diff --git a/decompiler/IR2/Form.h b/decompiler/IR2/Form.h index ffff0181d38..3f09a143045 100644 --- a/decompiler/IR2/Form.h +++ b/decompiler/IR2/Form.h @@ -1178,6 +1178,7 @@ class StringConstantElement : public FormElement { FormStack& stack, std::vector* result, bool allow_side_effects) override; + const std::string& value() const { return m_value; } private: std::string m_value; diff --git a/decompiler/IR2/GenericElementMatcher.cpp b/decompiler/IR2/GenericElementMatcher.cpp index e559e6dd375..11130e963bd 100644 --- a/decompiler/IR2/GenericElementMatcher.cpp +++ b/decompiler/IR2/GenericElementMatcher.cpp @@ -243,6 +243,15 @@ Matcher Matcher::let(bool is_star, return m; } +Matcher Matcher::unmerged_let(const std::vector& entries, + const std::vector& elts) { + Matcher m; + m.m_kind = Kind::UNMERGED_LET; + m.m_entry_matchers = entries; + m.m_sub_matchers = elts; + return m; +} + bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* const env) const { switch (m_kind) { case Kind::ANY: @@ -722,6 +731,64 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons return false; } + case Kind::UNMERGED_LET: { + auto as_let = dynamic_cast(input->try_as_single_active_element()); + if (as_let) { + size_t entries_matched = 0; + Form* innermost_let_body = nullptr; + // first try to find the innermost let, matching all let entries with the entry matchers + // throughout + as_let->apply_form([&](Form* form) { + for (int idx = 0; idx < form->size(); idx++) { + auto* f = form->at(idx); + // if this is the entry of the outermost let, try to do the first match + if (f->parent_form->parent_element == as_let) { + if (m_entry_matchers.at(entries_matched) + .do_match(as_let->entries().at(0), maps_out, env)) { + entries_matched++; + } else { + return; + } + } + auto let = dynamic_cast(f); + if (!let) { + continue; + } + + auto let_body = dynamic_cast(let->body()->at(0)); + if (!let_body) { + break; + } + + if (m_entry_matchers.at(entries_matched) + .do_match(let_body->entries().at(0), maps_out, env)) { + entries_matched++; + } else { + return; + } + + if (entries_matched == m_entry_matchers.size()) { + innermost_let_body = let_body->body(); + return; + } + } + }); + + if (entries_matched == m_entry_matchers.size() && innermost_let_body) { + // now match body of innermost let + for (int i = 0; i < (int)m_sub_matchers.size(); ++i) { + Form fake; + fake.elts().push_back(innermost_let_body->elts().at(i)); + if (!m_sub_matchers.at(i).do_match(&fake, maps_out, env)) { + return false; + } + } + return true; + } + } + return false; + } + default: ASSERT(false); return false; diff --git a/decompiler/IR2/GenericElementMatcher.h b/decompiler/IR2/GenericElementMatcher.h index 6ba41f32edb..d1c9d0fca99 100644 --- a/decompiler/IR2/GenericElementMatcher.h +++ b/decompiler/IR2/GenericElementMatcher.h @@ -76,6 +76,8 @@ class Matcher { static Matcher let(bool is_star, const std::vector& entries, const std::vector& elts); + static Matcher unmerged_let(const std::vector& entries, + const std::vector& elts); enum class Kind { ANY_REG, // matching any register @@ -106,6 +108,7 @@ class Matcher { QUOTED_SYMBOL, SAME_VAR, LET, + UNMERGED_LET, VAR_NAME, INVALID }; diff --git a/decompiler/analysis/find_defstates.cpp b/decompiler/analysis/find_defstates.cpp index 9cae8fafb3e..a5bdd6fe0f5 100644 --- a/decompiler/analysis/find_defstates.cpp +++ b/decompiler/analysis/find_defstates.cpp @@ -455,6 +455,110 @@ FormElement* rewrite_virtual_defstate( state_override); } +FormElement* rewrite_virtual_defstate_with_nonvirtual_inherit( + LetElement* elt, + const Env& env, + const std::string& expected_state_name, + FormPool& pool, + const std::unordered_map>& skip_states = {}) { + // (let ((gp-6 (new 'static 'state + // :name 'spinning + // :next #f + // :exit #f + // :parent #f + // :code #f + // :trans #f + // :post #f + // :enter #f + // :event #f + // ) + // ) + // ) + // (inherit-state gp-6 gun-yellow-3-saucer-base-state) + // (set! (-> gp-6 parent) gun-yellow-3-saucer-base-state) + // (method-set! gun-yellow-3-saucer 46 gp-6) + // (set! (-> gp-6 enter) L255) + // (set! (-> gp-6 exit) (the-as (function object) L251)) + // (set! (-> gp-6 trans) (the-as (function object) L253)) + // ) + + // ASSERT(elt->body()->size() > 1); + env.func->warnings.warning("Encountered virtual defstate {} with non-virtual inherit.", + expected_state_name); + // variable at the top of let, contains the static state with name exptected_state_name + auto state_var_from_let_def = elt->entries().at(0).dest; + // our index into the let body + int body_idx = 0; + + // the setup + auto first_in_body = elt->body()->at(body_idx); + auto inherit = dynamic_cast(first_in_body); + std::string parent_state; + if (inherit) { + parent_state = inherit->elts().at(1)->to_string(env); + } + body_idx += 2; + + // checks to check: method type is a state + // if inherit matches expected. + + // next, find (method-set! sunken-elevator 22 (the-as function gp-0)) + auto method_set_form = elt->body()->at(body_idx); + Form temp = Form(); + temp.elts().push_back(method_set_form); + auto mset_matcher = + Matcher::op(GenericOpMatcher::func(Matcher::symbol("method-set!")), + {Matcher::any_symbol(0), Matcher::any_integer(1), Matcher::any(2)}); + auto mset_mr = match(mset_matcher, &temp); + if (!mset_mr.matched) { + env.func->warnings.error_and_throw( + "Failed to recognize virtual defstate. Got a {} as the third thing, but was " + "expecting method-set! call", + temp.to_string(env)); + } + + // the actual type that gets this as a state + auto type_name = mset_mr.maps.strings.at(0); + auto method_id = mset_mr.maps.ints.at(1); + + // should be the state again. + auto val = strip_cast(mset_mr.maps.forms.at(2)->try_as_single_element()); + if (val->to_string(env) != env.get_variable_name(state_var_from_let_def)) { + env.func->warnings.error_and_throw( + "Variable name disagreement in virtual defstate: began with {}, but did method " + "set using {}", + val->to_string(env), env.get_variable_name(state_var_from_let_def)); + } + + // we should double check that the type in the defstate is correct + auto method_info = env.dts->ts.lookup_method(type_name, method_id); + if (method_info.type.base_type() != "state" || + method_info.type.last_arg().base_type() != "_type_") { + env.func->warnings.error_and_throw( + "Virtual defstate is defining a virtual state \"{}\" in method {} of {}, but the type " + "of this method is {}, which is not a valid virtual state type (must be " + "\"(state ... _type_)\")", + expected_state_name, method_info.name, type_name, method_info.type.print()); + } + + bool state_override = false; + + // name matches + if (expected_state_name != method_info.name) { + env.func->warnings.error_and_throw( + "Disagreement between state name and type system name. The state is named {}, " + "but the slot is named {}, defined in type {}", + expected_state_name, method_info.name, method_info.defined_in_type); + } + + auto entries = get_defstate_entries( + elt->body(), body_idx + 1, env, expected_state_name, elt->entries().at(0).dest, + method_info.type.substitute_for_method_call(type_name), pool, type_name, skip_states); + + return pool.alloc_element(type_name, expected_state_name, parent_state, entries, + true, state_override); +} + FormElement* rewrite_nonvirtual_defstate_with_inherit( LetElement* elt, const Env& env, @@ -482,7 +586,7 @@ FormElement* rewrite_nonvirtual_defstate_with_inherit( // (set! (-> gp-1 trans) (the-as (function object) L107)) // (set! (-> gp-1 code) L95) // ) - env.func->warnings.warning("Encountered non-virtual defstate {} with inherit.", + env.func->warnings.warning("Encountered non-virtual defstate {} with non-virtual inherit.", expected_state_name); ASSERT(elt->body()->size() > 0); int body_index = 0; @@ -532,6 +636,33 @@ bool is_nonvirtual_state_with_inherit(LetElement* elt) { return false; } +bool is_virtual_state_with_nonvirtual_inherit(LetElement* elt) { + if (elt->body()->size() >= 3) { + auto inherit = dynamic_cast(elt->body()->at(0)); + auto parent = dynamic_cast(elt->body()->at(1)); + auto method_set = dynamic_cast(elt->body()->at(2)); + if (!inherit || !parent || !method_set) { + return false; + } + std::vector forms = {inherit, parent, method_set}; + std::vector matchers = { + Matcher::op(GenericOpMatcher::func(Matcher::symbol("inherit-state")), + {Matcher::any_reg(0), Matcher::any_symbol(1)}), + Matcher::set(Matcher::deref(Matcher::any(), false, {DerefTokenMatcher::string("parent")}), + Matcher::any_symbol()), + Matcher::op(GenericOpMatcher::func(Matcher::symbol("method-set!")), + {Matcher::any_symbol(0), Matcher::any_integer(1), Matcher::any(2)})}; + for (size_t i = 0; i < matchers.size(); i++) { + auto mr = match(matchers.at(i), forms.at(i)); + if (!mr.matched) { + return false; + } + } + return true; + } + return false; +} + } // namespace void run_defstate( @@ -570,6 +701,12 @@ void run_defstate( if (rewritten) { fe = rewritten; } + } else if (is_virtual_state_with_nonvirtual_inherit(as_let)) { + auto rewritten = rewrite_virtual_defstate_with_nonvirtual_inherit( + as_let, env, expected_state_name, pool, skip_states); + if (rewritten) { + fe = rewritten; + } } else if (is_nonvirtual_state_with_inherit(as_let)) { auto rewritten = rewrite_nonvirtual_defstate_with_inherit( as_let, env, expected_state_name, pool, skip_states); diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index 9acd8981464..29d5a420e42 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -1239,15 +1239,18 @@ FormElement* rewrite_joint_macro(LetElement* in, const Env& env, FormPool& pool) } auto channel_form = mr_chan.int_or_form_to_form(pool, 0); - // now we checks for set!'s. the actual contents of the macro are not very complicated to match. + // now we check for set!'s. the actual contents of the macro are not very complicated to match. // there is just a LOT to match. and then to write! bool bad = false; int idx = 0; auto set_fi = match_ja_set(env, chan, "frame-interp", -1, in->body(), &idx, &bad); + auto set_fi1 = match_ja_set(env, chan, "frame-interp", 1, in->body(), &idx, &bad); + auto set_fi0 = match_ja_set(env, chan, "frame-interp", 0, in->body(), &idx, &bad); auto set_dist = match_ja_set(env, chan, "dist", -1, in->body(), &idx, &bad); auto set_fg = match_ja_set(env, chan, "frame-group", -1, in->body(), &idx, &bad); auto set_p0 = match_ja_set(env, chan, "param", 0, in->body(), &idx, &bad); auto set_p1 = match_ja_set(env, chan, "param", 1, in->body(), &idx, &bad); + auto set_p2 = match_ja_set(env, chan, "param", 2, in->body(), &idx, &bad); auto set_nf = match_ja_set(env, chan, "num-func", -1, in->body(), &idx, &bad); auto set_fn = match_ja_set(env, chan, "frame-num", -1, in->body(), &idx, &bad); @@ -1367,14 +1370,15 @@ FormElement* rewrite_joint_macro(LetElement* in, const Env& env, FormPool& pool) Form* num_form = nullptr; // check the num! arg if (prelim_num == "identity") { - if (env.version == GameVersion::Jak2 && set_fn && !set_fn2) { + if (env.version >= GameVersion::Jak2 && set_fn && !set_fn2) { // jak 2-specific made-up thing! // this has only appeared once so far. if (set_fn->to_form(env).is_float(0.0)) { num_form = pool.form("zero"); set_fn = nullptr; } else { - return nullptr; + num_form = pool.form( + GenericOperator::make_function(pool.form(prelim_num)), set_fn); } } else if (set_fn2) { auto obj_fn2 = set_fn2->to_form(env); @@ -1479,12 +1483,17 @@ FormElement* rewrite_joint_macro(LetElement* in, const Env& env, FormPool& pool) // other generic args ja_push_form_to_args(pool, args, set_fi, "frame-interp"); + ja_push_form_to_args(pool, args, set_fi0, "frame-interp0"); + ja_push_form_to_args(pool, args, set_fi1, "frame-interp1"); ja_push_form_to_args(pool, args, set_dist, "dist"); // ja_push_form_to_args(pool, args, form_fg, "frame-group"); ja_push_form_to_args(pool, args, set_p0, "param0"); ja_push_form_to_args(pool, args, set_p1, "param1"); + ja_push_form_to_args(pool, args, set_p2, "param2"); ja_push_form_to_args(pool, args, set_nf, "num-func"); - ja_push_form_to_args(pool, args, set_fn, "frame-num"); + if (arg_num_func != "num-func-identity") { + ja_push_form_to_args(pool, args, set_fn, "frame-num"); + } // TODO if (set_fn2) { @@ -1506,6 +1515,164 @@ FormElement* rewrite_joint_macro(LetElement* in, const Env& env, FormPool& pool) args); } +FormElement* rewrite_part_tracker_new(const std::string& type, + LetElement* in, + const Env& env, + FormPool& pool) { + // (let ((s4-11 (get-process *default-dead-pool* part-tracker #x4000 0))) + // (when s4-11 + // (let ((t9-26 (method-of-type part-tracker activate))) + // (t9-26 (the-as part-tracker s4-11) s5-1 "part-tracker" (the-as pointer #x70004000)) + // ) + // (let ((t9-27 run-function-in-process) + // (a0-84 s4-11) + // (a1-36 part-tracker-init) + // ) + // (set! (-> *part-tracker-params-default* group) (-> this collect-effect)) + // (set! (-> *part-tracker-params-default* duration) 0) + // (set! (-> *part-tracker-params-default* callback) part-tracker-track-target) + // (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) + // (set! (-> *part-tracker-params-default* target) #f) + // (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) + // ((the-as (function object object object none) t9-27) a0-84 a1-36 + // *part-tracker-params-default*) + // ) + // (-> s4-11 ppointer) + // ) + // ) + auto cond = dynamic_cast(in->body()->at(0)); + if (!cond) { + return nullptr; + } + auto when_body = cond->entries.at(0).body; + auto activate_let = dynamic_cast(when_body->at(0)); + if (!activate_let) { + return nullptr; + } + auto activate_matcher = Matcher::let( + false, + {LetEntryMatcher::any(Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::METHOD_OF_TYPE), + {Matcher::any(), Matcher::constant_token("activate")}), + 0)}, + {Matcher::func(Matcher::reg(Register(Reg::GPR, Reg::T9)), + {Matcher::any(), Matcher::any(1), Matcher::any(2), Matcher::any()})}); + auto activate_mr = match(activate_matcher, when_body->at(0)); + if (!activate_mr.matched) { + return nullptr; + } + auto name = activate_mr.maps.forms.find(2); + auto to = activate_mr.maps.forms.find(1); + auto params_let = dynamic_cast(when_body->at(1)); + if (!params_let) { + return nullptr; + } + auto part_tracker_subsampler_params_body_matcher = { + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("group")}), + Matcher::any(0)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("duration")}), + Matcher::any(1)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("callback")}), + Matcher::any(2)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("userdata")}), + Matcher::any(3)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("target")}), + Matcher::any(4)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("mat-joint")}), + Matcher::any(5)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-subsampler-params-default*"), + false, {DerefTokenMatcher::string("subsample-num")}), + Matcher::any(6)), + Matcher::any()}; + auto part_tracker_params_body_matcher = { + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("group")}), + Matcher::any(0)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("duration")}), + Matcher::any(1)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("callback")}), + Matcher::any(2)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("userdata")}), + Matcher::any(3)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("target")}), + Matcher::any(4)), + Matcher::set(Matcher::deref(Matcher::symbol("*part-tracker-params-default*"), false, + {DerefTokenMatcher::string("mat-joint")}), + Matcher::any(5)), + Matcher::any()}; + auto params_body_matcher = type == "part-tracker-subsampler" + ? part_tracker_subsampler_params_body_matcher + : part_tracker_params_body_matcher; + auto params_matcher = Matcher::unmerged_let( + {LetEntryMatcher::any(Matcher::symbol("run-function-in-process")), + LetEntryMatcher::any(Matcher::any()), LetEntryMatcher::any(Matcher::any())}, + params_body_matcher); + auto params_mr = match(params_matcher, when_body->at(1)); + if (!params_mr.matched) { + return nullptr; + } + + std::vector macro_args; + macro_args.push_back(pool.form(type)); + macro_args.push_back(pool.form(":to")); + macro_args.push_back(to->second); + auto name_str = dynamic_cast(name->second->try_as_single_element()); + if (name_str && name_str->value() != type) { + macro_args.push_back(pool.form(":name")); + macro_args.push_back(name->second); + } + auto group = params_mr.maps.forms.find(0); + macro_args.push_back(pool.form(":group")); + macro_args.push_back(group->second); + auto duration = params_mr.maps.forms.find(1); + if (duration->second->to_string(env) != "0") { + macro_args.push_back(pool.form(":duration")); + macro_args.push_back(duration->second); + } + auto callback = params_mr.maps.forms.find(2); + if (callback->second->to_string(env) != "#f") { + macro_args.push_back(pool.form(":callback")); + macro_args.push_back(callback->second); + } + auto userdata = params_mr.maps.forms.find(3); + if (userdata->second->to_string(env) != "(the-as uint #f)") { + macro_args.push_back(pool.form(":userdata")); + macro_args.push_back(userdata->second); + } + auto target = params_mr.maps.forms.find(4); + if (target->second->to_string(env) != "#f") { + macro_args.push_back(pool.form(":target")); + macro_args.push_back(target->second); + } + auto mat_joint = params_mr.maps.forms.find(5); + if (mat_joint->second->to_string(env) != "*launch-matrix*") { + macro_args.push_back(pool.form(":mat-joint")); + macro_args.push_back(mat_joint->second); + } + if (type == "part-tracker-subsampler") { + auto subsample_num = params_mr.maps.forms.find(6); + if (subsample_num->second->to_string(env) != "1.0") { + macro_args.push_back(pool.form(":subsample-num")); + macro_args.push_back(subsample_num->second); + } + } + + return pool + .form( + GenericOperator::make_function(pool.form("part-tracker-spawn")), + macro_args) + ->try_as_single_element(); +} + FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) { // this function checks for the process-spawn macros. // it uses recursive form scanning to wrap the macro inside a potential "shell" @@ -1530,6 +1697,13 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) { } const auto& proc_type = mr_get_proc.maps.strings.at(1); + + // part-tracker-spawn macro for jak 3 + if (env.version >= GameVersion::Jak3 && + (proc_type == "part-tracker" || proc_type == "part-tracker-subsampler")) { + return rewrite_part_tracker_new(proc_type, in, env, pool); + } + auto macro_form = is_full_let ? in->body()->at(0) : in->entries().at(1).src->try_as_single_element(); diff --git a/decompiler/analysis/mips2c.cpp b/decompiler/analysis/mips2c.cpp index 5645990dfd3..9fb30b3dc0f 100644 --- a/decompiler/analysis/mips2c.cpp +++ b/decompiler/analysis/mips2c.cpp @@ -716,6 +716,20 @@ Mips2C_Line handle_generic_op2(const Instruction& i0, instr_str}; } +Mips2C_Line handle_div_divu(const Instruction& i0, + const std::string& instr_str, + const std::string& op_name) { + return {fmt::format("c->{}({}, {});", op_name, reg_to_name(i0.get_src(0)), + reg_to_name(i0.get_src(1))), + instr_str}; +} + +Mips2C_Line handle_generic_op1(const Instruction& i0, + const std::string& instr_str, + const std::string& op_name) { + return {fmt::format("c->{}({});", op_name, reg_to_name(i0.get_dst(0))), instr_str}; +} + Mips2C_Line handle_plain_op(const Instruction& /*i0*/, const std::string& instr_str, const std::string& op_name) { @@ -1216,6 +1230,14 @@ Mips2C_Line handle_normal_instr(Mips2C_Output& output, return handle_vopmsub(i0, instr_str); case InstructionKind::PMFHL_LH: return handle_pmfhl_lh(i0, instr_str); + case InstructionKind::DIV: + return handle_div_divu(i0, instr_str, "div"); + case InstructionKind::DIVU: + return handle_div_divu(i0, instr_str, "divu"); + case InstructionKind::MFHI: + return handle_generic_op1(i0, instr_str, "mfhi"); + case InstructionKind::MFLO: + return handle_generic_op1(i0, instr_str, "mflo"); default: unknown_count++; return handle_unknown(instr_str); diff --git a/decompiler/config/jak3/all-types.gc b/decompiler/config/jak3/all-types.gc index d0bbb113f01..be56f86641f 100644 --- a/decompiler/config/jak3/all-types.gc +++ b/decompiler/config/jak3/all-types.gc @@ -19,6 +19,7 @@ (define-extern boolean type) ;; not actually added as a runtime type in jak2, but valid? supports it. (define-extern uint16 type) (define-extern uint32 type) +(define-extern int8 type) (define-extern int32 type) (define-extern int64 type) (define-extern uint8 type) @@ -1798,13 +1799,13 @@ "A 4x4 matrix, stored in row-major order. some, but not all, functions assume that a matrix is an affine transform. others assume that the rotation has no scale or shear (and that its inverse is its transpose)." - ((data float 16 :offset-assert 0 :score -2) ;; guessed by decompiler - (vector vector 4 :inline :offset 0 :score -1) ;; guessed by decompiler - (quad uint128 4 :offset 0) ;; guessed by decompiler - (rvec vector :inline :offset 0 :score 1) - (uvec vector :inline :offset 16 :score 1) - (fvec vector :inline :offset 32 :score 1) - (trans vector :inline :offset 48 :score 1) + ((data float 16 :offset-assert 0 :score -3) ;; guessed by decompiler + (vector vector 4 :inline :offset 0 :score -2) ;; guessed by decompiler + (quad uint128 4 :offset 0 :score -1) ;; guessed by decompiler + (rvec vector :inline :offset 0 :score 0) + (uvec vector :inline :offset 16 :score 0) + (fvec vector :inline :offset 32 :score 0) + (trans vector :inline :offset 48 :score 0) ) :method-count-assert 10 :size-assert #x40 @@ -2269,7 +2270,7 @@ (define-extern matrix-ur-compose (function matrix vector vector vector matrix)) (define-extern matrix-f-u-compose (function matrix vector vector vector matrix)) (define-extern matrix-f-r-compose (function matrix vector vector vector matrix)) -(define-extern matrix-u-f-compose (function matrix vector vector vector matrix)) +(define-extern matrix-u-f-compose (function matrix vector vector matrix)) (define-extern matrix-u-r-compose (function matrix vector vector vector matrix)) (define-extern matrix-r-f-compose (function matrix vector vector vector matrix)) (define-extern matrix-r-u-compose (function matrix vector vector vector matrix)) @@ -7635,6 +7636,7 @@ (declare-type light-hash basic) (declare-type engine basic) (declare-type game-text-info structure) +(declare-type text-id uint32) (deftype level (basic) ((name symbol :offset-assert 4) ;; guessed by decompiler (load-name symbol :offset-assert 8) ;; guessed by decompiler @@ -7740,7 +7742,7 @@ (debug-print-region-splitbox (_type_ vector object) none) ;; 20 (get-art-group-by-name "Look up art-group in this level by name." (_type_ string) art-group) ;; 21 (level-method-22 () none) ;; 22 ;; (level-method-22 (_type_ symbol) int) - (level-method-23 () none) ;; 23 ;; (lookup-text (_type_ text-id symbol) string) + (lookup-text (_type_ text-id symbol) string) ;; 23 (level-method-24 () none) ;; 24 ;; (level-method-24 () none) (birth "Start running a level." (_type_) _type_) ;; 25 (level-status-update! "Try to update the level to the given status, calling whatever is needed to make it happen. @@ -8302,8 +8304,8 @@ (moon-count int32 :offset-assert 232) (moon sparticle-launch-control :offset-assert 236) ;; guessed by decompiler (day-star-count int32 :offset-assert 240) - (day-star basic :offset-assert 244) - (day-star-enable basic :offset-assert 248) + (day-star sparticle-launch-control :offset-assert 244) + (day-star-enable symbol :offset-assert 248) (start-timer int32 :offset-assert 252) ) :method-count-assert 14 @@ -8757,7 +8759,7 @@ (progress-memcard-insufficient-space-retry? #x007f) (text-0080 #x0080) (text-0081 #x0081) - (text-0082 #x0082) + (press-triangle-to-talk #x0082) (text-0083 #x0083) (text-0084 #x0084) (text-0085 #x0085) @@ -9548,6 +9550,7 @@ ((id text-id :offset-assert 0) ;; guessed by decompiler (text string :offset-assert 4) ;; guessed by decompiler ) + :pack-me :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 @@ -9557,7 +9560,7 @@ ((length int32 :offset-assert 4) (language-id int32 :offset-assert 8) (group-name string :offset-assert 12) ;; guessed by decompiler - (data game-text :dynamic :offset-assert 16) ;; guessed by decompiler + (data game-text :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 10 :size-assert #x10 @@ -15982,7 +15985,7 @@ :size-assert #x60 :flag-assert #xf00000060 (:methods - (new (symbol type float float float vector float float) _type_) ;; 0 + (new (symbol type float float float vector shadow-flags float) _type_) ;; 0 (enable-draw (shadow-control) int) ;; 9 (disable-draw (shadow-control) int) ;; 10 (set-top-plane-offset (shadow-control float) int) ;; 11 @@ -18763,7 +18766,7 @@ :flag-assert #xd00000053 ;; field actor-option is likely a value type. (:methods - (new (symbol type process (pointer float) pickup-type float) _type_) ;; 0 + (new (symbol type process (pointer float)) _type_) ;; 0 (clear-mask-bits (_type_ int) none) ;; 12 ) ) @@ -18849,9 +18852,9 @@ (new (symbol type process) _type_) ;; 0 (compute-alignment! (_type_) transformq) ;; 9 (align! (_type_ align-opts float float float) trsqv) ;; 10 - (align-control-method-11 () none) ;; 11 ;; (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) - (align-control-method-12 () none) ;; 12 ;; (first-transform (_type_) transform) - (align-control-method-13 () none) ;; 13 ;; (second-transform (_type_) transform) + (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) ;; 11 + (first-transform (_type_) transform) ;; 12 + (second-transform (_type_) transform) ;; 13 ) ) @@ -18860,23 +18863,22 @@ ;; penetrate-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; +++game-h:knocked-type +;; +++penetrate-h:knocked-type (defenum knocked-type :type uint8 - (knocked-type-0 0) - (knocked-type-1 1) - (knocked-type-2 2) - (knocked-type-3 3) - (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) - (knocked-type-5 5) - (knocked-type-6 6) - (knocked-type-7 7) - (knocked-type-8 8) - (knocked-type-9 9) - (knocked-type-10 10) - ) -;; ---game-h:knocked-type - + (none 0) + (mech-punch 1) + (explode-or-darkjak 2) + (dark-shot 3) + (yellow-shot 4) + (red-shot 5) + (blue-shot 6) + (vehicle 7) + (knocked-off 8) + ) +;; ---penetrate-h:knocked-type + +;; +++penetrate-h:penetrate (defenum penetrate :type uint64 :bitfield #t @@ -18919,6 +18921,8 @@ (jak-dark-blackhole 36) (emp-blast 37) ) +;; ---penetrate-h:penetrate + (define-extern penetrate->string (function penetrate string)) (define-extern penetrate-using->damage (function penetrate float)) (define-extern penetrated-by-all&hit-points->penetrated-by (function penetrate int penetrate)) @@ -19372,6 +19376,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (declare-type continue-point basic) +(declare-type scene-player process) (deftype scene-actor (basic) ((name string :offset-assert 4) ;; guessed by decompiler @@ -19380,34 +19385,52 @@ (prefix string :offset-assert 16) ;; guessed by decompiler (draw-frames pair :offset-assert 20) ;; guessed by decompiler (scissor-frames pair :offset-assert 24) ;; guessed by decompiler - (shadow-frames basic :offset-assert 28) - (cloth-reset-frames basic :offset-assert 32) - (cloth-commands basic :offset-assert 36) + (shadow-frames pair :offset-assert 28) + (cloth-reset-frames pair :offset-assert 32) + (cloth-commands pair :offset-assert 36) (camera int16 :offset-assert 40) (light-index uint8 :offset-assert 42) (shadow-mask uint8 :offset-assert 43) (shadow-values uint32 :offset-assert 44) (flags uint32 :offset-assert 48) - (command-list basic :offset-assert 52) + (command-list pair :offset-assert 52) (shadow-flags int32 :offset-assert 56) (shadow-volume-joint basic :offset-assert 60) (draw-seg uint64 :offset-assert 64) (no-draw-seg uint64 :offset-assert 72) (last-frame float :offset-assert 80) - (process uint64 :offset-assert 88) ;; handle + (process handle :offset-assert 88) ;; handle ) :method-count-assert 10 :size-assert #x60 :flag-assert #xa00000060 (:methods - (scene-actor-method-9 () none) ;; 9 ;; (scene-actor-method-9 (_type_ scene-player) (pointer process)) + (setup-manipy-for-scene! (_type_ scene-player) (pointer process)) ;; 9 ) ) +;; +++scene-h:scene-flags (defenum scene-flags :bitfield #t :type uint32 - ) + (scf0 0) + (scf1 1) + (scf2 2) + (scf3 3) + (scf4 4) + (scf5 5) + (scf6 6) + (scf7 7) + (scf8 8) + (scf9 9) + (scf10 10) + (scf11 11) + (scf12 12) + (scf13 13) + (scf14 14) + (scf15 15) + ) +;; ---scene-h:scene-flags (deftype scene (art-group) ((scene-flags scene-flags :offset-assert 32) @@ -19422,24 +19445,24 @@ (wait-air-time time-frame :offset-assert 72) ;; time-frame (wait-ground-time time-frame :offset-assert 80) ;; time-frame (actor (array scene-actor) :offset-assert 88) ;; guessed by decompiler - (load-point continue-point :offset-assert 92) ;; guessed by decompiler - (end-point continue-point :offset-assert 96) ;; guessed by decompiler + (load-point basic :offset-assert 92) ;; guessed by decompiler + (end-point basic :offset-assert 96) ;; guessed by decompiler (borrow pair :offset-assert 100) ;; guessed by decompiler (sfx-volume float :offset-assert 104) (ambient-volume float :offset-assert 108) (music-volume float :offset-assert 112) (music-delay float :offset-assert 116) (scene-task uint16 :offset-assert 120) - (on-running basic :offset-assert 124) - (on-complete basic :offset-assert 128) + (on-running pair :offset-assert 124) + (on-complete pair :offset-assert 128) ) :method-count-assert 18 :size-assert #x84 :flag-assert #x1200000084 ;; field on-running uses ~A with a signed load. field on-complete uses ~A with a signed load. (:methods - (scene-method-16 () none) ;; 16 ;; (scene-method-16 (_type_) _type_) - (scene-method-17 () none) ;; 17 + (init-spool-by-scene! (_type_ spool-anim) spool-anim) ;; 16 + (load-scene (_type_) scene) ;; 17 ) ) @@ -19470,21 +19493,23 @@ (last-frame float :offset-assert 376) (end-point basic :offset-assert 380) (blackout-end basic :offset-assert 384) - (new-trans-hook basic :offset-assert 388) - (cur-trans-hook basic :offset-assert 392) + (new-trans-hook (function none) :offset-assert 388) + (cur-trans-hook (function none) :offset-assert 392) (user-data uint64 :offset-assert 400) ) :method-count-assert 26 :size-assert #x198 :flag-assert #x1a01200198 ;; field user-data uses ~A with a 64-bit load. + (:state-methods + (wait symbol) ;; 20 + release ;; 21 + play-anim ;; 22 + ) (:methods - (scene-player-method-20 () none) ;; 20 ;; (wait (symbol) _type_ :state) - (scene-player-method-21 () none) ;; 21 ;; (release () _type_ :state) - (scene-player-method-22 () none) ;; 22 ;; (play-anim () _type_ :state) - (scene-player-method-23 () none) ;; 23 ;; (scene-player-method-23 (_type_ string symbol) none) - (scene-player-method-24 () none) ;; 24 ;; (scene-player-method-24 (_type_ basic symbol) scene) - (scene-player-method-25 () none) ;; 25 ;; (scene-player-method-25 (_type_ float) none) + (scene-player-method-23 (_type_ string symbol) none) ;; 23 + (scene-player-method-24 (_type_ scene symbol) scene) ;; 24 + (scene-player-method-25 (_type_ float float) none) ;; 25 ) ) @@ -19701,11 +19726,11 @@ pov-camera-startup ;; 24 ) (:methods - (pov-camera-method-25 () none) ;; 25 ;; (abort? (_type_) symbol) - (pov-camera-method-26 () none) ;; 26 ;; (target-grabbed? (_type_) symbol) - (pov-camera-method-27 () none) ;; 27 ;; (pov-camera-method-27 () none) - (pov-camera-method-28 () none) ;; 28 ;; (pov-camera-method-28 () none) - (pov-camera-method-29 () none) ;; 29 ;; (target-released? (_type_) symbol) + (abort? (_type_) symbol) ;; 25 + (target-grabbed? (_type_) symbol) ;; 26 + (set-stack-size! (_type_) none) ;; 27 + (pov-camera-method-28 (_type_) none) ;; 28 + (target-released? (_type_) symbol) ;; 29 ) ) @@ -20374,6 +20399,8 @@ :flag-assert #x900000020 ) +(declare-type collide-query structure) +(declare-type collide-cache-prim structure) (deftype collide-shape-prim (basic) "Base class for collide primitives." ((cshape collide-shape :offset-assert 4) ;; guessed by decompiler @@ -20402,7 +20429,7 @@ (collide-shape-prim-method-13 () none) ;; 13 ;; (overlaps-others-group (_type_ overlaps-others-params collide-shape-prim-group) symbol) (collide-shape-prim-method-14 () none) ;; 14 ;; (collide-shape-prim-method-14 () none) (collide-shape-prim-method-15 () none) ;; 15 ;; (collide-with-collide-cache-prim-mesh (_type_ collide-query collide-cache-prim) none) - (collide-shape-prim-method-16 () none) ;; 16 ;; (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none) ;; 16 (collide-shape-prim-method-17 () none) ;; 17 ;; (on-platform-test (_type_ collide-shape-prim collide-query float) none) (collide-shape-prim-method-18 () none) ;; 18 ;; (should-push-away-test (_type_ collide-shape-prim collide-query) none) (collide-shape-prim-method-19 () none) ;; 19 ;; (should-push-away-a-group-test (_type_ collide-shape-prim-group collide-query) none) @@ -20511,8 +20538,8 @@ (set-collide-with! (_type_ collide-spec) none) ;; 47 (set-collide-as! (_type_ collide-spec) none) ;; 48 (collide-shape-method-49 () none) ;; 49 ;; (modify-collide-as! (_type_ int collide-spec collide-spec) none) - (collide-shape-method-50 () none) ;; 50 ;; (send-shoves (_type_ process touching-shapes-entry float float float) symbol) - (collide-shape-method-51 () none) ;; 51 ;; (above-ground? (_type_ collide-query vector collide-spec float float float) symbol) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol) ;; 50 + (above-ground? (_type_ collide-query vector collide-spec float float float) symbol) ;; 51 (water-info-init! (_type_ water-info collide-action) water-info) ;; 52 (collide-shape-method-53 () none) ;; 53 ;; (iterate-prims (_type_ (function collide-shape-prim none)) none) (collide-shape-method-54 () none) ;; 54 ;; (pusher-init (_type_) none) @@ -20583,11 +20610,14 @@ ;; ---collide-shape-h:collide-status (declare-type collide-query structure) +(declare-type rigid-body-control basic) (deftype collide-shape-moving (collide-shape) "A [[collide-shape]] for moving objects." ((rider-time time-frame :offset-assert 200) ;; time-frame (rider-last-move vector :inline :offset-assert 208) (trans-old vector :inline :offset-assert 224) + (trans-old-old vector :inline :offset 240) ;; added + (trans-old-old-old vector :inline :offset 256) ;; added (poly-pat pat-surface :offset 272) ;; guessed by decompiler (cur-pat pat-surface :offset-assert 276) ;; guessed by decompiler (ground-pat pat-surface :offset-assert 280) ;; guessed by decompiler @@ -20626,11 +20656,11 @@ (collide-shape-moving-method-60 () none) ;; 60 ;; (move-to-ground (_type_ float float symbol collide-spec) none) (move-to-ground-point (_type_ vector vector vector) none) ;; 61 (compute-acc-due-to-gravity (_type_ vector float) vector) ;; 62 - (collide-shape-moving-method-63 () none) ;; 63 ;; (collide-shape-moving-method-63 (_type_ rigid-body float) none) + (rbody-collision (_type_ rigid-body-control float) none) ;; 63 (collide-shape-moving-method-64 () none) ;; 64 ;; (try-snap-to-surface (_type_ vector float float float) symbol) (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol) ;; 65 (collide-shape-moving-method-66 () none) ;; 66 ;; (step-collison! (_type_ vector vector float int) float) - (collide-shape-moving-method-67 () none) ;; 67 ;; (collide-with-all-collide-cache-prims (_type_ matrix collide-query) none) + (collide-with-all-collide-cache-prims (_type_ matrix collide-query) none) ;; 67 ) ) @@ -21381,9 +21411,9 @@ :flag-assert #xd000000e8 (:methods (touching-prims-entry-method-9 () none) ;; 9 ;; (get-middle-of-bsphere-overlap (_type_ vector) vector) - (touching-prims-entry-method-10 () none) ;; 10 ;; (get-touched-prim (_type_ collide-shape touching-shapes-entry) collide-shape-prim) - (touching-prims-entry-method-11 () none) ;; 11 ;; (get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result) - (touching-prims-entry-method-12 () none) ;; 12 + (touching-prims-entry-method-10 () none) ;; 10 + (get-touched-prim (_type_ collide-shape touching-shapes-entry) collide-shape-prim) ;; 11 + (get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result) ;; 12 ) ) @@ -21421,7 +21451,7 @@ (:methods (get-head (_type_) touching-prims-entry) ;; 9 (get-next (_type_ touching-shapes-entry) touching-prims-entry) ;; 10 - (touching-shapes-entry-method-11 () none) ;; 11 ;; (get-touched-shape (_type_ collide-shape) collide-shape) + (get-touched-shape (_type_ collide-shape) collide-shape) ;; 11 (prims-touching? (_type_ collide-shape uint) touching-prims-entry) ;; 12 (prims-touching-action? (_type_ collide-shape collide-action collide-action) basic) ;; 13 (touching-shapes-entry-method-14 () none) ;; 14 ;; (free-touching-prims-list (_type_) none) @@ -21746,6 +21776,15 @@ (defenum process-taskable-flags :type uint32 :bitfield #t + (ptf0 0) + (ptf1 1) + (ptf2 2) + (ptf3 3) + (ptf4 4) + (ptf5 5) + (ptf6 6) + (ptf7 7) + (ptf8 8) ) ;; ---process-taskable-h:process-taskable-flags @@ -21774,13 +21813,13 @@ (play-game game-task-event) ) (:methods - (process-taskable-method-33 () none) ;; 33 ;; (init-art! (_type_) none) - (process-taskable-method-34 () none) ;; 34 ;; (process-taskable-method-34 (_type_) symbol) - (process-taskable-method-35 () none) ;; 35 ;; (get-art-elem (_type_) art-element) - (process-taskable-method-36 () none) ;; 36 ;; (process-taskable-method-36 (_type_) none) - (process-taskable-method-37 () none) ;; 37 ;; (process-taskable-method-37 (_type_) none) - (process-taskable-method-38 () none) ;; 38 - (process-taskable-method-39 () none) ;; 39 + (init-collision! (_type_) none) ;; 33 + (init-defaults! (_type_) none) ;; 34 + (init-skeleton! (_type_) none) ;; 35 + (process-taskable-method-36 (_type_) symbol) ;; 36 + (get-art-element (_type_) art-element) ;; 37 + (process-taskable-method-38 (_type_) none) ;; 38 + (update-cloth-and-shadow (_type_) none) ;; 39 ) ) @@ -21798,7 +21837,7 @@ :flag-assert #xd0000000c (:methods (clear-focused "Reset the focus' handle." (_type_) none) ;; 9 - (collide-check? + (collide-spec-match? "If the focused process is not dead, check that the [[collide-spec]] of the focus and the process match." (_type_ process-focusable) object) ;; 10 @@ -21852,10 +21891,10 @@ (new (symbol type process-drawable) _type_) ;; 0 (effect-control-method-9 (_type_) none) ;; 9 (do-effect (_type_ symbol float int) none) ;; 10 - (effect-control-method-11 () none) ;; 11 ;; (do-effect-for-surface (_type_ symbol float int basic pat-surface) none) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none) ;; 11 (play-effect-sound (_type_ symbol float int basic sound-name) int) ;; 12 (set-channel-offset! (_type_ int) none) ;; 13 - (effect-control-method-14 () none) ;; 14 ;; (play-effects-from-res-lump (_type_ float float float) none) + (play-effects-from-res-lump (_type_ float float float) none) ;; 14 ) ) @@ -22274,7 +22313,7 @@ (num-children int8 :offset-assert 147) (old-param0 basic :offset-assert 148) (hit-sound sound-name :offset-assert 160) - (ground-pat uint32 :offset-assert 176) + (ground-pat pat-surface :offset-assert 176) (user0 int32 :offset-assert 180) (original-speed float :offset-assert 184) ) @@ -22295,7 +22334,7 @@ (rf5 5) (rf6 6) (rf7 7) - (rf8 8) + (mirror 8) (rf9 9) (rf10 10) (rf11 11) @@ -22350,7 +22389,7 @@ (ragdoll-method-17 (_type_ process-drawable) none) ;; 17 (ragdoll-method-18 (_type_) none) ;; 18 (ragdoll-method-19 (_type_ vector int object vector) none) ;; 19 - (ragdoll-method-20 (_type_ vector) none) ;; 20 + (reset-vec! (_type_ vector) none) ;; 20 (ragdoll-method-21 (_type_ vector vector float) vector) ;; 21 (get-max-angle-for-joint-idx (_type_ int) degrees) ;; 22 (ragdoll-method-23 (_type_ vector vector float symbol) none) ;; 23 @@ -22372,9 +22411,9 @@ ) (:methods (ragdoll-proc-method-15 (_type_ symbol vector symbol) none) ;; 15 - (ragdoll-proc-method-16 (_type_ int) none) ;; 16 - (ragdoll-proc-method-17 (_type_ matrix) none) ;; 17 - (ragdoll-proc-method-18 (_type_ ragdoll-edit-info process) none) ;; 18 + (disable-for-duration (_type_ time-frame) none) ;; 16 + (ragdoll-proc-method-17 (_type_ ragdoll-edit-info) none) ;; 17 + (ragdoll-proc-method-18 (_type_ ragdoll-edit-info) none) ;; 18 (ragdoll-proc-method-19 (_type_) none) ;; 19 ) ) @@ -22465,7 +22504,7 @@ (sound-id sound-id :offset-assert 464) ;; guessed by decompiler (stop-speed meters :offset-assert 468) (invinc-time time-frame :offset-assert 472) ;; time-frame - (desired-target uint64 :offset-assert 480) + (desired-target handle :offset-assert 480) (desired-target-pos vector :inline :offset-assert 496) ) :method-count-assert 41 @@ -22485,11 +22524,11 @@ (play-impact-sound (_type_ projectile-options) none) ;; 28 (projectile-method-29 (_type_) none) ;; 29 ;; (stop-sound! (_type_) none) (setup-collision! (_type_) none) ;; 30 - (projectile-method-31 (_type_) none) ;; 31 ;; (init-proj-settings! (_type_) none) + (init-proj-settings! (_type_) none) ;; 31 (projectile-method-32 (_type_) none) ;; 32 ;; (go-moving! (_type_) none) (go-impact! (_type_) none) ;; 33 ;; (go-sitting! (_type_) none) (projectile-method-34 (_type_) none) ;; 34 ;; (kill-projectile! (_type_) symbol) - (event-handler! (_type_ process int symbol event-message-block) object) ;; 35 + (proj-event-handler (_type_ process int symbol event-message-block) object) ;; 35 (handle-proj-hit! (_type_ process event-message-block) object) ;; 36 (deal-damage! (_type_ process event-message-block) symbol) ;; 37 (made-impact? (_type_) symbol) ;; 38 @@ -22502,7 +22541,7 @@ ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) (target-pos vector :inline :offset-assert 32) - (target-handle uint64 :offset-assert 48) + (target-handle handle :offset-assert 48) (ent entity :offset-assert 56) ;; guessed by decompiler (charge float :offset-assert 60) (attack-id uint32 :offset-assert 64) @@ -22510,7 +22549,7 @@ (notify-handle handle :offset-assert 80) ;; handle (owner-handle handle :offset-assert 88) ;; handle (ignore-handle handle :offset-assert 96) ;; handle - (timeout time-frame :offset-assert 104) ;; time-frame + (timeout time-frame :offset-assert 104) ;; time-frame (damage float :offset-assert 112) (vehicle-damage-factor float :offset-assert 116) (vehicle-impulse-factor float :offset-assert 120) @@ -22521,7 +22560,7 @@ ) (deftype projectile-bounce (projectile) - ((played-bounce-time time-frame :offset-assert 512) ;; time-frame + ((played-bounce-time time-frame :offset-assert 512) ;; time-frame (tumble-quat quaternion :inline :offset-assert 528) (gravity float :offset-assert 544) ) @@ -22642,6 +22681,7 @@ (defenum target-anim :type int32 (uninitialized -2) + (unknown -1) (default 0) (board 1) (dark 2) @@ -22782,14 +22822,14 @@ target-hide target-float (target-grab symbol) - (target-play-anim string handle) ;; associated process guessed by decompiler, old: (state string handle target) - (target-clone-anim handle) ;; associated process guessed by decompiler, old: (state handle target) - (target-continue continue-point) ;; associated process guessed by decompiler, old: (state continue-point target) + (target-play-anim string handle) + (target-clone-anim handle) + (target-continue continue-point) (target-blast-recover rigid-body-impact) - (target-warp-in vector vector) ;; associated process guessed by decompiler, old: (state vector vector target target) - target-warp-out ;; associated process guessed by decompiler, old: (state vector vector target target) + (target-warp-in vector vector object) + (target-warp-out vector vector handle) target-launch-dir - (target-death symbol) ;; associated process guessed by decompiler, old: (state symbol target) + (target-death symbol) ;; general states target-stance target-stance-ambient @@ -22799,8 +22839,8 @@ target-attack target-running-attack (target-attack-air symbol) - (target-attack-uppercut float float) ;; associated process guessed by decompiler, old: (state float float target) - (target-attack-uppercut-jump float float) ;; associated process guessed by decompiler, old: (state float float target) + (target-attack-uppercut float float) + (target-attack-uppercut-jump float float) target-roll (target-roll-flip float float) target-turn-around @@ -22818,7 +22858,7 @@ (target-duck-walk symbol) (target-duck-high-jump float float symbol) (target-duck-high-jump-jump float float symbol) - (target-hit symbol attack-info) ;; associated process guessed by decompiler, old: (state symbol attack-info target) + (target-hit symbol attack-info) target-slide-down-to-ground ;; gun target-gun-stance @@ -22915,7 +22955,7 @@ ;; pilot (target-racing-start handle) (target-grab-ride handle) - (target-pilot-edge-grab pilot-edge-grab-info) ;; associated process guessed by decompiler, old: (state pilot-edge-grab-info target) + (target-pilot-edge-grab pilot-edge-grab-info) (target-pilot-start handle symbol symbol) target-pilot-get-on target-pilot-get-off @@ -23407,7 +23447,7 @@ (collide-cache-method-9 () none) ;; 9 ;; (debug-draw (_type_) none) (fill-and-probe-using-line-sphere (_type_ collide-query) float) ;; 10 (fill-and-probe-using-spheres (_type_ collide-query) symbol) ;; 11 - (collide-cache-method-12 () none) ;; 12 ;; (fill-using-bounding-box (_type_ collide-query) none) + (fill-using-bounding-box (_type_ collide-query) none) ;; 12 (fill-using-line-sphere (_type_ collide-query) none) ;; 13 (collide-cache-method-14 () none) ;; 14 ;; (fill-using-spheres (_type_ collide-query) none) (collide-cache-method-15 () none) ;; 15 ;; (reset (_type_) none) @@ -27786,7 +27826,7 @@ (path-control-method-15 () none) ;; 15 ;; (displacement-between-points-at-percent-scaled! (_type_ vector float float) vector) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) ;; 16 (get-num-segments (_type_) float) ;; 17 - (path-control-method-18 () none) ;; 18 ;; (total-distance (_type_) float) + (total-distance (_type_) float) ;; 18 (get-num-verts (_type_) int) ;; 19 (segement-duration->path-duration (_type_ float) float) ;; 20 (path-duration->segment-duration (_type_ float) float) ;; 21 @@ -28210,13 +28250,13 @@ (nav-state-method-31 () none) ;; 31 ;; (navigate-using-best-dir-recompute-avoid-spheres-2 (_type_) none) (nav-state-method-32 () none) ;; 32 ;; (update-travel-dir-from-spheres (_type_) none) (nav-state-method-33 () none) ;; 33 ;; (compute-speed-simple (_type_) none) - (nav-state-method-34 () none) ;; 34 ;; (navigate-v1! (_type_) none) + (navigate-v1! (_type_) none) ;; 34 (nav-state-method-35 () none) ;; 35 ;; (reset-target! (_type_) none) (nav-state-method-36 () none) ;; 36 ;; (add-offset-to-target! (_type_ vector) none) (nav-state-method-37 () none) ;; 37 ;; (navigate-v2! (_type_) none) (nav-state-method-38 () none) ;; 38 ;; (set-current-poly! (_type_ nav-poly) none) (nav-state-method-39 () none) ;; 39 ;; (nav-state-method-39 (_type_) symbol) - (nav-state-method-40 () none) ;; 40 ;; (do-navigation-to-destination (_type_ vector) none) + (do-navigation-to-destination (_type_ vector) none) ;; 40 (nav-state-method-41 () none) ;; 41 ;; (clamp-vector-to-mesh-cross-gaps (_type_ vector) symbol) (nav-state-method-42 () none) ;; 42 ;; (set-target-post! (_type_ vector) none) (nav-state-method-43 () none) ;; 43 ;; (set-travel! (_type_ vector) none) @@ -28268,7 +28308,7 @@ (nav-control-method-9 () none) ;; 9 ;; (debug-draw (_type_) none) (nav-control-method-10 () none) ;; 10 ;; (point-in-bsphere? (_type_ vector) symbol) (find-poly-containing-point-1 (_type_ vector) nav-poly) ;; 11 - (nav-control-method-12 () none) ;; 12 ;; (cloest-point-on-mesh (_type_ vector vector nav-poly) nav-poly) + (cloest-point-on-mesh (_type_ vector vector nav-poly) nav-poly) ;; 12 (nav-control-method-13 () none) ;; 13 ;; (find-nearest-poly-to-point (_type_ vector) nav-poly) (nav-control-method-14 () none) ;; 14 ;; (project-point-onto-plane-of-poly (_type_ nav-poly vector vector vector) none) (nav-control-method-15 () none) ;; 15 ;; (find-poly-containing-point-2 (_type_ vector) nav-poly) @@ -28534,7 +28574,7 @@ :size-assert #xbc :flag-assert #xa000000bc (:methods - (rigid-body-info-method-9 () none) ;; 9 ;; (rigid-body-info-method-9 (_type_) none) + (rigid-body-info-method-9 (_type_) none) ;; 9 ;; (rigid-body-info-method-9 (_type_) none) ) ) @@ -28582,7 +28622,7 @@ (velocity vector :inline :offset-assert 32) (impulse float :offset-assert 48) (pat pat-surface :offset-assert 52) ;; guessed by decompiler - (process basic :offset-assert 56) + (process process :offset-assert 56) (prim-id uint32 :offset-assert 60) ) :method-count-assert 9 @@ -28590,12 +28630,13 @@ :flag-assert #x900000040 ) +(declare-type rigid-body-object basic) (deftype rigid-body-control (basic) ((flags rigid-body-flag :offset-assert 4) (info rigid-body-info :offset-assert 8) - (force-callback basic :offset-assert 12) + (force-callback (function rigid-body-object float none) :offset-assert 12) (process process :offset-assert 16) ;; guessed by decompiler - (blocked-by basic :offset-assert 20) + (blocked-by process-focusable :offset-assert 20) (time-remaining float :offset-assert 24) (step-count int16 :offset-assert 28) (linear-damping float :offset-assert 32) @@ -28618,32 +28659,32 @@ :size-assert #x130 :flag-assert #x2200000130 (:methods - (new (symbol type) _type_) ;; 0 ;; (new (symbol type process) _type_) - (rigid-body-control-method-9 () none) ;; 9 ;; (rigid-body-control-method-9 (_type_ collide-shape-moving float) none) - (rigid-body-control-method-10 () none) ;; 10 ;; (rigid-body-control-method-10 (_type_ rigid-body-object float float) object) - (rigid-body-control-method-11 () none) ;; 11 ;; (rigid-body-control-method-11 (_type_ collide-shape-moving) none) - (rigid-body-control-method-12 () none) ;; 12 ;; (rigid-body-control-method-12 (_type_ float) none) - (rigid-body-control-method-13 () none) ;; 13 ;; (rigid-body-control-method-13 (_type_) none) - (rigid-body-control-method-14 () none) ;; 14 ;; (rigid-body-control-method-14 (_type_ float) none) - (rigid-body-control-method-15 () none) ;; 15 ;; (clear-force-torque! (_type_) none) - (rigid-body-control-method-16 () none) ;; 16 ;; (clear-momentum! (_type_) none) - (rigid-body-control-method-17 () none) ;; 17 ;; (rigid-body-control-method-17 (_type_ vector vector) none) - (rigid-body-control-method-18 () none) ;; 18 ;; (rigid-body-control-method-18 (_type_ vector vector) none) - (rigid-body-control-method-19 () none) ;; 19 ;; (rigid-body-control-method-19 (_type_ vector) none) - (rigid-body-control-method-20 () none) ;; 20 ;; (rigid-body-control-method-20 (_type_ vector vector float) none) - (rigid-body-control-method-21 () none) ;; 21 ;; (rigid-body-control-method-21 (_type_ vector vector) vector) - (rigid-body-control-method-22 () none) ;; 22 ;; (rigid-body-control-method-22 (_type_ vector) vector) - (rigid-body-control-method-23 () none) ;; 23 ;; (rigid-body-control-method-23 (_type_) none) - (rigid-body-control-method-24 () none) ;; 24 ;; (rigid-body-control-method-24 (_type_ rigid-body-info vector quaternion basic) none) - (rigid-body-control-method-25 () none) ;; 25 ;; (rigid-body-control-method-25 (_type_ vector quaternion) none) - (rigid-body-control-method-26 () none) ;; 26 - (rigid-body-control-method-27 () none) ;; 27 - (rigid-body-control-method-28 () none) ;; 28 - (rigid-body-control-method-29 () none) ;; 29 - (rigid-body-control-method-30 () none) ;; 30 - (rigid-body-control-method-31 () none) ;; 31 - (rigid-body-control-method-32 () none) ;; 32 - (rigid-body-control-method-33 () none) ;; 33 + (new (symbol type process) _type_) ;; 0 + (rigid-body-control-method-9 (_type_ collide-shape-moving float) none) ;; 9 + (rigid-body-control-method-10 (_type_ rigid-body-object float float) object) ;; 10 + (update-rbody-transform! (_type_ collide-shape-moving) none) ;; 11 + (rigid-body-control-method-12 (_type_ float) none) ;; 12 + (init-velocities! (_type_) none) ;; 13 + (rigid-body-control-method-14 (_type_ float) none) ;; 14 + (rigid-body-control-method-15 (_type_) none) ;; 15 + (reset-force-and-torque! (_type_) none) ;; 16 + (reset-momentum! (_type_) none) ;; 17 + (apply-impact! (_type_ vector vector) none) ;; 18 + (rigid-body-control-method-19 (_type_ vector vector) none) ;; 19 + (add-force! (_type_ vector) none) ;; 20 + (rigid-body-control-method-21 (_type_ vector vector float) none) ;; 21 + (rigid-body-control-method-22 (_type_ vector vector) none) ;; 22 + (rigid-body-control-method-23 (_type_ vector vector) none) ;; 23 + (rigid-body-control-method-24 (_type_ vector vector) none) ;; 24 + (rigid-body-control-method-25 (_type_ vector) none) ;; 25 + (rigid-body-control-method-26 (_type_) none) ;; 26 + (init! (_type_ rigid-body-info vector quaternion (function rigid-body-object float)) none) ;; 27 + (rigid-body-control-method-28 (_type_ vector quaternion) none) ;; 28 + (debug-print-info (_type_ object) none) ;; 29 + (debug-print-force-torque (_type_ object) none) ;; 30 + (debug-print-pos-rot (_type_ object) none) ;; 31 + (debug-print-momentum (_type_ object) none) ;; 32 + (debug-print-velocity (_type_ object) none) ;; 33 ) ) @@ -28661,55 +28702,57 @@ :size-assert #x120 :flag-assert #x3800a00120 ;; field rigid-body-object-flag is likely a value type. + (:state-methods + idle ;; 28 + active ;; 29 + ) (:methods - (rigid-body-object-method-28 () none) ;; 28 ;; (active () _type_ :state) - (rigid-body-object-method-29 () none) ;; 29 ;; (rigid-body-object-method-29 (_type_ float) none) - (rigid-body-object-method-30 () none) ;; 30 ;; (rigid-body-object-method-30 (_type_) none) - (rigid-body-object-method-31 () none) ;; 31 ;; (alloc-and-init-rigid-body-control (_type_ rigid-body-object-constants) none) - (rigid-body-object-method-32 () none) ;; 32 ;; (allocate-and-init-cshape (_type_) none) - (rigid-body-object-method-33 () none) ;; 33 ;; (init-skel-and-rigid-body (_type_) none) - (rigid-body-object-method-34 () none) ;; 34 ;; (rigid-body-object-method-34 (_type_) none) - (rigid-body-object-method-35 () none) ;; 35 ;; (rigid-body-object-method-35 (_type_) none) - (rigid-body-object-method-36 () none) ;; 36 ;; (do-engine-sounds (_type_) none) - (rigid-body-object-method-37 () none) ;; 37 ;; (rigid-body-object-method-37 (_type_) none) - (rigid-body-object-method-38 () none) ;; 38 ;; (rigid-body-object-method-38 (_type_) none) - (rigid-body-object-method-39 () none) ;; 39 ;; (rigid-body-object-method-39 (_type_) none) - (rigid-body-object-method-40 () none) ;; 40 ;; (rigid-body-object-method-40 (_type_) none) - (rigid-body-object-method-41 () none) ;; 41 ;; (rigid-body-object-method-41 (_type_) none) - (rigid-body-object-method-42 () none) ;; 42 ;; (rigid-body-object-method-42 (_type_) none) - (rigid-body-object-method-43 () none) ;; 43 ;; (rigid-body-object-method-43 (_type_) none) - (rigid-body-object-method-44 () none) ;; 44 ;; (apply-damage (_type_ float rigid-body-impact) none) - (rigid-body-object-method-45 () none) ;; 45 ;; (rigid-body-object-method-45 (_type_ rigid-body-impact) none) - (rigid-body-object-method-46 () none) ;; 46 ;; (rigid-body-object-method-46 (_type_ process-drawable int symbol event-message-block) object) - (rigid-body-object-method-47 () none) ;; 47 ;; (rigid-body-object-method-47 (_type_ process-drawable attack-info touching-shapes-entry penetrate) symbol) - (rigid-body-object-method-48 () none) ;; 48 ;; (rigid-body-object-method-48 (_type_ process-focusable touching-shapes-entry) symbol) - (rigid-body-object-method-49 () none) ;; 49 ;; (rigid-body-object-method-49 (_type_ rigid-body-impact touching-shapes-entry) none) - (rigid-body-object-method-50 () none) ;; 50 ;; (rigid-body-object-method-50 (_type_ float) none) - (rigid-body-object-method-51 () none) ;; 51 ;; (rigid-body-object-method-51 (_type_) none) - (rigid-body-object-method-52 () none) ;; 52 ;; (rigid-body-object-method-52 (_type_) none) - (rigid-body-object-method-53 () none) ;; 53 - (rigid-body-object-method-54 () none) ;; 54 - (rigid-body-object-method-55 () none) ;; 55 + (rigid-body-object-method-30 (_type_) none) ;; 30 + (apply-gravity! (_type_ float) none) ;; 31 + (rigid-body-object-method-32 (_type_) none) ;; 32 + (alloc-rbody-control! (_type_ rigid-body-object-constants) none) ;; 33 ;; (init-skel-and-rigid-body (_type_) none) + (init-collision! (_type_) none) ;; 34 + (init-rbody-control! (_type_) none) ;; 35 + (go-idle (_type_) object) ;; 36 ;; (do-engine-sounds (_type_) none) + (rigid-body-object-method-37 (_type_) none) ;; 37 + (rigid-body-object-method-38 (_type_) none) ;; 38 + (rbody-post (_type_) none) ;; 39 + (apply-momentum! (_type_) none) ;; 40 + (disable-physics! (_type_) none) ;; 41 + (rigid-body-object-method-42 (_type_) none) ;; 42 + (rigid-body-object-method-43 (_type_) none) ;; 43 + (impulse-handler (_type_) none) ;; 44 ;; (apply-damage (_type_ float rigid-body-impact) none) + (go-active (_type_) object) ;; 45 + (rigid-body-object-method-46 (_type_) none) ;; 46 + (impulse-force<-penetrate (_type_ rigid-body-impact attack-info penetrate) none) ;; 47 + (rigid-body-object-method-48 (_type_) none) ;; 48 + (rbody-event-handler (_type_ process int symbol event-message-block) object) ;; 49 + (attack-handler (_type_ process-drawable attack-info touching-shapes-entry penetrate) symbol) ;; 50 + (touch-handler (_type_ process-focusable touching-shapes-entry) symbol) ;; 51 + (init-rbody-impact-from-tshape! (_type_ rigid-body-impact touching-shapes-entry) none) ;; 52 + (rigid-body-object-method-53 (_type_ float) none) ;; 53 + (rigid-body-object-method-54 (_type_) none) ;; 54 + (clear-impulse-force-flag! (_type_) none) ;; 55 ) ) (deftype rigid-body-queue (structure) ((count int8 :offset-assert 0) - (manager uint64 :offset-assert 8) + (manager handle :offset-assert 8) (array handle 128 :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 17 :size-assert #x410 :flag-assert #x1100000410 (:methods - (rigid-body-queue-method-9 () none) ;; 9 ;; (rigid-body-queue-method-9 (_type_) none) - (rigid-body-queue-method-10 () none) ;; 10 ;; (rigid-body-queue-method-10 (_type_) none) - (rigid-body-queue-method-11 () none) ;; 11 ;; (rigid-body-queue-method-11 (_type_ rigid-body-object) none) - (rigid-body-queue-method-12 () none) ;; 12 ;; (rigid-body-queue-method-12 (_type_ int int) none) - (rigid-body-queue-method-13 () none) ;; 13 ;; (rigid-body-queue-method-13 (_type_ int rigid-body-object) none) - (rigid-body-queue-method-14 () none) ;; 14 ;; (rigid-body-queue-method-14 (_type_ int) none) - (rigid-body-queue-method-15 () none) ;; 15 ;; (rigid-body-queue-method-15 (_type_ rigid-body-object) none) - (rigid-body-queue-method-16 () none) ;; 16 ;; (validate (_type_) symbol) + (init-queue! (_type_ process) none) ;; 9 + (rigid-body-queue-method-10 (_type_) none) ;; 10 ;; (rigid-body-queue-method-10 (_type_) none) + (rigid-body-queue-method-11 (_type_ process int) none) ;; 11 ;; (rigid-body-queue-method-11 (_type_ rigid-body-object) none) + (rigid-body-queue-method-12 (_type_ int int) none) ;; 12 ;; (rigid-body-queue-method-12 (_type_ int int) none) + (rigid-body-queue-method-13 (_type_ int process) none) ;; 13 ;; (rigid-body-queue-method-13 (_type_ int rigid-body-object) none) + (rigid-body-queue-method-14 (_type_ int) none) ;; 14 ;; (rigid-body-queue-method-14 (_type_ int) none) + (rigid-body-queue-method-15 (_type_ process) none) ;; 15 ;; (rigid-body-queue-method-15 (_type_ rigid-body-object) none) + (rigid-body-queue-method-16 (_type_) none) ;; 16 ;; (validate (_type_) symbol) ) ) @@ -29025,7 +29068,7 @@ (define-extern joint-anim-login "Login a joint-anim-drawable by calling login on all drawables" (function joint-anim-drawable joint-anim-drawable)) (define-extern joint-anim-inspect-elt "Inspect an uncompressed anim (unused)" (function joint-anim float joint-anim)) (define-extern jacc-mem-usage "Compute memory usage stats for a compressed joint anim." (function joint-anim-compressed-control memory-usage-block int joint-anim-compressed-control)) -(define-extern joint-control-cleanup "Remove all animations that are stored on the given heap and return those slots to a safe default." (function joint-control kheap art-joint-anim none)) +(define-extern joint-control-cleanup "Remove all animations that are stored on the given heap and return those slots to a safe default." (function joint-control kheap art-joint-anim symbol)) (define-extern joint-control-channel-eval "Run the num-func to produce the current frame for this channel." (function joint-control-channel float :behavior process)) (define-extern joint-control-channel-eval! "Update the num-func for this channel and evaluate it." (function joint-control-channel (function joint-control-channel float float float float) float :behavior process)) (define-extern joint-control-channel-group-eval! (function joint-control-channel art-joint-anim (function joint-control-channel float float float float) int)) @@ -30243,8 +30286,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern *sky-texture-anim-array* (texture-anim-array texture-anim)) -;; (define-extern set-fog-height! function) ;; (function float none) -;; (define-extern set-cloud-minmax! function) ;; (function float float none) +(define-extern set-fog-height! (function float none)) +(define-extern set-cloud-minmax! (function float float none)) (define-extern *darkjak-texture-anim-array* (texture-anim-array texture-anim)) ;; (define-extern set-darkjak-texture-morph! function) ;; (function float none) (define-extern *darkjak-highres-texture-anim-array* (texture-anim-array texture-anim)) @@ -30821,7 +30864,7 @@ (define-extern *part-id-table* (array sparticle-launcher)) (define-extern *part-group-id-table* (array sparticle-launch-group)) (define-extern *sp-temp* float) -;; (define-extern lookup-part-group-by-name function) ;; (function string sparticle-launch-group) +(define-extern lookup-part-group-by-name (function string sparticle-launch-group)) (define-extern lookup-part-group-pointer-by-name (function string (pointer object))) (define-extern part-group-pointer? (function pointer symbol)) (define-extern unlink-part-group-by-heap (function kheap int)) @@ -31360,9 +31403,9 @@ (define-extern palette-select-special (function mood-context-core3 symbol)) (define-extern clear-mood-times (function mood-context symbol)) ;; -;; (define-extern update-mood-itimes function) ;; (function mood-context none) +(define-extern update-mood-itimes (function mood-context none)) ;; (define-extern update-mood-direction function) ;; (function mood-context-core3 mood-table float float) -;; (define-extern update-mood-exterior function) ;; (function mood-context-core3 mood-table float int object) +(define-extern update-mood-exterior (function mood-context-core3 mood-table float int object)) ;; (define-extern copy-mood-exterior function) ;; (function mood-context symbol) ;; (define-extern copy-mood-exterior-ambi function) ;; (function mood-context symbol none) (define-extern clear-mood-context (function mood-context symbol)) @@ -31553,7 +31596,7 @@ ) |# -;; (define-extern update-mood-default function) ;; (function mood-context float int none :behavior time-of-day-proc) +(define-extern update-mood-default (function mood-context float int none :behavior time-of-day-proc)) ;; (define-extern update-mood-copy-parent function) ;; (define-extern get-sphere-interp function) ;; (function sphere vector float float float) ;; (define-extern update-mood-ctywide function) ;; (function mood-context float int none :behavior time-of-day-proc) @@ -31727,13 +31770,13 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern group-rain-screend-drop sparticle-launch-group) -;; (define-extern update-snow function) ;; (function float vector vector none) +(define-extern update-snow (function float vector vector none)) ;; (define-extern birth-func-omega-normal-orient function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) ;; (define-extern birth-func-rain function) ;; (function sparticle-system sparticle-cpuinfo sprite-vec-data-3d sparticle-launcher sparticle-launch-state none) ;; (define-extern check-drop-level-rain function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern check-drop-level-rain2 function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern check-drop-level-splash function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern update-rain function) ;; (function float vector vector none) +(define-extern update-rain (function float vector vector none)) (define-extern cam-master-effect (function none :behavior camera-master)) ;; (define-extern sparticle-track-sun function) ;; (function int sparticle-cpuinfo matrix none) @@ -31741,21 +31784,21 @@ ;; time-of-day ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern time-of-day-effect object) ;; (function none) -;; (define-extern time-of-day-update function) ;; (function none :behavior time-of-day-proc) -;; (define-extern update-counters function) ;; (function float :behavior time-of-day-proc) -;; (define-extern time-of-day-tick state) ;; (state time-of-day-proc) -;; (define-extern init-time-of-day function) ;; (function object :behavior time-of-day-proc) -;; (define-extern start-time-of-day function) ;; (function (pointer process)) -;; (define-extern time-of-day-setup function) ;; (function symbol symbol) +(define-extern time-of-day-effect (function none)) +(define-extern time-of-day-update (function none :behavior time-of-day-proc)) +(define-extern update-counters (function float :behavior time-of-day-proc)) +(define-extern time-of-day-tick (state time-of-day-proc)) +(define-extern init-time-of-day (function object :behavior time-of-day-proc)) +(define-extern start-time-of-day (function (pointer time-of-day-proc))) +(define-extern time-of-day-setup (function symbol symbol)) (define-extern time-of-day-interp-colors (function (pointer rgba) uint mood-context none)) (define-extern time-of-day-interp-colors-scratch (function (pointer rgba) time-of-day-palette mood-context none)) (define-extern init-time-of-day-context (function time-of-day-context symbol)) -;; (define-extern set-filter-color! function) ;; (function float float float none) -;; (define-extern tod-madd! function) ;; (function vector vector vector float) -;; (define-extern update-environment-colors function) ;; (function time-of-day-context vector) +(define-extern set-filter-color! (function float float float none)) +(define-extern tod-madd! (function vector vector vector float)) +(define-extern update-environment-colors (function time-of-day-context vector)) (define-extern update-time-of-day (function time-of-day-context none)) -;; (define-extern calc-fade-from-fog function) ;; (function vector float) +(define-extern calc-fade-from-fog (function vector float)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; sky-data ;; @@ -32136,18 +32179,18 @@ ;; game-text-info is already defined! -;; (define-extern *expand-buf-number* object) ;; int -;; (define-extern *game-text-word* object) ;; string -;; (define-extern *game-text-line* object) ;; string -;; (define-extern *expanded-text-line0* object) ;; string -;; (define-extern *expanded-text-line1* object) ;; string -;; (define-extern *level-text-file-load-flag* object) ;; symbol -;; (define-extern convert-korean-text function) ;; (function string string) -;; (define-extern text-is-loading object) ;; symbol -;; (define-extern load-game-text-info function) ;; (function string (pointer object) kheap int) +(define-extern *expand-buf-number* int) +(define-extern *game-text-word* string) +(define-extern *game-text-line* string) +(define-extern *expanded-text-line0* string) +(define-extern *expanded-text-line1* string) +(define-extern *level-text-file-load-flag* symbol) +(define-extern convert-korean-text (function string string)) +(define-extern text-is-loading symbol) +(define-extern load-game-text-info (function string (pointer object) kheap int)) (define-extern load-level-text-files (function int none)) -;; (define-extern draw-debug-text-box function) ;; (function font-context none) -;; (define-extern print-game-text-scaled function) ;; (function string float font-context bucket-id none) +(define-extern draw-debug-text-box (function font-context none)) +(define-extern print-game-text-scaled (function string float font-context bucket-id none)) (define-extern print-game-text (function string font-context symbol int bucket-id float)) (define-extern disable-level-text-file-loading (function none)) (define-extern enable-level-text-file-loading (function none)) @@ -32315,7 +32358,7 @@ (define-extern collide-shape-moving-angle-set! (function collide-shape-moving vector vector none)) (define-extern cshape-reaction-update-state (function control-info collide-query vector none)) (define-extern cshape-reaction-default (function control-info collide-query vector vector collide-status)) -;; (define-extern cshape-reaction-just-move function) ;; (function control-info collide-query vector collide-status) +(define-extern cshape-reaction-just-move (function control-info collide-query vector collide-status)) (define-extern collide-shape-draw-debug-marks (function none)) ;; (define-extern *col-timer* object) ;; stopwatch ;; (define-extern *frame-timer* object) ;; stopwatch @@ -33194,6 +33237,7 @@ (constraint-length-sqd float :offset-assert 8) (particle0 uint16 :offset-assert 12) (particle1 uint16 :offset-assert 14) + (vec vector :inline :offset 0 :score -1) ;; added ) :method-count-assert 9 :size-assert #x10 @@ -33922,7 +33966,7 @@ (define-extern touch-tracker-init (function vector float time-frame none :behavior touch-tracker)) (define-extern explosion-init-by-other (function explosion-init-params object :behavior explosion)) (define-extern explosion-spawn-legacy-version (function process-drawable type explosion-init-params (pointer process))) -(define-extern explosion-spawn (function process-drawable type explosion-init-params none)) +(define-extern explosion-spawn (function explosion-init-params process-drawable none)) (define-extern find-closest-solid-sphere-prim (function collide-shape vector collide-spec collide-shape-prim)) (define-extern *explosion-debug-sphere* sphere) (define-extern process-drawable-random-point! (function process-drawable vector vector)) @@ -34354,7 +34398,15 @@ ;; particle-curves ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++particle-curves:particle-curve-flags +(defenum particle-curve-flags + :type uint64 + :bitfield #t + (pcf0 0) + (pcf1 1) + ) +;; ---particle-curves:particle-curve-flags + (deftype particle-curve-settings (structure) ((color-start basic :offset-assert 0) (alpha-start basic :offset-assert 4) @@ -34366,25 +34418,24 @@ (a-scalar basic :offset-assert 28) (scale-x-scalar basic :offset-assert 32) (scale-y-scalar basic :offset-assert 36) - (lifetime-base uint64 :offset-assert 40) - (lifetime-offset uint64 :offset-assert 48) - (flags uint64 :offset-assert 56) + (lifetime-base time-frame :offset-assert 40) + (lifetime-offset time-frame :offset-assert 48) + (flags particle-curve-flags :offset-assert 56) ) :method-count-assert 9 :size-assert #x40 :flag-assert #x900000040 ) -|# -;; (define-extern birth-func-curve function) -;; (define-extern live-func-curve function) -;; (define-extern *alpha-fast* curve2d-fast) -;; (define-extern *unity-fast* curve2d-fast) -;; (define-extern *ccro* curve-color-fast) -;; (define-extern *scale-curve* curve2d-fast) -;; (define-extern *scale-range* curve2d-fast) -;; (define-extern *part-function-curve-test-curve-settings* object) -;; (define-extern ptest function) +(define-extern birth-func-curve (function int sparticle-cpuinfo sparticle-launchinfo none)) +(define-extern live-func-curve (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern *alpha-fast* curve2d-fast) +(define-extern *unity-fast* curve2d-fast) +(define-extern *ccro* curve-color-fast) +(define-extern *scale-curve* curve2d-fast) +(define-extern *scale-range* curve2d-fast) +(define-extern *part-function-curve-test-curve-settings* particle-curve-settings) +(define-extern ptest (function none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; light-trails ;; @@ -35336,17 +35387,17 @@ ;; (define-extern *curve-explo-scale-y* curve2d-fast) ;; (define-extern *part-gun-red3-explosion-texture-curve-settings* object) ;; (define-extern *curve-linear-up-red* object) -;; (define-extern *red-shot-3-trail* object) +(define-extern *red-shot-3-trail* light-trail-composition) ;; (define-extern *curve-yellow2-shot-alpha* object) ;; (define-extern *curve-yellow2-shot-color* curve-color-fast) ;; (define-extern *curve-linear-down-long* curve2d-fast) -;; (define-extern *yellow-shot-2-trail* object) +(define-extern *yellow-shot-2-trail* light-trail-composition) ;; (define-extern check-shell-level1 function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern check-shell-level2 function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern sparticle-dark-shot-lightning function) ;; (function sparticle-system sparticle-cpuinfo vector none) ;; (define-extern sparticle-track-gun-joint-3d function) ;; (define-extern sparticle-track-gun-joint-player-y function) -;; (define-extern *last-player-pos* object) +(define-extern *last-player-pos* vector) ;; (define-extern birth-func-converge function) ;; (define-extern sparticle-red-2-converge function) ;; (define-extern sparticle-red-2-glow-trail-halt function) @@ -36005,7 +36056,7 @@ (define-extern gun-init (function none :behavior gun)) (define-extern do-fire-backcheck (function vector vector symbol)) (define-extern get-remaining-player-ammo (function pickup-type float)) -(define-extern adjust-player-ammo (function int pickup-type float)) +(define-extern adjust-player-ammo (function float pickup-type float)) (define-extern adjust-player-ammo-over-time (function int float pickup-type float float)) (define-extern truncate-player-ammo (function pickup-type none)) (define-extern *last-gun-fire-time* last-gun-fire-time) @@ -36242,266 +36293,246 @@ ;; gun-yellow-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-yellow-shot (projectile) ((hit-actor? symbol :offset-assert 512) ;; guessed by decompiler (tail-pos vector :inline :offset-assert 528) (hit-pos vector :inline :offset-assert 544) - (last-hit-time uint64 :offset-assert 560) - (snd-whoosh uint32 :offset-assert 568) - (muzzle-flash-part basic :offset-assert 572) - (main-shot-part basic :offset-assert 576) - (shot-aim-part basic :offset-assert 580) - (shot-ring-part basic :offset-assert 584) + (last-hit-time time-frame :offset-assert 560) + (snd-whoosh sound-id :offset-assert 568) + (muzzle-flash-part sparticle-launcher :offset-assert 572) + (main-shot-part sparticle-launcher :offset-assert 576) + (shot-aim-part sparticle-launcher :offset-assert 580) + (shot-ring-part sparticle-launcher :offset-assert 584) ) :method-count-assert 44 :size-assert #x24c :flag-assert #x2c01d0024c (:methods - (gun-yellow-shot-method-41 () none) ;; 41 - (gun-yellow-shot-method-42 () none) ;; 42 - (gun-yellow-shot-method-43 () none) ;; 43 + (draw-main-shot (_type_ vector vector) none) ;; 41 + (gun-yellow-shot-method-42 (_type_ float float matrix) none) ;; 42 + (spawn-particles (_type_ vector) none) ;; 43 ) ) -|# -#| (deftype gun-yellow-2-proc-ignore (structure) - ((hand uint64 :offset-assert 0) - (time uint64 :offset-assert 8) + ((hand handle :offset-assert 0) + (time time-frame :offset-assert 8) ) + :pack-me :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype gun-yellow-shot-2 (gun-yellow-shot) - ((last-collide-time uint64 :offset-assert 592) - (snd-trail uint32 :offset-assert 600) - (hit-yet? basic :offset-assert 604) - (actor-deflect? basic :offset-assert 608) + ((last-collide-time time-frame :offset-assert 592) + (snd-trail sound-id :offset-assert 600) + (hit-yet? symbol :offset-assert 604) + (actor-deflect? symbol :offset-assert 608) (max-actor-deflect-count int32 :offset-assert 612) - (last-hit-enemy uint64 :offset-assert 616) - (delay-attack uint64 :offset-assert 624) + (last-hit-enemy handle :offset-assert 616) + (delay-attack time-frame :offset-assert 624) (delay-norm vector :inline :offset-assert 640) (enemy-hit-count int32 :offset-assert 656) - (ignore-list UNKNOWN 6 :offset-assert 664) - (last-attack-time uint64 :offset-assert 760) + (ignore-list gun-yellow-2-proc-ignore 6 :inline :offset-assert 664) + (last-attack-time time-frame :offset-assert 760) ) :method-count-assert 48 :size-assert #x300 :flag-assert #x3002800300 - (:methods - (gun-yellow-shot-2-method-44 () none) ;; 44 - (gun-yellow-shot-2-method-45 () none) ;; 45 - (gun-yellow-shot-2-method-46 () none) ;; 46 - (gun-yellow-shot-2-method-47 () none) ;; 47 - ) (:state-methods impact ;; 22 ) + (:methods + (on-impact (_type_ handle) object) ;; 44 + (handle-impact (_type_ handle) object) ;; 45 + (is-in-ignore-list? (_type_ handle) symbol) ;; 46 + (add-to-ignore-list! (_type_ handle) int) ;; 47 + ) ) -|# -#| (deftype gun-yellow-shot-3 (gun-yellow-shot) () :method-count-assert 44 :size-assert #x24c :flag-assert #x2c01d0024c ) -|# -#| (deftype gun-yellow-3-saucer (projectile-bounce) - ((total-float-time uint64 :offset-assert 552) - (state-time uint64 :offset-assert 192) - (firing? basic :offset-assert 568) - (asleep? basic :offset-assert 572) - (first-fire-time uint64 :offset-assert 576) - (activated? basic :offset-assert 584) - (collided-with-surface? basic :offset-assert 588) - (last-deflect-time uint64 :offset-assert 592) - (last-fire-time uint64 :offset-assert 600) - (spawn-part basic :offset-assert 608) - (last-blink-time uint64 :offset-assert 616) - (finished? basic :offset-assert 624) + ((total-float-time time-frame :offset-assert 552) + (firing? symbol :offset 568) + (asleep? symbol :offset-assert 572) + (first-fire-time time-frame :offset-assert 576) + (activated? symbol :offset-assert 584) + (collided-with-surface? symbol :offset-assert 588) + (last-deflect-time time-frame :offset-assert 592) + (last-fire-time time-frame :offset-assert 600) + (spawn-part sparticle-launch-control :offset-assert 608) + (last-blink-time time-frame :offset-assert 616) + (finished? symbol :offset-assert 624) (initial-fire-dir vector :inline :offset-assert 640) (initial-fire-pos vector :inline :offset-assert 656) - (last-deduct-ammo-time uint64 :offset-assert 672) + (last-deduct-ammo-time time-frame :offset-assert 672) (total-ammo-drained float :offset-assert 680) (total-ammo-to-drain float :offset-assert 684) - (total-fire-time uint64 :offset-assert 688) - (snd-hum uint32 :offset-assert 696) - (snd-shoot uint32 :offset-assert 700) + (total-fire-time time-frame :offset-assert 688) + (snd-hum sound-id :offset-assert 696) + (snd-shoot sound-id :offset-assert 700) ) :method-count-assert 54 :size-assert #x2c0 :flag-assert #x36024002c0 - (:methods - (gun-yellow-3-saucer-method-44 () none) ;; 44 - (gun-yellow-3-saucer-method-50 () none) ;; 50 - (gun-yellow-3-saucer-method-51 () none) ;; 51 - (gun-yellow-3-saucer-method-52 () none) ;; 52 - (gun-yellow-3-saucer-method-53 () none) ;; 53 - ) (:state-methods - spinning ;; 46 + moving ;; 23 + sitting ;; 41 + undefined ;; 44 navigating ;; 45 + spinning ;; 46 impact-explode ;; 47 falling-down ;; 48 - moving ;; 23 - burnt-husk ;; 49 - sitting ;; 41 + burnt-husk + ) + (:methods + (start-firing (_type_) none) ;; 50 + (init-antigrav (_type_) none) ;; 51 + (find-targets (_type_) int) ;; 52 + (spawn-shot (_type_ vector) (pointer gun-yellow-shot-3)) ;; 53 ) (:states gun-yellow-3-saucer-base-state ) ) -|# -#| (deftype target-quality-info-saucer (structure) - ((targ uint64 :offset-assert 0) + ((targ handle :offset-assert 0) (value float :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype gun-yellow-3-event-msg (structure) - ((activated? basic :offset-assert 0) - (finished? basic :offset-assert 4) + ((activated? symbol :offset-assert 0) + (finished? symbol :offset-assert 4) ) :method-count-assert 9 :size-assert #x8 :flag-assert #x900000008 ) -|# -;; (define-extern saucer-land-move function) -;; (define-extern gun-fire-yellow-3 function) -;; (define-extern gun-fire-yellow-2 function) -;; (define-extern gun-fire-yellow-1 function) +(define-extern saucer-land-move (function gun-yellow-3-saucer none)) +(define-extern gun-fire-yellow-3 (function object :behavior target)) +(define-extern gun-fire-yellow-2 (function (pointer gun-yellow-shot-2) :behavior target)) +(define-extern gun-fire-yellow-1 (function (pointer gun-yellow-shot) :behavior target)) (define-extern target-gun-can-fire-yellow? (function pickup-type symbol :behavior target)) (define-extern target-gun-fire-yellow (function pickup-type (pointer process) :behavior target)) -;; (define-extern someone-fire-yellow function) ;; (function process-drawable vector vector (pointer process)) -;; (define-extern gun-yellow-shot-move function) ;; (function gun-yellow-shot none) -;; (define-extern *last-hit-deflect-target-handle* object) -;; (define-extern gun-yellow-shot-do-deflect function) -;; (define-extern gun-yellow-deflect-reaction function) -;; (define-extern gun-yellow-shot-2-move function) +(define-extern someone-fire-yellow (function process-drawable vector vector (pointer process))) +(define-extern gun-yellow-shot-move (function gun-yellow-shot none)) +(define-extern *last-hit-deflect-target-handle* (pointer process)) +(define-extern gun-yellow-shot-do-deflect (function gun-yellow-shot-2 vector vector vector none :behavior gun-yellow-shot-2)) +(define-extern gun-yellow-deflect-reaction (function control-info collide-query vector vector collide-status)) +(define-extern gun-yellow-shot-2-move (function gun-yellow-shot-2 none)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-red-shot ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype gun-red-shot (process-drawable) - ((probe-count int32 :offset-assert 200) - (probe-mask uint32 :offset-assert 204) - (actor-count int32 :offset-assert 208) - (attack-id uint32 :offset-assert 212) - (start-pos vector :inline :offset-assert 224) - (start-dir vector :inline :offset-assert 240) - (start-rot vector :inline :offset-assert 256) - (probe-dir vector 19 :offset-assert 272) ;; guessed by decompiler + ((parent (pointer gun) :override) + (root collide-shape-moving :override) + (probe-count int32 :offset-assert 200) + (probe-mask uint32 :offset-assert 204) + (actor-count int32 :offset-assert 208) + (attack-id uint32 :offset-assert 212) + (start-pos vector :inline :offset-assert 224) + (start-dir vector :inline :offset-assert 240) + (start-rot vector :inline :offset-assert 256) + (probe-dir vector 19 :inline :offset-assert 272) ;; guessed by decompiler ) :method-count-assert 30 :size-assert #x240 :flag-assert #x1e01c00240 - (:methods - (gun-red-shot-method-23 () none) ;; 23 ;; (init-probes! (_type_ collide-shape) none) - (gun-red-shot-method-24 () none) ;; 24 ;; (gun-red-shot-method-24 (_type_) symbol) - (gun-red-shot-method-25 () none) ;; 25 ;; (noop (_type_) none) - (gun-red-shot-method-26 () none) ;; 26 ;; (gun-red-shot-method-26 (_type_) none) - (gun-red-shot-method-27 () none) ;; 27 ;; (gun-red-shot-method-27 (_type_) none) - (gun-red-shot-method-28 () none) ;; 28 ;; (gun-red-shot-method-28 (_type_ vector) sound-id) - (gun-red-shot-method-29 () none) ;; 29 ;; (fire! (_type_ process-drawable int) object) - ) (:state-methods - idle ;; 22, old: (idle () _type_ :state) - blocked ;; 20, old: (blocked () _type_ :state) - debug-idle ;; 21, old: (debug-idle () _type_ :state) + blocked ;; 20 + debug-idle ;; 21 + idle ;; 22 + ) + (:methods + (init-probes! (_type_ collide-shape) none) ;; 23 + (gun-red-shot-method-24 (_type_) none) ;; 24 ;; (gun-red-shot-method-24 (_type_) symbol) + (stub (_type_) none) ;; 25 + (do-collision (_type_) none) ;; 26 ;; (gun-red-shot-method-26 (_type_) none) + (gun-red-shot-method-27 (_type_) none) ;; 27 ;; (gun-red-shot-method-27 (_type_) none) + (gun-red-shot-method-28 (_type_ vector) none) ;; 28 ;; (gun-red-shot-method-28 (_type_ vector) sound-id) + (gun-red-shot-method-29 (_type_ process-drawable touching-shapes-entry) none) ;; 29 ;; (fire! (_type_ process-drawable int) object) ) ) -|# -#| (deftype gun-red-3-grenade (projectile-bounce) ((blast-radius float :offset-assert 548) - (should-explode-soon? basic :offset-assert 552) - (explode-tick-time uint64 :offset-assert 560) - (birth-time uint64 :offset-assert 568) - (immediate-detonation? basic :offset-assert 576) - (attack-id uint32 :offset-assert 444) - (explode-delay-time uint64 :offset-assert 584) + (should-explode-soon? symbol :offset-assert 552) + (explode-tick-time time-frame :offset-assert 560) + (birth-time time-frame :offset-assert 568) + (immediate-detonation? symbol :offset-assert 576) + (explode-delay-time time-frame :offset-assert 584) ) :method-count-assert 48 :size-assert #x250 :flag-assert #x3001d00250 - (:methods - (gun-red-3-grenade-method-45 () none) ;; 45 - (gun-red-3-grenade-method-46 () none) ;; 46 - (gun-red-3-grenade-method-47 () none) ;; 47 - ) (:state-methods impact ;; 22 - impact-tiny ;; 44 - sitting ;; 41 moving ;; 23 + sitting ;; 41 + impact-tiny ;; 44 + ) + (:methods + (check-should-explode (_type_) int) ;; 45 + (go-impact (_type_) object) ;; 46 + (find-and-damage-targets (_type_) object) ;; 47 ) ) -|# -#| (deftype shockwave-collision-pt (structure) ((collision-pt vector :inline :offset-assert 0) (normal vector :inline :offset-assert 16) - (found? basic :offset-assert 32) - (angle float :offset-assert 36) + (found? symbol :offset-assert 32) + (angle degrees :offset-assert 36) ) :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype gun-red-2-shockwave (process) ((origin vector :inline :offset-assert 128) (max-radius float :offset-assert 144) (strength float :offset-assert 148) (current-radius float :offset-assert 152) (current-intensity float :offset-assert 156) - (state-time uint64 :offset-assert 160) + (state-time time-frame :offset-assert 160) (alpha-scalar float :offset-assert 168) (base-damage float :offset-assert 172) - (snd-charge uint32 :offset-assert 176) + (snd-charge sound-id :offset-assert 176) (min-charge-radius float :offset-assert 180) (max-charge-radius float :offset-assert 184) - (total-charge-time uint64 :offset-assert 192) - (total-explode-time uint64 :offset-assert 200) - (ring-expansion-time uint64 :offset-assert 208) - (burst-expansion-time uint64 :offset-assert 216) - (warp-expansion-time uint64 :offset-assert 224) - (previously-attacked-targets UNKNOWN 64 :offset-assert 232) + (total-charge-time time-frame :offset-assert 192) + (total-explode-time time-frame :offset-assert 200) + (ring-expansion-time time-frame :offset-assert 208) + (burst-expansion-time time-frame :offset-assert 216) + (warp-expansion-time time-frame :offset-assert 224) + (previously-attacked-targets handle 64 :offset-assert 232) (num-previously-attacked-targets int8 :offset-assert 744) - (start-pilot? basic :offset-assert 748) - (explosion-0 uint64 :offset-assert 752) - (explosion-1 uint64 :offset-assert 760) - (generate-order-array UNKNOWN 127 :offset-assert 768) + (start-pilot? symbol :offset-assert 748) + (explosion-0 handle :offset-assert 752) + (explosion-1 handle :offset-assert 760) + (generate-order-array uint8 127 :offset-assert 768) (current-stage-t float :offset-assert 896) (ammo-drained float :offset-assert 900) - (eventual-collision-points UNKNOWN 128 :offset-assert 912) + (eventual-collision-points shockwave-collision-pt 128 :inline :offset-assert 912) (next-computed-collision-point int8 :offset-assert 7056) (num-collision-pts-to-generate int8 :offset-assert 7057) - (show-scorch-marks? basic :offset-assert 7060) + (show-scorch-marks? symbol :offset-assert 7060) (height-off-ground float :offset-assert 7064) (max-ground-radius float :offset-assert 7068) (current-ring-radius float :offset-assert 7072) @@ -36510,35 +36541,34 @@ (current-warp-alpha float :offset-assert 7084) (current-burst-radius float :offset-assert 7088) (current-burst-alpha float :offset-assert 7092) - (generating-marks? basic :offset-assert 7096) - (generated-particles? basic :offset-assert 7100) - (charge-part-tracker uint64 :offset-assert 7104) + (generating-marks? symbol :offset-assert 7096) + (generated-particles? symbol :offset-assert 7100) + (charge-part-tracker handle :offset-assert 7104) ) :method-count-assert 28 :size-assert #x1bc8 :flag-assert #x1c1b501bc8 - (:methods - (gun-red-2-shockwave-method-17 () none) ;; 17 - (gun-red-2-shockwave-method-18 () none) ;; 18 - (gun-red-2-shockwave-method-19 () none) ;; 19 - (gun-red-2-shockwave-method-20 () none) ;; 20 - (gun-red-2-shockwave-method-21 () none) ;; 21 - (gun-red-2-shockwave-method-22 () none) ;; 22 - (gun-red-2-shockwave-method-23 () none) ;; 23 - (gun-red-2-shockwave-method-24 () none) ;; 24 - (gun-red-2-shockwave-method-25 () none) ;; 25 - (gun-red-2-shockwave-method-26 () none) ;; 26 - (gun-red-2-shockwave-method-27 () none) ;; 27 - ) (:state-methods + charging ;; 14 explode ;; 15 die ;; 16 - charging ;; 14 + ) + (:methods + (gun-red-2-shockwave-method-17 (_type_) none) ;; 17 + (send-attack! (_type_ process-focusable symbol) none) ;; 18 + ;; adding _type_ here causes decompiler hang + (gun-red-2-shockwave-method-19 () none) ;; 19 + (gun-red-2-shockwave-method-20 (_type_) none) ;; 20 + (gun-red-2-shockwave-method-21 (_type_) none) ;; 21 + (gun-red-2-shockwave-method-22 (_type_ int int int int) none) ;; 22 + (generate-shockwave-particles (_type_) none) ;; 23 + (adjust-warp-radius-and-alpha (_type_) object) ;; 24 + (adjust-ring-radius-and-alpha (_type_) none) ;; 25 + (generate-collision-points (_type_) none) ;; 26 + (spawn-ring (_type_) none) ;; 27 ) ) -|# -#| (deftype gun-red-2-shockwave-init-params (structure) ((pos vector :inline :offset-assert 0) (max-radius float :offset-assert 16) @@ -36548,38 +36578,33 @@ :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype gun-red-2-explosion (process-drawable) () :method-count-assert 21 :size-assert #xc8 :flag-assert #x15005000c8 (:methods - (gun-red-2-explosion-method-20 () none) ;; 20 + (gun-red-2-explosion-method-20 (_type_) none) ;; 20 ) ) -|# -#| (deftype red-2-ring (process-drawable) ((current-alpha float :offset-assert 200) + (pad uint8 12) ;; added ) :method-count-assert 23 :size-assert #xd8 :flag-assert #x17006000d8 - (:methods - (red-2-ring-method-21 () none) ;; 21 - (red-2-ring-method-22 () none) ;; 22 - ) (:state-methods active ;; 20 + fading ;; 21, referenced in event handler, but doesn't exist + ) + (:methods + (red-2-ring-method-22 () none) ;; 22, also doesn't exist ) ) -|# -#| (deftype red-2-ring-init-params (structure) ((pos vector :inline :offset-assert 0) ) @@ -36587,26 +36612,23 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype red-3-sphere (process-drawable) ((current-alpha float :offset-assert 200) + (pad uint8 12) ;; added ) :method-count-assert 23 :size-assert #xd8 :flag-assert #x17006000d8 - (:methods - (red-3-sphere-method-21 () none) ;; 21 - (red-3-sphere-method-22 () none) ;; 22 - ) (:state-methods active ;; 20 ) + (:methods + (red-3-sphere-method-21 (_type_) none) ;; 21 + (red-3-sphere-method-22 (_type_) none) ;; 22 + ) ) -|# -#| (deftype red-3-sphere-init-params (structure) ((pos vector :inline :offset-assert 0) ) @@ -36614,24 +36636,23 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# -;; (define-extern part-tracker-move-to-target-gun function) -;; (define-extern gun-red-2-shockwave-init-by-other function) -;; (define-extern generate-shockwave-scorch-marks-3 function) -;; (define-extern generate-shockwave-scorch-marks-2 function) -;; (define-extern red-2-ring-event-handler function) -;; (define-extern red-2-ring-init-by-other function) -;; (define-extern *impact-blur* object) -;; (define-extern *shockwave-blur-red-2* object) -;; (define-extern gun-fire-red-2 function) -;; (define-extern red-3-sphere-init-by-other function) -;; (define-extern gun-fire-red-3 function) -;; (define-extern gun-fire-red-1 function) +(define-extern part-tracker-move-to-target-gun (function part-tracker none)) +(define-extern gun-red-2-shockwave-init-by-other (function gun-red-2-shockwave-init-params object :behavior gun-red-2-shockwave)) +(define-extern generate-shockwave-scorch-marks-3 (function int none :behavior gun-red-2-shockwave)) +(define-extern generate-shockwave-scorch-marks-2 (function none :behavior gun-red-2-shockwave)) +(define-extern red-2-ring-event-handler (function process int symbol event-message-block object :behavior red-2-ring)) +(define-extern red-2-ring-init-by-other (function red-2-ring-init-params object :behavior red-2-ring)) +(define-extern *impact-blur* curve2d-piecewise) +(define-extern *shockwave-blur-red-2* curve2d-piecewise) +(define-extern gun-fire-red-2 (function object :behavior target)) +(define-extern red-3-sphere-init-by-other (function red-3-sphere-init-params object :behavior red-3-sphere)) +(define-extern gun-fire-red-3 (function gun-red-3-grenade :behavior target)) +(define-extern gun-fire-red-1 (function gun-red-shot :behavior target)) (define-extern target-gun-can-fire-red? (function pickup-type symbol :behavior target)) (define-extern target-gun-fire-red (function pickup-type (pointer process) :behavior target)) -;; (define-extern gun-red-shot-event-handler function) ;; (function process-drawable int symbol event-message-block object :behavior gun-red-shot) -;; (define-extern gun-red-shot-init-by-other function) ;; (function vector vector gun-red-shot :behavior gun-red-shot) +(define-extern gun-red-shot-event-handler (function process int symbol event-message-block object :behavior gun-red-shot)) +(define-extern gun-red-shot-init-by-other (function vector vector object :behavior gun-red-shot)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; gun-dark-shot ;; @@ -37427,7 +37448,7 @@ (define-extern entity-by-name (function string entity)) (define-extern entity-by-type (function type entity-actor)) (define-extern entity-by-aid (function uint entity)) -;; (define-extern entity-actor-from-level-name function) ;; (function symbol entity-actor) +(define-extern entity-actor-from-level-name (function symbol entity-actor)) ;; (define-extern entity-nav-mesh-by-aid function) ;; (function actor-id entity-nav-mesh) ;; (define-extern nav-mesh-from-res-tag function) ;; (function entity symbol int nav-mesh) ;; (define-extern entity-by-meters function) ;; (function float float float entity-actor) @@ -37645,9 +37666,9 @@ ;; effect-control ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *footstep-surface* object) ;; pat-surface +(define-extern *footstep-surface* object) ;; pat-surface (define-extern *debug-effect-control* symbol) -;; (define-extern sound-name-with-material function) ;; (function string pat-surface string sound-name) +(define-extern sound-name-with-material (function string pat-surface string sound-name)) (define-extern effect-param->sound-spec (function sound-spec (pointer float) int process-focusable sound-spec)) (define-extern target-land-effect (function none :behavior target)) @@ -38137,16 +38158,13 @@ ;; scene ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype scene-stage (process-hidden) () :method-count-assert 15 :size-assert #x80 :flag-assert #xf00000080 ) -|# -#| (deftype subtitle-work (structure) ((draw-tmpl dma-gif-packet :inline :offset-assert 0) (color0 vector4w :inline :offset-assert 32) @@ -38156,34 +38174,33 @@ :size-assert #x40 :flag-assert #x900000040 ) -|# -;; (define-extern scene-decode-continue function) ;; (function basic continue-point) -;; (define-extern scene-lookup function) ;; (function basic scene) -;; (define-extern *subtitle-work* object) ;; subtitle-work -;; (define-extern draw-subtitle-image function) ;; (function subtitle-image font-context none) -;; (define-extern process-drawable-draw-subtitles function) ;; (function none :behavior process-drawable) +(define-extern scene-decode-continue (function basic continue-point)) +(define-extern scene-lookup (function basic scene)) +(define-extern *subtitle-work* subtitle-work) +(define-extern draw-subtitle-image (function subtitle-image font-context none)) +(define-extern process-drawable-draw-subtitles (function none :behavior process-drawable)) (define-extern scene-player-init (function object symbol string none :behavior scene-player)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; pov-camera ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern pov-camera-play-and-reposition function) ;; (function art-joint-anim vector float none :behavior pov-camera) +(define-extern pov-camera-play-and-reposition (function art-joint-anim vector float none :behavior pov-camera)) (define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) -;; (define-extern othercam-calc function) ;; (function float float) +(define-extern othercam-calc (function float float)) (define-extern othercam-init-by-other (function pov-camera int symbol symbol none :behavior othercam)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; powerups ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern cloud-track function) ;; (function process-tree process-tree (function vector none) time-frame time-frame time-frame none :behavior process) +(define-extern cloud-track (function process-tree process-tree (function vector none) time-frame time-frame time-frame none :behavior process)) (define-extern eco-blue-glow (function vector none)) -;; (define-extern target-eco-process function) ;; (function none :behavior target) -;; (define-extern target-color-effect-process function) ;; (function none :behavior target) -(define-extern target-update-segs (function process-drawable none)) -;; (define-extern target-draw-process function) +(define-extern target-eco-process (function none :behavior target)) +(define-extern target-color-effect-process (function none :behavior target)) +(define-extern target-update-segs (function process-drawable float)) +(define-extern target-draw-process (function none :behavior target)) (define-extern target-powerup-process (function none :behavior target)) (define-extern target-powerup-effect (function symbol none :behavior target)) (define-extern process-contact-action (function process none :behavior target)) @@ -40086,171 +40103,181 @@ ;; los-control-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype los-control (structure) - ((src-proc uint64 :offset-assert 0) ;; handle - (dst-proc uint64 :offset-assert 8) ;; handle - (last-lost-los uint64 :offset-assert 16) - (last-gained-los uint64 :offset-assert 24) - (check-interval uint64 :offset-assert 32) ;; time-frame + ((src-proc handle :offset-assert 0) ;; handle + (dst-proc handle :offset-assert 8) ;; handle + (last-lost-los time-frame :offset-assert 16) + (last-gained-los time-frame :offset-assert 24) + (check-interval time-frame :offset-assert 32) ;; time-frame (max-check-distance float :offset-assert 40) - (last-check-time uint64 :offset-assert 48) ;; time-frame + (last-check-time time-frame :offset-assert 48) ;; time-frame (last-collide-result collide-tri-result :inline :offset-assert 64) - (collide-with collide-spec :offset-assert 160) ;; guessed by decompiler + (collide-with collide-spec :offset 160) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #xa4 :flag-assert #xe000000a4 (:methods - (los-control-method-9 () none) ;; 9 ;; (los-control-method-9 (_type_ process-focusable vector float) none) - (los-control-method-10 () none) ;; 10 ;; (check-los? (_type_ time-frame) symbol) - (los-control-method-11 () none) ;; 11 ;; (skip-check-los? (_type_ int) symbol) - (los-control-method-12 () none) ;; 12 ;; (set-dst-proc! (_type_ handle) none) - (los-control-method-13 () none) ;; 13 ;; (new-source! (_type_ process time-frame collide-spec) none) + (los-control-method-9 (_type_ process-focusable vector float float) none :behavior process-focusable) ;; 9 ;; (los-control-method-9 (_type_ process-focusable vector float) none) + (should-check-los? (_type_ time-frame) symbol) ;; 10 + (los-control-method-11 (_type_ time-frame) symbol) ;; 11 ;; (skip-check-los? (_type_ int) symbol) + (init-los! (_type_ process-focusable time-frame float collide-spec) none) ;; 12 ;; (set-dst-proc! (_type_ handle) none) + (los-control-method-13 (_type_ collide-query vector int float) float) ;; 13 ;; (new-source! (_type_ process time-frame collide-spec) none) ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; airlock ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++airlock:airlock-options +(defenum airlock-options + :type uint32 + :bitfield #t + (ao0 0) + (front 1) + (block-flut 2) + (back 3) + (ao4 4) + ) +;; ---airlock:airlock-options + (deftype com-airlock (process-drawable) - ((level-name pair :offset-assert 196) ;; guessed by decompiler - (open-test pair :offset-assert 200) ;; guessed by decompiler - (on-running basic :offset-assert 204) - (were-behind? symbol :offset-assert 208) ;; guessed by decompiler - (inner? symbol :offset-assert 212) ;; guessed by decompiler - (sound-behind? symbol :offset-assert 216) ;; guessed by decompiler - (visible-move? symbol :offset-assert 220) ;; guessed by decompiler - (saw-pilot? uint64 :offset-assert 228) ;; handle - (last-distance meters :offset-assert 236) - (y-height vector :offset-assert 240) ;; guessed by decompiler - (pre-open-speed float :offset-assert 244) - (open? basic :offset-assert 248) - (latch-closed-time uint64 :offset-assert 252) ;; time-frame - (latch-open-time uint64 :offset-assert 260) ;; time-frame - (gear joint-mod :offset-assert 268) ;; guessed by decompiler - (gear-rot deg :offset-assert 272) ;; degrees - (gear-rotv deg :offset-assert 276) ;; degrees - (gear-start-frame float :offset-assert 280) - (gear-stop-frame float :offset-assert 284) - (gear-play-time uint64 :offset-assert 292) - (open-frame float :offset-assert 300) - (pre-open-frame float :offset-assert 304) - (lock-frame float :offset-assert 308) - (close-speed-multiplier float :offset-assert 312) - (open-distance meters 2 :offset-assert 316) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. - (active-distance meters 2 :offset-assert 324) ;; guessed by decompiler - (UNKNOWN UNKNOWN :offset-assert -1) ;; field could not be read. - (sound-id sound-id :offset-assert 332) ;; guessed by decompiler - (gear-sound-id sound-id :offset-assert 336) ;; guessed by decompiler - (sound-gear sound-spec :offset-assert 340) ;; guessed by decompiler - (sound-pre-open sound-spec :offset-assert 344) ;; guessed by decompiler - (sound-pre-open-stop sound-spec :offset-assert 348) ;; guessed by decompiler - (sound-lock-loop sound-spec :offset-assert 352) ;; guessed by decompiler - (sound-lock-stop sound-spec :offset-assert 356) ;; guessed by decompiler - (sound-open sound-spec :offset-assert 360) ;; guessed by decompiler - (sound-open-loop sound-spec :offset-assert 364) ;; guessed by decompiler - (sound-open-stop sound-spec :offset-assert 368) ;; guessed by decompiler - (sound-close sound-spec :offset-assert 372) ;; guessed by decompiler - (sound-close-loop sound-spec :offset-assert 376) ;; guessed by decompiler - (sound-close-stop sound-spec :offset-assert 380) ;; guessed by decompiler - (sound-post-close sound-spec :offset-assert 384) ;; guessed by decompiler - (sound-post-close-stop sound-spec :offset-assert 388) ;; guessed by decompiler - (spool-sound-time uint64 :offset-assert 396) ;; time-frame - (start-open-time uint64 :offset-assert 404) - (door-radius meters :offset-assert 412) - (allow-pilot? basic :offset-assert 416) - (allow-flut? basic :offset-assert 420) - (blocking-plane? basic :offset-assert 424) + ((level-name pair :offset-assert 200) ;; guessed by decompiler + (open-test pair :offset-assert 204) ;; guessed by decompiler + (on-running pair :offset-assert 208) + (were-behind? symbol :offset-assert 212) ;; guessed by decompiler + (inner? symbol :offset-assert 216) ;; guessed by decompiler + (sound-behind? symbol :offset-assert 220) ;; guessed by decompiler + (visible-move? symbol :offset-assert 224) ;; guessed by decompiler + (saw-pilot? handle :offset-assert 232) ;; handle + (last-distance meters :offset-assert 240) + (y-height vector :offset-assert 244) ;; guessed by decompiler + (pre-open-speed float :offset-assert 248) + (open? symbol :offset-assert 252) + (latch-closed-time time-frame :offset-assert 256) ;; time-frame + (latch-open-time time-frame :offset-assert 264) ;; time-frame + (gear joint-mod :offset-assert 272) ;; guessed by decompiler + (gear-rot degrees :offset-assert 276) ;; degrees + (gear-rotv degrees :offset-assert 280) ;; degrees + (gear-start-frame float :offset-assert 284) + (gear-stop-frame float :offset-assert 288) + (gear-play-time time-frame :offset-assert 296) + (open-frame float :offset-assert 304) + (pre-open-frame float :offset-assert 308) + (lock-frame float :offset-assert 312) + (close-speed-multiplier float :offset-assert 316) + (open-distance meters 2 :offset-assert 320) ;; guessed by decompiler + (active-distance meters 2 :offset-assert 328) ;; guessed by decompiler + (sound-id sound-id :offset-assert 336) ;; guessed by decompiler + (gear-sound-id sound-id :offset-assert 340) ;; guessed by decompiler + (sound-gear sound-spec :offset-assert 344) ;; guessed by decompiler + (sound-pre-open sound-spec :offset-assert 348) ;; guessed by decompiler + (sound-pre-open-stop sound-spec :offset-assert 352) ;; guessed by decompiler + (sound-lock-loop sound-spec :offset-assert 356) ;; guessed by decompiler + (sound-lock-stop sound-spec :offset-assert 360) ;; guessed by decompiler + (sound-open sound-spec :offset-assert 364) ;; guessed by decompiler + (sound-open-loop sound-spec :offset-assert 368) ;; guessed by decompiler + (sound-open-stop sound-spec :offset-assert 372) ;; guessed by decompiler + (sound-close sound-spec :offset-assert 376) ;; guessed by decompiler + (sound-close-loop sound-spec :offset-assert 380) ;; guessed by decompiler + (sound-close-stop sound-spec :offset-assert 384) ;; guessed by decompiler + (sound-post-close sound-spec :offset-assert 388) ;; guessed by decompiler + (sound-post-close-stop sound-spec :offset-assert 392) ;; guessed by decompiler + (spool-sound-time time-frame :offset-assert 400) ;; time-frame + (start-open-time time-frame :offset-assert 408) + (door-radius float :offset-assert 416 :decomp-as meters) + (allow-pilot? symbol :offset-assert 420) + (allow-flut? symbol :offset-assert 424) + (blocking-plane? symbol :offset-assert 428) ) :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ;; field level-name uses ~A with a signed load. field open-test uses ~A with a signed load. field on-running uses ~A with a signed load. - (:methods - (com-airlock-method-22 () none) ;; 22 ;; (init-airlock! (_type_) _type_) - (com-airlock-method-23 () none) ;; 23 ;; (want-cross-airlock? (_type_) symbol) - (com-airlock-method-24 () none) ;; 24 ;; (destination-loaded? (_type_ symbol) symbol) - (com-airlock-method-25 () none) ;; 25 ;; (check-crossing-distance (_type_ vector symbol) float) - (com-airlock-method-26 () none) ;; 26 ;; (rotate-gear! (_type_ float) degrees) - (com-airlock-method-27 () none) ;; 27 ;; (play-city-voice-sound (_type_ symbol) none) - (com-airlock-method-28 () none) ;; 28 - (com-airlock-method-29 () none) ;; 29 - ) (:state-methods - open ;; 20, old: (open (symbol) _type_ :state) - close ;; 21, old: (close (symbol) _type_ :state) + (open symbol) ;; 20 + (close symbol) ;; 21 + ) + (:methods + (init-airlock! (_type_) _type_) ;; 22 + (want-cross-airlock? (_type_) object) ;; 23 + (destination-loaded? (_type_ symbol) symbol) ;; 24 + (check-crossing-distance (_type_ vector symbol) float) ;; 25 + (com-airlock-method-26 (_type_ vector symbol) symbol) ;; 26 + (rotate-gear! (_type_ float) degrees) ;; 27 + (play-city-voice-sound (_type_ symbol) none) ;; 28 + (spawn-blocking-plane (_type_ symbol) none) ;; 29 ) ) -|# -#| (deftype com-airlock-outer (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -#| (deftype com-airlock-inner (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -#| (deftype cty-door (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -#| (deftype vin-door-ctyinda (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -#| + (deftype com-airlock-outer-mhcity (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -#| (deftype hip-door-a (com-airlock) () :method-count-assert 30 :size-assert #x1b0 :flag-assert #x1e013001b0 ) -|# -;; (define-extern airlock-stop-part-trackers function) -;; (define-extern airlock-command-lookup function) +(define-extern airlock-stop-part-trackers (function none :behavior com-airlock)) +(define-extern airlock-command-lookup (function pair object)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; water-anim ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++water-anim:wanim-look +(defenum wanim-look + :type int32 + (nst-lake 0) + (forb-foresta 1) + (fora-forestb 2) + (fora-forestc 3) + (fora-forestd 4) + (fora-foreste 5) + (fora-forestf 6) + (waspala-thronesec 7) + (waspala-windowwall 8) + (waspala-frontthrone 9) + (waspala-frontwindowwall 10) + ) +;; ---water-anim:wanim-look + (deftype water-anim (process-drawable) ((water-height meters :offset-assert 200) (wade-height meters :offset-assert 204) @@ -40259,32 +40286,30 @@ (attack-event symbol :offset-assert 216) ;; guessed by decompiler (attack-id uint32 :offset-assert 220) (flow flow-control :offset-assert 224) ;; guessed by decompiler - (target uint64 :offset-assert 232) ;; handle - (flags water-flags :offset-assert 240) ;; guessed by decompiler - (look int32 :offset-assert 244) + (target handle :offset-assert 232) ;; handle + (flags water-flag :offset-assert 240) ;; guessed by decompiler + (look wanim-look :offset-assert 244) (play-ambient-sound? symbol :offset-assert 248) ;; guessed by decompiler (visible symbol :offset-assert 252) ;; guessed by decompiler ) :method-count-assert 29 :size-assert #x100 :flag-assert #x1d00800100 - (:methods - (water-anim-method-20 () none) ;; 20 ;; (water-anim-state-20 () _type_ :state) - (water-anim-method-22 () none) ;; 22 ;; (move-to-point! (_type_ vector) int) - (water-anim-method-23 () none) ;; 23 ;; (get-ripple-height (_type_ vector) float) - (water-anim-method-24 () none) ;; 24 ;; (init-water! (_type_) none) - (water-anim-method-25 () none) ;; 25 ;; (reset-root! (_type_) trsqv) - (water-anim-method-26 () none) ;; 26 ;; (water-anim-init! (_type_) none) - (water-anim-method-27 () none) ;; 27 ;; (water-anim-method-27 (_type_) none) - (water-anim-method-28 () none) ;; 28 ;; (offset! (_type_) none) - ) (:state-methods - idle ;; 21, old: (idle () _type_ :state) + unknown ;; 20, doesn't seem to be defined? + idle ;; 21 + ) + (:methods + (move-to-point! (_type_ vector) int) ;; 22 + (get-ripple-height (_type_ vector) float) ;; 23 + (init-water! (_type_) object) ;; 24 + (alloc-root! (_type_) none) ;; 25 + (water-anim-init! (_type_) none) ;; 26 + (stub (_type_) none) ;; 27 + (set-offset-and-look! (_type_) none) ;; 28 ) ) -|# -#| (deftype water-anim-look (structure) ((skel-group string :offset-assert 0) ;; guessed by decompiler (anim int32 :offset-assert 4) @@ -40294,58 +40319,62 @@ :size-assert #xc :flag-assert #x90000000c ) -|# -;; (define-extern *water-anim-look* array) ;; (array water-anim-look) -;; (define-extern water-anim-event-handler function) ;; (function process int symbol event-message-block object :behavior water-anim) -;; (define-extern water-anim-init-by-other function) ;; (function entity-actor none :behavior water-anim) +(define-extern *water-anim-look* (array water-anim-look)) +(define-extern water-anim-event-handler (function process int symbol event-message-block object :behavior water-anim)) +(define-extern water-anim-init-by-other (function entity-actor object :behavior water-anim)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; blocking-plane ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype blocking-plane (process-drawable) - ((current-attack-mode basic :offset-assert 200) + ((root collide-shape :override) + (current-attack-mode symbol :offset-assert 200) ) :method-count-assert 22 :size-assert #xcc :flag-assert #x16005000cc - (:methods - (blocking-plane-method-21 () none) ;; 21 ;; (init! (_type_ (inline-array vector) float) none) - ) (:state-methods - idle ;; 20, old: (idle () _type_ :state) + idle ;; 20 + ) + (:methods + (init! (_type_ (inline-array vector) float) none) ;; 21 ) ) -|# -;; (define-extern blocking-plane-init-by-other function) ;; (function (inline-array vector) float none :behavior blocking-plane) -;; (define-extern blocking-plane-spawn function) ;; (function curve-control (inline-array vector) float none :behavior process) -;; (define-extern blocking-plane-destroy function) ;; (function none :behavior blocking-plane) +(define-extern blocking-plane-init-by-other (function (inline-array vector) float object :behavior blocking-plane)) +(define-extern blocking-plane-spawn (function curve-control (inline-array vector) float none :behavior process)) +(define-extern blocking-plane-destroy (function none :behavior blocking-plane)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; idle-control ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++idle-control:idle-control-cmd +(defenum idle-control-cmd + :type uint8 + (reset 0) + (play 1) + (push 2) + ) +;; ---idle-control:idle-control-cmd + (deftype idle-control-frame (structure) - ((command uint8 :offset-assert 0) + ((command idle-control-cmd :offset-assert 0) (anim uint32 :offset-assert 4) (param0 int32 :offset-assert 8) (param1 int32 :offset-assert 12) - (param2 basic :offset-assert 16) + (param2 pair :offset-assert 16) ) :method-count-assert 9 :size-assert #x14 :flag-assert #x900000014 ;; field param2 uses ~A with a signed load. ) -|# -#| (deftype idle-control (structure) - ((anim (pointer idle-control-frame) :offset-assert 0) ;; guessed by decompiler + ((anim (inline-array idle-control-frame) :offset-assert 0) ;; guessed by decompiler (anim-speed float :offset-assert 4) (current-index int32 :offset-assert 8) (counter int32 :offset-assert 12) @@ -40355,80 +40384,129 @@ :size-assert #x14 :flag-assert #xb00000014 (:methods - (idle-control-method-9 () none) ;; 9 ;; (idle-control-method-9 (_type_ (pointer idle-control-frame)) none) - (idle-control-method-10 () none) ;; 10 ;; (idle-control-method-10 (_type_ process-drawable) none) + (init! "Initialize this [[idle-control]]." (_type_ (inline-array idle-control-frame)) none) ;; 9 + (play-idle-frames! + "Set the process pointer to the given [[process-drawable]] and run the idle frames for it." + (_type_ process-drawable) none :behavior process-drawable) ;; 10 ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; proc-focusable-spawner ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype proc-focusable-spawn-record (structure) - ((proc uint64 :offset-assert 0) + "A record of a [[process-focusable]] that was created by a spawner." + ((proc handle :offset-assert 0) (index int16 :offset-assert 8) - (dead-time uint64 :offset-assert 16) + (dead-time time-frame :offset-assert 16) ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype proc-focusable-spawn-record-array (inline-array-class) - ((data UNKNOWN :dynamic :offset-assert 16) + ((data proc-focusable-spawn-record :dynamic :inline :offset-assert 16) ) :method-count-assert 14 :size-assert #x10 :flag-assert #xe00000010 ) -|# -#| (deftype proc-focusable-spawner (basic) - ((records basic :offset-assert 4) - (unused-list basic :offset-assert 8) + "A [[process-focusable]] spawner. Keeps track of spawned processes and cleans up inactive ones." + ((records proc-focusable-spawn-record-array :offset-assert 4) + (unused-list (array int8) :offset-assert 8) ) :method-count-assert 17 :size-assert #xc :flag-assert #x110000000c (:methods - (proc-focusable-spawner-method-9 () none) ;; 9 - (proc-focusable-spawner-method-10 () none) ;; 10 - (proc-focusable-spawner-method-11 () none) ;; 11 - (proc-focusable-spawner-method-12 () none) ;; 12 - (proc-focusable-spawner-method-13 () none) ;; 13 - (proc-focusable-spawner-method-14 () none) ;; 14 - (proc-focusable-spawner-method-15 () none) ;; 15 - (proc-focusable-spawner-method-16 () none) ;; 16 + (alloc-records! "Allocate records and unused list." (_type_ int symbol) none) ;; 9 + (get-last-unused-handle! "Get the handle for the last element in the unused list and decrement the unused list size." (_type_) handle) ;; 10 + (get-last-unused-val! "Get the last value in the unused list and decrement size." (_type_) int) ;; 11 + (mark-unused! "Add this handle to the unused list." (_type_ handle) int) ;; 12 + (init-records! "Initialize the records list." (_type_) none) ;; 13 + (add-unused! "Add the given value to the unused list." (_type_ int) none) ;; 14 + (check-inactive "Check for inactive processes and add them to the unused list." (_type_) symbol) ;; 15 + (reset-and-kill-all! "Reset the records list and deactivate all remaining active processes." (_type_) none) ;; 16 ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enemy-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++enemy-h:enemy-aware +(defenum enemy-aware + :type uint64 + (ea0 0) + (ea1 1) + (ea2 2) + (ea3 3) + (ea4 4) + ) +;; ---enemy-h:enemy-aware + +;; +++enemy-h:enemy-flag +(defenum enemy-flag + :type uint64 + :bitfield #t + (look-at-focus 0) + (look-at-move-dest 1) + (vulnerable 2) + (vulnerable-backup 3) + (dangerous-backup 4) + (notice 5) + (alert 6) + (auto-reset-penetrate 7) + (victory 8) + (cam-attack-mode 9) + (use-notice-distance 10) + (attackable 11) + (attackable-backup 12) + (actor-pause-backup 13) + (enable-on-notice 14) + (enable-on-active 15) + (enable-on-hostile 16) + (dislike-combo 17) + (directed 18) + (directed-ready 19) + (chase-startup 20) + (lock-focus 21) + (multi-focus 22) + (use-trigger 23) + (trackable 24) + (trackable-backup 25) + (spawn-gem 26) + (check-water 27) + (check-water-backup 28) + (checking-water 29) + (drawn-mirrored 30) + (called-dying 31) + (no-initial-move-to-ground 32) + (jump-check-blocked 33) + (death-start 34) + (auto-death-phase-out 35) + (has-gem 36) + ) +;; ---enemy-h:enemy-flag + +(declare-type enemy process-focusable) (deftype enemy-focus (focus) - ((aware uint64 :offset-assert 16) ;; enemy-aware - (flags uint64 :offset-assert 24) ;; enemy-flag + ((aware enemy-aware :offset-assert 16) ;; enemy-aware + (flags enemy-flag :offset-assert 24) ;; enemy-flag ) :method-count-assert 14 :size-assert #x20 :flag-assert #xe00000020 (:methods - (enemy-focus-method-13 () none) ;; 13 ;; (enemy-focus-method-13 (_type_ process-focusable enemy-aware) symbol) + (try-update-focus (_type_ process-focusable enemy) symbol :replace) ;; 12 + (enemy-focus-method-13 (_type_ process-focusable enemy-aware) symbol) ;; 13 ) ) -|# -#| (deftype enemy-info (basic) ((fact-defaults fact-info-enemy-defaults :offset-assert 4) ;; guessed by decompiler (use-die-falling symbol :offset-assert 8) ;; guessed by decompiler @@ -40438,7 +40516,7 @@ (jump-debug-draw symbol :offset-assert 24) ;; guessed by decompiler (move-to-ground symbol :offset-assert 28) ;; guessed by decompiler (hover-if-no-ground symbol :offset-assert 32) ;; guessed by decompiler - (idle-anim-script (pointer idle-control-frame) :offset-assert 36) ;; guessed by decompiler + (idle-anim-script (inline-array idle-control-frame) :offset-assert 36) ;; guessed by decompiler (idle-anim int32 :offset-assert 40) (notice-anim int32 :offset-assert 44) (hostile-anim int32 :offset-assert 48) @@ -40454,16 +40532,16 @@ (neck-joint int32 :offset-assert 88) (look-at-joint int32 :offset-assert 92) (bullseye-joint int32 :offset-assert 96) - (sound-hit uint128 :offset-assert 112) ;; sound-name - (sound-die uint128 :offset-assert 128) ;; sound-name + (sound-hit sound-name :offset-assert 112) ;; sound-name + (sound-die sound-name :offset-assert 128) ;; sound-name (notice-distance meters :offset-assert 144) (notice-distance-delta meters :offset-assert 148) (proximity-notice-distance meters :offset-assert 152) (default-hit-points float :offset-assert 156) ;; int32 (gnd-collide-with collide-spec :offset-assert 160) ;; guessed by decompiler (overlaps-others-collide-with-filter collide-spec :offset-assert 164) ;; guessed by decompiler - (penetrate-flinch uint64 :offset-assert 168) ;; penetrate - (penetrate-knocked uint64 :offset-assert 176) ;; penetrate + (penetrate-flinch penetrate :offset-assert 168) ;; penetrate + (penetrate-knocked penetrate :offset-assert 176) ;; penetrate (movement-gravity meters :offset-assert 184) (friction float :offset-assert 188) (slip-factor float :offset-assert 192) @@ -40472,9 +40550,9 @@ (attack-mode symbol :offset-assert 204) ;; guessed by decompiler (attack-damage int32 :offset-assert 208) (recover-gnd-collide-with collide-spec :offset-assert 212) ;; guessed by decompiler - (knocked-can-land-timeout uint64 :offset-assert 216) - (knocked-recover-timeout uint64 :offset-assert 224) - (ragdoll-blend-out-time uint64 :offset-assert 232) + (knocked-can-land-timeout time-frame :offset-assert 216) + (knocked-recover-timeout time-frame :offset-assert 224) + (ragdoll-blend-out-time time-frame :offset-assert 232) (ragdoll-rotate-velocity-mult float :offset-assert 240) (jump-height-min meters :offset-assert 244) (jump-height-factor float :offset-assert 248) @@ -40522,29 +40600,40 @@ :size-assert #x1a4 :flag-assert #xa000001a4 (:methods - (enemy-info-method-9 () none) ;; 9 ;; (copy-enemy-info! (_type_ _type_) none) + (copy-enemy-info! (_type_ _type_) none) ;; 9 ) ) -|# -#| (deftype enemy-knocked-info (structure) ((anim-speed float :offset-assert 0) (on-surface-count int32 :offset-assert 4) (move-count int32 :offset-assert 8) - (land-can-land-time uint64 :offset-assert 16) ;; time-frame + (land-can-land-time time-frame :offset-assert 16) ;; time-frame ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| +;; +++enemy-h:enemy-jump-flags +(defenum enemy-jump-flags + :bitfield #t + :type uint8 + (ejf0 0) + (ejf1 1) + (ejf2 2) + (ejf3 3) + (ejf4 4) + (ejf5 5) + (ejf6 6) + (ejf7 7) + ) +;; ---enemy-h:enemy-jump-flags + (deftype enemy-jump-info (structure) - ((flags uint8 :offset-assert 0) ;; enemy-jump-flags + ((flags enemy-jump-flags :offset-assert 0) ;; enemy-jump-flags (anim-speed float :offset-assert 4) - (hang-time uint64 :offset-assert 8) ;; time-frame + (hang-time time-frame :offset-assert 8) ;; time-frame (start-pos vector :inline :offset-assert 16) (dest-pos vector :inline :offset-assert 32) (traj trajectory :inline :offset-assert 48) @@ -40553,31 +40642,27 @@ :size-assert #x58 :flag-assert #x900000058 ) -|# -#| (deftype enemy-init-by-other-params (structure) ((trans vector :inline :offset-assert 0) (quat quaternion :inline :offset-assert 16) (entity entity :offset-assert 32) ;; guessed by decompiler (directed? symbol :offset-assert 36) ;; guessed by decompiler (no-initial-move-to-ground? symbol :offset-assert 40) ;; guessed by decompiler - (art-level basic :offset-assert 44) + (art-level level :offset-assert 44) ) :method-count-assert 9 :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype enemy-attack-info (structure) ((attack-id uint32 :offset-assert 0) - (knocked-type uint8 :offset-assert 4) ;; knocked-type + (knocked-type knocked-type :offset-assert 4) ;; knocked-type (blue-juggle-count uint8 :offset-assert 5) - (attacker-handle uint64 :offset-assert 8) ;; handle - (attack-time uint64 :offset-assert 16) ;; time-frame - (penetrate-using uint64 :offset-assert 24) ;; penetrate + (attacker-handle handle :offset-assert 8) ;; handle + (attack-time time-frame :offset-assert 16) ;; time-frame + (penetrate-using penetrate :offset-assert 24) ;; penetrate (attacker-pos vector :inline :offset-assert 32) (attack-direction vector :inline :offset-assert 48) (attack-position vector :inline :offset-assert 64) @@ -40587,47 +40672,45 @@ :size-assert #x54 :flag-assert #x900000054 ) -|# -#| (deftype enemy-best-focus (structure) ((proc process :offset-assert 0) ;; guessed by decompiler (rating float :offset-assert 4) - (aware uint64 :offset-assert 8) ;; enemy-aware + (aware enemy-aware :offset-assert 8) ;; enemy-aware ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| (deftype enemy (process-focusable) - ((enemy-flags enemy-flag :offset-assert 208) + ((fact fact-info-enemy :override) + (root collide-shape-moving :override) + (enemy-flags enemy-flag :offset-assert 208) (enemy-info enemy-info :offset-assert 216) ;; guessed by decompiler (hit-points float :offset-assert 220) ;; int32 - (gnd-collide-with uint32 :offset-assert 224) + (gnd-collide-with collide-spec :offset-assert 224) (attack-id uint32 :offset-assert 228) (persistent-attack-id uint32 :offset-assert 232) (water-max-height float :offset-assert 236) ;; meters (water-surface-height float :offset-assert 240) ;; meters - (desired-angle float :offset-assert 244) ;; degrees + (desired-angle degrees :offset-assert 244) ;; degrees (jump-why uint64 :offset-assert 248) - (penetrated-by-all uint64 :offset-assert 256) ;; penetrate - (penetrate-flinch uint64 :offset-assert 264) - (penetrate-knocked uint64 :offset-assert 272) - (ragdoll-proc uint64 :offset-assert 280) - (reaction-time uint64 :offset-assert 288) ;; time-frame - (notice-time uint64 :offset-assert 296) ;; time-frame - (state-timeout uint64 :offset-assert 304) ;; time-frame - (auto-reset-penetrate-time uint64 :offset-assert 312) ;; time-frame - (hit-focus-time uint64 :offset-assert 320) ;; time-frame - (last-draw-time uint64 :offset-assert 328) ;; time-frame - (starting-time uint64 :offset-assert 336) ;; time-frame - (fated-time uint64 :offset-assert 344) ;; time-frame + (penetrated-by-all penetrate :offset-assert 256) ;; penetrate + (penetrate-flinch penetrate :offset-assert 264) + (penetrate-knocked penetrate :offset-assert 272) + (ragdoll-proc handle :offset-assert 280) + (reaction-time time-frame :offset-assert 288) ;; time-frame + (notice-time time-frame :offset-assert 296) ;; time-frame + (state-timeout time-frame :offset-assert 304) ;; time-frame + (auto-reset-penetrate-time time-frame :offset-assert 312) ;; time-frame + (hit-focus-time time-frame :offset-assert 320) ;; time-frame + (last-draw-time time-frame :offset-assert 328) ;; time-frame + (starting-time time-frame :offset-assert 336) ;; time-frame + (fated-time time-frame :offset-assert 344) ;; time-frame (focus-pos vector :inline :offset-assert 352) (event-param-point vector :inline :offset-assert 368) - (jump-dest vector :inline :offset-assert 368) + (jump-dest vector :inline :offset 368) (focus enemy-focus :inline :offset-assert 384) (incoming enemy-attack-info :inline :offset-assert 416) (actor-group (pointer actor-group) :offset-assert 500) ;; guessed by decompiler @@ -40644,139 +40727,139 @@ :size-assert #x228 :flag-assert #x9b01b00228 ;; field enemy-flag is likely a value type. field on-notice uses ~A with a signed load. field on-active uses ~A with a signed load. field on-hostile uses ~A with a signed load. field on-death uses ~A with a signed load. - (:methods - (enemy-method-28 () none) ;; 28 ;; (dormant-aware () _type_ :state) - (enemy-method-29 () none) ;; 29 ;; (hit () _type_ :state) - (enemy-method-30 () none) ;; 30 ;; (knocked () _type_ :state) - (enemy-method-31 () none) ;; 31 ;; (idle () _type_ :state) - (enemy-method-32 () none) ;; 32 ;; (active () _type_ :state) - (enemy-method-33 () none) ;; 33 ;; (notice () _type_ :state) - (enemy-method-34 () none) ;; 34 ;; (flee () _type_ :state) - (enemy-method-35 () none) ;; 35 ;; (stare () _type_ :state) - (enemy-method-36 () none) ;; 36 ;; (hostile () _type_ :state) - (enemy-method-37 () none) ;; 37 ;; (victory () _type_ :state) - (enemy-method-38 () none) ;; 38 ;; (die () _type_ :state) - (enemy-method-39 () none) ;; 39 ;; (die-falling () _type_ :state) - (enemy-method-40 () none) ;; 40 ;; (die-fast () _type_ :state) - (enemy-method-41 () none) ;; 41 ;; (directed () _type_ :state) - (enemy-method-42 () none) ;; 42 ;; (jump () _type_ :state) - (enemy-method-43 () none) ;; 43 ;; (jump-blocked () _type_ :state) - (enemy-method-44 () none) ;; 44 ;; (ambush () _type_ :state) - (enemy-method-45 () none) ;; 45 ;; (view-anims () _type_ :state) - (enemy-method-46 () none) ;; 46 ;; (enemy-method-46 (_type_ int) none) - (enemy-method-47 () none) ;; 47 ;; (enemy-method-47 (_type_ vector) float) - (enemy-method-48 () none) ;; 48 ;; (take-damage-from-attack (_type_ process event-message-block) int) - (enemy-method-49 () none) ;; 49 ;; (enemy-method-49 (_type_) time-frame) - (enemy-method-50 () none) ;; 50 ;; (enemy-method-50 (_type_ vector) vector) - (enemy-method-51 () none) ;; 51 ;; (enemy-method-51 (_type_) float) - (enemy-method-52 () none) ;; 52 ;; (enemy-method-52 (_type_ vector) none) - (enemy-method-53 () none) ;; 53 ;; (enemy-method-53 (_type_ process-focusable) symbol) - (enemy-method-54 () none) ;; 54 ;; (enemy-method-54 (_type_) enemy-flag) - (enemy-method-55 () none) ;; 55 ;; (common-post (_type_) none) - (enemy-method-56 () none) ;; 56 ;; (damage-amount-from-attack (_type_ process event-message-block) int) - (enemy-method-57 () none) ;; 57 ;; (update-target-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) - (enemy-method-58 () none) ;; 58 ;; (enemy-method-58 (_type_ process event-message-block) symbol) - (enemy-method-59 () none) ;; 59 ;; (get-penetrate-info (_type_) penetrate) - (enemy-method-60 () none) ;; 60 ;; (coin-flip? (_type_) symbol) - (enemy-method-61 () none) ;; 61 ;; (enemy-method-61 (_type_ int) int) - (enemy-method-62 () none) ;; 62 ;; (enemy-method-62 (_type_) none) - (enemy-method-63 () none) ;; 63 ;; (enemy-method-63 (_type_ process-focusable enemy-aware) symbol) - (enemy-method-64 () none) ;; 64 ;; (go-dormant (_type_) object) - (enemy-method-65 () none) ;; 65 ;; (go-dormant-aware (_type_) object) - (enemy-method-66 () none) ;; 66 ;; (go-ambush (_type_) object) - (enemy-method-67 () none) ;; 67 ;; (go-stare (_type_) object) - (enemy-method-68 () none) ;; 68 ;; (go-stare2 (_type_) object) - (enemy-method-69 () none) ;; 69 ;; (go-directed (_type_) object) - (enemy-method-70 () none) ;; 70 ;; (go-hostile (_type_) object) - (enemy-method-71 () none) ;; 71 ;; (go-flee (_type_) object) - (enemy-method-72 () none) ;; 72 ;; (react-to-focus (_type_) object) - (enemy-method-73 () none) ;; 73 ;; (kill-prefer-falling (_type_) object) - (enemy-method-74 () none) ;; 74 ;; (general-event-handler (_type_ process int symbol event-message-block) object) - (enemy-method-75 () none) ;; 75 ;; (enemy-method-75 (_type_ process event-message-block) object) - (enemy-method-76 () none) ;; 76 ;; (enemy-method-76 (_type_ process event-message-block) symbol) - (enemy-method-77 () none) ;; 77 ;; (enemy-method-77 (_type_ enemy-knocked-info) symbol) - (enemy-method-78 () none) ;; 78 ;; (enemy-method-78 (_type_ enemy-knocked-info) symbol) - (enemy-method-79 () none) ;; 79 ;; (enemy-method-79 (_type_ int enemy-knocked-info) symbol) - (enemy-method-80 () none) ;; 80 ;; (enemy-method-80 (_type_ enemy-knocked-info) symbol) - (enemy-method-81 () none) ;; 81 ;; (enemy-method-81 (_type_) symbol) - (enemy-method-82 () none) ;; 82 ;; (enemy-method-82 (_type_ enemy-jump-info) symbol) - (enemy-method-83 () none) ;; 83 ;; (enemy-method-83 (_type_ enemy-jump-info) none) - (enemy-method-84 () none) ;; 84 ;; (enemy-method-84 (_type_ enemy-jump-info) none) - (enemy-method-85 () none) ;; 85 ;; (enemy-method-85 (_type_) float) - (enemy-method-86 () none) ;; 86 ;; (enemy-method-86 (_type_) symbol) - (enemy-method-87 () none) ;; 87 ;; (enemy-method-87 (_type_ enemy-jump-info) symbol) - (enemy-method-88 () none) ;; 88 ;; (enemy-method-88 (_type_ enemy-jump-info) symbol) - (enemy-method-89 () none) ;; 89 ;; (enemy-method-89 (_type_ enemy-jump-info) symbol) - (enemy-method-90 () none) ;; 90 ;; (enemy-method-90 (_type_ int enemy-jump-info) symbol) - (enemy-method-91 () none) ;; 91 ;; (enemy-method-91 (_type_ int enemy-jump-info) none) - (enemy-method-92 () none) ;; 92 ;; (enemy-method-92 (_type_ int enemy-jump-info) none) - (enemy-method-93 () none) ;; 93 ;; (enemy-method-93 (_type_) none) - (enemy-method-94 () none) ;; 94 ;; (enemy-method-94 (_type_ vector float) symbol) - (enemy-method-95 () none) ;; 95 ;; (enemy-method-95 (_type_ vector float) symbol) - (enemy-method-96 () none) ;; 96 ;; (enemy-method-96 (_type_ float symbol) symbol) - (enemy-method-97 () none) ;; 97 ;; (enemy-method-97 (_type_) process) - (enemy-method-98 () none) ;; 98 ;; (in-aggro-range? (_type_ process-focusable vector) symbol) - (enemy-method-99 () none) ;; 99 ;; (enemy-method-99 (_type_ process-focusable) symbol) - (enemy-method-100 () none) ;; 100 ;; (enemy-method-100 (_type_) symbol) - (enemy-method-101 () none) ;; 101 ;; (enemy-method-101 (_type_) none) - (enemy-method-102 () none) ;; 102 ;; (enemy-method-102 (_type_) symbol) - (enemy-method-103 () none) ;; 103 ;; (enemy-method-103 (_type_) collide-spec) - (enemy-method-104 () none) ;; 104 ;; (enemy-method-104 (_type_ process touching-shapes-entry uint) symbol) - (enemy-method-105 () none) ;; 105 ;; (enemy-method-105 (_type_ process) enemy-flag) - (enemy-method-106 () none) ;; 106 ;; (set-incoming-attack-info (_type_ process object penetrate attack-info) none) - (enemy-method-107 () none) ;; 107 ;; (get-enemy-target (_type_) process-focusable) - (enemy-method-108 () none) ;; 108 ;; (enemy-method-108 (_type_ process-drawable event-message-block) int) - (enemy-method-109 () none) ;; 109 ;; (look-at-target! (_type_ enemy-flag) none) - (enemy-method-110 () none) ;; 110 ;; (stop-looking-at-target! (_type_) none) - (enemy-method-111 () none) ;; 111 ;; (enemy-method-111 (_type_) none) - (enemy-method-112 () none) ;; 112 ;; (set-enemy-info! (_type_ enemy-info) none) - (enemy-method-113 () none) ;; 113 ;; (init-enemy-behaviour-and-stats! (_type_ enemy-info) none) - (enemy-method-114 () none) ;; 114 ;; (init-enemy-collision! (_type_) none) - (enemy-method-115 () none) ;; 115 ;; (init-enemy! (_type_) none) - (enemy-method-116 () none) ;; 116 ;; (go-idle (_type_) none) - (enemy-method-117 () none) ;; 117 ;; (rnd-float (_type_) float) - (enemy-method-118 () none) ;; 118 ;; (rnd-float-range (_type_ float float) float) - (enemy-method-119 () none) ;; 119 ;; (rnd-int-count (_type_ int) int) - (enemy-method-120 () none) ;; 120 ;; (rnd-bit (_type_ int int) int) - (enemy-method-121 () none) ;; 121 ;; (rnd-int-range (_type_ int int) int) - (enemy-method-122 () none) ;; 122 ;; (rnd-percent? (_type_ float) symbol) - (enemy-method-123 () none) ;; 123 ;; (rnd-go-idle? (_type_ float) symbol) - (enemy-method-124 () none) ;; 124 ;; (enemy-method-124 (_type_) collide-spec) - (enemy-method-125 () none) ;; 125 ;; (ground-pat-set! (_type_ collide-query collide-spec float float float) pat-surface) - (enemy-method-126 () none) ;; 126 ;; (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) - (enemy-method-127 () none) ;; 127 ;; (enemy-method-127 (_type_ float float symbol collide-spec) symbol) - (enemy-method-128 () none) ;; 128 ;; (enemy-method-128 (_type_ vector move-above-ground-params) none) - (enemy-method-129 () none) ;; 129 ;; (enemy-method-129 (_type_) none) - (enemy-method-130 () none) ;; 130 ;; (enemy-method-130 (_type_ float) symbol) - (enemy-method-131 () none) ;; 131 ;; (penetrate-using->knocked (_type_ penetrate) knocked-type) - (enemy-method-132 () none) ;; 132 ;; (dying (_type_) none) - (enemy-method-133 () none) ;; 133 ;; (enemy-method-133 (_type_) symbol) - (enemy-method-134 () none) ;; 134 ;; (get-attacker (_type_ process attack-info) process-focusable) - (enemy-method-135 () none) ;; 135 ;; (enemy-method-135 (_type_ int) sound-id) - (enemy-method-136 () none) ;; 136 ;; (enemy-method-136 (_type_) enemy-flag) - (enemy-method-137 () none) ;; 137 - (enemy-method-138 () none) ;; 138 - (enemy-method-139 () none) ;; 139 - (enemy-method-140 () none) ;; 140 - (enemy-method-141 () none) ;; 141 - (enemy-method-142 () none) ;; 142 - (enemy-method-143 () none) ;; 143 - (enemy-method-144 () none) ;; 144 - (enemy-method-145 () none) ;; 145 - (enemy-method-146 () none) ;; 146 - (enemy-method-147 () none) ;; 147 - (enemy-method-148 () none) ;; 148 - (enemy-method-149 () none) ;; 149 - (enemy-method-150 () none) ;; 150 - (enemy-method-151 () none) ;; 151 - (enemy-method-152 () none) ;; 152 - (enemy-method-153 () none) ;; 153 - (enemy-method-154 () none) ;; 154 + (:state-methods + dormant ;; 28 + dormant-aware ;; 29 + hit ;; 30 + knocked ;; 31 + knocked-recover ;; 32 + idle ;; 33 + active ;; 34 + notice ;; 35 + flee ;; 36 + stare ;; 37 + hostile ;; 38 + victory ;; 39 + die ;; 40 + die-falling ;; 41 + die-fast ;; 42 + directed ;; 43 + jump ;; 44 + jump-blocked ;; 45 + ambush-delay ;; 46 + ambush ;; 47 + view-anims ;; 48 + gun-dark-2-stretch ;; 49 + ) + (:methods + (enemy-method-50 (_type_ int) none) ;; 50 + (accelerate-fall! (_type_ vector) float) ;; 51 + (damage-enemy! (_type_ object event-message-block) float) ;; 52 + (reset-penetrate! (_type_) none) ;; 53 + (get-knockback-dir! (_type_ vector) vector) ;; 54 + (get-knockback-angle (_type_) degrees) ;; 55 + (knocked-handler (_type_ vector) object) ;; 56 + (can-collide-with-focus? (_type_ process-focusable) object) ;; 57 + (check-water (_type_) object) ;; 58 + (enemy-common-post (_type_) none) ;; 59 + (lerp-damage (_type_ float) float) ;; 60 + (scale-impact-vel-y! (_type_ vector vector float) vector) ;; 61 + (get-damage-from-attack (_type_ object event-message-block) float) ;; 62 + (enemy-method-63 (_type_ float) float) ;; 63 + (update-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) ;; 64 + (penetrate->next-state (_type_) symbol) ;; 65 + (get-penetrated-by (_type_) penetrate) ;; 66 + (coin-flip? (_type_) symbol) ;; 67 + (get-enemy-aware (_type_ enemy-aware) enemy-aware) ;; 68 + (enemy-method-69 (_type_) none) ;; 69 + (enemy-method-70 (_type_ process-focusable enemy-aware) none) ;; 70 + (go-dormant (_type_) object) ;; 71 + (go-dormant-aware (_type_) object) ;; 72 + (go-idle (_type_) object) ;; 73 + (go-ambush-delay (_type_) object) ;; 74 + (go-stare (_type_) object) ;; 75 + (go-stare2 (_type_) object) ;; 76 + (go-directed (_type_) object) ;; 77 + (go-hostile (_type_) object) ;; 78 + (go-flee (_type_) object) ;; 79 + (go-best-state (_type_) object) ;; 80 + (go-die (_type_) object) ;; 81 + (event-handler (_type_ process int symbol event-message-block) object :behavior enemy) ;; 82 + (enemy-touch-handler (_type_ process event-message-block) none) ;; 83 + (send-attack-on-jump-or-knocked (_type_ process event-message-block) none) ;; 84 + (knocked-anim (_type_ enemy-knocked-info) symbol) ;; 85 + (knocked-land-anim (_type_ enemy-knocked-info) symbol) ;; 86 + (knocked-anim-handler (_type_ int enemy-knocked-info) symbol) ;; 87 + (enemy-method-88 (_type_ enemy-knocked-info) symbol) ;; 88 + (within-gspot-range? (_type_) symbol) ;; 89 + (enemy-method-90 (_type_ ragdoll-proc) none) ;; 90 + (enemy-method-91 (_type_) symbol) ;; 91 + (init-jump-info! (_type_ enemy-jump-info) none) ;; 92 + (setup-jump! (_type_ enemy-jump-info) none) ;; 93 + (move-to-gspot! (_type_) float) ;; 94 + (on-ground? (_type_) symbol) ;; 95 + (jump-in-air-anim (_type_ enemy-jump-info) symbol) ;; 96 + (jump-land-anim (_type_ enemy-jump-info) symbol) ;; 97 + (jump-wind-up-anim (_type_ enemy-jump-info) symbol) ;; 98 + (jump-anim-handler (_type_ int enemy-jump-info) symbol) ;; 99 + (in-jump-handler (_type_ int enemy-jump-info) none) ;; 100 + (enemy-method-101 (_type_) none) ;; 101 + (go-directed2 (_type_) object) ;; 102 + (enemy-method-103 (_type_ vector float) symbol) ;; 103 + (enemy-method-104 (_type_ vector float) symbol) ;; 104 + (enemy-method-105 (_type_ float symbol) symbol) ;; 105 + (find-best-focus (_type_) process) ;; 106 + (enemy-method-107 (_type_) symbol) ;; 107 + (enemy-method-108 (_type_) symbol) ;; 108 + (enemy-method-109 (_type_) symbol) ;; 109 + (send-attack (_type_ process touching-shapes-entry uint) symbol) ;; 110 + (on-attack (_type_ process-focusable) none) ;; 111 + (get-incoming-attack! (_type_ process-drawable event-message-block penetrate attack-info touching-shapes-entry) none) ;; 112 + (get-focus! (_type_) process-focusable) ;; 113 + (send-attack-to-all-tshapes (_type_ process-focusable event-message-block) int) ;; 114 + (set-look-at-mode! (_type_ int) none) ;; 115 + (stop-look-at! (_type_) none) ;; 116 + (apply-friction (_type_) none) ;; 117 + (init-enemy-info! (_type_ enemy-info) none) ;; 118 + (init-enemy-defaults! (_type_ enemy-info) none) ;; 119 + (init-enemy-collision! (_type_) none) ;; 120 + (init-enemy! (_type_) none) ;; 121 + (go-idle2 (_type_) object) ;; 122 + (enemy-method-123 (_type_) symbol) ;; 123 + (disable-ragdoll (_type_) none) ;; 124 + (ragdoll-settled? (_type_) object) ;; 125 + (ragdoll-spawn! (_type_ symbol symbol) vector) ;; 126 + (deactivate-ragdoll! (_type_) none) ;; 127 + (rnd-float (_type_) float) ;; 128 + (rnd-float-range (_type_ float float) float) ;; 129 + (rnd-int (_type_ int) int) ;; 130 + (enemy-method-131 (_type_ int int) int) ;; 131 + (set-reaction-time! (_type_ time-frame time-frame) time-frame) ;; 132 + (rnd-chance? (_type_ float) symbol) ;; 133 + (enemy-method-134 (_type_ float) symbol) ;; 134 + (enemy-method-135 (_type_) none) ;; 135 + (set-ground-pat! (_type_ collide-query collide-spec float float float) pat-surface) ;; 136 + (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) ;; 137 + (try-locate-ground (_type_ meters meters symbol collide-spec) symbol) ;; 138 + (move-above-ground! (_type_ vector move-above-ground-params) none) ;; 139 + (update-focus (_type_) process) ;; 140 + (enemy-method-141 (_type_ float) symbol) ;; 141 + (penetrate->knocked-type (_type_ penetrate) knocked-type) ;; 142 + (on-dying (_type_) none) ;; 143 + (falling? (_type_) symbol) ;; 144 + (find-offending-pfoc (_type_ process attack-info) process-focusable) ;; 145 + (play-damage-sound (_type_ int) sound-id) ;; 146 + (check-victory (_type_) none) ;; 147 + (go-gun-dark-2-stretch (_type_) object) ;; 148 + (have-less-than-10-joints? (_type_) object) ;; 149 + (enemy-method-150 (_type_) symbol) ;; 150 + (should-move-to-ground? (_type_) symbol) ;; 151 + (enemy-method-152 (_type_) float) ;; 152 + (get-gem-pool-idx (_type_) int) ;; 153 + (mark-as-dead (_type_) none) ;; 154 ) ) -|# -#| (deftype anim-info (structure) ((anim-index int32 :offset-assert 0) (travel-speed meters :offset-assert 4) @@ -40785,14 +40868,11 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-enemy-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype nav-enemy-info (enemy-info) ((callback-info nav-callback-info :offset-assert 420) (use-momentum symbol :offset-assert 424) ;; guessed by decompiler @@ -40810,11 +40890,11 @@ (walk-travel-speed meters :offset-assert 472) (walk-acceleration meters :offset-assert 476) (walk-turning-acceleration meters :offset-assert 480) - (maximum-rotation-rate deg :offset-assert 484) ;; degrees + (maximum-rotation-rate degrees :offset-assert 484) ;; degrees (notice-nav-radius meters :offset-assert 488) (frustration-distance meters :offset-assert 492) - (frustration-time uint64 :offset-assert 496) ;; time-frame - (blocked-time uint64 :offset-assert 504) ;; time-frame + (frustration-time time-frame :offset-assert 496) ;; time-frame + (blocked-time time-frame :offset-assert 504) ;; time-frame (circle-dist-lo float :offset-assert 512) (circle-dist-hi float :offset-assert 516) (nav-mesh nav-mesh :offset-assert 520) ;; guessed by decompiler @@ -40823,67 +40903,71 @@ :size-assert #x20c :flag-assert #xb0000020c (:methods - (nav-enemy-info-method-10 () none) ;; 10 ;; (copy-nav-enemy-info! (_type_ nav-enemy-info) none) + (copy! (_type_ nav-enemy-info) none) ;; 10 ) ) -|# -#| (deftype nav-enemy (enemy) - ((frustration-point vector :inline :offset-assert 560) + ((enemy-info nav-enemy-info :override) + (frustration-point vector :inline :offset-assert 560) (move-dest vector :inline :offset-assert 576) - (frustration-time uint64 :offset-assert 592) ;; time-frame - (blocked-start-time uint64 :offset-assert 600) ;; time-frame - (restore-nav-radius-time uint64 :offset-assert 608) ;; time-frame + (frustration-time time-frame :offset-assert 592) ;; time-frame + (blocked-start-time time-frame :offset-assert 600) ;; time-frame + (restore-nav-radius-time time-frame :offset-assert 608) ;; time-frame (nav-radius-backup float :offset-assert 616) - (circle-radial-dist float :offset-assert 244) + (circle-radial-dist float :offset 244) ) :method-count-assert 190 :size-assert #x26c :flag-assert #xbe01f0026c - (:methods - (nav-enemy-method-155 () none) ;; 155 ;; (nav-enemy-method-155 (_type_) none) - (nav-enemy-method-156 () none) ;; 156 ;; (nav-enemy-method-156 (_type_) none) - (nav-enemy-method-157 () none) ;; 157 ;; (nav-enemy-method-157 (_type_ vector) nav-poly) - (nav-enemy-method-158 () none) ;; 158 ;; (nav-enemy-method-158 (_type_ vector) object) - (nav-enemy-method-159 () none) ;; 159 ;; (nav-enemy-method-159 (_type_ vector) symbol) - (nav-enemy-method-160 () none) ;; 160 ;; (nav-enemy-method-160 (_type_) none) - (nav-enemy-method-161 () none) ;; 161 ;; (nav-enemy-method-161 (_type_) none) - (nav-enemy-method-162 () none) ;; 162 ;; (nav-enemy-method-162 (_type_) none) - (nav-enemy-method-163 () none) ;; 163 ;; (nav-enemy-method-163 (_type_) symbol) - (nav-enemy-method-164 () none) ;; 164 ;; (nav-enemy-method-164 (_type_) none) - (nav-enemy-method-165 () none) ;; 165 ;; (nav-enemy-method-165 (_type_) none) - (nav-enemy-method-166 () none) ;; 166 ;; (nav-enemy-method-166 (_type_) none) - (nav-enemy-method-167 () none) ;; 167 ;; (nav-enemy-method-167 (_type_) none) - (nav-enemy-method-168 () none) ;; 168 ;; (nav-enemy-method-168 (_type_) float) - (nav-enemy-method-169 () none) ;; 169 ;; (nav-enemy-method-169 (_type_ float symbol) float) - (nav-enemy-method-170 () none) ;; 170 ;; (nav-enemy-method-170 (_type_) none) - (nav-enemy-method-171 () none) ;; 171 ;; (nav-enemy-method-171 (_type_) none) - (nav-enemy-method-172 () none) ;; 172 ;; (nav-enemy-method-172 (_type_) none) - (nav-enemy-method-173 () none) ;; 173 ;; (nav-enemy-method-173 (_type_) none) - (nav-enemy-method-174 () none) ;; 174 ;; (nav-enemy-method-174 (_type_) symbol) - (nav-enemy-method-175 () none) ;; 175 ;; (nav-enemy-method-175 (_type_) symbol) - (nav-enemy-method-176 () none) ;; 176 ;; (nav-enemy-method-176 (_type_) none) - (nav-enemy-method-177 () none) ;; 177 ;; (nav-enemy-method-177 (_type_) none) - (nav-enemy-method-178 () none) ;; 178 - (nav-enemy-method-179 () none) ;; 179 - (nav-enemy-method-180 () none) ;; 180 - (nav-enemy-method-181 () none) ;; 181 - (nav-enemy-method-182 () none) ;; 182 - (nav-enemy-method-183 () none) ;; 183 - (nav-enemy-method-184 () none) ;; 184 - (nav-enemy-method-185 () none) ;; 185 - (nav-enemy-method-186 () none) ;; 186 - (nav-enemy-method-187 () none) ;; 187 - (nav-enemy-method-188 () none) ;; 188 - (nav-enemy-method-189 () none) ;; 189 + (:state-methods + taunt ;; 155 + pacing ;; 156 + circling ;; 157 + stop-chase ;; 158 + debug-control ;; 159 + ) + (:methods + ;; (nav-enemy-method-155 () none) ;; 155 ;; (nav-enemy-method-155 (_type_) none) + ;; (nav-enemy-method-156 () none) ;; 156 ;; (nav-enemy-method-156 (_type_) none) + ;; (nav-enemy-method-157 () none) ;; 157 ;; (nav-enemy-method-157 (_type_ vector) nav-poly) + ;; (nav-enemy-method-158 () none) ;; 158 ;; (nav-enemy-method-158 (_type_ vector) object) + ;; (nav-enemy-method-159 () none) ;; 159 ;; (nav-enemy-method-159 (_type_ vector) symbol) + (nav-enemy-method-160 (_type_) none) ;; 160 ;; (nav-enemy-method-160 (_type_) none) + (nav-enemy-method-161 (_type_) none) ;; 161 ;; (nav-enemy-method-161 (_type_) none) + (nav-enemy-method-162 (_type_) none) ;; 162 ;; (nav-enemy-method-162 (_type_) none) + (nav-enemy-method-163 (_type_) none) ;; 163 ;; (nav-enemy-method-163 (_type_) symbol) + (nav-enemy-method-164 (_type_) none) ;; 164 ;; (nav-enemy-method-164 (_type_) none) + (nav-enemy-method-165 (_type_) none) ;; 165 ;; (nav-enemy-method-165 (_type_) none) + (nav-enemy-method-166 (_type_) none) ;; 166 ;; (nav-enemy-method-166 (_type_) none) + (nav-enemy-method-167 (_type_) none) ;; 167 ;; (nav-enemy-method-167 (_type_) none) + (nav-enemy-method-168 (_type_) none) ;; 168 ;; (nav-enemy-method-168 (_type_) float) + (nav-enemy-method-169 (_type_) none) ;; 169 ;; (nav-enemy-method-169 (_type_ float symbol) float) + (nav-enemy-method-170 (_type_) none) ;; 170 ;; (nav-enemy-method-170 (_type_) none) + (nav-enemy-method-171 (_type_) none) ;; 171 ;; (nav-enemy-method-171 (_type_) none) + (nav-enemy-method-172 (_type_) none) ;; 172 ;; (nav-enemy-method-172 (_type_) none) + (nav-enemy-method-173 (_type_) none) ;; 173 ;; (nav-enemy-method-173 (_type_) none) + (nav-enemy-method-174 (_type_) none) ;; 174 ;; (nav-enemy-method-174 (_type_) symbol) + (nav-enemy-method-175 (_type_) none) ;; 175 ;; (nav-enemy-method-175 (_type_) symbol) + (nav-enemy-method-176 (_type_) none) ;; 176 ;; (nav-enemy-method-176 (_type_) none) + (nav-enemy-method-177 (_type_) none) ;; 177 ;; (nav-enemy-method-177 (_type_) none) + (nav-enemy-method-178 (_type_) none) ;; 178 + (nav-enemy-method-179 (_type_) none) ;; 179 + (nav-enemy-method-180 (_type_) none) ;; 180 + (nav-enemy-method-181 (_type_) none) ;; 181 + (nav-enemy-method-182 (_type_) none) ;; 182 + (nav-enemy-method-183 (_type_) none) ;; 183 + (nav-enemy-method-184 (_type_) none) ;; 184 + (nav-enemy-method-185 (_type_) none) ;; 185 + (nav-enemy-method-186 (_type_) none) ;; 186 + (nav-enemy-method-187 (_type_) none) ;; 187 + (nav-enemy-method-188 (_type_) none) ;; 188 + (nav-enemy-method-189 (_type_) none) ;; 189 ) ) -|# -#| (deftype nav-enemy-debug-control-info (basic) - ((enable basic :offset-assert 4) + ((enable symbol :offset-assert 4) (steering float :offset-assert 8) (throttle float :offset-assert 12) ) @@ -40891,59 +40975,56 @@ :size-assert #x10 :flag-assert #x900000010 ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enemy ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *enemy-dummy-shadow-control* shadow-control) ;; shadow-control -;; (define-extern get-penetrate-using-from-attack-event function) ;; (function process-drawable event-message-block penetrate) -;; (define-extern enemy-setup-gem function) -;; (define-extern enemy-init-by-other function) ;; (function process-drawable enemy-init-by-other-params none :behavior enemy) -;; (define-extern enemy-event-handler function) ;; (function process int symbol event-message-block object :behavior enemy) -;; (define-extern enemy-simple-post function) ;; (function none :behavior enemy) -;; (define-extern enemy-falling-post function) ;; (function none :behavior enemy) -;; (define-extern enemy-die-falling-post function) ;; (function none :behavior enemy) -;; (define-extern *shockwave-knock-scalar* curve2d-fast) -;; (define-extern ja-group-index? function) ;; (function int symbol :behavior enemy) +(define-extern *enemy-dummy-shadow-control* shadow-control) +(define-extern get-penetrate-using-from-attack-event (function process-drawable event-message-block penetrate)) +(define-extern enemy-setup-gem (function object :behavior enemy)) +(define-extern enemy-init-by-other (function process-drawable enemy-init-by-other-params object :behavior enemy)) +(define-extern enemy-event-handler (function process int symbol event-message-block object :behavior enemy)) +(define-extern enemy-simple-post (function none :behavior enemy)) +(define-extern enemy-falling-post (function none :behavior enemy)) +(define-extern enemy-die-falling-post (function none :behavior enemy)) +(define-extern *shockwave-knock-scalar* curve2d-fast) +(define-extern ja-group-index? (function int symbol :behavior enemy)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enemy-states ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern gun-dark-2-anim-code function) -;; (define-extern gun-dark-2-ragdoll-start function) +(define-extern gun-dark-2-anim-code (function object :behavior enemy)) +(define-extern gun-dark-2-ragdoll-start (function enemy object)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; nav-enemy ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *nav-enemy-dummy-shadow-control* shadow-control) ;; shadow-control -;; (define-extern nav-enemy-simple-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-die-falling-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-travel-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-patrol-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-chase-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-flee-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-face-focus-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-stare-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-falling-post function) ;; (function none :behavior nav-enemy) -;; (define-extern nav-enemy-turn-to-face-dir function) ;; (function vector float none :behavior nav-enemy) -;; (define-extern nav-enemy-turn-to-face-point function) ;; (function vector float none :behavior nav-enemy) -;; (define-extern *nav-enemy-debug-control-info* nav-enemy-debug-control-info) ;; nav-enemy-debug-control-info -;; (define-extern nav-enemy-debug-control-post function) ;; (function none :behavior nav-enemy) +(define-extern *nav-enemy-dummy-shadow-control* shadow-control) +(define-extern nav-enemy-simple-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-die-falling-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-travel-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-patrol-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-chase-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-flee-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-face-focus-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-stare-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-falling-post (function none :behavior nav-enemy)) +(define-extern nav-enemy-turn-to-face-dir (function vector float none :behavior nav-enemy)) +(define-extern nav-enemy-turn-to-face-point (function vector float none :behavior nav-enemy)) +(define-extern *nav-enemy-debug-control-info* nav-enemy-debug-control-info) +(define-extern nav-enemy-debug-control-post (function none :behavior nav-enemy)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; base-plat ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype base-plat (process-focusable) ((smush smush-control :inline :offset-assert 208) (basetrans vector :inline :offset-assert 240) - (bounce-time uint64 :offset-assert 256) ;; time-frame + (bounce-time time-frame :offset-assert 256) ;; time-frame (bouncing symbol :offset-assert 264) ;; guessed by decompiler (bounce-scale meters :offset-assert 268) ) @@ -40951,27 +41032,37 @@ :size-assert #x110 :flag-assert #x2300900110 (:methods - (base-plat-method-28 () none) ;; 28 ;; (stop-bouncing! (_type_) none) - (base-plat-method-29 () none) ;; 29 ;; (start-bouncing! (_type_) none) - (base-plat-method-30 () none) ;; 30 ;; (get-art-group (_type_) art-group) - (base-plat-method-31 () none) ;; 31 ;; (init-plat-collision! (_type_) none) - (base-plat-method-32 () none) ;; 32 ;; (base-plat-method-32 (_type_) none) - (base-plat-method-33 () none) ;; 33 ;; (init-plat! (_type_) none) - (base-plat-method-34 () none) ;; 34 + (update-part-and-sfx! (_type_) none) ;; 28 ;; (stop-bouncing! (_type_) none) + (init-bounce-params! (_type_) none) ;; 29 + (start-bounce! (_type_) none :behavior base-plat) ;; 30 ;; (get-art-group (_type_) art-group) + (get-art-group (_type_) art-group) ;; 31 + (init-collision! (_type_) none) ;; 32 + (base-plat-method-33 (_type_) none) ;; 33 ;; (init-plat! (_type_) none) + (base-plat-method-34 (_type_) none) ;; 34 ) ) -|# -#| +;; +++base-plat:eco-door-flags +(defenum eco-door-flags + :type int32 + :bitfield #t + (locked 0) + (unlocked 1) + (auto-close 2) + (one-way 3) + ) +;; ---base-plat:eco-door-flags + (deftype eco-door (process-drawable) - ((speed float :offset-assert 200) + ((root collide-shape :override) + (speed float :offset-assert 200) (open-distance float :offset-assert 204) (close-distance float :offset-assert 208) (out-dir vector :inline :offset-assert 224) - (open-sound uint128 :offset-assert 240) ;; sound-name - (close-sound uint128 :offset-assert 256) ;; sound-name + (open-sound sound-name :offset-assert 240) ;; sound-name + (close-sound sound-name :offset-assert 256) ;; sound-name (state-actor entity-actor :offset-assert 272) ;; guessed by decompiler - (flags int32 :offset-assert 276) ;; eco-door-flags + (flags eco-door-flags :offset-assert 276) ;; eco-door-flags (locked symbol :offset-assert 280) ;; guessed by decompiler (auto-close symbol :offset-assert 284) ;; guessed by decompiler (one-way symbol :offset-assert 288) ;; guessed by decompiler @@ -40979,31 +41070,29 @@ :method-count-assert 27 :size-assert #x124 :flag-assert #x1b00b00124 - (:methods - (eco-door-method-24 () none) ;; 24 ;; (lock-according-to-task! (_type_) none) - (eco-door-method-25 () none) ;; 25 ;; (eco-door-method-25 (_type_) none) - (eco-door-method-26 () none) ;; 26 ;; (stub (_type_) none) - ) (:state-methods - door-closing ;; 23, old: (door-closing () _type_ :state) - door-open ;; 22, old: (door-open () _type_ :state) - door-opening ;; 21, old: (door-opening () _type_ :state) - door-closed ;; 20, old: (door-closed () _type_ :state) + door-closed ;; 20 + door-opening ;; 21 + door-open ;; 22 + door-closing ;; 23 + ) + (:methods + (update-lock-status! (_type_) none) ;; 24 + (init-collision! (_type_) none) ;; 25 + (eco-door-method-26 (_type_) none) ;; 26 ;; (stub (_type_) none) ) ) -|# -;; (define-extern plat-code function) ;; (function none :behavior base-plat) -;; (define-extern plat-trans function) ;; (function none :behavior base-plat) -;; (define-extern plat-post function) ;; (function none :behavior base-plat) -;; (define-extern plat-event function) ;; (function process int symbol event-message-block object :behavior base-plat) -;; (define-extern eco-door-event-handler function) ;; (function process int symbol event-message-block object :behavior eco-door) +(define-extern plat-code (function none :behavior base-plat)) +(define-extern plat-trans (function none :behavior base-plat)) +(define-extern plat-post (function none :behavior base-plat)) +(define-extern plat-event (function process int symbol event-message-block object :behavior base-plat)) +(define-extern eco-door-event-handler (function process int symbol event-message-block object :behavior eco-door)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; plat ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype plat (base-plat) ((path-pos float :offset-assert 272) (sound-id sound-id :offset-assert 276) ;; guessed by decompiler @@ -41012,83 +41101,92 @@ :method-count-assert 38 :size-assert #x144 :flag-assert #x2600d00144 - (:methods - (plat-method-37 () none) ;; 37 - ) (:state-methods - plat-path-active ;; 36, old: (plat-path-sync (_type_) object) - plat-idle ;; 35, old: (plat-path-active () _type_ :state) + plat-idle ;; 35 + plat-path-active ;; 36 + ) + (:methods + (go-initial-state (_type_) object) ;; 37 ) ) -|# -#| (deftype drop-plat (base-plat) ((art-name string :offset-assert 272) ;; guessed by decompiler (anim spool-anim :offset-assert 276) ;; guessed by decompiler (break-anim-name string :offset-assert 280) ;; guessed by decompiler - (safe-time uint64 :offset-assert 288) ;; time-frame + (safe-time time-frame :offset-assert 288) ;; time-frame (hit-point vector :inline :offset-assert 304) ) :method-count-assert 37 :size-assert #x140 :flag-assert #x2500c00140 (:state-methods - fall ;; 36 - idle ;; 35, old: (fall (symbol) _type_ :state) + idle ;; 35 + (fall symbol) ;; 36 ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; bouncer ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype bouncer (process-drawable) - ((spring-height meters :offset-assert 200) + ((root collide-shape :override) + (spring-height meters :offset-assert 200) (smush float :offset-assert 204) (mods basic :offset-assert 208) - (use-alternate-jump? basic :offset-assert 212) + (use-alternate-jump? symbol :offset-assert 212) ) :method-count-assert 27 :size-assert #xd8 :flag-assert #x1b006000d8 - (:methods - (bouncer-method-23 () none) ;; 23 ;; (init-skeleton! (_type_) none) - (bouncer-method-24 () none) ;; 24 ;; (bouncer-method-24 (_type_) none) - (bouncer-method-25 () none) ;; 25 - (bouncer-method-26 () none) ;; 26 - ) (:state-methods - fire ;; 21, old: (fire () _type_ :state) - smush ;; 22, old: (smush () _type_ :state) - idle ;; 20, old: (idle () _type_ :state) + idle ;; 20 + fire ;; 21 + smush ;; 22 + ) + (:methods + (bouncer-method-23 (_type_) none) ;; 23 ;; (init-skeleton! (_type_) none) + (bouncer-method-24 (_type_) none) ;; 24 ;; (bouncer-method-24 (_type_) none) + (play-sound (_type_) none) ;; 25 + (bouncer-method-26 (_type_) none) ;; 26 ) ) -|# - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; elevator ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +;; +++elevator:elevator-flags +(defenum elevator-flags + :type uint64 + :bitfield #t + (running 0) + (ef1 1) + (waiting 2) + (ef3 3) + (teleport 4) + (prevent-jump 5) + (arrived 6) + (ef7 7) + (fence 8) + (grab 9) + (dormant 10) + ) +;; ---elevator:elevator-flags + (deftype elevator-params (structure) ((xz-threshold float :offset-assert 0) (y-threshold float :offset-assert 4) (start-pos float :offset-assert 8) (move-rate float :offset-assert 12) - (flags uint64 :offset-assert 16) ;; elevator-flags + (flags elevator-flags :offset-assert 16) ;; elevator-flags ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype path-step (structure) ((next-pos float :offset-assert 0) (dist float :offset-assert 4) @@ -41097,19 +41195,25 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype path-step-inline-array (inline-array-class) - ((data path-step :dynamic :offset-assert 16) ;; guessed by decompiler + ((data path-step :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 14 :size-assert #x10 :flag-assert #xe00000010 ) -|# -#| +;; +++elevator:elevator-status +(defenum elevator-status + :type uint64 + :bitfield #t + (waiting-to-descend) + (waiting-to-ascend) + (moving) + ) +;; ---elevator:elevator-status + (deftype elevator (base-plat) ((params elevator-params :inline :offset-assert 272) (path-seq path-step-inline-array :offset-assert 296) ;; guessed by decompiler @@ -41119,62 +41223,60 @@ (move-dist float :offset-assert 320) (path-pos float :offset-assert 324) (path-eased-pos float :offset-assert 328) - (ride-timer uint64 :offset-assert 336) ;; time-frame - (sticky-player-last-ride-time uint64 :offset-assert 344) ;; time-frame - (elevator-status uint64 :offset-assert 352) ;; elevator-status + (ride-timer time-frame :offset-assert 336) ;; time-frame + (sticky-player-last-ride-time time-frame :offset-assert 344) ;; time-frame + (elevator-status elevator-status :offset-assert 352) ;; elevator-status (on-activate pair :offset-assert 360) ;; guessed by decompiler (on-deactivate pair :offset-assert 364) ;; guessed by decompiler - (on-up basic :offset-assert 368) - (on-down basic :offset-assert 372) - (on-running basic :offset-assert 376) - (on-notice basic :offset-assert 380) - (on-wait basic :offset-assert 384) - (sound-id uint32 :offset-assert 388) - (sound-running-loop basic :offset-assert 392) - (sound-arrived basic :offset-assert 396) + (on-up pair :offset-assert 368) + (on-down pair :offset-assert 372) + (on-running pair :offset-assert 376) + (on-notice pair :offset-assert 380) + (on-wait pair :offset-assert 384) + (sound-id sound-id :offset-assert 388) + (sound-running-loop sound-spec :offset-assert 392) + (sound-arrived sound-spec :offset-assert 396) (fence-prim-index uint32 :offset-assert 400) (speed float :offset-assert 404) - (sound-start basic :offset-assert 408) - (activate-test basic :offset-assert 412) + (sound-start sound-spec :offset-assert 408) + (activate-test pair :offset-assert 412) ) :method-count-assert 52 :size-assert #x1a0 :flag-assert #x34012001a0 ;; field on-activate uses ~A with a signed load. field on-deactivate uses ~A with a signed load. field on-up uses ~A with a signed load. field on-down uses ~A with a signed load. field on-running uses ~A with a signed load. field on-notice uses ~A with a signed load. field on-wait uses ~A with a signed load. field activate-test uses ~A with a signed load. - (:methods - (elevator-method-39 () none) ;; 39 ;; (calc-dist-between-points! (_type_ int int) none) - (elevator-method-41 () none) ;; 41 ;; (init-defaults! (_type_) none) - (elevator-method-42 () none) ;; 42 ;; (set-ambient-sound! (_type_) none) - (elevator-method-43 () none) ;; 43 ;; (move-between-points (_type_ vector float float) symbol) - (elevator-method-44 () none) ;; 44 ;; (elevator-method-44 (_type_) symbol) - (elevator-method-45 () none) ;; 45 ;; (commited-to-ride? (_type_) symbol) - (elevator-method-46 () none) ;; 46 ;; (move-to-next-point! (_type_) none) - (elevator-method-47 () none) ;; 47 ;; (find-closest-point-in-path! (_type_ vector (pointer float) symbol symbol) symbol) - (elevator-method-48 () none) ;; 48 ;; (elevator-method-48 (_type_) none) - (elevator-method-49 () none) ;; 49 - (elevator-method-50 () none) ;; 50 - (elevator-method-51 () none) ;; 51 - ) (:state-methods - die ;; 40, old: (activate-elevator (_type_) object) - arrived ;; 38, old: (elevator-method-38 (_type_) none) - running ;; 37, old: (arrived () _type_ :state) - waiting ;; 36, old: (running () _type_ :state) - dormant ;; 35, old: (waiting () _type_ :state) + dormant ;; 35 + waiting ;; 36 + running ;; 37 + arrived ;; 38 + unknown ;; 39, method not defined! + die ;; 40 + ) + (:methods + (calc-dist-between-points! (_type_ int int) none) ;; 41 ;; (init-defaults! (_type_) none) + (go-arrived-or-waiting (_type_) none) ;; 42 ;; (set-ambient-sound! (_type_) none) + (init-params! (_type_) none) ;; 43 ;; (move-between-points (_type_ vector float float) symbol) + (init-sound! (_type_) none) ;; 44 + (point-inside-shaft? (_type_ vector float float) symbol) ;; 45 ;; (commited-to-ride? (_type_) symbol) + (elevator-method-46 (_type_) object) ;; 46 ;; (move-to-next-point! (_type_) none) + (elevator-method-47 (_type_) symbol) ;; 47 ;; (find-closest-point-in-path! (_type_ vector (pointer float) symbol symbol) symbol) + (elevator-method-48 (_type_) none) ;; 48 ;; (elevator-method-48 (_type_) none) + (find-closest-point-in-path! (_type_ vector (pointer float) symbol symbol) symbol) ;; 49 + (elevator-method-50 (_type_) none) ;; 50 + (toggle-fence-collision (_type_ symbol) none) ;; 51 ) ) -|# -;; (define-extern ease-value-in-out function) ;; (function float float float) -;; (define-extern elevator-event function) ;; (function process int symbol event-message-block object :behavior elevator) -;; (define-extern move-post function) ;; (function none :behavior elevator) -;; (define-extern teleport-check function) +(define-extern ease-value-in-out (function float float float)) +(define-extern elevator-event (function process int symbol event-message-block object :behavior elevator)) +(define-extern move-post (function none :behavior elevator)) +(define-extern teleport-check (function none :behavior elevator)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rigid-body ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype rigid-body-work (structure) ((max-ang-momentum float :offset-assert 0) (max-ang-velocity float :offset-assert 4) @@ -41183,11 +41285,10 @@ :size-assert #x8 :flag-assert #x900000008 ) -|# -#| (deftype rigid-body-move-work (structure) ((cquery collide-query :inline :offset-assert 0) + (best-dist float :offset 112 :score 2) ;; added (mat matrix :inline :offset-assert 544) (impact-info rigid-body-impact :inline :offset-assert 608) (impact-info2 rigid-body-impact :inline :offset-assert 672) @@ -41198,8 +41299,8 @@ (p-body vector :inline :offset-assert 800) (tmp vector :inline :offset-assert 816) (tangent-dir vector :inline :offset-assert 832) - (proc2 basic :offset-assert 848) - (rbody2 basic :offset-assert 852) + (proc2 process-focusable :offset-assert 848) + (rbody2 rigid-body-control :offset-assert 852) (vel-dot-norm float :offset-assert 856) (denom float :offset-assert 860) (denom2 float :offset-assert 864) @@ -41211,20 +41312,18 @@ :size-assert #x36d :flag-assert #x90000036d ) -|# -;; (define-extern *rigid-body-work* object) ;; rigid-body-work -;; (define-extern matrix-3x3-triple-transpose-product function) ;; (function matrix matrix matrix matrix) -;; (define-extern damping-time-adjust function) ;; (function float float float) -;; (define-extern transform-rigid-body-prims function) ;; (function collide-shape-prim matrix symbol) -;; (define-extern *rigid-body-object-constants* object) ;; rigid-body-object-constants -;; (define-extern rigid-body-object-event-handler function) ;; (function process int symbol event-message-block object :behavior rigid-body-object) +(define-extern *rigid-body-work* rigid-body-work) +(define-extern matrix-3x3-triple-transpose-product (function matrix matrix matrix matrix)) +(define-extern damping-time-adjust (function float float float)) +(define-extern transform-rigid-body-prims (function collide-shape-prim matrix symbol)) +(define-extern *rigid-body-object-constants* rigid-body-object-constants) +(define-extern rigid-body-object-event-handler (function process int symbol event-message-block object :behavior rigid-body-object)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; rigid-body-queue ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype rigid-body-queue-manager (process) ((queue rigid-body-queue :offset-assert 128) ) @@ -41232,23 +41331,21 @@ :size-assert #x84 :flag-assert #xf00100084 (:state-methods - idle ;; 14, old: (idle () _type_ :state) + idle ;; 14 ) ) -|# -;; (define-extern *rigid-body-queue-manager* object) -;; (define-extern rigid-body-queue-manager-init-by-other function) ;; (function rigid-body-queue object :behavior rigid-body-queue-manager) -;; (define-extern rigid-body-queue-manager-spawn function) ;; (function rigid-body-queue process-tree process) +(define-extern *rigid-body-queue-manager* rigid-body-queue-manager) +(define-extern rigid-body-queue-manager-init-by-other (function rigid-body-queue object :behavior rigid-body-queue-manager)) +(define-extern rigid-body-queue-manager-spawn (function rigid-body-queue process-tree process)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; joint-exploder ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype joint-exploder-tuning (structure) ((explosion uint64 :offset-assert 0) - (duration uint64 :offset-assert 8) ;; time-frame + (duration time-frame :offset-assert 8) ;; time-frame (gravity float :offset-assert 16) (rot-speed float :offset-assert 20) (bounds-inflate float :offset-assert 24) @@ -41259,21 +41356,22 @@ (friction float :offset-assert 44) (fountain-rand-transv-lo vector :inline :offset-assert 48) (fountain-rand-transv-hi vector :inline :offset-assert 64) - (away-from-focal-pt vector :inline :offset-assert 48) - (away-from-rand-transv-xz-lo float :offset-assert 64) - (away-from-rand-transv-xz-hi float :offset-assert 68) - (away-from-rand-transv-y-lo float :offset-assert 72) - (away-from-rand-transv-y-hi float :offset-assert 76) + (away-from-focal-pt vector :inline :offset 48) + (away-from-rand-transv-xz-lo float :offset 64) + (away-from-rand-transv-xz-hi float :offset 68) + (away-from-rand-transv-y-lo float :offset 72) + (away-from-rand-transv-y-hi float :offset 76) (hit-xz-reaction float :offset-assert 80) (hit-y-reaction float :offset-assert 84) ) :method-count-assert 9 :size-assert #x58 :flag-assert #x900000058 + (:methods + (new (symbol type uint) _type_) ;; 0 + ) ) -|# -#| (deftype joint-exploder-static-joint-params (structure) ((joint-index int16 :offset-assert 0) (parent-joint-index int16 :offset-assert 2) @@ -41282,23 +41380,19 @@ :size-assert #x4 :flag-assert #x900000004 ) -|# -#| (deftype joint-exploder-static-params (basic) ((joints (array joint-exploder-static-joint-params) :offset-assert 4) ;; guessed by decompiler - (collide-spec uint32 :offset-assert 8) + (collide-spec collide-spec :offset-assert 8) (art-level symbol :offset-assert 12) ;; guessed by decompiler - (collide-sound uint128 :offset-assert 16) - (collide-sound-interval uint64 :offset-assert 32) + (collide-sound sound-name :offset-assert 16) + (collide-sound-interval time-frame :offset-assert 32) ) :method-count-assert 9 :size-assert #x28 :flag-assert #x900000028 ) -|# -#| (deftype joint-exploder-joint (structure) ((next int16 :offset-assert 0) (prev int16 :offset-assert 2) @@ -41313,20 +41407,19 @@ :size-assert #xf0 :flag-assert #x9000000f0 ) -|# -#| (deftype joint-exploder-joints (basic) ((num-joints int32 :offset-assert 4) - (joint joint-exploder-joint :dynamic :offset-assert 16) ;; guessed by decompiler + (joint joint-exploder-joint :dynamic :inline :offset-assert 16) ;; guessed by decompiler ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 + (:methods + (new (symbol type joint-exploder-static-params) _type_) ;; 0 + ) ) -|# -#| (deftype joint-exploder-list (structure) ((head int32 :offset-assert 0) (pre-moved? symbol :offset-assert 4) ;; guessed by decompiler @@ -41338,53 +41431,49 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype joint-exploder-list-array (inline-array-class) - ((data UNKNOWN :dynamic :offset-assert 16) + ((data joint-exploder-list :dynamic :inline :offset-assert 16) ) :method-count-assert 14 :size-assert #x10 :flag-assert #xe00000010 ) -|# -#| (deftype joint-exploder (process-drawable) - ((die-if-below-y float :offset-assert 200) + ((parent (pointer process-drawable) :override) + (die-if-below-y float :offset-assert 200) (die-if-beyond-xz-dist-sqrd float :offset-assert 204) (joints joint-exploder-joints :offset-assert 208) ;; guessed by decompiler (static-params joint-exploder-static-params :offset-assert 212) ;; guessed by decompiler (anim art-joint-anim :offset-assert 216) ;; guessed by decompiler (scale-vector vector :inline :offset-assert 224) (tuning joint-exploder-tuning :inline :offset-assert 240) - (lists joint-exploder-list :offset-assert 328) ;; guessed by decompiler - (last-colsound-time uint64 :offset-assert 336) + (lists joint-exploder-list-array :offset-assert 328) ;; guessed by decompiler + (last-colsound-time time-frame :offset-assert 336) ) :method-count-assert 30 :size-assert #x158 :flag-assert #x1e00e00158 (:methods - (joint-exploder-method-20 () none) ;; 20 ;; (add-joint-to-list (_type_ joint-exploder-list int) int) - (joint-exploder-method-21 () none) ;; 21 ;; (update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none) - (joint-exploder-method-22 () none) ;; 22 ;; (do-collision-response (_type_ joint-exploder-list) none) - (joint-exploder-method-23 () none) ;; 23 ;; (init-joint-list (_type_) none) - (joint-exploder-method-24 () none) ;; 24 ;; (remove-from-list-and-reset (_type_ joint-exploder-list int) int) - (joint-exploder-method-25 () none) ;; 25 ;; (final-adjust (_type_ joint-exploder-list int) int) - (joint-exploder-method-26 () none) ;; 26 ;; (integrate-and-kill (_type_ joint-exploder-list) none) - (joint-exploder-method-27 () none) ;; 27 ;; (remove-joint-from-list (_type_ joint-exploder-list int) int) - (joint-exploder-method-28 () none) ;; 28 ;; (adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list) - (joint-exploder-method-29 () none) ;; 29 ;; (adjust-bbox-for-limits (_type_ joint-exploder-list) none) + (add-joint-to-list (_type_ joint-exploder-list int) int) ;; 20 + (update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none) ;; 21 + (do-collision-response (_type_ joint-exploder-list) none) ;; 22 + (init-joint-list (_type_) none) ;; 23 + (remove-from-list-and-reset (_type_ joint-exploder-list int) int) ;; 24 + (final-adjust (_type_ joint-exploder-list int) int) ;; 25 + (integrate-and-kill (_type_ joint-exploder-list) none) ;; 26 + (remove-joint-from-list (_type_ joint-exploder-list int) int) ;; 27 + (adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list) ;; 28 + (adjust-bbox-for-limits (_type_ joint-exploder-list) none) ;; 29 ) (:states joint-exploder-shatter ;; associated process guessed by decompiler, old: (state joint-exploder) ) ) -|# -;; (define-extern joint-exploder-joint-callback function) ;; (function draw-control cspace-array joint-control none) -;; (define-extern joint-exploder-init-by-other function) ;; (function skeleton-group int joint-exploder-tuning joint-exploder-static-params none :behavior joint-exploder) +(define-extern joint-exploder-joint-callback (function draw-control cspace-array joint-control none)) +(define-extern joint-exploder-init-by-other (function skeleton-group int joint-exploder-tuning joint-exploder-static-params object :behavior joint-exploder)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; simple-nav-sphere ;; @@ -41412,7 +41501,7 @@ ;; process-taskable ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern process-taskable-anim-loop function) ;; (function (function process-taskable object) none :behavior process-taskable) +(define-extern process-taskable-anim-loop (function (function process-taskable object) none :behavior process-taskable)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; scene-actor ;; @@ -41524,6 +41613,14 @@ :flag-assert #x2800a00118 ) +;; added, was inside a top-level lambda +(deftype flut-npc (process-taskable) + () + :method-count-assert 40 + :size-assert #x118 + :flag-assert #x2800a00118 + ) + (define-extern pre-intro-play (function none)) (define-extern intro-play (function none)) (define-extern outro-play (function none)) @@ -41532,9 +41629,9 @@ ;; warp-gate ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype warp-gate (process-drawable) - ((level-name uint32 :offset-assert 200) ;; guessed by decompiler + ((root collide-shape :override) + (level-name symbol :offset-assert 200) ;; guessed by decompiler (on-notice pair :offset-assert 204) ;; guessed by decompiler (on-activate pair :offset-assert 208) ;; guessed by decompiler (on-close pair :offset-assert 212) ;; guessed by decompiler @@ -41542,27 +41639,25 @@ (continue continue-point :offset-assert 220) ;; guessed by decompiler (distance meters :offset-assert 224) (anim-speed float :offset-assert 228) - (test-time uint64 :offset-assert 232) ;; time-frame + (test-time time-frame :offset-assert 232) ;; time-frame (center vector :inline :offset-assert 240) ) :method-count-assert 26 :size-assert #x100 :flag-assert #x1a00800100 ;; field on-notice uses ~A with a signed load. field on-activate uses ~A with a signed load. field on-close uses ~A with a signed load. - (:methods - (warp-gate-method-23 () none) ;; 23 ;; (init-skel-and-collide (_type_) none) - (warp-gate-method-24 () none) ;; 24 ;; (setup-fields (_type_) none) - (warp-gate-method-25 () none) ;; 25 ;; (handle-notice (_type_) continue-point) - ) (:state-methods - use ;; 21, old: (use (continue-point) _type_ :state) - idle ;; 20, old: (idle () _type_ :state) - hidden ;; 22, old: (hidden () _type_ :state) + idle ;; 20 + (use continue-point) ;; 21 + hidden ;; 22 + ) + (:methods + (init-skel-and-collide! (_type_) none) ;; 23 + (init-defaults! (_type_) none) ;; 24 + (eval-on-notice (_type_) continue-point) ;; 25 ) ) -|# -#| (deftype air-train (warp-gate) ((part-exhaust-left sparticle-launch-control :offset-assert 256) ;; guessed by decompiler (part-exhaust-right sparticle-launch-control :offset-assert 260) ;; guessed by decompiler @@ -41574,29 +41669,24 @@ :method-count-assert 26 :size-assert #x130 :flag-assert #x1a00b00130 - (:state-methods - use ;; 21 - idle ;; 20 - ) ) -|# -;; (define-extern warp-gate-init function) ;; (function entity-actor vector none :behavior warp-gate) -;; (define-extern *warp-jump-mods* surface) ;; surface -;; (define-extern *range-warp-dust-color* curve-color-fast) -;; (define-extern *range-warp-dust-alpha* curve2d-fast) -;; (define-extern *range-warp-dust-scale-x* curve2d-fast) -;; (define-extern *range-warp-dust-scale-y* curve2d-fast) -;; (define-extern *curve-warp-dust-alpha* curve2d-fast) -;; (define-extern *curve-warp-dust-scale-x* curve2d-fast) -;; (define-extern *curve-warp-dust-scale-y* curve2d-fast) -;; (define-extern *part-warp-fma-dust-takeoff-curve-settings* object) +(define-extern v-marauder type) +(define-extern warp-gate-init (function entity-actor vector none :behavior warp-gate)) +(define-extern *warp-jump-mods* surface) +(define-extern *range-warp-dust-color* curve-color-fast) +(define-extern *range-warp-dust-alpha* curve2d-fast) +(define-extern *range-warp-dust-scale-x* curve2d-fast) +(define-extern *range-warp-dust-scale-y* curve2d-fast) +(define-extern *curve-warp-dust-alpha* curve2d-fast) +(define-extern *curve-warp-dust-scale-x* curve2d-fast) +(define-extern *curve-warp-dust-scale-y* curve2d-fast) +(define-extern *part-warp-fma-dust-takeoff-curve-settings* particle-curve-settings) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; guard-projectile ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype guard-shot (projectile) ((hit-actor? symbol :offset-assert 512) ;; guessed by decompiler (tail-pos vector :inline :offset-assert 528) @@ -41605,16 +41695,14 @@ :size-assert #x220 :flag-assert #x2901a00220 ) -|# -;; (define-extern guard-shot-move function) ;; (function guard-shot none) -;; (define-extern spawn-guard-projectile function) +(define-extern guard-shot-move (function guard-shot none)) +(define-extern spawn-guard-projectile (function process-focusable vector vector float vector (pointer guard-shot))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; metalhead-projectile ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype metalhead-shot (projectile) ((tail-pos vector :inline :offset-assert 512) ) @@ -41622,9 +41710,7 @@ :size-assert #x210 :flag-assert #x2901900210 ) -|# -#| (deftype metalhead-grenade-shot (projectile) ((tumble-quat quaternion :inline :offset-assert 512) (blast-radius float :offset-assert 528) @@ -41637,19 +41723,18 @@ impact ;; 22 ) ) -|# -;; (define-extern metalhead-shot-move function) ;; (function metalhead-shot none) -;; (define-extern spawn-metalhead-projectile function) ;; (function metalhead-shot vector vector float (pointer metalhead-shot)) -;; (define-extern gren-canister-move function) ;; (function metalhead-grenade-shot none) -;; (define-extern gren-cshape-reaction-canister function) ;; (function collide-shape-moving metalhead-grenade-shot none) -;; (define-extern spawn-metalhead-grenade function) ;; (function metalhead-grenade-shot vector vector float (pointer metalhead-grenade-shot)) +(define-extern metalhead-shot-move (function metalhead-shot none)) +(define-extern spawn-metalhead-projectile (function metalhead-shot vector vector float (pointer metalhead-shot))) +(define-extern gren-canister-move (function metalhead-grenade-shot none)) +(define-extern gren-cshape-reaction-canister (function collide-shape-moving metalhead-grenade-shot none)) +(define-extern spawn-metalhead-grenade (function metalhead-grenade-shot vector vector float (pointer metalhead-grenade-shot))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; los-control ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern *los-time-offset* object) ;; time-frame +(define-extern *los-time-offset* time-frame) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; enemy-part ;; @@ -41660,60 +41745,54 @@ ;; ragdoll-test ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype ragdoll-test (process-focusable) - ((ragdoll-proc uint64 :offset-assert 208) + ((ragdoll-proc handle :offset-assert 208) ) :method-count-assert 33 :size-assert #xd8 :flag-assert #x21006000d8 (:state-methods - idle ;; 32 - freefall ;; 31 - freefall-reform ;; 30 - tweak ;; 29 reform ;; 28 + tweak ;; 29 + freefall-reform ;; 30 + freefall ;; 31 + idle ;; 32 ) ) -|# -;; (define-extern *ragdoll-test-ragdoll-setup* object) -;; (define-extern ragdoll-test-init-by-other function) +(define-extern *ragdoll-test-ragdoll-setup* ragdoll-setup) +(define-extern ragdoll-test-init-by-other (function ragdoll-setup entity-actor object :behavior ragdoll-test)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; debris ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| +(declare-type debris-group process) (deftype debris-static-joint-params (structure) ((parent-joint-index int16 :offset-assert 0) - (group basic :offset-assert 4) + (group string :offset-assert 4) (offset vector :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -#| (deftype debris-static-params (basic) - ((joints basic :offset-assert 4) - (collide-spec uint32 :offset-assert 8) - (sound-hit uint128 :offset-assert 16) - (art-level basic :offset-assert 32) + ((joints (array debris-static-joint-params) :offset-assert 4) + (collide-spec collide-spec :offset-assert 8) + (sound-hit sound-name :offset-assert 16) + (art-level symbol :offset-assert 32) ) :method-count-assert 9 :size-assert #x24 :flag-assert #x900000024 ) -|# -#| (deftype debris (basic) ((root transformq :inline :offset-assert 16) - (node-list basic :offset-assert 64) - (draw basic :offset-assert 68) + (node-list cspace-array :offset-assert 64) + (draw draw-control :offset-assert 68) (duration float :offset-assert 72) (hit-xz-reaction float :offset-assert 76) (hit-y-reaction float :offset-assert 80) @@ -41722,16 +41801,14 @@ (rot-axis vector :inline :offset-assert 128) (rot-angle float :offset-assert 144) (transv vector :inline :offset-assert 160) - (time-fade-out uint64 :offset-assert 176) - (params basic :offset-assert 184) + (time-fade-out time-frame :offset-assert 176) + (params debris-static-params :offset-assert 184) ) :method-count-assert 9 :size-assert #xbc :flag-assert #x9000000bc ) -|# -#| (deftype debris-box (structure) ((start uint32 :offset-assert 0) (num uint32 :offset-assert 4) @@ -41741,35 +41818,31 @@ :size-assert #x30 :flag-assert #x900000030 ) -|# -#| (deftype debris-group (process) ((dead-debris-num int32 :offset-assert 128) (debris-num int32 :offset-assert 132) - (debris basic :offset-assert 136) + (debris (array debris) :offset-assert 136) (max-probe-width float :offset-assert 140) - (state-time uint64 :offset-assert 144) + (state-time time-frame :offset-assert 144) (num-boxes uint32 :offset-assert 152) - (boxes UNKNOWN 16 :offset-assert 160) + (boxes debris-box 16 :inline :offset-assert 160) ) :method-count-assert 17 :size-assert #x3a0 :flag-assert #x11032003a0 - (:methods - (debris-group-method-15 () none) ;; 15 - (debris-group-method-16 () none) ;; 16 - ) (:state-methods idle ;; 14 ) + (:methods + (do-collision (_type_ int) none) ;; 15 + (update-box! (_type_ int) none) ;; 16 + ) ) -|# -#| (deftype debris-tuning (structure) ((explosion uint64 :offset-assert 0) - (duration uint64 :offset-assert 8) + (duration time-frame :offset-assert 8) (gravity float :offset-assert 16) (rot-speed float :offset-assert 20) (bounds-inflate float :offset-assert 24) @@ -41778,11 +41851,11 @@ (max-probe-depth float :offset-assert 36) (fountain-rand-transv-lo vector :inline :offset-assert 48) (fountain-rand-transv-hi vector :inline :offset-assert 64) - (away-from-focal-pt vector :inline :offset-assert 48) - (away-from-rand-transv-xz-lo float :offset-assert 64) - (away-from-rand-transv-xz-hi float :offset-assert 68) - (away-from-rand-transv-y-lo float :offset-assert 72) - (away-from-rand-transv-y-hi float :offset-assert 76) + (away-from-focal-pt vector :inline :offset 48) + (away-from-rand-transv-xz-lo float :offset 64) + (away-from-rand-transv-xz-hi float :offset 68) + (away-from-rand-transv-y-lo float :offset 72) + (away-from-rand-transv-y-hi float :offset 76) (hit-xz-reaction float :offset-assert 80) (hit-y-reaction float :offset-assert 84) (scale-rand-lo float :offset-assert 88) @@ -41791,88 +41864,91 @@ :method-count-assert 9 :size-assert #x60 :flag-assert #x900000060 + (:methods + (new (symbol type uint) _type_) ;; 0 + ) ) -|# -;; (define-extern debris-group-init-by-other function) -;; (define-extern debris-spawn function) +(define-extern debris-group-init-by-other (function debris-tuning debris-static-params process-drawable object :behavior debris-group)) +(define-extern debris-spawn (function process-drawable debris-tuning debris-static-params process-drawable (pointer debris-group))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; shield-sphere ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype shield-sphere-heat (structure) ((current-heat-value float :offset-assert 0) (damage-scalar float :offset-assert 4) - (last-heat-time uint64 :offset-assert 8) - (distort-handle uint64 :offset-assert 16) + (last-heat-time time-frame :offset-assert 8) + (distort-handle handle :offset-assert 16) ) :method-count-assert 9 :size-assert #x18 :flag-assert #x900000018 ) -|# -#| (deftype shield-sphere-toggle (structure) - ((enable-time uint64 :offset-assert 0) - (disable-time uint64 :offset-assert 8) + ((enable-time time-frame :offset-assert 0) + (disable-time time-frame :offset-assert 8) ) :method-count-assert 9 :size-assert #x10 :flag-assert #x900000010 ) -|# -#| +;; +++shield-sphere:shield-type +(defenum shield-type + :type uint8 + (shield-type-0) + (shield-type-1) + ) +;; ---shield-sphere:shield-type + (deftype shield-sphere (process-focusable) - ((owner uint64 :offset-assert 208) + ((owner handle :offset-assert 208) (sphere-size float :offset-assert 216) (offset-vec vector :inline :offset-assert 224) - (enabled? basic :offset-assert 240) - (shield-type uint8 :offset-assert 244) + (enabled? symbol :offset-assert 240) + (shield-type shield-type :offset-assert 244) (track-joint int32 :offset-assert 248) (heat-info shield-sphere-heat :inline :offset-assert 256) - (toggle-info shield-sphere-toggle :inline :offset-assert 256) - (last-attack-time uint64 :offset-assert 280) + (toggle-info shield-sphere-toggle :inline :offset 256) + (last-attack-time time-frame :offset-assert 280) (last-attack-id uint32 :offset-assert 288) (persistent-attack-id uint32 :offset-assert 292) ) :method-count-assert 43 :size-assert #x128 :flag-assert #x2b00b00128 - (:methods - (shield-sphere-method-32 () none) ;; 32 - (shield-sphere-method-33 () none) ;; 33 - (shield-sphere-method-34 () none) ;; 34 - (shield-sphere-method-35 () none) ;; 35 - (shield-sphere-method-36 () none) ;; 36 - (shield-sphere-method-37 () none) ;; 37 - (shield-sphere-method-38 () none) ;; 38 - (shield-sphere-method-39 () none) ;; 39 - (shield-sphere-method-40 () none) ;; 40 - (shield-sphere-method-41 () none) ;; 41 - (shield-sphere-method-42 () none) ;; 42 - ) (:state-methods - die ;; 31 - explode ;; 30 - shield-disabled ;; 29 shield-enabled ;; 28 + shield-disabled ;; 29 + explode ;; 30 + die ;; 31 + ) + (:methods + (shield-sphere-method-32 (_type_) quaternion) ;; 32 + (shield-enabled-trans (_type_) none) ;; 33 + (toggle-shield (_type_ symbol) none) ;; 34 + (shield-post (_type_) object) ;; 35 + (init-and-go! (_type_) object) ;; 36 + (init-collision! (_type_) none) ;; 37 + (shield-event-handler (_type_ process int symbol event-message-block) object) ;; 38 + (get-attack-damage (_type_ process-focusable event-message-block) int) ;; 39 + (shield-touch-handler (_type_ process-focusable event-message-block) object) ;; 40 + (shield-attack-handler (_type_ process-focusable event-message-block) symbol) ;; 41 + (send-shield-attack (_type_ process-focusable touching-shapes-entry int) object) ;; 42 ) ) -|# -#| (deftype shield-sphere-spawn-params (structure) ((offset-vec vector :inline :offset-assert 0) - (owner uint64 :offset-assert 16) + (owner handle :offset-assert 16) (sphere-size float :offset-assert 24) - (shield-type uint8 :offset-assert 28) + (shield-type shield-type :offset-assert 28) (track-joint int32 :offset-assert 32) - (enable-time uint64 :offset-assert 40) - (disable-time uint64 :offset-assert 48) + (enable-time time-frame :offset-assert 40) + (disable-time time-frame :offset-assert 48) (shield-strength int8 :offset-assert 56) (pad int16 :offset-assert 58) ) @@ -41880,11 +41956,9 @@ :size-assert #x3c :flag-assert #x90000003c ) -|# -#| (deftype shield-sphere-distort (process-drawable) - ((owner uint64 :offset-assert 200) + ((owner handle :offset-assert 200) (sphere-size float :offset-assert 208) ) :method-count-assert 23 @@ -41896,22 +41970,19 @@ die ;; 22 ) ) -|# -#| (deftype shield-sphere-distort-spawn-params (structure) - ((owner uint64 :offset-assert 0) + ((owner handle :offset-assert 0) (sphere-size float :offset-assert 8) ) :method-count-assert 9 :size-assert #xc :flag-assert #x90000000c ) -|# -;; (define-extern shield-sphere-distort-init-by-other function) -;; (define-extern *shield-sphere-exploder-params* joint-exploder-static-params) -;; (define-extern shield-sphere-init-by-other function) +(define-extern shield-sphere-distort-init-by-other (function shield-sphere-distort-spawn-params object :behavior shield-sphere-distort)) +(define-extern *shield-sphere-exploder-params* joint-exploder-static-params) +(define-extern shield-sphere-init-by-other (function shield-sphere-spawn-params object :behavior shield-sphere)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; des-bush-part ;; diff --git a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc index 2d159c1faca..ae237c6fc61 100644 --- a/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/anonymous_function_types.jsonc @@ -126,12 +126,45 @@ ], "trajectory": [[15, "(function trajectory none)"]], "progress": [[3, "(function int none :behavior process)"]], - "level": [[25, "(function level-group int symbol)"], [7, "(function none)"], [4, "(function load-state sound-bank-state symbol)"]], + "level": [ + [25, "(function level-group int symbol)"], + [7, "(function none)"], + [4, "(function load-state sound-bank-state symbol)"] + ], "main": [ [11, "(function int none)"], [9, "(function none)"], [8, "(function none)"], [7, "(function none)"], [3, "(function symbol :behavior process)"] - ] + ], + "scene": [[4, "(function none :behavior scene-player)"]], + "pov-camera": [ + [ + 7, + "(function process int symbol event-message-block object :behavior pov-camera)" + ] + ], + "airlock": [ + [7, "(function object :behavior com-airlock)"], + [11, "(function object :behavior com-airlock)"], + [12, "(function object :behavior com-airlock)"] + ], + "default-menu": [ + [3, "(function none)"], + [4, "(function none)"] + ], + "enemy-states": [[38, "(function object :behavior enemy)"]], + "scene-actor": [ + [0, "(function none)"], + [1, "(function flut-npc none)"], + [2, "(function flut-npc art-element)"], + [39, "(function flut-npc flut-npc)"] + ], + "warp-gate": [ + [0, "(function object)"], + [8, "(function string object :behavior process)"], + [12, "(function object :behavior target)"] + ], + "gun-yellow-shot": [[59, "(function handle object :behavior process)"]] } diff --git a/decompiler/config/jak3/ntsc_v1/art_info.jsonc b/decompiler/config/jak3/ntsc_v1/art_info.jsonc index 99d1d1fc408..fdf43f798cc 100644 --- a/decompiler/config/jak3/ntsc_v1/art_info.jsonc +++ b/decompiler/config/jak3/ntsc_v1/art_info.jsonc @@ -13,7 +13,8 @@ "sidekick": "daxter-ag", "wings": "jakb-ag", "lightjak-shield": "jakb-ag", - "freeze-screen": "collectables-ag" + "freeze-screen": "collectables-ag", + "red-3-sphere": "gun-ag" }, // remap names for types in an entire file (higher priority) diff --git a/decompiler/config/jak3/ntsc_v1/hacks.jsonc b/decompiler/config/jak3/ntsc_v1/hacks.jsonc index ac0953606d3..08f475d8839 100644 --- a/decompiler/config/jak3/ntsc_v1/hacks.jsonc +++ b/decompiler/config/jak3/ntsc_v1/hacks.jsonc @@ -344,7 +344,17 @@ "dma-add-process-drawable": [0, 77], "real-main-draw-hook": [120, 122], "display-frame-finish": [61], - "display-loop-main": [130] + "display-loop-main": [130], + "(method 63 collide-shape-moving)": [1, 2, 14, 49], + "(method 67 collide-shape-moving)": [2, 3, 13], + "(method 51 rigid-body-object)": [5], + "(anon-function 2 rigid-body-queue)": [0, 2], + "(method 15 rigid-body-queue)": [5, 6, 7, 9], + "(method 13 rigid-body-queue)": [5, 6, 7, 9], + "(method 11 rigid-body-queue)": [0, 6, 7, 9], + "(method 10 rigid-body-queue)": [10, 34, 37], + "(method 9 los-control)": [0, 43], + "load-game-text-info": [19, 20, 21] }, // Sometimes the game might use format strings that are fetched dynamically, @@ -503,7 +513,9 @@ "(method 21 cloth-system)", "debug-line-clip?", "(method 9 font-work)", - "(method 9 prim-strip)" + "(method 9 prim-strip)", + "live-func-curve", + "birth-func-curve" ], "mips2c_jump_table_functions": {}, diff --git a/decompiler/config/jak3/ntsc_v1/label_types.jsonc b/decompiler/config/jak3/ntsc_v1/label_types.jsonc index 8b7cc76413e..a8b03e710f3 100644 --- a/decompiler/config/jak3/ntsc_v1/label_types.jsonc +++ b/decompiler/config/jak3/ntsc_v1/label_types.jsonc @@ -66,7 +66,8 @@ ["L305", "cloth-params"], ["L304", "cloth-params"], ["L303", "cloth-params"], - ["L296", "cloth-params"] + ["L296", "cloth-params"], + ["L198", "cloth-params"] ], "joint-mod": [["L212", "(inline-array vector)", 3]], "game-info": [ @@ -314,7 +315,6 @@ ["L794", "vector4w"], ["L792", "vector4w"] ], - "level": [["L1003", "uint64", true]], "foreground": [ ["L215", "(pointer bucket-id-16)", 462], ["L214", "vector"] @@ -395,6 +395,67 @@ "level": [ ["L1004", "uint64", true], ["L1003", "uint64", true] - + ], + "airlock": [ + ["L316", "vector"], + ["L317", "vector"], + ["L321", "(inline-array vector)", 2], + ["L320", "vector"], + ["L319", "vector"], + ["L318", "(inline-array vector)", 2] + ], + "water-anim": [ + ["L63", "attack-info"], + ["L62", "attack-info"] + ], + "blocking-plane": [ + ["L55", "vector"], + ["L57", "attack-info"] + ], + "enemy": [ + ["L658", "uint64", true], + ["L660", "uint64", true], + ["L659", "uint64", true], + ["L652", "attack-info"] + ], + "enemy-states": [["L357", "attack-info"]], + "process-taskable": [["L127", "attack-info"]], + "warp-gate": [ + ["L677", "uint64", true], + ["L676", "uint64", true], + ["L562", "vector"], + ["L641", "uint64", true], + ["L642", "uint64", true], + ["L640", "uint64", true] + ], + "shield-sphere": [["L129", "attack-info"]], + "text": [["L97", "(inline-array vector4w)", 4]], + "gun-red-shot": [ + ["L558", "uint64", true], + ["L556", "uint64", true], + ["L554", "uint64", true], + ["L553", "uint64", true], + ["L559", "uint64", true], + ["L555", "uint64", true], + ["L557", "uint64", true], + ["L552", "uint64", true], + ["L445", "uint64", true], + ["L442", "uint64", true], + ["L451", "uint64", true], + ["L444", "uint64", true], + ["L412", "attack-info"], + ["L446", "uint64", true], + ["L449", "uint64", true], + ["L448", "uint64", true], + ["L447", "uint64", true], + ["L440", "uint64", true], + ["L432", "attack-info"], + ["L431", "attack-info"], + ["L428", "attack-info"], + ["L439", "uint64", true], + ["L441", "uint64", true], + ["L443", "uint64", true], + ["L405", "attack-info"], + ["L450", "uint64", true] ] } diff --git a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc index a14c8e509e7..2a3e23d49f3 100644 --- a/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc +++ b/decompiler/config/jak3/ntsc_v1/stack_structures.jsonc @@ -203,7 +203,7 @@ [640, ["inline-array", "sphere", 1]], [656, "vector"] ], - "target-gun-can-fire-yellow?": [[16, ["array", "symbol", 2]]], + "target-gun-can-fire-yellow?": [[16, "gun-yellow-3-event-msg"]], "draw-beam": [[16, ["inline-array", "vector", 2]]], "(code die gun)": [[144, "vector"]], "light-trail-tracker-init-by-other": [[16, "vector"]], @@ -400,21 +400,102 @@ ], "progress-post": [[176, "hud-box"]], "(method 15 hud-gun)": [[16, "hud-sprite"]], - "play": [ - [96, ["array", "symbol", 10]] - ], - "update-sound-banks": [ - [16, ["array", "int8", 36]] - ], + "play": [[96, ["array", "symbol", 10]]], + "update-sound-banks": [[16, ["array", "int8", 36]]], "show-level": [[16, ["array", "symbol", 10]]], "(method 20 load-state)": [ [16, ["inline-array", "level-buffer-state", 10]], [176, ["inline-array", "level-buffer-state", 10]] ], - "calc-vu1-lights": [ - [16, "light-group"] + "calc-vu1-lights": [[16, "light-group"]], + "teleport-camera-by-pos": [[16, "vector"]], + "water-anim-event-handler": [[16, "vector"]], + "blocking-plane-spawn": [[16, ["inline-array", "vector", 2]]], + "(method 11 blocking-plane)": [[16, ["inline-array", "vector", 2]]], + "(method 56 enemy)": [ + [48, "vector"], + [32, "vector"] ], - "teleport-camera-by-pos": [ + "(method 58 enemy)": [[80, "vector"]], + "(method 82 enemy)": [[96, "attack-info"]], + "(post knocked-recover enemy)": [ + [1120, "vector"], + [1136, "vector"] + ], + "(post running elevator)": [[16, "vector"]], + "matrix-3x3-triple-transpose-product": [[16, ["inline-array", "matrix", 3]]], + "(method 63 collide-shape-moving)": [[16, "rigid-body-move-work"]], + "(method 18 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], + "(method 22 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], + "(method 23 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], + "(method 24 rigid-body-control)": [[16, ["inline-array", "vector", 2]]], + "(method 28 rigid-body-control)": [[16, "rigid-body-impact"]], + "(method 50 rigid-body-object)": [[16, "rigid-body-impact"]], + "(method 51 rigid-body-object)": [[16, "rigid-body-impact"]], + "ptest": [[16, "vector"]], + "spawn-guard-projectile": [[16, "projectile-init-by-other-params"]], + "(method 25 guard-shot)": [[32, "vector"]], + "(method 25 metalhead-shot)": [[32, "vector"]], + "(event impact metalhead-grenade-shot)": [[16, "collide-query"]], + "(method 9 los-control)": [ + [32, "collide-query"], [16, "vector"] - ] + ], + "(method 22 joint-exploder)": [[16, "collide-query"]], + "(method 25 joint-exploder)": [[16, "bounding-box"]], + "(method 15 debris-group)": [[64, "vector"]], + "debris-group-init-by-other": [[16, "vector"]], + "shield-sphere-init-by-other": [[16, "shield-sphere-distort-spawn-params"]], + "gun-yellow-shot-do-deflect": [ + [144, ["array", "collide-shape", 384]], + [64, "vector"] + ], + "(method 31 gun-yellow-shot-2)": [[16, "light-trail-tracker-spawn-params"]], + "(method 25 gun-yellow-shot)": [[32, "vector"]], + "gun-fire-yellow-3": [[16, "gun-yellow-3-event-msg"]], + "(code impact-explode gun-yellow-3-saucer)": [[16, "explosion-init-params"]], + "saucer-land-move": [[16, "vector"]], + "(method 25 gun-yellow-shot-2)": [[32, "vector"]], + "(method 36 gun-yellow-shot-2)": [[96, "vector"]], + "(method 52 gun-yellow-3-saucer)": [ + [48, ["inline-array", "target-quality-info-saucer", 66]], + [1104, ["array", "collide-shape", 384]], + [32, "vector"], + [3728, ["array", "int8", 100]], + [3824, "vector"] + ], + "(code impact gun-red-3-grenade)": [[16, "red-3-sphere-init-params"]], + "(post explode gun-red-2-shockwave)": [[16, "vector"]], + "(method 27 gun-red-2-shockwave)": [ + [16, "vector"], + [32, "red-2-ring-init-params"] + ], + "(method 31 gun-red-3-grenade)": [ + [16, "vector"], + [32, "light-trail-tracker-spawn-params"] + ], + "(method 45 gun-red-3-grenade)": [ + [16, "vector"], + [112, ["array", "collide-shape", 384]] + ], + "(method 47 gun-red-3-grenade)": [ + [16, "vector"], + [112, ["array", "collide-shape", 384]] + ], + "(method 17 gun-red-2-shockwave)": [ + [48, ["array", "collide-shape", 384]], + [16, "vector"], + [1584, "collide-query"] + ], + "(method 19 gun-red-2-shockwave)": [[16, "collide-query"]], + "(method 23 gun-red-2-shockwave)": [[32, "vector"]], + "(method 24 gun-red-2-shockwave)": [[16, "vector"]], + "gun-fire-red-2": [[16, "gun-red-2-shockwave-init-params"]], + "gun-fire-red-3": [ + [160, ["array", "collide-shape", 384]], + [112, "vector"], + [128, "vector"], + [1696, "vector"] + ], + "(method 26 gun-red-shot)": [[16, "bounding-box"]] } diff --git a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc index 425af81060e..5165d095ac1 100644 --- a/decompiler/config/jak3/ntsc_v1/type_casts.jsonc +++ b/decompiler/config/jak3/ntsc_v1/type_casts.jsonc @@ -2944,12 +2944,8 @@ [21, "a1", "symbol"], [[22, 34], "a1", "level-load-info"] ], - "(method 29 level-group)": [ - [[2, 53], "v1", "pair"] - ], - "level-find-borrow-slot": [ - [[204, 211], "a2", "level"] - ], + "(method 29 level-group)": [[[2, 53], "v1", "pair"]], + "level-find-borrow-slot": [[[204, 211], "a2", "level"]], "(method 19 level)": [ [[40, 118], "a3", "symbol"], [[52, 56], "a0", "texture-anim-array"] @@ -2978,16 +2974,12 @@ [137, "s5", "(function level object)"], [[349, 358], "a1", "type"] ], - "(method 30 level-group)": [ - [87, "v0", "level"] - ], + "(method 30 level-group)": [[87, "v0", "level"]], "(method 10 load-state)": [ [461, "v1", "level"], [468, "v1", "level"] ], - "update-sound-banks": [ - [131, "a0", "pair"] - ], + "update-sound-banks": [[131, "a0", "pair"]], "borrow-city-expansion": [ [23, "a0", "basic"], [52, "s5", "basic"] @@ -3002,16 +2994,12 @@ [78, "a0", "foreground-work"], [198, "t0", "(pointer int128)"] ], - "calc-shadow-masks": [ - [10, "v0", "(array float)"] - ], + "calc-shadow-masks": [[10, "v0", "(array float)"]], "dma-add-process-drawable-hud": [ [[43, 59], "v1", "level"], [11, "a0", "foreground-work"] ], - "default-init-buffer": [ - [[116, 126], "a1", "dma-packet"] - ], + "default-init-buffer": [[[116, 126], "a1", "dma-packet"]], "default-end-buffer": [ [[117, 123], "a1", "dma-packet"], [125, "a1", "(pointer uint32)"] @@ -3030,12 +3018,8 @@ [[28, 32], "t2", "drawable-inline-array-node"], [[42, 46], "t2", "(pointer int8)"] ], - "get-shadow-by-name": [ - [7, "v1", "process-drawable"] - ], - "set-shadow-by-name": [ - [7, "v1", "process-drawable"] - ], + "get-shadow-by-name": [[7, "v1", "process-drawable"]], + "set-shadow-by-name": [[7, "v1", "process-drawable"]], "find-instance-by-index": [ [26, "t1", "drawable-tree-instance-shrub"], [40, "t1", "drawable-tree-instance-tie"] @@ -3053,12 +3037,529 @@ [[35, 41], "v1", "drawable-tree-instance-tie"] ], "set-graphics-mode": [[[0, 100], "gp", "gs-bank"]], - "(method 9 screen-filter)": [ - [[118, 128], "t1", "rgba"] - ], - "display-loop-main": [ - [231, "t9", "(function none)"] - ] - - + "(method 9 screen-filter)": [[[118, 128], "t1", "rgba"]], + "display-loop-main": [[231, "t9", "(function none)"]], + "effect-param->sound-spec": [[178, "v1", "collide-shape-moving"]], + "(method 10 effect-control)": [ + [149, "v1", "collide-shape-moving"], + [427, "s3", "death-info"], + [433, "s3", "death-info"], + [435, "s3", "death-info"], + [470, "s3", "death-info"], + [476, "s3", "death-info"], + [478, "s3", "death-info"], + [483, "s3", "death-info"], + [487, "s3", "death-info"], + [507, "s3", "death-info"], + [25, "v0", "string"] + ], + "(method 12 effect-control)": [ + [99, "gp", "(pointer int8)"], + ["_stack_", 112, "res-tag"] + ], + "process-drawable-draw-subtitles": [[26, "v0", "(array subtitle-range)"]], + "(method 25 scene-player)": [ + [102, "s1", "process-drawable"], + [163, "s1", "process-drawable"], + [166, "s1", "process-drawable"], + [169, "s1", "process-drawable"], + [172, "s1", "process-drawable"] + ], + "(method 9 scene-actor)": [ + [179, "s3", "skeleton-group"], + [286, "a0", "process-drawable"], + [290, "v1", "process-drawable"], + [294, "a0", "process-drawable"], + [370, "a0", "process-drawable"], + [549, "v1", "manipy"], + [557, "v1", "manipy"], + [563, "v1", "manipy"], + [578, "v1", "manipy"], + [584, "v1", "manipy"], + [528, "a0", "process-drawable"], + [536, "v1", "process-drawable"], + [543, "a0", "process-drawable"], + [751, "a0", "process-drawable"], + [755, "v1", "process-drawable"], + [759, "a0", "process-drawable"] + ], + "(post play-anim scene-player)": [ + [210, "s4", "process-drawable"], + [261, "s4", "process-drawable"], + [324, "s5", "process-drawable"], + [707, "v0", "sound-rpc-set-param"], + [586, "v0", "sound-rpc-set-param"] + ], + "(trans play-anim scene-player)": [[66, "a0", "process-drawable"]], + "(event play-anim scene-player)": [ + [11, "t9", "(function scene-player none)"] + ], + "(code othercam-running)": [ + [14, "s2", "process-drawable"], + [18, "s2", "process-drawable"], + [24, "s2", "process-drawable"], + [38, "s2", "process-drawable"], + [47, "s2", "process-drawable"], + [64, "s2", "process-drawable"] + ], + "(enter othercam-running)": [ + [56, "gp", "process-drawable"], + [59, "gp", "process-drawable"] + ], + "(event othercam-running)": [ + [17, "v1", "process-drawable"], + [24, "v0", "joint"], + [41, "a0", "process"] + ], + "(anon-function 7 pov-camera)": [ + [9, "v1", "float"], + [16, "v1", "float"] + ], + "target-powerup-process": [[358, "v0", "sound-rpc-set-param"]], + "cloud-track": [ + [[19, 83], "s1", "handle"], + [[29, 116], "s2", "handle"] + ], + "(method 22 com-airlock)": [ + ["_stack_", 16, "res-tag"], + ["_stack_", 32, "res-tag"], + [104, "v0", "(pointer float)"], + [143, "v0", "(pointer float)"], + [46, "v0", "airlock-options"], + [193, "v0", "pair"] + ], + "airlock-command-lookup": [ + [5, "s4", "pair"], + [15, "s4", "pair"], + [16, "v1", "pair"], + [21, "s5", "pair"], + [20, "s5", "pair"] + ], + "(anon-function 7 airlock)": [[14, "v0", "pair"]], + "(code open com-airlock)": [ + [123, "v0", "sound-rpc-set-param"], + [232, "v0", "sound-rpc-set-param"], + [442, "v0", "sound-rpc-set-param"], + [462, "v0", "sound-rpc-set-param"] + ], + "(anon-function 12 airlock)": [[14, "v0", "pair"]], + "(method 25 com-airlock)": [[90, "v0", "pair"]], + "(method 27 com-airlock)": [[108, "v0", "sound-rpc-set-param"]], + "(exit close com-airlock)": [ + [10, "v0", "sound-rpc-set-param"], + [30, "v0", "sound-rpc-set-param"] + ], + "(trans close com-airlock)": [[58, "v0", "sound-rpc-set-param"]], + "(code close com-airlock)": [ + [196, "v0", "sound-rpc-set-param"], + [303, "v0", "sound-rpc-set-param"], + [394, "v0", "sound-rpc-set-param"] + ], + "(method 26 water-anim)": [ + [52, "v0", "(pointer float)"], + ["_stack_", 16, "res-tag"] + ], + "(method 28 water-anim)": [ + [27, "v0", "vector"], + ["_stack_", 16, "res-tag"] + ], + "water-anim-event-handler": [ + [50, "s5", "water-info"], + [96, "gp", "process-focusable"], + [146, "gp", "process-focusable"], + [200, "s5", "water-info"], + [23, "v1", "float"] + ], + "(event idle blocking-plane)": [[113, "gp", "process-drawable"]], + "(method 15 proc-focusable-spawner)": [[26, "a0", "process-focusable"]], + "(method 10 idle-control)": [ + [35, "v1", "pair"], + [79, "v1", "art-joint-anim"] + ], + "(method 55 enemy)": [ + [27, "a0", "process-focusable"], + [30, "a0", "process-focusable"] + ], + "(method 59 enemy)": [ + [57, "a0", "process-focusable"], + [60, "a0", "process-focusable"] + ], + "(method 62 enemy)": [ + [2, "v1", "attack-info"], + [5, "v1", "attack-info"] + ], + "enemy-setup-gem": [[46, "v1", "float"]], + "(method 119 enemy)": [ + ["_stack_", 16, "res-tag"], + [135, "v0", "(pointer actor-group)"] + ], + "(method 113 enemy)": [[17, "v0", "process-focusable"]], + "(method 106 enemy)": [ + [16, "v1", "connection"], + [17, "v1", "collide-shape"], + [21, "v1", "collide-shape"], + [33, "a1", "process-focusable"], + [65, "v1", "connection"], + [66, "v1", "collide-shape"], + [70, "v1", "collide-shape"], + [82, "a1", "process-focusable"], + [112, "v1", "connection"], + [113, "v1", "collide-shape"], + [117, "v1", "collide-shape"], + [129, "a1", "process-focusable"], + [44, "a1", "process-focusable"], + [93, "a1", "process-focusable"], + [140, "a1", "process-focusable"] + ], + "(method 140 enemy)": [[18, "a1", "process-focusable"]], + "get-penetrate-using-from-attack-event": [ + [2, "v1", "attack-info"], + [5, "v1", "attack-info"], + [25, "v1", "collide-shape"] + ], + "(method 83 enemy)": [ + [21, "s3", "process-focusable"], + [67, "s3", "process-drawable"], + [68, "a1", "collide-shape"] + ], + "(method 82 enemy)": [ + [80, "v1", "process-drawable"], + [122, "v1", "attack-info"], + [170, "s2", "attack-info"], + [266, "s2", "attack-info"], + [286, "s4", "rigid-body-impact"], + [373, "s4", "rigid-body-impact"], + [787, "a0", "vector"], + [349, "s4", "rigid-body-impact"] + ], + "(method 147 enemy)": [[34, "a1", "process-focusable"]], + "(method 98 enemy)": [[28, "a1", "art-joint-anim"]], + "(method 96 enemy)": [[52, "s5", "art-joint-anim"]], + "(method 97 enemy)": [[28, "a1", "art-joint-anim"]], + "(method 85 enemy)": [[17, "a1", "art-joint-anim"]], + "(method 86 enemy)": [[11, "v1", "art-joint-anim"]], + "(method 124 enemy)": [ + [13, "s5", "ragdoll-proc"], + [21, "s5", "ragdoll-proc"], + [24, "s5", "ragdoll-proc"] + ], + "(method 125 enemy)": [ + [14, "s5", "ragdoll-proc"], + [42, "s5", "ragdoll-proc"], + [60, "s5", "ragdoll-proc"] + ], + "(method 126 enemy)": [ + [100, "s2", "ragdoll-proc"], + [102, "s2", "ragdoll-proc"], + [105, "s2", "ragdoll-proc"], + [115, "s2", "ragdoll-proc"], + [133, "s2", "ragdoll-proc"], + [152, "s2", "ragdoll-proc"], + [124, "s2", "ragdoll-proc"] + ], + "(method 105 enemy)": [ + [16, "a0", "process-focusable"], + [19, "a0", "process-focusable"] + ], + "(method 11 enemy)": [[12, "v0", "symbol"]], + "(code notice enemy)": [[31, "v1", "art-joint-anim"]], + "(code stare enemy)": [[23, "gp", "art-joint-anim"]], + "(code victory enemy)": [[30, "v1", "art-joint-anim"]], + "(code die enemy)": [[71, "v1", "art-joint-anim"]], + "(code die-falling enemy)": [[78, "gp", "art-joint-anim"]], + "(code view-anims enemy)": [[20, "s4", "art-joint-anim"]], + "(event gun-dark-2-stretch enemy)": [ + [8, "s5", "attack-info"], + [32, "s5", "attack-info"], + [71, "s5", "attack-info"] + ], + "(code knocked-recover enemy)": [ + [34, "v1", "art-joint-anim"], + [67, "v1", "ragdoll-proc"] + ], + "(method 114 enemy)": [ + [39, "s4", "touching-shapes-entry"], + [29, "s4", "touching-shapes-entry"], + [15, "s4", "touching-shapes-entry"], + [22, "s4", "touching-shapes-entry"], + [50, "s4", "touching-shapes-entry"], + [4, "s4", "touching-shapes-entry"], + [3, "s4", "touching-shapes-entry"] + ], + "gun-dark-2-ragdoll-start": [ + [72, "s4", "ragdoll-proc"], + [74, "s4", "ragdoll-proc"], + [77, "s4", "ragdoll-proc"], + [87, "s4", "ragdoll-proc"], + [104, "s4", "ragdoll-proc"], + [96, "s4", "ragdoll-proc"] + ], + "gun-dark-2-anim-code": [ + [127, "gp", "art-joint-anim"], + [30, "v1", "float"], + [53, "v1", "float"], + [154, "v1", "float"] + ], + "(trans gun-dark-2-stretch enemy)": [ + [136, "v1", "collide-shape-prim-sphere"], + [147, "a0", "process-focusable"], + [153, "v1", "process-focusable"], + [27, "v1", "float"] + ], + "(code hit enemy)": [[30, "v1", "art-joint-anim"]], + "(code flee enemy)": [[22, "v1", "art-joint-anim"]], + "(method 143 enemy)": [[81, "s5", "gem"]], + "(method 141 enemy)": [[44, "t1", "int"]], + "(method 56 enemy)": [ + [269, "v1", "float"], + [268, "v0", "float"] + ], + "(code debug-control nav-enemy)": [[28, "v1", "art-joint-anim"]], + "(event idle drop-plat)": [ + [23, "a0", "process-focusable"], + [55, "a0", "process-focusable"], + [58, "a0", "process-focusable"] + ], + "(event idle bouncer)": [ + [110, "v1", "attack-info"], + [116, "v1", "attack-info"] + ], + "(method 11 elevator)": [ + [35, "v1", "collide-shape-prim-group"], + ["_stack_", 32, "float"] + ], + "(method 48 elevator)": [["_stack_", 16, "float"]], + "teleport-check": [["_stack_", 16, "float"]], + "elevator-event": [ + [23, "v1", "focus"], + [361, "v1", "float"], + [133, "v1", "float"], + [89, "v1", "float"] + ], + "(method 51 elevator)": [[10, "v1", "collide-shape-prim-group"]], + "(method 63 collide-shape-moving)": [ + [298, "a0", "process-focusable"], + [300, "a0", "process-focusable"] + ], + "(method 14 rigid-body-control)": [[18, "v1", "vector"]], + "transform-rigid-body-prims": [[4, "v1", "collide-shape-prim-group"]], + "(method 67 collide-shape-moving)": [ + [8, "v1", "collide-shape-prim-group"], + [[30, 56], "s1", "collide-cache-prim"] + ], + "(method 49 rigid-body-object)": [ + [45, "s4", "process-focusable"], + [82, "s4", "process-drawable"], + [87, "s3", "attack-info"], + [89, "s3", "attack-info"], + [96, "s3", "attack-info"], + [115, "s4", "process-focusable"], + [129, "s5", "attack-info"], + [148, "v1", "focus"], + [172, "a0", "process-focusable"], + [183, "a0", "process-focusable"], + [191, "a0", "process-focusable"], + [193, "a0", "process-focusable"], + [230, "s4", "process-focusable"], + [237, "v1", "float"], + [241, "s4", "process-focusable"], + [243, "s4", "process-focusable"] + ], + "(method 47 rigid-body-object)": [ + [18, "v1", "float"], + [52, "v1", "float"], + [26, "v1", "float"] + ], + "(method 10 rigid-body-queue)": [ + [134, "a0", "process-focusable"], + [146, "a0", "rigid-body-object"], + [148, "a0", "rigid-body-object"], + [51, "s3", "process-focusable"], + [72, "s3", "rigid-body-object"], + [20, "a0", "process-focusable"] + ], + "scene-player-init": [ + [44, "a0", "(array scene)"], + [37, "s5", "(array scene)"] + ], + "(method 34 process-taskable)": [ + [58, "v0", "joint"], + [68, "v1", "collide-shape-prim-group"] + ], + "(code active process-taskable)": [ + [37, "gp", "handle"], + [72, "gp", "handle"] + ], + "(code target-warp-in)": [ + [340, "v1", "art-joint-anim"], + [13, "v0", "string"], + [128, "gp", "process"] + ], + "(post idle air-train)": [[4, "t9", "(function none)"]], + "(method 28 metalhead-shot)": [ + [29, "s5", "process-drawable"], + [32, "s5", "process-drawable"], + [10, "v0", "sound-rpc-set-param"] + ], + "(event impact metalhead-grenade-shot)": [[11, "s4", "process-focusable"]], + "(method 9 los-control)": [ + [85, "s1", "process-focusable"], + [96, "s2", "process-focusable"], + [109, "s1", "process-focusable"] + ], + "(method 0 joint-exploder-tuning)": [ + [[7, 82], "v0", "joint-exploder-tuning"] + ], + "joint-exploder-joint-callback": [ + [3, "s4", "joint-exploder"], + [24, "s4", "joint-exploder"] + ], + "(method 28 joint-exploder)": [[222, "s4", "joint-exploder-list"]], + "(enter freefall ragdoll-test)": [ + [15, "a0", "ragdoll-proc"], + [20, "a0", "ragdoll-proc"] + ], + "(trans freefall-reform ragdoll-test)": [ + [23, "gp", "ragdoll-proc"], + [29, "gp", "ragdoll-proc"] + ], + "(trans idle ragdoll-test)": [ + [55, "v1", "ragdoll-proc"], + [57, "v1", "ragdoll-proc"] + ], + "(trans freefall ragdoll-test)": [ + [32, "a0", "ragdoll-proc"], + [35, "a0", "ragdoll-proc"] + ], + "(exit freefall ragdoll-test)": [ + [12, "a0", "ragdoll-proc"], + [15, "a0", "ragdoll-proc"] + ], + "(exit tweak ragdoll-test)": [ + [12, "a0", "ragdoll-proc"], + [15, "a0", "ragdoll-proc"] + ], + "(enter tweak ragdoll-test)": [ + [15, "a0", "ragdoll-proc"], + [20, "a0", "ragdoll-proc"] + ], + "(trans reform ragdoll-test)": [ + [25, "gp", "ragdoll-proc"], + [31, "gp", "ragdoll-proc"], + [37, "gp", "ragdoll-proc"] + ], + "(trans tweak ragdoll-test)": [ + [34, "gp", "ragdoll-proc"], + [48, "gp", "ragdoll-proc"], + [40, "gp", "ragdoll-proc"], + [43, "gp", "ragdoll-proc"], + [46, "gp", "ragdoll-proc"], + [51, "gp", "ragdoll-proc"] + ], + "(method 0 debris-tuning)": [[[7, 84], "v0", "debris-tuning"]], + "(method 38 shield-sphere)": [[71, "v1", "rigid-body-impact"]], + "(code distort shield-sphere-distort)": [[14, "v1", "art-joint-anim"]], + "(trans distort shield-sphere-distort)": [ + [14, "v1", "process-drawable"], + [21, "v1", "process-drawable"] + ], + "(method 39 shield-sphere)": [ + [2, "v1", "attack-info"], + [5, "v1", "attack-info"] + ], + "(method 41 shield-sphere)": [ + [16, "v1", "attack-info"], + [27, "v1", "attack-info"] + ], + "(method 33 shield-sphere)": [ + [44, "s5", "process-focusable"], + [51, "s5", "process-focusable"] + ], + "(event time-of-day-tick)": [[9, "v1", "float"]], + "load-game-text-info": [ + [34, "v1", "game-text-info"], + [41, "v1", "game-text-info"] + ], + "gun-yellow-deflect-reaction": [ + [33, "a0", "collide-shape-prim"], + [46, "v1", "collide-shape-prim"], + [52, "v1", "collide-shape-prim"], + [62, "s2", "gun-yellow-shot-2"], + [58, "v1", "gun-yellow-shot-2"], + [68, "s2", "gun-yellow-shot-2"] + ], + "gun-yellow-shot-do-deflect": [ + [134, "s1", "process-focusable"], + [178, "s1", "process-focusable"], + ["_stack_", 136, "handle"] + ], + "gun-fire-yellow-1": [[33, "v0", "process"]], + "gun-fire-yellow-2": [[33, "v0", "process"]], + "gun-fire-yellow-3": [[140, "v0", "process"]], + "(method 35 gun-yellow-3-saucer)": [ + [[17, 22], "v1", "gun-yellow-3-event-msg"] + ], + "(code impact-explode gun-yellow-3-saucer)": [[34, "a0", "process"]], + "(method 36 gun-yellow-shot-2)": [[66, "s4", "touching-shapes-entry"]], + "(method 52 gun-yellow-3-saucer)": [ + [471, "a0", "process-focusable"], + [474, "a0", "process-focusable"], + [122, "s3", "process-focusable"], + [146, "s3", "process-focusable"], + ["_stack_", 1088, "float"], + ["_stack_", 3808, "float"] + ], + "(method 53 gun-yellow-3-saucer)": [[88, "v0", "process"]], + "red-2-ring-event-handler": [ + [6, "v1", "vector"], + [12, "v1", "float"] + ], + "(code active red-3-sphere)": [ + [14, "v1", "art-joint-anim"], + [66, "v1", "art-joint-anim"] + ], + "(code impact-tiny gun-red-3-grenade)": [[32, "a0", "process"]], + "(method 45 gun-red-3-grenade)": [ + [59, "a0", "process-focusable"], + [63, "a0", "process-focusable"], + [82, "a0", "process-focusable"], + [85, "a0", "process-focusable"] + ], + "(method 47 gun-red-3-grenade)": [ + [53, "s1", "process-focusable"], + [63, "s1", "process-focusable"], + [76, "s1", "process-focusable"] + ], + "(method 17 gun-red-2-shockwave)": [ + [43, "s3", "process-focusable"], + [93, "s3", "process-focusable"], + [122, "s3", "process-focusable"], + ["_stack_", 32, "bounding-box"] + ], + "gun-fire-red-3": [ + [216, "s1", "process-focusable"], + [246, "s1", "process-focusable"], + [436, "gp", "process-focusable"], + [440, "a0", "process-focusable"], + ["_stack_", 28, "float"] + ], + "gun-fire-red-1": [ + [147, "v1", "manipy"], + [191, "v1", "manipy"], + [194, "v1", "manipy"] + // decompiler hang + // [ + // 197, + // "v1", + // "manipy" + // ] + ], + "(method 23 gun-red-shot)": [[10, "s4", "process-focusable"]], + "(method 26 gun-red-shot)": [ + [43, "a0", "connection"], + [44, "a0", "collide-shape"], + [92, "a0", "connection"], + [93, "a0", "collide-shape"] + ], + "(trans charging gun-red-2-shockwave)": [[6, "a1", "process-drawable"]] } diff --git a/decompiler/config/jak3/ntsc_v1/var_names.jsonc b/decompiler/config/jak3/ntsc_v1/var_names.jsonc index 0348c612175..7a835aa40d5 100644 --- a/decompiler/config/jak3/ntsc_v1/var_names.jsonc +++ b/decompiler/config/jak3/ntsc_v1/var_names.jsonc @@ -1875,5 +1875,98 @@ "t0-10": "found-slot", "t0-8": "host-level-slot-idx" } + }, + "(method 24 com-airlock)": { + "args": ["this", "level-status"] + }, + "(method 29 com-airlock)": { + "args": ["this", "side"] + }, + "(method 23 com-airlock)": { + "vars": { + "s3-0": "tpos", + "f26-0": "target-dist", + "s4-0": "cmd" + } + }, + "(method 26 com-airlock)": { + "args": ["this", "arg1", "side"] + }, + "(method 9 proc-focusable-spawner)": { + "args": ["this", "count", "allocation"] + }, + "(method 15 proc-focusable-spawner)": { + "vars": { + "s5-0": "i", + "s4-0": "proc", + "a0-6": "pfoc", + "v1-8": "ii" + } + }, + "(method 119 enemy)": { + "vars": { + "a1-5": ["cspec", "collide-spec"] + } + }, + "(method 64 enemy)": { + "vars": { + "s3-2": ["aware", "enemy-aware"] + } + }, + "(method 146 enemy)": { + "vars": { + "gp-0": ["name", "sound-name"] + } + }, + "(method 82 enemy)": { + "args": ["this", "proc", "argc", "msg", "block"] + }, + "(method 11 process-taskable)": { + "args": ["this", "entity"] + }, + "debris-group-init-by-other": { + "args": ["tuning", "params", "pdraw"], + "vars": { + "s3-0": "i", + "s1-0": "debris", + "s2-0": "skel", + "v0-18": "draw", + "sv-48": "tuning-scale", + "s0-0": "joint-transform", + "sv-64": "debris-scale" + } + }, + "(method 15 debris-group)": { + "args": ["this", "idx"], + "vars": { + "s3-0": "cquery", + "v1-3": "debris-box", + "s5-0": "box-num", + "s4-0": "box-start", + "a0-1": "bbox", + "sv-96": "name", + "a1-13": "id", + "v1-7": "debris-start" + } + }, + "(trans idle debris-group)": { + "vars": { + "gp-0": "i", + "s5-0": "debris", + "s4-0": "draw-ctrl", + "gp-1": "ii", + "s5-1": "debris-box", + "s3-0": "box-num", + "s4-1": "box-start", + "s1-0": "bbox" + } + }, + "(method 16 debris-group)": { + "args": ["this", "idx"], + "vars": { + "s5-0": "debris-box", + "s4-0": "i", + "v1-7": "debris" + } } } diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 7358bef9246..4d83af377e2 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -195,6 +195,7 @@ set(RUNTIME_SOURCE mips2c/jak3_functions/prim.cpp mips2c/jak3_functions/sky.cpp mips2c/jak3_functions/texture.cpp + mips2c/jak3_functions/particle_curves.cpp mips2c/mips2c_table.cpp overlord/common/dma.cpp overlord/common/fake_iso.cpp diff --git a/game/graphics/opengl_renderer/OpenGLRenderer.cpp b/game/graphics/opengl_renderer/OpenGLRenderer.cpp index 8987b2c8f47..dc041e28ec4 100644 --- a/game/graphics/opengl_renderer/OpenGLRenderer.cpp +++ b/game/graphics/opengl_renderer/OpenGLRenderer.cpp @@ -292,6 +292,9 @@ void OpenGLRenderer::init_bucket_renderers_jak2() { BucketId::TEX_LCOM_PRIS, m_texture_animator); init_bucket_renderer("merc-lcom-pris", BucketCategory::MERC, BucketId::MERC_LCOM_PRIS, m_merc2); + init_bucket_renderer("gmerc-lcom-pris", BucketCategory::GENERIC, + BucketId::GMERC_LCOM_PRIS, m_generic2, + Generic2::Mode::NORMAL); init_bucket_renderer("tex-lcom-water", BucketCategory::TEX, BucketId::TEX_LCOM_WATER, m_texture_animator); init_bucket_renderer("merc-lcom-water", BucketCategory::MERC, diff --git a/game/mips2c/jak3_functions/particle_curves.cpp b/game/mips2c/jak3_functions/particle_curves.cpp new file mode 100644 index 00000000000..e5fd908e66a --- /dev/null +++ b/game/mips2c/jak3_functions/particle_curves.cpp @@ -0,0 +1,960 @@ +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace live_func_curve { +struct Cache { + void* random_generator; // *random-generator* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->daddiu(sp, sp, -336); // daddiu sp, sp, -336 + c->mov64(t0, a1); // or t0, a1, r0 + c->lwu(a3, 108, t0); // lwu a3, 108(t0) + c->lw(v1, 12, t0); // lw v1, 12(t0) + c->load_symbol2(a0, cache.random_generator); // lw a0, *random-generator*(s7) + c->lwu(a0, 0, a0); // lwu a0, 0(a0) + c->addiu(a1, r0, 0); // addiu a1, r0, 0 + c->addiu(a1, r0, 0); // addiu a1, r0, 0 + c->mtc1(f0, r0); // mtc1 f0, r0 + c->load_symbol2(a1, cache.random_generator); // lw a1, *random-generator*(s7) + c->sw(v1, 0, a1); // sw v1, 0(a1) + c->ld(t1, 40, a3); // ld t1, 40(a3) + c->ld(v1, 48, a3); // ld v1, 48(a3) + c->slt(v1, r0, v1); // slt v1, r0, v1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L5 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_2;} // branch non-likely + + c->load_symbol2(t2, cache.random_generator); // lw t2, *random-generator*(s7) + c->lwu(a1, 0, t2); // lwu a1, 0(t2) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t2); // sw v0, 0(t2) + c->ld(v1, 48, a3); // ld v1, 48(a3) + c->div(v0, v1); // div v0, v1 + c->mfhi(v1); // mfhi v1 + c->daddu(t1, t1, v1); // daddu t1, t1, v1 + c->mov64(v1, t1); // or v1, t1, r0 + +block_2: + c->lw(v1, 100, t0); // lw v1, 100(t0) + c->dsubu(v1, t1, v1); // dsubu v1, t1, v1 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->cvtsw(f0, f0); // cvt.s.w f0, f0 + c->mtc1(f1, t1); // mtc1 f1, t1 + c->cvtsw(f1, f1); // cvt.s.w f1, f1 + c->divs(f0, f0, f1); // div.s f0, f0, f1 + c->lwu(v1, 0, a3); // lwu v1, 0(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L14 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_24;} // branch non-likely + + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f1, a1); // mtc1 f1, a1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->adds(f1, f1, f2); // add.s f1, f1, f2 + c->mfc1(v1, f1); // mfc1 v1, f1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->daddiu(v1, sp, 16); // daddiu v1, sp, 16 + c->ld(a1, 56, a3); // ld a1, 56(a3) + c->andi(a1, a1, 2); // andi a1, a1, 2 + bc = c->sgpr64(a1) == 0; // beq a1, r0, L14 + c->mov64(a1, s7); // or a1, s7, r0 + if (bc) {goto block_24;} // branch non-likely + + c->lwu(a1, 0, a3); // lwu a1, 0(a3) + c->mov64(t0, v1); // or t0, v1, r0 + c->daddiu(t1, sp, 32); // daddiu t1, sp, 32 + c->mfc1(t2, f1); // mfc1 t2, f1 + c->mov128_vf_gpr(vf26, t2); // qmtc2.i vf26, t2 + c->lqc2(vf23, 12, a1); // lqc2 vf23, 12(a1) + c->lqc2(vf25, 92, a1); // lqc2 vf25, 92(a1) + c->vmax_bc(DEST::xyzw, BC::w, vf3, vf0, vf0); // vmaxw.xyzw vf3, vf0, vf0 + c->vmula(DEST::xyzw, vf25, vf23); // vmula.xyzw acc, vf25, vf23 + c->vmadd_bc(DEST::xyzw, BC::x, vf28, vf25, vf26); // vmaddx.xyzw vf28, vf25, vf26 + c->sqc2(vf28, 0, t1); // sqc2 vf28, 0(t1) + c->lw(t2, 8, t1); // lw t2, 8(t1) + c->lw(t1, 4, t1); // lw t1, 4(t1) + bc = ((s64)c->sgpr64(t2)) >= 0; // bgez t2, L7 + // nop // sll r0, r0, 0 + if (bc) {goto block_8;} // branch non-likely + + bc = ((s64)c->sgpr64(t1)) >= 0; // bgez t1, L6 + // nop // sll r0, r0, 0 + if (bc) {goto block_7;} // branch non-likely + + c->lqc2(vf1, 28, a1); // lqc2 vf1, 28(a1) + c->lqc2(vf2, 44, a1); // lqc2 vf2, 44(a1) + c->vsub_bc(DEST::xyzw, BC::x, vf4, vf3, vf28); // vsubx.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::x, vf2, vf28); // vmulax.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::x, vf5, vf1, vf4); // vmaddx.xyzw vf5, vf1, vf4 + //beq r0, r0, L8 // beq r0, r0, L8 + c->sqc2(vf5, 0, t0); // sqc2 vf5, 0(t0) + goto block_9; // branch always + + +block_7: + c->lqc2(vf1, 44, a1); // lqc2 vf1, 44(a1) + c->lqc2(vf2, 60, a1); // lqc2 vf2, 60(a1) + c->vsub_bc(DEST::xyzw, BC::y, vf4, vf3, vf28); // vsuby.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::y, vf2, vf28); // vmulay.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::y, vf5, vf1, vf4); // vmaddy.xyzw vf5, vf1, vf4 + //beq r0, r0, L8 // beq r0, r0, L8 + c->sqc2(vf5, 0, t0); // sqc2 vf5, 0(t0) + goto block_9; // branch always + + +block_8: + c->lqc2(vf1, 60, a1); // lqc2 vf1, 60(a1) + c->lqc2(vf2, 76, a1); // lqc2 vf2, 76(a1) + c->vsub_bc(DEST::xyzw, BC::z, vf4, vf3, vf28); // vsubz.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::z, vf2, vf28); // vmulaz.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf1, vf4); // vmaddz.xyzw vf5, vf1, vf4 + c->sqc2(vf5, 0, t0); // sqc2 vf5, 0(t0) + +block_9: + c->lwu(a1, 16, a3); // lwu a1, 16(a3) + bc = c->sgpr64(s7) == c->sgpr64(a1); // beq s7, a1, L10 + c->mov64(a1, s7); // or a1, s7, r0 + if (bc) {goto block_14;} // branch non-likely + + c->lwc1(f1, 0, v1); // lwc1 f1, 0(v1) + c->lwu(t1, 16, a3); // lwu t1, 16(a3) + c->movs(f2, f0); // mov.s f2, f0 + c->daddiu(t0, sp, 48); // daddiu t0, sp, 48 + c->daddiu(a1, sp, 64); // daddiu a1, sp, 64 + c->mfc1(t2, f2); // mfc1 t2, f2 + c->mov128_vf_gpr(vf27, t2); // qmtc2.i vf27, t2 + c->lqc2(vf24, 12, t1); // lqc2 vf24, 12(t1) + c->lqc2(vf25, 28, t1); // lqc2 vf25, 28(t1) + c->lqc2(vf26, 44, t1); // lqc2 vf26, 44(t1) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, t0); // sqc2 vf28, 0(t0) + c->sqc2(vf29, 0, a1); // sqc2 vf29, 0(a1) + c->lw(t1, 8, t0); // lw t1, 8(t0) + c->lw(t0, 4, t0); // lw t0, 4(t0) + bc = ((s64)c->sgpr64(t1)) >= 0; // bgez t1, L9 + c->lw(v0, 8, a1); // lw v0, 8(a1) + if (bc) {goto block_13;} // branch non-likely + + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L9 + c->lw(v0, 4, a1); // lw v0, 4(a1) + if (bc) {goto block_13;} // branch non-likely + + c->lw(v0, 0, a1); // lw v0, 0(a1) + +block_13: + c->mov64(a1, v0); // or a1, v0, r0 + c->mtc1(f2, a1); // mtc1 f2, a1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->swc1(f1, 32, a2); // swc1 f1, 32(a2) + c->mfc1(a1, f1); // mfc1 a1, f1 + +block_14: + c->lwu(a1, 20, a3); // lwu a1, 20(a3) + bc = c->sgpr64(s7) == c->sgpr64(a1); // beq s7, a1, L12 + c->mov64(a1, s7); // or a1, s7, r0 + if (bc) {goto block_19;} // branch non-likely + + c->lwc1(f1, 4, v1); // lwc1 f1, 4(v1) + c->lwu(t1, 20, a3); // lwu t1, 20(a3) + c->movs(f2, f0); // mov.s f2, f0 + c->daddiu(t0, sp, 80); // daddiu t0, sp, 80 + c->daddiu(a1, sp, 96); // daddiu a1, sp, 96 + c->mfc1(t2, f2); // mfc1 t2, f2 + c->mov128_vf_gpr(vf27, t2); // qmtc2.i vf27, t2 + c->lqc2(vf24, 12, t1); // lqc2 vf24, 12(t1) + c->lqc2(vf25, 28, t1); // lqc2 vf25, 28(t1) + c->lqc2(vf26, 44, t1); // lqc2 vf26, 44(t1) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, t0); // sqc2 vf28, 0(t0) + c->sqc2(vf29, 0, a1); // sqc2 vf29, 0(a1) + c->lw(t1, 8, t0); // lw t1, 8(t0) + c->lw(t0, 4, t0); // lw t0, 4(t0) + bc = ((s64)c->sgpr64(t1)) >= 0; // bgez t1, L11 + c->lw(v0, 8, a1); // lw v0, 8(a1) + if (bc) {goto block_18;} // branch non-likely + + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L11 + c->lw(v0, 4, a1); // lw v0, 4(a1) + if (bc) {goto block_18;} // branch non-likely + + c->lw(v0, 0, a1); // lw v0, 0(a1) + +block_18: + c->mov64(a1, v0); // or a1, v0, r0 + c->mtc1(f2, a1); // mtc1 f2, a1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->swc1(f1, 36, a2); // swc1 f1, 36(a2) + c->mfc1(a1, f1); // mfc1 a1, f1 + +block_19: + c->lwu(a1, 24, a3); // lwu a1, 24(a3) + bc = c->sgpr64(s7) == c->sgpr64(a1); // beq s7, a1, L14 + c->mov64(a1, s7); // or a1, s7, r0 + if (bc) {goto block_24;} // branch non-likely + + c->lwc1(f1, 8, v1); // lwc1 f1, 8(v1) + c->lwu(t0, 24, a3); // lwu t0, 24(a3) + c->movs(f2, f0); // mov.s f2, f0 + c->daddiu(a1, sp, 112); // daddiu a1, sp, 112 + c->daddiu(v1, sp, 128); // daddiu v1, sp, 128 + c->mfc1(t1, f2); // mfc1 t1, f2 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L13 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_23;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L13 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_23;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_23: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->swc1(f1, 40, a2); // swc1 f1, 40(a2) + c->mfc1(a1, f1); // mfc1 a1, f1 + +block_24: + c->lwu(v1, 4, a3); // lwu v1, 4(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L17 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_33;} // branch non-likely + + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f1, a1); // mtc1 f1, a1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->adds(f1, f1, f2); // add.s f1, f1, f2 + c->mfc1(v1, f1); // mfc1 v1, f1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->lwu(v1, 28, a3); // lwu v1, 28(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L17 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_33;} // branch non-likely + + c->lwu(t0, 4, a3); // lwu t0, 4(a3) + c->daddiu(a1, sp, 144); // daddiu a1, sp, 144 + c->daddiu(v1, sp, 160); // daddiu v1, sp, 160 + c->mfc1(t1, f1); // mfc1 t1, f1 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L15 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_29;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L15 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_29;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_29: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->lwu(t0, 28, a3); // lwu t0, 28(a3) + c->movs(f2, f0); // mov.s f2, f0 + c->daddiu(a1, sp, 176); // daddiu a1, sp, 176 + c->daddiu(v1, sp, 192); // daddiu v1, sp, 192 + c->mfc1(t1, f2); // mfc1 t1, f2 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L16 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_32;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L16 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_32;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_32: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->swc1(f1, 44, a2); // swc1 f1, 44(a2) + c->mfc1(v1, f1); // mfc1 v1, f1 + +block_33: + c->mtc1(f1, r0); // mtc1 f1, r0 + c->lwu(v1, 8, a3); // lwu v1, 8(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L20 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_42;} // branch non-likely + + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f1, a1); // mtc1 f1, a1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->adds(f1, f1, f2); // add.s f1, f1, f2 + c->mfc1(v1, f1); // mfc1 v1, f1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->lwu(v1, 32, a3); // lwu v1, 32(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L20 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_42;} // branch non-likely + + c->lui(v1, 17792); // lui v1, 17792 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->lwu(t0, 8, a3); // lwu t0, 8(a3) + c->daddiu(a1, sp, 208); // daddiu a1, sp, 208 + c->daddiu(v1, sp, 224); // daddiu v1, sp, 224 + c->mfc1(t1, f2); // mfc1 t1, f2 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L18 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_38;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L18 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_38;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_38: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->lwu(t0, 32, a3); // lwu t0, 32(a3) + c->movs(f2, f0); // mov.s f2, f0 + c->daddiu(a1, sp, 240); // daddiu a1, sp, 240 + c->daddiu(v1, sp, 256); // daddiu v1, sp, 256 + c->mfc1(t1, f2); // mfc1 t1, f2 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L19 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_41;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L19 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_41;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_41: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->abss(f1, f1); // abs.s f1, f1 + c->swc1(f1, 12, a2); // swc1 f1, 12(a2) + c->mfc1(v1, f1); // mfc1 v1, f1 + +block_42: + c->ld(v1, 56, a3); // ld v1, 56(a3) + c->andi(v1, v1, 1); // andi v1, v1, 1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L21 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_44;} // branch non-likely + + c->lwc1(f0, 12, a2); // lwc1 f0, 12(a2) + c->swc1(f0, 28, a2); // swc1 f0, 28(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + //beq r0, r0, L24 // beq r0, r0, L24 + // nop // sll r0, r0, 0 + goto block_53; // branch always + + +block_44: + c->lwu(v1, 12, a3); // lwu v1, 12(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L24 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_53;} // branch non-likely + + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f1, a1); // mtc1 f1, a1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->adds(f1, f1, f2); // add.s f1, f1, f2 + c->mfc1(v1, f1); // mfc1 v1, f1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->lwu(v1, 36, a3); // lwu v1, 36(a3) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L24 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_53;} // branch non-likely + + c->lui(v1, 17792); // lui v1, 17792 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->lwu(t0, 12, a3); // lwu t0, 12(a3) + c->daddiu(a1, sp, 272); // daddiu a1, sp, 272 + c->daddiu(v1, sp, 288); // daddiu v1, sp, 288 + c->mfc1(t1, f2); // mfc1 t1, f2 + c->mov128_vf_gpr(vf27, t1); // qmtc2.i vf27, t1 + c->lqc2(vf24, 12, t0); // lqc2 vf24, 12(t0) + c->lqc2(vf25, 28, t0); // lqc2 vf25, 28(t0) + c->lqc2(vf26, 44, t0); // lqc2 vf26, 44(t0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L22 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_49;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L22 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_49;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_49: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->muls(f1, f1, f2); // mul.s f1, f1, f2 + c->lwu(a3, 36, a3); // lwu a3, 36(a3) + c->daddiu(a1, sp, 304); // daddiu a1, sp, 304 + c->daddiu(v1, sp, 320); // daddiu v1, sp, 320 + c->mfc1(t0, f0); // mfc1 t0, f0 + c->mov128_vf_gpr(vf27, t0); // qmtc2.i vf27, t0 + c->lqc2(vf24, 12, a3); // lqc2 vf24, 12(a3) + c->lqc2(vf25, 28, a3); // lqc2 vf25, 28(a3) + c->lqc2(vf26, 44, a3); // lqc2 vf26, 44(a3) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(a3, 8, a1); // lw a3, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(a3)) >= 0; // bgez a3, L23 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_52;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L23 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_52;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_52: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->muls(f0, f1, f0); // mul.s f0, f1, f0 + c->abss(f0, f0); // abs.s f0, f0 + c->swc1(f0, 28, a2); // swc1 f0, 28(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + +block_53: + c->load_symbol2(v1, cache.random_generator); // lw v1, *random-generator*(s7) + c->sw(a0, 0, v1); // sw a0, 0(v1) + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + //jr ra // jr ra + c->daddiu(sp, sp, 336); // daddiu sp, sp, 336 + goto end_of_function; // return + + // nop // sll r0, r0, 0 + // nop // sll r0, r0, 0 +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.random_generator = intern_from_c(-1, 0, "*random-generator*").c(); + gLinkedFunctionTable.reg("live-func-curve", execute, 512); +} + +} // namespace live_func_curve +} // namespace Mips2C + +//--------------------------MIPS2C--------------------- +// clang-format off +#include "game/mips2c/mips2c_private.h" +#include "game/kernel/jak3/kscheme.h" +using ::jak3::intern_from_c; +namespace Mips2C::jak3 { +namespace birth_func_curve { +struct Cache { + void* random_generator; // *random-generator* +} cache; + +u64 execute(void* ctxt) { + auto* c = (ExecutionContext*)ctxt; + bool bc = false; + u32 call_addr = 0; + c->daddiu(sp, sp, -112); // daddiu sp, sp, -112 + c->mov64(t1, a1); // or t1, a1, r0 + c->lwu(a0, 108, t1); // lwu a0, 108(t1) + c->addiu(v1, r0, 0); // addiu v1, r0, 0 + c->load_symbol2(v1, cache.random_generator); // lw v1, *random-generator*(s7) + c->lwu(v1, 0, v1); // lwu v1, 0(v1) + c->sw(v1, 12, t1); // sw v1, 12(t1) + c->ld(a3, 40, a0); // ld a3, 40(a0) + c->ld(v1, 48, a0); // ld v1, 48(a0) + c->slt(v1, r0, v1); // slt v1, r0, v1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L26 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_2;} // branch non-likely + + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->ld(v1, 48, a0); // ld v1, 48(a0) + c->div(v0, v1); // div v0, v1 + c->mfhi(v1); // mfhi v1 + c->daddu(a3, a3, v1); // daddu a3, a3, v1 + c->mov64(v1, a3); // or v1, a3, r0 + +block_2: + c->sw(a3, 100, t1); // sw a3, 100(t1) + c->mtc1(f0, r0); // mtc1 f0, r0 + c->swc1(f0, 44, a2); // swc1 f0, 44(a2) + c->lwu(v1, 0, a0); // lwu v1, 0(a0) + if (((s64)c->sgpr64(s7)) == ((s64)c->sgpr64(v1))) {// beql s7, v1, L27 + c->mov64(v1, v1); // or v1, v1, r0 + goto block_7; + } + +// block_4: + c->ld(v1, 56, a0); // ld v1, 56(a0) + c->andi(v1, v1, 4); // andi v1, v1, 4 + if (((s64)c->sgpr64(v1)) != ((s64)0)) { // bnel v1, r0, L27 + c->daddiu(v1, s7, 4); // daddiu v1, s7, 4 + goto block_7; + } + +//block_6: + c->daddiu(v1, s7, 4); // daddiu v1, s7, 4 + c->ld(a1, 56, a0); // ld a1, 56(a0) + c->andi(a1, a1, 2); // andi a1, a1, 2 + c->movn(v1, s7, a1); // movn v1, s7, a1 + +block_7: + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L31 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_14;} // branch non-likely + + c->lwu(a3, 0, a0); // lwu a3, 0(a0) + c->load_symbol2(t0, cache.random_generator); // lw t0, *random-generator*(s7) + c->lwu(a1, 0, t0); // lwu a1, 0(t0) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, t0); // sw v0, 0(t0) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f0, a1); // mtc1 f0, a1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->adds(f0, f0, f1); // add.s f0, f0, f1 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->daddiu(v1, sp, 16); // daddiu v1, sp, 16 + c->daddiu(a1, sp, 32); // daddiu a1, sp, 32 + c->mfc1(t0, f0); // mfc1 t0, f0 + c->mov128_vf_gpr(vf26, t0); // qmtc2.i vf26, t0 + c->lqc2(vf23, 12, a3); // lqc2 vf23, 12(a3) + c->lqc2(vf25, 92, a3); // lqc2 vf25, 92(a3) + c->vmax_bc(DEST::xyzw, BC::w, vf3, vf0, vf0); // vmaxw.xyzw vf3, vf0, vf0 + c->vmula(DEST::xyzw, vf25, vf23); // vmula.xyzw acc, vf25, vf23 + c->vmadd_bc(DEST::xyzw, BC::x, vf28, vf25, vf26); // vmaddx.xyzw vf28, vf25, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->lw(t0, 8, a1); // lw t0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(t0)) >= 0; // bgez t0, L29 + // nop // sll r0, r0, 0 + if (bc) {goto block_12;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L28 + // nop // sll r0, r0, 0 + if (bc) {goto block_11;} // branch non-likely + + c->lqc2(vf1, 28, a3); // lqc2 vf1, 28(a3) + c->lqc2(vf2, 44, a3); // lqc2 vf2, 44(a3) + c->vsub_bc(DEST::xyzw, BC::x, vf4, vf3, vf28); // vsubx.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::x, vf2, vf28); // vmulax.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::x, vf5, vf1, vf4); // vmaddx.xyzw vf5, vf1, vf4 + //beq r0, r0, L30 // beq r0, r0, L30 + c->sqc2(vf5, 0, v1); // sqc2 vf5, 0(v1) + goto block_13; // branch always + + +block_11: + c->lqc2(vf1, 44, a3); // lqc2 vf1, 44(a3) + c->lqc2(vf2, 60, a3); // lqc2 vf2, 60(a3) + c->vsub_bc(DEST::xyzw, BC::y, vf4, vf3, vf28); // vsuby.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::y, vf2, vf28); // vmulay.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::y, vf5, vf1, vf4); // vmaddy.xyzw vf5, vf1, vf4 + //beq r0, r0, L30 // beq r0, r0, L30 + c->sqc2(vf5, 0, v1); // sqc2 vf5, 0(v1) + goto block_13; // branch always + + +block_12: + c->lqc2(vf1, 60, a3); // lqc2 vf1, 60(a3) + c->lqc2(vf2, 76, a3); // lqc2 vf2, 76(a3) + c->vsub_bc(DEST::xyzw, BC::z, vf4, vf3, vf28); // vsubz.xyzw vf4, vf3, vf28 + c->vmula_bc(DEST::xyzw, BC::z, vf2, vf28); // vmulaz.xyzw acc, vf2, vf28 + c->vmadd_bc(DEST::xyzw, BC::z, vf5, vf1, vf4); // vmaddz.xyzw vf5, vf1, vf4 + c->sqc2(vf5, 0, v1); // sqc2 vf5, 0(v1) + +block_13: + c->lwc1(f0, 0, v1); // lwc1 f0, 0(v1) + c->swc1(f0, 32, a2); // swc1 f0, 32(a2) + c->lwc1(f0, 4, v1); // lwc1 f0, 4(v1) + c->swc1(f0, 36, a2); // swc1 f0, 36(a2) + c->lwc1(f0, 8, v1); // lwc1 f0, 8(v1) + c->swc1(f0, 40, a2); // swc1 f0, 40(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + +block_14: + c->ld(v1, 56, a0); // ld v1, 56(a0) + c->andi(v1, v1, 4); // andi v1, v1, 4 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L36 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_27;} // branch non-likely + + c->mtc1(f0, r0); // mtc1 f0, r0 + c->lwu(v1, 8, a0); // lwu v1, 8(a0) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L33 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_20;} // branch non-likely + + c->load_symbol2(a3, cache.random_generator); // lw a3, *random-generator*(s7) + c->lwu(a1, 0, a3); // lwu a1, 0(a3) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, a3); // sw v0, 0(a3) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f0, a1); // mtc1 f0, a1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->adds(f0, f0, f1); // add.s f0, f0, f1 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->lui(v1, 17792); // lui v1, 17792 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lwu(a3, 8, a0); // lwu a3, 8(a0) + c->daddiu(a1, sp, 48); // daddiu a1, sp, 48 + c->daddiu(v1, sp, 64); // daddiu v1, sp, 64 + c->mfc1(t0, f1); // mfc1 t0, f1 + c->mov128_vf_gpr(vf27, t0); // qmtc2.i vf27, t0 + c->lqc2(vf24, 12, a3); // lqc2 vf24, 12(a3) + c->lqc2(vf25, 28, a3); // lqc2 vf25, 28(a3) + c->lqc2(vf26, 44, a3); // lqc2 vf26, 44(a3) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(a3, 8, a1); // lw a3, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + bc = ((s64)c->sgpr64(a3)) >= 0; // bgez a3, L32 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_19;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L32 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_19;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_19: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 12, a2); // swc1 f0, 12(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + +block_20: + c->ld(v1, 56, a0); // ld v1, 56(a0) + c->andi(v1, v1, 1); // andi v1, v1, 1 + bc = c->sgpr64(v1) == 0; // beq v1, r0, L34 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_22;} // branch non-likely + + c->lwc1(f0, 12, a2); // lwc1 f0, 12(a2) + c->swc1(f0, 28, a2); // swc1 f0, 28(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + //beq r0, r0, L36 // beq r0, r0, L36 + // nop // sll r0, r0, 0 + goto block_27; // branch always + + +block_22: + c->lwu(v1, 12, a0); // lwu v1, 12(a0) + bc = c->sgpr64(s7) == c->sgpr64(v1); // beq s7, v1, L36 + c->mov64(v1, s7); // or v1, s7, r0 + if (bc) {goto block_27;} // branch non-likely + + c->load_symbol2(a3, cache.random_generator); // lw a3, *random-generator*(s7) + c->lwu(a1, 0, a3); // lwu a1, 0(a3) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, a3); // sw v0, 0(a3) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f0, a1); // mtc1 f0, a1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->adds(f0, f0, f1); // add.s f0, f0, f1 + c->mfc1(v1, f0); // mfc1 v1, f0 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lui(v1, 17792); // lui v1, 17792 + c->mtc1(f0, v1); // mtc1 f0, v1 + c->lwu(a0, 12, a0); // lwu a0, 12(a0) + c->load_symbol2(a3, cache.random_generator); // lw a3, *random-generator*(s7) + c->lwu(a1, 0, a3); // lwu a1, 0(a3) + c->addiu(v1, r0, 16807); // addiu v1, r0, 16807 + c->mult3(v0, v1, a1); // mult3 v0, v1, a1 + c->mfhi(v1); // mfhi v1 + c->daddu(v1, v1, v1); // daddu v1, v1, v1 + c->srl(a1, v0, 31); // srl a1, v0, 31 + c->or_(v1, v1, a1); // or v1, v1, a1 + c->daddu(v0, v0, v1); // daddu v0, v0, v1 + c->sll(v0, v0, 1); // sll v0, v0, 1 + c->srl(v0, v0, 1); // srl v0, v0, 1 + c->sw(v0, 0, a3); // sw v0, 0(a3) + c->mov64(v1, v0); // or v1, v0, r0 + c->dsra(v1, v1, 8); // dsra v1, v1, 8 + c->lui(a1, 16256); // lui a1, 16256 + c->or_(v1, a1, v1); // or v1, a1, v1 + c->lui(a1, -16512); // lui a1, -16512 + c->mtc1(f1, a1); // mtc1 f1, a1 + c->mtc1(f2, v1); // mtc1 f2, v1 + c->adds(f1, f1, f2); // add.s f1, f1, f2 + c->mfc1(v1, f1); // mfc1 v1, f1 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->daddiu(a1, sp, 80); // daddiu a1, sp, 80 + c->daddiu(v1, sp, 96); // daddiu v1, sp, 96 + c->mfc1(a3, f1); // mfc1 a3, f1 + c->mov128_vf_gpr(vf27, a3); // qmtc2.i vf27, a3 + c->lqc2(vf24, 12, a0); // lqc2 vf24, 12(a0) + c->lqc2(vf25, 28, a0); // lqc2 vf25, 28(a0) + c->lqc2(vf26, 44, a0); // lqc2 vf26, 44(a0) + c->vmini_bc(DEST::xyzw, BC::w, vf27, vf27, vf0); // vminiw.xyzw vf27, vf27, vf0 + c->vmax_bc(DEST::xyzw, BC::x, vf27, vf27, vf0); // vmaxx.xyzw vf27, vf27, vf0 + c->vadd_bc(DEST::xyzw, BC::x, vf28, vf24, vf27); // vaddx.xyzw vf28, vf24, vf27 + c->vmula_bc(DEST::xyzw, BC::w, vf25, vf0); // vmulaw.xyzw acc, vf25, vf0 + c->vmadd(DEST::xyzw, vf29, vf28, vf26); // vmadd.xyzw vf29, vf28, vf26 + c->sqc2(vf28, 0, a1); // sqc2 vf28, 0(a1) + c->sqc2(vf29, 0, v1); // sqc2 vf29, 0(v1) + c->lw(a0, 8, a1); // lw a0, 8(a1) + c->lw(a1, 4, a1); // lw a1, 4(a1) + // nop // sll r0, r0, 0 + bc = ((s64)c->sgpr64(a0)) >= 0; // bgez a0, L35 + c->lw(v0, 8, v1); // lw v0, 8(v1) + if (bc) {goto block_26;} // branch non-likely + + bc = ((s64)c->sgpr64(a1)) >= 0; // bgez a1, L35 + c->lw(v0, 4, v1); // lw v0, 4(v1) + if (bc) {goto block_26;} // branch non-likely + + c->lw(v0, 0, v1); // lw v0, 0(v1) + +block_26: + c->mov64(v1, v0); // or v1, v0, r0 + c->mtc1(f1, v1); // mtc1 f1, v1 + c->muls(f0, f0, f1); // mul.s f0, f0, f1 + c->swc1(f0, 28, a2); // swc1 f0, 28(a2) + c->mfc1(v1, f0); // mfc1 v1, f0 + +block_27: + c->gprs[v0].du64[0] = 0; // or v0, r0, r0 + //jr ra // jr ra + c->daddiu(sp, sp, 112); // daddiu sp, sp, 112 + goto end_of_function; // return + +end_of_function: + return c->gprs[v0].du64[0]; +} + +void link() { + cache.random_generator = intern_from_c(-1, 0, "*random-generator*").c(); + gLinkedFunctionTable.reg("birth-func-curve", execute, 128); +} + +} // namespace birth_func_curve +} // namespace Mips2C \ No newline at end of file diff --git a/game/mips2c/mips2c_private.h b/game/mips2c/mips2c_private.h index fa71f698af4..574af214f7e 100644 --- a/game/mips2c/mips2c_private.h +++ b/game/mips2c/mips2c_private.h @@ -1165,16 +1165,48 @@ struct ExecutionContext { } } + void mfhi(int dst) { gprs[dst].du64[0] = hi.du64[0]; } + void mflo(int dst) { gprs[dst].du64[0] = lo.du64[0]; } + void mult3(int dst, int src0, int src1) { - u32 result = gpr_src(src0).ds32[0] * gpr_src(src1).ds32[0]; - s32 sresult = result; - gprs[dst].ds64[0] = sresult; + s64 result = (s64)gpr_src(src0).ds32[0] * gpr_src(src1).ds32[0]; + + lo.ds64[0] = (s32)(result & 0xffffffff); + hi.ds64[0] = (s32)(result >> 32); + + gprs[dst].du64[0] = lo.du64[0]; } void multu3(int dst, int src0, int src1) { - u32 result = gpr_src(src0).du32[0] * gpr_src(src1).du32[0]; - s32 sresult = result; - gprs[dst].ds64[0] = sresult; + u64 result = (u64)gpr_src(src0).du32[0] * gpr_src(src1).du32[0]; + + lo.ds64[0] = (s32)(result & 0xffffffff); + hi.ds64[0] = (s32)(result >> 32); + + gprs[dst].du64[0] = lo.du64[0]; + } + + void div(int dst, int src) { + if (gprs[dst].du32[0] == 0x80000000 && gprs[src].du32[0] == 0xffffffff) { + lo.ds64[0] = (s32)0x80000000; + lo.ds64[0] = (s32)0x0; + } else if (gprs[src].ds32[0] != 0) { + lo.ds64[0] = gprs[dst].ds32[0] / gprs[src].ds32[0]; + hi.ds64[0] = gprs[dst].ds32[0] % gprs[src].ds32[0]; + } else { + lo.ds64[0] = gprs[dst].ds32[0] < 0 ? 1 : -1; + hi.ds64[0] = gprs[dst].ds32[0]; + } + } + + void divu(int dst, int src) { + if (gprs[dst].du32[0] != 0) { + lo.ds64[0] = (s32)(gprs[dst].du32[0] / gprs[src].du32[0]); + hi.ds64[0] = (s32)(gprs[dst].du32[0] % gprs[src].du32[0]); + } else { + lo.ds64[0] = -1; + hi.ds64[0] = gprs[dst].ds32[0]; + } } void xori(int dest, int src, u64 imm) { gprs[dest].du64[0] = gpr_src(src).du64[0] ^ imm; } diff --git a/game/mips2c/mips2c_table.cpp b/game/mips2c/mips2c_table.cpp index fd6f682845f..11849b3e184 100644 --- a/game/mips2c/mips2c_table.cpp +++ b/game/mips2c/mips2c_table.cpp @@ -289,6 +289,8 @@ namespace cspace_parented_transformq_joint { extern void link(); } namespace foreground_check_longest_edge_asm { extern void link(); } namespace foreground_merc { extern void link(); } namespace foreground_generic_merc { extern void link(); } +namespace live_func_curve { extern void link(); } +namespace birth_func_curve { extern void link(); } } @@ -460,29 +462,33 @@ PerGameVersion>> gMips2C jak2::shadow_scissor_top::link, jak2::shadow_scissor_edges::link, jak2::shadow_calc_dual_verts::link, jak2::shadow_xform_verts::link}}}, /////////// JAK 3 - {{"lights", - {jak3::light_hash_get_bucket_index::link, jak3::add_light_sphere_to_light_group::link, - jak3::light_hash_count_items::link, jak3::light_hash_add_items::link}}, - {"debug", - {jak3::debug_line_clip::link, jak3::init_boundary_regs::link, - jak3::draw_boundary_polygon::link, jak3::render_boundary_quad::link, - jak3::render_boundary_tri::link, jak3::set_sky_vf27::link}}, - {"generic-effect", - {jak3::generic_light_proc::link, jak3::generic_envmap_proc::link, - jak3::generic_prepare_dma_double::link, jak3::generic_prepare_dma_single::link, - jak3::generic_warp_source_proc::link, jak3::generic_warp_dest_proc::link, - jak3::generic_warp_dest::link, jak3::generic_warp_envmap_dest::link, - jak3::generic_no_light_proc::link}}, - {"font", - {jak3::method_9_font_work::link, jak3::draw_string_asm::link, jak3::get_string_length::link}}, - {"texture", {jak3::adgif_shader_texture_with_update::link}}, - {"collide-func", - {jak3::moving_sphere_triangle_intersect::link, jak3::collide_do_primitives::link}}, - {"prim", {jak3::method_9_prim_strip::link}}, - {"joint", {jak3::cspace_parented_transformq_joint::link}}, - {"foreground", - {jak3::foreground_check_longest_edge_asm::link, jak3::foreground_generic_merc::link, - jak3::foreground_merc::link}}}}; + { + {"lights", + {jak3::light_hash_get_bucket_index::link, jak3::add_light_sphere_to_light_group::link, + jak3::light_hash_count_items::link, jak3::light_hash_add_items::link}}, + {"debug", + {jak3::debug_line_clip::link, jak3::init_boundary_regs::link, + jak3::draw_boundary_polygon::link, jak3::render_boundary_quad::link, + jak3::render_boundary_tri::link, jak3::set_sky_vf27::link}}, + {"generic-effect", + {jak3::generic_light_proc::link, jak3::generic_envmap_proc::link, + jak3::generic_prepare_dma_double::link, jak3::generic_prepare_dma_single::link, + jak3::generic_warp_source_proc::link, jak3::generic_warp_dest_proc::link, + jak3::generic_warp_dest::link, jak3::generic_warp_envmap_dest::link, + jak3::generic_no_light_proc::link}}, + {"font", + {jak3::method_9_font_work::link, jak3::draw_string_asm::link, + jak3::get_string_length::link}}, + {"texture", {jak3::adgif_shader_texture_with_update::link}}, + {"collide-func", + {jak3::moving_sphere_triangle_intersect::link, jak3::collide_do_primitives::link}}, + {"prim", {jak3::method_9_prim_strip::link}}, + {"joint", {jak3::cspace_parented_transformq_joint::link}}, + {"foreground", + {jak3::foreground_check_longest_edge_asm::link, jak3::foreground_generic_merc::link, + jak3::foreground_merc::link}}, + {"particle-curves", {jak3::live_func_curve::link, jak3::birth_func_curve::link}}, + }}; void LinkedFunctionTable::reg(const std::string& name, u64 (*exec)(void*), u32 stack_size) { const auto& it = m_executes.insert({name, {exec, Ptr()}}); diff --git a/goal_src/jak1/engine/entity/entity.gc b/goal_src/jak1/engine/entity/entity.gc index bf2c540b0d7..4dde7a86b74 100644 --- a/goal_src/jak1/engine/entity/entity.gc +++ b/goal_src/jak1/engine/entity/entity.gc @@ -338,6 +338,23 @@ ;; entity inspection ;;;;;;;;;;;;;;;;;;;;;; +(defmethod inspect ((this entity)) + (call-parent-method this) + (format #t "~Ttrans: ~`vector`P~%" (-> this trans)) + (format #t "~Taid: ~A~%" (-> this aid)) + this + ) + +(defmethod inspect ((this entity-actor)) + (call-parent-method this) + (format #t "~Tnav-mesh: ~A~%" (-> this nav-mesh)) + (format #t "~Tetype: ~A~%" (-> this etype)) + (format #t "~Ttask: ~d~%" (-> this task)) + (format #t "~Tvis-id: ~d~%" (-> this vis-id-signed)) + (format #t "~Tquat: ~`vector`P~%" (-> this quat)) + this + ) + (defun-debug process-status-bits ((arg0 process) (arg1 symbol)) "Print to arg1 three characters representing the status of a process The first is an r, if we should run. diff --git a/goal_src/jak2/engine/entity/entity.gc b/goal_src/jak2/engine/entity/entity.gc index c6847600339..b6e075434a7 100644 --- a/goal_src/jak2/engine/entity/entity.gc +++ b/goal_src/jak2/engine/entity/entity.gc @@ -498,6 +498,25 @@ (-> arg0 level task-mask) ) +(defmethod inspect ((this entity)) + (call-parent-method this) + (format #t "~Ttrans: ~`vector`P~%" (-> this trans)) + (format #t "~Taid: ~A~%" (-> this aid)) + this + ) + +(defmethod inspect ((this entity-actor)) + (call-parent-method this) + (format #t "~Tetype: ~A~%" (-> this etype)) + (format #t "~Ttask: ~d~%" (-> this task)) + (format #t "~Tkill-mask: #x~X : (" (-> this kill-mask)) + (bit-enum->string task-mask (-> this kill-mask) #t) + (format #t ")~%") + (format #t "~Tvis-id: ~d~%" (-> this vis-id)) + (format #t "~Tquat: ~`vector`P~%" (-> this quat)) + this + ) + (defmethod print ((this process)) (cond ((and (-> this top-thread) (!= (-> this status) 'dead)) diff --git a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc index dd2b7ec4031..4b5de92d99b 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable-h.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable-h.gc @@ -242,9 +242,11 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) &key (eval? #t) ) @@ -257,8 +259,10 @@ num-func = sets the num-func field for the channel. this lets you change the function with eval'ing. param0 = 1st parameter for the playback function. ONLY USE THESE WITH num-func !! param1 = 2nd parameter for the playback function. ONLY USE THESE WITH num-func !! + param2 = 3rd parameter for the playback function. ONLY USE THESE WITH num-func !! frame-num = set the frame-num field. - frame-interp = set the frame-interp field. + frame-interp0 = set the first value of the frame-interp array. + frame-interp1 = set the second value of the frame-interp array. dist = set the dist field. available num! functions: - (+!) = advance anim. @@ -314,6 +318,10 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) + (p2 (if param2 param2 + (cond + ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) + ))) (frame-num (cond ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) @@ -324,11 +332,13 @@ (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan))) - ,(if frame-interp `(set! (-> ja-ch frame-interp) ,frame-interp) `(none)) + ,(if frame-interp0 `(set! (-> ja-ch frame-interp 0) ,frame-interp0) `(none)) + ,(if frame-interp1 `(set! (-> ja-ch frame-interp 1) ,frame-interp1) `(none)) ,(if dist `(set! (-> ja-ch dist) ,dist) `(none)) ,(if frame-group `(set! (-> ja-ch frame-group) (the art-joint-anim ,frame-group)) `(none)) ,(if p0 `(set! (-> ja-ch param 0) ,p0) `(none)) ,(if p1 `(set! (-> ja-ch param 1) ,p1) `(none)) + ,(if p2 `(set! (-> ja-ch param 2) ,p2) `(none)) ,(if num-func `(set! (-> ja-ch num-func) ,num-func) `(none)) ,(if frame-num `(set! (-> ja-ch frame-num) ,frame-num) `(none)) ,(if nf @@ -341,7 +351,7 @@ `(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) frames num-frames)))) `(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group frames num-frames)))) )) - ((eq? num! 'identity) `(set! (-> ja-ch frame-num) ,(car num-args))) + ((and (eq? num! 'identity) (not (null? num-args))) `(set! (-> ja-ch frame-num) ,(car num-args))) (#t `(none)) ) )) @@ -352,10 +362,12 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) ) - `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :num-func ,num-func :frame-num ,frame-num :frame-interp ,frame-interp :dist ,dist) + `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :param2 ,param2 :num-func ,num-func :frame-num ,frame-num :frame-interp0 ,frame-interp0 :frame-interp1 ,frame-interp1 :dist ,dist) ) diff --git a/goal_src/jak2/engine/target/mech/mech-states.gc b/goal_src/jak2/engine/target/mech/mech-states.gc index b9ed546a42e..64eb964c739 100644 --- a/goal_src/jak2/engine/target/mech/mech-states.gc +++ b/goal_src/jak2/engine/target/mech/mech-states.gc @@ -153,12 +153,7 @@ ) 0 (ja :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) - (let ((a0-41 (-> self skel root-channel 1))) - (set! (-> a0-41 frame-interp 1) f30-0) - (set! (-> a0-41 frame-interp 0) f30-0) - (set! (-> a0-41 param 0) 0.0) - (joint-control-channel-group-eval! a0-41 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (ja-no-eval :chan 1 :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) ) ) @@ -312,18 +307,8 @@ 0 (ja :num! (loop! f26-1)) ) - (let ((a0-24 (-> self skel root-channel 1))) - (set! (-> a0-24 frame-interp 1) f30-0) - (set! (-> a0-24 frame-interp 0) f30-0) - (set! (-> a0-24 param 0) 0.0) - (joint-control-channel-group-eval! a0-24 (the-as art-joint-anim #f) num-func-chan) - ) - (let ((a0-25 (-> self skel root-channel 2))) - (set! (-> a0-25 frame-interp 1) f28-0) - (set! (-> a0-25 frame-interp 0) f28-0) - (set! (-> a0-25 param 0) 0.0) - (joint-control-channel-group-eval! a0-25 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :num! (chan 0) :frame-interp0 f28-0 :frame-interp1 f28-0) ) ) #f @@ -1452,13 +1437,7 @@ ) (ja-channel-push! 2 1) (ja :group! jakb-mech-carry-pickup-high-ja :num! min) - (let ((a0-2 (-> self skel root-channel 1))) - (set! (-> a0-2 frame-interp 1) f30-0) - (set! (-> a0-2 frame-interp 0) f30-0) - (set! (-> a0-2 frame-group) (the-as art-joint-anim jakb-mech-carry-pickup-low-ja)) - (set! (-> a0-2 param 0) 0.0) - (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim jakb-mech-carry-pickup-low-ja) num-func-chan) - ) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja :num! (seek!)) (ja :chan 1 :num! (chan 0)) @@ -1546,10 +1525,7 @@ (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-120 (-> self skel root-channel 1))) - (set! (-> v1-120 frame-interp 1) f30-0) - (set! (-> v1-120 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1587,10 +1563,7 @@ (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-174 (-> self skel root-channel 1))) - (set! (-> v1-174 frame-interp 1) f30-0) - (set! (-> v1-174 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1608,20 +1581,14 @@ (else (ja-no-eval :num! (seek! (ja-aframe 11.0 0))) (while (not (ja-done? 0)) - (let ((v1-190 (-> self skel root-channel 1))) - (set! (-> v1-190 frame-interp 1) f30-0) - (set! (-> v1-190 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) (suspend) (ja-no-eval :num! (seek! 0.0)) (while (not (ja-done? 0)) - (let ((v1-199 (-> self skel root-channel 1))) - (set! (-> v1-199 frame-interp 1) f30-0) - (set! (-> v1-199 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1690,13 +1657,7 @@ ) (ja-channel-push! 2 (seconds 0.1)) (ja :group! jakb-mech-carry-pickup-high-ja :num! max) - (let ((a0-19 (-> self skel root-channel 1))) - (set! (-> a0-19 frame-interp 1) f30-0) - (set! (-> a0-19 frame-interp 0) f30-0) - (set! (-> a0-19 frame-group) (the-as art-joint-anim jakb-mech-carry-pickup-low-ja)) - (set! (-> a0-19 param 0) 0.0) - (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim jakb-mech-carry-pickup-low-ja) num-func-chan) - ) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) (while (not (ja-done? 0)) @@ -1988,12 +1949,7 @@ ) (ja :num! (loop! f28-1)) ) - (let ((a0-16 (-> self skel root-channel 1))) - (set! (-> a0-16 frame-interp 1) f30-0) - (set! (-> a0-16 frame-interp 0) f30-0) - (set! (-> a0-16 param 0) 0.0) - (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) #f diff --git a/goal_src/jak2/engine/target/target-anim.gc b/goal_src/jak2/engine/target/target-anim.gc index 387f7920210..dc37275a28e 100644 --- a/goal_src/jak2/engine/target/target-anim.gc +++ b/goal_src/jak2/engine/target/target-anim.gc @@ -1105,10 +1105,7 @@ ) ) ) - (let ((v1-252 (-> self skel root-channel 6))) - (set! (-> v1-252 frame-interp 1) f26-0) - (set! (-> v1-252 frame-interp 0) f26-0) - ) + (ja :chan 6 :frame-interp0 f26-0 :frame-interp1 f26-0) (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) (f0-70 (/ (-> self control ctrl-xz-vel) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) ) diff --git a/goal_src/jak2/engine/target/target-carry.gc b/goal_src/jak2/engine/target/target-carry.gc index 4d95bce04fe..a018cd561e5 100644 --- a/goal_src/jak2/engine/target/target-carry.gc +++ b/goal_src/jak2/engine/target/target-carry.gc @@ -186,17 +186,12 @@ (ja-channel-push! 2 (seconds 0.1)) (target-danger-set! 'carry? #f) (ja :group! (-> self draw art-group data 319) :num! min) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 318))) - (set! (-> a0-3 param 0) 0.0) - (joint-control-channel-group-eval! - a0-3 - (the-as art-joint-anim (-> self draw art-group data 318)) - num-func-chan + (ja :chan 1 + :group! (-> self draw art-group data 318) + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 ) - ) (suspend) (format #t "carry picked ~A~%" (handle->process (-> self carry other))) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) @@ -234,10 +229,7 @@ (ja-no-eval :num! (seek! (ja-aframe 5.0 0))) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-45 (-> self skel root-channel 1))) - (set! (-> v1-45 frame-interp 1) f30-0) - (set! (-> v1-45 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -246,10 +238,7 @@ (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-70 (-> self skel root-channel 1))) - (set! (-> v1-70 frame-interp 1) f30-0) - (set! (-> v1-70 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (when (< 22.0 (ja-aframe-num 0)) (let ((a1-22 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-22 from) (process->ppointer self)) @@ -270,10 +259,7 @@ ) (ja-no-eval :num! (seek! 0.0)) (while (not (ja-done? 0)) - (let ((v1-93 (-> self skel root-channel 1))) - (set! (-> v1-93 frame-interp 1) f30-0) - (set! (-> v1-93 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -327,17 +313,12 @@ ) (ja-channel-push! 2 (seconds 0.1)) (ja :group! (-> self draw art-group data 319) :num! max) - (let ((a0-16 (-> self skel root-channel 1))) - (set! (-> a0-16 frame-interp 1) f30-0) - (set! (-> a0-16 frame-interp 0) f30-0) - (set! (-> a0-16 frame-group) (the-as art-joint-anim (-> self draw art-group data 318))) - (set! (-> a0-16 param 0) 0.0) - (joint-control-channel-group-eval! - a0-16 - (the-as art-joint-anim (-> self draw art-group data 318)) - num-func-chan + (ja :chan 1 + :group! (-> self draw art-group data 318) + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 ) - ) ) (suspend) (ja-no-eval :num! (seek! (ja-aframe 5.0 0))) diff --git a/goal_src/jak2/engine/target/target-swim.gc b/goal_src/jak2/engine/target/target-swim.gc index ae023dedf28..71eb0014ada 100644 --- a/goal_src/jak2/engine/target/target-swim.gc +++ b/goal_src/jak2/engine/target/target-swim.gc @@ -254,10 +254,7 @@ (set! f30-1 (seek f30-1 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 4.0 (seconds-per-frame))) ) - (let ((v1-107 (-> self skel root-channel 1))) - (set! (-> v1-107 frame-interp 1) f24-1) - (set! (-> v1-107 frame-interp 0) f24-1) - ) + (ja :chan 1 :frame-interp0 f24-1 :frame-interp1 f24-1) (ja :num! (loop! (/ (-> self control ctrl-xz-vel) (* 60.0 diff --git a/goal_src/jak2/levels/castle/roboguard-level.gc b/goal_src/jak2/levels/castle/roboguard-level.gc index e9cdabe6fdb..7f6fb9959ba 100644 --- a/goal_src/jak2/levels/castle/roboguard-level.gc +++ b/goal_src/jak2/levels/castle/roboguard-level.gc @@ -376,11 +376,7 @@ 0 ) :code (behavior () - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 frame-group) (the-as art-joint-anim roboguard-idle-to-ball-ja)) - (set! (-> a0-0 frame-num) 3.0) - (joint-control-channel-group! a0-0 (the-as art-joint-anim roboguard-idle-to-ball-ja) num-func-identity) - ) + (ja-no-eval :group! roboguard-idle-to-ball-ja :num! (identity 3.0)) (until (logtest? (-> self root status) (collide-status on-surface)) (nav-enemy-falling-post) (suspend) @@ -1172,13 +1168,14 @@ ) (defmethod deactivate ((this roboguard-level)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this roll-sound)) (call-parent-method this) (none) ) -(defmethod relocate ((this roboguard-level) (arg0 int)) - (call-parent-method this arg0) +(defmethod relocate ((this roboguard-level) (offset int)) + (call-parent-method this offset) ) (defmethod init-enemy-collision! ((this roboguard-level)) diff --git a/goal_src/jak2/levels/city/common/pilot-states.gc b/goal_src/jak2/levels/city/common/pilot-states.gc index b517d804fbd..d1e5237c022 100644 --- a/goal_src/jak2/levels/city/common/pilot-states.gc +++ b/goal_src/jak2/levels/city/common/pilot-states.gc @@ -35,13 +35,13 @@ (let ((gp-0 (-> self pilot))) (let ((f30-0 (* 5.0 (- 1.0 (-> gp-0 left-right-interp))))) (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) - (let ((f0-3 (fmax 0.0 (fmin 1.0 (* 0.5 (+ 1.0 (* 1.42 (+ -0.3 (-> gp-0 front-back-interp)))))))) - (s5-1 (-> self skel root-channel 1)) + (let ((f0-3 (fmax 0.0 (fmin 1.0 (* 0.5 (+ 1.0 (* 1.42 (+ -0.3 (-> gp-0 front-back-interp))))))))) + (ja :chan 1 + :frame-interp0 f0-3 + :frame-interp1 f0-3 + :num-func num-func-identity + :frame-num (ja-aframe f30-0 1) ) - (set! (-> s5-1 frame-interp 1) f0-3) - (set! (-> s5-1 frame-interp 0) f0-3) - (set! (-> s5-1 num-func) num-func-identity) - (set! (-> s5-1 frame-num) (ja-aframe f30-0 1)) ) ) (let ((f0-6 (* 5.0 (- 1.0 (-> gp-0 up-down-interp)))) diff --git a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc index 0db2d640942..28654b128a0 100644 --- a/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc +++ b/goal_src/jak2/levels/city/kiddogescort/kidesc-states.gc @@ -507,12 +507,12 @@ ) ) (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) - (let ((gp-2 (-> self skel root-channel 1))) - (set! (-> gp-2 frame-interp 1) f26-0) - (set! (-> gp-2 frame-interp 0) f26-0) - (set! (-> gp-2 num-func) num-func-identity) - (set! (-> gp-2 frame-num) (ja-aframe f28-0 0)) - ) + (ja :chan 1 + :frame-interp0 f26-0 + :frame-interp1 f26-0 + :num-func num-func-identity + :frame-num (ja-aframe f28-0 0) + ) (suspend) ) ) diff --git a/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc b/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc index c85c90c0d0c..4a85053059e 100644 --- a/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc +++ b/goal_src/jak2/levels/city/traffic/citizen/metalhead-flitter.gc @@ -819,24 +819,18 @@ (ja-channel-push! 2 (seconds 0.1)) (let ((f30-0 (metalhead-flitter-method-209 self))) (ja-no-eval :group! flitter-attack-ja :num! (seek! max 0.8) :frame-num 0.0) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim flitter-attack-high-ja)) - (set! (-> a0-3 param 0) 0.0) - (set! (-> a0-3 frame-num) 0.0) - (joint-control-channel-group! a0-3 (the-as art-joint-anim flitter-attack-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! flitter-attack-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (set! f30-0 (seek f30-0 (metalhead-flitter-method-209 self) (* 0.2 (seconds-per-frame)))) (ja :num! (seek! max 0.8)) - (let ((a0-7 (-> self skel root-channel 1))) - (set! (-> a0-7 frame-interp 1) f30-0) - (set! (-> a0-7 frame-interp 0) f30-0) - (set! (-> a0-7 param 0) 0.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) (let ((v1-40 self)) diff --git a/goal_src/jak2/levels/common/enemy/flitter.gc b/goal_src/jak2/levels/common/enemy/flitter.gc index 96c1059bea5..cddbf21b145 100644 --- a/goal_src/jak2/levels/common/enemy/flitter.gc +++ b/goal_src/jak2/levels/common/enemy/flitter.gc @@ -1190,24 +1190,18 @@ (ja-channel-push! 2 (seconds 0.1)) (let ((f30-0 (flitter-method-183 self))) (ja-no-eval :group! flitter-attack-ja :num! (seek! max 0.8) :frame-num 0.0) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim flitter-attack-high-ja)) - (set! (-> a0-3 param 0) 0.0) - (set! (-> a0-3 frame-num) 0.0) - (joint-control-channel-group! a0-3 (the-as art-joint-anim flitter-attack-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! flitter-attack-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (set! f30-0 (seek f30-0 (flitter-method-183 self) (* 0.2 (seconds-per-frame)))) (ja :num! (seek! max 0.8)) - (let ((a0-7 (-> self skel root-channel 1))) - (set! (-> a0-7 frame-interp 1) f30-0) - (set! (-> a0-7 frame-interp 0) f30-0) - (set! (-> a0-7 param 0) 0.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) (let ((v1-40 self)) diff --git a/goal_src/jak2/levels/common/enemy/spyder.gc b/goal_src/jak2/levels/common/enemy/spyder.gc index 16d92ea1768..290b978b7b6 100644 --- a/goal_src/jak2/levels/common/enemy/spyder.gc +++ b/goal_src/jak2/levels/common/enemy/spyder.gc @@ -1041,14 +1041,13 @@ (ja-channel-push! 2 (seconds 0.2)) (let ((f30-0 0.0)) (ja-no-eval :group! spyder-shoot-low-ja :num! (loop!) :frame-num 0.0) - (let ((a0-12 (-> self skel root-channel 1))) - (set! (-> a0-12 frame-interp 1) f30-0) - (set! (-> a0-12 frame-interp 0) f30-0) - (set! (-> a0-12 frame-group) (the-as art-joint-anim spyder-shoot-high-ja)) - (set! (-> a0-12 param 0) 0.0) - (set! (-> a0-12 frame-num) 0.0) - (joint-control-channel-group! a0-12 (the-as art-joint-anim spyder-shoot-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! spyder-shoot-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (let ((a0-14 (handle->process (-> self focus handle)))) (when a0-14 (let ((gp-0 (new 'stack-no-clear 'vector))) @@ -1072,12 +1071,7 @@ (until (time-elapsed? s3-1 (seconds 0.2)) (set! f30-0 (seek f30-0 (lerp-scale 0.0 1.0 (the float s4-0) 0.0 8.0) (seconds-per-frame))) (ja :num! (loop!)) - (let ((a0-27 (-> self skel root-channel 1))) - (set! (-> a0-27 frame-interp 1) f30-0) - (set! (-> a0-27 frame-interp 0) f30-0) - (set! (-> a0-27 param 0) 0.0) - (joint-control-channel-group-eval! a0-27 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) ) ) @@ -1297,16 +1291,16 @@ (none) ) -(defmethod relocate ((this spyder) (arg0 int)) +(defmethod relocate ((this spyder) (offset int)) (if (nonzero? (-> this joint)) - (&+! (-> this joint) arg0) + (&+! (-> this joint) offset) ) (dotimes (v1-4 4) (if (nonzero? (-> this joint-ik v1-4)) - (&+! (-> this joint-ik v1-4) arg0) + (&+! (-> this joint-ik v1-4) offset) ) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod init-enemy! ((this spyder)) diff --git a/goal_src/jak2/levels/drill/drill-obs.gc b/goal_src/jak2/levels/drill/drill-obs.gc index d1befd03437..dc82db3f8f6 100644 --- a/goal_src/jak2/levels/drill/drill-obs.gc +++ b/goal_src/jak2/levels/drill/drill-obs.gc @@ -342,11 +342,8 @@ This commonly includes things such as: (until #f (let ((f30-0 (- (-> self extent 1 y) (-> self extent 0 y)))) (when (!= f30-0 (-> self length)) - (let ((f0-3 (* 0.000010172526 f30-0)) - (a0-0 (-> self skel root-channel 0)) - ) - (set! (-> a0-0 frame-num) f0-3) - (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-identity) + (let ((f0-3 (* 0.000010172526 f30-0))) + (ja :num! (identity f0-3)) ) (transform-post) (set! (-> self length) f30-0) @@ -449,6 +446,7 @@ This commonly includes things such as: ) (defmethod deactivate ((this drill-elevator)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this sound-id)) (call-parent-method this) (none) @@ -586,6 +584,7 @@ do so. ) (defmethod deactivate ((this drill-mech-elevator)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (nonzero? (-> this running-sound-id)) (sound-stop (-> this running-sound-id)) ) @@ -793,14 +792,15 @@ For example for an elevator pre-compute the distance between the first and last (none) ) -(defmethod relocate ((this fire-floor) (arg0 int)) +(defmethod relocate ((this fire-floor) (offset int)) (if (nonzero? (-> this part-off)) - (&+! (-> this part-off) arg0) + (&+! (-> this part-off) offset) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) (defmethod deactivate ((this fire-floor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this sound-id)) (if (nonzero? (-> this part-off)) (kill-and-free-particles (-> this part-off)) @@ -990,14 +990,15 @@ This commonly includes things such as: ) ;; WARN: Return type mismatch basebutton vs drill-switch. -(defmethod relocate ((this drill-switch) (arg0 int)) +(defmethod relocate ((this drill-switch) (offset int)) (if (nonzero? (-> this green-part)) - (&+! (-> this green-part) arg0) + (&+! (-> this green-part) offset) ) - (the-as drill-switch ((method-of-type basebutton relocate) this arg0)) + (the-as drill-switch ((method-of-type basebutton relocate) this offset)) ) (defmethod deactivate ((this drill-switch)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (nonzero? (-> this green-part)) (kill-and-free-particles (-> this green-part)) ) @@ -1348,6 +1349,7 @@ This commonly includes things such as: (defmethod deactivate ((this drill-laser)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this hit-sound-id)) ((method-of-type process-drawable deactivate) this) (none) diff --git a/goal_src/jak2/levels/forest/wren.gc b/goal_src/jak2/levels/forest/wren.gc index 24d287ac0c4..72a5a000b66 100644 --- a/goal_src/jak2/levels/forest/wren.gc +++ b/goal_src/jak2/levels/forest/wren.gc @@ -324,11 +324,7 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" ) (set! (-> v1-59 frame-group) (the-as art-joint-anim wren-glide-ja)) ) - (let ((v1-62 (-> self skel root-channel 1))) - (set! (-> v1-62 frame-interp 1) f30-1) - (set! (-> v1-62 frame-interp 0) f30-1) - (set! (-> v1-62 frame-group) (the-as art-joint-anim wren-fly-ja)) - ) + (ja :chan 1 :group! wren-fly-ja :frame-interp0 f30-1 :frame-interp1 f30-1) (let ((f30-2 (lerp 0.6 2.4 f30-1))) (ja :num! (loop! f30-2)) (ja :chan 1 :num! (loop! f30-2)) @@ -427,15 +423,15 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" ) ) -(defmethod relocate ((this wren) (arg0 int)) +(defmethod relocate ((this wren) (offset int)) (dotimes (v1-0 2) (when (-> this fly-curve v1-0) (if (nonzero? (-> this fly-curve v1-0)) - (&+! (-> this fly-curve v1-0) arg0) + (&+! (-> this fly-curve v1-0) offset) ) ) ) - (call-parent-method this arg0) + (call-parent-method this offset) ) ;; WARN: Return type mismatch object vs none. diff --git a/goal_src/jak2/levels/nest/boss/metalkor-states.gc b/goal_src/jak2/levels/nest/boss/metalkor-states.gc index a0dfb8616ea..062658fc749 100644 --- a/goal_src/jak2/levels/nest/boss/metalkor-states.gc +++ b/goal_src/jak2/levels/nest/boss/metalkor-states.gc @@ -295,6 +295,7 @@ ) (defmethod deactivate ((this metalkor)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (-> this wing-sound-playing) (sound-stop (-> this wing-sound)) ) @@ -303,14 +304,14 @@ ) ;; WARN: Return type mismatch process-focusable vs metalkor. -(defmethod relocate ((this metalkor) (arg0 int)) +(defmethod relocate ((this metalkor) (offset int)) (if (nonzero? (-> this shot-anticipate)) - (&+! (-> this shot-anticipate) arg0) + (&+! (-> this shot-anticipate) offset) ) (if (nonzero? (-> this neck)) - (&+! (-> this neck) arg0) + (&+! (-> this neck) offset) ) - (the-as metalkor ((method-of-type process-focusable relocate) this arg0)) + (the-as metalkor ((method-of-type process-focusable relocate) this offset)) ) (defmethod get-trans ((this metalkor) (arg0 int)) @@ -514,10 +515,7 @@ ) ) ) - (let ((v1-24 (-> self skel root-channel 1))) - (set! (-> v1-24 frame-interp 1) f30-2) - (set! (-> v1-24 frame-interp 0) f30-2) - ) + (ja :chan 1 :frame-interp0 f30-2 :frame-interp1 f30-2) ) ) (none) diff --git a/goal_src/jak2/levels/stadium/stadium-obs.gc b/goal_src/jak2/levels/stadium/stadium-obs.gc index 1b315e171a4..cb706754c34 100644 --- a/goal_src/jak2/levels/stadium/stadium-obs.gc +++ b/goal_src/jak2/levels/stadium/stadium-obs.gc @@ -992,6 +992,7 @@ This commonly includes things such as: ) (defmethod deactivate ((this rift-rider)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (sound-stop (-> this sound-id)) (call-parent-method this) (none) @@ -1935,6 +1936,7 @@ This commonly includes things such as: ) (defmethod deactivate ((this stad-samos)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." (if (valid? (-> this hud) (the-as type #f) "" #t 0) (send-event (handle->process (-> this hud)) 'hide-and-die) ) @@ -2115,12 +2117,7 @@ This commonly includes things such as: ) ) ) - (let ((a0-10 (-> self skel root-channel 0))) - (set! (-> a0-10 frame-interp 1) f28-0) - (set! (-> a0-10 frame-interp 0) f28-0) - (set! (-> a0-10 param 0) f30-0) - (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-loop!) - ) + (ja :num! (loop! f30-0) :frame-interp0 f28-0 :frame-interp1 f28-0) (let ((a0-11 (-> self skel root-channel 1))) (let ((f0-9 (- 1.0 f28-0))) (set! (-> a0-11 frame-interp 1) f0-9) @@ -2522,6 +2519,7 @@ This commonly includes things such as: ) (defmethod run-logic? ((this stad-force-field)) + "Should this process be run? Checked by execute-process-tree." #t ) diff --git a/goal_src/jak2/levels/tomb/monster-frog.gc b/goal_src/jak2/levels/tomb/monster-frog.gc index 06f88b1d663..265bea29159 100644 --- a/goal_src/jak2/levels/tomb/monster-frog.gc +++ b/goal_src/jak2/levels/tomb/monster-frog.gc @@ -533,43 +533,31 @@ 0 (ja-channel-push! 2 (seconds 0.01)) (ja-no-eval :group! monster-frog-hop-small-start-ja :num! (seek! max f28-1) :frame-num 0.0) - (let ((a0-15 (-> self skel root-channel 1))) - (set! (-> a0-15 frame-interp 1) f30-1) - (set! (-> a0-15 frame-interp 0) f30-1) - (set! (-> a0-15 frame-group) (the-as art-joint-anim monster-frog-hop-slow-start-ja)) - (set! (-> a0-15 param 0) 0.0) - (set! (-> a0-15 frame-num) 0.0) - (joint-control-channel-group! a0-15 (the-as art-joint-anim monster-frog-hop-slow-start-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! monster-frog-hop-slow-start-ja + :num! (chan 0) + :frame-interp0 f30-1 + :frame-interp1 f30-1 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (ja :num! (seek! max f28-1)) - (let ((a0-17 (-> self skel root-channel 1))) - (set! (-> a0-17 frame-interp 1) f30-1) - (set! (-> a0-17 frame-interp 0) f30-1) - (set! (-> a0-17 param 0) 0.0) - (joint-control-channel-group-eval! a0-17 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-1 :frame-interp1 f30-1) ) (nav-enemy-method-167 self) (ja-no-eval :group! monster-frog-hop-small-end-ja :num! (seek! max f28-1) :frame-num 0.0) - (let ((a0-21 (-> self skel root-channel 1))) - (set! (-> a0-21 frame-interp 1) f30-1) - (set! (-> a0-21 frame-interp 0) f30-1) - (set! (-> a0-21 frame-group) (the-as art-joint-anim monster-frog-hop-slow-end-ja)) - (set! (-> a0-21 param 0) 0.0) - (set! (-> a0-21 frame-num) 0.0) - (joint-control-channel-group! a0-21 (the-as art-joint-anim monster-frog-hop-slow-end-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! monster-frog-hop-slow-end-ja + :num! (chan 0) + :frame-interp0 f30-1 + :frame-interp1 f30-1 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (ja :num! (seek! max f28-1)) - (let ((a0-23 (-> self skel root-channel 1))) - (set! (-> a0-23 frame-interp 1) f30-1) - (set! (-> a0-23 frame-interp 0) f30-1) - (set! (-> a0-23 param 0) 0.0) - (joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-1 :frame-interp1 f30-1) ) ) ) diff --git a/goal_src/jak2/levels/tomb/target-indax.gc b/goal_src/jak2/levels/tomb/target-indax.gc index 38ab5d7cdf4..2ca4d0d2d2a 100644 --- a/goal_src/jak2/levels/tomb/target-indax.gc +++ b/goal_src/jak2/levels/tomb/target-indax.gc @@ -680,10 +680,7 @@ ) (set! f30-0 (seek f30-0 f26-1 (* 4.0 (seconds-per-frame)))) ) - (let ((v1-94 (-> self skel root-channel 1))) - (set! (-> v1-94 frame-interp 1) f28-0) - (set! (-> v1-94 frame-interp 0) f28-0) - ) + (ja :chan 1 :frame-interp0 f28-0 :frame-interp1 f28-0) (let ((v1-98 (-> self skel root-channel 2)) (f0-23 (- 1.0 f30-0)) ) diff --git a/goal_src/jak3/engine/ai/enemy-h.gc b/goal_src/jak3/engine/ai/enemy-h.gc index bb711d1ac34..17d3f8bfdee 100644 --- a/goal_src/jak3/engine/ai/enemy-h.gc +++ b/goal_src/jak3/engine/ai/enemy-h.gc @@ -5,5 +5,456 @@ ;; name in dgo: enemy-h ;; dgos: GAME +;; +++enemy-aware +(defenum enemy-aware + :type uint64 + (ea0 0) + (ea1 1) + (ea2 2) + (ea3 3) + (ea4 4) + ) +;; ---enemy-aware + + +;; +++enemy-flag +(defenum enemy-flag + :type uint64 + :bitfield #t + (look-at-focus 0) + (look-at-move-dest 1) + (vulnerable 2) + (vulnerable-backup 3) + (dangerous-backup 4) + (notice 5) + (alert 6) + (auto-reset-penetrate 7) + (victory 8) + (cam-attack-mode 9) + (use-notice-distance 10) + (attackable 11) + (attackable-backup 12) + (actor-pause-backup 13) + (enable-on-notice 14) + (enable-on-active 15) + (enable-on-hostile 16) + (dislike-combo 17) + (directed 18) + (directed-ready 19) + (chase-startup 20) + (lock-focus 21) + (multi-focus 22) + (use-trigger 23) + (trackable 24) + (trackable-backup 25) + (spawn-gem 26) + (check-water 27) + (check-water-backup 28) + (checking-water 29) + (drawn-mirrored 30) + (called-dying 31) + (no-initial-move-to-ground 32) + (jump-check-blocked 33) + (death-start 34) + (auto-death-phase-out 35) + (has-gem 36) + ) +;; ---enemy-flag + + +;; +++enemy-jump-flags +(defenum enemy-jump-flags + :bitfield #t + :type uint8 + (ejf0 0) + (ejf1 1) + (ejf2 2) + (ejf3 3) + (ejf4 4) + (ejf5 5) + (ejf6 6) + (ejf7 7) + ) +;; ---enemy-jump-flags + + +(declare-type enemy process-focusable) +(define-extern *shockwave-knock-scalar* curve2d-fast) + ;; DECOMP BEGINS +(deftype enemy-focus (focus) + ((aware enemy-aware) + (flags enemy-flag) + ) + (:methods + (try-update-focus (_type_ process-focusable enemy) symbol :replace) + (enemy-focus-method-13 (_type_ process-focusable enemy-aware) symbol) + ) + ) + + +(deftype enemy-info (basic) + ((fact-defaults fact-info-enemy-defaults) + (use-die-falling symbol) + (use-victory symbol) + (use-jump-blocked symbol) + (debug-draw-neck symbol) + (jump-debug-draw symbol) + (move-to-ground symbol) + (hover-if-no-ground symbol) + (idle-anim-script (inline-array idle-control-frame)) + (idle-anim int32) + (notice-anim int32) + (hostile-anim int32) + (hit-anim int32) + (knocked-anim int32) + (knocked-land-anim int32) + (die-anim int32) + (die-falling-anim int32) + (victory-anim int32) + (jump-wind-up-anim int32) + (jump-in-air-anim int32) + (jump-land-anim int32) + (neck-joint int32) + (look-at-joint int32) + (bullseye-joint int32) + (sound-hit sound-name) + (sound-die sound-name) + (notice-distance meters) + (notice-distance-delta meters) + (proximity-notice-distance meters) + (default-hit-points float) + (gnd-collide-with collide-spec) + (overlaps-others-collide-with-filter collide-spec) + (penetrate-flinch penetrate) + (penetrate-knocked penetrate) + (movement-gravity meters) + (friction float) + (slip-factor float) + (attack-shove-back meters) + (attack-shove-up meters) + (attack-mode symbol) + (attack-damage int32) + (recover-gnd-collide-with collide-spec) + (knocked-can-land-timeout time-frame) + (knocked-recover-timeout time-frame) + (ragdoll-blend-out-time time-frame) + (ragdoll-rotate-velocity-mult float) + (jump-height-min meters) + (jump-height-factor float) + (knocked-seek-ry-clamp float) + (knocked-soft-vxz-lo float) + (knocked-soft-vxz-hi float) + (knocked-soft-vy-lo float) + (knocked-soft-vy-hi float) + (knocked-medium-vxz-lo float) + (knocked-medium-vxz-hi float) + (knocked-medium-vy-lo float) + (knocked-medium-vy-hi float) + (knocked-hard-vxz-lo float) + (knocked-hard-vxz-hi float) + (knocked-hard-vy-lo float) + (knocked-hard-vy-hi float) + (knocked-huge-vxz-lo float) + (knocked-huge-vxz-hi float) + (knocked-huge-vy-lo float) + (knocked-huge-vy-hi float) + (knocked-yellow-vxz-lo float) + (knocked-yellow-vxz-hi float) + (knocked-yellow-vy-lo float) + (knocked-yellow-vy-hi float) + (knocked-red-vxz-lo float) + (knocked-red-vxz-hi float) + (knocked-red-vy-lo float) + (knocked-red-vy-hi float) + (knocked-blue-vxz-lo float) + (knocked-blue-vxz-hi float) + (knocked-blue-vy-lo float) + (knocked-blue-vy-hi float) + (ragdoll-info ragdoll-setup) + (shadow-size meters) + (shadow-max-y meters) + (shadow-min-y meters) + (shadow-locus-dist meters) + (gem-joint int32) + (gem-seg uint32) + (gem-no-seg uint32) + (gem-offset sphere :inline) + (knocked-off basic) + ) + (:methods + (copy-enemy-info! (_type_ _type_) none) + ) + ) + + +(deftype enemy-knocked-info (structure) + ((anim-speed float) + (on-surface-count int32) + (move-count int32) + (land-can-land-time time-frame) + ) + ) + + +(deftype enemy-jump-info (structure) + ((flags enemy-jump-flags) + (anim-speed float) + (hang-time time-frame) + (start-pos vector :inline) + (dest-pos vector :inline) + (traj trajectory :inline) + ) + ) + + +(deftype enemy-init-by-other-params (structure) + ((trans vector :inline) + (quat quaternion :inline) + (entity entity) + (directed? symbol) + (no-initial-move-to-ground? symbol) + (art-level level) + ) + ) + + +(deftype enemy-attack-info (structure) + ((attack-id uint32) + (knocked-type knocked-type) + (blue-juggle-count uint8) + (attacker-handle handle) + (attack-time time-frame) + (penetrate-using penetrate) + (attacker-pos vector :inline) + (attack-direction vector :inline) + (attack-position vector :inline) + (intensity float) + ) + ) + + +(deftype enemy-best-focus (structure) + ((proc process) + (rating float) + (aware enemy-aware) + ) + ) + + +(deftype enemy (process-focusable) + ((fact fact-info-enemy :override) + (root collide-shape-moving :override) + (enemy-flags enemy-flag) + (enemy-info enemy-info) + (hit-points float) + (gnd-collide-with collide-spec) + (attack-id uint32) + (persistent-attack-id uint32) + (water-max-height float) + (water-surface-height float) + (desired-angle degrees) + (jump-why uint64) + (penetrated-by-all penetrate) + (penetrate-flinch penetrate) + (penetrate-knocked penetrate) + (ragdoll-proc handle) + (reaction-time time-frame) + (notice-time time-frame) + (state-timeout time-frame) + (auto-reset-penetrate-time time-frame) + (hit-focus-time time-frame) + (last-draw-time time-frame) + (starting-time time-frame) + (fated-time time-frame) + (focus-pos vector :inline) + (event-param-point vector :inline) + (jump-dest vector :inline :overlay-at event-param-point) + (focus enemy-focus :inline) + (incoming enemy-attack-info :inline) + (actor-group (pointer actor-group)) + (actor-group-count int32) + (neck joint-mod) + (on-notice pair) + (on-active pair) + (on-hostile pair) + (on-death pair) + (idle-anim-player idle-control :inline) + (rand-gen symbol) + ) + (:state-methods + dormant + dormant-aware + hit + knocked + knocked-recover + idle + active + notice + flee + stare + hostile + victory + die + die-falling + die-fast + directed + jump + jump-blocked + ambush-delay + ambush + view-anims + gun-dark-2-stretch + ) + (:methods + (enemy-method-50 (_type_ int) none) + (accelerate-fall! (_type_ vector) float) + (damage-enemy! (_type_ object event-message-block) float) + (reset-penetrate! (_type_) none) + (get-knockback-dir! (_type_ vector) vector) + (get-knockback-angle (_type_) degrees) + (knocked-handler (_type_ vector) object) + (can-collide-with-focus? (_type_ process-focusable) object) + (check-water (_type_) object) + (enemy-common-post (_type_) none) + (lerp-damage (_type_ float) float) + (scale-impact-vel-y! (_type_ vector vector float) vector) + (get-damage-from-attack (_type_ object event-message-block) float) + (enemy-method-63 (_type_ float) float) + (update-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) + (penetrate->next-state (_type_) symbol) + (get-penetrated-by (_type_) penetrate) + (coin-flip? (_type_) symbol) + (get-enemy-aware (_type_ enemy-aware) enemy-aware) + (enemy-method-69 (_type_) none) + (enemy-method-70 (_type_ process-focusable enemy-aware) none) + (go-dormant (_type_) object) + (go-dormant-aware (_type_) object) + (go-idle (_type_) object) + (go-ambush-delay (_type_) object) + (go-stare (_type_) object) + (go-stare2 (_type_) object) + (go-directed (_type_) object) + (go-hostile (_type_) object) + (go-flee (_type_) object) + (go-best-state (_type_) object) + (go-die (_type_) object) + (event-handler (_type_ process int symbol event-message-block) object :behavior enemy) + (enemy-touch-handler (_type_ process event-message-block) none) + (send-attack-on-jump-or-knocked (_type_ process event-message-block) none) + (knocked-anim (_type_ enemy-knocked-info) symbol) + (knocked-land-anim (_type_ enemy-knocked-info) symbol) + (knocked-anim-handler (_type_ int enemy-knocked-info) symbol) + (enemy-method-88 (_type_ enemy-knocked-info) symbol) + (within-gspot-range? (_type_) symbol) + (enemy-method-90 (_type_ ragdoll-proc) none) + (enemy-method-91 (_type_) symbol) + (init-jump-info! (_type_ enemy-jump-info) none) + (setup-jump! (_type_ enemy-jump-info) none) + (move-to-gspot! (_type_) float) + (on-ground? (_type_) symbol) + (jump-in-air-anim (_type_ enemy-jump-info) symbol) + (jump-land-anim (_type_ enemy-jump-info) symbol) + (jump-wind-up-anim (_type_ enemy-jump-info) symbol) + (jump-anim-handler (_type_ int enemy-jump-info) symbol) + (in-jump-handler (_type_ int enemy-jump-info) none) + (enemy-method-101 (_type_) none) + (go-directed2 (_type_) object) + (enemy-method-103 (_type_ vector float) symbol) + (enemy-method-104 (_type_ vector float) symbol) + (enemy-method-105 (_type_ float symbol) symbol) + (find-best-focus (_type_) process) + (enemy-method-107 (_type_) symbol) + (enemy-method-108 (_type_) symbol) + (enemy-method-109 (_type_) symbol) + (send-attack (_type_ process touching-shapes-entry uint) symbol) + (on-attack (_type_ process-focusable) none) + (get-incoming-attack! (_type_ process-drawable event-message-block penetrate attack-info touching-shapes-entry) none) + (get-focus! (_type_) process-focusable) + (send-attack-to-all-tshapes (_type_ process-focusable event-message-block) int) + (set-look-at-mode! (_type_ int) none) + (stop-look-at! (_type_) none) + (apply-friction (_type_) none) + (init-enemy-info! (_type_ enemy-info) none) + (init-enemy-defaults! (_type_ enemy-info) none) + (init-enemy-collision! (_type_) none) + (init-enemy! (_type_) none) + (go-idle2 (_type_) object) + (enemy-method-123 (_type_) symbol) + (disable-ragdoll (_type_) none) + (ragdoll-settled? (_type_) object) + (ragdoll-spawn! (_type_ symbol symbol) vector) + (deactivate-ragdoll! (_type_) none) + (rnd-float (_type_) float) + (rnd-float-range (_type_ float float) float) + (rnd-int (_type_ int) int) + (enemy-method-131 (_type_ int int) int) + (set-reaction-time! (_type_ time-frame time-frame) time-frame) + (rnd-chance? (_type_ float) symbol) + (enemy-method-134 (_type_ float) symbol) + (enemy-method-135 (_type_) none) + (set-ground-pat! (_type_ collide-query collide-spec float float float) pat-surface) + (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) + (try-locate-ground (_type_ meters meters symbol collide-spec) symbol) + (move-above-ground! (_type_ vector move-above-ground-params) none) + (update-focus (_type_) process) + (enemy-method-141 (_type_ float) symbol) + (penetrate->knocked-type (_type_ penetrate) knocked-type) + (on-dying (_type_) none) + (falling? (_type_) symbol) + (find-offending-pfoc (_type_ process attack-info) process-focusable) + (play-damage-sound (_type_ int) sound-id) + (check-victory (_type_) none) + (go-gun-dark-2-stretch (_type_) object) + (have-less-than-10-joints? (_type_) object) + (enemy-method-150 (_type_) symbol) + (should-move-to-ground? (_type_) symbol) + (enemy-method-152 (_type_) float) + (get-gem-pool-idx (_type_) int) + (mark-as-dead (_type_) none) + ) + ) + + +(deftype anim-info (structure) + ((anim-index int32) + (travel-speed meters) + ) + ) + + +(defmethod try-update-focus ((this enemy-focus) (arg0 process-focusable) (arg1 enemy)) + (let* ((t9-0 (method-of-type focus try-update-focus)) + (s3-0 (t9-0 this arg0)) + ) + (when (not s3-0) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + (set! (-> this aware) (get-enemy-aware arg1 (update-awareness! arg1 arg0 (the-as enemy-best-focus #f)))) + ) + s3-0 + ) + ) + +(defmethod enemy-focus-method-13 ((this enemy-focus) (arg0 process-focusable) (arg1 enemy-aware)) + (let* ((t9-0 (method-of-type focus try-update-focus)) + (v0-0 (t9-0 this arg0)) + ) + (set! (-> this aware) arg1) + (if (not v0-0) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + ) + v0-0 + ) + ) + +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod clear-focused ((this enemy-focus)) + "Reset the focus' handle." + (let ((t9-0 (method-of-type focus clear-focused))) + (t9-0 this) + ) + (set! (-> this aware) (enemy-aware ea0)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + (none) + ) diff --git a/goal_src/jak3/engine/ai/enemy.gc b/goal_src/jak3/engine/ai/enemy.gc index 17de2eebbc5..9b7ed3641b5 100644 --- a/goal_src/jak3/engine/ai/enemy.gc +++ b/goal_src/jak3/engine/ai/enemy.gc @@ -7,3 +7,2999 @@ ;; DECOMP BEGINS +(defmethod copy-enemy-info! ((this enemy-info) (arg0 enemy-info)) + (mem-copy! (&-> this type) (&-> arg0 type) 420) + 0 + (none) + ) + +(define *enemy-dummy-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #x28)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 4096.0) + :top-plane (new 'static 'plane :y 1.0 :w -4096.0) + ) + ) + ) + +(defmethod relocate ((this enemy) (offset int)) + (if (nonzero? (-> this neck)) + (&+! (-> this neck) offset) + ) + (call-parent-method this offset) + ) + +(defmethod rnd-float ((this enemy)) + (rand-vu) + ) + +(defmethod rnd-float-range ((this enemy) (arg0 float) (arg1 float)) + (+ arg0 (* (rand-vu) (- arg1 arg0))) + ) + +(defmethod rnd-int ((this enemy) (arg0 int)) + (the int (* (rand-vu) (the float arg0))) + ) + +(defmethod set-reaction-time! ((this enemy) (arg0 time-frame) (arg1 time-frame)) + (+ arg0 (the int (* (rand-vu) (the float (+ (- 1 arg0) arg1))))) + ) + +(defmethod rnd-chance? ((this enemy) (arg0 float)) + (>= arg0 (rand-vu)) + ) + +;; WARN: new jak 2 until loop case, check carefully +(defmethod enemy-method-131 ((this enemy) (arg0 int) (arg1 int)) + (let ((v1-0 0) + (s5-0 0) + ) + (let ((a2-1 1)) + (while (nonzero? arg0) + (+! arg0 -1) + (if (not (logtest? arg1 a2-1)) + (+! v1-0 1) + ) + (set! a2-1 (* a2-1 2)) + ) + ) + (when (> v1-0 0) + (let ((v1-1 (rnd-int this v1-0)) + (a0-1 1) + ) + (until #f + (while (logtest? arg1 a0-1) + (nop!) + (nop!) + (+! s5-0 1) + (set! a0-1 (* a0-1 2)) + ) + (if (zero? v1-1) + (goto cfg-14) + ) + (+! v1-1 -1) + (+! s5-0 1) + (set! a0-1 (* a0-1 2)) + ) + ) + #f + ) + (label cfg-14) + s5-0 + ) + ) + +(defmethod enemy-method-134 ((this enemy) (arg0 float)) + (let* ((v1-5 (-> *display* frames (-> *display* last-screen) run-time)) + (f1-2 (fmax 0.0 (fmin 1.0 (* 0.001 (+ -7000.0 (the float v1-5)))))) + ) + (>= (+ arg0 (* f1-2 (- 1.0 arg0))) (rand-vu)) + ) + ) + +(defmethod coin-flip? ((this enemy)) + (zero? (rnd-int this 2)) + ) + +;; WARN: disable def twice: 40. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod run-logic? ((this enemy)) + "Should this process be run? Checked by execute-process-tree." + (cond + ((logtest? (-> this mask) (process-mask actor-pause)) + (let ((gp-0 (-> this draw))) + (or (and (nonzero? gp-0) + (>= (+ (-> *ACTOR-bank* pause-dist) (-> this root pause-adjust-distance)) + (vector-vector-distance (-> this root trans) (camera-pos)) + ) + (or (logtest? (-> gp-0 status) (draw-control-status on-screen)) + (not (and (-> this next-state) (= (-> this next-state name) 'idle))) + ) + ) + (and (nonzero? (-> this skel)) (!= (-> this skel root-channel 0) (-> this skel channel))) + (and (nonzero? gp-0) (logtest? (-> gp-0 status) (draw-control-status uninited))) + ) + ) + ) + (else + #t + ) + ) + ) + +(defmethod can-collide-with-focus? ((this enemy) (arg0 process-focusable)) + (and arg0 (!= this arg0) (collide-spec-match? (-> this focus) arg0)) + ) + +;; WARN: Return type mismatch int vs search-info-flag. +(defmethod process-mask->search-info-flag ((this enemy)) + (let ((v1-0 (-> this enemy-flags)) + (v0-0 0) + ) + (when (and (!= (-> this hit-points) 0.0) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (logtest? (enemy-flag trackable) (-> this enemy-flags)) + ) + (if (logtest? (process-mask enemy) (-> this mask)) + (set! v0-0 (logior v0-0 16)) + ) + (if (logtest? v1-0 (enemy-flag attackable)) + (set! v0-0 (logior v0-0 8)) + ) + ) + (the-as search-info-flag v0-0) + ) + ) + +(defmethod get-trans ((this enemy) (arg0 int)) + "Get the `trans` for this process." + (let ((s4-0 (-> this root))) + (cond + ((zero? arg0) + (-> s4-0 trans) + ) + ((and (= arg0 1) (type? s4-0 collide-shape-moving)) + (-> s4-0 gspot-pos) + ) + ((= arg0 2) + (vector<-cspace! (new 'static 'vector) (-> this node-list data (-> this enemy-info look-at-joint))) + ) + ((= arg0 3) + (let ((v0-0 (vector<-cspace! (new 'static 'vector) (-> this node-list data (-> this enemy-info bullseye-joint))))) + (set! (-> v0-0 w) (-> this root root-prim prim-core world-sphere w)) + v0-0 + ) + ) + (else + ((method-of-type process-focusable get-trans) this arg0) + ) + ) + ) + ) + +(defmethod get-penetrated-by ((this enemy)) + (penetrated-by-all&hit-points->penetrated-by (-> this penetrated-by-all) (the int (-> this hit-points))) + ) + +;; WARN: Return type mismatch float vs meters. +(defmethod get-water-height ((this enemy)) + (the-as meters (-> this water-surface-height)) + ) + +;; WARN: Return type mismatch enemy-flag vs object. +(defmethod check-water ((this enemy)) + (let ((s4-0 (-> this root))) + (when (>= (-> this water-max-height) (-> s4-0 trans y)) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! s4-0 s5-0 (collide-action solid semi-solid)) + (let ((s3-0 (-> s5-0 flags))) + (when (logtest? (water-flag touch-water) s3-0) + (set! (-> this water-surface-height) (-> s5-0 trans y)) + (when (not (focus-test? this touch-water under-water)) + (let ((v1-9 (new 'stack-no-clear 'vector))) + (set! (-> v1-9 quad) (-> this root trans quad)) + (set! (-> v1-9 y) (+ 409.6 (-> s5-0 trans y))) + (cond + ((logtest? (-> *part-group-id-table* 192 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-9 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 192)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-9 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 192)) + ) + ) + ) + (cond + ((logtest? s3-0 (water-flag dark-eco)) + (sound-play "eco-splash") + (send-event this 'instant-death) + ) + (else + (play-damage-sound this 2) + ) + ) + ) + (logior! (-> this focus-status) (focus-status touch-water)) + (let* ((v1-46 (-> s4-0 root-prim prim-core)) + (f0-6 (+ (-> v1-46 world-sphere y) (-> v1-46 world-sphere w))) + ) + (if (focus-test? this under-water) + (set! f0-6 (+ -819.2 f0-6)) + ) + (if (< f0-6 (-> s5-0 trans y)) + (logior! (-> this focus-status) (focus-status under-water)) + (logclear! (-> this focus-status) (focus-status under-water)) + ) + ) + (return (the-as object #f)) + ) + ) + ) + ) + ) + (logclear! (-> this focus-status) (focus-status touch-water under-water)) + (let ((v0-11 (logclear (-> this enemy-flags) (enemy-flag checking-water)))) + (set! (-> this enemy-flags) v0-11) + v0-11 + ) + ) + +(defmethod enemy-common-post ((this enemy)) + (if (and (nonzero? (-> this draw)) (logtest? (-> this draw status) (draw-control-status on-screen))) + (set-time! (-> this last-draw-time)) + ) + (update-focus this) + (when *target* + (if *target* + (look-at! + (-> *target* neck) + (the-as vector (-> this root root-prim prim-core)) + (if (logtest? (-> this enemy-flags) (enemy-flag cam-attack-mode)) + 'attacking + ) + this + ) + ) + ) + (when (nonzero? (-> this neck)) + (when (logtest? (-> this enemy-flags) (enemy-flag look-at-focus)) + (let ((a0-7 (handle->process (-> this focus handle)))) + (if a0-7 + (target-set! (-> this neck) (get-trans (the-as process-focusable a0-7) 2)) + ) + ) + ) + ) + (when (and (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (time-elapsed? (-> this auto-reset-penetrate-time) (seconds 0.1)) + ) + (logclear! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (let ((v1-43 0)) + (if (logtest? (penetrate knocked) (-> this root penetrate-using)) + (set! v1-43 (logior (shl 2 32) v1-43)) + ) + (set! (-> this root penetrate-using) (the-as penetrate v1-43)) + ) + ) + (if (logtest? (-> this enemy-flags) (enemy-flag victory)) + (check-victory this) + ) + (if (logtest? (enemy-flag check-water checking-water) (-> this enemy-flags)) + (check-water this) + ) + (if (and *debug-segment* (-> this enemy-info debug-draw-neck) (nonzero? (-> this neck))) + (joint-mod-debug-draw (-> this neck)) + ) + (ja-post) + 0 + (none) + ) + +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod check-victory ((this enemy)) + (if (or (time-elapsed? (-> this hit-focus-time) (seconds 2)) + (and (handle->process (-> this focus handle)) + (not (logtest? (-> (the-as process-focusable (handle->process (-> this focus handle))) focus-status) + (focus-status disable dead ignore grabbed) + ) + ) + ) + ) + (logclear! (-> this enemy-flags) (enemy-flag victory)) + ) + (none) + ) + +;; WARN: Return type mismatch int vs penetrate. +(defun get-penetrate-using-from-attack-event ((arg0 process-drawable) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (if (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-0) mask)) + (return (the-as penetrate (-> (the-as attack-info v1-0) penetrate-using))) + ) + ) + (let* ((gp-0 arg0) + (v1-3 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when v1-3 + (let* ((gp-1 (-> v1-3 root)) + (v1-4 (if (type? gp-1 collide-shape) + gp-1 + ) + ) + ) + (if v1-4 + (return + (the-as penetrate (logior (-> (the-as collide-shape v1-4) penetrate-using) (penetrate generic-attack))) + ) + ) + ) + ) + ) + (the-as penetrate 2) + ) + +;; WARN: Return type mismatch process vs process-focusable. +(defmethod get-focus! ((this enemy)) + (let ((v0-0 (handle->process (-> this focus handle)))) + (if (and v0-0 + (not (and v0-0 + (not (logtest? (-> (the-as process-focusable v0-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + ) + ) + (set! v0-0 (the-as process #f)) + ) + (the-as process-focusable v0-0) + ) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod enemy-method-70 ((this enemy) (arg0 process-focusable) (arg1 enemy-aware)) + (if arg1 + (enemy-focus-method-13 (-> this focus) arg0 arg1) + (try-update-focus (-> this focus) arg0 this) + ) + (none) + ) + +(defmethod enemy-method-69 ((this enemy)) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (let* ((s4-0 (handle->process (-> this incoming attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (can-collide-with-focus? this (the-as process-focusable s5-0)) + (enemy-method-70 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (logior! (-> this focus flags) (enemy-flag look-at-focus)) + ) + ) + ) + 0 + (none) + ) + +(defmethod send-attack-to-all-tshapes ((this enemy) (arg0 process-focusable) (arg1 event-message-block)) + (let ((s4-0 (the-as touching-shapes-entry (-> arg1 param 0)))) + (when (and s4-0 + (and (logtest? (-> this incoming penetrate-using) (penetrate board)) + (not (logtest? (-> this incoming penetrate-using) (penetrate spin))) + ) + (begin + (let ((s3-0 (-> s4-0 head))) + (while s3-0 + (let ((s2-0 (get-touched-prim s3-0 (-> arg0 root) s4-0))) + (get-touched-prim s3-0 (-> this root) s4-0) + (when (logtest? (-> s2-0 prim-core action) (collide-action solid semi-solid deadly)) + (let* ((a0-5 this) + (t9-2 (method-of-object a0-5 send-attack)) + (a1-3 arg0) + (a2-3 s4-0) + (v1-13 *game-info*) + (a3-1 (+ (-> v1-13 attack-id) 1)) + ) + (set! (-> v1-13 attack-id) a3-1) + (if (t9-2 a0-5 a1-3 a2-3 a3-1) + (return 0) + ) + ) + ) + ) + (set! s3-0 (-> s3-0 next)) + ) + ) + #f + ) + ) + ) + ) + 0 + ) + +(defmethod go-dormant ((this enemy)) + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> this draw status) (draw-control-status no-draw)) + (logior! (-> this focus-status) (focus-status disable)) + (go (method-of-object this dormant)) + ) + +(defmethod go-dormant-aware ((this enemy)) + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> this draw status) (draw-control-status no-draw)) + (logior! (-> this focus-status) (focus-status disable)) + (go (method-of-object this dormant-aware)) + ) + +(defmethod go-idle ((this enemy)) + (go (method-of-object this idle)) + ) + +(defmethod go-stare ((this enemy)) + (go (method-of-object this stare)) + ) + +(defmethod go-stare2 ((this enemy)) + (go (method-of-object this stare)) + ) + +(defmethod go-hostile ((this enemy)) + (go (method-of-object this hostile)) + ) + +(defmethod have-less-than-10-joints? ((this enemy)) + (and (nonzero? (-> this node-list)) (-> this node-list) (< 10 (-> this node-list length))) + ) + +(defmethod enemy-method-150 ((this enemy)) + #t + ) + +(defmethod go-gun-dark-2-stretch ((this enemy)) + (if (not (and (-> this next-state) (= (-> this next-state name) 'gun-dark-2-stretch))) + (go (method-of-object this gun-dark-2-stretch)) + ) + ) + +(defmethod go-ambush-delay ((this enemy)) + (if (< 0.0 (res-lump-float (-> this entity) 'ambush-delay)) + (go (method-of-object this ambush-delay)) + (go (method-of-object this ambush)) + ) + ) + +(defmethod go-flee ((this enemy)) + (go (method-of-object this flee)) + ) + +(defmethod go-directed ((this enemy)) + (go (method-of-object this directed)) + ) + +(defmethod go-best-state ((this enemy)) + (let ((s5-0 (-> this focus aware))) + (cond + ((and (= s5-0 (enemy-aware ea3)) (get-focus! this)) + (go-hostile this) + ) + ((<= (the-as int s5-0) 0) + (go-idle this) + ) + ((>= 1 (the-as int s5-0)) + (go (method-of-object this active)) + ) + ((= s5-0 (enemy-aware ea4)) + (go-flee this) + ) + (else + (go-stare this) + ) + ) + ) + ) + +(defmethod go-directed2 ((this enemy)) + (if (logtest? (enemy-flag directed) (-> this enemy-flags)) + (go-directed this) + (go-best-state this) + ) + ) + +(defmethod go-die ((this enemy)) + (if (-> this enemy-info use-die-falling) + (go (method-of-object this die-falling)) + (go (method-of-object this die)) + ) + ) + +(defmethod play-damage-sound ((this enemy) (arg0 int)) + (let ((name (static-sound-name ""))) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (set! name (-> this enemy-info sound-hit)) + ) + ((= v1-0 1) + (set! name (-> this enemy-info sound-die)) + ) + ((= v1-0 2) + (sound-play "splash") + ) + ) + ) + (if (nonzero? (the-as uint name)) + (sound-play-by-name (the-as sound-name name) (new-sound-id) 1024 0 0 (sound-group) #t) + ) + ) + ) + +(defmethod enemy-method-103 ((this enemy) (arg0 vector) (arg1 float)) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-0 quad) (-> arg0 quad)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (set! (-> s5-0 y) 0.0) + (vector-normalize! s5-0 1.0) + (>= (vector-dot s4-0 s5-0) (cos arg1)) + ) + ) + +(defmethod enemy-method-104 ((this enemy) (arg0 vector) (arg1 float)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this root trans)))) + (enemy-method-103 this v1-1 arg1) + ) + ) + +(defmethod enemy-method-105 ((this enemy) (arg0 float) (arg1 symbol)) + (let ((a0-2 (handle->process (-> this focus handle)))) + (cond + (a0-2 + (let ((s4-1 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-2) 0) (-> this root trans)) + ) + ) + (enemy-method-103 this s4-1 arg0) + ) + ) + (else + arg1 + ) + ) + ) + ) + +(defmethod send-attack ((this enemy) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) + (let ((a0-1 (-> this enemy-info attack-damage))) + (if (and (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) (= a0-1 1)) + (set! a0-1 2) + ) + (when (send-event + arg0 + 'attack + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id arg2) + (damage (the float a0-1)) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (-> this enemy-info attack-shove-back)) + (shove-up (-> this enemy-info attack-shove-up)) + (mode (-> this enemy-info attack-mode)) + (knock (if (-> this enemy-info knocked-off) + (knocked-type knocked-off) + (knocked-type none) + ) + ) + ) + ) + ) + (on-attack this (the-as process-focusable arg0)) + #t + ) + ) + ) + +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod on-attack ((this enemy) (arg0 process-focusable)) + (when (logtest? (process-mask target bot) (-> arg0 mask)) + (set! (-> this root penetrated-by) (the-as penetrate -1)) + (reset-penetrate! this) + ) + (let ((s5-0 (if (type? arg0 process-focusable) + arg0 + ) + ) + ) + (when (can-collide-with-focus? this s5-0) + (let ((v1-10 (handle->process (-> this focus handle)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag look-at-focus)))) + ) + ) + (enemy-method-70 this s5-0 (the-as enemy-aware #f)) + (set-time! (-> this hit-focus-time)) + (logior! (-> this enemy-flags) (enemy-flag victory)) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch time-frame vs none. +(defmethod reset-penetrate! ((this enemy)) + (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (set-time! (-> this auto-reset-penetrate-time)) + (none) + ) + +(defmethod get-knockback-dir! ((this enemy) (arg0 vector)) + (set! (-> arg0 quad) (-> this incoming attack-direction quad)) + (let ((v1-1 arg0)) + (when (= (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))) 0.0) + (vector-z-quaternion! arg0 (-> this root quat)) + (vector-negate-in-place! arg0) + ) + ) + (set! (-> arg0 y) 0.0) + (vector-xz-normalize! arg0 1.0) + ) + +;; WARN: Return type mismatch int vs knocked-type. +(defmethod penetrate->knocked-type ((this enemy) (arg0 penetrate)) + (the-as knocked-type (cond + ((logtest? arg0 (penetrate vehicle)) + 7 + ) + ((logtest? (penetrate jak-blue-shot) arg0) + 6 + ) + ((logtest? (penetrate jak-yellow-shot enemy-yellow-shot) arg0) + 4 + ) + ((logtest? (penetrate jak-red-shot) arg0) + 5 + ) + ((logtest? (penetrate dark-bomb dark-smack) arg0) + 3 + ) + ((logtest? (penetrate explode jak-dark-shot enemy-dark-shot) arg0) + 2 + ) + ((logtest? arg0 (penetrate mech-punch)) + 1 + ) + (else + 0 + ) + ) + ) + ) + +(defmethod get-incoming-attack! ((this enemy) + (arg0 process-drawable) + (arg1 event-message-block) + (arg2 penetrate) + (arg3 attack-info) + (arg4 touching-shapes-entry) + ) + (set! (-> this incoming penetrate-using) arg2) + (set! (-> this incoming attack-id) (-> arg3 id)) + (let ((v1-3 (if (logtest? (attack-mask knock) (-> arg3 mask)) + (-> arg3 knock) + (penetrate->knocked-type this arg2) + ) + ) + ) + (set! (-> this incoming knocked-type) v1-3) + (let ((a0-4 (current-time))) + (cond + ((!= v1-3 (knocked-type blue-shot)) + (set! (-> this incoming blue-juggle-count) (the-as uint 0)) + 0 + ) + ((time-elapsed? (-> this incoming attack-time) (seconds 1)) + (set! (-> this incoming blue-juggle-count) (the-as uint 1)) + ) + (else + (+! (-> this incoming blue-juggle-count) 1) + ) + ) + (set! (-> this incoming attack-time) a0-4) + ) + (cond + ((= v1-3 (knocked-type vehicle)) + (set! (-> this incoming attack-direction quad) (-> arg3 vector quad)) + ) + (else + (let ((s2-0 (new 'stack-no-clear 'attack-info))) + (attack-info-method-9 arg3 s2-0 arg0 this) + (set! (-> this incoming attacker-pos quad) (-> s2-0 intersection quad)) + (set! (-> this incoming attack-direction quad) (-> s2-0 attacker-velocity quad)) + ) + ) + ) + ) + (set! (-> this incoming intensity) (-> arg3 control)) + (set! (-> this incoming attacker-handle) (process->handle (find-offending-pfoc this arg0 arg3))) + (cond + (arg4 + (let ((a1-12 (-> arg4 head))) + (get-intersect-point (-> this incoming attack-position) a1-12 (-> this root) arg4) + ) + ) + (else + (vector-! (-> this incoming attack-position) (-> this root trans) (-> this incoming attack-direction)) + ) + ) + 0 + (none) + ) + +(defmethod set-look-at-mode! ((this enemy) (arg0 int)) + (case arg0 + ((1) + (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) + ) + ((2) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + ) + ) + (if (nonzero? (-> this neck)) + (mode-set! (-> this neck) (joint-mod-mode look-at)) + ) + 0 + (none) + ) + +(defmethod stop-look-at! ((this enemy)) + (when (nonzero? (-> this neck)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) + (shut-down (-> this neck)) + ) + 0 + (none) + ) + +(defmethod set-ground-pat! ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) + (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) + (let ((v0-1 (-> arg0 best-other-tri pat))) + (set! (-> this root ground-pat) v0-1) + v0-1 + ) + ) + ) + +(defmethod enemy-above-ground? ((this enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) + (above-ground? (-> this root) arg0 arg1 arg2 arg3 arg4 arg5) + ) + +(defmethod try-locate-ground ((this enemy) (arg0 meters) (arg1 meters) (arg2 symbol) (arg3 collide-spec)) + (let* ((s4-0 (new 'stack-no-clear 'collide-query)) + (a0-1 this) + (t9-0 (method-of-object a0-1 set-ground-pat!)) + (v1-1 s4-0) + (t3-0 arg3) + (a3-1 arg0) + (t0-1 arg1) + (t1-0 1024.0) + ) + (cond + ((t9-0 a0-1 v1-1 t3-0 a3-1 t0-1 t1-0) + (let ((s5-1 (-> this root))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> this root trans quad)) + (set! (-> s3-0 y) (-> s4-0 best-other-tri intersect y)) + (move-to-point! s5-1 s3-0) + (let ((a0-3 (-> s4-0 best-other-tri normal)) + (v1-8 (-> s4-0 best-other-tri pat)) + ) + (set! (-> s5-1 ground-touch-point quad) (-> s3-0 quad)) + (set! (-> s5-1 poly-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 surface-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 local-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 ground-poly-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 poly-pat) v1-8) + (set! (-> s5-1 cur-pat) v1-8) + (set! (-> s5-1 ground-pat) v1-8) + ) + ) + (logior! (-> s5-1 status) (collide-status on-surface on-ground touch-surface)) + ) + #t + ) + (else + (let ((v1-11 (-> this root))) + (logclear! (-> v1-11 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> v1-11 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((a0-12 (-> v1-11 dynam gravity-normal))) + (set! (-> v1-11 local-normal quad) (-> a0-12 quad)) + (set! (-> v1-11 surface-normal quad) (-> a0-12 quad)) + (set! (-> v1-11 poly-normal quad) (-> a0-12 quad)) + ) + (set! (-> v1-11 coverage) 0.0) + (set! (-> v1-11 touch-angle) 0.0) + ) + ) + (if arg2 + (format 0 "WARNING: enemy::move-to-ground: failed to locate ground for ~S!~%" (-> this name)) + ) + #f + ) + ) + ) + ) + +(defmethod move-above-ground! ((this enemy) (arg0 vector) (arg1 move-above-ground-params)) + (let ((gp-0 (-> this root))) + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (set! (-> arg1 old-gspot-pos quad) (-> gp-0 gspot-pos quad)) + (set! (-> arg1 old-gspot-normal quad) (-> gp-0 gspot-normal quad)) + (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) + (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) + (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) + (set! (-> gp-0 prev-status) (-> gp-0 status)) + (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) + (set! (-> arg1 new-pos quad) (-> gp-0 trans quad)) + (let* ((s2-0 (new 'stack-no-clear 'collide-query)) + (t9-1 (method-of-object this set-ground-pat!)) + (a1-2 s2-0) + (a2-2 (-> arg1 gnd-collide-with)) + (a3-0 (-> arg1 popup)) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (cond + ((t9-1 this a1-2 a2-2 a3-0 t0-0 t1-0) + (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> s2-0 best-other-tri pat)) + (set! (-> arg1 new-pos y) (-> s2-0 best-other-tri intersect y)) + (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + ) + (else + (if (-> arg1 hover-if-no-ground?) + (set! (-> arg1 new-pos y) (-> gp-0 trans-old y)) + ) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> gp-0 trans-old quad)) + (move-to-point! gp-0 (-> arg1 new-pos)) + (when (logtest? (logand (-> arg1 overlaps-params collide-with-filter) + (collide-spec hit-by-player-list hit-by-others-list player-list) + ) + (-> gp-0 root-prim prim-core collide-with) + ) + (when (find-overlapping-shapes gp-0 (-> arg1 overlaps-params)) + (when (-> arg1 dont-move-if-overlaps?) + (set! (-> arg1 do-move?) #f) + (move-to-point! gp-0 (-> gp-0 trans-old)) + (set! (-> gp-0 gspot-pos quad) (-> arg1 old-gspot-pos quad)) + (set! (-> gp-0 gspot-normal quad) (-> arg1 old-gspot-normal quad)) + ) + ) + ) + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-6 (-> gp-0 gspot-pos)) + (a0-21 (-> gp-0 gspot-normal)) + (v1-39 (-> arg1 pat)) + ) + (set! (-> gp-0 ground-touch-point quad) (-> a1-6 quad)) + (set! (-> gp-0 poly-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 surface-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 local-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 ground-poly-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 poly-pat) v1-39) + (set! (-> gp-0 cur-pat) v1-39) + (set! (-> gp-0 ground-pat) v1-39) + ) + (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> gp-0 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-49 (-> gp-0 dynam gravity-normal))) + (set! (-> gp-0 local-normal quad) (-> v1-49 quad)) + (set! (-> gp-0 surface-normal quad) (-> v1-49 quad)) + (set! (-> gp-0 poly-normal quad) (-> v1-49 quad)) + ) + (set! (-> gp-0 coverage) 0.0) + (set! (-> gp-0 touch-angle) 0.0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod apply-friction ((this enemy)) + (let ((v1-0 (-> this root))) + (when (logtest? (-> v1-0 status) (collide-status touch-surface)) + (let ((f0-1 (fmax 0.0 (+ 1.0 (* 60.0 (seconds-per-frame) (+ -1.0 (-> this enemy-info friction))))))) + (vector-float*! (-> v1-0 transv) (-> v1-0 transv) f0-1) + ) + 0 + ) + ) + 0 + (none) + ) + +(defmethod init-enemy-collision! ((this enemy)) + 0 + (none) + ) + +(defmethod init-enemy! ((this enemy)) + 0 + (none) + ) + +(defmethod go-idle2 ((this enemy)) + (go (method-of-object this idle)) + ) + +(defmethod init-enemy-info! ((this enemy) (arg0 enemy-info)) + (set! (-> this enemy-info) arg0) + (when (and (!= (-> this enemy-info neck-joint) -1) (zero? (-> this neck))) + (set! (-> this neck) + (new 'process 'joint-mod (joint-mod-mode flex-blend) this (-> this enemy-info neck-joint)) + ) + (set-vector! (-> this neck twist-max) 8192.0 8192.0 0.0 1.0) + (set! (-> this neck up) (the-as uint 1)) + (set! (-> this neck nose) (the-as uint 2)) + (set! (-> this neck ear) (the-as uint 0)) + (set! (-> this neck max-dist) 102400.0) + (set! (-> this neck ignore-angle) 16384.0) + ) + 0 + (none) + ) + +(defmethod init-enemy-defaults! ((this enemy) (arg0 enemy-info)) + (local-vars (sv-16 res-tag)) + (when (coin-flip? this) + (let ((a0-2 (-> this node-list data 2))) + (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) + (set! (-> a0-2 param1) #f) + (set! (-> a0-2 param2) #f) + ) + (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + ) + (logior! (-> this mask) (process-mask enemy)) + (logior! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (init-enemy-info! this arg0) + (set! (-> this ragdoll-proc) (the-as handle #f)) + (let ((a1-2 (-> this enemy-info idle-anim-script))) + (if a1-2 + (init! (-> this idle-anim-player) a1-2) + ) + ) + (if (-> this draw shadow) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + (-> this enemy-info shadow-min-y) + (-> this enemy-info shadow-max-y) + (-> this enemy-info shadow-locus-dist) + (the-as vector #f) + (shadow-flags shdf00 shdf04) + 245760.0 + ) + ) + (set! (-> this draw shadow-ctrl) *enemy-dummy-shadow-control*) + ) + (set! (-> this water-max-height) 8192.0) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) + (set! (-> this hit-points) (-> this enemy-info default-hit-points)) + ) + (let* ((v1-37 *game-info*) + (a0-10 (+ (-> v1-37 attack-id) 1)) + ) + (set! (-> v1-37 attack-id) a0-10) + (set! (-> this attack-id) a0-10) + ) + (let* ((v1-38 *game-info*) + (a0-12 (+ (-> v1-38 attack-id) 1)) + ) + (set! (-> v1-38 attack-id) a0-12) + (set! (-> this persistent-attack-id) a0-12) + ) + (set! (-> this incoming attacker-handle) (the-as handle #f)) + (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) + (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) + (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) + (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) + (the-as collide-spec (collide-spec jak player-list jak-vehicle)) + ) + ) + ) + (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (cond + ((and v1-47 (nonzero? (-> sv-16 elt-count))) + (set! (-> this actor-group) v1-47) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> this actor-group) (the-as (pointer actor-group) #f)) + (set! (-> this actor-group-count) 0) + 0 + ) + ) + ) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) + (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) + (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) + (if (-> this on-notice) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> this on-active) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> this on-hostile) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) + ) + (let ((s4-0 (-> this root))) + (set! (-> this penetrated-by-all) (-> s4-0 penetrated-by)) + (set! (-> s4-0 penetrated-by) (get-penetrated-by this)) + (set! (-> s4-0 event-self) 'touched) + ) + (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) + (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) + (set! (-> this reaction-time) (set-reaction-time! this (seconds 0.1) (seconds 0.6))) + (let* ((v1-77 (-> this enemy-flags)) + (a0-28 (-> this fact enemy-options)) + (v1-78 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-77 + ) + ) + ) + (if (logtest? (enemy-option multi-focus) a0-28) + (set! v1-78 (logior (enemy-flag multi-focus) v1-78)) + ) + (if (logtest? (enemy-option has-trigger) a0-28) + (set! v1-78 (logior (enemy-flag use-trigger) v1-78)) + ) + (set! (-> this enemy-flags) v1-78) + ) + (if (and (should-move-to-ground? this) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) + ) + (try-locate-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) + ) + (if (zero? (-> this draw light-index)) + (set! (-> this draw light-index) (the-as uint 10)) + ) + 0 + (none) + ) + +(defmethod enemy-method-152 ((this enemy)) + 1.0 + ) + +(defmethod get-gem-pool-idx ((this enemy)) + (-> *setting-control* user-current gem-pool-index) + ) + +(defbehavior enemy-setup-gem enemy () + (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag has-gem)))) + (when (> (-> self enemy-info gem-joint) 0) + (let ((gp-0 (get-gem-pool-idx self))) + (when (gems-available? gp-0) + (if (or (and (zero? gp-0) + (-> self entity) + (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status save)))) + ) + (and (nonzero? gp-0) (let* ((v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-15 (the-as number (logior #x3f800000 v1-14))) + ) + (< (+ -1.0 (the-as float v1-15)) (enemy-method-152 self)) + ) + ) + ) + (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag has-gem) (-> self enemy-flags)))) + ) + ) + ) + (cond + ((logtest? (enemy-flag has-gem) (-> self enemy-flags)) + (setup-masks + (-> self draw) + (the-as int (-> self enemy-info gem-seg)) + (the-as int (-> self enemy-info gem-no-seg)) + ) + (add-connection *part-engine* self (-> self enemy-info gem-joint) self 464 (-> self enemy-info gem-offset)) + ) + (else + (setup-masks + (-> self draw) + (the-as int (-> self enemy-info gem-seg)) + (the-as int (-> self enemy-info gem-no-seg)) + ) + ) + ) + ) + ) + +(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 enemy-init-by-other-params)) + (let ((a1-1 (-> arg1 entity))) + (if a1-1 + (process-entity-set! self a1-1) + ) + ) + (when (-> arg1 art-level) + (let ((v1-5 (level-get *level* (the-as symbol (-> arg1 art-level))))) + (if v1-5 + (set! (-> self level) v1-5) + ) + ) + ) + (if (-> arg1 directed?) + (logior! (-> self enemy-flags) (enemy-flag directed)) + ) + (if (-> arg1 no-initial-move-to-ground?) + (set! (-> self enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> self enemy-flags))) + ) + ) + (init-enemy-collision! self) + (set! (-> self root trans quad) (-> arg1 trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 quat)) + (vector-identity! (-> self root scale)) + (init-enemy! self) + (enemy-setup-gem) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (let ((v1-24 (-> self fact enemy-options))) + (cond + (*debug-view-anims* + (go-virtual view-anims) + ) + ((logtest? (enemy-option dormant) v1-24) + (go-dormant self) + ) + ((logtest? (enemy-flag directed) (-> self enemy-flags)) + (go-directed self) + ) + ((logtest? (enemy-option dormant-aware) v1-24) + (go-dormant-aware self) + ) + ((logtest? (enemy-option ambush) (-> self fact enemy-options)) + (go-ambush-delay self) + ) + (else + (go-idle2 self) + ) + ) + ) + ) + +(defmethod init-from-entity! ((this enemy) (arg0 entity-actor)) + (let ((a1-2 (res-lump-struct arg0 'art-level symbol))) + (when a1-2 + (let ((a0-3 (level-get *level* a1-2))) + (if a0-3 + (set! (-> this level) a0-3) + ) + ) + ) + ) + (init-enemy-collision! this) + (process-drawable-from-entity! this arg0) + (init-enemy! this) + (enemy-setup-gem) + (let ((v1-10 (-> this fact enemy-options))) + (cond + ((logtest? (enemy-option spawner) v1-10) + (process-entity-status! this (entity-perm-status dead) #t) + (go (method-of-object this die-fast)) + ) + (*debug-view-anims* + (go (method-of-object this view-anims)) + ) + ((logtest? (enemy-option dormant) v1-10) + (go-dormant this) + ) + ((logtest? (enemy-option dormant-aware) v1-10) + (go-dormant-aware this) + ) + (else + (go-idle2 this) + ) + ) + ) + ) + +(defmethod enemy-method-107 ((this enemy)) + #t + ) + +(defmethod enemy-method-108 ((this enemy)) + #f + ) + +(defmethod reset-to-collide-spec ((this enemy-focus) (arg0 collide-spec)) + "Reset this focus with the given [[collide-spec]]." + (let ((t9-0 (method-of-type focus reset-to-collide-spec))) + (t9-0 this arg0) + ) + (set! (-> this aware) (enemy-aware ea0)) + 0 + (none) + ) + +(defmethod update-focus ((this enemy)) + (let ((gp-0 (-> this focus))) + (let ((a1-0 (handle->process (-> gp-0 handle)))) + (when a1-0 + (let ((v1-4 (-> this enemy-flags))) + (cond + ((and a1-0 (not (logtest? (-> (the-as process-focusable a1-0) focus-status) (focus-status disable dead)))) + (when (and (logtest? (enemy-flag multi-focus) v1-4) + (not (logtest? (enemy-flag lock-focus) v1-4)) + (not (logtest? (-> gp-0 flags) (enemy-flag look-at-focus))) + ) + (find-best-focus this) + (return (the-as process #f)) + ) + (let ((v1-14 + (get-enemy-aware this (update-awareness! this (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) + ) + ) + (set! (-> gp-0 aware) v1-14) + (if (>= 1 (the-as int v1-14)) + (logclear! (-> gp-0 flags) (enemy-flag look-at-focus)) + ) + ) + (return (the-as process #f)) + ) + (else + (clear-focused gp-0) + ) + ) + ) + ) + ) + (if (!= (-> gp-0 handle) #f) + (clear-focused gp-0) + ) + ) + (if (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (find-best-focus this) + ) + ) + +(defmethod find-best-focus ((this enemy)) + (let ((s4-0 (-> this focus collide-with)) + (gp-0 (new 'stack-no-clear 'enemy-best-focus)) + ) + (set! (-> gp-0 proc) #f) + (set! (-> gp-0 rating) 409600000.0) + (set! (-> gp-0 aware) (enemy-aware ea0)) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s3-0 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1)))) + (when (logtest? s4-0 (-> v1-5 root-prim prim-core collide-as)) + (let* ((s2-0 (-> v1-5 process)) + (a1-1 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (if (and a1-1 + (and a1-1 (not (logtest? (-> (the-as process-focusable a1-1) focus-status) (focus-status disable dead)))) + (!= this a1-1) + ) + (update-awareness! this (the-as process-focusable a1-1) gp-0) + ) + ) + ) + ) + (set! v1-4 s3-0) + *collide-player-list* + (set! s3-0 (-> s3-0 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-player-list hit-by-others-list)) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((v1-19 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s3-1 (-> v1-19 next0))) + (while (!= v1-19 (-> *collide-hit-by-player-list* alive-list-end)) + (let ((v1-20 (the-as collide-shape (-> (the-as connection v1-19) param1)))) + (when (logtest? s4-0 (-> v1-20 root-prim prim-core collide-as)) + (let* ((s2-1 (-> v1-20 process)) + (a1-3 (if (type? s2-1 process-focusable) + s2-1 + ) + ) + ) + (if (and a1-3 + (and a1-3 (not (logtest? (-> (the-as process-focusable a1-3) focus-status) (focus-status disable dead)))) + (!= this a1-3) + ) + (update-awareness! this (the-as process-focusable a1-3) gp-0) + ) + ) + ) + ) + (set! v1-19 s3-1) + *collide-hit-by-player-list* + (set! s3-1 (-> s3-1 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-others-list)) + (let ((v1-32 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((s3-2 (-> v1-32 next0))) + (while (!= v1-32 (-> *collide-hit-by-others-list* alive-list-end)) + (let ((v1-33 (the-as collide-shape (-> (the-as connection v1-32) param1)))) + (when (logtest? s4-0 (-> v1-33 root-prim prim-core collide-as)) + (let* ((s2-2 (-> v1-33 process)) + (a1-5 (if (type? s2-2 process-focusable) + s2-2 + ) + ) + ) + (if (and a1-5 + (and a1-5 (not (logtest? (-> (the-as process-focusable a1-5) focus-status) (focus-status disable dead)))) + (!= this a1-5) + ) + (update-awareness! this (the-as process-focusable a1-5) gp-0) + ) + ) + ) + ) + (set! v1-32 s3-2) + *collide-hit-by-others-list* + (set! s3-2 (-> s3-2 next0)) + ) + ) + ) + ) + ) + (let ((s4-1 (-> gp-0 proc))) + (when s4-1 + (enemy-method-70 this (the-as process-focusable s4-1) (get-enemy-aware this (-> gp-0 aware))) + s4-1 + ) + ) + ) + ) + +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod update-awareness! ((this enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) + (let ((f30-0 (vector-vector-distance (get-trans arg0 0) (-> this root trans))) + (s3-1 #f) + (s2-0 #f) + ) + (cond + ((< f30-0 (-> this enemy-info proximity-notice-distance)) + (set! s3-1 #t) + (let* ((a0-3 this) + (t9-2 (method-of-object a0-3 enemy-method-107)) + ) + (set! s2-0 (t9-2 a0-3)) + ) + ) + (else + (let ((f0-1 (the-as float (-> this enemy-info notice-distance)))) + (if (< 1 (the-as int (-> this focus aware))) + (set! f0-1 (+ (the-as meters f0-1) (-> this enemy-info notice-distance-delta))) + ) + (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag use-notice-distance)))) + (let* ((a0-7 this) + (t9-3 (method-of-object a0-7 enemy-method-107)) + ) + (set! s2-0 (t9-3 a0-7)) + ) + (if s2-0 + (set! s3-1 #t) + ) + ) + ) + ) + ) + (let ((aware (cond + (s3-1 + (cond + ((enemy-method-108 this) + (the-as enemy-aware (enemy-aware ea4)) + ) + (s2-0 + (the-as enemy-aware (enemy-aware ea3)) + ) + (else + (the-as enemy-aware (enemy-aware ea2)) + ) + ) + ) + ((< f30-0 (-> this fact idle-distance)) + (the-as enemy-aware (enemy-aware ea1)) + ) + (else + (the-as enemy-aware (enemy-aware ea0)) + ) + ) + ) + ) + (when (and (> (the-as int aware) 0) (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) + (cond + ((logtest? (enemy-option idle-til-trigger) (-> this fact enemy-options)) + (if (not (enemy-method-141 this f30-0)) + (set! aware (enemy-aware ea0)) + ) + ) + (else + (if (and (< 1 (the-as int aware)) (not (enemy-method-141 this f30-0))) + (set! aware (enemy-aware ea1)) + ) + ) + ) + ) + (when arg1 + (when (and (>= (the-as int aware) (the-as int (-> arg1 aware))) (< f30-0 (-> arg1 rating))) + (set! (-> arg1 aware) (the-as enemy-aware aware)) + (set! (-> arg1 rating) f30-0) + (set! (-> arg1 proc) arg0) + ) + ) + (the-as enemy-aware aware) + ) + ) + ) + +(defmethod enemy-method-141 ((this enemy) (arg0 float)) + (let* ((v1-0 (-> this fact)) + (a2-0 (-> v1-0 trig-mask-count)) + (a3-0 (-> v1-0 trig-mask)) + ) + (dotimes (t0-0 a2-0) + (let ((t1-1 (the-as int (-> a3-0 t0-0)))) + (if (and (logtest? (the-as uint t1-1) 1) (>= (-> v1-0 trig-dist) arg0)) + (set! t1-1 (the-as int (logand -2 (the-as uint t1-1)))) + ) + (when (logtest? (the-as uint t1-1) 2) + (let ((t2-8 (-> v1-0 trig-actor-group 0))) + (countdown (t3-0 (-> t2-8 length)) + (let ((t5-0 (-> t2-8 data t3-0 actor))) + (when (and t5-0 (logtest? (-> t5-0 extra perm status) (entity-perm-status subtask-complete))) + (set! t1-1 (the-as int (logand -3 (the-as uint t1-1)))) + (goto cfg-17) + ) + ) + ) + ) + ) + (label cfg-17) + (when (zero? t1-1) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (return #t) + ) + ) + ) + ) + #f + ) + +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod get-enemy-aware ((this enemy) (arg0 enemy-aware)) + (let ((v1-1 (< 1 (the-as int arg0)))) + (cond + (v1-1 + (when (not (logtest? (-> this enemy-flags) (enemy-flag notice))) + (logior! (-> this enemy-flags) (enemy-flag notice)) + (set-time! (-> this notice-time)) + ) + (if (and (not (logtest? (-> this enemy-flags) (enemy-flag alert))) + (not (time-elapsed? (-> this notice-time) (-> this reaction-time))) + ) + (set! v1-1 #f) + ) + ) + (else + (logclear! (-> this enemy-flags) (enemy-flag notice)) + ) + ) + (the-as enemy-aware (cond + (v1-1 + (the-as int arg0) + ) + ((or (= arg0 (enemy-aware ea0)) (time-elapsed? (-> this last-draw-time) (seconds 2))) + 0 + ) + (else + 1 + ) + ) + ) + ) + ) + +(defmethod event-handler ((this enemy) (proc process) (argc int) (msg symbol) (block event-message-block)) + (local-vars (s5-6 rgbaf) (sv-640 event-message-block) (sv-656 process) (sv-672 event-message-block)) + (cond + ((= msg 'go-gun-dark-2-stretch) + (go-gun-dark-2-stretch this) + ) + ((= msg 'go-gun-dark-3-nuke) + (on-dying this) + (send-event (ppointer->process (-> this parent)) 'child-die) + (mark-as-dead this) + (cleanup-for-death this) + (go (method-of-object this die-fast)) + ) + ((= msg 'combo) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (!= (-> this hit-points) 0.0)) + ) + ((= msg 'touch) + (enemy-touch-handler this proc block) + ) + ((= msg 'touched) + (when (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (let* ((s3-1 proc) + (v1-27 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (when v1-27 + (let* ((s3-2 (-> (the-as process-drawable v1-27) root)) + (a1-5 (if (type? s3-2 collide-shape) + s3-2 + ) + ) + (s3-3 (-> block param 0)) + ) + (if (and a1-5 + s3-3 + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (the-as collide-shape a1-5) + (collide-action solid) + (collide-action) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (-> this root) + (collide-action solid) + (collide-action) + ) + ) + (set-time! (-> this auto-reset-penetrate-time)) + ) + ) + ) + ) + ) + (send-attack-on-jump-or-knocked this proc block) + ) + ((= msg 'attack-invinc) + (case (-> (the-as attack-info (-> block param 1)) mode) + (('endlessfall) + (let ((v1-39 (-> this root root-prim))) + (set! (-> v1-39 prim-core collide-as) (collide-spec)) + (set! (-> v1-39 prim-core collide-with) (collide-spec)) + ) + 0 + (go-die this) + ) + ) + ) + ((= msg 'attack-no-avoid) + (let* ((s2-0 (-> block param 1)) + (s3-4 this) + (s1-0 (method-of-object s3-4 get-incoming-attack!)) + (s0-0 proc) + ) + (set! sv-640 block) + (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-0 (-> block param 0)) + ) + (s1-0 + s3-4 + (the-as process-drawable s0-0) + sv-640 + a3-3 + (the-as attack-info s2-0) + (the-as touching-shapes-entry t1-0) + ) + ) + ) + (damage-enemy! this proc block) + ) + ((= msg 'attack) + (let ((s2-1 (the-as object (-> block param 1)))) + (when (!= (-> (the-as attack-info s2-1) id) (-> this incoming attack-id)) + (cond + ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (let* ((s1-1 this) + (s0-1 (method-of-object s1-1 get-incoming-attack!)) + ) + (set! sv-656 proc) + (set! sv-672 block) + (let ((a3-4 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-1 (-> block param 0)) + ) + (s0-1 + s1-1 + (the-as process-drawable sv-656) + sv-672 + a3-4 + (the-as attack-info s2-1) + (the-as touching-shapes-entry t1-1) + ) + ) + ) + (send-event (ppointer->process (-> this parent)) 'child-hit) + (let ((f0-1 (the-as number 0.0))) + (if (not *debug-unkillable*) + (set! f0-1 (damage-enemy! this proc block)) + ) + ) + (let ((s2-2 (penetrate->next-state this))) + (when s2-2 + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (send-attack-to-all-tshapes this (the-as process-focusable proc) block) + (let ((a1-17 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-17 from) (process->ppointer proc)) + (set! (-> a1-17 num-params) argc) + (set! (-> a1-17 message) s2-2) + (set! (-> a1-17 param 0) (-> block param 0)) + (set! (-> a1-17 param 1) (-> block param 1)) + (set! (-> a1-17 param 2) (-> block param 2)) + (set! (-> a1-17 param 3) (-> block param 3)) + (set! (-> a1-17 param 4) (-> block param 4)) + (set! (-> a1-17 param 5) (-> block param 5)) + (send-event-function this a1-17) + ) + #t + ) + ) + ) + (else + (set! (-> this incoming attack-id) (-> (the-as attack-info s2-1) id)) + (enemy-touch-handler this proc block) + ) + ) + ) + ) + ) + ((= msg 'impact-impulse) + (let* ((s4-1 (the-as object (-> block param 0))) + (s3-5 (if (type? proc process-focusable) + proc + ) + ) + (f30-1 (* (-> (the-as rigid-body-impact s4-1) impulse) (get-inv-mass this))) + ) + (when (and s3-5 (< 20480.0 f30-1)) + (let ((s5-1 (new 'stack-no-clear 'attack-info))) + (let ((v1-85 (process->handle s3-5))) + (let ((a0-41 s5-1)) + (set! (-> a0-41 mode) 'impact) + (set! (-> a0-41 penetrate-using) (penetrate vehicle)) + (set! (-> a0-41 mask) (attack-mask mode penetrate-using)) + ) + (cond + ((and (= v1-85 (-> this incoming attacker-handle)) + (not (time-elapsed? (-> this incoming attack-time) (seconds 0.1))) + ) + (set! (-> s5-1 id) (-> this incoming attack-id)) + ) + (else + (let* ((a0-48 *game-info*) + (a1-26 (+ (-> a0-48 attack-id) 1)) + ) + (set! (-> a0-48 attack-id) a1-26) + (set! (-> s5-1 id) a1-26) + ) + ) + ) + (logior! (-> s5-1 mask) (attack-mask id)) + (set! (-> s5-1 attacker) (the-as handle v1-85)) + ) + (logior! (-> s5-1 mask) (attack-mask attacker)) + (let ((v1-89 (scale-impact-vel-y! + this + (new 'stack-no-clear 'vector) + (vector-negate! (new 'stack-no-clear 'vector) (-> (the-as rigid-body-impact s4-1) velocity)) + f30-1 + ) + ) + ) + (set! (-> s5-1 attacker-velocity quad) (-> v1-89 quad)) + (set! (-> s5-1 vector quad) (-> v1-89 quad)) + ) + (logior! (-> s5-1 mask) (attack-mask attacker-velocity)) + (logior! (-> s5-1 mask) (attack-mask vector)) + (set! (-> s5-1 intersection quad) (-> (the-as rigid-body-impact s4-1) point quad)) + (logior! (-> s5-1 mask) (attack-mask intersection)) + (set! (-> s5-1 damage) (lerp-damage this f30-1)) + (logior! (-> s5-1 mask) (attack-mask damage)) + (when (< 0.0 (-> s5-1 damage)) + (format + 0 + "Sending impact-impulse attack with ~f damage (~m impulse, ~m attacker-velocity)~%" + (-> s5-1 damage) + f30-1 + (vector-length (-> s5-1 attacker-velocity)) + ) + (send-event this 'attack #f s5-1) + (when (= (-> this hit-points) 0.0) + (logior! (-> this root penetrated-by) (penetrate vehicle)) + #t + ) + ) + ) + ) + ) + ) + ((= msg 'hit-flinch) + (when (= (-> this hit-points) 0.0) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (go-die this) + ) + #t + ) + ((= msg 'hit-knocked) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (when (= (-> this hit-points) 0.0) + (case (-> this incoming knocked-type) + (((knocked-type yellow-shot) (knocked-type blue-shot)) + (set! (-> this incoming knocked-type) (knocked-type none)) + 0 + ) + ) + ) + (go (method-of-object this knocked)) + ) + ((= msg 'hit) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (if (= (-> this hit-points) 0.0) + (go-die this) + (go (method-of-object this hit)) + ) + ) + ((= msg 'cue-chase) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (let ((v1-202 (logtest? (enemy-flag directed) (-> this enemy-flags)))) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (cond + (v1-202 + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go-hostile this) + ) + ) + ((and (-> this next-state) (let ((v1-213 (-> this next-state name))) + (or (= v1-213 'dormant) (= v1-213 'dormant-aware)) + ) + ) + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go (method-of-object this notice)) + ) + ) + ) + ) + #t + ) + ) + ((= msg 'cue-wake) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (logclear! (-> this enemy-flags) (enemy-flag directed directed-ready use-trigger)) + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go-best-state this) + ) + #t + ) + ) + ((= msg 'jump) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this jump-why) (-> block param 0)) + (set! (-> this event-param-point quad) (-> (the-as vector (-> block param 1)) quad)) + (go (method-of-object this jump)) + ) + ) + ((= msg 'birth-pickup) + (if (not (-> *setting-control* user-current gun-special-mode)) + (drop-pickup (-> this fact) #t *entity-pool* (-> this fact) 0 #f) + ) + ) + ((= msg 'death-start) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag death-start) (-> this enemy-flags)))) + (send-event (ppointer->process (-> this parent)) 'child-die) + (when (< (-> *event-queue* length) (-> *event-queue* allocated-length)) + (let ((v1-269 (-> *event-queue* data (-> *event-queue* length)))) + (+! (-> *event-queue* length) 1) + (set! (-> v1-269 from-handle) (process->handle self)) + (set! (-> v1-269 to-handle) (process->handle this)) + (set! (-> v1-269 num-params) 0) + (set! (-> v1-269 message) 'birth-pickup) + ) + ) + (let ((s5-2 (-> this on-death))) + (if s5-2 + (script-eval s5-2 :vector (-> this root trans)) + ) + ) + ) + ((= msg 'death-end) + (if (-> this skel effect) + (logior! (-> this skel effect flags) (effect-control-flag ecf2)) + ) + (logior! (-> this draw status) (draw-control-status no-draw)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag dangerous-backup))) + ) + ((= msg 'instant-death) + (when (and (< 0.0 (-> this hit-points)) (zero? (-> this fated-time))) + (set! (-> this hit-points) 0.0) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (let ((s5-3 (get-knockback-dir! this (new 'stack-no-clear 'vector)))) + (vector-z-quaternion! s5-3 (-> this root quat)) + (vector-float*! s5-3 s5-3 -1.0) + (vector-normalize! s5-3 1.0) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (go-die this) + ) + ) + ((= msg 'die-fast) + (logior! (-> this draw status) (draw-control-status no-draw)) + (on-dying this) + (send-event (ppointer->process (-> this parent)) 'child-die) + (let ((s5-4 (-> this on-death))) + (if s5-4 + (script-eval s5-4 :vector (-> this root trans)) + ) + ) + (cleanup-for-death this) + (go (method-of-object this die-fast)) + ) + ((= msg 'victory) + (if (and (-> this enemy-info use-victory) + (not (and (-> this next-state) (= (-> this next-state name) 'victory))) + (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + ) + (go (method-of-object this victory)) + ) + ) + ((= msg 'nav-control) + (if (nonzero? (-> this nav)) + (-> this nav) + ) + ) + ((= msg 'push-trans) + (move-by-vector! (-> this root) (the-as vector (-> block param 0))) + ) + ((= msg 'move-trans) + (move-to-point! (-> this root) (the-as vector (-> block param 0))) + ) + ((= msg 'shadow) + (cond + ((-> block param 0) + (let ((v1-371 (-> this draw shadow-ctrl))) + (logclear! (-> v1-371 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (else + (let ((v1-374 (-> this draw shadow-ctrl))) + (logior! (-> v1-374 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + ((= msg 'color-effect) + (case (-> block param 0) + (('dark) + (let ((f30-2 (rand-vu-float-range 0.2 1.0))) + (set-vector! (-> this draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.0 f30-2) (lerp 1.0 1.0 f30-2) 1.0) + (set! s5-6 (-> this draw color-emissive)) + (set! (-> s5-6 x) (lerp 0.0 0.3 f30-2)) + (set! (-> s5-6 y) (lerp 0.0 0.0 f30-2)) + (set! (-> s5-6 z) (lerp 0.0 0.3 f30-2)) + ) + (set! (-> s5-6 w) 1.0) + s5-6 + ) + ((#f) + (set-vector! (-> this draw color-mult) 1.0 1.0 1.0 1.0) + (set! s5-6 (-> this draw color-emissive)) + (set! (-> s5-6 quad) (the-as uint128 0)) + s5-6 + ) + ) + ) + ((= msg 'enable-envmap) + (cond + ((-> block param 0) + (logclear! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) + #t + ) + (else + (logior! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) + #t + ) + ) + ) + ) + ) + +(defmethod lerp-damage ((this enemy) (arg0 float)) + (lerp-scale 0.0 (-> this enemy-info default-hit-points) arg0 20480.0 122880.0) + ) + +(defmethod scale-impact-vel-y! ((this enemy) (arg0 vector) (arg1 vector) (arg2 float)) + (set! (-> arg0 quad) (-> arg1 quad)) + (vector-normalize! arg0 arg2) + (set! (-> arg0 y) (lerp-scale + (-> this enemy-info knocked-hard-vy-lo) + (-> this enemy-info knocked-hard-vy-hi) + arg2 + 20480.0 + 204800.0 + ) + ) + (vector-normalize! arg0 arg2) + arg0 + ) + +(defmethod get-damage-from-attack ((this enemy) (arg0 object) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (if (logtest? (attack-mask damage) (-> (the-as attack-info v1-0) mask)) + (-> (the-as attack-info v1-0) damage) + (penetrate-using->damage (-> this incoming penetrate-using)) + ) + ) + ) + +(defmethod enemy-method-63 ((this enemy) (arg0 float)) + (let ((f0-1 (fmax 0.0 (fmin arg0 (-> this hit-points))))) + (cond + ((and (= (-> this incoming knocked-type) (knocked-type blue-shot)) (= f0-1 (-> this hit-points)) (< 0.0 f0-1)) + (cond + ((zero? (-> this fated-time)) + (set-time! (-> this fated-time)) + (+ -1.0 f0-1) + ) + ((not (time-elapsed? (-> this fated-time) (seconds 1))) + (+ -1.0 f0-1) + ) + (else + f0-1 + ) + ) + ) + (else + f0-1 + ) + ) + ) + ) + +(defmethod penetrate->next-state ((this enemy)) + (let ((gp-0 (-> this incoming penetrate-using))) + (cond + ((and (logtest? (penetrate jak-dark-blackhole) gp-0) #t) + 'go-gun-dark-2-stretch + ) + ((and (logtest? (penetrate jak-dark-nuke) (-> this incoming penetrate-using)) (enemy-method-150 this)) + 'go-gun-dark-3-nuke + ) + ((logtest? gp-0 (-> this penetrate-flinch)) + 'hit-flinch + ) + ((logtest? gp-0 (-> this penetrate-knocked)) + 'hit-knocked + ) + (else + 'hit + ) + ) + ) + ) + +(defmethod damage-enemy! ((this enemy) (arg0 object) (arg1 event-message-block)) + (let* ((f0-0 (get-damage-from-attack this arg0 arg1)) + (f30-0 (enemy-method-63 this f0-0)) + ) + (set! (-> this hit-points) (- (-> this hit-points) f30-0)) + (if (not (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate))) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + ) + f30-0 + ) + ) + +(defmethod find-offending-pfoc ((this enemy) (arg0 process) (arg1 attack-info)) + (find-offending-process-focusable arg0 arg1) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod enemy-touch-handler ((this enemy) (arg0 process) (arg1 event-message-block)) + (let* ((s4-0 (-> arg1 param 0)) + (s2-0 arg0) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and s4-0 s3-0) + (cond + ((and (focus-test? this dangerous) + (and s3-0 + (not (logtest? (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action deadly) + (collide-action) + ) + ) + (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action persistent-attack) + (collide-action) + ) + (-> this persistent-attack-id) + (-> this attack-id) + ) + ) + ) + (send-attack this arg0 (the-as touching-shapes-entry s4-0) a3-2) + ) + ) + ((and ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action no-standon) + (collide-action) + ) + (not (logtest? (-> this root penetrated-by) + (-> (the-as collide-shape (-> (the-as process-drawable s3-0) root)) penetrate-using) + ) + ) + ) + (if (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s4-0) 0.7 6144.0 16384.0) + (send-event this 'bouncing-off arg0) + ) + ) + ) + ) + ) + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod send-attack-on-jump-or-knocked ((this enemy) (arg0 process) (arg1 event-message-block)) + (let ((s4-0 (-> arg1 param 0))) + (when s4-0 + (when (or (and (and (-> this next-state) (= (-> this next-state name) 'knocked)) + (logtest? (process-mask crate) (-> arg0 mask)) + ) + (and (and (-> this next-state) (= (-> this next-state name) 'jump)) + (logtest? (process-mask target sidekick crate bot) (-> arg0 mask)) + ) + ) + (when ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action solid semi-solid deadly) + (collide-action) + ) + (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action persistent-attack) + (collide-action) + ) + (-> this persistent-attack-id) + (-> this attack-id) + ) + ) + ) + (send-attack this arg0 (the-as touching-shapes-entry s4-0) a3-2) + ) + ) + ) + ) + ) + (none) + ) + +(defbehavior enemy-event-handler enemy ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (event-handler self arg0 arg1 arg2 arg3) + ) + +(defbehavior enemy-simple-post enemy () + (enemy-common-post self) + (update-transforms (-> self root)) + 0 + (none) + ) + +(defbehavior enemy-falling-post enemy () + (let ((gp-0 (-> self root))) + (cond + ((focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + ) + (else + (let ((a1-1 (new-stack-vector0))) + (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 a1-1 (-> self enemy-info slip-factor))) + ) + ) + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> gp-0 pat-ignore-mask))) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-1 (meters 0)) + ) + ) + (apply-friction self) + (enemy-common-post self) + (none) + ) + +(defmethod accelerate-fall! ((this enemy) (arg0 vector)) + (let* ((f2-0 0.8) + (f0-1 (fmax 0.0 (+ 1.0 (* 60.0 (seconds-per-frame) (+ -1.0 f2-0))))) + ) + (vector-float*! arg0 arg0 f0-1) + ) + (set! (-> arg0 y) (+ (-> arg0 y) (* -204800.0 (seconds-per-frame)))) + ) + +(defbehavior enemy-die-falling-post enemy () + (let ((gp-0 (-> self root))) + (if (focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 (new-stack-vector0) 0.0)) + ) + (let ((s4-1 (new 'stack-no-clear 'collide-query)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 quad) (-> gp-0 trans quad)) + (vector-v++! s5-1 (-> gp-0 transv)) + (let* ((a0-6 gp-0) + (t9-4 (method-of-object a0-6 find-ground)) + (a2-1 (-> self enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (t9-4 a0-6 s4-1 a2-1 a3-0 t0-0 t1-0) + (when (>= (-> gp-0 gspot-pos y) (-> s5-1 y)) + (set! (-> s5-1 y) (-> gp-0 gspot-pos y)) + (vector-reset! (-> gp-0 transv)) + ) + ) + ) + (move-to-point! gp-0 s5-1) + ) + ) + (enemy-common-post self) + 0 + (none) + ) + +(defmethod enemy-method-91 ((this enemy)) + #f + ) + +(defmethod init-jump-info! ((this enemy) (arg0 enemy-jump-info)) + (set! (-> arg0 flags) (enemy-jump-flags ejf0)) + (set! (-> arg0 anim-speed) (rnd-float-range this 0.9 1.1)) + (set! (-> arg0 hang-time) 0) + (set! (-> arg0 dest-pos quad) (-> this event-param-point quad)) + (set! (-> arg0 start-pos quad) (-> this root trans quad)) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (if (enemy-above-ground? this s4-0 (-> arg0 dest-pos) (-> this gnd-collide-with) 8192.0 81920.0 1024.0) + (set! (-> arg0 dest-pos y) (-> s4-0 best-other-tri intersect y)) + ) + ) + (setup-jump! this arg0) + (none) + ) + +(defmethod setup-jump! ((this enemy) (arg0 enemy-jump-info)) + (let* ((f0-0 (vector-vector-xz-distance (-> arg0 start-pos) (-> arg0 dest-pos))) + (f0-2 (fmax (-> this enemy-info jump-height-min) (* (-> this enemy-info jump-height-factor) f0-0))) + ) + (setup-from-to-height! (-> arg0 traj) (-> arg0 start-pos) (-> arg0 dest-pos) f0-2 -4.551111) + ) + (none) + ) + +(defmethod on-ground? ((this enemy)) + (let ((gp-0 (-> this root))) + (when (< (-> gp-0 transv y) 0.0) + (let* ((a1-0 (new 'stack-no-clear 'collide-query)) + (v1-0 (-> this root)) + (t9-0 (method-of-object v1-0 find-ground)) + (a2-1 (-> this gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (t9-0 v1-0 a1-0 a2-1 a3-0 t0-0 t1-0) + ) + (>= (+ 409.6 (-> gp-0 gspot-pos y)) (-> gp-0 trans y)) + ) + ) + ) + +(defmethod move-to-gspot! ((this enemy)) + (let* ((v1-0 (-> this root)) + (f0-0 (-> v1-0 gspot-pos y)) + ) + (if (< (-> v1-0 trans y) f0-0) + (set! (-> v1-0 trans y) f0-0) + ) + ) + (set! (-> this root transv y) 0.0) + ) + +(defmethod enemy-method-101 ((this enemy)) + 0 + (none) + ) + +(defmethod in-jump-handler ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + (case arg0 + ((2 3) + (let ((f30-0 (the float (-> arg1 hang-time)))) + (let ((a1-3 (compute-trans-at-time (-> arg1 traj) f30-0 (new 'stack-no-clear 'vector)))) + (move-to-point! (-> this root) a1-3) + ) + (let ((s5-1 (-> this root transv))) + (compute-transv-at-time (-> arg1 traj) f30-0 s5-1) + (vector-float*! s5-1 s5-1 300.0) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod jump-wind-up-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((a0-1 (-> this skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-3 (-> this draw art-group data (-> this enemy-info jump-wind-up-anim))) + (a0-5 (-> this skel root-channel 0)) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) + (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) + ) + #t + ) + +(defmethod jump-in-air-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((s5-0 (-> this draw art-group data (-> this enemy-info jump-in-air-anim)))) + (let ((v1-6 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-6 (= v1-6 (-> this draw art-group data (-> this enemy-info jump-wind-up-anim)))) + (ja-channel-push! 1 0) + ) + (else + (let ((a0-10 (-> this skel root-channel 0))) + (set! (-> a0-10 param 0) 1.0) + (joint-control-channel-group! a0-10 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((a0-12 (-> this skel root-channel 0))) + (set! (-> a0-12 frame-group) (the-as art-joint-anim s5-0)) + (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim s5-0) frames num-frames) -1))) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! a0-12 (the-as art-joint-anim s5-0) num-func-seek!) + ) + ) + #t + ) + +(defmethod jump-land-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((a0-1 (-> this skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.075)) + (let ((a1-3 (-> this draw art-group data (-> this enemy-info jump-land-anim))) + (a0-5 (-> this skel root-channel 0)) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) + (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) + ) + #t + ) + +(defmethod jump-anim-handler ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + (local-vars (s5-0 symbol)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (not (jump-wind-up-anim this arg1)) + ) + ((= v1-0 1) + (set! s5-0 (ja-done? 0)) + (let ((a0-4 (-> this skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + ((= v1-0 2) + (jump-in-air-anim this arg1) + #f + ) + ((= v1-0 3) + (set! s5-0 (ja-done? 0)) + (let ((a0-9 (-> this skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + ((= v1-0 4) + (not (jump-land-anim this arg1)) + ) + ((= v1-0 5) + (set! s5-0 (ja-done? 0)) + (let ((a0-14 (-> this skel root-channel 0))) + (set! (-> a0-14 param 0) (the float (+ (-> a0-14 frame-group frames num-frames) -1))) + (set! (-> a0-14 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + (else + #t + ) + ) + ) + ) + +(defmethod enemy-method-109 ((this enemy)) + #f + ) + +(defmethod enemy-method-50 ((this enemy) (arg0 int)) + 0 + (none) + ) + +(if #t + (set! *shockwave-knock-scalar* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -1.0 :w -2.0) + :ys (new 'static 'vector :x 0.5 :y 1.0 :z 1.5 :w 2.5) + :one-over-x-deltas (new 'static 'vector :x 1.6666666 :y 0.71428573 :z 1.0 :w 1.0) + ) + ) + ) + +(defmethod knocked-handler ((this enemy) (arg0 vector)) + (local-vars (v0-22 number)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf27 :class vf) + (vf28 :class vf) + (vf29 :class vf) + ) + (init-vf0-vector) + (get-knockback-dir! this arg0) + (let ((s5-0 (-> this enemy-info))) + (case (-> this incoming knocked-type) + (((knocked-type explode-or-darkjak)) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-hard-vxz-lo) (-> s5-0 knocked-hard-vxz-hi) f30-0)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-hard-vy-lo) (-> s5-0 knocked-hard-vy-hi) f30-0)) + ) + ) + (((knocked-type mech-punch)) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-medium-vxz-lo) (-> s5-0 knocked-medium-vxz-hi) f30-1)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-medium-vy-lo) (-> s5-0 knocked-medium-vy-hi) f30-1)) + ) + ) + (((knocked-type dark-shot)) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-huge-vxz-lo) (-> s5-0 knocked-huge-vxz-hi) f30-2)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-huge-vy-lo) (-> s5-0 knocked-huge-vy-hi) f30-2)) + ) + ) + (((knocked-type yellow-shot)) + (vector-rotate90-around-y! arg0 arg0) + (let ((v1-9 (new 'stack-no-clear 'vector))) + (vector-! v1-9 (-> this incoming attacker-pos) (-> this root trans)) + (set! (-> v1-9 y) 0.0) + (if (< 0.0 (vector-dot v1-9 arg0)) + (vector-negate! arg0 arg0) + ) + ) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-yellow-vxz-lo) (-> s5-0 knocked-yellow-vxz-hi) f30-3)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-yellow-vy-lo) (-> s5-0 knocked-yellow-vy-hi) f30-3)) + ) + ) + (((knocked-type red-shot)) + (let ((f30-4 0.0)) + (cond + ((logtest? (penetrate jak-red-shockwave) (-> this incoming penetrate-using)) + (format 0 "Intensity ~f (handle ~d)~%" f30-4 (process->handle this)) + ) + (else + (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f0-26 1.0) + (f2-0 61440.0) + (f1-3 (fmin f1-2 (* f2-0 f2-0))) + (f2-3 61440.0) + ) + (set! f30-4 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + ) + ) + ) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-4)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-4)) + ) + (when (logtest? (penetrate jak-red-shockwave) (-> this incoming penetrate-using)) + (let ((a0-31 *shockwave-knock-scalar*) + (f0-34 (-> this incoming intensity)) + (a1-23 (new 'stack-no-clear 'vector)) + (v1-33 (new 'stack-no-clear 'vector)) + ) + (let ((a2-18 f0-34)) + (.mov vf27 a2-18) + ) + (.lvf vf24 (&-> a0-31 xs quad)) + (.lvf vf25 (&-> a0-31 ys quad)) + (.lvf vf26 (&-> a0-31 one-over-x-deltas quad)) + (.min.w.vf vf27 vf27 vf0) + (.max.x.vf vf27 vf27 vf0) + (.add.x.vf vf28 vf24 vf27) + (.mul.w.vf acc vf25 vf0) + (.add.mul.vf vf29 vf28 vf26 acc) + (.svf (&-> a1-23 quad) vf28) + (.svf (&-> v1-33 quad) vf29) + (let ((a0-32 (-> a1-23 z)) + (a1-24 (-> a1-23 y)) + ) + (b! (>= (the-as int a0-32) 0) cfg-23 :delay (set! v0-22 (-> v1-33 z))) + (b! (>= (the-as int a1-24) 0) cfg-23 :delay (set! v0-22 (-> v1-33 y))) + ) + (set! v0-22 (-> v1-33 x)) + ) + (label cfg-23) + (let ((f0-35 (the-as float v0-22))) + (vector-float*! arg0 arg0 f0-35) + ) + ) + ) + (((knocked-type blue-shot)) + (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f0-36 1.0) + (f2-6 122880.0) + (f1-6 (fmin f1-5 (* f2-6 f2-6))) + (f2-9 122880.0) + (f30-7 (* (- f0-36 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) + ) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) + (cond + ((or (>= (the-as uint 4) (-> this incoming blue-juggle-count)) (handle->process (-> this ragdoll-proc))) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-blue-vy-lo) (-> s5-0 knocked-blue-vy-hi) f30-7)) + ) + (else + (if (zero? (rnd-int this 3)) + (set! (-> arg0 y) 40960.0) + ) + ) + ) + ) + ) + (((knocked-type vehicle)) + (let ((v0-4 (the-as object arg0))) + (set! (-> (the-as vector v0-4) quad) (-> this incoming attack-direction quad)) + v0-4 + ) + ) + (else + (let ((f30-8 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-soft-vxz-lo) (-> s5-0 knocked-soft-vxz-hi) f30-8)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-soft-vy-lo) (-> s5-0 knocked-soft-vy-hi) f30-8)) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch float vs degrees. +(defmethod get-knockback-angle ((this enemy)) + (let ((f30-0 (quaternion-y-angle (-> this root quat)))) + (case (-> this incoming knocked-type) + (((knocked-type yellow-shot) (knocked-type blue-shot)) + (let ((a0-5 (handle->process (-> this focus handle)))) + (when a0-5 + (let ((v1-9 (get-trans (the-as process-focusable a0-5) 0))) + (set! f30-0 (atan (- (-> v1-9 x) (-> this root trans x)) (- (-> v1-9 z) (-> this root trans z)))) + ) + ) + ) + ) + (else + (let* ((v1-13 (-> this root transv)) + (f28-0 (atan (-> v1-13 x) (-> v1-13 z))) + (f1-2 (deg- f30-0 f28-0)) + (f2-0 (fabs f1-2)) + (f0-6 (-> this enemy-info knocked-seek-ry-clamp)) + ) + (when (and (< f0-6 f2-0) (< f2-0 (- 32768.0 f0-6))) + (set! f30-0 (+ (cond + ((< f2-0 16384.0) + (if (>= f1-2 0.0) + f0-6 + (- f0-6) + ) + ) + ((>= f1-2 0.0) + (- 32768.0 f0-6) + ) + (else + (+ -32768.0 f0-6) + ) + ) + f28-0 + ) + ) + (if (< f30-0 0.0) + (set! f30-0 (+ 65536.0 f30-0)) + ) + ) + ) + ) + ) + (the-as degrees f30-0) + ) + ) + +(defmethod knocked-anim ((this enemy) (arg0 enemy-knocked-info)) + (ja-channel-push! 1 0) + (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-anim))) + (a0-4 (-> this skel root-channel 0)) + ) + (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) + (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) + ) + #t + ) + +(defmethod knocked-land-anim ((this enemy) (arg0 enemy-knocked-info)) + (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) + (a0-3 (-> this skel root-channel 0)) + ) + (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) + (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) + ) + #t + ) + +(defmethod enemy-method-88 ((this enemy) (arg0 enemy-knocked-info)) + (let ((gp-0 (-> this root))) + (or (>= (-> arg0 on-surface-count) 3) + (and (logtest? (-> gp-0 status) (collide-status on-ground)) (>= 16384.0 (-> gp-0 transv y))) + (and (>= (-> arg0 move-count) 3) + (let ((f0-1 40.96)) + (>= (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) + ) + (let ((f0-4 40.96)) + (>= (* f0-4 f0-4) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) + ) + ) + ) + ) + ) + +(defmethod within-gspot-range? ((this enemy)) + (let ((gp-0 (-> this root)) + (a1-0 (new 'stack-no-clear 'collide-query)) + ) + (if (or (< 0.0 (-> this root transv y)) (begin + (let* ((v1-3 gp-0) + (t9-0 (method-of-object v1-3 find-ground)) + (a2-1 (-> this enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (t9-0 v1-3 a1-0 a2-1 a3-0 t0-0 t1-0) + ) + (let ((f0-2 (- (-> gp-0 trans y) (-> gp-0 gspot-pos y)))) + (and (>= f0-2 -1228.8) (>= 6144.0 f0-2)) + ) + ) + ) + #f + #t + ) + ) + ) + +(defmethod enemy-method-90 ((this enemy) (arg0 ragdoll-proc)) + (let* ((s4-0 (-> arg0 ragdoll)) + (s2-0 (-> s4-0 ragdoll-joints)) + (s1-0 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s4-0 orient-tform) (-> s4-0 orient-tform w)) + ) + (s3-0 (new 'stack-no-clear 'matrix)) + (s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> this root quat))) + ) + (quaternion-normalize! (quaternion*! s1-0 (the-as quaternion (-> s2-0 0)) s1-0)) + (quaternion->matrix s3-0 s1-0) + (if (logtest? (-> s4-0 ragdoll-flags) (ragdoll-flag mirror)) + (matrix*! s3-0 s3-0 (-> s4-0 mirror)) + ) + (vector-flatten! (-> s5-0 fvec) (-> s3-0 uvec) (-> s5-0 uvec)) + (vector-normalize! (-> s5-0 fvec) 1.0) + (vector-cross! (-> s5-0 rvec) (-> s5-0 uvec) (-> s5-0 fvec)) + (matrix->quaternion (-> this root quat) s5-0) + ) + 0 + (none) + ) + +(defmethod knocked-anim-handler ((this enemy) (arg0 int) (arg1 enemy-knocked-info)) + (local-vars (s5-0 symbol)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (knocked-anim this arg1) + (set! s5-0 #f) + ) + ((= v1-0 1) + (set! s5-0 (ja-done? 0)) + (let ((a0-4 (-> this skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ((= v1-0 2) + (freeze-hit-end) + (set! s5-0 (not (knocked-land-anim this arg1))) + (set! (-> this incoming blue-juggle-count) (the-as uint 0)) + ) + ((= v1-0 3) + (set! s5-0 (ja-done? 0)) + (let ((a0-9 (-> this skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ((= v1-0 4) + (vector-reset! (-> this root transv)) + (set! s5-0 #t) + ) + (else + (set! s5-0 #t) + ) + ) + ) + s5-0 + ) + +(defbehavior ja-group-index? enemy ((arg0 int)) + (ja-group? (-> self draw art-group data arg0)) + ) + +(defmethod enemy-method-123 ((this enemy)) + #t + ) + +(defmethod ragdoll-spawn! ((this enemy) (arg0 symbol) (arg1 symbol)) + (local-vars (s2-0 process)) + (with-pp + (when (and (enemy-method-123 this) (-> this enemy-info ragdoll-info)) + (let ((s3-0 (handle->process (-> this ragdoll-proc)))) + (cond + (s3-0 + (set! s2-0 s3-0) + ) + (else + (set! (-> this ragdoll-proc) + (ppointer->handle + (process-spawn + ragdoll-proc + (-> this enemy-info ragdoll-info) + :name "ragdoll-proc" + :to this + :stack-size #x5000 + ) + ) + ) + (set! s2-0 (handle->process (-> this ragdoll-proc))) + (when (not s2-0) + (format 0 "deactivated ~A because a ragdoll allocate failed~%" (-> this name)) + (deactivate this) + ) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag auto-death-phase-out) (-> this enemy-flags))) + ) + ) + ) + (when (and (-> this draw) (-> this draw shadow-ctrl)) + (let ((v1-29 (-> this draw shadow-ctrl))) + (logior! (-> v1-29 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (if (-> (the-as ragdoll-proc s2-0) ragdoll) + (logior! (-> (the-as ragdoll-proc s2-0) ragdoll ragdoll-flags) (ragdoll-flag rf3 rf4)) + ) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector-float*! s1-0 (-> this root transv) (seconds-per-frame)) + (if s3-0 + (ragdoll-proc-method-15 (the-as ragdoll-proc s2-0) arg1 (the-as vector #f) #f) + (ragdoll-proc-method-15 (the-as ragdoll-proc s2-0) arg1 (the-as vector #f) #t) + ) + (if arg0 + (ragdoll-method-23 + (-> (the-as ragdoll-proc s2-0) ragdoll) + (-> this incoming attack-position) + s1-0 + (-> this enemy-info ragdoll-rotate-velocity-mult) + #t + ) + ) + (vector-float*! s1-0 s1-0 (/ 1.0 (-> pp clock time-adjust-ratio))) + (let ((v0-1 (-> (the-as ragdoll-proc s2-0) ragdoll ragdoll-joints 0 velocity))) + (set! (-> v0-1 quad) (-> s1-0 quad)) + v0-1 + ) + ) + ) + ) + ) + ) + +(defmethod deactivate-ragdoll! ((this enemy)) + (when (and (enemy-method-123 this) (-> this enemy-info ragdoll-info)) + (let ((a0-3 (handle->process (-> this ragdoll-proc)))) + (when a0-3 + (when (and (-> this draw) (-> this draw shadow-ctrl)) + (let ((v1-14 (-> this draw shadow-ctrl))) + (logclear! (-> v1-14 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (deactivate a0-3) + ) + ) + ) + 0 + (none) + ) + +(defmethod ragdoll-settled? ((this enemy)) + (let ((s5-0 (handle->process (-> this ragdoll-proc)))) + (or (not s5-0) + (or (ragdoll-proc-method-19 (the-as ragdoll-proc s5-0)) + (and (time-elapsed? (-> this state-time) (seconds 0.1)) + (let ((f0-1 (if (= (-> this hit-points) 0.0) + 4096.0 + 49152.0 + ) + ) + (f1-2 (if (= (-> this hit-points) 0.0) + 364.0889 + 16384.0 + ) + ) + ) + (and (and (< (vector-length (-> (the-as ragdoll-proc s5-0) ragdoll ragdoll-joints 0 velocity)) + (* f0-1 (seconds-per-frame)) + ) + (< (cos (* f1-2 (seconds-per-frame))) (-> (the-as ragdoll-proc s5-0) ragdoll rotate-vel w)) + ) + (and (not (enemy-method-109 this)) (not (within-gspot-range? this))) + ) + ) + ) + ) + ) + ) + ) + +(defmethod disable-ragdoll ((this enemy)) + (let ((s5-0 (handle->process (-> this ragdoll-proc)))) + (when s5-0 + (disable-for-duration (the-as ragdoll-proc s5-0) (-> this enemy-info ragdoll-blend-out-time)) + (logclear! (-> (the-as ragdoll-proc s5-0) ragdoll ragdoll-flags) (ragdoll-flag rf9)) + (enemy-method-90 this (the-as ragdoll-proc s5-0)) + ) + ) + 0 + (none) + ) + +(defmethod should-move-to-ground? ((this enemy)) + (-> this enemy-info move-to-ground) + ) diff --git a/goal_src/jak3/engine/anim/aligner-h.gc b/goal_src/jak3/engine/anim/aligner-h.gc index 3c0d8a3235a..605bfdc09b1 100644 --- a/goal_src/jak3/engine/anim/aligner-h.gc +++ b/goal_src/jak3/engine/anim/aligner-h.gc @@ -68,9 +68,9 @@ (new (symbol type process) _type_) (compute-alignment! (_type_) transformq) (align! (_type_ align-opts float float float) trsqv) - (align-control-method-11 () none) - (align-control-method-12 () none) - (align-control-method-13 () none) + (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) + (first-transform (_type_) transform) + (second-transform (_type_) transform) ) ) diff --git a/goal_src/jak3/engine/anim/aligner.gc b/goal_src/jak3/engine/anim/aligner.gc index 5afca9863c5..82d31556334 100644 --- a/goal_src/jak3/engine/anim/aligner.gc +++ b/goal_src/jak3/engine/anim/aligner.gc @@ -7,3 +7,208 @@ ;; DECOMP BEGINS +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod compute-alignment! ((this align-control)) + (local-vars (a0-10 symbol) (s7-0 none) (ra-0 int)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (update-anim-data (-> this process skel)) + (let ((s5-0 (-> this process skel active-channels))) + (dotimes (s4-0 (the-as int s5-0)) + (let* ((a0-4 (-> this process skel channel s4-0)) + (v1-7 (-> a0-4 frame-group)) + ) + (case (-> a0-4 command) + (((joint-control-command stack) (joint-control-command stack1)) + ) + (else + (when (!= (-> v1-7 type) art-joint-anim) + (go process-drawable-art-error "align joint-anim") + ;; og:preserve-this + ;; (.lw ra-0 return-from-thread s7-0) + ;; (.jr ra-0) + (abandon-thread) + (nop!) + 0 + ) + ) + ) + ) + ) + ) + (let* ((a0-9 (-> this process skel root-channel 0)) + (v1-18 (-> a0-9 frame-group)) + (f0-0 (-> a0-9 frame-num)) + ) + (= (-> a0-9 num-func) num-func-loop!) + (cond + ((or (not v1-18) (!= (-> this frame-group) v1-18)) + (set! a0-10 #t) + ) + ((= (-> a0-9 num-func) num-func-loop!) + (set! a0-10 (< (* (-> a0-9 param 0) (- f0-0 (-> this frame-num))) 0.0)) + ) + (else + (set! a0-10 (= f0-0 0.0)) + ) + ) + (if a0-10 + (logior! (-> this flags) (align-flags disabled)) + (logclear! (-> this flags) (align-flags disabled)) + ) + (set! (-> this frame-group) v1-18) + (set! (-> this frame-num) f0-0) + ) + (mem-copy! (the-as pointer (-> this transform 1)) (the-as pointer (-> this transform)) 48) + (quaternion-copy! (the-as quaternion (-> this transform 1 rot)) (-> this align quat)) + (set! (-> this transform 1 scale quad) (-> this align scale quad)) + (let* ((a2-5 (-> this matrix 1)) + (a3-0 (-> this matrix)) + (v1-21 (-> a3-0 0 rvec quad)) + (a0-19 (-> a3-0 0 uvec quad)) + (a1-13 (-> a3-0 0 fvec quad)) + (a3-1 (-> a3-0 0 trans quad)) + ) + (set! (-> a2-5 rvec quad) v1-21) + (set! (-> a2-5 uvec quad) a0-19) + (set! (-> a2-5 fvec quad) a1-13) + (set! (-> a2-5 trans quad) a3-1) + ) + (let ((s5-1 (-> this process node-list data 1))) + (cspace<-matrix-no-push-joint! s5-1 (-> this process skel)) + (let* ((v1-25 (-> this matrix)) + (a3-2 (-> s5-1 bone transform)) + (a0-22 (-> a3-2 rvec quad)) + (a1-15 (-> a3-2 uvec quad)) + (a2-6 (-> a3-2 fvec quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> v1-25 0 rvec quad) a0-22) + (set! (-> v1-25 0 uvec quad) a1-15) + (set! (-> v1-25 0 fvec quad) a2-6) + (set! (-> v1-25 0 trans quad) a3-3) + ) + (let ((v1-26 (-> this transform))) + (let ((a0-24 (-> s5-1 bone transform trans)) + (a1-18 (-> this process root scale)) + ) + (.lvf vf4 (&-> a0-24 quad)) + (.lvf vf5 (&-> a1-18 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-26 0 trans quad) vf6) + ) + ) + (vector-! + (the-as vector (-> this delta)) + (the-as vector (-> this transform)) + (the-as vector (-> this transform 1)) + ) + (set-vector! + (-> this align scale) + (vector-length (the-as vector (-> this matrix))) + (vector-length (-> this matrix 0 uvec)) + (vector-length (-> this matrix 0 fvec)) + 1.0 + ) + (vector-! (-> this delta scale) (-> this align scale) (-> this transform 1 scale)) + (let ((a2-7 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> this align scale)))) + (quaternion-normalize! + (matrix->quaternion (-> this align quat) (matrix*! a2-7 (the-as matrix (-> this matrix)) a2-7)) + ) + ) + (let ((a1-27 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot)))) + ) + (quaternion-normalize! (quaternion*! (-> this delta quat) a1-27 (-> this align quat))) + ) + (-> this delta) + ) + ) + +;; WARN: Return type mismatch (inline-array transform) vs transform. +(defmethod first-transform ((this align-control)) + (the-as transform (-> this transform)) + ) + +(defmethod second-transform ((this align-control)) + (-> this transform 1) + ) + +(defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float)) + (when (not (logtest? (-> this flags) (align-flags disabled))) + (let* ((a0-1 (-> this process)) + (t9-0 (method-of-object a0-1 apply-alignment)) + (v1-4 (-> this delta)) + (t1-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> t1-0 x) arg1) + (set! (-> t1-0 y) arg2) + (set! (-> t1-0 z) arg3) + (set! (-> t1-0 w) 1.0) + (t9-0 a0-1 arg0 v1-4 t1-0) + ) + ) + (-> this process root) + ) + +(defmethod set-and-limit-velocity ((this trsqv) (arg0 int) (arg1 vector) (arg2 float)) + (with-pp + (let ((a0-1 (-> this transv))) + (when (logtest? arg0 4) + (set! (-> a0-1 x) (-> arg1 x)) + (set! (-> a0-1 z) (-> arg1 z)) + (let* ((v1-2 arg1) + (f0-8 + (fmin + (* (sqrtf (+ (* (-> v1-2 x) (-> v1-2 x)) (* (-> v1-2 z) (-> v1-2 z)))) (-> pp clock frames-per-second)) + arg2 + ) + ) + ) + (vector-xz-normalize! a0-1 f0-8) + ) + ) + ) + this + ) + ) + +(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) + (with-pp + (when (not (logtest? (-> this flags) (align-flags disabled))) + (let ((s5-0 (-> this delta))) + (let ((a0-1 (-> this process root transv))) + (if (logtest? arg0 (align-opts adjust-y-vel)) + (set! (-> a0-1 y) (* (-> s5-0 trans y) arg3 (-> pp clock frames-per-second))) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a0-1 x) (-> arg1 x)) + (set! (-> a0-1 z) (-> arg1 z)) + (let* ((v1-11 arg1) + (f0-9 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + (v1-13 (-> s5-0 trans)) + (f0-11 (* (fmin f0-9 (* (sqrtf (+ (* (-> v1-13 x) (-> v1-13 x)) (* (-> v1-13 z) (-> v1-13 z)))) arg4)) + (-> pp clock frames-per-second) + ) + ) + (t9-0 vector-xz-normalize!) + ) + (set! (-> this last-speed) f0-11) + (t9-0 a0-1 f0-11) + ) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat))) + ) + ) + ) + (-> this process root) + ) + ) diff --git a/goal_src/jak3/engine/anim/fma-sphere.gc b/goal_src/jak3/engine/anim/fma-sphere.gc index 3e25c4e8c69..a7b27885144 100644 --- a/goal_src/jak3/engine/anim/fma-sphere.gc +++ b/goal_src/jak3/engine/anim/fma-sphere.gc @@ -75,7 +75,7 @@ (vehicle-impulse-factor 1.0) (mode 'eco-red) (attacker-velocity (-> self root transv)) - (knock (knocked-type knocked-type-2)) + (knock (knocked-type explode-or-darkjak)) ) ) ) diff --git a/goal_src/jak3/engine/anim/joint-exploder.gc b/goal_src/jak3/engine/anim/joint-exploder.gc index 9854c30ce89..971ada90822 100644 --- a/goal_src/jak3/engine/anim/joint-exploder.gc +++ b/goal_src/jak3/engine/anim/joint-exploder.gc @@ -7,3 +7,834 @@ ;; DECOMP BEGINS +(deftype joint-exploder-tuning (structure) + ((explosion uint64) + (duration time-frame) + (gravity float) + (rot-speed float) + (bounds-inflate float) + (max-probes uint8) + (max-probe-width float) + (max-probe-height float) + (max-probe-depth float) + (friction float) + (fountain-rand-transv-lo vector :inline) + (fountain-rand-transv-hi vector :inline) + (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) + (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi data 0)) + (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi data 1)) + (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi data 2)) + (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi data 3)) + (hit-xz-reaction float) + (hit-y-reaction float) + ) + (:methods + (new (symbol type uint) _type_) + ) + ) + + +(deftype joint-exploder-static-joint-params (structure) + ((joint-index int16) + (parent-joint-index int16) + ) + ) + + +(deftype joint-exploder-static-params (basic) + ((joints (array joint-exploder-static-joint-params)) + (collide-spec collide-spec) + (art-level symbol) + (collide-sound sound-name) + (collide-sound-interval time-frame) + ) + ) + + +(deftype joint-exploder-joint (structure) + ((next int16) + (prev int16) + (joint-index int16) + (mat matrix :inline) + (rmat matrix :inline) + (update-rmat matrix :inline) + (transv vector :inline) + (prev-pos vector :inline) + ) + ) + + +(deftype joint-exploder-joints (basic) + ((num-joints int32) + (joint joint-exploder-joint :inline :dynamic) + ) + (:methods + (new (symbol type joint-exploder-static-params) _type_) + ) + ) + + +(deftype joint-exploder-list (structure) + ((head int32) + (pre-moved? symbol) + (bbox-valid? symbol) + (probeless? symbol) + (bbox bounding-box :inline) + ) + ) + + +(deftype joint-exploder-list-array (inline-array-class) + ((data joint-exploder-list :inline :dynamic) + ) + ) + + +(set! (-> joint-exploder-list-array heap-base) (the-as uint 48)) + +(deftype joint-exploder (process-drawable) + ((parent (pointer process-drawable) :override) + (die-if-below-y float) + (die-if-beyond-xz-dist-sqrd float) + (joints joint-exploder-joints) + (static-params joint-exploder-static-params) + (anim art-joint-anim) + (scale-vector vector :inline) + (tuning joint-exploder-tuning :inline) + (lists joint-exploder-list-array) + (last-colsound-time time-frame) + ) + (:methods + (add-joint-to-list (_type_ joint-exploder-list int) int) + (update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none) + (do-collision-response (_type_ joint-exploder-list) none) + (init-joint-list (_type_) none) + (remove-from-list-and-reset (_type_ joint-exploder-list int) int) + (final-adjust (_type_ joint-exploder-list int) int) + (integrate-and-kill (_type_ joint-exploder-list) none) + (remove-joint-from-list (_type_ joint-exploder-list int) int) + (adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list) + (adjust-bbox-for-limits (_type_ joint-exploder-list) none) + ) + (:states + joint-exploder-shatter + ) + ) + + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this joint-exploder-joints)) + (the-as int (+ (-> this type size) (* 240 (-> this num-joints)))) + ) + +(defmethod new joint-exploder-joints ((allocation symbol) (type-to-make type) (arg0 joint-exploder-static-params)) + (let* ((gp-0 (-> arg0 joints length)) + (v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 240 gp-0))))) + ) + (set! (-> v0-0 num-joints) gp-0) + v0-0 + ) + ) + +(defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + (let ((s4-0 (the-as joint-exploder (-> arg0 process)))) + (let ((s3-0 (-> s4-0 joints))) + (countdown (s2-0 (-> s3-0 num-joints)) + (let* ((v1-3 (-> s3-0 joint s2-0)) + (a0-5 (-> arg1 data (-> v1-3 joint-index) bone transform)) + ) + (matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat)) + ) + ) + ) + (let ((s4-1 (-> s4-0 scale-vector))) + (countdown (s3-1 (-> arg1 length)) + (let ((a2-2 (-> arg1 data s3-1 bone transform))) + (scale-matrix! a2-2 s4-1 a2-2) + ) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix))) + (set! (-> s4-2 rvec quad) (the-as uint128 0)) + (set! (-> s4-2 uvec quad) (the-as uint128 0)) + (set! (-> s4-2 fvec quad) (the-as uint128 0)) + (set! (-> s4-2 trans quad) (the-as uint128 0)) + (let ((f30-0 (-> arg0 bounds w))) + (matrix-4x4-inverse! s4-2 (-> arg1 data 0 bone transform)) + (set! (-> arg0 bounds w) 1.0) + (vector-matrix*! (-> arg0 bounds) (-> arg0 bounds) s4-2) + (set! (-> arg0 bounds w) f30-0) + ) + ) + 0 + (none) + ) + +(defmethod remove-from-list-and-reset ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let ((v0-0 (remove-joint-from-list this arg0 arg1))) + (let* ((v1-1 (-> this joints)) + (v1-2 (-> v1-1 joint arg1)) + ) + (set! (-> v1-2 mat rvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat uvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat fvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat trans quad) (-> this root trans quad)) + ) + v0-0 + ) + ) + +(defmethod remove-joint-from-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let* ((v1-0 (-> this joints)) + (a2-1 (-> v1-0 joint arg1)) + (a0-4 (-> a2-1 prev)) + (v0-0 (-> a2-1 next)) + ) + (cond + ((>= a0-4 0) + (set! (-> v1-0 joint a0-4 next) v0-0) + (if (>= v0-0 0) + (set! (-> v1-0 joint v0-0 prev) a0-4) + ) + ) + (else + (set! (-> arg0 head) v0-0) + (cond + ((>= v0-0 0) + (let ((v1-2 (-> v1-0 joint v0-0))) + (set! (-> v1-2 prev) -1) + ) + ) + (else + (set! (-> arg0 bbox-valid?) #f) + ) + ) + ) + ) + v0-0 + ) + ) + +(defmethod add-joint-to-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let* ((v1-0 (-> this joints)) + (a3-0 (-> v1-0 joint arg1)) + (a0-4 (-> arg0 head)) + ) + (set! (-> arg0 head) arg1) + (set! (-> a3-0 prev) -1) + (set! (-> a3-0 next) a0-4) + (when (>= a0-4 0) + (set! (-> v1-0 joint a0-4 prev) arg1) + arg1 + ) + ) + ) + +(defmethod update-bbox-for-joint ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint)) + (let ((a1-1 (-> arg1 mat trans))) + (cond + ((-> arg0 bbox-valid?) + (add-point! (-> arg0 bbox) a1-1) + ) + (else + (set! (-> arg0 bbox-valid?) #t) + (set! (-> arg0 bbox min quad) (-> a1-1 quad)) + (set! (-> arg0 bbox max quad) (-> a1-1 quad)) + ) + ) + ) + (add-point! (-> arg0 bbox) (-> arg1 prev-pos)) + (none) + ) + +;; WARN: Return type mismatch object vs joint-exploder-list. +(defmethod adjust-bbox-for-limits-along-axis ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (local-vars + (sv-16 int) + (sv-32 int) + (sv-48 joint-exploder-joint) + (sv-64 int) + (sv-80 joint-exploder-joint) + (sv-96 int) + (sv-112 joint-exploder-joint) + ) + (let ((s4-0 (the-as object #f))) + (let ((v1-0 1)) + (until (= v1-0 (+ (-> this tuning max-probes) 1)) + (let ((a0-4 (-> this lists data v1-0))) + (when (< (-> a0-4 head) 0) + (set! s4-0 a0-4) + (goto cfg-6) + ) + ) + (+! v1-0 1) + ) + ) + (label cfg-6) + (cond + ((the-as joint-exploder-list s4-0) + (set! (-> (the-as joint-exploder-list s4-0) pre-moved?) #t) + (set! (-> (the-as joint-exploder-list s4-0) bbox-valid?) #f) + ) + (else + (set! s4-0 (-> this lists data)) + ) + ) + (set! (-> arg0 bbox-valid?) #f) + (let ((s2-0 (-> this joints))) + (set! sv-32 (-> arg0 head)) + (let ((s1-0 0) + (s0-0 0) + ) + (let ((v1-8 arg1)) + (cond + ((zero? v1-8) + (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) + (while (>= sv-32 0) + (set! sv-48 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-48 mat trans x) f30-0) + (set! sv-16 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-16) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-48) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-48) + (set! sv-32 (-> sv-48 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ((= v1-8 1) + (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) + (while (>= sv-32 0) + (set! sv-80 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-80 mat trans y) f30-1) + (set! sv-64 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-64) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-80) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-80) + (set! sv-32 (-> sv-80 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ((= v1-8 2) + (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) + (while (>= sv-32 0) + (set! sv-112 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-112 mat trans z) f30-2) + (set! sv-96 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-96) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-112) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-112) + (set! sv-32 (-> sv-112 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ) + ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) + (final-adjust this (the-as joint-exploder-list s4-0) arg1) + ) + ) + ) + ) + ) + (the-as joint-exploder-list s4-0) + ) + ) + +;; WARN: Return type mismatch symbol vs int. +(defmethod final-adjust ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (local-vars (sv-48 int) (sv-64 (inline-array joint-exploder-list)) (sv-80 joint-exploder-joint)) + (set! (-> arg0 bbox-valid?) #f) + (let ((s3-0 (-> this joints)) + (s2-0 (-> arg0 head)) + ) + (while (>= s2-0 0) + (set! sv-80 (-> s3-0 joint s2-0)) + (let ((s1-0 (new 'stack-no-clear 'bounding-box)) + (s0-0 (-> arg0 bbox-valid?)) + ) + (set! (-> s1-0 min quad) (-> arg0 bbox min quad)) + (set! (-> s1-0 max quad) (-> arg0 bbox max quad)) + (update-bbox-for-joint this arg0 sv-80) + (let* ((v1-7 arg1) + (v1-8 (cond + ((zero? v1-7) + (< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x))) + ) + ((= v1-7 1) + (< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y))) + ) + ((= v1-7 2) + (< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z))) + ) + ) + ) + ) + (set! s2-0 (cond + (v1-8 + (set! sv-48 (remove-joint-from-list this arg0 s2-0)) + (set! sv-64 (-> this lists data)) + (add-joint-to-list this (the-as joint-exploder-list sv-64) s2-0) + (set! s2-0 sv-48) + (update-bbox-for-joint this (the-as joint-exploder-list sv-64) sv-80) + (set! (-> arg0 bbox-valid?) s0-0) + (set! (-> arg0 bbox min quad) (-> s1-0 min quad)) + (set! (-> arg0 bbox max quad) (-> s1-0 max quad)) + s2-0 + ) + (else + (-> sv-80 next) + ) + ) + ) + ) + ) + ) + ) + (the-as int #f) + ) + +(defmethod adjust-bbox-for-limits ((this joint-exploder) (arg0 joint-exploder-list)) + (when (and (-> arg0 bbox-valid?) (>= (-> arg0 head) 0) (not (-> arg0 probeless?))) + (let ((a2-0 -1)) + (cond + ((< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x))) + (set! a2-0 0) + ) + ((< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y))) + (set! a2-0 1) + ) + ((< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z))) + (set! a2-0 2) + ) + ) + (when (>= a2-0 0) + (let ((a1-2 (adjust-bbox-for-limits-along-axis this arg0 a2-0))) + (if (not (-> a1-2 probeless?)) + (adjust-bbox-for-limits this a1-2) + ) + ) + (adjust-bbox-for-limits this arg0) + ) + ) + ) + 0 + (none) + ) + +(defmethod integrate-and-kill ((this joint-exploder) (arg0 joint-exploder-list)) + (local-vars (v1-8 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (set! (-> arg0 bbox-valid?) #f) + (set! (-> arg0 pre-moved?) #t) + (let ((s4-0 (-> this joints)) + (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) + (s3-0 (-> arg0 head)) + ) + (while (>= s3-0 0) + (let* ((s2-0 (-> s4-0 joint s3-0)) + (s1-0 (-> s2-0 mat trans)) + ) + (set! (-> s2-0 prev-pos quad) (-> s1-0 quad)) + (+! (-> s2-0 transv y) f30-0) + (when (< 0.0 (-> this tuning friction)) + (.lvf vf1 (&-> (-> s2-0 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-8 vf1) + (let* ((f0-4 v1-8) + (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) + (f0-6 (- (sqrtf f0-4) f1-5)) + ) + (if (< f0-6 0.0) + (set! f0-6 0.0) + ) + (vector-normalize! (-> s2-0 transv) f0-6) + ) + ) + (vector-v+! s1-0 s1-0 (-> s2-0 transv)) + (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) + (cond + ((or (< (-> s1-0 y) (-> this die-if-below-y)) + (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) + ) + (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + ) + (else + (update-bbox-for-joint this arg0 s2-0) + (set! s3-0 (-> s2-0 next)) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod do-collision-response ((this joint-exploder) (arg0 joint-exploder-list)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s5-0 collide-with) (-> this static-params collide-spec)) + (set! (-> s5-0 ignore-process0) this) + (set! (-> s5-0 ignore-process1) #f) + (set! (-> s5-0 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s5-0 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s5-0 bbox)) (the-as pointer (-> arg0 bbox)) 32) + (fill-using-bounding-box *collide-cache* s5-0) + ) + (let ((s5-1 (-> this joints)) + (v1-6 (-> arg0 head)) + ) + (while (>= v1-6 0) + (let ((s4-1 (-> s5-1 joint v1-6))) + (let ((s3-0 (-> s4-1 mat trans)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (vector-! (-> s2-0 move-dist) s3-0 (-> s4-1 prev-pos)) + (set! (-> s2-0 start-pos quad) (-> s4-1 prev-pos quad)) + (let ((v1-11 s2-0)) + (set! (-> v1-11 radius) 40.96) + (set! (-> v1-11 collide-with) (-> this static-params collide-spec)) + (set! (-> v1-11 ignore-process0) #f) + (set! (-> v1-11 ignore-process1) #f) + (set! (-> v1-11 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-11 action-mask) (collide-action solid)) + ) + (when (>= (probe-using-line-sphere *collide-cache* s2-0) 0.0) + (set! (-> s3-0 quad) (-> s2-0 best-other-tri intersect quad)) + (let* ((v1-16 (-> s4-1 transv)) + (f28-0 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + ) + (vector-reflect! (-> s4-1 transv) (-> s4-1 transv) (-> s2-0 best-other-tri normal)) + (let ((f30-0 (-> s4-1 transv y))) + (set! (-> s4-1 transv y) 0.0) + (vector-normalize! (-> s4-1 transv) (* f28-0 (-> this tuning hit-xz-reaction))) + (set! (-> s4-1 transv y) (* f30-0 (-> this tuning hit-y-reaction))) + ) + ) + (let ((v1-20 (-> this static-params collide-sound))) + (when (and v1-20 + (nonzero? v1-20) + (< (-> this static-params collide-sound-interval) (- (current-time) (-> this last-colsound-time))) + ) + (sound-play-by-name + (-> this static-params collide-sound) + (new-sound-id) + 1024 + 0 + 0 + (sound-group) + (-> s4-1 transv) + ) + (set-time! (-> this last-colsound-time)) + ) + ) + (+! (-> s3-0 y) (* 40.96 (-> s2-0 best-other-tri normal y))) + (set! (-> s3-0 w) 1.0) + (matrix-lerp! (-> s4-1 update-rmat) (-> s4-1 update-rmat) *identity-matrix* 0.5) + ) + ) + (set! v1-6 (-> s4-1 next)) + ) + ) + ) + 0 + (none) + ) + +(defstate joint-exploder-shatter (joint-exploder) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (let* ((f1-0 (the float (- (current-time) (-> self state-time)))) + (f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration))))) + (f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))) + (f1-3 (fmax 0.0001 f1-2)) + (f0-3 (fmax 0.0001 f0-2)) + ) + (set-vector! (-> self scale-vector) f0-3 f1-3 f0-3 1.0) + ) + (dotimes (v1-11 (the-as int (+ (-> self tuning max-probes) 1))) + (set! (-> self lists data v1-11 pre-moved?) #f) + ) + (dotimes (gp-0 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((s5-0 (-> self lists data gp-0))) + (when (>= (-> s5-0 head) 0) + (when (not (-> s5-0 pre-moved?)) + (integrate-and-kill self s5-0) + (if (nonzero? gp-0) + (adjust-bbox-for-limits self s5-0) + ) + ) + ) + ) + ) + (let ((gp-1 (new 'stack-no-clear 'bounding-box))) + (let ((v1-31 (-> self root trans))) + (set! (-> gp-1 min quad) (-> v1-31 quad)) + (set! (-> gp-1 max quad) (-> v1-31 quad)) + ) + (dotimes (s5-1 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((s4-0 (-> self lists data s5-1))) + (if (-> s4-0 bbox-valid?) + (add-box! gp-1 (-> s4-0 bbox)) + ) + (if (nonzero? s5-1) + (do-collision-response self s4-0) + ) + ) + ) + (let ((s5-2 (-> self draw bounds))) + (vector-average! s5-2 (-> gp-1 min) (-> gp-1 max)) + (set! (-> s5-2 w) (+ (vector-vector-distance s5-2 (-> gp-1 max)) (-> self tuning bounds-inflate))) + ) + ) + 0 + ) + :code (behavior () + (set-time! (-> self state-time)) + (until (time-elapsed? (-> self state-time) (-> self tuning duration)) + (suspend) + (ja :num! (loop!)) + ) + ) + :post ja-post + ) + +(defmethod init-joint-list ((this joint-exploder)) + (let ((gp-0 (-> this joints))) + (dotimes (s4-0 (-> gp-0 num-joints)) + (let ((v1-2 (-> this static-params joints s4-0)) + (s3-0 (-> gp-0 joint s4-0)) + ) + (let ((a0-6 (-> v1-2 parent-joint-index))) + (set! (-> s3-0 prev) (+ s4-0 -1)) + (set! (-> s3-0 next) (+ s4-0 1)) + (set! (-> s3-0 joint-index) (-> v1-2 joint-index)) + (cond + ((>= a0-6 0) + (if (zero? a0-6) + (set! a0-6 (-> v1-2 joint-index)) + ) + (let* ((a3-0 (-> this parent 0 node-list data a0-6 bone transform)) + (a2-0 (-> s3-0 mat)) + (v1-9 (-> a3-0 rvec quad)) + (a0-8 (-> a3-0 uvec quad)) + (a1-4 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 rvec quad) v1-9) + (set! (-> a2-0 uvec quad) a0-8) + (set! (-> a2-0 fvec quad) a1-4) + (set! (-> a2-0 trans quad) a3-1) + ) + (matrix-identity! (-> s3-0 rmat)) + ) + (else + (let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform)) + (a2-1 (-> s3-0 mat)) + (v1-15 (-> a3-2 rvec quad)) + (a0-11 (-> a3-2 uvec quad)) + (a1-5 (-> a3-2 fvec quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> a2-1 rvec quad) v1-15) + (set! (-> a2-1 uvec quad) a0-11) + (set! (-> a2-1 fvec quad) a1-5) + (set! (-> a2-1 trans quad) a3-3) + ) + (matrix-identity! (-> s3-0 rmat)) + ) + ) + ) + (case (-> this tuning explosion) + ((1) + (vector-! (-> s3-0 transv) (-> s3-0 mat trans) (-> this tuning fountain-rand-transv-lo)) + (vector-normalize! + (-> s3-0 transv) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y)) + ) + (+! (-> s3-0 transv y) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w)) + ) + (set! (-> s3-0 transv w) 1.0) + ) + (else + (let ((s0-0 (-> this tuning fountain-rand-transv-lo)) + (s1-1 (-> this tuning fountain-rand-transv-hi)) + ) + (set-vector! + (-> s3-0 transv) + (rand-vu-float-range (-> s0-0 x) (-> s1-1 x)) + (rand-vu-float-range (-> s0-0 y) (-> s1-1 y)) + (rand-vu-float-range (-> s0-0 z) (-> s1-1 z)) + 1.0 + ) + ) + ) + ) + (let ((s2-3 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'quaternion)) + ) + (rand-vu-sphere-point-uniform! s2-3 1.0) + (vector-normalize! s2-3 1.0) + (quaternion-vector-angle! s1-2 s2-3 (* 182.04445 (-> this tuning rot-speed))) + (quaternion->matrix (-> s3-0 update-rmat) s1-2) + ) + ) + ) + (when (nonzero? (-> gp-0 num-joints)) + (let ((v1-31 (-> gp-0 joint (+ (-> gp-0 num-joints) -1)))) + (set! (-> v1-31 next) -1) + ) + (let ((v1-33 (-> this lists data 1))) + (set! (-> v1-33 head) 0) + (let ((s5-1 (-> v1-33 bbox))) + (let ((v1-34 (-> gp-0 joint 0 mat trans))) + (set! (-> s5-1 min quad) (-> v1-34 quad)) + (set! (-> s5-1 max quad) (-> v1-34 quad)) + ) + (dotimes (s4-1 (-> gp-0 num-joints)) + (add-point! s5-1 (the-as vector (+ (the-as uint (-> gp-0 joint 0 mat trans)) (* 240 s4-1)))) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch process-drawable vs joint-exploder. +(defmethod relocate ((this joint-exploder) (offset int)) + (if (nonzero? (-> this joints)) + (&+! (-> this joints) offset) + ) + (if (nonzero? (-> this lists)) + (&+! (-> this lists) offset) + ) + (the-as joint-exploder ((method-of-type process-drawable relocate) this offset)) + ) + +(defbehavior joint-exploder-init-by-other joint-exploder ((arg0 skeleton-group) (arg1 int) (arg2 joint-exploder-tuning) (arg3 joint-exploder-static-params)) + (set! (-> self static-params) arg3) + (set! (-> self die-if-beyond-xz-dist-sqrd) 10485760000.0) + (mem-copy! (the-as pointer (-> self tuning)) (the-as pointer arg2) 88) + (set! (-> self joints) (new 'process 'joint-exploder-joints arg3)) + (set! (-> self lists) + (new 'process 'joint-exploder-list-array (the-as int (+ (-> self tuning max-probes) 1))) + ) + (dotimes (v1-4 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((a0-7 (-> self lists data v1-4))) + (set! (-> a0-7 head) -1) + (set! (-> a0-7 bbox-valid?) #f) + (set! (-> a0-7 pre-moved?) #f) + (set! (-> a0-7 probeless?) #f) + ) + ) + (let ((v1-8 (-> self lists data))) + (set! (-> v1-8 0 probeless?) #t) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> self parent 0 root trans quad)) + (quaternion-copy! (-> self root quat) (-> self parent 0 root quat)) + (set! (-> self root scale quad) (-> self parent 0 root scale quad)) + (when (-> arg3 art-level) + (let ((a1-8 (entity-actor-from-level-name (-> arg3 art-level)))) + (if a1-8 + (process-entity-set! self a1-8) + ) + ) + ) + (initialize-skeleton self arg0 (the-as pair 0)) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! (-> self anim) (the-as art-joint-anim (-> self draw art-group data arg1))) + (ja-channel-set! 1) + (ja :group! (-> self anim) :num! min) + (ja-post) + (init-joint-list self) + (set! (-> self die-if-below-y) (+ -102400.0 (-> self root trans y))) + (set! (-> self skel postbind-function) joint-exploder-joint-callback) + (set! (-> self last-colsound-time) 0) + (go joint-exploder-shatter) + ) + +;; WARN: Return type mismatch structure vs joint-exploder-tuning. +(defmethod new joint-exploder-tuning ((allocation symbol) (type-to-make type) (arg0 uint)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((v0-0 (t9-0 allocation v1-1))) + (set! (-> (the-as joint-exploder-tuning v0-0) explosion) arg0) + (set! (-> (the-as joint-exploder-tuning v0-0) duration) (seconds 2)) + (set! (-> (the-as joint-exploder-tuning v0-0) gravity) -286720.0) + (set! (-> (the-as joint-exploder-tuning v0-0) rot-speed) 8.4) + (set! (-> (the-as joint-exploder-tuning v0-0) friction) 0.0) + (set! (-> (the-as joint-exploder-tuning v0-0) bounds-inflate) 16384.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-width) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-height) 24576.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-depth) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probes) (the-as uint 4)) + (set! (-> (the-as joint-exploder-tuning v0-0) hit-xz-reaction) 0.75) + (set! (-> (the-as joint-exploder-tuning v0-0) hit-y-reaction) 0.7) + (cond + ((zero? arg0) + (set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0) + (set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0) + ) + ((= arg0 1) + (vector-reset! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo)) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi x) 49152.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi y) 163840.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi z) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi w) 61440.0) + ) + ) + (the-as joint-exploder-tuning v0-0) + ) + ) + ) diff --git a/goal_src/jak3/engine/anim/joint.gc b/goal_src/jak3/engine/anim/joint.gc index e0ce96764ba..8621382c1e6 100644 --- a/goal_src/jak3/engine/anim/joint.gc +++ b/goal_src/jak3/engine/anim/joint.gc @@ -1354,6 +1354,7 @@ "Remove all animations that are stored on the given heap and return those slots to a safe default." (let ((v1-0 (-> heap base)) (a1-1 (-> heap top-base)) + (v0-0 #f) ) (countdown (a3-1 (+ (-> jc active-channels) (-> jc float-channels))) (let ((t0-3 (-> jc channel a3-1))) @@ -1363,12 +1364,12 @@ (set! (-> t0-3 frame-group) ja) (set! (-> t0-3 frame-num) 0.0) (set! (-> t0-3 num-func) num-func-identity) - #t + (set! v0-0 #t) ) ) ) + v0-0 ) - (none) ) (defbehavior joint-control-channel-eval process ((jcc joint-control-channel)) @@ -2274,8 +2275,8 @@ (let ((a0-9 (-> jc interp-select 0))) (dotimes (a1-5 2) (when (logtest? a0-9 1) - (let* ((a2-7 (the-as object (-> dst matrices a1-5 rvec))) - (t2-0 (the-as (inline-array vector) (-> v1-9 matrices a1-5 rvec))) + (let* ((a2-7 (the-as object (-> dst matrices a1-5))) + (t2-0 (the-as (inline-array vector) (-> v1-9 matrices a1-5))) (a3-3 (-> t2-0 0 quad)) (t0-0 (-> t2-0 1 quad)) (t1-0 (-> t2-0 2 quad)) diff --git a/goal_src/jak3/engine/camera/pov-camera-h.gc b/goal_src/jak3/engine/camera/pov-camera-h.gc index 8f6066aa172..b46403126e6 100644 --- a/goal_src/jak3/engine/camera/pov-camera-h.gc +++ b/goal_src/jak3/engine/camera/pov-camera-h.gc @@ -17,7 +17,9 @@ ;; ---pov-camera-flag (declare-type pov-camera process-drawable) +(declare-type othercam process) (define-extern pov-camera-init-by-other (function vector skeleton-group string pov-camera-flag process-drawable pair none :behavior pov-camera)) +(define-extern othercam-init-by-other (function pov-camera int symbol symbol none :behavior othercam)) ;; DECOMP BEGINS @@ -39,10 +41,10 @@ pov-camera-startup ) (:methods - (pov-camera-method-25 () none) - (pov-camera-method-26 () none) - (pov-camera-method-27 () none) - (pov-camera-method-28 () none) - (pov-camera-method-29 () none) + (abort? (_type_) symbol) + (target-grabbed? (_type_) symbol) + (set-stack-size! (_type_) none) + (pov-camera-method-28 (_type_) none) + (target-released? (_type_) symbol) ) ) diff --git a/goal_src/jak3/engine/camera/pov-camera.gc b/goal_src/jak3/engine/camera/pov-camera.gc index a418962b519..ddbb0085660 100644 --- a/goal_src/jak3/engine/camera/pov-camera.gc +++ b/goal_src/jak3/engine/camera/pov-camera.gc @@ -7,3 +7,405 @@ ;; DECOMP BEGINS +(defmethod abort? ((this pov-camera)) + (when (or (and (time-elapsed? (-> this debounce-start-time) (seconds 0.2)) (cpad-pressed? 0 triangle)) + (logtest? (-> this flags) (pov-camera-flag allow-abort)) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (when (logtest? (-> this flags) (pov-camera-flag notify-of-abort)) + (send-event (handle->process (-> this notify-handle)) 'notify 'abort-request) + #t + ) + ) + ) + +(defmethod target-grabbed? ((this pov-camera)) + (or (not *target*) (process-grab? *target* #f)) + ) + +(defmethod target-released? ((this pov-camera)) + (or (not *target*) (process-release? *target*)) + ) + +(defstate pov-camera-startup (pov-camera) + :virtual #t + :code (behavior () + (go-virtual pov-camera-start-playing) + ) + ) + +(defstate pov-camera-start-playing (pov-camera) + :virtual #t + :code (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not (logtest? (-> self flags) (pov-camera-flag pcf3))) + (while (not (target-grabbed? self)) + (suspend) + ) + ) + (let ((gp-0 0)) + (let ((v1-10 (the-as joint (get-art-by-name-method (-> self draw jgeo) "camera" (the-as type #f))))) + (if v1-10 + (set! gp-0 (+ (-> v1-10 number) 1)) + ) + ) + (let ((v1-13 (process-spawn othercam self gp-0 #t #t :name "othercam" :to self))) + (send-event (ppointer->process v1-13) 'mask (-> self mask-to-clear)) + ) + ) + (go-virtual pov-camera-playing) + ) + ) + +(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float)) + (let ((s4-0 #f)) + (ja-no-eval :group! arg0 :num! (seek! max arg2) :frame-num 0.0) + (until (ja-done? 0) + (let ((v1-4 (and (not s4-0) (< (the float (+ (-> (ja-group) frames num-frames) -4)) (ja-frame-num 0))))) + (when v1-4 + (set! s4-0 #t) + (send-event *camera* 'teleport-to-vector-start-string arg1) + ) + ) + (suspend) + (ja :num! (seek! max arg2)) + ) + ) + 0 + (none) + ) + +(defstate pov-camera-playing (pov-camera) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('abort) + (when (logtest? (-> self flags) (pov-camera-flag notify-of-abort)) + (logior! (-> self flags) (pov-camera-flag allow-abort)) + (if (= (-> self anim-name type) string) + (go-virtual pov-camera-abort) + ) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self debounce-start-time)) + (if (= (-> self anim-name type) string) + (backup-load-state-and-set-cmds *load-state* (-> self command-list)) + ) + ) + :exit (behavior () + (if (= (-> self anim-name type) string) + (restore-load-state-and-cleanup *load-state*) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + ) + :code (behavior () + (add-setting! 'music-volume 'rel (-> self music-volume-movie) 0) + (add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0) + (cond + ((= (-> self anim-name type) string) + (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (abort? self) + (suspend) + (ja :num! (seek!)) + ) + ) + ((= (-> self anim-name type) spool-anim) + (ja-play-spooled-anim + (the-as spool-anim (-> self anim-name)) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (method-of-object self abort?) + (spooler-flags blackout-on-stall) + ) + ) + ) + (go-virtual pov-camera-done-playing) + ) + :post (behavior () + (if (= (-> self anim-name type) string) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + ) + (ja-post) + ) + ) + +(defstate pov-camera-abort (pov-camera) + :virtual #t + :enter (behavior () + (logior! (-> self flags) (pov-camera-flag allow-abort)) + ) + :code (behavior () + (set-blackout-frames (seconds 0.035)) + (suspend) + (suspend) + (go-virtual pov-camera-done-playing) + ) + ) + +(defstate pov-camera-done-playing (pov-camera) + :virtual #t + :code (behavior () + (while (not (target-released? self)) + (suspend) + ) + (send-event (handle->process (-> self notify-handle)) 'notify 'die) + (suspend) + (suspend) + (cleanup-for-death self) + (deactivate self) + ) + ) + +(defmethod pov-camera-method-28 ((this pov-camera)) + 0 + (none) + ) + +(defmethod set-stack-size! ((this pov-camera)) + (stack-size-set! (-> this main-thread) 512) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior pov-camera-init-by-other pov-camera ((arg0 vector) (arg1 skeleton-group) (arg2 string) (arg3 pov-camera-flag) (arg4 process-drawable) (arg5 pair)) + (set-stack-size! self) + (set! (-> *game-info* pov-camera-handle) (process->handle self)) + (set! (-> self flags) arg3) + (set! (-> self command-list) arg5) + (set! (-> self music-volume-movie) 100.0) + (set! (-> self sfx-volume-movie) 100.0) + (if arg4 + (set! (-> self notify-handle) (process->handle arg4)) + (set! (-> self notify-handle) (the-as handle #f)) + ) + (set-time! (-> self debounce-start-time)) + (logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (when (and (logtest? (-> self flags) (pov-camera-flag inherit-orientation)) arg4) + (let ((v1-22 (if (type? arg4 process-drawable) + arg4 + ) + ) + ) + (quaternion-copy! (-> self root quat) (-> v1-22 root quat)) + ) + ) + (initialize-skeleton self arg1 (the-as pair 0)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! (-> self anim-name) arg2) + (cond + ((= (-> arg2 type) string) + (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) + (let ((s5-1 (get-art-by-name (-> self draw art-group) arg2 art-joint-anim))) + (if (not s5-1) + (go process-drawable-art-error arg2) + ) + (ja-channel-set! 1) + (set! (-> self skel root-channel 0 frame-group) s5-1) + ) + ) + ((= (-> arg2 type) spool-anim) + ) + ) + (set! (-> self mask-to-clear) (process-mask movie enemy platform projectile)) + (set! (-> self event-hook) (lambda :behavior pov-camera + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('mask) + (let ((v0-0 (the-as number (-> arg3 param 0)))) + (set! (-> self mask-to-clear) (the-as process-mask v0-0)) + v0-0 + ) + ) + (('music-movie-volume) + (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0))) + ) + (('sfx-movie-volume) + (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0))) + ) + ) + ) + ) + (pov-camera-method-28 self) + (go-virtual pov-camera-startup) + (none) + ) + +(defun othercam-calc ((arg0 float)) + (set! (-> *camera-other-fov* data) (* 2.0 (atan (/ 14.941477 (* 20.3 arg0)) 1.0))) + ) + +(defstate othercam-running (othercam) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('die) + (set! v0-0 #t) + (set! (-> self die?) (the-as symbol v0-0)) + v0-0 + ) + (('joint) + (cond + ((type? (-> block param 0) string) + (let ((v1-7 (the-as joint (get-art-by-name-method + (-> (the-as process-drawable (-> self hand process 0)) draw jgeo) + (the-as string (-> block param 0)) + (the-as type #f) + ) + ) + ) + ) + (when v1-7 + (set! v0-0 (+ (-> v1-7 number) 1)) + (set! (-> self cam-joint-index) (the-as int v0-0)) + v0-0 + ) + ) + ) + ((not (logtest? (-> block param 0) 7)) + (set! v0-0 (/ (the-as int (-> block param 0)) 8)) + (set! (-> self cam-joint-index) (the-as int v0-0)) + v0-0 + ) + ) + ) + (('target) + (set! v0-0 (process->handle (the-as process (-> block param 0)))) + (set! (-> self hand) (the-as handle v0-0)) + v0-0 + ) + (('mask) + (set! v0-0 (-> block param 0)) + (set! (-> self mask-to-clear) (the-as process-mask v0-0)) + v0-0 + ) + ) + ) + :enter (behavior () + (hide-hud-quick #f) + (case (-> self spooling?) + (('logo 'scene-player) + ) + (else + (add-setting! 'process-mask 'set 0.0 (-> self mask-to-clear)) + (add-setting! 'movie (process->ppointer self) 0.0 0) + (if (not (-> self border-value)) + (add-setting! 'border-mode (-> self border-value) 0.0 0) + ) + ) + ) + (set! (-> self had-valid-frame) #f) + (let ((gp-0 (-> self hand process 0))) + (vector<-cspace! + (-> self old-pos) + (-> (the-as process-drawable gp-0) node-list data (-> self cam-joint-index)) + ) + (let ((v1-20 (-> (the-as process-drawable gp-0) node-list data (-> self cam-joint-index) bone transform))) + (vector-normalize-copy! (-> self old-mat-z) (-> v1-20 fvec) -1.0) + ) + ) + (apply-settings *setting-control*) + ) + :exit (behavior () + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + ) + :code (behavior () + (until #f + (let ((s2-0 (-> self hand process 0))) + (when (not s2-0) + (format #t "ERROR: othercam parent invalid~%") + (deactivate self) + ) + (set! (-> *camera-other-root* quad) (-> (the-as process-drawable s2-0) root trans quad)) + (let ((s4-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index) bone transform)) + (s3-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index) bone scale)) + (gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s1-0 + (or (!= (-> self spooling?) #t) + (logtest? (-> (the-as process-drawable s2-0) skel status) (joint-control-status valid-spooled-frame)) + ) + ) + ) + (vector<-cspace! s5-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index))) + (vector-normalize-copy! gp-0 (-> s4-0 fvec) -1.0) + (cond + ((< (vector-length (-> s4-0 fvec)) 0.1) + (set-blackout-frames (seconds 0.017)) + (if (not (logtest? (-> (the-as process-drawable s2-0) draw status) (draw-control-status no-draw no-draw-temp))) + (format 0 "ERROR: other camera zero matrix!~%") + ) + ) + (s1-0 + (when (not (-> self had-valid-frame)) + (set! (-> self had-valid-frame) #t) + (set! (-> self old-pos quad) (-> s5-0 quad)) + (set! (-> self old-mat-z quad) (-> gp-0 quad)) + ) + (set! (-> *camera-other-trans* quad) (-> s5-0 quad)) + (vector-normalize-copy! (-> *camera-other-matrix* rvec) (-> s4-0 rvec) -1.0) + (set! (-> *camera-other-matrix* rvec w) 0.0) + (vector-normalize-copy! (-> *camera-other-matrix* uvec) (-> s4-0 uvec) 1.0) + (set! (-> *camera-other-matrix* uvec w) 0.0) + (vector-normalize-copy! (-> *camera-other-matrix* fvec) (-> s4-0 fvec) -1.0) + (set! (-> *camera-other-matrix* fvec w) 0.0) + (vector-reset! (-> *camera-other-matrix* trans)) + (set! (-> self fov) (othercam-calc (-> s3-0 x))) + (set! *camera-look-through-other* 2) + (set! (-> self old-pos quad) (-> s5-0 quad)) + (set! (-> self old-mat-z quad) (-> gp-0 quad)) + ) + ) + ) + ) + (suspend) + (let ((a0-27 (-> self hand process 0))) + (when (or (-> self die?) (and (not (-> self survive-anim-end?)) (ja-anim-done? a0-27))) + (let ((gp-1 (current-time))) + (while (and (not (time-elapsed? gp-1 (seconds 60))) + (or (and (-> self entity) (not (is-object-visible? (-> self level) (-> self entity extra vis-id)))) + (< 81920.0 (vector-vector-distance (camera-pos) (-> *math-camera* trans))) + ) + ) + (suspend) + ) + ) + (deactivate self) + ) + ) + ) + #f + ) + ) + +(defbehavior othercam-init-by-other othercam ((arg0 pov-camera) (arg1 int) (arg2 symbol) (arg3 symbol)) + (set! (-> self spooling?) arg3) + (case (-> self spooling?) + (('logo) + ) + (else + (set! (-> *game-info* other-camera-handle) (process->handle self)) + ) + ) + (set! (-> self hand) (process->handle arg0)) + (set! (-> self cam-joint-index) arg1) + (logclear! (-> self mask) (process-mask freeze pause menu actor-pause)) + (set! (-> self border-value) #f) + (set! (-> self die?) #f) + (set! (-> self survive-anim-end?) arg2) + (set! (-> self mask-to-clear) (process-mask movie enemy platform projectile)) + (set! (-> self event-hook) (-> othercam-running event)) + (go othercam-running) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/collide/collide-cache-h.gc b/goal_src/jak3/engine/collide/collide-cache-h.gc index a3616341ac0..6c2524d4891 100644 --- a/goal_src/jak3/engine/collide/collide-cache-h.gc +++ b/goal_src/jak3/engine/collide/collide-cache-h.gc @@ -102,7 +102,7 @@ It is not useful for ollision queries against a specific foreground object, like (collide-cache-method-9 () none) (fill-and-probe-using-line-sphere (_type_ collide-query) float) (fill-and-probe-using-spheres (_type_ collide-query) symbol) - (collide-cache-method-12 () none) + (fill-using-bounding-box (_type_ collide-query) none) (fill-using-line-sphere (_type_ collide-query) none) (collide-cache-method-14 () none) (collide-cache-method-15 () none) diff --git a/goal_src/jak3/engine/collide/collide-shape-h.gc b/goal_src/jak3/engine/collide/collide-shape-h.gc index 8e2fc50063d..67e8ae91561 100644 --- a/goal_src/jak3/engine/collide/collide-shape-h.gc +++ b/goal_src/jak3/engine/collide/collide-shape-h.gc @@ -91,6 +91,7 @@ (declare-type rigid-body structure) (define-extern cshape-reaction-update-state (function control-info collide-query vector none)) +(define-extern cshape-reaction-just-move (function control-info collide-query vector collide-status)) (define-extern collide-shape-draw-debug-marks (function none)) ;; +++cshape-reaction-flags @@ -248,7 +249,7 @@ (collide-shape-prim-method-13 () none) (collide-shape-prim-method-14 () none) (collide-shape-prim-method-15 () none) - (collide-shape-prim-method-16 () none) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none) (collide-shape-prim-method-17 () none) (collide-shape-prim-method-18 () none) (collide-shape-prim-method-19 () none) @@ -337,8 +338,8 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t (set-collide-with! (_type_ collide-spec) none) (set-collide-as! (_type_ collide-spec) none) (collide-shape-method-49 () none) - (collide-shape-method-50 () none) - (collide-shape-method-51 () none) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol) + (above-ground? (_type_ collide-query vector collide-spec float float float) symbol) (water-info-init! (_type_ water-info collide-action) water-info) (collide-shape-method-53 () none) (collide-shape-method-54 () none) @@ -351,14 +352,16 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t ((rider-time time-frame) (rider-last-move vector :inline) (trans-old vector :inline) - (poly-pat pat-surface :offset 272) + (trans-old-old vector :inline :offset 240) + (trans-old-old-old vector :inline :offset 256) + (poly-pat pat-surface :offset 272) (cur-pat pat-surface) (ground-pat pat-surface) (status collide-status) (old-status collide-status) (prev-status collide-status) (reaction-flag cshape-reaction-flags) - (reaction (function control-info collide-query vector vector collide-status) :offset 316) + (reaction (function control-info collide-query vector vector collide-status) :offset 316) (no-reaction (function collide-shape-moving collide-query vector vector object)) (local-normal vector :inline) (surface-normal vector :inline) @@ -385,11 +388,11 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t (collide-shape-moving-method-60 () none) (move-to-ground-point (_type_ vector vector vector) none) (compute-acc-due-to-gravity (_type_ vector float) vector) - (collide-shape-moving-method-63 () none) + (rbody-collision (_type_ rigid-body-control float) none) (collide-shape-moving-method-64 () none) (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol) (collide-shape-moving-method-66 () none) - (collide-shape-moving-method-67 () none) + (collide-with-all-collide-cache-prims (_type_ matrix collide-query) none) ) ) diff --git a/goal_src/jak3/engine/collide/collide-touch-h.gc b/goal_src/jak3/engine/collide/collide-touch-h.gc index 3143cb04b7a..03bdacaf8c1 100644 --- a/goal_src/jak3/engine/collide/collide-touch-h.gc +++ b/goal_src/jak3/engine/collide/collide-touch-h.gc @@ -29,8 +29,8 @@ Potentially also stores the triangle that is involved." (:methods (touching-prims-entry-method-9 () none) (touching-prims-entry-method-10 () none) - (touching-prims-entry-method-11 () none) - (touching-prims-entry-method-12 () none) + (get-touched-prim (_type_ collide-shape touching-shapes-entry) collide-shape-prim) + (get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result) ) ) @@ -97,7 +97,7 @@ storing a record of the primitives involved." (:methods (get-head (_type_) touching-prims-entry) (get-next (_type_ touching-shapes-entry) touching-prims-entry) - (touching-shapes-entry-method-11 () none) + (get-touched-shape (_type_ collide-shape) collide-shape) (prims-touching? (_type_ collide-shape uint) touching-prims-entry) (prims-touching-action? (_type_ collide-shape collide-action collide-action) basic) (touching-shapes-entry-method-14 () none) diff --git a/goal_src/jak3/engine/collide/los-control-h.gc b/goal_src/jak3/engine/collide/los-control-h.gc index ffa5a40414e..f6223eedc4e 100644 --- a/goal_src/jak3/engine/collide/los-control-h.gc +++ b/goal_src/jak3/engine/collide/los-control-h.gc @@ -7,3 +7,22 @@ ;; DECOMP BEGINS +(deftype los-control (structure) + ((src-proc handle) + (dst-proc handle) + (last-lost-los time-frame) + (last-gained-los time-frame) + (check-interval time-frame) + (max-check-distance float) + (last-check-time time-frame) + (last-collide-result collide-tri-result :inline) + (collide-with collide-spec :offset 160) + ) + (:methods + (los-control-method-9 (_type_ process-focusable vector float float) none :behavior process-focusable) + (should-check-los? (_type_ time-frame) symbol) + (los-control-method-11 (_type_ time-frame) symbol) + (init-los! (_type_ process-focusable time-frame float collide-spec) none) + (los-control-method-13 (_type_ collide-query vector int float) float) + ) + ) diff --git a/goal_src/jak3/engine/collide/los-control.gc b/goal_src/jak3/engine/collide/los-control.gc index b1fd0c159b9..a8ad23ee570 100644 --- a/goal_src/jak3/engine/collide/los-control.gc +++ b/goal_src/jak3/engine/collide/los-control.gc @@ -7,3 +7,151 @@ ;; DECOMP BEGINS +(define *los-time-offset* (the-as time-frame 0)) + +(defmethod los-control-method-13 ((this los-control) (arg0 collide-query) (arg1 vector) (arg2 int) (arg3 float)) + (set! (-> arg0 move-dist quad) (-> arg1 quad)) + (vector-length-max! (-> arg0 move-dist) (-> this max-check-distance)) + (set! (-> arg0 radius) arg3) + (set! (-> arg0 collide-with) (the-as collide-spec (logand (the-as collide-spec arg2) (-> this collide-with)))) + (fill-using-line-sphere *collide-cache* arg0) + (let ((f30-0 (probe-using-line-sphere *collide-cache* arg0)) + (f28-0 (vector-length arg1)) + ) + (cond + ((>= f30-0 0.0) + (quad-copy! (the-as pointer (-> this last-collide-result)) (the-as pointer (-> arg0 best-other-tri)) 6) + (* f30-0 f28-0) + ) + (else + f28-0 + ) + ) + ) + ) + +(defmethod los-control-method-9 ((this los-control) (arg0 process-focusable) (arg1 vector) (arg2 float) (arg3 float)) + (local-vars (a0-22 int) (a0-24 int) (sv-592 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let* ((v1-1 (-> *perf-stats* data 56)) + (a0-1 (-> v1-1 ctrl)) + ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-1) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-1) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (when (and (time-elapsed? (-> this last-check-time) (-> this check-interval)) + (-> this src-proc) + (or arg0 (-> this dst-proc)) + ) + (let* ((s0-0 (handle->process (-> this src-proc))) + (s1-0 (if (type? s0-0 process-focusable) + s0-0 + ) + ) + ) + (when s1-0 + (when (and (not arg0) (not arg1)) + (let ((s0-1 (handle->process (-> this dst-proc)))) + (set! arg0 (if (type? s0-1 process-focusable) + (the-as process-focusable s0-1) + ) + ) + ) + ) + (when (or (the-as process arg0) arg1) + (set! sv-592 (new 'stack-no-clear 'vector)) + (let ((v1-24 (-> (get-trans (the-as process-focusable s1-0) 10) quad))) + (set! (-> sv-592 quad) v1-24) + ) + (let ((s0-2 (new 'stack-no-clear 'collide-query))) + (if (not arg1) + (set! arg1 (get-trans arg0 3)) + ) + (set! (-> s0-2 start-pos quad) (-> sv-592 quad)) + (set! (-> s0-2 ignore-process0) s1-0) + (set! (-> s0-2 ignore-process1) (the-as process arg0)) + (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) + (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> arg1 quad)) + (.lvf vf5 (&-> sv-592 quad)) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> s2-1 quad) vf6) + (let ((f30-0 (vector-length s2-1))) + (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) + (if (< f0-0 f30-0) + (vector-normalize! s2-1 f0-0) + ) + ) + (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) + (set-time! (-> this last-lost-los)) + (set-time! (-> this last-gained-los)) + ) + ) + ) + ) + (set-time! (-> this last-check-time)) + ) + ) + ) + ) + (let ((v1-45 (-> *perf-stats* data 56))) + (b! (zero? (-> v1-45 ctrl)) cfg-45 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-22 pcr0) + (+! (-> v1-45 accum0) a0-22) + (.mfpc a0-24 pcr1) + (+! (-> v1-45 accum1) a0-24) + ) + (label cfg-45) + 0 + 0 + (none) + ) + ) + +(defmethod should-check-los? ((this los-control) (arg0 time-frame)) + (and (time-elapsed? (-> this last-lost-los) (+ (-> this check-interval) arg0)) + (not (time-elapsed? (-> this last-gained-los) (-> this check-interval))) + ) + ) + +(defmethod los-control-method-11 ((this los-control) (arg0 time-frame)) + (and (time-elapsed? (-> this last-gained-los) (+ (-> this check-interval) arg0)) + (not (time-elapsed? (-> this last-lost-los) (-> this check-interval))) + ) + ) + +(defmethod init-los! ((this los-control) (arg0 process-focusable) (arg1 time-frame) (arg2 float) (arg3 collide-spec)) + (set! (-> this src-proc) (process->handle arg0)) + (set! (-> this dst-proc) (the-as handle #f)) + (set! (-> this last-lost-los) 0) + (set! (-> this last-gained-los) 0) + (set! (-> this last-check-time) 0) + (set! (-> this check-interval) (+ arg1 *los-time-offset*)) + (set! (-> this max-check-distance) arg2) + (set! (-> this collide-with) arg3) + (set! *los-time-offset* (the-as time-frame (mod (+ *los-time-offset* (seconds 0.045)) 30))) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/common-obs/airlock.gc b/goal_src/jak3/engine/common-obs/airlock.gc index 77e559c2c1c..2af4084468e 100644 --- a/goal_src/jak3/engine/common-obs/airlock.gc +++ b/goal_src/jak3/engine/common-obs/airlock.gc @@ -5,5 +5,1364 @@ ;; name in dgo: airlock ;; dgos: GAME +;; +++airlock-options +(defenum airlock-options + :type uint32 + :bitfield #t + (ao0 0) + (front 1) + (block-flut 2) + (back 3) + (ao4 4) + ) +;; ---airlock-options + + +(declare-type blocking-plane process-drawable) + +(define-extern blocking-plane-spawn (function curve-control (inline-array vector) float none :behavior process)) +(define-extern blocking-plane-destroy (function none :behavior blocking-plane)) ;; DECOMP BEGINS +(deftype com-airlock (process-drawable) + ((level-name pair) + (open-test pair) + (on-running pair) + (were-behind? symbol) + (inner? symbol) + (sound-behind? symbol) + (visible-move? symbol) + (saw-pilot? handle) + (last-distance meters) + (y-height vector) + (pre-open-speed float) + (open? symbol) + (latch-closed-time time-frame) + (latch-open-time time-frame) + (gear joint-mod) + (gear-rot degrees) + (gear-rotv degrees) + (gear-start-frame float) + (gear-stop-frame float) + (gear-play-time time-frame) + (open-frame float) + (pre-open-frame float) + (lock-frame float) + (close-speed-multiplier float) + (open-distance meters 2) + (active-distance meters 2) + (sound-id sound-id) + (gear-sound-id sound-id) + (sound-gear sound-spec) + (sound-pre-open sound-spec) + (sound-pre-open-stop sound-spec) + (sound-lock-loop sound-spec) + (sound-lock-stop sound-spec) + (sound-open sound-spec) + (sound-open-loop sound-spec) + (sound-open-stop sound-spec) + (sound-close sound-spec) + (sound-close-loop sound-spec) + (sound-close-stop sound-spec) + (sound-post-close sound-spec) + (sound-post-close-stop sound-spec) + (spool-sound-time time-frame) + (start-open-time time-frame) + (door-radius float) + (allow-pilot? symbol) + (allow-flut? symbol) + (blocking-plane? symbol) + ) + (:state-methods + (open symbol) + (close symbol) + ) + (:methods + (init-airlock! (_type_) _type_) + (want-cross-airlock? (_type_) object) + (destination-loaded? (_type_ symbol) symbol) + (check-crossing-distance (_type_ vector symbol) float) + (com-airlock-method-26 (_type_ vector symbol) symbol) + (rotate-gear! (_type_ float) degrees) + (play-city-voice-sound (_type_ symbol) none) + (spawn-blocking-plane (_type_ symbol) none) + ) + ) + + +(defmethod deactivate ((this com-airlock)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (process-entity-status! this (entity-perm-status subtask-complete) #f) + (if (nonzero? (-> this sound-id)) + (sound-stop (-> this sound-id)) + ) + (if (nonzero? (-> this gear-sound-id)) + (sound-stop (-> this gear-sound-id)) + ) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; WARN: Return type mismatch process-drawable vs com-airlock. +(defmethod relocate ((this com-airlock) (offset int)) + (if (nonzero? (-> this gear)) + (&+! (-> this gear) offset) + ) + (the-as com-airlock ((method-of-type process-drawable relocate) this offset)) + ) + +(defmethod init-airlock! ((this com-airlock)) + (local-vars (sv-16 res-tag) (sv-32 res-tag)) + (process-entity-status! this (entity-perm-status subtask-complete) #f) + (set! (-> this open?) #f) + (process-drawable-from-entity! this (-> this entity)) + (let ((f0-0 (res-lump-float (-> this entity) 'rotoffset))) + (if (!= f0-0 0.0) + (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-0) + ) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (let ((s5-0 (res-lump-value (-> this entity) 'options airlock-options :time -1000000000.0))) + (set! (-> this were-behind?) #f) + (set! (-> this inner?) (logtest? s5-0 (airlock-options ao0))) + (set! (-> this on-running) (res-lump-struct (-> this entity) 'on-running pair)) + (set! (-> this sound-behind?) #f) + (set! (-> this saw-pilot?) (the-as handle #f)) + (set! (-> this open-frame) 0.0) + (set! (-> this pre-open-frame) 0.0) + (set! (-> this lock-frame) 0.0) + (set! (-> this pre-open-speed) 2.0) + (set! (-> this allow-pilot?) #f) + (set! (-> this allow-flut?) (not (logtest? s5-0 (airlock-options block-flut)))) + (let ((v1-16 (cond + ((logtest? s5-0 (airlock-options front)) + 'front + ) + ((logtest? s5-0 (airlock-options back)) + 'back + ) + ) + ) + ) + (set! (-> this blocking-plane?) v1-16) + ) + ) + (set! (-> this open-distance 0) 143360.0) + (set! (-> this open-distance 1) 143360.0) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16)))) + (when v1-21 + (if (>= (-> sv-16 elt-count) (the-as uint 1)) + (set! (-> this open-distance 0) (-> v1-21 0)) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 2)) + (set! (-> this open-distance 1) (-> v1-21 1)) + ) + ) + ) + (set! (-> this active-distance 0) (+ 143360.0 (-> this open-distance 0))) + (set! (-> this active-distance 1) (+ 143360.0 (-> this open-distance 1))) + (set! sv-32 (new 'static 'res-tag)) + (let ((v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32)))) + (when v1-25 + (if (>= (-> sv-32 elt-count) (the-as uint 1)) + (set! (-> this active-distance 0) (-> v1-25 0)) + ) + (if (>= (-> sv-32 elt-count) (the-as uint 2)) + (set! (-> this active-distance 1) (-> v1-25 1)) + ) + ) + ) + (set! (-> this y-height) (res-lump-data (-> this entity) 'height vector)) + (set! (-> this level-name) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this open-test) + (the-as pair ((method-of-type res-lump get-property-struct) + (-> this entity) + 'open-test + 'interp + -1000000000.0 + (the-as structure '(not (or (scene-player?) (focus-test? *target* grabbed)))) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> this gear-start-frame) -1.0) + (set! (-> this gear-stop-frame) 10000.0) + (set! (-> this sound-gear) #f) + (set! (-> this sound-pre-open) #f) + (set! (-> this sound-pre-open-stop) #f) + (set! (-> this sound-lock-loop) #f) + (set! (-> this sound-lock-stop) #f) + (set! (-> this sound-post-close) #f) + (set! (-> this sound-post-close-stop) #f) + (set! (-> this sound-open) #f) + (set! (-> this sound-close) #f) + (set! (-> this sound-open-loop) #f) + (set! (-> this sound-close-loop) #f) + (set! (-> this sound-open-stop) #f) + (set! (-> this sound-close-stop) #f) + (set! (-> this door-radius) 20480.0) + (set! (-> this close-speed-multiplier) 2.0) + this + ) + +(defbehavior airlock-stop-part-trackers com-airlock () + (let ((gp-0 (ppointer->process (-> self child)))) + (while gp-0 + (if (type? gp-0 part-tracker) + (send-event gp-0 'draw #f) + ) + (set! gp-0 (ppointer->process (-> gp-0 brother))) + ) + ) + 0 + (none) + ) + +(defun airlock-command-lookup ((arg0 pair)) + (let* ((s5-0 (the-as object (-> *setting-control* user-current airlock-command))) + (s4-0 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (let ((a0-1 (-> (the-as pair s4-0) car))) + (if (or (= a0-1 'any) (string= (the-as string a0-1) (the-as string arg0))) + (return (-> (the-as pair (-> (the-as pair s4-0) cdr)) car)) + ) + ) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! s4-0 (-> (the-as pair s5-0) car)) + ) + ) + #f + ) + +(defmethod com-airlock-method-26 ((this com-airlock) (arg1 vector) (side symbol)) + (case side + (('front) + (let ((f0-0 (check-crossing-distance this arg1 #f))) + (and (< 0.0 f0-0) (or (< (vector-vector-xz-distance (-> this root trans) arg1) (-> this active-distance 0)) + (< 0.0 (-> this last-distance)) + ) + ) + ) + ) + ) + ) + +(defmethod check-crossing-distance ((this com-airlock) (arg0 vector) (arg1 symbol)) + (let ((s5-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this root trans))) + ) + (set! (-> s4-1 y) 0.0) + (let ((f30-0 (vector-dot s4-1 s5-0))) + (cond + ((not arg1) + ) + ((or (< (vector-vector-xz-distance (-> this root trans) arg0) 40960.0) + (< 0.7 (fabs (vector-dot s5-0 (vector-normalize! s4-1 1.0)))) + ) + (when (and (< f30-0 0.0) + (< 0.0 (-> this last-distance)) + (and (not (and *target* (focus-test? *target* grabbed teleporting))) + (< (fabs (- f30-0 (-> this last-distance))) 81920.0) + ) + ) + (let ((s5-1 (res-lump-struct (-> this entity) 'on-cross pair))) + (if s5-1 + (script-eval s5-1) + ) + ) + ) + (set! (-> this last-distance) f30-0) + ) + ((< 0.0 (-> this last-distance)) + (set! f30-0 (fmax 4096.0 f30-0)) + ) + ((< (-> this last-distance) 0.0) + (set! f30-0 (fmin -4096.0 f30-0)) + ) + ) + f30-0 + ) + ) + ) + +(defmethod want-cross-airlock? ((this com-airlock)) + (local-vars (a0-22 entity-actor)) + (let* ((tpos (target-pos 0)) + (f30-0 (check-crossing-distance this tpos #t)) + (target-dist (vector-vector-xz-distance (-> this root trans) tpos)) + (s5-0 (< (current-time) (-> this latch-open-time))) + (cmd (airlock-command-lookup (the-as pair (-> this name)))) + ) + (if (= cmd 'open) + (set! s5-0 #t) + ) + (and (or s5-0 (< target-dist (if (>= f30-0 0.0) + (-> this active-distance 0) + (-> this active-distance 1) + ) + ) + ) + (and (or s5-0 (not (-> this y-height)) (and (>= (-> tpos y) (- (-> this root trans y) (-> this y-height y))) + (< (-> tpos y) (+ (-> this root trans y) (-> this y-height x))) + ) + ) + (begin + (if (and (not (-> this were-behind?)) (and (< f30-0 0.0) (-> this inner?))) + (set! (-> this were-behind?) #t) + ) + (< (-> this latch-closed-time) (current-time)) + ) + (or (not (and *target* (or (focus-test? *target* teleporting) + (and (not (-> this allow-pilot?)) (focus-test? *target* pilot)) + (and (not (-> this allow-flut?)) (focus-test? *target* flut)) + ) + ) + ) + (< f30-0 -409.6) + ) + (let ((f28-0 (check-crossing-distance this (camera-pos) #f))) + (if (and *target* + (< target-dist 81920.0) + (or (< (* f30-0 f28-0) 0.0) (and (>= 32768.0 (fabs f30-0)) (if (= (-> this blocking-plane?) 'front) + (< f30-0 0.0) + (< 0.0 f30-0) + ) + ) + ) + (and (or (not (-> this allow-flut?)) (not (-> this allow-pilot?))) + (not (logtest? (focus-status flut pilot) (-> *target* focus-status))) + ) + ) + (persist-with-delay *setting-control* 'pilot (seconds 0.1) 'pilot #f 0.0 0) + ) + (or (and (< f30-0 (-> this open-distance 0)) + (or (not (-> this were-behind?)) (< f30-0 20480.0)) + (and (or (< 409.6 f30-0) + (begin + (let ((a0-21 (-> this entity))) + (set! a0-22 (entity-actor-lookup a0-21 'next-actor 0)) + ) + (not a0-22) + ) + (logtest? (-> a0-22 extra perm status) (entity-perm-status subtask-complete)) + ) + (script-eval (-> this open-test)) + (and (-> *setting-control* user-current airlock) + (!= cmd 'close) + (not (and (-> this blocking-plane?) *target* (or (and (not (-> this allow-pilot?)) (focus-test? *target* pilot)) + (and (not (-> this allow-flut?)) (focus-test? *target* flut)) + ) + ) + ) + ) + ) + ) + s5-0 + (and (or (not *target*) (not (logtest? (-> *target* focus-status) (focus-status in-head)))) + (not (and (and (-> this next-state) (= (-> this next-state name) 'close)) + (= (-> this skel root-channel 0 frame-num) 0.0) + ) + ) + (or (< (* f30-0 f28-0) 0.0) + (and (< (fabs f28-0) 4096.0) + (< (vector-vector-xz-distance (camera-pos) (-> this root trans)) (-> this door-radius)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +(defmethod destination-loaded? ((this com-airlock) (level-status symbol)) + (let ((s5-1 (script-eval (-> this level-name)))) + (cond + ((not s5-1) + (if level-status + 'unknown + #f + ) + ) + (level-status + (let ((a1-3 (car s5-1))) + (while (not (null? s5-1)) + (let ((v1-4 (status-of-level-and-borrows *level* (the-as symbol a1-3) level-status))) + (case level-status + (('display) + (if (!= v1-4 'active) + (return #f) + ) + ) + (else + (if (not (or (= v1-4 'loaded) (= v1-4 'active))) + (return #f) + ) + ) + ) + ) + (set! s5-1 (cdr s5-1)) + (set! a1-3 (car (the-as pair s5-1))) + ) + ) + #t + ) + (else + (let* ((v1-13 s5-1) + (a0-8 (car v1-13)) + ) + (while (not (null? v1-13)) + (dotimes (a1-6 10) + (if (= a0-8 (-> *load-state* want a1-6 name)) + (goto cfg-32) + ) + ) + #t + (return #f) + (label cfg-32) + (set! v1-13 (cdr v1-13)) + (set! a0-8 (car (the-as pair v1-13))) + ) + ) + #t + ) + ) + ) + ) + +(defmethod rotate-gear! ((this com-airlock) (arg0 float)) + (cond + ((and (>= (ja-aframe-num 0) (-> this gear-start-frame)) (< (ja-aframe-num 0) (-> this gear-stop-frame))) + (if (and (zero? (-> this gear-sound-id)) + (-> this sound-gear) + (and (-> this next-state) (= (-> this next-state name) 'open)) + (>= (check-crossing-distance this (target-pos 0) #f) 0.0) + ) + (set! (-> this gear-sound-id) (sound-play-by-spec (-> this sound-gear) (new-sound-id) (the-as vector #t))) + ) + (set-time! (-> this gear-play-time)) + (when (nonzero? (-> this gear)) + (seek! (-> this gear-rotv) arg0 (* 131072.0 (seconds-per-frame))) + (+! (-> this gear-rot) (* (-> this gear-rotv) (seconds-per-frame))) + (twist-set! (-> this gear) (the-as float #f) (the-as float #f) (-> this gear-rot)) + ) + ) + (else + (when (and (nonzero? (-> this gear-sound-id)) (time-elapsed? (-> this gear-play-time) (seconds 1.5))) + (let ((v1-28 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-28 command) (sound-command set-param)) + (set! (-> v1-28 id) (-> this gear-sound-id)) + (set! (-> v1-28 params volume) -4) + (set! (-> v1-28 auto-time) 120) + (set! (-> v1-28 auto-from) 2) + (set! (-> v1-28 params mask) (the-as uint 17)) + (-> v1-28 id) + ) + (set! (-> this gear-sound-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + (-> this gear-rotv) + ) + +(defmethod play-city-voice-sound ((this com-airlock) (arg0 symbol)) + (let ((gp-0 (the-as (array string) #f))) + (case arg0 + (('enter) + (set! gp-0 (new 'static 'boxed-array :type string "cityv005" "cityv006" "cityv007" "cityv008" "cityv009")) + ) + (('exit) + (set! gp-0 (new 'static 'boxed-array :type string "cityv001" "cityv002" "cityv003" "cityv004")) + ) + ) + (cond + ((and gp-0 (time-elapsed? (-> this spool-sound-time) (seconds 2))) + (set-time! (-> this spool-sound-time)) + (add-process + *gui-control* + this + (gui-channel alert) + (gui-action play) + (-> gp-0 (rand-vu-int-range 0 (+ (-> gp-0 length) -1))) + -99.0 + 0 + ) + ) + (else + 0 + ) + ) + ) + (none) + ) + +(defmethod spawn-blocking-plane ((this com-airlock) (side symbol)) + (case side + (('front) + (let ((s5-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (vector-matrix*! + (-> s5-0 0) + (new 'static 'vector :x 40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (vector-matrix*! + (-> s5-0 1) + (new 'static 'vector :x -40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (blocking-plane-spawn (the-as curve-control #f) s5-0 122880.0) + ) + ) + (('back) + (let ((s5-1 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (vector-matrix*! + (-> s5-1 0) + (new 'static 'vector :x -40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (vector-matrix*! + (-> s5-1 1) + (new 'static 'vector :x 40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (blocking-plane-spawn (the-as curve-control #f) s5-1 122880.0) + ) + ) + (else + (blocking-plane-destroy) + ) + ) + 0 + (none) + ) + +(defskelgroup skel-com-airlock-outer com-airlock-outer com-airlock-outer-lod0-jg com-airlock-outer-idle-ja + ((com-airlock-outer-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +(defskelgroup skel-com-airlock-inner com-airlock-inner com-airlock-inner-lod0-jg com-airlock-inner-idle-ja + ((com-airlock-inner-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +(defstate close (com-airlock) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('close) + (set! (-> self latch-closed-time) (+ (current-time) (if (>= argc 1) + (the-as int (-> block param 0)) + 3000 + ) + ) + ) + (if (and (>= argc 2) (and (= (-> block param 1) #t) (not (want-cross-airlock? self)))) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + ) + (and (-> self next-state) (= (-> self next-state name) 'open)) + ) + (('open) + (set! (-> self latch-open-time) (+ (current-time) (if (>= argc 1) + (the-as int (-> block param 0)) + 3000 + ) + ) + ) + (if (and (>= argc 2) (and (= (-> block param 1) #t) (want-cross-airlock? self) (destination-loaded? self #f))) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! max) + ) + (and (-> self next-state) (= (-> self next-state name) 'close)) + ) + (('front) + (let ((f30-0 (check-crossing-distance self (target-pos 0) #f)) + (f0-3 (check-crossing-distance self (camera-pos) #f)) + ) + (and (< 2048.0 f30-0) (>= (* f30-0 f0-3) 0.0)) + ) + ) + (('back) + (let ((f30-1 (check-crossing-distance self (target-pos 0) #f)) + (f0-5 (check-crossing-distance self (camera-pos) #f)) + ) + (and (< f30-1 -2048.0) (>= (* f30-1 f0-5) 0.0)) + ) + ) + (('sound) + (if (>= (check-crossing-distance self (target-pos 0) #f) 0.0) + (play-city-voice-sound self (the-as symbol (-> block param 0))) + ) + ) + (('distance) + (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) + (('open?) + (-> self open?) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + (set! (-> self visible-move?) #f) + ) + :exit (behavior () + (spawn-blocking-plane self #f) + (when (nonzero? (-> self sound-id)) + (let ((v1-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-4 command) (sound-command set-param)) + (set! (-> v1-4 id) (-> self sound-id)) + (set! (-> v1-4 params volume) -4) + (set! (-> v1-4 auto-time) 24) + (set! (-> v1-4 auto-from) 2) + (set! (-> v1-4 params mask) (the-as uint 17)) + (-> v1-4 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-9 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-9 command) (sound-command set-param)) + (set! (-> v1-9 id) (-> self gear-sound-id)) + (set! (-> v1-9 params volume) -4) + (set! (-> v1-9 auto-time) 24) + (set! (-> v1-9 auto-from) 2) + (set! (-> v1-9 params mask) (the-as uint 17)) + (-> v1-9 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + ) + :trans (behavior () + (if (logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self visible-move?) #t) + ) + (when (and (want-cross-airlock? self) + (and (!= (-> self state-time) (current-time)) + (begin + (let ((gp-0 (res-lump-struct (-> self entity) 'on-activate structure))) + (if gp-0 + (script-eval (the-as pair gp-0)) + ) + ) + (destination-loaded? self #f) + ) + ) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-19 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-19 command) (sound-command set-param)) + (set! (-> v1-19 id) (-> self sound-id)) + (set! (-> v1-19 params volume) -4) + (set! (-> v1-19 auto-time) 24) + (set! (-> v1-19 auto-from) 2) + (set! (-> v1-19 params mask) (the-as uint 17)) + (-> v1-19 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (go-virtual open #f) + ) + (let ((gp-1 (-> self on-running))) + (if gp-1 + (script-eval gp-1) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (when (not arg0) + ((lambda :behavior com-airlock () (when (ja-max? 0) + (let ((gp-0 (res-lump-struct (-> self entity) 'on-start-close pair))) + (if (and gp-0 (not *scene-player*)) + (script-eval gp-0) + ) + ) + ) + ) + ) + (spawn-blocking-plane self #t) + (if (and (-> self sound-close) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (sound-play-by-spec (-> self sound-close) (new-sound-id) (the-as vector #t)) + ) + (if (and (-> self sound-close-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-close-loop) (new-sound-id) (the-as vector #t))) + ) + (while (< (-> self open-frame) (ja-aframe-num 0)) + (rotate-gear! self 65536.0) + (when (and (-> self were-behind?) + (< 0.4 (vector-dot + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (-> (math-camera-matrix) fvec) + ) + ) + (< 0.0 (check-crossing-distance self (target-pos 0) #f)) + ) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self open-frame) 0)) + (goto cfg-42) + ) + (suspend) + (ja :num! (seek! 0.0 (-> self close-speed-multiplier))) + (transform-post) + ) + (label cfg-42) + (if (com-airlock-method-26 self (target-pos 0) 'front) + ((lambda :behavior com-airlock + () + (let ((gp-0 (res-lump-struct (-> self entity) 'on-exit structure))) + (if (and gp-0 (not *scene-player*)) + (script-eval (the-as pair gp-0)) + ) + ) + (when (-> self were-behind?) + (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) + (set! (-> self were-behind?) #f) + (if (and gp-1 (not *scene-player*)) + (script-eval (the-as pair gp-1)) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-48 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-48 command) (sound-command set-param)) + (set! (-> v1-48 id) (-> self sound-id)) + (set! (-> v1-48 params volume) -4) + (set! (-> v1-48 auto-time) 24) + (set! (-> v1-48 auto-from) 2) + (set! (-> v1-48 params mask) (the-as uint 17)) + (-> v1-48 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (if (and (-> self sound-close-stop) (not arg0) (-> self visible-move?)) + (sound-play-by-spec (-> self sound-close-stop) (new-sound-id) (the-as vector #t)) + ) + (while (not (ja-min? 0)) + (if (and (zero? (-> self sound-id)) + (-> self sound-post-close) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-post-close) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! 0.0)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-73 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-73 command) (sound-command set-param)) + (set! (-> v1-73 id) (-> self sound-id)) + (set! (-> v1-73 params volume) -4) + (set! (-> v1-73 auto-time) 24) + (set! (-> v1-73 auto-from) 2) + (set! (-> v1-73 params mask) (the-as uint 17)) + (-> v1-73 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-post-close-stop) + (sound-play-by-spec (-> self sound-post-close-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (set! (-> self open?) #f) + (when (com-airlock-method-26 self (target-pos 0) 'front) + (let ((gp-3 (res-lump-struct (-> self entity) 'on-deactivate structure))) + (if (and gp-3 (not *scene-player*)) + (script-eval (the-as pair gp-3)) + ) + ) + ) + (while (!= (-> self gear-rotv) 0.0) + (rotate-gear! self 0.0) + (suspend) + (transform-post) + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-93 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-93 command) (sound-command set-param)) + (set! (-> v1-93 id) (-> self gear-sound-id)) + (set! (-> v1-93 params volume) -4) + (set! (-> v1-93 auto-time) 24) + (set! (-> v1-93 auto-from) 2) + (set! (-> v1-93 params mask) (the-as uint 17)) + (-> v1-93 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + ) + (spawn-blocking-plane self #f) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + (transform-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + ) + +(defstate open (com-airlock) + :virtual #t + :event (-> (method-of-type com-airlock close) event) + :enter (behavior ((arg0 symbol)) + (set! (-> self visible-move?) #f) + ) + :exit (-> (method-of-type com-airlock close) exit) + :trans (behavior () + (if (logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self visible-move?) #t) + ) + (if (not (want-cross-airlock? self)) + (go-virtual close #f) + ) + (when (logtest? (-> self mask) (process-mask sleep-code)) + (let ((v1-15 (destination-loaded? self 'display))) + (when (or (not v1-15) (= v1-15 'unknown)) + (if (and (not v1-15) (< (-> self open-frame) (ja-aframe-num 0))) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self open-frame) 0)) + ) + (go-virtual close #f) + ) + ) + ) + (let ((gp-1 (-> self on-running))) + (if gp-1 + (script-eval gp-1) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (when (not arg0) + ((lambda :behavior com-airlock + () + (when (ja-min? 0) + (let ((gp-0 (res-lump-struct (-> self entity) 'on-start-open pair))) + (if (and gp-0 (not *scene-player*) (time-elapsed? (-> self start-open-time) (seconds 0.1))) + (script-eval gp-0) + ) + ) + ) + ) + ) + (set-time! (-> self start-open-time)) + (when (< (check-crossing-distance self (target-pos 0) #f) 0.0) + (if (< (ja-aframe-num 0) (-> self pre-open-frame)) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self pre-open-frame) 0)) + ) + ) + (while (< (ja-aframe-num 0) (-> self lock-frame)) + (if (and (zero? (-> self sound-id)) + (-> self sound-pre-open) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-pre-open) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! (ja-aframe (-> self lock-frame) 0) (-> self pre-open-speed))) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-29 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-29 command) (sound-command set-param)) + (set! (-> v1-29 id) (-> self sound-id)) + (set! (-> v1-29 params volume) -4) + (set! (-> v1-29 auto-time) 24) + (set! (-> v1-29 auto-from) 2) + (set! (-> v1-29 params mask) (the-as uint 17)) + (-> v1-29 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-pre-open-stop) + (sound-play-by-spec (-> self sound-pre-open-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (while (< (ja-aframe-num 0) (-> self open-frame)) + (if (and (zero? (-> self sound-id)) + (-> self sound-lock-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-lock-loop) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! (ja-aframe (-> self open-frame) 0) 2.0)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-52 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-52 command) (sound-command set-param)) + (set! (-> v1-52 id) (-> self sound-id)) + (set! (-> v1-52 params volume) -4) + (set! (-> v1-52 auto-time) 24) + (set! (-> v1-52 auto-from) 2) + (set! (-> v1-52 params mask) (the-as uint 17)) + (-> v1-52 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-lock-stop) + (sound-play-by-spec (-> self sound-lock-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (while (not (destination-loaded? self #t)) + (if (not (destination-loaded? self #f)) + (go-virtual close #f) + ) + (rotate-gear! self 65536.0) + (suspend) + (transform-post) + ) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self open?) #t) + (let ((s5-10 (res-lump-struct (-> self entity) 'on-enter structure))) + (if s5-10 + (script-eval (the-as pair s5-10)) + ) + ) + (if (and (-> self sound-open) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (sound-play-by-spec (-> self sound-open) (new-sound-id) (the-as vector #t)) + ) + (if (and (-> self sound-open-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-open-loop) (new-sound-id) (the-as vector #t))) + ) + (set! (-> *ACTOR-bank* birth-max) 1000) + (while (not (ja-max? 0)) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek!)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-104 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-104 command) (sound-command set-param)) + (set! (-> v1-104 id) (-> self sound-id)) + (set! (-> v1-104 params volume) -4) + (set! (-> v1-104 auto-time) 24) + (set! (-> v1-104 auto-from) 2) + (set! (-> v1-104 params mask) (the-as uint 17)) + (-> v1-104 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-109 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-109 command) (sound-command set-param)) + (set! (-> v1-109 id) (-> self gear-sound-id)) + (set! (-> v1-109 params volume) -4) + (set! (-> v1-109 auto-time) 24) + (set! (-> v1-109 auto-from) 2) + (set! (-> v1-109 params mask) (the-as uint 17)) + (-> v1-109 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + (if (and (-> self sound-open-stop) (not arg0) (-> self visible-move?)) + (sound-play-by-spec (-> self sound-open-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self open?) #t) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! max) + (transform-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + ) + +(deftype com-airlock-outer (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this com-airlock-outer) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 7) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (init-airlock! this) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-com-airlock-outer" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this pre-open-frame) 35.0) + (set! (-> this lock-frame) 45.0) + (set! (-> this open-frame) 45.0) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-post-close) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-post-close-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (go (method-of-object this close) #t) + ) + +(deftype com-airlock-inner (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this com-airlock-inner) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 8) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-com-airlock-inner" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this lock-frame) 37.0) + (set! (-> this pre-open-frame) 65.0) + (set! (-> this open-frame) 75.0) + (set! (-> this gear) (new 'process 'joint-mod (joint-mod-mode rotate) this 12)) + (set! (-> this inner?) + (logtest? (the-as + int + (res-lump-value (-> this entity) 'options uint128 :default (the-as uint128 1) :time -1000000000.0) + ) + 1 + ) + ) + (set! (-> this pre-open-speed) 0.9) + (set! (-> this sound-gear) (static-sound-spec "airlock-gear" :group 1)) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-lock-loop) (static-sound-spec "airlock-turn" :group 1)) + (set! (-> this sound-lock-stop) (static-sound-spec "airlock-unlock" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (go (method-of-object this close) #t) + ) + +(defskelgroup skel-cty-door cty-door cty-door-lod0-jg cty-door-idle-ja + ((cty-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 8) + ) + +(deftype cty-door (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this cty-door) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 32768.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 28672.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 28672.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-cty-door" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open) (static-sound-spec "hqdoor-open" :group 1)) + (set! (-> this sound-close) (static-sound-spec "hqdoor-close" :group 1)) + (go (method-of-object this close) #t) + ) + +(defskelgroup skel-vin-door-ctyinda vin-door-ctyinda vin-door-ctyinda-lod0-jg vin-door-ctyinda-idle-ja + ((vin-door-ctyinda-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 6) + ) + +(deftype vin-door-ctyinda (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this vin-door-ctyinda) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 12288.0 0.0 24576.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 8192.0 16384.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) -8192.0 16384.0 0.0 20480.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-vin-door-ctyinda" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open) (static-sound-spec "vindoor-open" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "vindoor-close" :group 1)) + (set! (-> this door-radius) 8192.0) + (go (method-of-object this close) #t) + ) + +(defskelgroup skel-com-airlock-outer-mhcity com-airlock-outer-mhcity com-airlock-outer-mhcity-lod0-jg com-airlock-outer-mhcity-idle-ja + ((com-airlock-outer-mhcity-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +(deftype com-airlock-outer-mhcity (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this com-airlock-outer-mhcity) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (init-airlock! this) + (initialize-skeleton + this + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-com-airlock-outer-mhcity" (the-as (pointer level) #f)) + ) + (the-as pair 0) + ) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-post-close) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-post-close-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (go (method-of-object this close) #t) + ) + +(defskelgroup skel-hip-door-a hip-door-a hip-door-a-lod0-jg hip-door-a-idle-ja + ((hip-door-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +(deftype hip-door-a (com-airlock) + () + ) + + +(defmethod init-from-entity! ((this hip-door-a) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 8192.0 0.0 16384.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 8192.0 0.0 16384.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-hip-door-a" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open-loop) (static-sound-spec "wood-door-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "wood-open-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "wood-door-close" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "wood-close-hit" :group 1)) + (set! (-> this door-radius) 8192.0) + (go (method-of-object this close) #t) + ) diff --git a/goal_src/jak3/engine/common-obs/base-plat.gc b/goal_src/jak3/engine/common-obs/base-plat.gc index d7c3f39a48f..30a8d75aea6 100644 --- a/goal_src/jak3/engine/common-obs/base-plat.gc +++ b/goal_src/jak3/engine/common-obs/base-plat.gc @@ -5,5 +5,368 @@ ;; name in dgo: base-plat ;; dgos: GAME +;; +++eco-door-flags +(defenum eco-door-flags + :type int32 + :bitfield #t + (locked 0) + (unlocked 1) + (auto-close 2) + (one-way 3) + ) +;; ---eco-door-flags + + ;; DECOMP BEGINS +(deftype base-plat (process-focusable) + ((smush smush-control :inline) + (basetrans vector :inline) + (bounce-time time-frame) + (bouncing symbol) + (bounce-scale meters) + ) + (:methods + (update-part-and-sfx! (_type_) none) + (init-bounce-params! (_type_) none) + (start-bounce! (_type_) none :behavior base-plat) + (get-art-group (_type_) art-group) + (init-collision! (_type_) none) + (base-plat-method-33 (_type_) none) + (base-plat-method-34 (_type_) none) + ) + ) + + +(defmethod base-plat-method-34 ((this base-plat)) + 0 + (none) + ) + +(defmethod init-bounce-params! ((this base-plat)) + (set! (-> this basetrans quad) (-> this root trans quad)) + (set! (-> this bouncing) #f) + (set! (-> this bounce-scale) 819.2) + 0 + (none) + ) + +(defmethod start-bounce! ((this base-plat)) + (activate! (-> this smush) -1.0 60 150 1.0 1.0 (-> self clock)) + (set-time! (-> this bounce-time)) + (set! (-> this bouncing) #t) + (sound-play "plat-bounce" :position (-> this root trans)) + (logclear! (-> this mask) (process-mask sleep)) + (logclear! (-> this mask) (process-mask sleep-code)) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior plat-code base-plat () + (transform-post) + (suspend) + (transform-post) + (suspend) + (until #f + (when (not (-> self bouncing)) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + (while (-> self bouncing) + (suspend) + ) + ) + #f + (none) + ) + +(defbehavior plat-trans base-plat () + (rider-trans) + (cond + ((-> self bouncing) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self basetrans quad)) + (+! (-> gp-0 y) (* (-> self bounce-scale) (update! (-> self smush)))) + (move-to-point! (-> self root) gp-0) + ) + (if (not (!= (-> self smush amp) 0.0)) + (set! (-> self bouncing) #f) + ) + ) + (else + (move-to-point! (-> self root) (-> self basetrans)) + ) + ) + (none) + ) + +(defbehavior plat-post base-plat () + (update-part-and-sfx! self) + (rider-post) + (none) + ) + +(defmethod base-plat-method-33 ((this base-plat)) + 0 + (none) + ) + +(defmethod update-part-and-sfx! ((this base-plat)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (when (nonzero? (-> this sound)) + (set! (-> this sound trans quad) (-> this root trans quad)) + (update! (-> this sound)) + ) + (none) + ) + +;; WARN: Return type mismatch none vs object. +(defbehavior plat-event base-plat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('bonk) + (start-bounce! self) + ) + ) + ) + +(deftype eco-door (process-drawable) + ((root collide-shape :override) + (speed float) + (open-distance float) + (close-distance float) + (out-dir vector :inline) + (open-sound sound-name) + (close-sound sound-name) + (state-actor entity-actor) + (flags eco-door-flags) + (locked symbol) + (auto-close symbol) + (one-way symbol) + ) + (:state-methods + door-closed + door-opening + door-open + door-closing + ) + (:methods + (update-lock-status! (_type_) none) + (init-collision! (_type_) none) + (eco-door-method-26 (_type_) none) + ) + ) + + +;; WARN: Return type mismatch symbol vs object. +(defbehavior eco-door-event-handler eco-door ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('trigger) + (set! (-> self locked) (not (-> self locked))) + (cond + ((-> self locked) + (if (and (-> self next-state) (= (-> self next-state name) 'door-closed)) + (sound-play "door-lock") + ) + ) + (else + (sound-play "door-unlock") + ) + ) + #t + ) + ) + ) + +(defstate door-closed (eco-door) + :virtual #t + :code (behavior () + (ja :num-func num-func-identity :frame-num 0.0) + (suspend) + (update-transforms (-> self root)) + (ja-post) + (until #f + (when (and *target* + (and (>= (-> self open-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (update-lock-status! self) + (if (and (not (-> self locked)) + (or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + (send-event *target* 'query 'powerup (pickup-type eco-blue)) + (and (-> self one-way) (< (vector4-dot (-> self out-dir) (target-pos 0)) -8192.0)) + ) + ) + (go-virtual door-opening) + ) + ) + (suspend) + ) + #f + ) + ) + +(defstate door-opening (eco-door) + :virtual #t + :code (behavior () + (if (and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + ) + (send-event *target* 'query 'powerup (pickup-type eco-blue)) + ) + (sound-play "blue-eco-on" :position (-> self root trans)) + ) + (sound-play-by-name (-> self open-sound) (new-sound-id) 1024 0 0 (sound-group) #t) + (let ((v1-14 (-> self root root-prim))) + (set! (-> v1-14 prim-core collide-as) (collide-spec)) + (set! (-> v1-14 prim-core collide-with) (collide-spec)) + ) + 0 + (until (ja-done? 0) + (ja :num! (seek! max (-> self speed))) + (suspend) + ) + (go-virtual door-open) + ) + :post transform-post + ) + +(defstate door-open (eco-door) + :virtual #t + :code (behavior () + (set-time! (-> self state-time)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (ja :num-func num-func-identity :frame-num max) + (logior! (-> self draw status) (draw-control-status no-draw)) + (suspend) + (update-transforms (-> self root)) + (ja-post) + (until #f + (let ((f30-0 (vector4-dot (-> self out-dir) (target-pos 0))) + (f28-0 (vector4-dot (-> self out-dir) (camera-pos))) + ) + (when (and (-> self auto-close) + (or (not *target*) + (or (< (-> self close-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + ) + (if (and (>= (* f30-0 f28-0) 0.0) (< 16384.0 (fabs f28-0))) + (go-virtual door-closing) + ) + ) + ) + (suspend) + ) + #f + ) + ) + +(defstate door-closing (eco-door) + :virtual #t + :code (behavior () + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> self root backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((gp-0 (new 'stack 'overlaps-others-params))) + (set! (-> gp-0 options) (overlaps-others-options oo0)) + (set! (-> gp-0 tlist) #f) + (while (find-overlapping-shapes (-> self root) gp-0) + (suspend) + ) + ) + (sound-play-by-name (-> self close-sound) (new-sound-id) 1024 0 0 (sound-group) #t) + (until (ja-done? 0) + (ja :num! (seek! 0.0 (-> self speed))) + (suspend) + ) + (if (-> self locked) + (sound-play "door-lock") + ) + (go-virtual door-closed) + ) + :post transform-post + ) + +(defmethod update-lock-status! ((this eco-door)) + (when (-> this state-actor) + (if (logtest? (-> this state-actor extra perm status) (entity-perm-status subtask-complete)) + (set! (-> this locked) (logtest? (-> this flags) (eco-door-flags unlocked))) + (set! (-> this locked) (logtest? (-> this flags) (eco-door-flags locked))) + ) + ) + 0 + (none) + ) + +(defmethod init-collision! ((this eco-door)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 0) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 16384.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod eco-door-method-26 ((this eco-door)) + 0 + (none) + ) + +(defmethod init-from-entity! ((this eco-door) (arg0 entity-actor)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (let ((f0-0 (res-lump-float (-> this entity) 'scale :default 1.0))) + (set-vector! (-> this root scale) f0-0 f0-0 f0-0 1.0) + ) + (set! (-> this open-distance) 32768.0) + (set! (-> this close-distance) 49152.0) + (set! (-> this speed) 1.0) + (set! (-> this state-actor) #f) + (let ((v1-8 (entity-actor-lookup arg0 'state-actor 0))) + (if v1-8 + (set! (-> this state-actor) v1-8) + ) + ) + (set! (-> this locked) #f) + (set! (-> this flags) (res-lump-value arg0 'flags eco-door-flags :time -1000000000.0)) + (update-lock-status! this) + (set! (-> this auto-close) (logtest? (-> this flags) (eco-door-flags auto-close))) + (set! (-> this one-way) (logtest? (-> this flags) (eco-door-flags one-way))) + (vector-z-quaternion! (-> this out-dir) (-> this root quat)) + (set! (-> this out-dir w) (- (vector-dot (-> this out-dir) (-> this root trans)))) + (update-transforms (-> this root)) + (eco-door-method-26 this) + (if (and (not (-> this auto-close)) + (-> this entity) + (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)) + ) + (go (method-of-object this door-open)) + (go (method-of-object this door-closed)) + ) + ) diff --git a/goal_src/jak3/engine/common-obs/blocking-plane.gc b/goal_src/jak3/engine/common-obs/blocking-plane.gc index ca8a655c722..7b681e325a3 100644 --- a/goal_src/jak3/engine/common-obs/blocking-plane.gc +++ b/goal_src/jak3/engine/common-obs/blocking-plane.gc @@ -7,3 +7,261 @@ ;; DECOMP BEGINS +(deftype blocking-plane (process-drawable) + ((root collide-shape :override) + (current-attack-mode symbol) + ) + (:state-methods + idle + ) + (:methods + (init! (_type_ (inline-array vector) float) none) + ) + ) + + +(defskelgroup skel-blocking-plane blocking-plane blocking-plane-lod0-jg blocking-plane-idle-ja + ((blocking-plane-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 100.1) + :texture-level 10 + ) + +(defstate idle (blocking-plane) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('on) + (cond + ((nonzero? (-> self root)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! v0-0 (-> self root backup-collide-with)) + (set! (-> v1-3 prim-core collide-with) (the-as collide-spec v0-0)) + ) + v0-0 + ) + (else + (let ((gp-1 (-> self child))) + (while gp-1 + (let ((s5-0 (ppointer->process gp-1))) + (set! gp-1 (-> gp-1 0 brother)) + (if (type? s5-0 blocking-plane) + (send-event s5-0 'on) + ) + ) + ) + ) + #f + ) + ) + ) + (('off) + (cond + ((nonzero? (-> self root)) + (let ((v1-13 (-> self root root-prim))) + (set! (-> v1-13 prim-core collide-as) (collide-spec)) + (set! (-> v1-13 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (else + (let ((gp-2 (-> self child))) + (while gp-2 + (let ((s5-1 (ppointer->process gp-2))) + (set! gp-2 (-> gp-2 0 brother)) + (if (type? s5-1 blocking-plane) + (send-event s5-1 'off) + ) + ) + ) + ) + #f + ) + ) + ) + (('collide-as) + (set! v0-0 (-> block param 0)) + (set! (-> self root root-prim prim-core collide-as) (the-as collide-spec v0-0)) + v0-0 + ) + (('attack-mode) + (set! v0-0 (-> block param 0)) + (set! (-> self current-attack-mode) (the-as symbol v0-0)) + v0-0 + ) + (('touch 'bonk 'attack) + (when (-> self current-attack-mode) + (let ((v1-25 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (if (< (vector-dot + (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable proc) root trans) (-> self root trans)) + v1-25 + ) + 0.0 + ) + (vector-float*! v1-25 v1-25 -1.0) + ) + (send-event + proc + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode (-> self current-attack-mode)) + (vector v1-25) + (shove-up (meters 2)) + (shove-back (meters 4)) + ) + ) + ) + ) + ) + ) + (('impact-impulse) + (send-event (ppointer->process (-> self parent)) 'blocking-plane-hit (-> block param 0)) + ) + ) + ) + :code sleep-code + ) + +(defmethod init! ((this blocking-plane) (arg0 (inline-array vector)) (arg1 float)) + (let ((s3-0 (-> arg0 0)) + (s4-0 (-> arg0 1)) + ) + 0.0 + (* 0.5 (vector-vector-distance s3-0 s4-0)) + (let ((s2-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (let ((v1-3 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle blocking-plane)) + (set! (-> v1-3 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list)) + (set! (-> v1-3 prim-core action) (collide-action solid)) + (set! (-> v1-3 transform-index) 3) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-3) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-6 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> this root) s2-0) + ) + (let ((s1-0 (new 'stack-no-clear 'matrix)) + (s2-1 (-> this root)) + ) + (vector+! (-> s2-1 trans) s3-0 s4-0) + (vector-float*! (-> s2-1 trans) (-> s2-1 trans) 0.5) + (+! (-> s2-1 trans y) (* 0.5 arg1)) + (vector-! (-> s1-0 rvec) s4-0 s3-0) + (let ((f30-1 (vector-normalize-ret-len! (-> s1-0 rvec) 1.0))) + (set! (-> s2-1 scale x) (* 0.00024414062 f30-1)) + (set! (-> s2-1 scale y) (* 0.00024414062 arg1)) + (set! (-> s2-1 scale z) 0.0) + (set! (-> s1-0 uvec quad) (-> (new 'static 'vector :y 1.0 :w 1.0) quad)) + (vector-cross! (-> s1-0 fvec) (-> s1-0 rvec) (-> s1-0 uvec)) + (vector-normalize! (-> s1-0 fvec) 1.0) + (matrix->quaternion (-> s2-1 quat) s1-0) + (let ((v1-20 (-> this root root-prim local-sphere))) + (set! (-> v1-20 x) 0.0) + (set! (-> v1-20 y) (* 0.00024414062 (* 0.5 arg1))) + (set! (-> v1-20 z) 0.0) + (let ((f0-17 0.5) + (f1-7 (* f30-1 f30-1)) + (f2-2 arg1) + ) + (set! (-> v1-20 w) (* f0-17 (sqrtf (+ f1-7 (* f2-2 f2-2))))) + ) + ) + ) + ) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-blocking-plane" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (logior! (-> this draw status) (draw-control-status no-draw-bounds)) + (transform-post) + (none) + ) + +(defbehavior blocking-plane-init-by-other blocking-plane ((arg0 (inline-array vector)) (arg1 float)) + (if (not arg0) + (deactivate self) + ) + (init! self arg0 arg1) + (set! (-> self current-attack-mode) #f) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (go-virtual idle) + ) + +(defmethod init-from-entity! ((this blocking-plane) (arg0 entity-actor)) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this current-attack-mode) #f) + (let ((s5-0 (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (f30-0 (res-lump-float (-> this entity) 'height :default 122880.0)) + ) + (set! (-> this path) s5-0) + (if (or (not s5-0) (< (-> s5-0 curve num-cverts) 2)) + (go process-drawable-art-error "bad path") + ) + (logior! (-> s5-0 flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((s4-0 (+ (-> s5-0 curve num-cverts) -1)) + (s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) + ) + (dotimes (v1-14 2) + (set! (-> s3-0 v1-14 quad) (the-as uint128 0)) + ) + (dotimes (s2-0 s4-0) + (get-point-in-path! s5-0 (-> s3-0 0) (the float s2-0) 'interp) + (get-point-in-path! s5-0 (-> s3-0 1) (the float (+ s2-0 1)) 'interp) + (process-spawn blocking-plane s3-0 f30-0 :name "blocking-plane" :to this) + ) + ) + ) + (go (method-of-object this idle)) + ) + +(defbehavior blocking-plane-spawn process ((arg0 curve-control) (arg1 (inline-array vector)) (arg2 float)) + (cond + ((and arg1 (or (not arg0) (logtest? (-> arg0 flags) (path-control-flag not-found)))) + (process-spawn blocking-plane arg1 arg2 :name "blocking-plane" :to self) + ) + (else + (let ((s4-1 (the int (get-num-segments arg0))) + (s3-0 0) + (s2-0 (new 'stack-no-clear 'inline-array 'vector 2)) + ) + (dotimes (v1-8 2) + (set! (-> s2-0 v1-8 quad) (the-as uint128 0)) + ) + (while (< s3-0 s4-1) + (get-point-in-path! arg0 (-> s2-0 0) (the float s3-0) 'interp) + (get-point-in-path! arg0 (-> s2-0 1) (the float (+ s3-0 1)) 'interp) + (process-spawn blocking-plane s2-0 arg2 :name "blocking-plane" :to self) + (+! s3-0 2) + ) + ) + ) + ) + 0 + (none) + ) + +(defbehavior blocking-plane-destroy blocking-plane () + (let ((gp-0 (-> self child))) + (while gp-0 + (let ((s5-0 (ppointer->process gp-0))) + (set! gp-0 (-> gp-0 0 brother)) + (if (type? s5-0 blocking-plane) + (deactivate s5-0) + ) + ) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/common-obs/bouncer.gc b/goal_src/jak3/engine/common-obs/bouncer.gc index e69e2e1fdb7..958bb0b16f9 100644 --- a/goal_src/jak3/engine/common-obs/bouncer.gc +++ b/goal_src/jak3/engine/common-obs/bouncer.gc @@ -7,3 +7,243 @@ ;; DECOMP BEGINS +(deftype bouncer (process-drawable) + ((root collide-shape :override) + (spring-height meters) + (smush float) + (mods basic) + (use-alternate-jump? symbol) + ) + (:state-methods + idle + fire + smush + ) + (:methods + (bouncer-method-23 (_type_) none) + (bouncer-method-24 (_type_) none) + (play-sound (_type_) none) + (bouncer-method-26 (_type_) none) + ) + ) + + +(method-set! bouncer 12 (method-of-type process run-logic?)) + +(defstate idle (bouncer) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('bonk) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self root) + (the-as uint 1) + ) + (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + (play-sound self) + (go-virtual fire) + ) + ) + ) + (('touch) + (let ((gp-1 (-> block param 0))) + (cond + (((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (collide-action solid) + (collide-action) + ) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (the-as uint 1) + ) + (if (not (and (-> self next-state) (let ((v1-22 (-> self next-state name))) + (or (= v1-22 'smush) (= v1-22 'fire)) + ) + ) + ) + (go-virtual smush) + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (the-as uint 4) + ) + (persist-with-delay + *setting-control* + (the-as symbol (process->ppointer self)) + (seconds 0.05) + 'double-jump + #f + 0.0 + 0 + ) + ) + ) + ) + ) + (('attack) + (let ((v1-29 (the-as object (-> block param 1))) + (a0-16 (-> block param 0)) + (a2-6 0) + ) + (cond + ((= (-> (the-as attack-info v1-29) mode) 'flop) + (set! a2-6 1) + ) + ((= (-> (the-as attack-info v1-29) mode) 'board) + (set! a2-6 9) + ) + ) + (when (and (nonzero? a2-6) + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry a0-16) + (-> self root) + (the-as uint a2-6) + ) + (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + ) + ) + (play-sound self) + (go-virtual fire) + #f + ) + ) + ) + ) + ) + :code (behavior () + (if (nonzero? (-> self draw)) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + ) + (transform-post) + (until #f + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + #f + ) + ) + +(defstate smush (bouncer) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touch) + (set-time! (-> self state-time)) + #f + ) + (else + ((-> (method-of-object self idle) event) proc argc message block) + ) + ) + ) + :code (behavior () + (set-time! (-> self state-time)) + (set! (-> self smush) 0.0) + (until #f + (if (and (nonzero? (-> self draw)) (time-elapsed? (-> self state-time) (seconds 0.2))) + (ja :num! (seek! 0.0 0.1)) + (ja :num! (seek! + (lerp-scale + (ja-aframe 6.0 0) + (ja-aframe 2.0 0) + (vector-vector-xz-distance (target-pos 0) (-> self root trans)) + 0.0 + 4096.0 + ) + 0.2 + ) + ) + ) + (suspend) + (let ((v1-17 (and (nonzero? (-> self draw)) (ja-min? 0)))) + (if v1-17 + (go-virtual idle) + (go-virtual idle) + ) + ) + ) + #f + ) + :post transform-post + ) + +(defstate fire (bouncer) + :virtual #t + :code (behavior () + (when (or (-> self use-alternate-jump?) (-> *setting-control* user-current use-alternate-bouncer?)) + (persist-with-delay *setting-control* 'slave-options (seconds 2.5) 'slave-options 'clear 0.0 16) + (persist-with-delay *setting-control* 'slave-options2 (seconds 2.5) 'slave-options 'set 0.0 #x2000000) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + (bouncer-method-26 self) + (when (nonzero? (-> self draw)) + (ja-no-eval :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) + :num! (seek!) + :frame-num (ja-aframe 6.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (go-virtual idle) + ) + :post transform-post + ) + +(defmethod play-sound ((this bouncer)) + (sound-play "trampoline") + 0 + (none) + ) + +(defmethod bouncer-method-26 ((this bouncer)) + 0 + (none) + ) + +(defmethod bouncer-method-23 ((this bouncer)) + (break!) + 0 + (none) + ) + +(defmethod bouncer-method-24 ((this bouncer)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 0) + (set-vector! (-> v1-2 local-sphere) 0.0 3072.0 0.0 6963.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod init-from-entity! ((this bouncer) (arg0 entity-actor)) + (set! (-> this mods) #f) + (bouncer-method-24 this) + (process-drawable-from-entity! this arg0) + (bouncer-method-23 this) + (nav-mesh-connect-from-ent this) + (set! (-> this spring-height) (res-lump-float arg0 'spring-height :default 45056.0)) + (set! (-> this use-alternate-jump?) (= (res-lump-value arg0 'behavior-type uint128 :time -1000000000.0) 1)) + (go (method-of-object this idle)) + ) diff --git a/goal_src/jak3/engine/common-obs/collectables.gc b/goal_src/jak3/engine/common-obs/collectables.gc index 4c99de329b9..da55b0fffcc 100644 --- a/goal_src/jak3/engine/common-obs/collectables.gc +++ b/goal_src/jak3/engine/common-obs/collectables.gc @@ -467,50 +467,16 @@ (cond ((logtest? (-> this collect-effect flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s4-10 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-10 - (let ((t9-23 (method-of-type part-tracker-subsampler activate))) - (t9-23 (the-as part-tracker-subsampler s4-10) s5-1 "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-24 run-function-in-process) - (a0-77 s4-10) - (a1-33 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> this collect-effect)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-24) a0-77 a1-33 *part-tracker-subsampler-params-default*) - ) - (-> s4-10 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to s5-1 + :group (-> this collect-effect) + :callback part-tracker-track-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s4-11 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-11 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker s4-11) s5-1 "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-84 s4-11) - (a1-36 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> this collect-effect)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-84 a1-36 *part-tracker-params-default*) - ) - (-> s4-11 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to s5-1 :group (-> this collect-effect) :callback part-tracker-track-target) ) ) ) @@ -518,99 +484,68 @@ (cond ((logtest? (-> this collect-effect2 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-29 (method-of-type part-tracker-subsampler activate))) - (t9-29 (the-as part-tracker-subsampler s5-2) this "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-30 run-function-in-process) - (a0-91 s5-2) - (a1-39 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> this collect-effect2)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) - (lambda ((arg0 part-tracker)) - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) + (part-tracker-spawn + part-tracker-subsampler + :to this + :group (-> this collect-effect2) + :callback (lambda ((arg0 part-tracker)) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) - ) - ) - ) - ) - ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) ) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint (process->handle this))) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-30) a0-91 a1-39 *part-tracker-subsampler-params-default*) + ) + ) ) - (-> s5-2 ppointer) ) + :userdata (the-as uint (process->handle this)) ) ) (else (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-32 (method-of-type part-tracker activate))) - (t9-32 (the-as part-tracker s5-3) this "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-33 run-function-in-process) - (a0-98 s5-3) - (a1-42 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> this collect-effect2)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) - (lambda ((arg0 part-tracker)) - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) + (part-tracker-spawn + part-tracker + :to this + :group (-> this collect-effect2) + :callback (lambda ((arg0 part-tracker)) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) - ) - ) - ) - ) - ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) ) - (set! (-> *part-tracker-params-default* userdata) (the-as uint (process->handle this))) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-33) a0-98 a1-42 *part-tracker-params-default*) + ) + ) ) - (-> s5-3 ppointer) ) + :userdata (the-as uint (process->handle this)) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/crates.gc b/goal_src/jak3/engine/common-obs/crates.gc index 27fe2a2e4ee..6350aca3db2 100644 --- a/goal_src/jak3/engine/common-obs/crates.gc +++ b/goal_src/jak3/engine/common-obs/crates.gc @@ -964,50 +964,11 @@ (cond ((logtest? (-> *part-group-id-table* 197 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-9 - (let ((t9-19 (method-of-type part-tracker-subsampler activate))) - (t9-19 (the-as part-tracker-subsampler s5-9) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-20 run-function-in-process) - (a0-41 s5-9) - (a1-20 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 197)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-20) a0-41 a1-20 *part-tracker-subsampler-params-default*) - ) - (-> s5-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 197)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-10 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s5-10) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-47 s5-10) - (a1-23 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 197)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-23) a0-47 a1-23 *part-tracker-params-default*) - ) - (-> s5-10 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 197)) ) ) ) @@ -1015,99 +976,21 @@ (cond ((logtest? (-> *part-group-id-table* 196 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-11 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-11 - (let ((t9-25 (method-of-type part-tracker-subsampler activate))) - (t9-25 (the-as part-tracker-subsampler s5-11) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-26 run-function-in-process) - (a0-55 s5-11) - (a1-27 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 196)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-26) a0-55 a1-27 *part-tracker-subsampler-params-default*) - ) - (-> s5-11 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 196)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-12 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-12 - (let ((t9-28 (method-of-type part-tracker activate))) - (t9-28 (the-as part-tracker s5-12) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-29 run-function-in-process) - (a0-61 s5-12) - (a1-30 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 196)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-29) a0-61 a1-30 *part-tracker-params-default*) - ) - (-> s5-12 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 196)) ) ) ) ((logtest? (-> *part-group-id-table* 195 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-13 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-13 - (let ((t9-31 (method-of-type part-tracker-subsampler activate))) - (t9-31 (the-as part-tracker-subsampler s5-13) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-67 s5-13) - (a1-33 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 195)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-32) a0-67 a1-33 *part-tracker-subsampler-params-default*) - ) - (-> s5-13 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 195)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-14 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-14 - (let ((t9-34 (method-of-type part-tracker activate))) - (t9-34 (the-as part-tracker s5-14) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-35 run-function-in-process) - (a0-73 s5-14) - (a1-36 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 195)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-35) a0-73 a1-36 *part-tracker-params-default*) - ) - (-> s5-14 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 195)) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/debris.gc b/goal_src/jak3/engine/common-obs/debris.gc index 13e6a418cdb..14317b89e04 100644 --- a/goal_src/jak3/engine/common-obs/debris.gc +++ b/goal_src/jak3/engine/common-obs/debris.gc @@ -7,3 +7,593 @@ ;; DECOMP BEGINS +(deftype debris-static-joint-params (structure) + ((parent-joint-index int16) + (group string) + (offset vector) + ) + ) + + +(deftype debris-static-params (basic) + ((joints (array debris-static-joint-params)) + (collide-spec collide-spec) + (sound-hit sound-name) + (art-level symbol) + ) + ) + + +(deftype debris (basic) + ((root transformq :inline) + (node-list cspace-array) + (draw draw-control) + (duration float) + (hit-xz-reaction float) + (hit-y-reaction float) + (prev-pos vector :inline) + (gravity float) + (rot-axis vector :inline) + (rot-angle float) + (transv vector :inline) + (time-fade-out time-frame) + (params debris-static-params) + ) + ) + + +(deftype debris-box (structure) + ((start uint32) + (num uint32) + (bbox bounding-box :inline) + ) + ) + + +(deftype debris-group (process) + ((dead-debris-num int32) + (debris-num int32) + (debris (array debris)) + (max-probe-width float) + (state-time time-frame) + (num-boxes uint32) + (boxes debris-box 16 :inline) + ) + (:state-methods + idle + ) + (:methods + (do-collision (_type_ int) none) + (update-box! (_type_ int) none) + ) + ) + + +(deftype debris-tuning (structure) + ((explosion uint64) + (duration time-frame) + (gravity float) + (rot-speed float) + (bounds-inflate float) + (max-probe-width float) + (max-probe-height float) + (max-probe-depth float) + (fountain-rand-transv-lo vector :inline) + (fountain-rand-transv-hi vector :inline) + (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) + (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi data 0)) + (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi data 1)) + (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi data 2)) + (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi data 3)) + (hit-xz-reaction float) + (hit-y-reaction float) + (scale-rand-lo float) + (scale-rand-hi float) + ) + (:methods + (new (symbol type uint) _type_) + ) + ) + + +;; WARN: Return type mismatch structure vs debris-tuning. +(defmethod new debris-tuning ((allocation symbol) (type-to-make type) (arg0 uint)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((v0-0 (t9-0 allocation v1-1))) + (set! (-> (the-as debris-tuning v0-0) explosion) arg0) + (set! (-> (the-as debris-tuning v0-0) duration) (seconds 1)) + (set! (-> (the-as debris-tuning v0-0) gravity) -286720.0) + (set! (-> (the-as debris-tuning v0-0) rot-speed) 180.0) + (set! (-> (the-as debris-tuning v0-0) bounds-inflate) 16384.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-width) 40960.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-height) 24576.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-depth) 20480.0) + (set! (-> (the-as debris-tuning v0-0) hit-xz-reaction) 0.75) + (set! (-> (the-as debris-tuning v0-0) hit-y-reaction) 0.7) + (set! (-> (the-as debris-tuning v0-0) scale-rand-lo) 0.8) + (set! (-> (the-as debris-tuning v0-0) scale-rand-hi) 2.0) + (cond + ((zero? arg0) + (set-vector! (-> (the-as debris-tuning v0-0) fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0) + (set-vector! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0) + ) + ((= arg0 1) + (vector-reset! (-> (the-as debris-tuning v0-0) fountain-rand-transv-lo)) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi x) 49152.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi y) 163840.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi z) 20480.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi w) 61440.0) + ) + ) + (the-as debris-tuning v0-0) + ) + ) + ) + +(defmethod update-box! ((this debris-group) (idx int)) + (let ((debris-box (-> this boxes idx))) + (dotimes (i (the-as int (-> debris-box num))) + (let ((debris (-> this debris (+ i (-> debris-box start))))) + (if (zero? i) + (set-to-point! (-> debris-box bbox) (the-as vector (-> debris root))) + (add-point! (-> debris-box bbox) (the-as vector (-> debris root))) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod do-collision ((this debris-group) (idx int)) + (local-vars + (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) + (name sound-name) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((debris-box (-> this boxes idx)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) + ) + (when (> box-num 0) + (let ((cquery (new 'static 'collide-query))) + (let ((debris-start (-> this debris box-start))) + (let ((a3-0 (-> cquery bbox)) + (a1-2 (-> bbox min)) + (a2-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-0 x) 4096.0) + (set! (-> a2-0 y) 4096.0) + (set! (-> a2-0 z) 4096.0) + (set! (-> a2-0 w) 1.0) + (vector-! (the-as vector a3-0) a1-2 a2-0) + ) + (let ((a1-3 (-> cquery bbox max)) + (a0-2 (-> bbox max)) + (a2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-1 x) 4096.0) + (set! (-> a2-1 y) 4096.0) + (set! (-> a2-1 z) 4096.0) + (set! (-> a2-1 w) 1.0) + (vector+! a1-3 a0-2 a2-1) + ) + (set! (-> cquery collide-with) (-> debris-start params collide-spec)) + ) + (set! (-> cquery ignore-process0) #f) + (set! (-> cquery ignore-process1) #f) + (set! (-> cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> cquery action-mask) (collide-action solid)) + (fill-using-bounding-box *collide-cache* cquery) + (dotimes (s2-0 (the-as int box-num)) + (let ((s1-0 (-> this debris (+ s2-0 box-start)))) + (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) + (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) + (s0-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> s1-0 prev-pos quad) (-> s1-0 root trans quad)) + (+! (-> s1-0 transv y) f0-9) + (vector-v+! (the-as vector (-> s1-0 root)) (the-as vector (-> s1-0 root)) (-> s1-0 transv)) + (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) + (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) + ) + (quaternion-normalize! (-> s1-0 root quat)) + (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) + (when (nonzero? (-> s1-0 params collide-spec)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (vector-! (-> cquery move-dist) (the-as vector (-> s1-0 root)) (-> s1-0 prev-pos)) + (set! (-> cquery start-pos quad) (-> s1-0 prev-pos quad)) + (let ((v1-34 cquery)) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) + (set! (-> v1-34 ignore-process0) #f) + (set! (-> v1-34 ignore-process1) #f) + (set! (-> v1-34 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) + (when (>= f0-16 0.0) + (let ((a1-12 s0-1)) + (let ((v1-37 (-> cquery start-pos))) + (let ((a0-21 (-> cquery move-dist))) + (let ((a2-5 f0-16)) + (.mov vf7 a2-5) + ) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.lvf vf4 (&-> v1-37 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-12 quad) vf6) + ) + (let* ((v1-38 (-> s1-0 transv)) + (f30-0 (sqrtf (+ (* (-> v1-38 x) (-> v1-38 x)) (* (-> v1-38 z) (-> v1-38 z))))) + ) + (let ((f28-0 (vector-length (-> s1-0 transv)))) + (when (< (-> s1-0 transv y) -61440.0) + (set! sv-80 sound-play-by-name) + (set! name (-> s1-0 params sound-hit)) + (let ((id (new-sound-id)) + (a2-6 1024) + (a3-6 0) + (t0-4 0) + (t1-0 0) + (t2-0 (-> s1-0 root)) + ) + (sv-80 name id a2-6 a3-6 t0-4 (the-as sound-group t1-0) t2-0) + ) + ) + (vector-reflect! (-> s1-0 transv) (-> s1-0 transv) (-> cquery best-other-tri normal)) + (vector-reflect! (-> s1-0 rot-axis) (-> s1-0 rot-axis) (-> cquery best-other-tri normal)) + (set! (-> s1-0 rot-angle) f28-0) + ) + (let ((f28-1 (-> s1-0 transv y))) + (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) + (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) + ) + ) + (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) + (set! (-> s0-1 w) 1.0) + (set! (-> s1-0 root trans quad) (-> s0-1 quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defstate idle (debris-group) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (set! (-> self dead-debris-num) (-> self debris-num)) + (dotimes (i (-> self debris-num)) + (let ((debris (-> self debris i)) + (draw-ctrl (-> self debris i draw)) + ) + (matrix<-transformq+trans! + (the-as matrix (-> draw-ctrl skeleton bones 3)) + (-> debris root) + (-> draw-ctrl skeleton bones 0 transform trans) + ) + (logclear! (-> draw-ctrl status) (draw-control-status no-draw-temp uninited)) + (vector+! (-> draw-ctrl origin) (-> draw-ctrl skeleton bones 3 transform trans) (-> draw-ctrl bounds)) + (set! (-> draw-ctrl origin w) (-> draw-ctrl bounds w)) + (cond + ((zero? (-> debris time-fade-out)) + (if (or (< (vector-length (-> debris transv)) 4096.0) + (time-elapsed? (-> self state-time) (the int (-> debris duration))) + ) + (set-time! (-> debris time-fade-out)) + ) + ) + ((time-elapsed? (-> debris time-fade-out) (seconds 0.5)) + (logior! (-> draw-ctrl status) (draw-control-status no-draw)) + (+! (-> self dead-debris-num) -1) + ) + (else + (logior! (-> draw-ctrl status) (draw-control-status force-fade)) + (set! (-> draw-ctrl force-fade) + (the-as uint (the int (- 128.0 (* 0.85333335 (the float (- (current-time) (-> debris time-fade-out))))))) + ) + ) + ) + ) + ) + (if (zero? (-> self dead-debris-num)) + (deactivate self) + ) + (dotimes (ii (the-as int (-> self num-boxes))) + (let* ((debris-box (-> self boxes ii)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) + (s2-0 0) + ) + (update-box! self ii) + (if (< (- (-> bbox max data s2-0) (-> bbox min data s2-0)) (- (-> bbox max y) (-> bbox min y))) + (set! s2-0 1) + ) + (if (< (- (-> bbox max data s2-0) (-> bbox min data s2-0)) (- (-> bbox max z) (-> bbox min z))) + (set! s2-0 2) + ) + (when (and (< (-> self max-probe-width) (- (-> debris-box bbox max data s2-0) (-> bbox min data s2-0))) + (< (-> self num-boxes) (the-as uint 15)) + ) + 0.0 + (let ((a1-3 (new 'static 'boxed-array :type debris :length 0 :allocated-length 32)) + (a0-12 0) + (v1-72 0) + (a2-4 (-> self boxes (-> self num-boxes))) + ) + (let ((f0-14 (* 0.5 (+ (-> debris-box bbox min data s2-0) (-> debris-box bbox max data s2-0))))) + (dotimes (a3-6 (the-as int box-num)) + (let ((t0-4 (-> self debris (+ a3-6 (-> debris-box start))))) + (cond + ((< (-> t0-4 root trans data s2-0) f0-14) + (set! (-> self debris (+ a0-12 box-start)) (-> self debris (+ a3-6 box-start))) + (+! a0-12 1) + ) + (else + (set! (-> a1-3 v1-72) (-> self debris (+ a3-6 box-start))) + (+! v1-72 1) + ) + ) + ) + ) + ) + (dotimes (a3-9 v1-72) + (set! (-> self debris (+ a0-12 box-start a3-9)) (-> a1-3 a3-9)) + ) + (set! (-> debris-box num) (the-as uint a0-12)) + (set! (-> a2-4 start) (+ box-start a0-12)) + (set! (-> a2-4 num) (the-as uint v1-72)) + ) + (update-box! self ii) + (update-box! self (the-as int (-> self num-boxes))) + (+! (-> self num-boxes) 1) + ) + ) + ) + (dotimes (gp-2 (the-as int (-> self num-boxes))) + (do-collision self gp-2) + ) + ) + :code sleep-code + ) + +;; WARN: Return type mismatch process vs debris-group. +(defmethod relocate ((this debris-group) (offset int)) + (dotimes (v1-0 (-> this debris length)) + (if (nonzero? (-> this debris v1-0 node-list)) + (&+! (-> this debris v1-0 node-list) offset) + ) + (if (nonzero? (-> this debris v1-0 draw)) + (&+! (-> this debris v1-0 draw) offset) + ) + (if (nonzero? (-> this debris v1-0)) + (&+! (-> this debris v1-0) offset) + ) + ) + (if (nonzero? (-> this debris)) + (&+! (-> this debris) offset) + ) + (the-as debris-group ((method-of-type process relocate) this offset)) + ) + +(defbehavior debris-group-init-by-other debris-group ((tuning debris-tuning) (params debris-static-params) (pdraw process-drawable)) + (local-vars (tuning-scale vector) (debris-scale vector) (sv-80 vector) (sv-96 vector) (sv-112 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self debris-num) (-> params joints length)) + (set! (-> self debris) (new 'process 'boxed-array debris (-> self debris-num))) + (set! (-> self debris length) (-> self debris allocated-length)) + (dotimes (i (-> params joints length)) + (set! (-> self debris i) (new 'process 'debris)) + (let ((skel (art-group-get-by-name *level* (-> params joints i group) (the-as (pointer level) #f))) + (debris (-> self debris i)) + ) + (cond + ((and skel (nonzero? skel)) + (set! (-> debris params) params) + (let ((joint-transform (-> pdraw node-list data (-> params joints i parent-joint-index) bone transform))) + (matrix->quaternion (-> debris root quat) joint-transform) + (matrix->trans joint-transform (the-as vector (-> debris root))) + (set! (-> debris root scale quad) (-> pdraw root scale quad)) + (if (nonzero? (-> params joints i offset)) + (vector-matrix*! (the-as vector (-> debris root)) (-> params joints i offset) joint-transform) + ) + ) + (set! debris-scale (-> debris root scale)) + (let ((s0-1 (-> debris root scale))) + (set! tuning-scale (new 'stack-no-clear 'vector)) + (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale w) 1.0) + (.lvf vf4 (&-> s0-1 quad)) + ) + (.lvf vf5 (&-> tuning-scale quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> debris-scale quad) vf6) + (case (-> tuning explosion) + ((1) + (vector-! (-> debris transv) (the-as vector (-> debris root)) (-> tuning fountain-rand-transv-lo)) + (let ((s0-2 vector-normalize!)) + (set! sv-80 (-> debris transv)) + (let ((a1-17 (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)))) + (s0-2 sv-80 a1-17) + ) + ) + (+! (-> debris transv y) + (rand-vu-float-range (-> tuning fountain-rand-transv-hi z) (-> tuning fountain-rand-transv-hi w)) + ) + (set! (-> debris transv w) 1.0) + ) + (else + (set! sv-96 (-> tuning fountain-rand-transv-lo)) + (set! sv-112 (-> tuning fountain-rand-transv-hi)) + (set-vector! + (-> debris transv) + (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) + (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) + (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) + 1.0 + ) + ) + ) + (let ((s0-5 (new 'stack-no-clear 'vector))) + (rand-vu-sphere-point-uniform! s0-5 1.0) + (vector-normalize! s0-5 1.0) + (set! (-> debris rot-axis quad) (-> s0-5 quad)) + ) + (set! (-> debris rot-angle) (* 182.04445 (-> tuning rot-speed))) + (set! (-> debris duration) (the float (-> tuning duration))) + (set! (-> debris hit-xz-reaction) (-> tuning hit-xz-reaction)) + (set! (-> debris hit-y-reaction) (-> tuning hit-y-reaction)) + (set! (-> debris gravity) (-> tuning gravity)) + (set! (-> debris time-fade-out) 0) + (let ((draw (skeleton-group->draw-control + (the-as process-drawable self) + (the-as skeleton-group skel) + (&-> debris node-list) + ) + ) + ) + (set! (-> debris draw) draw) + (set! (-> draw skeleton bones 0 transform trans quad) (-> *null-vector* quad)) + ) + ) + (else + ) + ) + ) + ) + (set! (-> self max-probe-width) (-> tuning max-probe-width)) + (set! (-> self num-boxes) (the-as uint 1)) + (set! (-> self boxes 0 start) (the-as uint 0)) + (set! (-> self boxes 0 num) (the-as uint (-> self debris-num))) + (go-virtual idle) + ) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer debris-group). +(defun debris-spawn ((arg0 process-drawable) (arg1 debris-tuning) (arg2 debris-static-params) (arg3 process-drawable)) + (if (not arg3) + (set! arg3 arg0) + ) + (process-spawn debris-group arg1 arg2 arg3 :name "debris-group" :to arg0 :stack-size #x8000) + ) + +(defskelgroup skel-kg-debris-a kg-debris kg-debris-a-lod0-jg -1 + ((kg-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-kg-debris-b kg-debris kg-debris-b-lod0-jg -1 + ((kg-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-kg-debris-c kg-debris kg-debris-c-lod0-jg -1 + ((kg-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-kg-debris-d kg-debris kg-debris-d-lod0-jg -1 + ((kg-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-neo-debris-a neo-debris neo-debris-a-lod0-jg -1 + ((neo-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-neo-debris-b neo-debris neo-debris-b-lod0-jg -1 + ((neo-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-neo-debris-c neo-debris neo-debris-c-lod0-jg -1 + ((neo-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-neo-debris-d neo-debris neo-debris-d-lod0-jg -1 + ((neo-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-v-marauder-debris-ring interceptor interceptor-debris-ring-lod0-jg -1 + ((interceptor-debris-ring-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-v-marauder-debris-nut interceptor interceptor-debris-nut-lod0-jg -1 + ((interceptor-debris-nut-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-v-marauder-debris-rod interceptor interceptor-debris-rod-lod0-jg -1 + ((interceptor-debris-rod-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-v-marauder-debris-panel interceptor interceptor-debris-panel-lod0-jg -1 + ((interceptor-debris-panel-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-dm-debris-a dm-debris dm-debris-a-lod0-jg -1 + ((dm-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-dm-debris-b dm-debris dm-debris-b-lod0-jg -1 + ((dm-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-dm-debris-c dm-debris dm-debris-c-lod0-jg -1 + ((dm-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +(defskelgroup skel-dm-debris-d dm-debris dm-debris-d-lod0-jg -1 + ((dm-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) diff --git a/goal_src/jak3/engine/common-obs/elevator.gc b/goal_src/jak3/engine/common-obs/elevator.gc index 9a4a3787aec..873822dd2a4 100644 --- a/goal_src/jak3/engine/common-obs/elevator.gc +++ b/goal_src/jak3/engine/common-obs/elevator.gc @@ -5,5 +5,942 @@ ;; name in dgo: elevator ;; dgos: GAME +;; +++elevator-flags +(defenum elevator-flags + :type uint64 + :bitfield #t + (running 0) + (ef1 1) + (waiting 2) + (ef3 3) + (teleport 4) + (prevent-jump 5) + (arrived 6) + (ef7 7) + (fence 8) + (grab 9) + (dormant 10) + ) +;; ---elevator-flags + + +;; +++elevator-status +(defenum elevator-status + :type uint64 + :bitfield #t + (waiting-to-descend) + (waiting-to-ascend) + (moving) + ) +;; ---elevator-status + + ;; DECOMP BEGINS +(deftype elevator-params (structure) + ((xz-threshold float) + (y-threshold float) + (start-pos float) + (move-rate float) + (flags elevator-flags) + ) + ) + + +(deftype path-step (structure) + ((next-pos float) + (dist float) + ) + ) + + +(deftype path-step-inline-array (inline-array-class) + ((data path-step :inline :dynamic) + ) + ) + + +(set! (-> path-step-inline-array heap-base) (the-as uint 16)) + +(deftype elevator (base-plat) + ((params elevator-params :inline) + (path-seq path-step-inline-array) + (path-dest float) + (bottom-top float 2) + (move-pos float 2) + (move-dist float) + (path-pos float) + (path-eased-pos float) + (ride-timer time-frame) + (sticky-player-last-ride-time time-frame) + (elevator-status elevator-status) + (on-activate pair) + (on-deactivate pair) + (on-up pair) + (on-down pair) + (on-running pair) + (on-notice pair) + (on-wait pair) + (sound-id sound-id) + (sound-running-loop sound-spec) + (sound-arrived sound-spec) + (fence-prim-index uint32) + (speed float) + (sound-start sound-spec) + (activate-test pair) + ) + (:state-methods + dormant + waiting + running + arrived + unknown + die + ) + (:methods + (calc-dist-between-points! (_type_ int int) none) + (go-arrived-or-waiting (_type_) none) + (init-params! (_type_) none) + (init-sound! (_type_) none) + (point-inside-shaft? (_type_ vector float float) symbol) + (elevator-method-46 (_type_) object) + (elevator-method-47 (_type_) symbol) + (elevator-method-48 (_type_) none) + (find-closest-point-in-path! (_type_ vector (pointer float) symbol symbol) symbol) + (elevator-method-50 (_type_) none) + (toggle-fence-collision (_type_ symbol) none) + ) + ) + + +(defmethod point-inside-shaft? ((this elevator) (arg0 vector) (arg1 float) (arg2 float)) + #f + ) + +(defmethod elevator-method-50 ((this elevator)) + (let ((gp-0 *target*)) + (when gp-0 + (let ((s4-0 (-> gp-0 control collision-spheres 0)) + (s5-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> s5-0 start-pos quad) (-> s4-0 prim-core world-sphere quad)) + (+! (-> s5-0 start-pos y) 8192.0) + (set! (-> s5-0 start-pos w) 1.0) + (vector-reset! (-> s5-0 move-dist)) + (set! (-> s5-0 move-dist y) -90112.0) + (let ((v1-6 s5-0)) + (set! (-> v1-6 radius) (-> s4-0 local-sphere w)) + (set! (-> v1-6 collide-with) (collide-spec hit-by-others-list pusher)) + (set! (-> v1-6 ignore-process0) gp-0) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) (-> gp-0 control pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (when (< 0.0 f0-5) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-5) + (vector+! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 start-pos)) + (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (the-as vector (-> s4-0 prim-core))) + (move-by-vector! (-> gp-0 control) (-> s5-0 move-dist)) + ) + ) + ) + ) + ) + (none) + ) + +(defmethod toggle-fence-collision ((this elevator) (arg0 symbol)) + (when (and (logtest? (-> this params flags) (elevator-flags fence)) (nonzero? (-> this fence-prim-index))) + (let ((v1-7 (-> (the-as collide-shape-prim-group (-> this root root-prim)) child (-> this fence-prim-index)))) + (cond + (arg0 + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak player-list)) + (set-setting! 'jump #f 0.0 0) + ) + (else + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + (remove-setting! 'jump) + ) + ) + ) + ) + (none) + ) + +(defmethod deactivate ((this elevator)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (sound-stop (-> this sound-id)) + (call-parent-method this) + (none) + ) + +(defmethod init-params! ((this elevator)) + (set! (-> this params xz-threshold) (res-lump-float (-> this entity) 'elevator-xz-threshold :default 81920.0)) + (set! (-> this params y-threshold) (res-lump-float (-> this entity) 'elevator-y-threshold :default 20480.0)) + (set! (-> this params start-pos) (res-lump-float (-> this entity) 'elevator-start-pos)) + (set! (-> this params move-rate) (res-lump-float (-> this entity) 'elevator-move-rate :default 25600.0)) + (set! (-> this params flags) (res-lump-value + (-> this entity) + 'elevator-flags + elevator-flags + :default (the-as uint128 1) + :time -1000000000.0 + ) + ) + 0 + (none) + ) + +(defun ease-value-in-out ((arg0 float) (arg1 float)) + (let* ((f0-0 arg1) + (f4-0 (- 1.0 arg1)) + (f3-0 (/ f0-0 (- 1.0 f4-0))) + (f2-1 (* f0-0 f0-0)) + (f1-6 (+ (* 2.0 f0-0 (- f4-0 f0-0)) f2-1)) + (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) + ) + (/ (cond + ((< arg0 f0-0) + (* arg0 arg0) + ) + ((< arg0 f4-0) + (+ (* 2.0 f0-0 (- arg0 f0-0)) f2-1) + ) + (else + (let ((f0-7 (- 1.0 arg0))) + (- f1-7 (* f0-7 f0-7 f3-0)) + ) + ) + ) + f1-7 + ) + ) + ) + +;; WARN: disable def twice: 11. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defbehavior elevator-event elevator ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('status?) + (and (= (the float (/ (the-as int (-> arg3 param 0)) 8)) (-> self move-pos 0)) + (= (the float (/ (the-as int (-> arg3 param 1)) 8)) (-> self move-pos 1)) + ) + ) + (('ridden) + (let ((v1-8 (handle->process (-> (the-as focus (-> arg3 param 0)) handle)))) + (if (= (-> v1-8 type) target) + (set-time! (-> self sticky-player-last-ride-time)) + ) + ) + #t + ) + (('use-camera) + (if (-> arg3 param 0) + (set-setting! 'entity-name (-> arg3 param 0) 0.0 0) + (remove-setting! 'entity-name) + ) + ) + (('move-to) + (when (and (-> self next-state) (let ((v1-20 (-> self next-state name))) + (or (= v1-20 'waiting) (= v1-20 'arrived)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (cond + ((not (logtest? (-> arg3 param 0) 7)) + (let ((gp-0 (-> arg3 param 0))) + (set! (-> self move-pos 1) (the-as float (if (type? gp-0 float) + (the-as float gp-0) + ) + ) + ) + ) + ) + (else + (case (-> arg3 param 0) + (('quote 'bottom) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('quote 'top) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + ) + (go-virtual running) + ) + ) + (('jump-to) + (cond + ((not (logtest? (-> arg3 param 0) 7)) + (let ((gp-1 (-> arg3 param 0))) + (set! (-> self move-pos 1) (the-as float (if (type? gp-1 float) + (the-as float gp-1) + ) + ) + ) + ) + ) + (else + (case (-> arg3 param 0) + (('quote 'bottom) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('quote 'top) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (get-point-in-path! (-> self path) (-> self basetrans) (-> self move-pos 0) 'interp) + (go-virtual waiting) + ) + (('trigger) + (when (and (-> self next-state) (let ((v1-48 (-> self next-state name))) + (or (= v1-48 'waiting) (= v1-48 'arrived)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (cond + ((= (-> self move-pos 0) (-> self bottom-top 0)) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ((= (-> self move-pos 0) (-> self bottom-top 1)) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + ) + (go-virtual running) + ) + ) + (('query) + (case (-> arg3 param 0) + (('waiting?) + (and (-> self next-state) (= (-> self next-state name) 'waiting)) + ) + (('arrived?) + (and (-> self next-state) (let ((v1-61 (-> self next-state name))) + (or (= v1-61 'arrived) (= v1-61 'waiting)) + ) + ) + ) + (('running?) + (and (-> self next-state) (= (-> self next-state name) 'running)) + ) + (('path-pos?) + (+ (-> self move-pos 0) (* (-> self path-pos) (- (-> self move-pos 1) (-> self move-pos 0)))) + ) + (('player-standing-on?) + (= (-> self sticky-player-last-ride-time) (current-time)) + ) + (('point-inside-shaft?) + (point-inside-shaft? self (the-as vector (-> arg3 param 1)) (-> self bottom-top 1) (-> self bottom-top 0)) + ) + (('going-down?) + (< (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 1) 'interp) y) + (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 0) 'interp) y) + ) + ) + (('going-up?) + (< (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 0) 'interp) y) + (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 1) 'interp) y) + ) + ) + (('bottom?) + (= (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('top?) + (= (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + (('reset) + (go-virtual die) + ) + (('go-dormant) + (go-virtual dormant) + ) + (('set-path-pos) + (set! (-> self path-pos) (the-as float (-> arg3 param 0))) + ) + (else + (plat-event arg0 arg1 arg2 arg3) + ) + ) + ) + +(defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) + (local-vars (sv-32 vector)) + (let ((s1-0 (-> this params)) + (f28-0 0.0) + (f30-0 -1.0) + ) + (dotimes (s0-0 (-> this path curve num-cverts)) + (set! sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp)) + (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) + (or (not arg3) + (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) + (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) + (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) + ) + ) + (let* ((t9-2 vector-vector-distance) + (a1-3 arg0) + (f0-12 (t9-2 sv-32 a1-3)) + ) + (when (or (= f30-0 -1.0) (< f0-12 f28-0)) + (set! f28-0 f0-12) + (set! f30-0 (the float s0-0)) + ) + ) + ) + ) + (when (!= f30-0 -1.0) + (set! (-> arg1 0) f30-0) + #t + ) + ) + ) + +(defmethod elevator-method-46 ((this elevator)) + (let* ((s5-0 *target*) + (a0-2 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (and a0-2 (point-inside-shaft? this (get-trans a0-2 0) (-> this move-pos 0) (-> this move-pos 1))) + ) + ) + +(defmethod elevator-method-47 ((this elevator)) + #t + ) + +(defmethod elevator-method-48 ((this elevator)) + (local-vars (sv-16 float)) + (let ((a0-1 *target*)) + (when (and a0-1 + (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) + (-> a0-1 focus-status) + ) + ) + ) + (set! sv-16 (the-as float 0.0)) + (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) (!= (-> this move-pos 1) sv-16)) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) sv-16) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) + ) + ) + 0 + (none) + ) + +(defbehavior move-post elevator () + (when (nonzero? (-> self sound)) + (let ((f0-3 (sqrtf (sin-rad (* 3.1415925 (-> self path-pos)))))) + (update-vol! (-> self sound) f0-3) + ) + (update-trans! (-> self sound) (-> self root trans)) + (update! (-> self sound)) + ) + (plat-post) + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defbehavior teleport-check elevator () + (local-vars (sv-16 float)) + (when (and *target* (logtest? (-> self params flags) (elevator-flags teleport)) (focus-test? *target* teleporting)) + (set! sv-16 (the-as float 0.0)) + (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) + (set! (-> self move-pos 0) sv-16) + (set! (-> self move-pos 1) sv-16) + (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + ) + ) + (none) + ) + +(defstate dormant (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trigger) + (go-virtual waiting) + ) + (('bonk) + #f + ) + (else + (plat-event proc argc message block) + ) + ) + ) + :trans plat-trans + :code sleep-code + :post plat-post + ) + +(defstate waiting (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('ridden) + (if (elevator-method-47 self) + (logior! (-> self elevator-status) (elevator-status waiting-to-descend)) + ) + (elevator-event proc argc message block) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (if (logtest? (-> self params flags) (elevator-flags dormant)) + (go-virtual dormant) + ) + (set-time! (-> self ride-timer)) + (logclear! (-> self elevator-status) (elevator-status waiting-to-descend moving)) + (logior! (-> self mask) (process-mask actor-pause)) + (if (nonzero? (-> self sound)) + (update-vol! (-> self sound) 0.0) + ) + (let ((gp-0 (-> self on-notice))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :trans (behavior () + (teleport-check) + (plat-trans) + (when (not (logtest? (-> self elevator-status) (elevator-status waiting-to-descend))) + (set-time! (-> self ride-timer)) + (-> self params) + (if (and (logtest? (-> self params flags) (elevator-flags running)) + (not (logtest? (-> self params flags) (elevator-flags ef3))) + ) + (elevator-method-48 self) + ) + ) + (when (and (not (logtest? (-> self params flags) (elevator-flags ef3))) + (time-elapsed? (-> self ride-timer) (seconds 1)) + (or (not (-> self activate-test)) + (script-eval (-> self activate-test) :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (set! (-> self move-pos 1) (-> self path-seq data (the int (-> self move-pos 1)) next-pos)) + (go-virtual running) + ) + (let ((gp-0 (-> self on-wait))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :code sleep-code + :post (behavior () + (logclear! (-> self elevator-status) (elevator-status waiting-to-descend)) + (path-control-method-9 (-> self path)) + (plat-post) + ) + ) + +(defstate running (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('running?) + #t + ) + (('player-ridden?) + (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (if (not (logtest? (-> self params flags) (elevator-flags ef7))) + (process-entity-status! self (entity-perm-status no-kill) #t) + ) + (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) + (when (logtest? (-> self params flags) (elevator-flags waiting)) + (logclear! (-> self params flags) (elevator-flags waiting)) + (logior! (-> self params flags) (elevator-flags running)) + ) + (set! (-> self move-dist) 0.0) + (let ((v1-13 (the int (-> self move-pos 0))) + (a0-3 (the int (-> self move-pos 1))) + (a1-1 0) + ) + (while (let ((a2-3 (abs (- a0-3 v1-13)))) + (< a1-1 a2-3) + ) + (+! (-> self move-dist) (-> self path-seq data (+ (min v1-13 a0-3) a1-1) dist)) + (+! a1-1 1) + ) + ) + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self path-pos) 0.0) + (if (nonzero? (-> self sound)) + (update-vol! (-> self sound) 0.0) + ) + (if (-> self sound-start) + (sound-play-by-spec (-> self sound-start) (new-sound-id) (the-as vector #t)) + ) + (when (logtest? (-> self params flags) (elevator-flags prevent-jump)) + (set-setting! 'jump #f 0.0 0) + (apply-settings *setting-control*) + ) + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (set-setting! 'board #f 0.0 0) + (set-setting! 'lightjak #f 0.0 0) + (toggle-fence-collision self #t) + (if (logtest? (-> self params flags) (elevator-flags grab)) + (process-grab? *target* #f) + ) + ) + (let ((gp-1 (-> self on-activate))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :exit (behavior () + (if (not (logtest? (-> self params flags) (elevator-flags ef7))) + (process-entity-status! self (entity-perm-status no-kill) #f) + ) + (remove-setting! 'board) + (remove-setting! 'jump) + (remove-setting! 'lightjak) + (set! (-> self speed) 0.0) + ) + :trans (behavior () + (teleport-check) + (if (and (not (logtest? (-> self elevator-status) (elevator-status waiting-to-ascend))) + (= (-> self path-pos) 1.0) + ) + (go-virtual arrived) + ) + (if (elevator-method-46 self) + (set! (-> self path-dest) 0.0) + (set! (-> self path-dest) 1.0) + ) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) + (and *target* (not (logtest? (-> *target* focus-status) (focus-status grabbed)))) + ) + (process-grab? *target* #f) + ) + (if (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) *target*) + (process-drawable-cloth-command *target* '(set-flags local-space-y)) + ) + (if (>= (+ (current-time) (seconds -1)) (-> self sticky-player-last-ride-time)) + (remove-setting! 'board) + (set-setting! 'board #f 0.0 0) + ) + (if (logtest? (-> self params flags) (elevator-flags prevent-jump)) + (elevator-method-50 self) + ) + (let ((gp-0 (-> self on-running))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + (plat-trans) + ) + :code (behavior () + (logior! (-> self elevator-status) (elevator-status waiting-to-ascend)) + (suspend) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'player-standing-on?)) + (cond + ((and (send-event-function self a1-0) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'going-up?)) + (and (send-event-function self a1-1) (logtest? (-> self params flags) (elevator-flags fence))) + ) + ) + (let ((gp-0 (-> self on-up))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + ((let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 1) + (set! (-> a1-4 message) 'query) + (set! (-> a1-4 param 0) (the-as uint 'player-standing-on?)) + (and (send-event-function self a1-4) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer self)) + (set! (-> a1-5 num-params) 1) + (set! (-> a1-5 message) 'query) + (set! (-> a1-5 param 0) (the-as uint 'going-down?)) + (and (send-event-function self a1-5) (logtest? (-> self params flags) (elevator-flags fence))) + ) + ) + ) + (let ((gp-1 (-> self on-down))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + ) + ) + (until #f + (suspend) + (if (= (-> self path-pos) 1.0) + (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) + ) + ) + #f + ) + :post (behavior () + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-ascend)) + (seek! + (-> self path-pos) + (-> self path-dest) + (* (/ (-> self params move-rate) (-> self move-dist)) (seconds-per-frame)) + ) + (let* ((f30-0 (-> self move-pos 0)) + (f28-0 (-> self move-pos 1)) + (f0-9 (+ f30-0 (* (ease-value-in-out (-> self path-pos) 0.08) (- f28-0 f30-0)))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> self basetrans quad)) + (get-point-in-path! (-> self path) (-> self basetrans) f0-9 'interp) + (set! (-> self speed) (* (- (-> self basetrans y) (-> gp-0 y)) (-> self clock frames-per-second))) + ) + (if (-> self sound-running-loop) + (sound-play-by-spec (-> self sound-running-loop) (-> self sound-id) (-> self root trans)) + ) + ) + (move-post) + ) + ) + +(defstate arrived (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('ridden) + (set-time! (-> self ride-timer)) + (elevator-event proc argc message block) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self ride-timer)) + (if (not (-> *setting-control* user-current jump)) + (remove-setting! 'jump) + ) + (sound-stop (-> self sound-id)) + (if (-> self sound-arrived) + (sound-play-by-spec (-> self sound-arrived) (new-sound-id) (the-as vector #t)) + ) + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (toggle-fence-collision self #f) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) *target* (focus-test? *target* grabbed)) + (process-release? *target*) + ) + ) + (let ((gp-1 (-> self on-deactivate))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 1)) 8) :vector (-> self root trans)) + ) + ) + ) + :trans (behavior () + (teleport-check) + (if (and (< (- (-> self ride-timer) (-> self sticky-player-last-ride-time)) (seconds 2)) + (begin *target* *target*) + (focus-test? *target* in-air) + ) + (set-time! (-> self ride-timer)) + ) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) *target* (focus-test? *target* grabbed)) + (process-release? *target*) + ) + (when (or (logtest? (-> self elevator-status) (elevator-status moving)) + (time-elapsed? (-> self ride-timer) (seconds 0.5)) + ) + (cond + ((and (logtest? (-> self params flags) (elevator-flags ef1)) + (!= (-> self move-pos 1) (-> self params start-pos)) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (set! (-> self move-pos 1) (-> self params start-pos)) + (go-virtual running) + ) + (else + (go-virtual waiting) + ) + ) + ) + (plat-trans) + ) + :code sleep-code + :post plat-post + ) + +(defstate die (elevator) + :virtual #t + :event (the-as (function process int symbol event-message-block object) eco-door-event-handler) + :code (behavior () + '() + ) + ) + +(defmethod calc-dist-between-points! ((this elevator) (arg0 int) (arg1 int)) + (set! (-> this path-seq data arg0 next-pos) (the float arg1)) + (let ((s3-0 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float arg0) 'interp)) + (a1-3 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float arg1) 'interp)) + ) + (set! (-> this path-seq data arg0 dist) (vector-vector-distance s3-0 a1-3)) + ) + 0 + (none) + ) + +(defmethod init-sound! ((this elevator)) + (set! (-> this sound) (the-as ambient-sound 0)) + (if (-> this sound-running-loop) + (set! (-> this sound-id) (new-sound-id)) + ) + 0 + (none) + ) + +(defmethod base-plat-method-34 ((this elevator)) + 0 + (none) + ) + +(defmethod relocate ((this elevator) (offset int)) + (if (nonzero? (-> this path-seq)) + (&+! (-> this path-seq) offset) + ) + (call-parent-method this offset) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod go-arrived-or-waiting ((this elevator)) + (if (logtest? (-> this params flags) (elevator-flags arrived)) + (go (method-of-object this arrived)) + (go (method-of-object this waiting)) + ) + (none) + ) + +;; WARN: Return type mismatch none vs object. +(defmethod init-from-entity! ((this elevator) (arg0 entity-actor)) + (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) + (stack-size-set! (-> this main-thread) 512) + (set! (-> this sound-running-loop) #f) + (set! (-> this sound-arrived) #f) + (set! (-> this sound-start) #f) + (init-params! this) + (init-collision! this) + (when (type? (-> this root root-prim) collide-shape-prim-group) + (let ((v1-9 (-> this root root-prim))) + (dotimes (a0-5 (the-as int (-> v1-9 specific 0))) + (when (= (-> (the-as collide-shape-prim-group v1-9) child a0-5 prim-id) (shl #xfe00 16)) + (set! (-> this fence-prim-index) (the-as uint a0-5)) + (toggle-fence-collision this #f) + #t + (goto cfg-8) + ) + ) + ) + ) + (label cfg-8) + (process-drawable-from-entity! this arg0) + (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) + (init-bounce-params! this) + (set! (-> this elevator-status) (elevator-status)) + (update-transforms (-> this root)) + (base-plat-method-33 this) + (set! (-> this on-activate) (res-lump-struct (-> this entity) 'on-activate pair)) + (set! (-> this on-deactivate) (res-lump-struct (-> this entity) 'on-deactivate pair)) + (set! (-> this on-up) (res-lump-struct (-> this entity) 'on-up pair)) + (set! (-> this on-down) (res-lump-struct (-> this entity) 'on-down pair)) + (set! (-> this on-running) (res-lump-struct (-> this entity) 'on-running pair)) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-wait) (res-lump-struct (-> this entity) 'on-wait pair)) + (set! (-> this activate-test) (res-lump-struct (-> this entity) 'activate-test pair)) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 arg0 #f)) + (when (logtest? (-> this path flags) (path-control-flag not-found)) + (if (logtest? (-> this params flags) (elevator-flags dormant)) + (go (method-of-object this dormant)) + ) + (go process-drawable-art-error "error in path") + ) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((s5-1 (-> this path curve num-cverts)) + (s4-1 0) + (f30-0 0.0) + (f28-0 0.0) + ) + (set! (-> this path-seq) (new 'process 'path-step-inline-array s5-1)) + (dotimes (s3-1 s5-1) + (calc-dist-between-points! this s3-1 (mod (+ s3-1 1) s5-1)) + (let ((v1-55 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s3-1) 'interp))) + (when (or (not (logtest? s4-1 1)) (< (-> v1-55 y) f28-0)) + (set! (-> this bottom-top 0) (the float s3-1)) + (set! f28-0 (-> v1-55 y)) + (set! s4-1 (logior s4-1 1)) + ) + (when (or (not (logtest? s4-1 2)) (< f30-0 (-> v1-55 y))) + (set! (-> this bottom-top 1) (the float s3-1)) + (set! f30-0 (-> v1-55 y)) + (set! s4-1 (logior s4-1 2)) + ) + ) + ) + ) + (set! sv-32 (the-as float 0.0)) + (set! sv-36 (-> this path)) + (let ((s5-2 *target*)) + (set! sv-40 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (if (not (and sv-40 + (logtest? (-> this params flags) (elevator-flags teleport)) + (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) + ) + ) + (set! sv-32 (-> this params start-pos)) + ) + (set! (-> this move-pos 0) sv-32) + (set! (-> this move-pos 1) sv-32) + (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + (set! (-> this root pause-adjust-distance) + (+ 122880.0 (-> this params xz-threshold) (total-distance (-> this path))) + ) + (base-plat-method-34 this) + (init-sound! this) + (go-arrived-or-waiting this) + ) diff --git a/goal_src/jak3/engine/common-obs/enemy-states.gc b/goal_src/jak3/engine/common-obs/enemy-states.gc index 2dd03df9b41..047bd628db6 100644 --- a/goal_src/jak3/engine/common-obs/enemy-states.gc +++ b/goal_src/jak3/engine/common-obs/enemy-states.gc @@ -7,3 +7,1647 @@ ;; DECOMP BEGINS +(defstate idle (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (stop-look-at! self) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) + (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (set! (-> self state-timeout) (seconds 0.5)) + (if (-> self on-notice) + (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> self on-active) + (logior! (-> self enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> self on-hostile) + (logior! (-> self enemy-flags) (enemy-flag enable-on-hostile)) + ) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + ) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (-> self state-timeout)) + (let ((v1-3 (-> self focus aware))) + (cond + ((< 1 (the-as int v1-3)) + (go-virtual notice) + ) + ((> (the-as int v1-3) 0) + (go-virtual active) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + ) + :post (behavior () + (play-idle-frames! (-> self idle-anim-player) self) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set-time! (-> self last-draw-time)) + ) + (update-focus self) + (ja-post) + ) + ) + +(defstate dormant (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + ((-> (method-of-type enemy idle) enter)) + (set! (-> self root nav-flags) (the-as uint 0)) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (set! (-> self draw origin quad) (-> self root trans quad)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + ) + (logior! (-> self focus-status) (focus-status disable)) + ) + :exit (behavior () + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) + (logior! (-> self root nav-flags) 1) + ) + :code sleep-code + ) + +(defstate dormant-aware (enemy) + :virtual #t + :event enemy-event-handler + :enter (-> (method-of-type enemy dormant) enter) + :exit (-> (method-of-type enemy dormant) exit) + :trans (behavior () + (when (and (time-elapsed? (-> self state-time) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0)) + (if (logtest? (enemy-option ambush) (-> self fact enemy-options)) + (go-ambush-delay self) + (go-virtual active) + ) + ) + ) + :code sleep-code + :post (behavior () + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set-time! (-> self last-draw-time)) + ) + (update-focus self) + ) + ) + +(defstate ambush-delay (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self desired-angle) (fmax 0.0 (res-lump-float (-> self entity) 'ambush-delay))) + (logior! (-> self focus-status) (focus-status disable)) + (let ((v1-6 (-> self root root-prim))) + (set! (-> v1-6 prim-core collide-as) (collide-spec)) + (set! (-> v1-6 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + (logand! (-> self root nav-flags) -2) + ) + :exit (behavior () + ((-> (method-of-type enemy dormant) exit)) + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :trans (behavior () + (if (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self desired-angle)))) + (go-virtual ambush) + ) + ) + :code sleep-code + ) + +(defstate ambush (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :code (behavior () + (go-virtual notice) + ) + ) + +(defstate active (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (let ((gp-0 (-> self on-active))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + ) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((v1-3 (-> self focus aware))) + (cond + ((< (the-as int v1-3) 1) + (go-idle self) + ) + ((< 1 (the-as int v1-3)) + (go-virtual notice) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + ) + :post (behavior () + (play-idle-frames! (-> self idle-anim-player) self) + (enemy-simple-post) + ) + ) + +(defstate notice (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag use-trigger))) + ) + (logclear! (-> self mask) (process-mask actor-pause)) + (set-look-at-mode! self 1) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (let ((gp-0 (-> self on-notice))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + (let ((gp-1 (-> self focus aware))) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) + (cond + ((and (= gp-1 (enemy-aware ea3)) (get-focus! self)) + (go-hostile self) + ) + ((= gp-1 (enemy-aware ea4)) + (go-flee self) + ) + (else + (go-stare self) + ) + ) + ) + ) + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (vector-! gp-0 (target-pos 0) (-> self root trans)) + (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.05)) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (go-best-state self) + ) + :post enemy-simple-post + ) + +(defstate hostile (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set-look-at-mode! self 1) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (logtest? (enemy-flag enable-on-hostile) (-> self enemy-flags)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (let ((gp-0 (-> self on-hostile))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + ) + :trans (behavior () + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) + (go-virtual victory) + ) + (let ((gp-0 (-> self focus aware))) + (when (time-elapsed? (-> self state-time) (-> self reaction-time)) + (cond + ((or (>= 2 (the-as int gp-0)) (not (get-focus! self))) + (go-stare self) + ) + ((= gp-0 (enemy-aware ea4)) + (go-flee self) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) + (ja :num-func num-func-identity :frame-num 0.0) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (until #f + (suspend) + (ja :num! (loop! f30-0)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +(defstate stare (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((gp-0 (-> self focus aware))) + (cond + ((>= 1 (the-as int gp-0)) + (go-virtual active) + ) + ((and (= gp-0 (enemy-aware ea3)) (get-focus! self)) + (go-hostile self) + ) + ((= gp-0 (enemy-aware ea4)) + (go-flee self) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) + (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) + ) + (until #f + (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + #f + ) + :post enemy-simple-post + ) + +(defstate victory (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (go-best-state self) + ) + :post enemy-simple-post + ) + +(defstate flee (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set-look-at-mode! self 1) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (-> self reaction-time)) + (if (!= (-> self focus aware) (enemy-aware ea4)) + (go-stare self) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (until #f + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +(defstate jump (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logior! (-> self focus-status) (focus-status dangerous)) + (let* ((v1-6 *game-info*) + (a0-2 (+ (-> v1-6 attack-id) 1)) + ) + (set! (-> v1-6 attack-id) a0-2) + (set! (-> self attack-id) a0-2) + ) + (logclear! (-> self focus-status) (focus-status in-air)) + ) + :exit (behavior () + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'enemy-jump-info))) + (let ((s5-0 0)) + (init-jump-info! self gp-0) + (if (and (-> self enemy-info use-jump-blocked) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) + (enemy-method-91 self) + ) + (go-virtual jump-blocked) + ) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags ejf0)) + (until #f + (if (jump-anim-handler self s5-0 gp-0) + (goto cfg-12) + ) + (in-jump-handler self s5-0 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-0 1) + ) + #f + ) + ) + (label cfg-12) + (logclear! (-> self root status) (collide-status on-surface on-ground touch-surface)) + (let ((s5-1 2)) + (logior! (-> self focus-status) (focus-status in-air)) + (until (on-ground? self) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) + (jump-anim-handler self s5-1 gp-0) + (in-jump-handler self s5-1 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-1 3) + ) + ) + (logclear! (-> self focus-status) (focus-status in-air)) + (move-to-gspot! self) + (let ((s5-2 4)) + (until #f + (if (jump-anim-handler self s5-2 gp-0) + (goto cfg-19) + ) + (in-jump-handler self s5-2 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-2 5) + ) + ) + ) + #f + (label cfg-19) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + ((lambda :behavior enemy () (send-event (ppointer->process (-> self parent)) 'child-jumped))) + ) + (go-directed2 self) + ) + :post (behavior () + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (-> self enemy-info overlaps-others-collide-with-filter)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root) a1-0) + ) + (enemy-simple-post) + ) + ) + +(defstate jump-blocked (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.5)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (go-virtual jump) + (go-directed2 self) + ) + ) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data (-> self enemy-info idle-anim))))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) + :num! (identity (rand-vu-float-range 0.0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + ) + (let ((f30-0 (rnd-float-range self 0.75 1.25))) + (until #f + (suspend) + (ja :num! (loop! f30-0)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +(defstate hit (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (stop-look-at! self) + (logclear! (-> self mask) (process-mask actor-pause)) + (play-damage-sound self 0) + ) + :code (behavior () + (local-vars (v1-37 enemy-flag) (v1-39 enemy-flag) (v1-41 enemy-flag)) + (ja-channel-push! 1 (seconds 0.2)) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-36 (-> self enemy-flags))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-37) + (let ((v1-38 (-> self enemy-flags))) + (if (logtest? v1-38 (enemy-flag attackable-backup)) + (set! v1-39 (logior v1-38 (enemy-flag attackable))) + (set! v1-39 (logclear v1-38 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-39) + (let ((v1-40 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-40) + (set! v1-41 (logior (enemy-flag trackable) v1-40)) + (set! v1-41 (logclear v1-40 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-41) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + (go-hostile self) + ) + :post enemy-simple-post + ) + +(defstate knocked (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (when (>= 0.0 (-> self hit-points)) + (let ((v1-2 (handle->process (-> self incoming attacker-handle)))) + (when (or (not (-> self draw)) + (and (or (not v1-2) (!= (-> v1-2 type) target)) + (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (let ((f0-1 450560.0)) + (< (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) + ) + ) + ) + ) + (send-event (ppointer->process (-> self parent)) 'child-die) + (go-virtual die-fast) + ) + ) + ) + (set-time! (-> self state-time)) + (stop-look-at! self) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self mask) (process-mask actor-pause)) + (let* ((v1-30 *game-info*) + (a0-13 (+ (-> v1-30 attack-id) 1)) + ) + (set! (-> v1-30 attack-id) a0-13) + (set! (-> self attack-id) a0-13) + ) + (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) + ) + (if (and (enemy-method-123 self) (-> self enemy-info ragdoll-info)) + (set! (-> self root transv y) 0.0) + ) + (let ((v1-43 (-> self root))) + (logclear! (-> v1-43 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> v1-43 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((a0-25 (-> v1-43 dynam gravity-normal))) + (set! (-> v1-43 local-normal quad) (-> a0-25 quad)) + (set! (-> v1-43 surface-normal quad) (-> a0-25 quad)) + (set! (-> v1-43 poly-normal quad) (-> a0-25 quad)) + ) + (set! (-> v1-43 coverage) 0.0) + (set! (-> v1-43 touch-angle) 0.0) + ) + (knocked-handler self (-> v1-43 transv)) + ) + (if (>= (-> self enemy-info knocked-seek-ry-clamp) 0.0) + (set! (-> self desired-angle) (get-knockback-angle self)) + ) + (if (or (= (-> self hit-points) 0.0) (nonzero? (-> self fated-time))) + (on-dying self) + (play-damage-sound self 0) + ) + (logclear! (-> self focus-status) (focus-status dangerous)) + (if (= (-> self incoming knocked-type) (knocked-type yellow-shot)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) + ) + (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) + (reset-penetrate! self) + (enemy-method-50 self 1) + (ragdoll-spawn! self #t #f) + ) + :exit (behavior () + (disable-ragdoll self) + ) + :trans (behavior () + (if (>= (-> self enemy-info knocked-seek-ry-clamp) 0.0) + (seek-toward-yaw-angle! (-> self root) (-> self desired-angle) 138353.78 (seconds 0.1)) + ) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.2)) + (suspend) + ) + ) + (until (ragdoll-settled? self) + (if (or (time-elapsed? (-> self state-time) (seconds 4)) (enemy-method-109 self)) + (go-die self) + ) + (suspend) + ) + (if (within-gspot-range? self) + (go-die self) + ) + ) + (else + (let ((gp-1 (new 'stack-no-clear 'enemy-knocked-info))) + (let ((s5-0 0)) + (set! (-> gp-1 anim-speed) (rnd-float-range self 0.9 1.1)) + (set! (-> gp-1 on-surface-count) 0) + (set! (-> gp-1 move-count) 0) + (until (enemy-method-88 self gp-1) + (if (time-elapsed? (-> self state-time) (seconds 2)) + (go-die self) + ) + (if (logtest? (-> self root status) (collide-status on-surface)) + (+! (-> gp-1 on-surface-count) 1) + ) + (knocked-anim-handler self s5-0 gp-1) + (suspend) + (+! (-> gp-1 move-count) 1) + (set! s5-0 1) + ) + ) + (let ((s5-1 2)) + (set-time! (-> gp-1 land-can-land-time)) + (until #f + (if (logtest? (-> self root status) (collide-status on-surface)) + (+! (-> gp-1 on-surface-count) 1) + ) + (if (knocked-anim-handler self s5-1 gp-1) + (goto cfg-33) + ) + (suspend) + (+! (-> gp-1 move-count) 1) + (set! s5-1 3) + (if (enemy-method-88 self gp-1) + (set-time! (-> gp-1 land-can-land-time)) + ) + ) + ) + #f + (label cfg-33) + (if (and (not (logtest? (enemy-flag death-start) (-> self enemy-flags))) + (or (within-gspot-range? self) + (enemy-method-109 self) + (time-elapsed? (-> gp-1 land-can-land-time) (-> self enemy-info knocked-can-land-timeout)) + ) + ) + (go-die self) + ) + (while (not (knocked-anim-handler self 4 gp-1)) + (suspend) + ) + ) + ) + ) + (cond + ((or (= (-> self hit-points) 0.0) (nonzero? (-> self fated-time))) + (cond + ((logtest? (enemy-flag death-start) (-> self enemy-flags)) + (set! (-> self hit-points) 0.0) + (let ((v1-90 (-> self root root-prim))) + (set! (-> v1-90 prim-core collide-as) (collide-spec)) + (set! (-> v1-90 prim-core collide-with) (collide-spec)) + ) + 0 + (send-event self 'death-end) + (let ((gp-2 (-> self child))) + (while gp-2 + (send-event (ppointer->process gp-2) 'notice 'die) + (set! gp-2 (-> gp-2 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + (else + (when (and (-> self skel effect) (logtest? (enemy-flag auto-death-phase-out) (-> self enemy-flags))) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + (suspend) + 0 + ) + (go-die self) + ) + ) + ) + (else + (go-virtual knocked-recover) + ) + ) + ) + :post enemy-falling-post + ) + +(defstate knocked-recover (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (local-vars (v1-1 enemy-flag) (v1-13 enemy-flag) (v1-15 enemy-flag) (v1-17 enemy-flag)) + (let ((v1-0 (-> self enemy-flags))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v1-1 (logior (enemy-flag check-water) v1-0)) + (set! v1-1 (logclear v1-0 (enemy-flag check-water))) + ) + ) + (set! (-> self enemy-flags) v1-1) + (when (!= (-> self hit-points) 0.0) + (set! (-> self root penetrate-using) + (the-as penetrate (logclear (-> self root penetrate-using) (penetrate knocked))) + ) + (enemy-method-50 self 2) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-12 (-> self enemy-flags))) + (if (logtest? v1-12 (enemy-flag vulnerable-backup)) + (set! v1-13 (logior v1-12 (enemy-flag vulnerable))) + (set! v1-13 (logclear v1-12 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-13) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? v1-14 (enemy-flag attackable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag attackable))) + (set! v1-15 (logclear v1-14 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (let ((v1-16 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-16) + (set! v1-17 (logior (enemy-flag trackable) v1-16)) + (set! v1-17 (logclear v1-16 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-17) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) (seconds 0.01)) + (and (not (handle->process (-> self ragdoll-proc))) + (or (within-gspot-range? self) + (time-elapsed? (-> self state-time) (-> self enemy-info knocked-recover-timeout)) + ) + ) + ) + (go-die self) + ) + ) + :code (behavior () + (local-vars (v1-58 symbol)) + (cond + ((handle->process (-> self ragdoll-proc)) + (ja-channel-push! 1 0) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) + (ragdoll-method-25 (-> (the-as ragdoll-proc (handle->process (-> self ragdoll-proc))) ragdoll) self) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (loop!) :frame-num 0.0) + (until v1-58 + (suspend) + (ja :num! (loop!)) + (set! v1-58 (and (logtest? (-> self root status) (collide-status on-surface)) + (< (vector-length (-> self root transv)) 2048.0) + ) + ) + ) + ) + ) + (if (enemy-method-109 self) + (go-die self) + (go-hostile self) + ) + ) + :post (behavior () + (when (not (handle->process (-> self ragdoll-proc))) + (let ((gp-0 (-> self root))) + (if (focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + (vector-v++! + (-> gp-0 transv) + (compute-acc-due-to-gravity gp-0 (new 'stack-no-clear 'vector) (-> self enemy-info slip-factor)) + ) + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (-> self enemy-info recover-gnd-collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> gp-0 pat-ignore-mask))) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-1 (meters 0)) + ) + ) + (apply-friction self) + ) + (let ((gp-1 (-> self root)) + (a1-5 (new 'stack-no-clear 'collide-query)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 quad) (-> gp-1 gspot-pos quad)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> gp-1 gspot-normal quad)) + (let* ((a0-10 gp-1) + (t9-5 (method-of-object a0-10 find-ground)) + (a2-2 (-> self enemy-info gnd-collide-with)) + (a3-1 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (not (t9-5 a0-10 a1-5 a2-2 a3-1 t0-0 t1-0)) + (set! (-> gp-1 gspot-pos quad) (-> s5-1 quad)) + (set! (-> gp-1 gspot-normal quad) (-> s4-1 quad)) + ) + ) + ) + ) + (enemy-simple-post) + ) + ) + +;; WARN: Return type mismatch entity-perm-status vs none. +(defmethod mark-as-dead ((this enemy)) + (cond + ((logtest? (process-mask enemy) (-> this mask)) + (+! (-> *game-info* enemies-killed) 1.0) + ) + ((logtest? (process-mask guard civilian) (-> this mask)) + (+! (-> *game-info* civilians-killed) 1.0) + ) + ) + (logior! (-> this focus-status) (focus-status dead)) + (process-entity-status! this (entity-perm-status subtask-complete) #t) + (none) + ) + +(defmethod on-dying ((this enemy)) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag called-dying) (-> this enemy-flags)))) + (play-damage-sound this 1) + (when (and (logtest? (enemy-flag has-gem) (-> this enemy-flags)) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) + ) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) + (remove-from-process *part-engine* this) + (setup-masks + (-> this draw) + (the-as int (-> this enemy-info gem-no-seg)) + (the-as int (-> this enemy-info gem-seg)) + ) + (let* ((a0-11 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data (-> this enemy-info gem-joint))) + ) + (s4-0 (ppointer->process (birth-pickup-at-point a0-11 (pickup-type gem) 1.0 #t *entity-pool* (-> this fact)))) + (s5-0 (if (type? s4-0 gem) + s4-0 + ) + ) + ) + (if s5-0 + (set! (-> (the-as gem s5-0) gem-pool) (the-as uint (get-gem-pool-idx this))) + ) + ) + ) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag attackable attackable-backup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (mark-as-dead this) + (if (-> this skel effect) + (logior! (-> this skel effect flags) (effect-control-flag ecf1)) + ) + (stop-look-at! this) + ) + (none) + ) + +(defstate die (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (on-dying self) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (set-time! (-> self state-time)) + (set! (-> self hit-points) 0.0) + (ragdoll-spawn! self #f #t) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.2)) + (suspend) + ) + ) + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 0.8)) + (suspend) + ) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (send-event self 'death-end) + (let ((gp-2 (-> self child))) + (while gp-2 + (send-event (ppointer->process gp-2) 'notice 'die) + (set! gp-2 (-> gp-2 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + :post enemy-simple-post + ) + +(defmethod falling? ((this enemy)) + (let ((s5-0 (-> this root)) + (a1-0 (new 'stack-no-clear 'collide-query)) + (gp-0 #t) + ) + (let* ((v1-0 s5-0) + (t9-0 (method-of-object v1-0 find-ground)) + (a2-1 (-> this enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (t9-0 v1-0 a1-0 a2-1 a3-0 t0-0 t1-0) + (if (< (- (-> s5-0 trans y) (-> s5-0 gspot-pos y)) 8192.0) + (set! gp-0 #f) + ) + ) + ) + gp-0 + ) + ) + +(defstate die-falling (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (on-dying self) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self hit-points) 0.0) + (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) + ) + (ragdoll-spawn! self #f #t) + ) + :exit (behavior () + (local-vars (v0-0 enemy-flag)) + (let ((v1-0 (-> self enemy-flags))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v0-0 (logior (enemy-flag check-water) v1-0)) + (set! v0-0 (logclear v1-0 (enemy-flag check-water))) + ) + ) + (set! (-> self enemy-flags) v0-0) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 1)) + (suspend) + ) + ) + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 1)) + (suspend) + ) + ) + (deactivate-ragdoll! self) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-2 (-> self draw art-group data (if (falling? self) + (-> self enemy-info die-falling-anim) + (-> self enemy-info die-anim) + ) + ) + ) + (f30-0 (rnd-float-range self 0.8 1.2)) + ) + (ja-no-eval :group! gp-2 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (send-event self 'death-end) + (let ((gp-3 (-> self child))) + (while gp-3 + (send-event (ppointer->process gp-3) 'notice 'die) + (set! gp-3 (-> gp-3 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + :post enemy-die-falling-post + ) + +(defstate directed (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + ((-> (method-of-type enemy idle) enter)) + ) + :exit (behavior () + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) + ) + :code (-> (method-of-type enemy idle) code) + :post (-> (method-of-type enemy idle) post) + ) + +(defstate die-fast (enemy) + :virtual #t + :code nothing + ) + +(defstate view-anims (enemy) + :virtual #t + :enter (behavior () + '() + ) + :trans (behavior () + '() + ) + :code (behavior () + (let ((gp-0 (-> self draw art-group))) + (until #f + (dotimes (s5-0 (-> gp-0 length)) + (let ((s4-0 (-> gp-0 data s5-0))) + (when (and s4-0 (= (-> s4-0 type) art-joint-anim)) + (ja-channel-set! 1) + (ja-no-eval :group! s4-0 :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ) + #f + ) + :post transform-post + ) + +;; WARN: Return type mismatch symbol vs object. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior gun-dark-2-anim-code enemy () + 0.0 + (let ((f28-0 (the float (ja-num-frames 0)))) + 0.0 + 0.0 + (let ((f30-0 1.0)) + 0.0 + (let* ((f26-0 (/ (ja-frame-num 0) f28-0)) + (f0-12 (cond + ((< 0.5 f26-0) + (let* ((f24-0 0.3) + (v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-5 (the-as number (logior #x3f800000 v1-4))) + ) + (- f26-0 (+ f24-0 (* (+ -1.0 (the-as float v1-5)) (+ -0.3 f26-0)))) + ) + ) + (else + (let* ((f24-1 0.3) + (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-12 (the-as number (logior #x3f800000 v1-11))) + ) + (+ f24-1 (* (+ -1.0 (the-as float v1-12)) (- 0.7 f26-0)) f26-0) + ) + ) + ) + ) + (f26-1 (fmax 0.0 (fmin 1.0 f0-12))) + (f28-1 (* f28-0 f26-1)) + ) + (let* ((f1-8 (* 0.000061035156 (-> self root root-prim local-sphere w))) + (f0-21 (fmax 0.0 (fmin 1.0 f1-8))) + ) + (* f30-0 (lerp 2.0 1.0 f0-21)) + ) + (cond + ((>= (-> self enemy-info idle-anim) 0) + (let ((s5-0 (ja-group)) + (f30-1 (ja-frame-num 0)) + (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) + ) + (ja-channel-push! 2 (seconds 1)) + (ja :group! s5-0 :num! (identity f30-1)) + (ja :chan 1 + :group! gp-0 + :num! (identity (* f26-1 (the float (+ (-> (the-as art-joint-anim gp-0) frames num-frames) -1)))) + ) + ) + (let* ((gp-1 (current-time)) + (f30-2 18.0) + (f28-2 6.0) + (v1-45 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-46 (the-as number (logior #x3f800000 v1-45))) + (f30-3 (+ f30-2 (* f28-2 (+ -1.0 (the-as float v1-46))))) + ) + (until #f + (let* ((f0-32 (* 0.0033333334 (the float (- (current-time) gp-1)))) + (f0-34 (/ (- f0-32 (* (the float (the int (/ f0-32 f30-3))) f30-3)) f30-3)) + (f0-36 (cos (* 65536.0 f0-34))) + (f0-37 (+ 1.0 f0-36)) + (f28-3 (* 0.5 f0-37)) + ) + (ja :num! identity :frame-interp0 f28-3 :frame-interp1 f28-3) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-39 (- 1.0 f28-3))) + (set! (-> a0-20 frame-interp 1) f0-39) + (set! (-> a0-20 frame-interp 0) f0-39) + ) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-identity) + ) + ) + (suspend) + 0 + ) + ) + #f + ) + (else + (until (time-elapsed? (-> self state-time) (seconds 2)) + (let* ((f1-22 (* 0.0016666667 (the float (- (current-time) (-> self state-time))))) + (f0-42 (fmax 0.0 (fmin 1.0 f1-22))) + ) + (ja :num! (seek! f28-1 (lerp 0.2 0.01 f0-42))) + ) + (suspend) + 0 + ) + ) + ) + ) + ) + ) + (sleep-code) + ) + +(defun gun-dark-2-ragdoll-start ((arg0 enemy)) + (local-vars (s4-0 process)) + (when (-> arg0 enemy-info ragdoll-info) + (let ((s5-0 (handle->process (-> arg0 ragdoll-proc)))) + (cond + (s5-0 + (set! s4-0 s5-0) + ) + (else + (set! (-> arg0 ragdoll-proc) + (ppointer->handle + (process-spawn + ragdoll-proc + (-> arg0 enemy-info ragdoll-info) + :name "ragdoll-proc" + :to arg0 + :stack-size #x5000 + ) + ) + ) + (set! s4-0 (handle->process (-> arg0 ragdoll-proc))) + (if (not s4-0) + (return 0) + ) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logior (enemy-flag auto-death-phase-out) (-> arg0 enemy-flags))) + ) + ) + ) + (if (-> (the-as ragdoll-proc s4-0) ragdoll) + (logior! (-> (the-as ragdoll-proc s4-0) ragdoll ragdoll-flags) (ragdoll-flag rf3 rf4)) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-float*! s3-0 (-> arg0 root transv) (seconds-per-frame)) + (if s5-0 + (ragdoll-proc-method-15 (the-as ragdoll-proc s4-0) #f (the-as vector #f) #f) + (ragdoll-proc-method-15 (the-as ragdoll-proc s4-0) #f (the-as vector #f) #t) + ) + (let ((v0-0 (the-as object (-> (the-as ragdoll-proc s4-0) ragdoll ragdoll-joints 0 velocity)))) + (set! (-> (the-as vector v0-0) quad) (-> s3-0 quad)) + v0-0 + ) + ) + ) + ) + ) + +(defstate gun-dark-2-stretch (enemy) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-4 object) (sv-112 event-message-block) (sv-128 event-message-block)) + (case message + (('attack) + (let* ((s5-0 (the-as object (-> block param 1))) + (s4-0 (new 'stack-no-clear 'vector)) + (v1-1 (-> (the-as attack-info s5-0) mode)) + ) + (set! v0-4 (cond + ((= v1-1 'gravity-end) + (set! (-> self root transv quad) (the-as uint128 0)) + (gun-dark-2-ragdoll-start self) + (let* ((s4-1 self) + (s1-0 (method-of-object s4-1 get-incoming-attack!)) + (s0-0 proc) + ) + (set! sv-112 block) + (let ((a3-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-0 #f) + ) + (s1-0 + s4-1 + (the-as process-drawable s0-0) + sv-112 + a3-1 + (the-as attack-info s5-0) + (the-as touching-shapes-entry t1-0) + ) + ) + ) + (damage-enemy! self proc block) + (set! (-> self incoming penetrate-using) (penetrate vehicle)) + (set! (-> self incoming knocked-type) (knocked-type vehicle)) + (set! (-> self incoming attack-direction quad) (the-as uint128 0)) + (set! (-> self starting-time) 0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer proc)) + (set! (-> a1-4 num-params) argc) + (set! (-> a1-4 message) 'hit-knocked) + (set! (-> a1-4 param 0) (-> block param 0)) + (set! (-> a1-4 param 1) (-> block param 1)) + (set! (-> a1-4 param 2) (-> block param 2)) + (set! (-> a1-4 param 3) (-> block param 3)) + (set! (-> a1-4 param 4) (-> block param 4)) + (set! (-> a1-4 param 5) (-> block param 5)) + (send-event-function self a1-4) + ) + ) + (else + (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming attack-id)) + (let* ((s2-1 self) + (s1-1 (method-of-object s2-1 get-incoming-attack!)) + (s0-1 proc) + ) + (set! sv-128 block) + (let ((a3-2 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t0-1 (the-as uint s5-0)) + (t1-1 (-> block param 0)) + ) + (s1-1 + s2-1 + (the-as process-drawable s0-1) + sv-128 + a3-2 + (the-as attack-info t0-1) + (the-as touching-shapes-entry t1-1) + ) + ) + ) + (knocked-handler self s4-0) + (let ((gp-1 (-> self child))) + (while gp-1 + (when (send-event (-> gp-1 0) 'is-gravity) + (send-event + (-> gp-1 0) + 'attack-forward + (-> self incoming attack-direction) + (-> self incoming attack-position) + (the-as uint s5-0) + (-> self incoming penetrate-using) + s4-0 + (-> self incoming attack-position) + ) + (set! v0-4 0) + (goto cfg-17) + ) + (set! gp-1 (-> gp-1 0 brother)) + ) + ) + #f + ) + ) + ) + ) + ) + (label cfg-17) + v0-4 + ) + (else + (if (zero? (-> self starting-time)) + (enemy-event-handler proc argc message block) + ) + ) + ) + ) + :enter (behavior () + (local-vars (v1-7 enemy-flag) (v1-9 enemy-flag) (v1-11 enemy-flag) (v1-34 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (let ((v1-8 (-> self enemy-flags))) + (if (logtest? v1-8 (enemy-flag attackable-backup)) + (set! v1-9 (logior v1-8 (enemy-flag attackable))) + (set! v1-9 (logclear v1-8 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-9) + (let ((v1-10 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-10) + (set! v1-11 (logior (enemy-flag trackable) v1-10)) + (set! v1-11 (logclear v1-10 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-11) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + (vector-float*! (-> self root transv) (-> self root transv) 0.5) + (set! (-> self root penetrated-by) (penetrate)) + (+! (-> self root transv y) 2048.0) + (set-time! (-> self state-time)) + (set! (-> self root penetrated-by) (logior (get-penetrated-by self) (penetrate vehicle))) + (set-time! (-> self starting-time)) + (set! (-> self focus-status) (the-as focus-status (logior (focus-status no-gravity) (-> self focus-status)))) + (let ((v1-33 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-33) + (set! v1-34 (logior (enemy-flag trackable) v1-33)) + (set! v1-34 (logclear v1-33 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-34) + (stop-look-at! self) + (when (and (-> self draw) (-> self draw shadow-ctrl)) + (let ((v1-41 (-> self draw shadow-ctrl))) + (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + :exit (behavior () + (set! (-> self focus-status) + (the-as focus-status (logclear (-> self focus-status) (focus-status no-gravity))) + ) + (when (and (-> self draw) (-> self draw shadow-ctrl)) + (let ((v1-6 (-> self draw shadow-ctrl))) + (logclear! (-> v1-6 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + :trans (behavior () + (let ((gp-0 (-> self child))) + (while gp-0 + (when (send-event (-> gp-0 0) 'is-gravity) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'get-float-speed) + (let ((f0-0 (the-as float (send-event-function (-> gp-0 0) a1-1)))) + (+! (-> self root transv y) (* f0-0 (seconds-per-frame))) + ) + ) + 0 + (goto cfg-11) + ) + (set! gp-0 (-> gp-0 0 brother)) + ) + ) + (label cfg-11) + (vector-float*! (-> self root transv) (-> self root transv) (- 1.0 (* 0.5 (seconds-per-frame)))) + (let ((s3-0 (new 'stack 'collide-query)) + (gp-2 (vector-float*! (new 'stack-no-clear 'vector) (-> self root transv) (seconds-per-frame))) + ) + (set! (-> s3-0 start-pos quad) (-> (get-trans self 3) quad)) + (set! (-> s3-0 move-dist quad) (-> gp-2 quad)) + (let ((v1-26 s3-0)) + (set! (-> v1-26 radius) (* 0.7 (-> self root root-prim prim-core world-sphere w))) + (set! (-> v1-26 collide-with) + (collide-spec backgnd civilian enemy obstacle hit-by-others-list pusher vehicle-mesh) + ) + (set! (-> v1-26 ignore-process0) self) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (set! f30-0 + (cond + ((>= f30-0 0.0) + (vector-float*! gp-2 gp-2 f30-0) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (v1-31 (-> s3-0 best-other-tri)) + (f28-0 0.9) + ) + (set! (-> s5-1 quad) (-> v1-31 normal quad)) + (set! (-> s4-0 quad) (-> v1-31 intersect quad)) + (let ((v1-32 (and (-> v1-31 collide-ptr) (let ((s2-0 (-> v1-31 collide-ptr))) + (if (type? s2-0 collide-shape-prim-sphere) + s2-0 + ) + ) + ) + ) + ) + (when v1-32 + (let ((s2-1 (-> (the-as collide-shape-prim-sphere v1-32) cshape process))) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 quad) (-> self root transv quad)) + (let* ((s0-0 s2-1) + (v1-37 (if (type? s0-0 process-focusable) + s0-0 + ) + ) + ) + (when v1-37 + (when (focus-test? (the-as process-focusable v1-37) no-gravity) + (vector-float*! s1-0 s1-0 0.5) + (set! f28-0 0.5) + ) + ) + ) + ) + (let ((f1-6 (fmax 0.0 (fmin 1.0 (* 0.000008138021 (vector-length (-> self root transv)))))) + (f0-12 0.0) + ) + (if (< 0.1 f1-6) + (set! f0-12 (lerp 3.0 12.0 f1-6)) + ) + (send-event + s2-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self attack-id)) + (damage f0-12) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (penetrate-using (penetrate vehicle)) + (vector (-> self root transv)) + (attacker-velocity (-> self root transv)) + (intersection s4-0) + ) + ) + ) + ) + ) + ) + ) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0))) + 0.0 + (let* ((f0-16 (vector-normalize-ret-len! s2-3 1.0)) + (f0-18 (* 1.3 (- (* 0.7 (-> self root root-prim prim-core world-sphere w)) f0-16))) + ) + (vector-normalize! s2-3 f0-18) + ) + (vector+! (-> self root trans) (-> self root trans) s2-3) + ) + (let ((f26-0 (vector-dot (-> self root transv) s5-1))) + (vector+float*! (-> self root transv) (-> self root transv) s5-1 (* -2.0 f26-0)) + (vector-float*! (-> self root transv) (-> self root transv) f28-0) + (let ((s3-1 (-> self child))) + (while s3-1 + (when (send-event (-> s3-1 0) 'is-gravity) + (send-event (-> s3-1 0) 'impact s4-0 (vector-float*! (new 'stack-no-clear 'vector) s5-1 (- f26-0))) + 0 + (goto cfg-38) + ) + (set! s3-1 (-> s3-1 0 brother)) + ) + ) + ) + ) + (label cfg-38) + f30-0 + ) + (else + 1.0 + ) + ) + ) + (vector+! (-> self root trans) (-> self root trans) gp-2) + (if (< f30-0 1.0) + (vector+float*! (-> self root trans) (-> self root trans) (-> self root transv) (* f30-0 (seconds-per-frame))) + ) + ) + ) + ) + :code (behavior () + (gun-dark-2-anim-code) + ) + :post (behavior () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (-> self root)) + (set! (-> self skel status) gp-0) + ) + (let ((gp-1 (-> self child))) + (while gp-1 + (when (send-event (-> gp-1 0) 'is-gravity) + (send-event (-> gp-1 0) 'update-rotation) + (return 0) + ) + (set! gp-1 (-> gp-1 0 brother)) + ) + ) + ) + ) diff --git a/goal_src/jak3/engine/common-obs/generic-obs.gc b/goal_src/jak3/engine/common-obs/generic-obs.gc index 00de5e6891b..470db433152 100644 --- a/goal_src/jak3/engine/common-obs/generic-obs.gc +++ b/goal_src/jak3/engine/common-obs/generic-obs.gc @@ -20,6 +20,56 @@ (define-extern process-entity-set! (function process entity entity)) (define-extern cshape-reaction-default (function control-info collide-query vector vector collide-status)) +(defmacro set-part-tracker-params (type group duration callback userdata target mat-joint subsample-num) + `(case ,type + ((part-tracker) + (set! (-> *part-tracker-params-default* group) ,group) + (set! (-> *part-tracker-params-default* duration) ,duration) + (set! (-> *part-tracker-params-default* callback) ,callback) + (set! (-> *part-tracker-params-default* userdata) ,userdata) + (set! (-> *part-tracker-params-default* target) ,target) + (set! (-> *part-tracker-params-default* mat-joint) ,mat-joint) + ) + (else + (set! (-> *part-tracker-subsampler-params-default* group) ,group) + (set! (-> *part-tracker-subsampler-params-default* duration) ,duration) + (set! (-> *part-tracker-subsampler-params-default* callback) ,callback) + (set! (-> *part-tracker-subsampler-params-default* userdata) ,userdata) + (set! (-> *part-tracker-subsampler-params-default* target) ,target) + (set! (-> *part-tracker-subsampler-params-default* mat-joint) ,mat-joint) + (set! (-> *part-tracker-subsampler-params-default* subsample-num) ,subsample-num) + ) + ) + ) + +(defmacro part-tracker-spawn (type &key (group #f) + &key (to #f) + &key (name #f) + &key (stack-size #x4000) + &key (stack *scratch-memory-top*) + &key (unk 0) + &key (duration (seconds 0)) + &key (callback #f) + &key (userdata (the uint #f)) + &key (target #f) + &key (mat-joint *launch-matrix*) + &key (subsample-num 1.0)) + "Specialized `process-spawn` macro for [[part-tracker]]s. + Returns a pointer to the new process, or #f (or is it 0?) if something goes wrong." + (with-gensyms (new-tracker) + `(let ((,new-tracker (the-as ,type (get-process *default-dead-pool* ,type ,stack-size ,unk)))) + (when ,new-tracker + ((method-of-type ,type activate) ,new-tracker ,to ,(if name name `(symbol->string (quote ,type))) ,stack) + (set-part-tracker-params ,type ,group ,duration ,callback ,userdata ,target ,mat-joint ,subsample-num) + (run-now-in-process ,new-tracker + (if (= ,type part-tracker) part-tracker-init part-tracker-subsampler-init) + (if (= ,type part-tracker) *part-tracker-params-default* *part-tracker-subsampler-params-default*)) + (the (pointer ,type) (-> ,new-tracker ppointer)) + ) + ) + ) + ) + ;; DECOMP BEGINS (define *part-tracker-params-default* (new 'static 'part-tracker-init-params)) @@ -1032,7 +1082,7 @@ 0.0 614400.0 (the-as vector #f) - 0.000000000000000000000000000000000000000000084 + (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0 ) ) @@ -3027,12 +3077,12 @@ ) ;; WARN: Return type mismatch process vs none. -(defun explosion-spawn ((arg0 process-drawable) (arg1 type) (arg2 explosion-init-params)) +(defun explosion-spawn ((arg0 explosion-init-params) (arg1 process-drawable)) (let* ((gp-0 (the-as process #f)) (s3-0 (get-process *default-dead-pool* explosion #x4000 1)) (v1-1 (when s3-0 (let ((t9-1 (method-of-type explosion activate))) - (t9-1 (the-as explosion s3-0) (the-as process-tree arg1) "explosion" (the-as pointer #x70004000)) + (t9-1 (the-as explosion s3-0) arg1 "explosion" (the-as pointer #x70004000)) ) (run-now-in-process s3-0 explosion-init-by-other arg0) (-> s3-0 ppointer) @@ -3662,56 +3712,18 @@ (cond ((logtest? (-> self particle-launchers (-> self current-part-index) 0 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> gp-1 quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-4 (method-of-type part-tracker-subsampler activate))) - (t9-4 - (the-as part-tracker-subsampler gp-2) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-5 run-function-in-process) - (a0-18 gp-2) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) - (-> self particle-launchers (-> self current-part-index) 0) - ) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-5) a0-18 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> self particle-launchers (-> self current-part-index) 0) ) ) (else (set! (-> *launch-matrix* trans quad) (-> gp-1 quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker gp-3) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-23 gp-3) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self particle-launchers (-> self current-part-index) 0)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-8) a0-23 a1-6 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> self particle-launchers (-> self current-part-index) 0) ) ) ) diff --git a/goal_src/jak3/engine/common-obs/guard-projectile.gc b/goal_src/jak3/engine/common-obs/guard-projectile.gc index 47864d10952..d09cea5f64b 100644 --- a/goal_src/jak3/engine/common-obs/guard-projectile.gc +++ b/goal_src/jak3/engine/common-obs/guard-projectile.gc @@ -7,3 +7,611 @@ ;; DECOMP BEGINS +(defpart 849 + :init-specs ((:texture (common-white common)) + (:num 10.0 1.0) + (:x (meters 0)) + (:y (meters 0)) + (:z (meters 0)) + (:scale-x (meters 1)) + (:rot-x (degrees 90)) + (:rot-y (degrees 0)) + (:rot-z (degrees 0)) + (:scale-y (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0 32.0) + (:accel-y (meters -0.00033333333) (meters -0.001)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 850 + :init-specs ((:texture (gun-yellow-beam level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 0.25)) + (:scale-y (meters 9)) + (:r 128.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 128.0) + (:scalevel-x (meters 0.0016666667)) + (:fade-a -2.1333334) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +(defpart 851 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 32.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters -0.016666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.6) + (:timer (seconds 0.085)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 852 + :init-specs ((:texture (glow level-default-sprite)) + (:num 0.0) + (:scale-x (meters 0.3) (meters 0.3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0 32.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 853 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 8.0 8.0) + (:z (meters 0) (meters -3)) + (:scale-x (meters 0.4) (meters 0.4)) + (:scale-y (meters 0.4) (meters 0.4)) + (:r 192.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters -0.00234375)) + (:scalevel-y :copy scalevel-x) + (:fade-g -1.2 -2.4) + (:fade-a -0.53333336 -2.1333334) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:timer (seconds 0.8)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 854 + :init-specs ((:texture (gun-enemy-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 2)) + (:scale-y (meters 4.5)) + (:r 128.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 128.0) + (:fade-a -3.6571429) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +(defpart 855 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1) (meters 1)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 0.0) + (:a 255.0) + (:omega (degrees 4515.75)) + (:scalevel-x (meters 0.053333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -3.6571429) + (:fade-a -7.285714) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1024.0) + ) + ) + +(defpartgroup group-guard-shot-hit-object + :id 211 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 856 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 857 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 858 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + ) + ) + +(defpartgroup group-guard-shot-hit + :id 212 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 856 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 857 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 858 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 859 :period (seconds 2) :length (seconds 0.017)) + ) + ) + +(defpart 858 + :init-specs ((:texture (explosion-nebula level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2)) + (:rot-x (degrees 1.125)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters 0.075)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.8285714) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 8192.0) + ) + ) + +(defpart 859 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 8.0 8.0) + (:scale-x (meters 0.75) (meters 0.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 16.0 48.0) + (:vel-y (meters 0.026666667) (meters 0.026666667)) + (:scalevel-x (meters 0.0016666667) (meters 0.006666667)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.30476192) + (:fade-g 0.15238096) + (:fade-b 0.30476192) + (:fade-a -0.15238096) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:friction 0.9) + (:timer (seconds 1.4)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 857 + :init-specs ((:texture (glow level-default-sprite)) + (:num 2.0) + (:scale-x (meters 2)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 128.0 64.0) + (:b 0.0 32.0) + (:a 48.0) + (:scalevel-x (meters 0.125)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.1333334) + (:fade-b -2.1333334) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow)) + (:userdata 0.0) + (:next-time (seconds 0.067)) + (:next-launcher 860) + ) + ) + +(defpart 860 + :init-specs ((:scale-x (meters 4.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.05)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.53333336) + (:fade-a -0.8) + ) + ) + +(defpart 856 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 96.0) + (:scalevel-x (meters 0.1)) + (:rotvel-z (degrees 0.3)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.185)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.05)) + (:next-launcher 861) + ) + ) + +(defpart 861 + :init-specs ((:scale-x (meters 3.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.0625)) + (:scalevel-y :copy scalevel-x) + (:fade-b -6.4) + ) + ) + +(defpartgroup group-guard-grenade + :id 213 + :duration (seconds 0.5) + :flags (sp0) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 862 :fade-after (meters 200) :falloff-to (meters 200))) + ) + +(defpart 862 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.5) (meters 0.25)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 64.0 128.0) + (:g :copy r) + (:b :copy g) + (:a 16.0 32.0) + (:vel-y (meters 0) (meters 0.016666668)) + (:scalevel-x (meters 0.006666667) (meters 0.013333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16 -0.16) + (:friction 0.96) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 0)) + ) + ) + +(deftype guard-shot (projectile) + ((hit-actor? symbol) + (tail-pos vector :inline) + ) + ) + + +(defmethod deal-damage! ((this guard-shot) (arg0 process) (arg1 event-message-block)) + (let ((t9-0 (method-of-type projectile deal-damage!))) + (when (t9-0 this arg0 arg1) + (set! (-> this hit-actor?) #t) + #t + ) + ) + ) + +(defmethod projectile-method-24 ((this guard-shot)) + (draw-beam (-> *part-id-table* 854) (-> this tail-pos) (-> this starting-dir) #f) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> this tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 855)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +(defmethod projectile-method-25 ((this guard-shot)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-0) + (launch-particles (-> *part-id-table* 852) s4-0) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000027126736 f30-0)) + (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 853) s4-1 :origin-is-matrix #t) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +(defmethod projectile-method-26 ((this guard-shot)) + (let* ((s5-0 (-> this root)) + (a0-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> s5-0 trans)) 2048.0)) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-1 quad) (-> s5-0 trans quad)) + (vector+! v1-1 v1-1 a0-3) + (cond + ((-> this hit-actor?) + (cond + ((logtest? (-> *part-group-id-table* 211 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 211)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 211)) + ) + ) + ) + ((logtest? (-> *part-group-id-table* 212 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 212)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 212)) + ) + ) + ) + 0 + (none) + ) + +(defmethod play-impact-sound ((this guard-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "guard-shot-fire") + ) + ((= v1-0 (projectile-options po0)) + (sound-play "guard-shot-hit") + ) + ) + ) + 0 + (none) + ) + +(defun guard-shot-move ((arg0 guard-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 36864.0 f0-0) + (vector-normalize! s4-0 36864.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (if (logtest? (-> arg0 root status) (collide-status touch-actor)) + (set! (-> arg0 hit-actor?) #t) + ) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +(defmethod made-impact? ((this guard-shot)) + (let ((v1-0 (-> this root)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a0-1 t1-0)) + (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a0-1 ignore-process0) this) + (set! (-> a0-1 ignore-process1) (ppointer->process (-> this parent))) + (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a0-1 action-mask) (collide-action solid)) + ) + (when (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) + (if (logtest? (-> this root status) (collide-status touch-actor)) + (set! (-> this hit-actor?) #t) + ) + #t + ) + ) + ) + +(defmethod setup-collision! ((this guard-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 2457.6) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + 0 + (none) + ) + +(defmethod init-proj-settings! ((this guard-shot)) + (set! (-> this hit-actor?) #f) + (set! (-> this tail-pos quad) (-> this root trans quad)) + (set! (-> this attack-mode) 'guard-shot) + (set! (-> this max-speed) 819200.0) + (set! (-> this move) guard-shot-move) + (set! (-> this update-velocity) projectile-update-velocity-space-wars) + (set! (-> this timeout) (seconds 0.5)) + (logior! (-> this options) (projectile-options po13)) + (set-gravity-length (-> this root dynam) 573440.0) + (none) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer guard-shot). +(defun spawn-guard-projectile ((arg0 process-focusable) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (if arg4 + (set! (-> gp-0 pos quad) (-> arg4 quad)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + ) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer guard-shot) (spawn-projectile guard-shot gp-0 arg0 *default-dead-pool*)) + ) + ) diff --git a/goal_src/jak3/engine/common-obs/metalhead-projectile.gc b/goal_src/jak3/engine/common-obs/metalhead-projectile.gc index b0f57821e0a..6b4534223dc 100644 --- a/goal_src/jak3/engine/common-obs/metalhead-projectile.gc +++ b/goal_src/jak3/engine/common-obs/metalhead-projectile.gc @@ -7,3 +7,878 @@ ;; DECOMP BEGINS +(defpart 863 + :init-specs ((:texture (gun-enemy-beam level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 0.25)) + (:scale-y (meters 12)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 32.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +(defpart 864 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0) + (:b 128.0) + (:a 64.0) + (:scalevel-x (meters -0.075)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.6) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +(defpart 865 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 16.0) + (:z (meters 0) (meters -2)) + (:scale-x (meters 0.5) (meters 0.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 0.5) (meters 0.5)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0) + (:fade-g -3.2 -6.4) + (:fade-a -1.6 -6.4) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 866 + :init-specs ((:texture (gun-enemy-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 2)) + (:scale-y (meters 4.5)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 128.0) + (:fade-a -3.6571429) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +(defpart 867 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 64.0) + (:b 128.0) + (:a 255.0) + (:omega (degrees 4515.75)) + (:scalevel-x (meters 0.10666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -7.285714) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1024.0) + ) + ) + +(defpartgroup group-metalhead-shot-hit + :id 214 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 868 :period (seconds 2) :length (seconds 0.017)) + (sp-item 869 :fade-after (meters 100) :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 870 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 871 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 872 :period (seconds 2) :length (seconds 0.017)) + (sp-item 873 :fade-after (meters 50) :falloff-to (meters 50) :period (seconds 2) :length (seconds 0.017)) + ) + ) + +(defpart 871 + :init-specs ((:texture (explosion-nebula level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-x (degrees 1.125)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 255.0) + (:a 12.0) + (:scalevel-x (meters 0.26666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.34285715) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 4096.0) + ) + ) + +(defpart 872 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 8.0 8.0) + (:scale-x (meters 1) (meters 0.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0 128.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:a 16.0 48.0) + (:vel-y (meters 0.013333334) (meters 0.04)) + (:scalevel-x (meters 0.0016666667) (meters 0.013333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.30476192) + (:fade-g -0.35555556) + (:fade-b -0.17777778) + (:fade-a -0.15238096) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:friction 0.9) + (:timer (seconds 1.4)) + (:flags (sp-cpuinfo-flag-2)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 873 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 20.0 10.0) + (:y (meters 0.25)) + (:scale-x (meters 0.075) (meters 0.05)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 128.0) + (:b 128.0) + (:a 64.0 32.0) + (:omega (degrees 0.0225) (degrees 0.0225)) + (:vel-y (meters 0.033333335) (meters 0.1)) + (:rotvel-z (degrees -2.4) 1 (degrees 4.8)) + (:fade-g -0.85333335) + (:fade-a 0.0) + (:accel-y (meters -0.00033333333) (meters -0.0013333333)) + (:friction 0.9 0.02) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:func 'sparticle-motion-blur) + (:next-time (seconds 0.335)) + (:next-launcher 874) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 874 + :init-specs ((:fade-a -0.48 -0.48)) + ) + +(defpart 869 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 4)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 128.0) + (:b 128.0 128.0) + (:a 128.0) + (:rotvel-z (degrees -0.1)) + (:fade-a -1.6) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata -4096.0) + (:next-launcher 875) + ) + ) + +(defpart 875 + :init-specs ((:scale-x (meters 2) (meters 0.5)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:next-time (seconds 0.017)) + (:next-launcher 875) + ) + ) + +(defpart 870 + :init-specs ((:texture (glow level-default-sprite)) + (:num 2.0) + (:scale-x (meters 1)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:a 48.0) + (:scalevel-x (meters 0.12857144)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.1333334) + (:fade-b -2.1333334) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow)) + (:userdata -4096.0) + (:next-time (seconds 0.067)) + (:next-launcher 876) + ) + ) + +(defpart 876 + :init-specs ((:scale-x (meters 4.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.06666667)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.53333336) + (:fade-a -0.8) + ) + ) + +(defpart 868 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 96.0) + (:scalevel-x (meters 0.16666667)) + (:rotvel-z (degrees 0.3)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.185)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.05)) + (:next-launcher 877) + ) + ) + +(defpart 877 + :init-specs ((:scale-x (meters 3.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.0875)) + (:scalevel-y :copy scalevel-x) + (:fade-b -6.4) + ) + ) + +(defpartgroup group-metalhead-shot-die + :id 215 + :duration (seconds 0.017) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 249)) + ) + +(defpart 878 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2.5)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 192.0) + (:b 64.0) + (:a 16.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 819.2) + ) + ) + +(deftype metalhead-shot (projectile) + ((tail-pos vector :inline) + ) + ) + + +(defmethod projectile-method-24 ((this metalhead-shot)) + (draw-beam (-> *part-id-table* 866) (-> this tail-pos) (-> this starting-dir) #f) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> this tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 867)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +(defmethod projectile-method-25 ((this metalhead-shot)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 864) s4-0) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000020345053 f30-0)) + (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 865) s4-1 :origin-is-matrix #t) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +(defmethod projectile-method-26 ((this metalhead-shot)) + (let* ((gp-0 (-> this root)) + (a0-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> gp-0 trans)) 2048.0)) + (v1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-2 quad) (-> gp-0 trans quad)) + (vector+! v1-2 v1-2 a0-3) + (cond + ((logtest? (-> *part-group-id-table* 214 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-2 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 214)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-2 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 214)) + ) + ) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch sound-id vs none. +(defmethod play-impact-sound ((this metalhead-shot) (arg0 projectile-options)) + (with-pp + (case arg0 + (((projectile-options po0 po1)) + (when (nonzero? (-> this sound-id)) + (when *sound-player-enable* + (let ((gp-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-0 command) (sound-command set-param)) + (set! (-> gp-0 id) (-> this sound-id)) + (let ((a1-1 (-> this root trans))) + (let ((s5-1 pp)) + (when (= a1-1 #t) + (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> (the-as process-drawable s5-1) root))) + (set! a1-1 (-> (the-as process-drawable s5-1) root trans)) + (set! a1-1 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (-> gp-0 params trans) a1-1) + ) + (set! (-> gp-0 params mask) (the-as uint 32)) + (-> gp-0 id) + ) + ) + ) + ) + ) + (none) + ) + ) + +(defun metalhead-shot-move ((arg0 metalhead-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 49152.0 f0-0) + (vector-normalize! s4-0 49152.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (if (logtest? (-> s5-0 status) (collide-status touch-surface)) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +(defmethod setup-collision! ((this metalhead-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + (none) + ) + +(defmethod init-proj-settings! ((this metalhead-shot)) + (set! (-> this tail-pos quad) (-> this root trans quad)) + (set! (-> this attack-mode) 'metalhead-shot) + (set! (-> this max-speed) 532480.0) + (set! (-> this move) metalhead-shot-move) + (set! (-> this timeout) (seconds 0.767)) + (set-gravity-length (-> this root dynam) 573440.0) + (none) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-shot). +(defun spawn-metalhead-projectile ((arg0 metalhead-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) + +(defpartgroup group-metalhead-grenade-shot + :id 216 + :duration (seconds 0.5) + :flags (sp0) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 879) (sp-item 880) (sp-item 881)) + ) + +(defpart 879 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3) (meters 1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0) + (:fade-r -5.5) + (:fade-g -51.0) + (:fade-b -5.5) + (:fade-a -8.533334) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 409.6) + ) + ) + +(defpart 880 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 4.0) + (:scale-x (meters 1) (meters 0.2)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 128.0) + (:scalevel-x (meters -0.01)) + (:rotvel-z (degrees -1.2) (degrees 1.2)) + (:scalevel-y :copy scalevel-x) + (:fade-r -1.375) + (:fade-g -6.375) + (:fade-b -1.375) + (:fade-a -3.2 -3.2) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0) (meters 0.2)) + ) + ) + +(defpart 881 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 2.0 1.0) + (:scale-x (meters 0.8) (meters 0.4)) + (:scale-y (meters 0.6) (meters 0.2)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0 32.0) + (:scalevel-x (meters -0.0026666666) (meters -0.0026666666)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.73333335) + (:fade-g -3.4) + (:fade-b -0.73333335) + (:accel-y (meters -0.00033333333) (meters -0.001)) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.25)) + (:next-launcher 882) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0) (meters 0.35)) + ) + ) + +(defpart 882 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:fade-a -0.48 -0.48)) + ) + +(deftype metalhead-grenade-shot (projectile) + ((tumble-quat quaternion :inline) + (blast-radius float) + ) + ) + + +(defmethod projectile-method-26 ((this metalhead-grenade-shot)) + (cond + ((logtest? (-> *part-group-id-table* 104 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> this root trans quad)) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 104)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> this root trans quad)) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 104)) + ) + ) + 0 + (none) + ) + +(defmethod play-impact-sound ((this metalhead-grenade-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "gren-launch") + ) + ((= v1-0 (projectile-options po0)) + (sound-play "gren-shot-hit") + ) + ((= v1-0 (projectile-options po0 po1)) + (sound-play-by-name + (static-sound-name "gren-missile") + (-> this sound-id) + 1024 + (the int (* 1524.0 (doppler-pitch-shift (-> this root trans) (-> this root transv)))) + 0 + (sound-group) + (-> this root trans) + ) + ) + ) + ) + 0 + (none) + ) + +(defstate impact (metalhead-grenade-shot) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + (the-as process-focusable s4-0) + ) + ) + ) + (when v1-1 + (let ((s4-1 (-> v1-1 root)) + (a1-3 (new 'stack 'collide-query)) + ) + 0.0 + (set! (-> a1-3 start-pos quad) (-> self root root-prim prim-core world-sphere quad)) + (vector-! (-> a1-3 move-dist) (the-as vector (-> s4-1 root-prim prim-core)) (-> a1-3 start-pos)) + (let ((v1-6 a1-3)) + (set! (-> v1-6 radius) 40.96) + (set! (-> v1-6 collide-with) (collide-spec backgnd)) + (set! (-> v1-6 ignore-process0) self) + (set! (-> v1-6 ignore-process1) (ppointer->process (-> self parent))) + (set! (-> v1-6 ignore-pat) (-> self root pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-3) 0.0) + (deal-damage! self proc (the-as event-message-block (-> block param 0))) + (let ((v1-11 (-> self notify-handle))) + (if (handle->process v1-11) + (send-event (-> v1-11 process 0) 'notify 'attack proc) + ) + ) + ) + ) + ) + ) + ) + ) + ) + :enter (behavior () + (let ((t9-0 (-> (method-of-type projectile impact) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-5 (-> self root root-prim))) + (set! (-> v1-5 local-sphere w) (-> self blast-radius)) + (set! (-> v1-5 prim-core world-sphere w) (-> self blast-radius)) + (set! (-> v1-5 prim-core collide-with) + (collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-5 prim-core collide-as) (collide-spec enemy)) + ) + (update-transforms (-> self root)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root) a1-0) + ) + ) + :code (behavior () + (suspend) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + ) + ) + +(defstate dissipate (metalhead-grenade-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + ) + ) + +(defmethod projectile-method-25 ((this metalhead-grenade-shot)) + (spawn (-> this part) (-> this root trans)) + 0 + (none) + ) + +(defun gren-canister-move ((arg0 metalhead-grenade-shot)) + (quaternion*! (-> arg0 root quat) (-> arg0 root quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> arg0 root) s5-0 (collide-action solid semi-solid)) + (if (and (logtest? (-> s5-0 flags) (water-flag active)) (< (-> arg0 root trans y) (-> s5-0 trans y))) + (go (method-of-object arg0 impact)) + ) + ) + (if (logtest? (-> arg0 root status) (collide-status touch-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +(defun gren-cshape-reaction-canister ((arg0 collide-shape-moving) (arg1 metalhead-grenade-shot)) + (let ((s5-0 0)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (the-as vector (&-> arg1 starting-dir y)) (the-as float (-> arg1 connection-list prev0))) + (move-by-vector! arg0 a1-1) + ) + (let ((f30-0 (vector-dot (-> arg0 transv) (the-as vector (&-> arg1 prev-state)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s3-0 (the-as vector (&-> arg1 prev-state)) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! (-> arg0 transv) (-> arg0 transv) s3-0) + ) + (let ((v0-2 (logior s5-0 7))) + (logior! (-> arg0 status) v0-2) + ) + ) + (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.88) + (none) + ) + +(defmethod setup-collision! ((this metalhead-grenade-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec backgnd jak crate obstacle hit-by-others-list player-list pusher) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + (none) + ) + +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-proj-settings! ((this metalhead-grenade-shot)) + (set! (-> this attack-mode) 'explode) + (set! (-> this blast-radius) 4096.0) + (set! (-> this max-speed) 135168.0) + (set! (-> this timeout) (seconds 4)) + (set! (-> this update-velocity) projectile-update-velocity-add-gravity) + (set! (-> this move) gren-canister-move) + (set! (-> this root dynam gravity y) 102400.0) + (set! (-> this root dynam gravity-length) 102400.0) + (set! (-> this root dynam gravity-max) 102400.0) + (let ((f0-5 1092.2667)) + (quaternion-axis-angle! (-> this tumble-quat) 1.0 0.0 0.0 f0-5) + ) + (set! (-> this part) (create-launch-control (-> *part-group-id-table* 216) this)) + (set! (-> this sound-id) (new-sound-id)) + (none) + ) + +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-grenade-shot). +(defun spawn-metalhead-grenade ((arg0 metalhead-grenade-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-grenade-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) diff --git a/goal_src/jak3/engine/common-obs/particle-curves.gc b/goal_src/jak3/engine/common-obs/particle-curves.gc index a28624b5241..9fb1c24b294 100644 --- a/goal_src/jak3/engine/common-obs/particle-curves.gc +++ b/goal_src/jak3/engine/common-obs/particle-curves.gc @@ -5,5 +5,166 @@ ;; name in dgo: particle-curves ;; dgos: GAME +;; +++particle-curve-flags +(defenum particle-curve-flags + :type uint64 + :bitfield #t + (pcf0 0) + (pcf1 1) + ) +;; ---particle-curve-flags + +(define-extern *alpha-fast* curve2d-fast) +(define-extern *unity-fast* curve2d-fast) +(define-extern *ccro* curve-color-fast) +(define-extern *scale-curve* curve2d-fast) +(define-extern *scale-range* curve2d-fast) + ;; DECOMP BEGINS +(deftype particle-curve-settings (structure) + ((color-start basic) + (alpha-start basic) + (scale-x-start basic) + (scale-y-start basic) + (r-scalar basic) + (g-scalar basic) + (b-scalar basic) + (a-scalar basic) + (scale-x-scalar basic) + (scale-y-scalar basic) + (lifetime-base time-frame) + (lifetime-offset time-frame) + (flags particle-curve-flags) + ) + ) + + +(def-mips2c birth-func-curve (function int sparticle-cpuinfo sparticle-launchinfo none)) + +(def-mips2c live-func-curve (function sparticle-system sparticle-cpuinfo vector none)) + +(defpart 69 + :init-specs ((:texture (middot level-default-sprite)) + (:birth-func 'birth-func-curve) + (:num 1.0) + (:scale-x (meters 1)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 128.0) + (:vel-y (meters 0.01)) + (:timer (seconds 16.667)) + (:flags ()) + (:userdata 0.0) + (:func 'live-func-curve) + (:conerot-x (degrees -30) (degrees 60)) + (:conerot-z (degrees -30) (degrees 60)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(if #t + (set! *alpha-fast* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.25 :z -0.5 :w -1.0) + :ys (new 'static 'vector :x 1.0 :y 0.75 :z 0.5) + :one-over-x-deltas (new 'static 'vector :x -1.0 :y -1.0 :z -1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *unity-fast* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 1.0 :y 1.0 :z 2.0 :w 3.0) + :one-over-x-deltas (new 'static 'vector :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *ccro* (new 'static 'curve-color-fast + :xs (new 'static 'vector :y -0.4 :z -0.7 :w -1.0) + :ys (new 'static 'inline-array vector 4 + (new 'static 'vector :x 128.0 :w 128.0) + (new 'static 'vector :x 128.0 :y 128.0 :w 128.0) + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + (new 'static 'vector :y 128.0 :w 128.0) + ) + :one-over-x-deltas (new 'static 'vector :x 2.5 :y 3.3333335 :z 3.3333333 :w 1.0) + ) + ) + ) + +(if #t + (set! *scale-curve* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.7 :w -1.0) + :ys (new 'static 'vector :x 1.0 :y 0.1 :z 0.1 :w 6.0) + :one-over-x-deltas (new 'static 'vector :x -2.9999998 :z 19.666666 :w 1.0) + ) + ) + ) + +(if #t + (set! *scale-range* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 0.3 :y 0.4 :z 1.4 :w 2.4) + :one-over-x-deltas (new 'static 'vector :x 0.099999994 :y 1.0 :z 1.0000001 :w 1.0) + ) + ) + ) + +(define *part-function-curve-test-curve-settings* (new 'static 'particle-curve-settings + :lifetime-base (seconds 1.5) + :lifetime-offset (seconds 1) + :flags (particle-curve-flags pcf0) + ) + ) + +(set! (-> *part-id-table* 69 init-specs 12 initial-valuef) + (the-as float *part-function-curve-test-curve-settings*) + ) + +(set! (-> *part-function-curve-test-curve-settings* color-start) *ccro*) + +(set! (-> *part-function-curve-test-curve-settings* alpha-start) *unity-fast*) + +(set! (-> *part-function-curve-test-curve-settings* scale-x-start) *scale-range*) + +(set! (-> *part-function-curve-test-curve-settings* scale-y-start) #f) + +(set! (-> *part-function-curve-test-curve-settings* r-scalar) #f) + +(set! (-> *part-function-curve-test-curve-settings* g-scalar) #f) + +(set! (-> *part-function-curve-test-curve-settings* b-scalar) #f) + +(set! (-> *part-function-curve-test-curve-settings* a-scalar) *alpha-fast*) + +(set! (-> *part-function-curve-test-curve-settings* scale-x-scalar) *scale-curve*) + +(set! (-> *part-function-curve-test-curve-settings* scale-y-scalar) #f) + +;; WARN: Return type mismatch symbol vs none. +(defun ptest () + (dotimes (gp-0 1000) + (let ((t9-0 sp-launch-particles-var) + (a0-0 *sp-particle-system-2d*) + (a1-0 (-> *part-id-table* 69)) + (a2-0 *launch-matrix*) + ) + (let ((v1-1 (-> a2-0 trans)) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) 0.0) + (set! (-> a3-0 y) 40960.0) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (set! (-> v1-1 quad) (-> a3-0 quad)) + ) + (t9-0 a0-0 a1-0 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (none) + ) diff --git a/goal_src/jak3/engine/common-obs/plat.gc b/goal_src/jak3/engine/common-obs/plat.gc index 32d3a286824..4e97b60ccf3 100644 --- a/goal_src/jak3/engine/common-obs/plat.gc +++ b/goal_src/jak3/engine/common-obs/plat.gc @@ -7,3 +7,310 @@ ;; DECOMP BEGINS +(deftype plat (base-plat) + ((path-pos float) + (sound-id sound-id) + (sync sync-eased :inline) + ) + (:state-methods + plat-idle + plat-path-active + ) + (:methods + (go-initial-state (_type_) object) + ) + ) + + +(defskelgroup skel-plat plat plat-lod0-jg plat-idle-ja + ((plat-lod0-mg (meters 20)) (plat-lod1-mg (meters 40)) (plat-lod2-mg (meters 999999))) + :bounds (static-spherem 0 -0.5 0 3) + ) + +(defmethod get-art-group ((this plat)) + (art-group-get-by-name *level* "skel-plat" (the-as (pointer level) #f)) + ) + +(defmethod init-collision! ((this plat)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13107.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + ((method-of-object s5-0 collide-shape-method-54)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-11 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod base-plat-method-34 ((this plat)) + 0 + (none) + ) + +(defmethod base-plat-method-33 ((this plat)) + 0 + (none) + ) + +(defmethod go-initial-state ((this plat)) + (cond + ((logtest? (-> this path flags) (path-control-flag not-found)) + (go (method-of-object this plat-idle)) + ) + ((> (-> this sync period) 0) + (go (method-of-object this plat-path-active)) + ) + (else + (go (method-of-object this plat-idle)) + ) + ) + ) + +(defstate plat-idle (plat) + :virtual #t + :event plat-event + :trans (behavior () + (update-part-and-sfx! self) + ) + :code (behavior () + (plat-trans) + (rider-post) + (suspend) + (until #f + (when (not (-> self bouncing)) + (plat-trans) + (rider-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + (while (-> self bouncing) + (plat-trans) + (rider-post) + (suspend) + ) + ) + #f + ) + ) + +(defstate plat-path-active (plat) + :virtual #t + :event plat-event + :exit (behavior () + (sound-stop (-> self sound-id)) + ) + :trans (behavior () + (set! (-> self path-pos) (get-norm! (-> self sync) 0)) + (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) + (if (< (vector-vector-distance (-> self root trans) (ear-trans 0)) 81920.0) + (sound-play "eco-plat-hover" :id (-> self sound-id) :position (-> self root trans)) + ) + (plat-trans) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + ) + :post plat-post + ) + +(defmethod init-from-entity! ((this plat) (arg0 entity-actor)) + (logior! (-> this mask) (process-mask platform)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) + (update-transforms (-> this root)) + (init-bounce-params! this) + (base-plat-method-33 this) + (set! (-> this fact) + (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-15 0)) + (if (not (logtest? (-> this fact options) (actor-option loop))) + (set! v1-15 (logior v1-15 1)) + ) + (set! (-> a1-4 sync-type) 'sync-eased) + (set! (-> a1-4 sync-flags) (the-as sync-flags v1-15)) + ) + (set! (-> a1-4 period) (the-as uint 1200)) + (set! (-> a1-4 entity) arg0) + (set! (-> a1-4 percent) 0.0) + (set! (-> a1-4 ease-in) 0.15) + (set! (-> a1-4 ease-out) 0.15) + (set! (-> a1-4 pause-in) 0.0) + (set! (-> a1-4 pause-out) 0.0) + (initialize! (-> this sync) a1-4) + ) + (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> this sound-id) (new-sound-id)) + (cond + ((logtest? (-> this path flags) (path-control-flag not-found)) + (set! (-> this path-pos) 0.0) + (base-plat-method-34 this) + (go-initial-state this) + ) + ((> (-> this sync period) 0) + (set! (-> this path-pos) (get-norm! (-> this sync) 0)) + (get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp) + (base-plat-method-34 this) + (go-initial-state this) + ) + (else + (set! (-> this path-pos) 0.0) + (get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp) + (base-plat-method-34 this) + (go-initial-state this) + ) + ) + ) + +(deftype drop-plat (base-plat) + ((art-name string) + (anim spool-anim) + (break-anim-name string) + (safe-time time-frame) + (hit-point vector :inline) + ) + (:state-methods + idle + (fall symbol) + ) + ) + + +;; WARN: Return type mismatch base-plat vs drop-plat. +(defmethod relocate ((this drop-plat) (offset int)) + (if (nonzero? (-> this break-anim-name)) + (&+! (-> this break-anim-name) offset) + ) + (let ((v1-5 (-> this anim anim-name))) + (if (and (>= (the-as int v1-5) (-> *kernel-context* relocating-min)) + (< (the-as int v1-5) (-> *kernel-context* relocating-max)) + ) + (&+! (-> this anim anim-name) offset) + ) + ) + (the-as drop-plat ((method-of-type base-plat relocate) this offset)) + ) + +(defstate idle (drop-plat) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touch 'attack 'bonk) + (let* ((s5-0 proc) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (cond + ((and a0-5 (focus-test? (the-as process-focusable a0-5) edge-grab)) + (set! (-> self safe-time) (+ (current-time) (seconds 0.2))) + (return (the-as object #f)) + ) + ((not (time-elapsed? (-> self safe-time) (seconds 0.05))) + (return (the-as object #f)) + ) + ) + ) + (set! (-> self hit-point quad) (-> self root trans quad)) + (let ((a0-13 (if (type? proc process-focusable) + proc + ) + ) + ) + (set! (-> self hit-point quad) (-> (get-trans (the-as process-focusable a0-13) 0) quad)) + ) + (if (zero? (-> self bounce-time)) + (start-bounce! self) + ) + #f + ) + ) + ) + :trans plat-trans + :code (behavior () + (add-process *gui-control* self (gui-channel art-load) (gui-action queue) (-> self anim name) -99.0 0) + (until #f + (when (not (-> self bouncing)) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + (while (-> self bouncing) + (suspend) + ) + (go-virtual fall #f) + ) + #f + ) + :post plat-post + ) + +(defstate fall (drop-plat) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('edge-grabbed) + (if (time-elapsed? (-> self state-time) (seconds 0.5)) + (send-event proc 'end-mode 'edge-grab) + ) + ) + (('die) + (go-virtual fall #t) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + ) + :exit (behavior () + (ja-abort-spooled-anim (-> self anim) (the-as art-joint-anim #f) -1) + ) + :trans rider-trans + :code (behavior ((arg0 symbol)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (if (not arg0) + (ja-play-spooled-anim + (-> self anim) + (ja-group) + (the-as art-joint-anim #f) + (the-as (function process-drawable symbol) false-func) + (spooler-flags) + ) + ) + (ja-channel-set! 0) + (suspend) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + :post rider-post + ) diff --git a/goal_src/jak3/engine/common-obs/powerups.gc b/goal_src/jak3/engine/common-obs/powerups.gc index 8c9d8189228..5a2b9b7191b 100644 --- a/goal_src/jak3/engine/common-obs/powerups.gc +++ b/goal_src/jak3/engine/common-obs/powerups.gc @@ -7,3 +7,1257 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior cloud-track process ((arg0 process-tree) + (arg1 process-tree) + (arg2 (function vector none)) + (arg3 time-frame) + (arg4 time-frame) + (arg5 time-frame) + ) + (change-parent self arg0) + (let ((s1-1 (process->handle arg0)) + (s2-1 (process->handle arg1)) + ) + (let ((s0-0 (current-time))) + (until (time-elapsed? s0-0 (+ arg3 arg4)) + (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) + (if v1-8 + (deactivate self) + ) + ) + (let* ((f0-1 (fmax 0.0 (fmin 1.0 (/ (- (the float (- (current-time) s0-0)) (the float arg3)) (the float arg4))))) + (a0-18 (process-drawable-pair-random-point! + (the-as process-drawable (-> s1-1 process 0)) + (the-as process-drawable (-> s2-1 process 0)) + (new-stack-vector0) + f0-1 + ) + ) + ) + (arg2 a0-18) + ) + (suspend) + ) + ) + (cond + ((zero? arg5) + (until #f + (suspend) + ) + #f + ) + (else + (let ((s4-1 (current-time))) + (until (time-elapsed? s4-1 arg5) + (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) + (arg2 a0-21) + ) + (suspend) + ) + ) + ) + ) + ) + (none) + ) + +(defpart 784 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 64.0) + (:g 64.0) + (:b 192.0) + (:a 64.0) + (:fade-a -1.0666667) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 785 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 64.0) + (:g 64.0) + (:b 192.0) + (:a 64.0) + (:fade-a -1.0666667) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 786 + :init-specs ((:texture (common-white common)) + (:num 1.0 3.0) + (:scale-x (meters 0.5) (meters 1.5)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y (meters 0.2) (meters 0.1)) + (:r 64.0) + (:g 64.0) + (:b 128.0) + (:a 128.0) + (:fade-a -1.6) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.035)) + (:next-launcher 787) + ) + ) + +(defpart 788 + :init-specs ((:texture (common-white common)) + (:num 0.0 3.0) + (:scale-x (meters 1.5) (meters 1.5)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y (meters 0.2) (meters 0.1)) + (:r 128.0) + (:g 128.0) + (:b 255.0) + (:a 128.0) + (:fade-a -1.6) + (:timer (seconds 0.305)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.035)) + (:next-launcher 787) + ) + ) + +(defpart 787 + :init-specs ((:r 64.0) (:g 64.0) (:fade-r -1.0) (:fade-g -0.4) (:fade-a -2.0)) + ) + +(defpart 789 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.1) (meters 0.15)) + (:scale-y :copy scale-x) + (:r 32.0) + (:g 32.0 64.0) + (:b 192.0 64.0) + (:a 64.0 128.0) + (:scalevel-x (meters -0.00033333333)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.2) + (:accel-y (meters -0.000016666667)) + (:timer (seconds 1.5)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +(defpartgroup group-blue-hit-ground-effect + :id 194 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 790) (sp-item 791) (sp-item 792 :flags (is-3d)) (sp-item 793) (sp-item 794 :flags (is-3d))) + ) + +(defpart 793 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 32.0) + (:y (meters 0.5)) + (:scale-x (meters 1) (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 0.0 63 1.0) + (:vel-y (meters 0.093333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-3)) + (:next-time (seconds 0.067) (seconds 0.065)) + (:next-launcher 795) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0)) + ) + ) + +(defpart 795 + :init-specs ((:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 0.0 63 1.0) + (:next-time (seconds 0.067) (seconds 0.065)) + (:next-launcher 795) + ) + ) + +(defpart 794 + :init-specs ((:texture (splash-foam level-default-sprite)) + (:num 1.0) + (:y (meters 0.5)) + (:scale-x (meters 0)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 96.0 32.0) + (:scalevel-x (meters 0.21333334)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.4)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat)) + (:next-time (seconds 0.2)) + (:next-launcher 796) + ) + ) + +(defpart 796 + :init-specs ((:fade-a -2.1333334)) + ) + +(defpart 792 + :init-specs ((:texture (middot level-default-sprite)) + (:num 1.0) + (:y (meters 0.5)) + (:scale-x (meters 0)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 32.0 32.0) + (:scalevel-x (meters 0.22666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.7111111) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat)) + (:next-time (seconds 0.15)) + (:next-launcher 797) + ) + ) + +(defpart 797 + :init-specs ((:fade-a -1.4222223)) + ) + +(defpart 790 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 32.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 16.0 32.0) + (:vel-y (meters 0.053333335) (meters 0.026666667)) + (:scalevel-x (meters 0.0033333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16) + (:accel-y (meters -0.00033333333)) + (:friction 0.95) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 60) (degrees 30)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 791 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 12.0) + (:scale-x (meters 0.5) (meters 0.25)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 16.0 16.0) + (:vel-y (meters 0.10666667) (meters 0.053333335)) + (:scalevel-x (meters 0.0016666667)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.21333334) + (:accel-y (meters -0.00033333333)) + (:friction 0.95) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 60) (degrees 30)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 798 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 32.0 92.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 799 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 32.0 92.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 800 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 100.0 28.0) + (:g 64.0 64.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 801) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +(defpart 801 + :init-specs ((:fade-r 0.0)) + ) + +(defpart 802 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 0.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 803 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 0.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 804 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 100.0 28.0) + (:g 0.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 805) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +(defpart 805 + :init-specs ((:fade-r 0.0)) + ) + +(defpart 806 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 92.0 32.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 807 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 92.0 32.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +(defpart 808 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 100.0 28.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 809) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +(defpart 809 + :init-specs ((:fade-g 0.0)) + ) + +(defun eco-blue-glow ((arg0 vector)) + (launch-particles (-> *part-id-table* 784) arg0) + (if (rand-vu-percent? 0.5) + (launch-particles (-> *part-id-table* 786) arg0) + ) + 0 + (none) + ) + +(defbehavior target-eco-process target () + (when (and (!= (-> self fact eco-level) 0.0) + (>= (- (-> *display* game-clock frame-counter) (-> self fact eco-pickup-time)) + (the-as time-frame (-> self fact eco-timeout)) + ) + ) + (set! (-> self fact eco-level) 0.0) + (set! (-> self fact eco-timeout) 0) + (logclear! (-> self target-flags) (target-flags tf4)) + (send-event self 'reset-collide) + (stop! (-> self sound)) + ) + (if (logtest? (game-secrets endless-dark) (-> self game secrets)) + (set! (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + (if (logtest? (game-secrets endless-light) (-> self game secrets)) + (set! (-> self game eco-pill-light) (-> *FACT-bank* eco-pill-light-max-default)) + ) + (when (and (< 0.0 (-> self fact eco-level)) + (not (focus-test? self in-head)) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + (rand-vu-percent? + (lerp-scale + 0.0 + 1.0 + (the float (- (-> self fact eco-timeout) + (the-as uint (- (-> *display* game-clock frame-counter) (-> self fact eco-pickup-time))) + ) + ) + 0.0 + 900.0 + ) + ) + ) + (case (-> self fact eco-type) + ((1) + (change-sound! (-> self sound) (static-sound-name "yel-eco-jak")) + (let ((s1-0 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 798 + 799 + ) + ) + ) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-0)) quad) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-2 2) + (let ((v1-58 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-1 sp-launch-particles-var) + (s4-1 *sp-particle-system-2d*) + (s3-1 (-> *part-id-table* 800)) + (s1-1 *launch-matrix*) + ) + (set! (-> s1-1 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-58)) quad) + ) + (s5-1 s4-1 s3-1 s1-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((2) + (target-danger-set! (-> self control danger-mode) 'eco-red) + (update-transforms (-> self control)) + (let ((a1-13 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-13 options) (overlaps-others-options)) + (set! (-> a1-13 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-13 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-13) + ) + (target-danger-set! (-> self control danger-mode) #f) + (update-transforms (-> self control)) + (change-sound! (-> self sound) (static-sound-name "red-eco-jak")) + (let ((s1-2 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-3 sp-launch-particles-var) + (s5-2 *sp-particle-system-2d*) + (s4-2 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 802 + 803 + ) + ) + ) + (s2-2 *launch-matrix*) + ) + (set! (-> s2-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-2)) quad) + ) + (gp-3 s5-2 s4-2 s2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-4 2) + (let ((v1-91 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-3 sp-launch-particles-var) + (s4-3 *sp-particle-system-2d*) + (s3-3 (-> *part-id-table* 804)) + (s1-3 *launch-matrix*) + ) + (set! (-> s1-3 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-91)) quad) + ) + (s5-3 s4-3 s3-3 s1-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((3) + (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) + (let ((v1-104 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (set! (-> *part-id-table* 788 init-specs 4 initial-valuef) 0.0) + (set! (-> *part-id-table* 788 init-specs 4 random-rangef) 65536.0) + ) + (else + (set! (-> *part-id-table* 788 init-specs 4 initial-valuef) 40960.0) + (set! (-> *part-id-table* 788 init-specs 4 random-rangef) 16384.0) + ) + ) + (launch-particles + (-> *part-id-table* 788) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-104)) + ) + ) + (let ((gp-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (launch-particles + (-> *part-id-table* (if (rand-vu-percent? 0.5) + 784 + 785 + ) + ) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) + ) + (if (rand-vu-percent? 0.5) + (launch-particles + (-> *part-id-table* 786) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) + ) + ) + ) + (let ((v1-128 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-7 sp-launch-particles-var) + (s5-7 *sp-particle-system-2d*) + (s4-7 (-> *part-id-table* 789)) + (s2-7 *launch-matrix*) + ) + (set! (-> s2-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-128)) quad) + ) + (gp-7 s5-7 s4-7 s2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) + ) + ((5) + (change-sound! (-> self sound) (static-sound-name "green-eco-jak")) + (let ((s1-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-8 sp-launch-particles-var) + (s5-8 *sp-particle-system-2d*) + (s4-8 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 806 + 807 + ) + ) + ) + (s2-8 *launch-matrix*) + ) + (set! (-> s2-8 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-6)) quad) + ) + (gp-8 s5-8 s4-8 s2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-9 2) + (let ((v1-152 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-9 sp-launch-particles-var) + (s4-9 *sp-particle-system-2d*) + (s3-9 (-> *part-id-table* 808)) + (s1-7 *launch-matrix*) + ) + (set! (-> s1-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-152)) quad) + ) + (s5-9 s4-9 s3-9 s1-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (update-trans! (-> self sound) (-> self control trans)) + (update! (-> self sound)) + ) + 0 + (none) + ) + +(defbehavior target-color-effect-process target () + (when (and (-> self color-effect) (time-elapsed? (-> self color-effect-start-time) (-> self color-effect-duration))) + (set! (-> self color-effect) #f) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set! (-> self draw color-emissive quad) (the-as uint128 0)) + ) + (case (-> self color-effect) + (('shock) + (let ((f0-4 (rand-vu-float-range 0.5 2.0))) + (set-vector! (-> self draw color-mult) f0-4 f0-4 (+ 0.5 f0-4) 1.0) + ) + ) + (('eco-pill-dark) + (let ((f30-0 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-0) (lerp 0.0 0.0 f30-0) (lerp 0.0 0.3 f30-0) 1.0) + ) + ) + (('eco-pill-light) + (let ((f30-1 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 5.0 f30-1) (lerp 1.0 5.0 f30-1) (lerp 1.0 5.0 f30-1) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 2.0 f30-1) (lerp 0.0 2.0 f30-1) (lerp 0.0 2.0 f30-1) 1.0) + ) + ) + (('ammo-yellow) + (let ((f30-2 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.0 f30-2) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.0 f30-2) 1.0) + ) + ) + (('ammo-red) + (let ((f30-3 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-3) (lerp 1.0 0.6 f30-3) (lerp 1.0 0.6 f30-3) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-3) (lerp 0.0 0.0 f30-3) (lerp 0.0 0.0 f30-3) 1.0) + ) + ) + (('ammo-blue) + (let ((f30-4 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.6 f30-4) (lerp 1.0 0.8 f30-4) (lerp 1.0 1.0 f30-4) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-4) (lerp 0.0 0.1 f30-4) (lerp 0.0 0.3 f30-4) 1.0) + ) + ) + (('ammo-dark) + (let ((f30-5 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-5) (lerp 1.0 0.7 f30-5) (lerp 1.0 0.8 f30-5) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.2 f30-5) (lerp 0.0 0.0 f30-5) (lerp 0.0 0.1 f30-5) 1.0) + ) + ) + (('health 'eco-green) + (let ((f30-6 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.5 f30-6) (lerp 1.0 1.0 f30-6) (lerp 1.0 0.5 f30-6) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-6) (lerp 0.0 0.5 f30-6) (lerp 0.0 0.0 f30-6) 1.0) + ) + ) + ) + 0 + (none) + ) + +(defun target-update-segs ((arg0 process-drawable)) + (let ((f30-0 (-> *FACT-bank* health-max-default))) + (let ((s5-0 (-> *game-info* features))) + (when (!= (-> arg0 type) target) + (if (-> *setting-control* user-current beard) + (setup-masks (-> arg0 draw) 4 0) + (setup-masks (-> arg0 draw) 0 4) + ) + (setup-masks (-> arg0 draw) 32 64) + ) + (cond + ((logtest? (game-feature armor0) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 2 0) + ) + (else + (setup-masks (-> arg0 draw) 0 2) + ) + ) + (cond + ((logtest? (game-feature armor1) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 16 0) + ) + (else + (setup-masks (-> arg0 draw) 0 16) + ) + ) + (cond + ((logtest? (game-feature armor2) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 128 0) + ) + (else + (setup-masks (-> arg0 draw) 0 128) + ) + ) + (cond + ((logtest? (game-feature armor3) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 512 256) + ) + (else + (setup-masks (-> arg0 draw) 256 512) + ) + ) + ) + (if (not (-> *setting-control* user-current armor)) + (setup-masks (-> arg0 draw) 256 658) + ) + f30-0 + ) + ) + +(defbehavior target-draw-process target () + (let ((gp-0 (the-as uint (-> self game features)))) + (if (not (-> *setting-control* user-current armor)) + (set! gp-0 (logand (the-as uint #xff0fffffffffffff) (the-as game-feature gp-0))) + ) + (when (or (!= (-> self game old-features) gp-0) (not (time-elapsed? (-> self init-time) (seconds 0.5)))) + (let ((f30-0 (-> self fact health-max)) + (f0-0 (target-update-segs self)) + ) + (if (!= f30-0 f0-0) + (pickup-collectable! (-> self fact) (pickup-type health-max) (- f0-0 f30-0) (the-as handle #f)) + ) + ) + (set! (-> self game old-features) (the-as game-feature gp-0)) + ) + ) + (+! (-> self scarf-interp) (* 0.2 (- (-> self scarf-interp-targ) (-> self scarf-interp)))) + (seek! (-> self scarf-interp) (-> self scarf-interp-targ) (seconds-per-frame)) + (+! (-> self goggles-interp) (* 0.2 (- (-> self goggles-interp-targ) (-> self goggles-interp)))) + (seek! (-> self goggles-interp) (-> self goggles-interp-targ) (seconds-per-frame)) + (let ((f30-1 (-> self scarf-interp)) + (f28-0 (-> self goggles-interp)) + (f26-0 (-> self darkjak-interp)) + (f24-0 (-> self lightjak-interp)) + ) + (when (or (!= (-> self scarf-interp-old) f30-1) + (!= (-> self goggles-interp-old) f28-0) + (!= (-> self darkjak-interp-old) f26-0) + (or (!= (-> self lightjak-interp-old) f24-0) (not (time-elapsed? (-> self teleport-time) (seconds 0.6)))) + ) + (if (>= (-> self scarf-interp) 1.0) + (setup-masks (-> self draw) 64 32) + (setup-masks (-> self draw) 32 64) + ) + (cond + ((and (= f30-1 0.0) + (= f28-0 0.0) + (= f26-0 0.0) + (and (= f24-0 0.0) (not (time-elapsed? (-> self teleport-time) (seconds 0.5)))) + ) + (set! (-> self skel override 0) 0.00001) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 1.0) + (set! (-> self skel override 52) 1.0) + ) + ((and (= f30-1 0.0) (= f28-0 0.0) (= f26-0 0.0) (= f24-0 0.0)) + (set! (-> self skel override 0) 0.0) + (set! (-> self skel override 41) 0.0) + (set! (-> self scarf-interp-old) f30-1) + (set! (-> self goggles-interp-old) f28-0) + (set! (-> self darkjak-interp-old) f26-0) + (set! (-> self lightjak-interp-old) f24-0) + ) + (else + (set! (-> self skel override 0) 1.0) + (set! (-> self skel override 8) f30-1) + (set! (-> self skel override 5) f28-0) + (set! (-> self skel override 2) f26-0) + (set! (-> self skel override 6) f26-0) + (set! (-> self skel override 7) f26-0) + (set! (-> self skel override 4) f26-0) + (cond + ((!= f26-0 0.0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 2.0) + (set! (-> self skel override 52) 2.0) + ) + ((!= f24-0 0.0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 0.0) + (set! (-> self skel override 52) 0.0) + ) + (else + (set! (-> self skel override 41) 0.0) + ) + ) + (set! (-> self scarf-interp-old) f30-1) + (set! (-> self goggles-interp-old) f28-0) + (set! (-> self darkjak-interp-old) f26-0) + (set! (-> self lightjak-interp-old) f24-0) + ) + ) + ) + ) + (when (!= (-> self cloth) (-> *setting-control* user-current cloth)) + (process-drawable-show-all-cloth self (-> *setting-control* user-current cloth)) + (set! (-> self cloth) (-> *setting-control* user-current cloth)) + ) + 0 + (none) + ) + +(defbehavior target-powerup-process target () + (target-draw-process) + (let ((gp-0 (-> self ext-anim-control))) + (when (!= (-> self ext-anim) (-> self pending-ext-anim)) + (when (not (or (= (-> gp-0 status) 'initialize) (= (-> self ext-anim) (target-anim unknown)))) + (when (joint-control-cleanup (-> self skel) (-> gp-0 heap) (the-as art-joint-anim jakb-stance-loop-ja)) + (target-gun-end-mode 'fast-exit) + (set! (-> self skel float-channels) (the-as uint 0)) + (reset (-> self skel top-anim)) + ) + (send-event (ppointer->process (-> self sidekick)) 'cleanup) + (unload-from-heap *anim-manager* (-> gp-0 heap)) + (unlink-shaders-in-heap *texture-page-dir* (-> gp-0 heap)) + ) + (case (-> self pending-ext-anim) + (((target-anim default) (target-anim board) (target-anim dark) (target-anim light)) + (set-pending-file gp-0 "jak-external" (the-as int (-> self pending-ext-anim)) (process->handle self) 0.0) + ) + (else + (set-pending-file gp-0 (the-as string #f) 0 (process->handle self) 0.0) + ) + ) + ) + (if (= (-> gp-0 status) 'active) + (set! (-> self ext-anim) (the-as target-anim (-> gp-0 load-file-part))) + (set! (-> self ext-anim) (target-anim unknown)) + ) + ) + (let ((f30-0 (-> self control collision-spheres 0 prim-core world-sphere w))) + (if (focus-test? self board) + (+! (-> self control collision-spheres 0 prim-core world-sphere w) 4096.0) + ) + (water-control-method-10 (-> self water)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) f30-0) + ) + (if (and (logtest? (-> self water flags) (water-flag under-water)) + (not (logtest? (-> self water flags) (water-flag swim-ground))) + ) + (set-time! (-> self control unknown-time-frame26)) + (set-time! (-> self control unknown-time-frame27)) + ) + (cond + ((and (= (-> self control ground-pat material) (pat-material ice)) + (and (>= (-> self control ctrl-xz-vel) 204.8) + (not (time-elapsed? (-> self control last-time-on-surface) (seconds 0.05))) + ) + ) + (let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg RbigToe)))) + (if (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 159) gp-1) + ) + ) + (let ((gp-2 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg LbigToe)))) + (if (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-2 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 159) gp-2) + ) + ) + (let ((f0-10 (lerp-scale 0.8 1.0 (-> self control ctrl-xz-vel) 0.0 81920.0))) + (let ((v1-100 (ja-group))) + (if (not (and v1-100 (= v1-100 jakb-ice-stance-ja))) + (set! f0-10 (* 0.8 f0-10)) + ) + ) + (seek! (-> self control unknown-float45) f0-10 (seconds-per-frame)) + ) + (let ((f30-1 (-> self control unknown-float45)) + (f0-14 (lerp-scale -0.3 0.3 (-> self control ctrl-xz-vel) 0.0 81920.0)) + ) + (sound-play-by-name + (static-sound-name "ice-loop") + (-> self control unknown-sound-id04) + (the int (* 1024.0 f30-1)) + (the int (* 1524.0 f0-14)) + 0 + (sound-group) + (-> self control trans) + ) + ) + ) + ((< 0.0 (-> self control unknown-float45)) + (set! (-> self control unknown-float45) 0.0) + (let ((v1-121 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-121 command) (sound-command set-param)) + (set! (-> v1-121 id) (-> self control unknown-sound-id04)) + (set! (-> v1-121 params volume) -4) + (set! (-> v1-121 auto-time) 48) + (set! (-> v1-121 auto-from) 2) + (set! (-> v1-121 params mask) (the-as uint 17)) + (-> v1-121 id) + ) + ) + ) + (target-darkjak-process) + (target-lightjak-process) + (target-invisible-process) + (when (nonzero? (-> self fact trick-point-duration)) + (when (>= (- (-> *display* game-clock frame-counter) (-> self fact trick-point-start-time)) + (-> self fact trick-point-duration) + ) + (format #t "------------> ~,,f total points~%" (-> self fact trick-point)) + (send-event (handle->process (-> self notify)) 'notify 'trick-judge (-> self fact trick-point)) + (reset! (-> self fact) 'trick-judge) + ) + ) + (cond + ((logtest? (-> self game features) (game-feature feature0)) + (cond + ((< (current-time) (-> self fact stop-time-timeout)) + (set-setting! 'bg-a 'abs 0.3 0) + (set-setting! 'bg-r 'abs 1.0 0) + (update-rates! (-> *display* entity-clock) 0.0) + (if (zero? (mod (-> *display* base-clock integral-frame-counter) 60)) + (sound-play "stopwatch") + ) + ) + ((nonzero? (-> self fact stop-time-timeout)) + (remove-setting! 'bg-a) + (remove-setting! 'bg-r) + (update-rates! (-> *display* entity-clock) 1.0) + (set! (-> self fact stop-time-timeout) 0) + 0 + ) + ((cpad-pressed? (-> self control cpad number) r1) + (set! (-> self fact stop-time-timeout) (+ (current-time) (seconds 5))) + ) + ) + ) + ((logtest? (-> self game features) (game-feature feature2)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 1.0) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 60.0 (* 120.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 2.0 (* 120.0 (seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 2.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 2.0 (* 120.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 120.0 (seconds-per-frame))) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature feature4)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 1.0) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 0.3 (* 30.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 0.5 (* 30.0 (seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 1.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 1.0 (* 30.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 30.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + (target-eco-process) + (target-color-effect-process) + (if (logtest? (-> self target-effect) 7) + (logior! (-> self draw global-effect) (draw-control-global-effect no-textures)) + (logclear! (-> self draw global-effect) (draw-control-global-effect no-textures)) + ) + (if (logtest? (-> self target-effect) 56) + (logior! (-> self draw global-effect) (draw-control-global-effect rim-lights)) + (logclear! (-> self draw global-effect) (draw-control-global-effect rim-lights)) + ) + (logclear! (-> self focus-status) (focus-status super)) + (if (or (focus-test? self dead hit) + (or (logtest? (target-flags tf2 tinvuln1 tf5 tinvuln2 invisible) (-> self target-flags)) + (-> *setting-control* user-current ignore-target) + ) + ) + (logior! (-> self focus-status) (focus-status ignore)) + (logclear! (-> self focus-status) (focus-status ignore)) + ) + (cond + ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (and (focus-test? self board) (not (time-elapsed? (-> self board last-jump-time) (seconds 0.1)))) + ) + (logior! (-> self focus-status) (focus-status in-air)) + (if (logtest? (surface-flag super) (-> self control current-surface flags)) + (logior! (-> self focus-status) (focus-status super)) + ) + ) + (else + (logclear! (-> self focus-status) (focus-status in-air)) + ) + ) + (if (using-gun? self) + (logior! (-> self focus-status) (focus-status gun)) + (logclear! (-> self focus-status) (focus-status gun)) + ) + (if (or (logtest? (water-flag touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (logior! (-> self focus-status) (focus-status touch-water)) + (logclear! (-> self focus-status) (focus-status touch-water)) + ) + (if (logtest? (-> self control status) (collide-status on-water)) + (logior! (-> self focus-status) (focus-status on-water)) + (logclear! (-> self focus-status) (focus-status on-water)) + ) + (if (and (logtest? (-> self water flags) (water-flag under-water)) + (not (logtest? (-> self water flags) (water-flag swim-ground))) + ) + (logior! (-> self focus-status) (focus-status under-water)) + (logclear! (-> self focus-status) (focus-status under-water)) + ) + (if (not (time-elapsed? (-> self gun fire-time) (seconds 0.1))) + (logior! (-> self focus-status) (focus-status shooting)) + (logclear! (-> self focus-status) (focus-status shooting)) + ) + 0 + (none) + ) + +(defbehavior target-powerup-effect target ((arg0 symbol)) + (case arg0 + (('eco-blue) + (let ((v1-4 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (eco-blue-glow (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-4))) + ) + ) + ) + 0 + (none) + ) + +(defbehavior process-contact-action target ((arg0 process)) + (when (logtest? (-> *game-info* features) (game-feature feature0)) + (cond + (arg0 + (+! (-> self clock ref-count) -1) + (+! (-> arg0 clock ref-count) 1) + (set! (-> self clock) (-> arg0 clock)) + ) + (else + (+! (-> self clock ref-count) -1) + (+! (-> *display* base-clock ref-count) 1) + (set! (-> self clock) (-> *display* base-clock)) + ) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/common-obs/proc-focusable-spawner.gc b/goal_src/jak3/engine/common-obs/proc-focusable-spawner.gc index 8b407d3d4d2..40aa73a56ad 100644 --- a/goal_src/jak3/engine/common-obs/proc-focusable-spawner.gc +++ b/goal_src/jak3/engine/common-obs/proc-focusable-spawner.gc @@ -7,3 +7,162 @@ ;; DECOMP BEGINS +(deftype proc-focusable-spawn-record (structure) + "A record of a [[process-focusable]] that was created by a spawner." + ((proc handle) + (index int16) + (dead-time time-frame) + ) + ) + + +(deftype proc-focusable-spawn-record-array (inline-array-class) + ((data proc-focusable-spawn-record :inline :dynamic) + ) + ) + + +(set! (-> proc-focusable-spawn-record-array heap-base) (the-as uint 32)) + +(deftype proc-focusable-spawner (basic) + "A [[process-focusable]] spawner. Keeps track of spawned processes and cleans up inactive ones." + ((records proc-focusable-spawn-record-array) + (unused-list (array int8)) + ) + (:methods + (alloc-records! (_type_ int symbol) none) + (get-last-unused-handle! (_type_) handle) + (get-last-unused-val! (_type_) int) + (mark-unused! (_type_ handle) int) + (init-records! (_type_) none) + (add-unused! (_type_ int) none) + (check-inactive (_type_) symbol) + (reset-and-kill-all! (_type_) none) + ) + ) + + +(defmethod alloc-records! ((this proc-focusable-spawner) (count int) (allocation symbol)) + "Allocate records and unused list." + (set! (-> this records) + ((method-of-type proc-focusable-spawn-record-array new) allocation proc-focusable-spawn-record-array count) + ) + (set! (-> this unused-list) (the-as (array int8) ((method-of-type array new) allocation array int8 count))) + (init-records! this) + (none) + ) + +(defmethod relocate ((this proc-focusable-spawner) (offset int)) + (if (nonzero? (-> this records)) + (&+! (-> this records) offset) + ) + (if (nonzero? (-> this unused-list)) + (&+! (-> this unused-list) offset) + ) + (call-parent-method this offset) + ) + +(defmethod init-records! ((this proc-focusable-spawner)) + "Initialize the records list." + (dotimes (v1-0 (-> this records allocated-length)) + (set! (-> this unused-list v1-0) v1-0) + (set! (-> this records data v1-0 proc) (the-as handle #f)) + (set! (-> this records data v1-0 index) v1-0) + (set! (-> this records data v1-0 dead-time) 0) + ) + (set! (-> this unused-list length) (-> this unused-list allocated-length)) + (none) + ) + +(defmethod get-last-unused-val! ((this proc-focusable-spawner)) + "Get the last value in the unused list and decrement size." + (cond + ((<= (-> this unused-list length) 0) + -1 + ) + (else + (let ((v0-0 (-> this unused-list (+ (-> this unused-list length) -1)))) + (+! (-> this unused-list length) -1) + v0-0 + ) + ) + ) + ) + +(defmethod get-last-unused-handle! ((this proc-focusable-spawner)) + "Get the handle for the last element in the unused list and decrement the unused list size." + (local-vars (v1-6 int)) + (cond + ((<= (-> this unused-list length) 0) + (the-as handle #f) + ) + ((begin (set! v1-6 (-> this unused-list (+ (-> this unused-list length) -1))) #t) + (+! (-> this unused-list length) -1) + (-> this records data v1-6 proc) + ) + (else + (the-as handle #f) + ) + ) + ) + +(defmethod add-unused! ((this proc-focusable-spawner) (arg0 int)) + "Add the given value to the unused list." + (set! (-> this records data arg0 dead-time) (+ (current-time) (seconds 1))) + (set! (-> this unused-list (-> this unused-list length)) arg0) + (+! (-> this unused-list length) 1) + (none) + ) + +(defmethod mark-unused! ((this proc-focusable-spawner) (arg0 handle)) + "Add this handle to the unused list." + (dotimes (v1-0 (-> this records length)) + (when (= (-> this records data v1-0 proc) arg0) + (add-unused! this v1-0) + (return 0) + ) + ) + (the-as int #f) + ) + +(defmethod check-inactive ((this proc-focusable-spawner)) + "Check for inactive processes and add them to the unused list." + (local-vars (v1-10 symbol)) + (dotimes (i (-> this records length)) + (let* ((proc (handle->process (-> this records data i proc))) + (pfoc (if (type? proc process-focusable) + proc + ) + ) + ) + (when (or (not pfoc) (focus-test? (the-as process-focusable pfoc) inactive)) + (dotimes (ii (-> this unused-list length)) + (when (= (-> this unused-list ii) i) + (set! v1-10 #t) + (goto cfg-19) + ) + ) + (set! v1-10 #f) + (label cfg-19) + (if (not v1-10) + (add-unused! this i) + ) + ) + ) + ) + #f + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod reset-and-kill-all! ((this proc-focusable-spawner)) + "Reset the records list and deactivate all remaining active processes." + (dotimes (s5-0 (-> this records length)) + (let ((a0-3 (handle->process (-> this records data s5-0 proc)))) + (when a0-3 + (deactivate a0-3) + (set! (-> this records data s5-0 proc) (the-as handle #f)) + ) + ) + ) + (none) + ) diff --git a/goal_src/jak3/engine/common-obs/projectile-h.gc b/goal_src/jak3/engine/common-obs/projectile-h.gc index e3ee11c3aa2..5ebe08f7cf4 100644 --- a/goal_src/jak3/engine/common-obs/projectile-h.gc +++ b/goal_src/jak3/engine/common-obs/projectile-h.gc @@ -84,7 +84,7 @@ (sound-id sound-id) (stop-speed meters) (invinc-time time-frame) - (desired-target uint64) + (desired-target handle) (desired-target-pos vector :inline) ) (:state-methods @@ -101,11 +101,11 @@ (play-impact-sound (_type_ projectile-options) none) (projectile-method-29 (_type_) none) (setup-collision! (_type_) none) - (projectile-method-31 (_type_) none) + (init-proj-settings! (_type_) none) (projectile-method-32 (_type_) none) (go-impact! (_type_) none) (projectile-method-34 (_type_) none) - (event-handler! (_type_ process int symbol event-message-block) object) + (proj-event-handler (_type_ process int symbol event-message-block) object) (handle-proj-hit! (_type_ process event-message-block) object) (deal-damage! (_type_ process event-message-block) symbol) (made-impact? (_type_) symbol) @@ -119,7 +119,7 @@ ((pos vector :inline) (vel vector :inline) (target-pos vector :inline) - (target-handle uint64) + (target-handle handle) (ent entity) (charge float) (attack-id uint32) diff --git a/goal_src/jak3/engine/common-obs/projectile.gc b/goal_src/jak3/engine/common-obs/projectile.gc index f80ebd17980..7fdab32bf61 100644 --- a/goal_src/jak3/engine/common-obs/projectile.gc +++ b/goal_src/jak3/engine/common-obs/projectile.gc @@ -23,7 +23,7 @@ (none) ) -(defmethod event-handler! ((this projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +(defmethod proj-event-handler ((this projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('tracked) (let ((v0-0 (the-as object (process->handle (the-as process (-> arg3 param 0)))))) @@ -42,7 +42,7 @@ ;; WARN: Return type mismatch object vs projectile. (defbehavior projectile-event-handler projectile ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (the-as projectile (event-handler! self arg0 arg1 arg2 arg3)) + (the-as projectile (proj-event-handler self arg0 arg1 arg2 arg3)) ) ;; WARN: Return type mismatch object vs symbol. @@ -368,7 +368,7 @@ ) ) -(defmethod projectile-method-31 ((this projectile)) +(defmethod init-proj-settings! ((this projectile)) 0 (none) ) @@ -496,7 +496,7 @@ ) (set! (-> self target-pos quad) (-> self base-target-pos quad)) (set! (-> self event-hook) projectile-event-handler) - (projectile-method-31 self) + (init-proj-settings! self) (update-transforms (-> self root)) (projectile-method-24 self) (play-impact-sound self (projectile-options)) @@ -663,7 +663,7 @@ (none) ) -(defmethod projectile-method-31 ((this projectile-bounce)) +(defmethod init-proj-settings! ((this projectile-bounce)) (set! (-> this max-speed) 450560.0) (set! (-> this timeout) (seconds 1.6)) (set! (-> this update-velocity) projectile-bounce-update-velocity) diff --git a/goal_src/jak3/engine/common-obs/ragdoll-test.gc b/goal_src/jak3/engine/common-obs/ragdoll-test.gc index 6700cb5197b..e368f85bcbd 100644 --- a/goal_src/jak3/engine/common-obs/ragdoll-test.gc +++ b/goal_src/jak3/engine/common-obs/ragdoll-test.gc @@ -7,3 +7,341 @@ ;; DECOMP BEGINS +;; this file is debug only +(declare-file (debug)) + +(defskelgroup skel-ragdoll-test wlander-male wlander-male-lod0-jg wlander-male-ragdoll-ja + ((wlander-male-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + ) + +(define *ragdoll-test-ragdoll-setup* (new 'static 'ragdoll-setup + :scale (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :bg-collide-with (collide-spec backgnd player-list) + :joint-setup (new 'static 'boxed-array :type ragdoll-joint-setup + (new 'static 'ragdoll-joint-setup :joint-index 3 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 4 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 5 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 6 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 7 :parent-joint 4) + (new 'static 'ragdoll-joint-setup :joint-index 8 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 9 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 10 :parent-joint 4) + (new 'static 'ragdoll-joint-setup :joint-index 11 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 12 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 13 :parent-joint 3) + (new 'static 'ragdoll-joint-setup :joint-index 14 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 15 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 16 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 17 :parent-joint 13) + (new 'static 'ragdoll-joint-setup :joint-index 18 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 19 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 20 :parent-joint 2) + (new 'static 'ragdoll-joint-setup :joint-index 21 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 22 :parent-joint 12) + (new 'static 'ragdoll-joint-setup :joint-index 23 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 24 :parent-joint 12) + (new 'static 'ragdoll-joint-setup :joint-index 25 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 26 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 27 :parent-joint 16) + (new 'static 'ragdoll-joint-setup :joint-index 28 :parent-joint 19) + ) + ) + ) + +(deftype ragdoll-test (process-focusable) + ((ragdoll-proc handle) + ) + (:state-methods + reform + tweak + freefall-reform + freefall + idle + ) + ) + + +(defstate reform (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (cond + ((!= *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + :trans (behavior () + (ja :num! (loop!)) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (if (nonzero? *ragdoll-edit-info*) + (ragdoll-proc-method-18 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + ) + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + (let ((v1-14 (-> (the-as ragdoll-proc gp-0) ragdoll))) + (if (or (zero? v1-14) (= (-> v1-14 flex-blend) 0.0)) + (go-virtual idle) + ) + ) + ) + ) + (format *stdcon* "~%press r2 to advance single-step~%") + ) + :code sleep-code + :post transform-post + ) + +(defstate tweak (ragdoll-test) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (let ((v1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-1 from) (process->ppointer proc)) + (set! (-> v1-1 num-params) argc) + (set! (-> v1-1 message) message) + (set! (-> v1-1 param 0) (-> block param 0)) + (set! (-> v1-1 param 1) (-> block param 1)) + (set! (-> v1-1 param 2) (-> block param 2)) + (set! (-> v1-1 param 3) (-> block param 3)) + (set! (-> v1-1 param 4) (-> block param 4)) + (set! (-> v1-1 param 5) (-> block param 5)) + (send-event-function (handle->process (-> self ragdoll-proc)) v1-1) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (ragdoll-proc-method-15 (the-as ragdoll-proc a0-1) #f (the-as vector #f) #t) + ) + ) + (vector-reset! (-> self root transv)) + ) + :exit (behavior () + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.25)) + ) + ) + (if (= *external-cam-mode* 'locked) + (set! *external-cam-mode* 'pad-0) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) 1) (cpad-pressed? 0 r3)) + (go-virtual reform) + ) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (when (nonzero? *ragdoll-edit-info*) + (ragdoll-proc-method-18 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + (if (-> (the-as ragdoll-proc gp-0) ragdoll) + (logclear! (-> (the-as ragdoll-proc gp-0) ragdoll ragdoll-flags) (ragdoll-flag rf2)) + ) + ) + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + ) + ) + ) + :code sleep-code + :post transform-post + ) + +(defstate freefall-reform (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (ja :num! (loop!)) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) (the-as ragdoll-edit-info 0)) + (let ((v1-9 (-> (the-as ragdoll-proc gp-0) ragdoll))) + (if (or (zero? v1-9) (= (-> v1-9 flex-blend) 0.0)) + (go-virtual idle) + ) + ) + ) + ) + ) + :code sleep-code + :post transform-post + ) + +(defstate freefall (ragdoll-test) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (let ((v1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-1 from) (process->ppointer proc)) + (set! (-> v1-1 num-params) argc) + (set! (-> v1-1 message) message) + (set! (-> v1-1 param 0) (-> block param 0)) + (set! (-> v1-1 param 1) (-> block param 1)) + (set! (-> v1-1 param 2) (-> block param 2)) + (set! (-> v1-1 param 3) (-> block param 3)) + (set! (-> v1-1 param 4) (-> block param 4)) + (set! (-> v1-1 param 5) (-> block param 5)) + (send-event-function (handle->process (-> self ragdoll-proc)) v1-1) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (ragdoll-proc-method-15 (the-as ragdoll-proc a0-1) #f (the-as vector #f) #t) + ) + ) + (vector-reset! (-> self root transv)) + ) + :exit (behavior () + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.25)) + ) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) 1) (cpad-pressed? 0 triangle)) + (go-virtual freefall-reform) + ) + (let ((a0-7 (handle->process (-> self ragdoll-proc)))) + (if a0-7 + (ragdoll-proc-method-17 (the-as ragdoll-proc a0-7) (the-as ragdoll-edit-info 0)) + ) + ) + (format *stdcon* "press triangle to edit ragdoll~%") + ) + :code sleep-code + :post transform-post + ) + +(defstate idle (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (cond + ((not (time-elapsed? (-> self state-time) 1)) + ) + (else + (format *stdcon* "up: reinit ragdoll~%") + (format *stdcon* "l2: reset position~%") + (format *stdcon* "rpush: edit ragdoll~%") + (format *stdcon* "triangle: run ragdoll~%") + (if (= (-> self node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) + (format *stdcon* "x: stop mirroring~%") + (format *stdcon* "x: mirror~%") + ) + (when (cpad-pressed? 0 up) + (let ((v1-13 (handle->process (-> self ragdoll-proc)))) + (when v1-13 + (if (nonzero? (-> (the-as ragdoll-proc v1-13) ragdoll)) + (ragdoll-setup! (-> (the-as ragdoll-proc v1-13) ragdoll) self *ragdoll-test-ragdoll-setup*) + ) + ) + ) + ) + (when (cpad-pressed? 0 l2) + (cond + ((-> self entity) + (set! (-> self root trans quad) (-> self entity trans quad)) + ) + (else + (vector-reset! (-> self root trans)) + (set! (-> self root trans y) -163840.0) + ) + ) + (quaternion-identity! (-> self root quat)) + ) + (if (cpad-pressed? 0 r3) + (go-virtual tweak) + ) + (if (cpad-pressed? 0 triangle) + (go-virtual freefall) + ) + (when (cpad-pressed? 0 x) + (cond + ((= (-> self node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) + (let ((v1-54 (-> self node-list data 2))) + (set! (-> v1-54 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint!)) + (set! (-> v1-54 param1) #f) + (set! (-> v1-54 param2) #f) + ) + ) + (else + (let ((v1-56 (-> self node-list data 2))) + (set! (-> v1-56 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) + (set! (-> v1-56 param1) #f) + (set! (-> v1-56 param2) #f) + ) + ) + ) + ) + (set! (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat)) trans quad) + (-> self root trans quad) + ) + ) + ) + (ja :num! (loop!)) + ) + :code sleep-code + :post transform-post + ) + +(defbehavior ragdoll-test-init-by-other ragdoll-test ((arg0 ragdoll-setup) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s5-0 event-self) 'touched) + (set! (-> self root) s5-0) + ) + (set! (-> self root trans quad) (-> arg0 orient-tform quad)) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-ragdoll-test" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (logior! (-> self mask) (process-mask enemy)) + (set! (-> self ragdoll-proc) + (ppointer->handle + (process-spawn ragdoll-proc *ragdoll-test-ragdoll-setup* :name "ragdoll-proc" :to self :stack-size #x5000) + ) + ) + (go-virtual idle) + ) diff --git a/goal_src/jak3/engine/common-obs/scene-actor.gc b/goal_src/jak3/engine/common-obs/scene-actor.gc index df14361fa95..9a132ef4be6 100644 --- a/goal_src/jak3/engine/common-obs/scene-actor.gc +++ b/goal_src/jak3/engine/common-obs/scene-actor.gc @@ -7,3 +7,1641 @@ ;; DECOMP BEGINS +(defskelgroup skel-scenecamera scenecamera scenecamera-lod0-jg -1 + ((scenecamera-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :texture-level 10 + ) + +(defskelgroup skel-particleman particleman particleman-lod0-jg -1 + ((particleman-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :shadow-joint-index 3 + ) + +(defskelgroup skel-darkjak-highres darkjak-highres darkjak-highres-lod0-jg -1 + ((darkjak-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3.2) + :longest-edge (meters 1) + :shadow-joint-index 3 + :light-index 1 + :clothing (((mesh darkjak-highres-jakcfma0-skirt-cg) + (gravity-constant (meters 16)) + (wind-constant 0.5) + (cloth-width 13) + (flags (cloth-flag use-wind double-sided)) + (tex-name "jakc-skirt") + (tex-name2 "jakc-skirt") + (tex-name3 "jakc-skirt") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (ball-collision-radius (meters 0.05)) + (num-iterations 1) + (timestep-frequency 7) + ) + ((mesh darkjak-highres-jakcfma0-sash-cg) + (gravity-constant (meters 32)) + (wind-constant 0.75) + (cloth-width 6) + (flags (cloth-flag use-wind double-sided)) + (tex-name "jakc-skirt") + (tex-name2 "jakc-skirt") + (tex-name3 "jakc-skirt") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.251) + (ball-collision-radius (meters 0.05)) + (num-iterations 1) + (timestep-frequency 7) + ) + ((mesh darkjak-highres-jakcfma0-scarf-cg) + (gravity-constant (meters 16)) + (wind-constant 1.25) + (cloth-width 6) + (flags (cloth-flag use-wind double-sided)) + (tex-name "jakc-scarfhanging") + (tex-name2 "jakc-scarfhanging") + (tex-name3 "jakc-scarfhanging") + (cloth-thickness 2.0) + (initial-xform 4) + (drag 0.151) + (ball-collision-radius (meters 0.05)) + (num-iterations 1) + (timestep-frequency 7) + ) + ) + ) + +(defskelgroup skel-pecker-highres pecker-highres pecker-highres-lod0-jg pecker-highres-idle-ja + ((pecker-highres-lod0-mg (meters 200))) + :bounds (static-spherem 0 0 0 5) + :shadow pecker-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(deftype pecker-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this pecker-npc)) + (-> this draw art-group data 3) + ) + +(defmethod init-skeleton! ((this pecker-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-pecker-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-veger-highres veger-highres veger-highres-lod0-jg veger-highres-idle-ja + ((veger-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow veger-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + :clothing (((mesh veger-highres-veger-coatL-cg) + (gravity-constant (meters 36)) + (wind-constant 1.0) + (cloth-width 10) + (flags (cloth-flag use-wind double-sided)) + (tex-name "veger-coat") + (tex-name2 "veger-coat") + (tex-name3 "veger-coat") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.051) + (num-iterations 1) + ) + ((mesh veger-highres-veger-coatR-cg) + (gravity-constant (meters 36)) + (wind-constant 1.0) + (cloth-width 10) + (flags (cloth-flag use-wind double-sided)) + (tex-name "veger-coat") + (tex-name2 "veger-coat") + (tex-name3 "veger-coat") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.051) + (num-iterations 1) + ) + ) + ) + +(deftype veger-npc (process-taskable) + () + ) + + +(defmethod init-skeleton! ((this veger-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-veger-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod get-art-element ((this veger-npc)) + (case (-> this task actor) + (((game-task-actor veger-cave)) + (logior! (-> this draw status) (draw-control-status no-draw-bounds)) + (let ((v1-7 (-> this root root-prim))) + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + ) + 0 + ) + ) + (-> this draw art-group data 5) + ) + +(defskelgroup skel-ashelin-highres ashelin-highres ashelin-highres-lod0-jg ashelin-highres-idle-stand-ja + ((ashelin-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + :shadow ashelin-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(deftype ashelin-npc (process-taskable) + () + ) + + +(defmethod init-skeleton! ((this ashelin-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-ashelin-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod get-art-element ((this ashelin-npc)) + (case (-> this task actor) + (((game-task-actor ashelin-oasis)) + ) + ) + (-> this draw art-group data 4) + ) + +(defskelgroup skel-damus-highres king-highres king-highres-lod0-jg king-highres-idle-ja + ((king-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow king-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + :clothing (((mesh king-highres-king-kingskirt-cg) + (gravity-constant (meters 12)) + (cloth-width 13) + (flags (cloth-flag use-wind double-sided flip-normals)) + (tex-name "king-skirt-b") + (tex-name2 "king-skirt-b") + (tex-name3 "king-skirt-b") + (cloth-thickness 1.3) + (initial-xform 3) + (drag 0.051) + (num-iterations 1) + ) + ) + ) + +(deftype damus-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this damus-npc)) + (case (-> this task actor) + (((game-task-actor damus-wasdoors)) + (-> this draw art-group data 9) + ) + (else + (let ((v1-6 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-6 (= v1-6 (-> this draw art-group data 4))) + (-> this draw art-group data 5) + ) + ((let ((v1-14 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-14 (= v1-14 (-> this draw art-group data 5))) + ) + (if (= (the int (ja-aframe-num 0)) 14) + (-> this draw art-group data 6) + (-> this draw art-group data 5) + ) + ) + ((let ((v1-25 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-25 (= v1-25 (-> this draw art-group data 6))) + ) + (if (and (= (the int (ja-aframe-num 0)) 44) (rand-vu-percent? 0.1)) + (-> this draw art-group data 7) + (-> this draw art-group data 6) + ) + ) + ((let ((v1-38 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-38 (= v1-38 (-> this draw art-group data 7))) + ) + (if (= (the int (ja-aframe-num 0)) 54) + (-> this draw art-group data 8) + (-> this draw art-group data 7) + ) + ) + ((let ((v1-49 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-49 (= v1-49 (-> this draw art-group data 8))) + ) + (if (and (= (the int (ja-aframe-num 0)) 84) (rand-vu-percent? 0.1)) + (-> this draw art-group data 5) + (-> this draw art-group data 8) + ) + ) + ) + ) + ) + ) + ) + +(defmethod init-skeleton! ((this damus-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-damus-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-crimson-guard-highres crimson-guard-highres crimson-guard-highres-lod0-jg -1 + ((crimson-guard-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow crimson-guard-highres-shadow-mg + :shadow-joint-index 3 + ) + +(defskelgroup skel-torn-highres torn-highres torn-highres-lod0-jg torn-highres-idle-ja + ((torn-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow torn-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(deftype torn-npc (process-taskable) + () + ) + + +(defmethod init-skeleton! ((this torn-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-torn-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod get-art-element ((this torn-npc)) + (case (-> this task actor) + (((game-task-actor torn-freehq)) + (-> this draw art-group data 4) + ) + (((game-task-actor torn-hiptable)) + (-> this draw art-group data 4) + ) + (((game-task-actor torn-hipbar)) + (-> this draw art-group data 6) + ) + (((game-task-actor torn-hipbooth)) + (-> this draw art-group data 5) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod get-trans ((this torn-npc) (arg0 int)) + "Get the `trans` for this process." + (let ((v1-0 (-> this root))) + (if (= arg0 2) + (vector<-cspace! (new 'static 'vector) (-> this node-list data 6)) + (-> v1-0 trans) + ) + ) + ) + +(defskelgroup skel-samos-highres samos-highres samos-highres-lod0-jg samos-highres-idle-ja + ((samos-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + :shadow samos-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(deftype samos-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this samos-npc)) + (case (-> this task actor) + (((game-task-actor samos-genb)) + (-> this draw art-group data 4) + ) + (((game-task-actor samos-freehq)) + (-> this draw art-group data 4) + ) + (else + (-> this draw art-group data 4) + ) + ) + ) + +(defmethod init-skeleton! ((this samos-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-samos-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-palmpilot palmpilot palmpilot-lod0-jg -1 + ((palmpilot-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + :shadow-joint-index 3 + ) + +(defskelgroup skel-palmpilot-b palmpilot-b palmpilot-b-lod0-jg -1 + ((palmpilot-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + :shadow-joint-index 3 + ) + +(defskelgroup skel-sig-highres sig-highres sig-highres-lod0-jg sig-highres-idle-ja + ((sig-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 5) + :shadow sig-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 17 + ) + +(deftype sig-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this sig-npc)) + (case (-> this task actor) + (((game-task-actor sig-wasdoors)) + (-> this draw art-group data 4) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod init-skeleton! ((this sig-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-sig-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-kleever-highres kleever-highres kleever-highres-lod0-jg kleever-highres-idle-ja + ((kleever-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow kleever-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + :clothing (((mesh kleever-highres-kleever-L1-cg) + (gravity-constant (meters 24)) + (wind-constant 0.5) + (cloth-width 3) + (flags (cloth-flag use-wind double-sided)) + (tex-name "klever-skirtlight") + (tex-name2 "klever-skirtlight") + (tex-name3 "klever-skirtlight") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + (secret-disable (game-secrets scene-player-1 scene-player-3)) + ) + ((mesh kleever-highres-kleever-R1-cg) + (gravity-constant (meters 24)) + (wind-constant 0.5) + (cloth-width 3) + (flags (cloth-flag use-wind double-sided)) + (tex-name "klever-skirtlight") + (tex-name2 "klever-skirtlight") + (tex-name3 "klever-skirtlight") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + (secret-disable (game-secrets scene-player-1 scene-player-3)) + ) + ((mesh kleever-highres-kleever-Center-cg) + (gravity-constant (meters 24)) + (wind-constant 0.5) + (cloth-width 11) + (flags (cloth-flag use-wind double-sided)) + (tex-name "klever-skirtdark") + (tex-name2 "klever-skirtdark") + (tex-name3 "klever-skirtdark") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + (secret-disable (game-secrets scene-player-1 scene-player-3)) + ) + ((mesh kleever-highres-kleever-L2-cg) + (gravity-constant (meters 12)) + (wind-constant 1.0) + (cloth-width 4) + (flags (cloth-flag use-wind double-sided)) + (tex-name "klever-skirtlight") + (tex-name2 "klever-skirtlight") + (tex-name3 "klever-skirtlight") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + (secret-disable (game-secrets scene-player-1 scene-player-3)) + ) + ((mesh kleever-highres-kleever-R2-cg) + (gravity-constant (meters 12)) + (wind-constant 1.0) + (cloth-width 4) + (flags (cloth-flag use-wind double-sided)) + (tex-name "klever-skirtlight") + (tex-name2 "klever-skirtlight") + (tex-name3 "klever-skirtlight") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + (secret-disable (game-secrets scene-player-1 scene-player-3)) + ) + ) + ) + +(deftype kleever-npc (process-taskable) + ((cloth basic) + ) + ) + + +(defmethod init-collision! ((this kleever-npc)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 6) 0))) + (set! (-> s5-0 total-prims) (the-as uint 7)) + (set! (-> s4-0 prim-core collide-as) (collide-spec civilian)) + (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 -1024.0 0.0 9011.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set! (-> v1-7 transform-index) 0) + (set-vector! (-> v1-7 local-sphere) 0.0 -4096.0 0.0 4096.0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 0) + (set-vector! (-> v1-9 local-sphere) 0.0 -1024.0 0.0 4096.0) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-11 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-11 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-11 transform-index) 0) + (set-vector! (-> v1-11 local-sphere) 0.0 2048.0 0.0 4096.0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set! (-> v1-13 transform-index) 0) + (set-vector! (-> v1-13 local-sphere) 6144.0 -4096.0 1638.4 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set! (-> v1-15 transform-index) 0) + (set-vector! (-> v1-15 local-sphere) 6144.0 -1024.0 1638.4 819.2) + ) + (let ((v1-17 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-17 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-17 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-17 transform-index) 0) + (set-vector! (-> v1-17 local-sphere) 6144.0 2048.0 1638.4 819.2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-20 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-20 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-20 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod get-art-element ((this kleever-npc)) + (case (-> this task actor) + (((game-task-actor kleever-arena)) + (-> this draw art-group data 9) + ) + (else + (let ((v1-6 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-6 (= v1-6 (-> this draw art-group data 8))) + (-> this draw art-group data 10) + ) + ((let ((v1-14 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-14 (= v1-14 (-> this draw art-group data 10))) + ) + (if (and (= (the int (ja-aframe-num 0)) 59) (rand-vu-percent? 0.1)) + (-> this draw art-group data 11) + (-> this draw art-group data 10) + ) + ) + ((let ((v1-27 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-27 (= v1-27 (-> this draw art-group data 11))) + ) + (if (= (the int (ja-aframe-num 0)) 74) + (-> this draw art-group data 12) + (-> this draw art-group data 11) + ) + ) + ((let ((v1-38 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-38 (= v1-38 (-> this draw art-group data 12))) + ) + (if (and (= (the int (ja-aframe-num 0)) 127) (rand-vu-percent? 0.1)) + (-> this draw art-group data 13) + (-> this draw art-group data 12) + ) + ) + ((let ((v1-51 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (and v1-51 (= v1-51 (-> this draw art-group data 13))) + ) + (if (= (the int (ja-aframe-num 0)) 139) + (-> this draw art-group data 10) + (-> this draw art-group data 13) + ) + ) + ) + ) + ) + ) + ) + +(defmethod init-skeleton! ((this kleever-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-kleever-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + (set! (-> this cloth) (the-as basic #t)) + 0 + (none) + ) + +(defskelgroup skel-seem-highres seem-highres seem-highres-lod0-jg seem-highres-idle-ja + ((seem-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow seem-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + :clothing (((mesh seem-highres-seem-seemskirt_fr-cg) + (gravity-constant (meters 20)) + (wind-constant 1.0) + (cloth-width 21) + (flags (cloth-flag double-sided wraps autogen-uvs use-old-resets)) + (tex-name "seem-skirt") + (tex-name2 "seem-skirt") + (tex-name3 "seem-skirt") + (initial-xform 3) + (drag 0.301) + (num-iterations 3) + (timestep-frequency 7) + ) + ) + ) + +(deftype seem-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this seem-npc)) + (case (-> this task actor) + (((game-task-actor seem-wascity)) + (-> this draw art-group data 5) + ) + (((game-task-actor seem-leaper)) + (-> this draw art-group data 7) + ) + (else + (-> this draw art-group data 4) + ) + ) + ) + +(defmethod init-skeleton! ((this seem-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-seem-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod init-defaults! ((this seem-npc)) + (let ((t9-0 (method-of-type process-taskable init-defaults!))) + (t9-0 this) + ) + (case (-> this task actor) + (((game-task-actor seem-wascity)) + (logior! (-> this flags) (process-taskable-flags ptf6)) + ) + ) + 0 + (none) + ) + +(defskelgroup skel-onin-highres onin-highres onin-highres-lod0-jg onin-highres-idle-ja + ((onin-highres-lod0-mg (meters 200))) + :bounds (static-spherem 0 0 0 3) + :shadow onin-highres-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) + +(deftype onin-npc (process-taskable) + () + ) + + +(defmethod init-skeleton! ((this onin-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-onin-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod get-art-element ((this onin-npc)) + (case (-> this task actor) + (((game-task-actor onin-onintent)) + ) + ) + (-> this draw art-group data 4) + ) + +(defskelgroup skel-jinx-highres jinx-highres jinx-highres-lod0-jg jinx-highres-idle-ja + ((jinx-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow-joint-index 3 + ) + +(deftype jinx-npc (process-taskable) + () + ) + + +(defmethod init-skeleton! ((this jinx-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-jinx-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defmethod get-art-element ((this jinx-npc)) + (case (-> this task actor) + (((game-task-actor jinx-hiphog)) + (-> this draw art-group data 3) + ) + (else + (-> this draw art-group data 2) + ) + ) + ) + +(defskelgroup skel-gun-npc gun-npc gun-npc-lod0-jg -1 + ((gun-npc-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + :shadow gun-npc-shadow-mg + :shadow-joint-index 3 + ) + +(deftype gun-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this gun-npc)) + (case (-> this task actor) + (((game-task-actor gun-gungame)) + (cond + ((task-node-closed? (game-task-node city-port-assault-resolution)) + (-> this draw art-group data 3) + ) + ((task-node-closed? (game-task-node city-gun-course-1-introduction)) + (-> this draw art-group data 4) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod init-skeleton! ((this gun-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-gun-npc" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-tess-highres tess-highres tess-highres-lod0-jg tess-highres-idle-ja + ((tess-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow tess-highres-shadow-mg + :shadow-joint-index 3 + ) + +(deftype tess-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this tess-npc)) + (case (-> this task actor) + (((game-task-actor tess-gungame)) + (cond + ((task-node-closed? (game-task-node city-gun-course-2-resolution)) + (-> this draw art-group data 7) + ) + ((task-node-closed? (game-task-node city-gun-course-2-introduction)) + (-> this draw art-group data 5) + ) + ((task-node-closed? (game-task-node city-port-assault-resolution)) + (-> this draw art-group data 5) + ) + ((task-node-closed? (game-task-node city-gun-course-1-resolution)) + (-> this draw art-group data 7) + ) + ((task-node-closed? (game-task-node city-gun-course-1-introduction)) + (-> this draw art-group data 6) + ) + (else + (-> this draw art-group data 5) + ) + ) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod init-skeleton! ((this tess-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-tess-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-wlander-male wlander-male wlander-male-lod0-jg -1 + ((wlander-male-lod0-mg (meters 20)) (wlander-male-lod2-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow wlander-male-shadow-mg + :shadow-joint-index 3 + ) + +(deftype vin-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this vin-npc)) + (-> this draw art-group data 5) + ) + +(defmethod init-skeleton! ((this vin-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (logior! (-> this draw status) (draw-control-status no-draw-bounds2)) + 0 + (none) + ) + +(defskelgroup skel-eco-crystal-dark eco-crystal-dark eco-crystal-dark-lod0-jg eco-crystal-dark-idle-ja + ((eco-crystal-dark-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 0.5) + :shadow-joint-index 3 + ) + +(defskelgroup skel-keira-highres keira-highres keira-highres-lod0-jg keira-highres-idle-ja + ((keira-highres-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 3) + :shadow keira-highres-shadow-mg + :origin-joint-index 4 + :shadow-joint-index 3 + ) + +(deftype keira-npc (process-taskable) + () + ) + + +(defmethod get-art-element ((this keira-npc)) + (case (-> this task actor) + (((game-task-actor keira-freehq)) + (-> this draw art-group data 3) + ) + (((game-task-actor keira-genb)) + (-> this draw art-group data 3) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod init-skeleton! ((this keira-npc)) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-keira-highres" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this draw light-index) (the-as uint 30)) + 0 + (none) + ) + +(defskelgroup skel-hellcat-movie hellcat hellcat-lod0-jg hellcat-idle-ja + ((hellcat-lod0-mg (meters 20)) (hellcat-lod0-mg (meters 40)) (hellcat-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 6.8) + :shadow hellcat-shadow-mg + :shadow-joint-index 3 + ) + +(defskelgroup skel-kidmedallion kidmedallion kidmedallion-lod0-jg kidmedallion-idle-ja + ((kidmedallion-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1) + :shadow-joint-index 3 + ) + +(defun pre-intro-play () + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) (-> *setting-control* user-default border-mode)) + (process-spawn + scene-player + :init scene-player-init + '("intro-drop" "intro-lost" "intro-ffhq" "intro-tired" "intro-palace" "intro-rescue") + #t + "wasintro-start" + :name "scene-player" + ) + 0 + (none) + ) + +(defun intro-play () + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) (-> *setting-control* user-default border-mode)) + (process-spawn + scene-player + :init scene-player-init + '("intro-training" "arena-training-1-intro") + #t + "waspala-intro-training" + :name "scene-player" + ) + 0 + (none) + ) + +(defun outro-play () + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) (-> *setting-control* user-default border-mode)) + (process-spawn scene-player :init scene-player-init "arena-outro" #t "wasstada-outro" :name "scene-player") + 0 + (none) + ) + +;; og:preserve-this +;; for some inexplicable reason, there is a lambda at the top level with skelgroups and a type definition +;; we just get rid of that and move everything to the top level +(defskelgroup skel-flut-wild flut-wild flut-wild-lod0-jg flut-wild-idle-ja + ((flut-wild-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 4) + :shadow flut-wild-shadow-mg + :shadow-joint-index 3 + :light-index 1 + ) + +(deftype flut-npc (process-taskable) + () + ) + +(defmethod inspect ((this flut-npc)) + (when (not this) + (set! this this) + (return this) + ) + ((method-of-type process-taskable inspect) this) + this + ) + +(defmethod get-art-element ((this flut-npc)) + (case (-> this task actor) + (((game-task-actor wascity-leaper)) + (-> this draw art-group data 12) + ) + (else + (-> this draw art-group data 3) + ) + ) + ) + +(defmethod init-skeleton! ((this flut-npc)) + (initialize-skeleton + this + (the skeleton-group (art-group-get-by-name *level* "skel-flut-wild" (the (pointer level) #f))) + (the pair 0) + ) + (set! (-> this draw light-index) (the uint 30)) + (none) + ) + +(defskelgroup skel-mhcity-de-tower-egg mhcity-de-tower-egg mhcity-de-tower-egg-lod0-jg mhcity-de-tower-egg-idle-ja + ((mhcity-de-tower-egg-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :shadow-joint-index 3 + ) +(defskelgroup skel-errol-effect errol-effect errol-effect-lod0-jg errol-effect-idle-ja + ((errol-effect-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + :shadow-joint-index 3 + ) +(defskelgroup skel-errol errol errol-lod0-jg errol-idle-ja + ((errol-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + :shadow-joint-index 6 + ) +(defskelgroup skel-snake-wheel-fma snake-wheel-fma snake-wheel-fma-lod0-jg snake-wheel-fma-idle-ja + ((snake-wheel-fma-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :shadow snake-wheel-fma-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) +(defskelgroup skel-ottsel-veger ottsel-veger ottsel-veger-lod0-jg ottsel-veger-idle-ja + ((ottsel-veger-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow ottsel-veger-shadow-mg + :shadow-joint-index 3 + ) +(defskelgroup skel-ottsel-surfer ottsel-surfer ottsel-surfer-lod0-jg ottsel-surfer-idle-ja + ((ottsel-surfer-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow ottsel-surfer-shadow-mg + :shadow-joint-index 3 + ) +(defskelgroup skel-ottsel-leader ottsel-leader ottsel-leader-lod0-jg ottsel-leader-idle-ja + ((ottsel-leader-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow ottsel-leader-shadow-mg + :shadow-joint-index 3 + :clothing (((mesh ottsel-leader-leader-leaderskirt_fr-cg) + (gravity-constant (meters 12)) + (wind-constant 1.0) + (cloth-width 13) + (flags (cloth-flag use-wind double-sided flip-normals autogen-uvs)) + (tex-name "prec-leader-robe-01") + (tex-name2 "prec-leader-robe-01") + (tex-name3 "prec-leader-robe-01") + (cloth-thickness 1.0) + (initial-xform 3) + (drag 0.151) + (num-iterations 1) + (timestep-frequency 7) + ) + ) + ) +(defskelgroup skel-battle-amulet battle-amulet battle-amulet-lod0-jg battle-amulet-idle-ja + ((battle-amulet-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + :shadow-joint-index 3 + ) +(defskelgroup skel-precursor precursor precursor-lod0-jg precursor-idle-ja + ((precursor-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8.5) + :shadow-joint-index 3 + ) +(defskelgroup skel-comb-rail-rider-fma comb-rail-rider comb-rail-rider-lod0-jg comb-rail-rider-idle-ja + ((comb-rail-rider-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10.5) + :shadow-joint-index 3 + ) +(defskelgroup skel-monk monk monk-lod0-jg monk-idle-ja + ((monk-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow monk-shadow-mg + :origin-joint-index 3 + :shadow-joint-index 3 + ) +(defskelgroup skel-terraformer-fma terraformer-fma 0 2 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 4) + :shadow-joint-index 3 + ) +(defskelgroup skel-rhino-fma rhino rhino-lod0-jg rhino-idle-ja + ((rhino-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 100) + :shadow-joint-index 3 + ) +(defskelgroup skel-neo-satellite-fma neo-satellite-fma neo-satellite-fma-lod0-jg neo-satellite-fma-idle-ja + ((neo-satellite-fma-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :shadow neo-satellite-fma-shadow-mg + :shadow-joint-index 3 + :global-effects 32 + ) +(defskelgroup skel-neo-satellite-break neo-satellite-break neo-satellite-break-lod0-jg neo-satellite-break-idle-ja + ((neo-satellite-break-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + :shadow-joint-index 3 + :global-effects 32 + ) +(defskelgroup skel-talk-box talk-box talk-box-lod0-jg talk-box-idle-ja + ((talk-box-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + :shadow-joint-index 3 + ) + +;; og:preserve-this +;; ((lambda () +;; (let ((a0-0 +;; (new 'static 'skeleton-group +;; :name "skel-flut-wild" +;; :extra #f +;; :info #f +;; :art-group-name "flut-wild" +;; :bounds (new 'static 'vector :y 8192.0 :w 16384.0) +;; :version 8 +;; :shadow 2 +;; :origin-joint-index 3 +;; :sort 1 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-0 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-0 clothing length) (-> a0-0 clothing allocated-length)) +;; ) +;; (set! (-> a0-0 jgeo) 0) +;; (set! (-> a0-0 janim) 3) +;; (set! (-> a0-0 mgeo 0) 1) +;; (set! (-> a0-0 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-0) +;; ) +;; (type-new 'flut-npc process-taskable (the-as int (the-as uint #x2800a00118))) +;; (method-set! flut-npc 3 (lambda ((arg0 flut-npc)) +;; (when (not arg0) +;; (set! arg0 arg0) +;; (goto cfg-4) +;; ) +;; (let ((t9-0 (method-of-type process-taskable inspect))) +;; (t9-0 arg0) +;; ) +;; (label cfg-4) +;; arg0 +;; ) +;; ) +;; (method-set! flut-npc 37 (lambda ((arg0 flut-npc)) (case (-> arg0 task actor) +;; (((game-task-actor wascity-leaper)) +;; (-> arg0 draw art-group data 12) +;; ) +;; (else +;; (-> arg0 draw art-group data 3) +;; ) +;; ) +;; ) +;; ) +;; (method-set! +;; flut-npc +;; 35 +;; (lambda ((arg0 flut-npc)) +;; (initialize-skeleton +;; arg0 +;; (the-as skeleton-group (art-group-get-by-name *level* "skel-flut-wild" (the-as (pointer level) #f))) +;; (the-as pair 0) +;; ) +;; (set! (-> arg0 draw light-index) (the-as uint 30)) +;; 0 +;; (none) +;; ) +;; ) +;; (let ((a0-5 (new 'static 'skeleton-group +;; :name "skel-mhcity-de-tower-egg" +;; :extra #f +;; :info #f +;; :art-group-name "mhcity-de-tower-egg" +;; :bounds (new 'static 'vector :w 40960.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-5 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-5 clothing length) (-> a0-5 clothing allocated-length)) +;; ) +;; (set! (-> a0-5 jgeo) 0) +;; (set! (-> a0-5 janim) 2) +;; (set! (-> a0-5 mgeo 0) 1) +;; (set! (-> a0-5 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-5) +;; ) +;; (let ((a0-6 (new 'static 'skeleton-group +;; :name "skel-errol-effect" +;; :extra #f +;; :info #f +;; :art-group-name "errol-effect" +;; :bounds (new 'static 'vector :w 32768.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-6 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-6 clothing length) (-> a0-6 clothing allocated-length)) +;; ) +;; (set! (-> a0-6 jgeo) 0) +;; (set! (-> a0-6 janim) 2) +;; (set! (-> a0-6 mgeo 0) 1) +;; (set! (-> a0-6 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-6) +;; ) +;; (let ((a0-7 (new 'static 'skeleton-group +;; :name "skel-errol" +;; :extra #f +;; :info #f +;; :art-group-name "errol" +;; :bounds (new 'static 'vector :w 32768.0) +;; :version 8 +;; :origin-joint-index 6 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-7 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-7 clothing length) (-> a0-7 clothing allocated-length)) +;; ) +;; (set! (-> a0-7 jgeo) 0) +;; (set! (-> a0-7 janim) 2) +;; (set! (-> a0-7 mgeo 0) 1) +;; (set! (-> a0-7 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-7) +;; ) +;; (let ((a0-8 (new 'static 'skeleton-group +;; :name "skel-snake-wheel-fma" +;; :extra #f +;; :info #f +;; :art-group-name "snake-wheel-fma" +;; :bounds (new 'static 'vector :w 40960.0) +;; :version 8 +;; :shadow 2 +;; :shadow-joint-index 3 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-8 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-8 clothing length) (-> a0-8 clothing allocated-length)) +;; ) +;; (set! (-> a0-8 jgeo) 0) +;; (set! (-> a0-8 janim) 3) +;; (set! (-> a0-8 mgeo 0) 1) +;; (set! (-> a0-8 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-8) +;; ) +;; (let ((a0-9 (new 'static 'skeleton-group +;; :name "skel-ottsel-veger" +;; :extra #f +;; :info #f +;; :art-group-name "ottsel-veger" +;; :bounds (new 'static 'vector :w 10240.0) +;; :version 8 +;; :shadow 2 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-9 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-9 clothing length) (-> a0-9 clothing allocated-length)) +;; ) +;; (set! (-> a0-9 jgeo) 0) +;; (set! (-> a0-9 janim) 3) +;; (set! (-> a0-9 mgeo 0) 1) +;; (set! (-> a0-9 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-9) +;; ) +;; (let ((a0-10 (new 'static 'skeleton-group +;; :name "skel-ottsel-surfer" +;; :extra #f +;; :info #f +;; :art-group-name "ottsel-surfer" +;; :bounds (new 'static 'vector :w 10240.0) +;; :version 8 +;; :shadow 2 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-10 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-10 clothing length) (-> a0-10 clothing allocated-length)) +;; ) +;; (set! (-> a0-10 jgeo) 0) +;; (set! (-> a0-10 janim) 3) +;; (set! (-> a0-10 mgeo 0) 1) +;; (set! (-> a0-10 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-10) +;; ) +;; (let ((a0-11 (new 'static 'skeleton-group +;; :name "skel-ottsel-leader" +;; :extra #f +;; :info #f +;; :art-group-name "ottsel-leader" +;; :bounds (new 'static 'vector :w 10240.0) +;; :version 8 +;; :shadow 2 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #t +;; (set! (-> a0-11 clothing) (new 'static 'boxed-array :type cloth-params :length 0 :allocated-length 1)) +;; (set! (-> a0-11 clothing 0) (new 'static 'cloth-params +;; :mesh 3 +;; :gravity-constant (meters 12) +;; :wind-constant 1.0 +;; :cloth-width #xd +;; :flags (cloth-flag use-wind double-sided flip-normals autogen-uvs) +;; :tex-name "prec-leader-robe-01" +;; :tex-name2 "prec-leader-robe-01" +;; :tex-name3 "prec-leader-robe-01" +;; :alt-tex-name #f +;; :alt-tex-name2 #f +;; :alt-tex-name3 #f +;; :cloth-thickness 1.0 +;; :initial-xform 3 +;; :drag 0.151 +;; :num-iterations 1 +;; :timestep-frequency 7 +;; ) +;; ) +;; (set! (-> a0-11 clothing length) (-> a0-11 clothing allocated-length)) +;; ) +;; (set! (-> a0-11 jgeo) 0) +;; (set! (-> a0-11 janim) 4) +;; (set! (-> a0-11 mgeo 0) 1) +;; (set! (-> a0-11 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-11) +;; ) +;; (let ((a0-12 (new 'static 'skeleton-group +;; :name "skel-battle-amulet" +;; :extra #f +;; :info #f +;; :art-group-name "battle-amulet" +;; :bounds (new 'static 'vector :w 8192.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-12 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-12 clothing length) (-> a0-12 clothing allocated-length)) +;; ) +;; (set! (-> a0-12 jgeo) 0) +;; (set! (-> a0-12 janim) 2) +;; (set! (-> a0-12 mgeo 0) 1) +;; (set! (-> a0-12 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-12) +;; ) +;; (let ((a0-13 (new 'static 'skeleton-group +;; :name "skel-precursor" +;; :extra #f +;; :info #f +;; :art-group-name "precursor" +;; :bounds (new 'static 'vector :w 34816.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-13 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-13 clothing length) (-> a0-13 clothing allocated-length)) +;; ) +;; (set! (-> a0-13 jgeo) 0) +;; (set! (-> a0-13 janim) 2) +;; (set! (-> a0-13 mgeo 0) 1) +;; (set! (-> a0-13 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-13) +;; ) +;; (let ((a0-14 (new 'static 'skeleton-group +;; :name "skel-comb-rail-rider-fma" +;; :extra #f +;; :info #f +;; :art-group-name "comb-rail-rider" +;; :bounds (new 'static 'vector :w 43008.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-14 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-14 clothing length) (-> a0-14 clothing allocated-length)) +;; ) +;; (set! (-> a0-14 jgeo) 0) +;; (set! (-> a0-14 janim) 3) +;; (set! (-> a0-14 mgeo 0) 1) +;; (set! (-> a0-14 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-14) +;; ) +;; (let ((a0-15 (new 'static 'skeleton-group +;; :name "skel-monk" +;; :extra #f +;; :info #f +;; :art-group-name "monk" +;; :bounds (new 'static 'vector :w 16384.0) +;; :version 8 +;; :shadow 2 +;; :shadow-joint-index 3 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-15 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-15 clothing length) (-> a0-15 clothing allocated-length)) +;; ) +;; (set! (-> a0-15 jgeo) 0) +;; (set! (-> a0-15 janim) 3) +;; (set! (-> a0-15 mgeo 0) 1) +;; (set! (-> a0-15 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-15) +;; ) +;; (let ((a0-16 (new 'static 'skeleton-group +;; :name "skel-terraformer-fma" +;; :extra #f +;; :info #f +;; :art-group-name "terraformer-fma" +;; :bounds (new 'static 'vector :w 16384.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-16 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-16 clothing length) (-> a0-16 clothing allocated-length)) +;; ) +;; (set! (-> a0-16 jgeo) 0) +;; (set! (-> a0-16 janim) 2) +;; (set! (-> a0-16 mgeo 0) 1) +;; (set! (-> a0-16 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-16) +;; ) +;; (let ((a0-17 (new 'static 'skeleton-group +;; :name "skel-rhino-fma" +;; :extra #f +;; :info #f +;; :art-group-name "rhino" +;; :bounds (new 'static 'vector :w 409600.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-17 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-17 clothing length) (-> a0-17 clothing allocated-length)) +;; ) +;; (set! (-> a0-17 jgeo) 4) +;; (set! (-> a0-17 janim) 7) +;; (set! (-> a0-17 mgeo 0) 5) +;; (set! (-> a0-17 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-17) +;; ) +;; (let ((a0-18 (new 'static 'skeleton-group +;; :name "skel-neo-satellite-fma" +;; :extra #f +;; :info #f +;; :art-group-name "neo-satellite-fma" +;; :bounds (new 'static 'vector :w 40960.0) +;; :version 8 +;; :shadow 2 +;; :origin-joint-index 3 +;; :clothing #f +;; :global-effects #x20 +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-18 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-18 clothing length) (-> a0-18 clothing allocated-length)) +;; ) +;; (set! (-> a0-18 jgeo) 0) +;; (set! (-> a0-18 janim) 3) +;; (set! (-> a0-18 mgeo 0) 1) +;; (set! (-> a0-18 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-18) +;; ) +;; (let ((a0-19 (new 'static 'skeleton-group +;; :name "skel-neo-satellite-break" +;; :extra #f +;; :info #f +;; :art-group-name "neo-satellite-break" +;; :bounds (new 'static 'vector :w 2048000.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; :global-effects #x20 +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-19 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-19 clothing length) (-> a0-19 clothing allocated-length)) +;; ) +;; (set! (-> a0-19 jgeo) 0) +;; (set! (-> a0-19 janim) 2) +;; (set! (-> a0-19 mgeo 0) 1) +;; (set! (-> a0-19 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-19) +;; ) +;; (let ((a0-20 (new 'static 'skeleton-group +;; :name "skel-talk-box" +;; :extra #f +;; :info #f +;; :art-group-name "talk-box" +;; :bounds (new 'static 'vector :w 8192.0) +;; :version 8 +;; :origin-joint-index 3 +;; :clothing #f +;; ) +;; ) +;; ) +;; (when #f +;; (set! (-> a0-20 clothing) (new 'static 'boxed-array :type cloth-params)) +;; (set! (-> a0-20 clothing length) (-> a0-20 clothing allocated-length)) +;; ) +;; (set! (-> a0-20 jgeo) 0) +;; (set! (-> a0-20 janim) 2) +;; (set! (-> a0-20 mgeo 0) 1) +;; (set! (-> a0-20 lod-dist 0) 4095996000.0) +;; (add-to-loading-level a0-20) +;; ) +;; (none) +;; ) +;; ) + +(defskelgroup skel-ottsel-daxpants ottsel-daxpants ottsel-daxpants-lod0-jg ottsel-daxpants-idle-ja + ((ottsel-daxpants-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow-joint-index 3 + ) + +(defskelgroup skel-ottsel-dummy ottsel-dummy ottsel-dummy-lod0-jg ottsel-dummy-idle-ja + ((ottsel-dummy-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow-joint-index 3 + ) + +(defskelgroup skel-ottsel-tess ottsel-tess ottsel-tess-lod0-jg ottsel-tess-idle-ja + ((ottsel-tess-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2.5) + :shadow ottsel-tess-shadow-mg + :shadow-joint-index 3 + ) diff --git a/goal_src/jak3/engine/common-obs/shield-sphere.gc b/goal_src/jak3/engine/common-obs/shield-sphere.gc index 15af02a1218..25f10c763dd 100644 --- a/goal_src/jak3/engine/common-obs/shield-sphere.gc +++ b/goal_src/jak3/engine/common-obs/shield-sphere.gc @@ -5,5 +5,700 @@ ;; name in dgo: shield-sphere ;; dgos: GAME +;; +++shield-type +(defenum shield-type + :type uint8 + (shield-type-0) + (shield-type-1) + ) +;; ---shield-type + + ;; DECOMP BEGINS +(deftype shield-sphere-heat (structure) + ((current-heat-value float) + (damage-scalar float) + (last-heat-time time-frame) + (distort-handle handle) + ) + ) + + +(deftype shield-sphere-toggle (structure) + ((enable-time time-frame) + (disable-time time-frame) + ) + ) + + +(deftype shield-sphere (process-focusable) + ((owner handle) + (sphere-size float) + (offset-vec vector :inline) + (enabled? symbol) + (shield-type shield-type) + (track-joint int32) + (heat-info shield-sphere-heat :inline) + (toggle-info shield-sphere-toggle :inline :overlay-at (-> heat-info current-heat-value)) + (last-attack-time time-frame) + (last-attack-id uint32) + (persistent-attack-id uint32) + ) + (:state-methods + shield-enabled + shield-disabled + explode + die + ) + (:methods + (shield-sphere-method-32 (_type_) quaternion) + (shield-enabled-trans (_type_) none) + (toggle-shield (_type_ symbol) none) + (shield-post (_type_) object) + (init-and-go! (_type_) object) + (init-collision! (_type_) none) + (shield-event-handler (_type_ process int symbol event-message-block) object) + (get-attack-damage (_type_ process-focusable event-message-block) int) + (shield-touch-handler (_type_ process-focusable event-message-block) object) + (shield-attack-handler (_type_ process-focusable event-message-block) symbol) + (send-shield-attack (_type_ process-focusable touching-shapes-entry int) object) + ) + ) + + +(deftype shield-sphere-spawn-params (structure) + ((offset-vec vector :inline) + (owner handle) + (sphere-size float) + (shield-type shield-type) + (track-joint int32) + (enable-time time-frame) + (disable-time time-frame) + (shield-strength int8) + (pad int16) + ) + ) + + +(defskelgroup skel-shield-sphere-distort shield-sphere-distort shield-sphere-distort-lod0-jg shield-sphere-distort-idle-ja + ((shield-sphere-distort-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + ) + +(deftype shield-sphere-distort (process-drawable) + ((owner handle) + (sphere-size float) + ) + (:state-methods + inactive + distort + die + ) + ) + + +(deftype shield-sphere-distort-spawn-params (structure) + ((owner handle) + (sphere-size float) + ) + ) + + +(defbehavior shield-sphere-distort-init-by-other shield-sphere-distort ((arg0 shield-sphere-distort-spawn-params)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self root) (new 'process 'trsqv)) + (initialize-skeleton + self + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-shield-sphere-distort" (the-as (pointer level) #f)) + ) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> arg0 sphere-size) (-> arg0 sphere-size) (-> arg0 sphere-size) 1.0) + (go-virtual inactive) + ) + +(defskelgroup skel-shield-sphere-explode shield-sphere-explode shield-sphere-explode-lod0-jg shield-sphere-explode-idle-ja + ((shield-sphere-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + ) + +(define *shield-sphere-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 1 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 2 :parent-joint-index -1) + (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) + ) + :collide-spec (collide-spec backgnd) + ) + ) + +(defmethod init-and-go! ((this shield-sphere)) + (case (-> this shield-type) + (((shield-type shield-type-0)) + (set! (-> this heat-info current-heat-value) 0.0) + (set-time! (-> this heat-info last-heat-time)) + ) + (((shield-type shield-type-1)) + ) + ) + (let* ((v1-5 *game-info*) + (a0-4 (+ (-> v1-5 attack-id) 1)) + ) + (set! (-> v1-5 attack-id) a0-4) + (set! (-> this last-attack-id) a0-4) + ) + (let* ((v1-6 *game-info*) + (a0-6 (+ (-> v1-6 attack-id) 1)) + ) + (set! (-> v1-6 attack-id) a0-6) + (set! (-> this persistent-attack-id) a0-6) + ) + (set-vector! (-> this draw color-mult) 0.4 0.4 0.4 0.4) + (shield-enabled-trans this) + (go (method-of-object this shield-enabled)) + ) + +(defmethod init-collision! ((this shield-sphere)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate mech-punch dark-punch dark-smack)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle impenetrable-obj shield)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-7 prim-core action) (collide-action solid deadly no-standon)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 (* 4096.0 (-> this sphere-size))) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod shield-enabled-trans ((this shield-sphere)) + (if (= (-> this shield-type) (shield-type shield-type-0)) + (seek! (-> this heat-info current-heat-value) 0.0 (* 0.2 (seconds-per-frame))) + ) + (let* ((s4-0 (handle->process (-> this owner))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (cond + (s5-0 + (if (!= (-> this track-joint) -1) + (vector<-cspace! + (-> this root trans) + (-> (the-as process-focusable s5-0) node-list data (-> this track-joint)) + ) + (vector+! (-> this root trans) (get-trans (the-as process-focusable s5-0) 0) (-> this offset-vec)) + ) + (shield-sphere-method-32 this) + (send-event s5-0 'go-invulnerable) + ) + (else + (go (method-of-object this die)) + ) + ) + ) + (none) + ) + +(defmethod toggle-shield ((this shield-sphere) (arg0 symbol)) + (cond + (arg0 + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> this root backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> this root backup-collide-with)) + ) + ) + (else + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + ) + ) + (let* ((s4-0 (handle->process (-> this owner))) + (a0-9 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (cond + (arg0 + (logior! (-> this draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> this draw status) (draw-control-status no-draw)) + (send-event a0-9 'go-vulnerable) + ) + ) + ) + (set! (-> this enabled?) arg0) + 0 + (none) + ) + +(defstate shield-enabled (shield-sphere) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #t) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (shield-enabled-trans self) + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self toggle-info enable-time)) + ) + (go-virtual shield-disabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +(defstate shield-disabled (shield-sphere) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #f) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self heat-info last-heat-time)) + ) + (go-virtual shield-enabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +(defstate explode (shield-sphere) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + (toggle-shield self #f) + (let ((a0-2 (handle->process (-> self heat-info distort-handle)))) + (if a0-2 + (send-event a0-2 'die) + ) + ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-0 rot-speed) 20.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-shield-sphere-explode" (the-as (pointer level) #f)) + 2 + gp-0 + *shield-sphere-exploder-params* + :name "joint-exploder" + :to self + :unk 0 + ) + ) + ) + :code (behavior () + (while (-> self child) + (suspend) + ) + (go-virtual die) + ) + :post (behavior () + (shield-post self) + ) + ) + +(defstate die (shield-sphere) + :virtual #t + :enter (behavior () + '() + ) + :code (behavior () + '() + ) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod shield-post ((this shield-sphere)) + (cond + ((not (-> this enabled?)) + (logior! (-> this draw status) (draw-control-status no-draw)) + (return (the-as object 0)) + ) + (else + (logclear! (-> this draw status) (draw-control-status no-draw)) + ) + ) + (let ((f0-0 (calc-fade-from-fog (-> this root trans)))) + (case (-> this shield-type) + (((shield-type shield-type-0)) + (+ 0.4 (* 0.6 (-> this heat-info current-heat-value))) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (set-vector! a1-0 0.4 0.4 0.4 0.4) + (vector-lerp! (-> this draw color-mult) a1-0 *zero-vector* (-> this heat-info current-heat-value)) + ) + (set-vector! + (-> this draw color-emissive) + (-> this heat-info current-heat-value) + 0.0 + 0.0 + (-> this heat-info current-heat-value) + ) + ) + (((shield-type shield-type-1)) + (set-vector! (-> this draw color-mult) 0.4 0.4 0.4 (* 0.4 f0-0)) + (set-vector! (-> this draw color-emissive) 0.0 0.0 0.0 0.0) + ) + ) + ) + (transform-post) + ) + +(defskelgroup skel-shield-sphere shield-sphere shield-sphere-lod0-jg shield-sphere-idle-ja + ((shield-sphere-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + ) + +(defbehavior shield-sphere-init-by-other shield-sphere ((arg0 shield-sphere-spawn-params)) + (stack-size-set! (-> self main-thread) 128) + (logclear! (-> self mask) (process-mask enemy)) + (set! (-> self sphere-size) (-> arg0 sphere-size)) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self track-joint) (-> arg0 track-joint)) + (set! (-> self offset-vec quad) (-> arg0 offset-vec quad)) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-shield-sphere" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> self sphere-size) (-> self sphere-size) (-> self sphere-size) 1.0) + (set! (-> self shield-type) (-> arg0 shield-type)) + (case (-> self shield-type) + (((shield-type shield-type-0)) + (set! (-> self heat-info damage-scalar) (/ 1.0 (the float (-> arg0 shield-strength)))) + (let ((gp-1 (new 'stack-no-clear 'shield-sphere-distort-spawn-params))) + (set! (-> gp-1 owner) (process->handle self)) + (set! (-> gp-1 sphere-size) (-> self sphere-size)) + (let ((s5-1 (the-as process #f))) + (let* ((s4-1 (get-process *default-dead-pool* shield-sphere-distort #x4000 1)) + (v1-22 (when s4-1 + (let ((t9-5 (method-of-type process activate))) + (t9-5 s4-1 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 shield-sphere-distort-init-by-other gp-1) + (-> s4-1 ppointer) + ) + ) + ) + (if v1-22 + (set! s5-1 (-> v1-22 0)) + ) + ) + (set! (-> self heat-info distort-handle) (process->handle s5-1)) + ) + ) + ) + (((shield-type shield-type-1)) + (set! (-> self toggle-info enable-time) (-> arg0 enable-time)) + (set! (-> self heat-info last-heat-time) (-> arg0 disable-time)) + ) + ) + (ja-no-eval :group! (ja-group) :num! (loop!) :frame-num 0.0) + (ja-post) + (logior! (-> self draw status) (draw-control-status disable-fog)) + (set! (-> self event-hook) (-> (method-of-type shield-sphere shield-enabled) event)) + (init-and-go! self) + ) + +(defmethod shield-sphere-method-32 ((this shield-sphere)) + (forward-up-nopitch->quaternion + (-> this root quat) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (camera-pos) (-> this root trans)) 1.0) + *y-vector* + ) + ) + +(defmethod get-inv-mass ((this shield-sphere)) + 2.0 + ) + +(defmethod shield-event-handler ((this shield-sphere) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('shield-detach) + (go (method-of-object this die)) + #t + ) + (('active) + #t + ) + (('heat-ratio) + (-> this heat-info current-heat-value) + ) + (('notice) + (case (-> arg3 param 0) + (('die) + (go (method-of-object this die)) + #t + ) + (else + #f + ) + ) + ) + (('enabled) + (go (method-of-object this shield-enabled)) + ) + (('disabled) + (go (method-of-object this shield-disabled)) + ) + (('touch) + (shield-touch-handler this (the-as process-focusable arg0) arg3) + ) + (('attack) + (shield-attack-handler this (the-as process-focusable arg0) arg3) + ) + (('impact-impulse) + (let ((v1-12 (the-as object (-> arg3 param 0)))) + (when (< 40960.0 (* (-> (the-as rigid-body-impact v1-12) impulse) (get-inv-mass this))) + (logior! (-> this root penetrated-by) (penetrate vehicle)) + (go (method-of-object this explode)) + #t + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch number vs int. +(defmethod get-attack-damage ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (the-as int (cond + ((logtest? (attack-mask damage) (-> (the-as attack-info v1-0) mask)) + (the int (-> (the-as attack-info v1-0) damage)) + ) + (else + (let ((a0-4 (get-penetrate-using-from-attack-event arg0 arg1))) + (if (and (logtest? a0-4 (penetrate board)) (logtest? a0-4 (penetrate spin))) + 10000 + (penetrate-using->damage a0-4) + ) + ) + ) + ) + ) + ) + ) + +(defmethod shield-touch-handler ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let* ((s5-0 (-> arg1 param 0)) + (s2-0 arg0) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and s5-0 s3-0) + (cond + ((and (and s3-0 (not (logtest? (-> s3-0 focus-status) (focus-status disable dead ignore grabbed)))) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s5-0) + (-> this root) + (collide-action deadly) + (collide-action) + ) + ) + (let ((a3-1 (-> this persistent-attack-id))) + (send-shield-attack this arg0 (the-as touching-shapes-entry s5-0) (the-as int a3-1)) + ) + ) + ((and ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s5-0) + (-> this root) + (collide-action no-standon) + (collide-action) + ) + (not (logtest? (-> this root penetrated-by) (-> s3-0 root penetrate-using))) + ) + (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s5-0) 0.0 10240.0 24576.0) + ) + ) + ) + ) + ) + +(defmethod shield-attack-handler ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let ((s5-0 (-> arg1 param 0)) + (v1-0 (the-as object (-> arg1 param 1))) + ) + (cond + ((and (and (-> this next-state) (= (-> this next-state name) 'shield-enabled)) + (and (= (-> this shield-type) (shield-type shield-type-0)) + (or (!= (-> (the-as attack-info v1-0) id) (-> this last-attack-id)) + (time-elapsed? (-> this last-attack-time) (seconds 1)) + ) + ) + ) + (set! (-> this last-attack-id) (-> (the-as attack-info v1-0) id)) + (set-time! (-> this last-attack-time)) + (let* ((v1-5 (get-attack-damage this arg0 arg1)) + (f30-0 (* (-> this heat-info damage-scalar) (the float v1-5))) + ) + (when (> v1-5 0) + (if (< (+ f30-0 (-> this heat-info current-heat-value)) 1.0) + (set! f30-0 (fmin f30-0 (* 0.0027777778 (the float (- (current-time) (-> this heat-info last-heat-time)))))) + ) + (set-time! (-> this heat-info last-heat-time)) + (let ((a0-14 (handle->process (-> this heat-info distort-handle)))) + (if a0-14 + (send-event a0-14 'distort) + ) + ) + (sound-play "dpbiped-shld-df") + (+! (-> this heat-info current-heat-value) f30-0) + (if (< 1.0 (-> this heat-info current-heat-value)) + (go (method-of-object this explode)) + ) + ) + ) + (if (not (send-shield-attack this arg0 (the-as touching-shapes-entry s5-0) (the-as int (-> this persistent-attack-id))) + ) + (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s5-0) 0.0 12288.0 32768.0) + ) + #t + ) + (else + #f + ) + ) + ) + ) + +(defmethod send-shield-attack ((this shield-sphere) (arg0 process-focusable) (arg1 touching-shapes-entry) (arg2 int)) + (let ((t0-0 0)) + (send-event + arg0 + 'attack + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint arg2)) + (damage (the float t0-0)) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 4)) + (shove-up (meters 3)) + (mode 'generic) + ) + ) + ) + ) + ) + +(defstate die (shield-sphere-distort) + :virtual #t + :code (behavior () + '() + ) + ) + +(defstate distort (shield-sphere-distort) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('die) + (go-virtual die) + ) + (('distort) + (let ((f0-0 (ja-frame-num 0))) + (if (< 5.0 f0-0) + (go-virtual distort) + ) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + :trans (behavior () + (let ((v1-1 (handle->process (-> self owner)))) + (when v1-1 + (set! (-> self root trans quad) (-> (the-as process-drawable v1-1) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable v1-1) root quat)) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 0) + (ja-no-eval :group! shield-sphere-distort-idle-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (go-virtual inactive) + ) + :post (behavior () + (ja-post) + ) + ) + +(defstate inactive (shield-sphere-distort) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('distort) + (go-virtual distort) + ) + (('die) + (go-virtual die) + ) + ) + ) + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + :code sleep-code + ) diff --git a/goal_src/jak3/engine/common-obs/vent.gc b/goal_src/jak3/engine/common-obs/vent.gc index 743cb5ef633..e0415c0fd44 100644 --- a/goal_src/jak3/engine/common-obs/vent.gc +++ b/goal_src/jak3/engine/common-obs/vent.gc @@ -215,98 +215,35 @@ (cond ((logtest? (-> self collect-effect flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> v1-9 root-prim prim-core world-sphere quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-3 (method-of-type part-tracker-subsampler activate))) - (t9-3 (the-as part-tracker-subsampler s5-2) gp-0 "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-4 run-function-in-process) - (a0-13 s5-2) - (a1-10 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> self collect-effect)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-4) a0-13 a1-10 *part-tracker-subsampler-params-default*) - ) - (-> s5-2 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to gp-0 + :group (-> self collect-effect) + :callback part-tracker-track-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> v1-9 root-prim prim-core world-sphere quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker s5-3) gp-0 "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-18 s5-3) - (a1-13 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self collect-effect)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-7) a0-18 a1-13 *part-tracker-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to gp-0 :group (-> self collect-effect) :callback part-tracker-track-target) ) ) (cond ((logtest? (-> self collect-effect2 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root root-prim prim-core world-sphere quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-9 (method-of-type part-tracker-subsampler activate))) - (t9-9 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-10 run-function-in-process) - (a0-25 gp-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> self collect-effect2)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-move-to-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-10) a0-25 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> self collect-effect2) + :callback part-tracker-move-to-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> self root root-prim prim-core world-sphere quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-12 (method-of-type part-tracker activate))) - (t9-12 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-32 gp-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self collect-effect2)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-move-to-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-13) a0-32 a1-19 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + part-tracker + :to self + :group (-> self collect-effect2) + :callback part-tracker-move-to-target ) ) ) diff --git a/goal_src/jak3/engine/common-obs/warp-gate.gc b/goal_src/jak3/engine/common-obs/warp-gate.gc index 40ebec7f1b6..4b86acb175a 100644 --- a/goal_src/jak3/engine/common-obs/warp-gate.gc +++ b/goal_src/jak3/engine/common-obs/warp-gate.gc @@ -5,5 +5,1922 @@ ;; name in dgo: warp-gate ;; dgos: GAME +(define-extern v-marauder type) +(define-extern *range-warp-dust-color* curve-color-fast) +(define-extern *range-warp-dust-alpha* curve2d-fast) +(define-extern *range-warp-dust-scale-x* curve2d-fast) +(define-extern *range-warp-dust-scale-y* curve2d-fast) +(define-extern *curve-warp-dust-alpha* curve2d-fast) +(define-extern *curve-warp-dust-scale-x* curve2d-fast) +(define-extern *curve-warp-dust-scale-y* curve2d-fast) + ;; DECOMP BEGINS +(defpartgroup group-warpgate + :id 202 + :duration (seconds 0.267) + :flags (sp0 sp6) + :bounds (static-bspherem 0 0 0 8) + :rotate ((degrees 90) (degrees 0) (degrees 0)) + :parts ((sp-item 825 :flags (is-3d sp3 sp7)) (sp-item 826 :flags (sp3)) (sp-item 827 :flags (sp7))) + ) + +(defpart 825 + :init-specs ((:texture (middot level-default-sprite)) + (:num 1.0) + (:scale-x (meters 4.75)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 196.0) + (:fade-a -3.1875) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-2)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 826 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 14)) + (:rot-x (degrees 11.25)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 48.0) + (:fade-a -0.8) + (:timer (seconds 0.267)) + (:flags (glow)) + (:userdata 4096.0) + ) + ) + +(defpart 827 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 16.0) + (:x (meters 0) (meters 2)) + (:scale-x (meters 0.1) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 255.0) + (:scalevel-x (meters -0.0025)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpartgroup group-airtrain-dust-plume :id 203 :bounds (static-bspherem 0 0 0 15) :parts ((sp-item 828))) + +(defpart 828 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:x (meters 0) (meters 10)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 128.0) + (:g 106.0 16.0) + (:b 64.0 32.0) + (:a 16.0 32.0) + (:vel-x (meters 0.033333335) (meters 0.033333335)) + (:scalevel-x (meters 0.033333335) (meters 0.006666667)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.04 -0.08) + (:accel-y (meters 0.00033333333)) + (:friction 0.95 0.03) + (:timer (seconds 4.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpartgroup group-airtrain-dust-hover :id 204 :bounds (static-bspherem 0 0 0 15) :parts ((sp-item 829))) + +(defpart 829 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0) + (:x (meters 0) (meters 5)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 128.0) + (:g 106.0 16.0) + (:b 64.0 32.0) + (:a 16.0 16.0) + (:vel-x (meters 0.033333335) (meters 0.033333335)) + (:scalevel-x (meters 0.016666668) (meters 0.006666667)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.04 -0.08) + (:accel-y (meters 0.00033333333)) + (:friction 0.95 0.03) + (:timer (seconds 4.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpartgroup group-airtrain-thruster + :id 205 + :linger-duration (seconds 2) + :flags (sp4 sp6) + :bounds (static-bspherem 0 0 0 12) + :rotate ((degrees 180) (degrees 0) (degrees 0)) + :parts ((sp-item 830 :flags (sp6 sp7)) + (sp-item 831 :flags (sp6 sp7)) + (sp-item 832 :flags (sp7)) + (sp-item 833 :flags (sp7)) + (sp-item 834 :flags (sp7)) + ) + ) + +(defpartgroup group-airtrain-thruster-off + :id 206 + :linger-duration (seconds 2) + :flags (sp4 sp6) + :bounds (static-bspherem 0 0 0 12) + :rotate ((degrees 180) (degrees 0) (degrees 0)) + :parts ((sp-item 834 :fade-after (meters 120) :falloff-to (meters 90) :flags (sp7)) + (sp-item 835 :fade-after (meters 120) :falloff-to (meters 90) :flags (sp7)) + (sp-item 836 :flags (sp6 sp7)) + ) + ) + +(defpart 830 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 1) (meters 0.4)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 64.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 831 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 4.8) (meters 0.6)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 16.0 2.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 832 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 2.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 196.0) + (:g 128.0 64.0) + (:b :copy g) + (:a 16.0 16.0) + (:vel-x (meters -0.006666667) (meters 0.013333334)) + (:vel-y (meters -0.05) (meters -0.1)) + (:vel-z (meters -0.006666667) (meters 0.013333334)) + (:scalevel-x (meters 0.053333335) (meters 0.053333335)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.21333334 -0.42666668) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94 0.04) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 835 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 2.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 196.0) + (:g 128.0 64.0) + (:b :copy g) + (:a 10.0 4.0) + (:vel-x (meters -0.006666667) (meters 0.013333334)) + (:vel-y (meters -0.05) (meters -0.1)) + (:vel-z (meters -0.006666667) (meters 0.013333334)) + (:scalevel-x (meters 0.053333335) (meters 0.053333335)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.21333334 -0.42666668) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94 0.04) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 836 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 1.4) (meters 0.1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 48.0 32.0) + (:b 0.0) + (:a 48.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 833 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.0 1.0) + (:x (meters 0) (meters 0.5)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 192.0 64.0) + (:g 128.0) + (:b 0.0) + (:a 128.0) + (:omega (degrees 0.0675) (degrees 0.0225)) + (:vel-x (meters -0.013333334) (meters 0.026666667)) + (:vel-y (meters -0.1) (meters -0.06666667)) + (:vel-z (meters -0.013333334) (meters 0.026666667)) + (:fade-g -1.0) + (:fade-a -2.56) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.96 0.02) + (:timer (seconds 0.085) (seconds 0.08)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:func 'sparticle-motion-blur) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(defpart 834 + :init-specs ((:num 0.4) + (:rot-x 8) + (:r 1638.4) + (:g 1331.2) + (:b 1433.6) + (:vel-y (meters -0.05) (meters -0.016666668)) + (:fade-r 32.768) + (:fade-g 28.671999) + (:fade-b 26.623999) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.94) + (:timer (seconds 0.335)) + (:flags (distort)) + (:next-time (seconds 0.167)) + (:next-launcher 837) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +(defpart 837 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b -4.096)) + ) + +(defpartgroup group-warp-hellcat-thruster + :id 207 + :duration (seconds 3) + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 32) + :parts ((sp-item 838 :flags (is-3d sp7)) + (sp-item 839 :flags (is-3d sp7)) + (sp-item 840 :flags (sp7)) + (sp-item 841 :flags (is-3d sp7)) + (sp-item 842 :flags (is-3d sp7)) + (sp-item 843 :flags (sp7)) + ) + ) + +(defpart 838 + :init-specs ((:texture (mech-flame lprecurc-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 839 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:rot-z (degrees 90)) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 840 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -4.75)) + (:scale-x (meters 1.75)) + (:rot-x (degrees 0.5625)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 16.0 4.0) + (:rotvel-z (degrees 0.3)) + (:timer (seconds 0.017)) + (:flags (glow)) + (:userdata 2048.0) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 841 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 842 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:rot-z (degrees 90)) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 843 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -4.75)) + (:scale-x (meters 1.75)) + (:rot-x (degrees 0.5625)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 16.0 4.0) + (:rotvel-z (degrees 0.3)) + (:timer (seconds 0.017)) + (:flags (glow)) + (:userdata 2048.0) + (:rotate-y (degrees 0)) + ) + ) + +(defskelgroup skel-warp-gate warp-gate warp-gate-lod0-jg warp-gate-idle-ja + ((warp-gate-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 4) + :shadow-joint-index 3 + ) + +(deftype warp-gate (process-drawable) + ((root collide-shape :override) + (level-name symbol) + (on-notice pair) + (on-activate pair) + (on-close pair) + (wait-for pair) + (continue continue-point) + (distance meters) + (anim-speed float) + (test-time time-frame) + (center vector :inline) + ) + (:state-methods + idle + (use continue-point) + hidden + ) + (:methods + (init-skel-and-collide! (_type_) none) + (init-defaults! (_type_) none) + (eval-on-notice (_type_) continue-point) + ) + ) + + +(defmethod eval-on-notice ((this warp-gate)) + (let ((s5-0 (script-eval (-> this on-notice)))) + (cond + ((= s5-0 'hide) + (logior! (-> this draw status) (draw-control-status no-draw)) + (set! (-> this continue) #f) + ) + (s5-0 + (logclear! (-> this draw status) (draw-control-status no-draw)) + (set! (-> this continue) (get-continue-by-name *game-info* (the-as string (car s5-0)))) + (set! (-> this on-activate) (the-as pair (car (cdr s5-0)))) + (set! (-> this wait-for) (the-as pair (car (cdr (cdr s5-0))))) + (set! (-> this on-close) (the-as pair (car (cdr (cdr (cdr s5-0)))))) + ) + (else + (set! (-> this continue) #f) + ) + ) + ) + (-> this continue) + ) + +(defstate hidden (warp-gate) + :virtual #t + :code sleep-code + ) + +(defstate idle (warp-gate) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('hide) + (go-virtual hidden) + ) + (('effect) + (script-eval '(part-tracker "group-warpgate" entity self joint "outerOut")) + ) + ) + ) + :code (behavior () + (remove-setting! 'allow-progress) + (set-time! (-> self state-time)) + (update-transforms (-> self root)) + (until #f + (eval-on-notice self) + (when (and (and *target* + (and (>= (-> self distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (-> self continue) + (-> *setting-control* user-current airlock) + (begin + (persist-with-delay *setting-control* 'lightjak (seconds 0.1) 'lightjak #f 0.0 0) + (persist-with-delay *setting-control* 'darkjak (seconds 0.1) 'darkjak #f 0.0 0) + (persist-with-delay *setting-control* 'board (seconds 0.1) 'board #f 0.0 0) + (not (logtest? (focus-status in-head edge-grab pole flut tube light board pilot mech dark indax) + (-> *target* focus-status) + ) + ) + ) + (not (-> *setting-control* user-current hint)) + (zero? (-> *target* ext-anim)) + ) + (talker-surpress!) + (when (and (can-display-query? self "warp-gate" -99.0) + (cond + ((and (-> *target* next-state) (let ((v1-37 (-> *target* next-state name))) + (or (= v1-37 'target-warp-in) (= v1-37 'target-warp-out)) + ) + ) + (set-time! (-> self state-time)) + #f + ) + (else + #t + ) + ) + (time-elapsed? (-> self state-time) (seconds 0.1)) + ) + (if (and (cpad-pressed? 0 triangle) (process-grab? *target* #f)) + (go-virtual use (-> self continue)) + ) + (script-eval (-> self on-close)) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-58 gp-0)) + (set! (-> v1-58 width) (the float 340)) + ) + (let ((v1-59 gp-0)) + (set! (-> v1-59 height) (the float 80)) + ) + (let ((v1-60 gp-0) + (a0-25 (-> *setting-control* user-default language)) + ) + (set! (-> v1-60 scale) (if (or (= a0-25 (language-enum korean)) (= a0-25 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + ) + ) + (cond + ((-> self continue) + (seek! (-> self anim-speed) 1.0 (* 2.0 (seconds-per-frame))) + (setup-masks (-> self draw) 2 0) + ) + (else + (setup-masks (-> self draw) 0 2) + (seek! (-> self anim-speed) 0.0 (* 2.0 (seconds-per-frame))) + ) + ) + (update! (-> self sound)) + (ja-post) + (suspend) + (ja :num! (loop! (-> self anim-speed))) + ) + #f + ) + ) + +(defstate use (warp-gate) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('effect) + (script-eval '(part-tracker "group-warpgate" entity self joint "outerOut")) + ) + ) + ) + :exit (behavior () + (remove-setting! 'mode-name) + (remove-setting! 'interp-time) + ) + :trans (behavior () + (send-event *camera* 'joystick 0.0 0.0) + ) + :code (behavior ((arg0 continue-point)) + (local-vars (v1-38 symbol)) + (kill-current-talker '() '() 'exit) + (set-setting! 'mode-name 'cam-fixed 0.0 0) + (set-setting! 'interp-time 'abs 0.0 0) + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not arg0) + (process-release? *target*) + (go-virtual idle) + ) + (set-setting! 'allow-progress #f 0.0 0) + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) #t) + (apply-settings *setting-control*) + (let ((s5-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> s5-0 from) (process->ppointer self)) + (set! (-> s5-0 num-params) 4) + (set! (-> s5-0 message) 'change-state) + (set! (-> s5-0 param 0) (the-as uint target-warp-out)) + (let ((v1-22 (new 'static 'vector))) + (set! (-> v1-22 quad) (-> self center quad)) + (set! (-> s5-0 param 1) (the-as uint v1-22)) + ) + (set! (-> s5-0 param 2) (the-as uint (target-pos 0))) + (set! (-> s5-0 param 3) (the-as uint (process->handle self))) + (send-event-function *target* s5-0) + ) + (script-eval (-> self on-activate)) + (while (begin + (set! v1-38 + (when (-> self wait-for) + (let* ((s5-1 (-> self wait-for)) + (a1-8 (car s5-1)) + ) + (while (not (null? s5-1)) + (when (not (member (status-of-level-and-borrows *level* (the-as symbol a1-8) #f) '(loaded active))) + (set! v1-38 #t) + (goto cfg-21) + ) + (set! s5-1 (cdr s5-1)) + (set! a1-8 (car s5-1)) + ) + ) + #f + ) + ) + (label cfg-21) + (or v1-38 (not (time-elapsed? (-> self state-time) (seconds 2)))) + ) + (update! (-> self sound)) + (suspend) + (ja :num! (loop!)) + (ja-post) + ) + (if (not (logtest? (-> arg0 flags) (continue-flags no-blackout))) + (set-blackout-frames (seconds 0.05)) + ) + (start 'play arg0) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 1)) + (suspend) + ) + ) + (while (and *target* (and (>= 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (suspend) + (ja :num! (loop!)) + (ja-post) + ) + (logior! (-> self mask) (process-mask actor-pause)) + (go-virtual idle) + ) + ) + +;; WARN: Return type mismatch draw-control vs none. +(defmethod init-skel-and-collide! ((this warp-gate)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 12288.0 0.0 16384.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-warp-gate" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (none) + ) + +;; WARN: Return type mismatch float vs none. +(defmethod init-defaults! ((this warp-gate)) + (set! (-> this level-name) (-> this level name)) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-activate) #f) + (set! (-> this wait-for) #f) + (set! (-> this continue) #f) + (set! (-> this on-close) #f) + (set! (-> this part) (create-launch-control (-> *part-group-id-table* 202) this)) + (set! (-> this center quad) (-> this root trans quad)) + (+! (-> this center y) 13516.8) + (set! (-> this sound) + (new 'process 'ambient-sound (static-sound-spec "warpgate" :group 1 :fo-max 30) (-> this root trans) 0.0) + ) + (set! (-> this distance) (res-lump-float (-> this entity) 'distance :default 20480.0)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior warp-gate-init warp-gate ((arg0 entity-actor) (arg1 vector)) + (stack-size-set! (-> self main-thread) 512) + (init-skel-and-collide! self) + (if arg0 + (process-drawable-from-entity! self arg0) + ) + (if arg1 + (set! (-> self root trans quad) (-> arg1 quad)) + ) + (logior! (-> self mask) (process-mask actor-pause)) + (init-defaults! self) + (go-virtual idle) + (none) + ) + +;; WARN: Return type mismatch none vs object. +(defmethod init-from-entity! ((this warp-gate) (arg0 entity-actor)) + (warp-gate-init arg0 (the-as vector #f)) + ) + +(define *warp-jump-mods* (new 'static 'surface + :name 'jump + :turnv 273066.66 + :turnvf 30.0 + :turnvv 1820444.5 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 65536.0 + :target-speed 65536.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag turn-to-vel turn-when-centered gun-off) + ) + ) + +(defstate target-warp-out (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('death-end) + (let ((v0-0 (the-as object (logior (-> self draw status) (draw-control-status no-draw))))) + (set! (-> self draw status) (the-as draw-control-status v0-0)) + v0-0 + ) + ) + (('warp-gate) + (if (not (-> self control unknown-spool-anim00)) + 'busy + ) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 vector) (arg1 vector) (arg2 handle)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *warp-jump-mods*) + (set! (-> self control unknown-vector37 quad) (-> arg0 quad)) + (set! (-> self control unknown-vector38 quad) (-> arg1 quad)) + (+! (-> self control unknown-vector37 y) -4096.0) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control unknown-handle02) arg2) + (vector-reset! (-> self control transv)) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> arg1 quad)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) arg1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + ) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf6)) + ) + :code (behavior ((arg0 vector) (arg1 vector) (arg2 handle)) + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 16.0 0))) + ) + (vector-! (-> self control transv) (-> self control unknown-vector37) (-> self control trans)) + (vector-xz-normalize! (-> self control transv) 32768.0) + (let ((v1-18 (new-stack-vector0))) + (let ((f0-6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-18 (-> self control transv) (vector-float*! v1-18 (-> self control dynam gravity-normal) f0-6)) + ) + (let* ((f0-7 (vector-length v1-18)) + (f1-1 f0-7) + (f2-4 + (- (sqrtf + (* 2.0 + (-> self control dynam gravity-length) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector37) (-> self control trans)) + ) + ) + ) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-4) + (vector-float*! v1-18 v1-18 (/ f0-7 f1-1)) + ) + ) + ) + (let ((v1-20 (-> self control root-prim))) + (set! (-> v1-20 prim-core collide-as) (collide-spec)) + (set! (-> v1-20 prim-core collide-with) (collide-spec)) + ) + 0 + (set-time! (-> self state-time)) + (set! (-> self trans-hook) + (lambda :behavior target + () + (let ((v1-0 (new-stack-vector0)) + (f0-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-0 (-> self control transv) (vector-float*! v1-0 (-> self control dynam gravity-normal) f0-1)) + (let* ((f1-2 (vector-length v1-0)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 8192.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-1) + (vector-float*! v1-0 v1-0 (/ f1-2 f2-0)) + ) + ) + ) + (let ((gp-1 (vector-! (new-stack-vector0) (-> self control unknown-vector37) (-> self control trans)))) + (set! (-> gp-1 y) 0.0) + (send-event *target* 'sidekick #f) + (when (and (or (< (vector-dot gp-1 (-> self control transv)) 0.0) (-> self control unknown-spool-anim00)) + (time-elapsed? (-> self state-time) (seconds 0.05)) + ) + (vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (seconds-per-frame))) + (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-spool-anim00)) + (sound-play "warpgate-tele") + (send-event (handle->process (-> self control unknown-handle02)) 'effect) + (send-event self 'draw #f) + (let ((v0-1 #t)) + (set! (-> self control unknown-word04) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 40.0 0)) :frame-num (ja-aframe 16.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 40.0 0))) + ) + (sleep-code) + ) + :post target-no-stick-post + ) + +(defstate target-warp-in (target) + :event target-generic-event-handler + :enter (behavior ((arg0 vector) (arg1 vector) (arg2 object)) + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float arg2)) + ((-> target-warp-out enter) arg0 arg1 (the-as handle arg2)) + ) + :exit (-> target-warp-out exit) + :trans (behavior () + (set! (-> self control transv x) + (* 2.4 (- (-> self control unknown-vector38 x) (-> self control unknown-vector37 x))) + ) + (set! (-> self control transv z) + (* 2.4 (- (-> self control unknown-vector38 z) (-> self control unknown-vector37 z))) + ) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-hit-ground #f) + ) + ) + :code (behavior ((arg0 vector) (arg1 vector) (arg2 object)) + (let ((a0-1 (-> self control did-move-to-pole-or-max-jump-height))) + (when a0-1 + (let ((s5-0 (res-lump-struct (the-as res-lump a0-1) 'camera-name string))) + (when s5-0 + (logclear! (-> self target-flags) (target-flags tf6)) + (process-spawn-function + process + (lambda :behavior process + ((arg0 string)) + (local-vars (a1-2 event-message-block)) + (add-setting! 'entity-name arg0 0.0 0) + (until (send-event-function *camera* a1-2) + (suspend) + (set! a1-2 (new 'stack-no-clear 'event-message-block)) + (let ((v1-2 (process->ppointer self))) + (set! (-> a1-2 from) v1-2) + ) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'intro-done?) + ) + #f + ) + s5-0 + :to self + ) + ) + ) + ) + ) + (let ((v1-12 (-> self control root-prim))) + (set! (-> self control backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> self control backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (let ((v1-15 (-> self control root-prim))) + (set! (-> v1-15 prim-core collide-as) (collide-spec)) + (set! (-> v1-15 prim-core collide-with) (collide-spec)) + ) + 0 + (ja-channel-set! 0) + (vector-reset! (-> self control transv)) + (move-to-point! (-> self control) (-> self control unknown-vector37)) + (let ((s5-1 (current-time))) + (while (or (not (time-elapsed? s5-1 (seconds 1))) + (< 81920.0 (vector-vector-distance (camera-pos) (-> self control trans))) + ) + (suspend) + ) + ) + (set-heading-vec! (-> self control) (-> self control transv)) + (rot->dir-targ! (-> self control)) + (set-time! (-> self state-time)) + (set! (-> self post-hook) target-no-stick-post) + (ja-channel-set! 1) + (send-event + (if arg2 + (-> (the-as process arg2) child 3) + ) + 'effect + ) + (send-event self 'draw #t) + (sound-play "warpgate-tele") + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 42.0 0)) :frame-num (ja-aframe 40.0 0)) + (until (ja-done? 0) + (let ((v1-58 (new-stack-vector0))) + (let ((f0-5 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-58 (-> self control transv) (vector-float*! v1-58 (-> self control dynam gravity-normal) f0-5)) + ) + (let* ((f0-6 (vector-length v1-58)) + (f1-1 f0-6) + (f2-3 + (- (sqrtf (* 4096.0 (-> self control dynam gravity-length))) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-3) + (vector-float*! v1-58 v1-58 (/ f0-6 f1-1)) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 42.0 0))) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 50.0 0)) :frame-num (ja-aframe 42.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 50.0 0))) + ) + (let ((v1-79 (-> self control root-prim))) + (set! (-> v1-79 prim-core collide-as) (-> self control backup-collide-as)) + (set! (-> v1-79 prim-core collide-with) (-> self control backup-collide-with)) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek!) :frame-num (ja-aframe 50.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (target-falling-anim -1 (seconds 0.33)) + ) + :post target-no-move-post + ) + +(defskelgroup skel-air-train air-train air-train-lod0-jg air-train-idle-ja + ((air-train-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 -2 12.5) + :shadow-joint-index 3 + ) + +(deftype air-train (warp-gate) + ((part-exhaust-left sparticle-launch-control) + (part-exhaust-right sparticle-launch-control) + (part-dust sparticle-launch-control) + (dust-y float) + (hover-sound sound-id) + (base-pos vector :inline) + ) + ) + + +;; WARN: Return type mismatch warp-gate vs air-train. +(defmethod relocate ((this air-train) (offset int)) + (if (nonzero? (-> this part-exhaust-left)) + (&+! (-> this part-exhaust-left) offset) + ) + (if (nonzero? (-> this part-exhaust-right)) + (&+! (-> this part-exhaust-right) offset) + ) + (if (nonzero? (-> this part-dust)) + (&+! (-> this part-dust) offset) + ) + (the-as air-train ((method-of-type warp-gate relocate) this offset)) + ) + +(defmethod deactivate ((this air-train)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (sound-stop (-> this hover-sound)) + (if (nonzero? (-> this part-exhaust-left)) + (kill-particles (-> this part-exhaust-left)) + ) + (if (nonzero? (-> this part-exhaust-right)) + (kill-particles (-> this part-exhaust-right)) + ) + (if (nonzero? (-> this part-dust)) + (kill-particles (-> this part-dust)) + ) + ((method-of-type warp-gate deactivate) this) + (none) + ) + +;; WARN: Return type mismatch draw-control vs none. +(defmethod init-skel-and-collide! ((this air-train)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 69632.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set! (-> v1-13 transform-index) 6) + (set-vector! (-> v1-13 local-sphere) 0.0 10240.0 0.0 24576.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 53248.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-air-train" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (none) + ) + +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-defaults! ((this air-train)) + (let ((t9-0 (method-of-type warp-gate init-defaults!))) + (t9-0 this) + ) + (set! (-> this base-pos quad) (-> this root trans quad)) + (let ((v1-2 (-> this level-name))) + (set! (-> this dust-y) (cond + ((= v1-2 'nest) + -1105.92 + ) + ((= v1-2 'caspad) + 114647.04 + ) + (else + (the-as float #x7f800000) + ) + ) + ) + ) + (set! (-> this part-exhaust-left) (create-launch-control (-> *part-group-id-table* 206) this)) + (set! (-> this part-exhaust-right) (create-launch-control (-> *part-group-id-table* 206) this)) + (set! (-> this part-dust) (create-launch-control (-> *part-group-id-table* 204) this)) + (set! (-> this root pause-adjust-distance) 368640.0) + (set! (-> this hover-sound) (sound-play "air-train")) + (none) + ) + +(defstate idle (air-train) + :virtual #t + :post (behavior () + (let ((t9-0 (-> (method-of-type warp-gate idle) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (set! (-> self root trans y) (+ (-> self base-pos y) + (* 696.32 (cos (* 66.19798 (the float (mod (current-time) 990))))) + (* 450.56 (cos (* 42.25403 (the float (mod (current-time) 1551))))) + ) + ) + (sparticle-launch-control-method-18 (-> self part-exhaust-left) (joint-node air-train-lod0-jg thruster_l)) + (sparticle-launch-control-method-18 (-> self part-exhaust-right) (joint-node air-train-lod0-jg thruster_r)) + (let ((f0-9 (-> self dust-y))) + (when (!= f0-9 (the-as float #x7f800000)) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) f0-9) + (spawn (-> self part-dust) a1-2) + ) + ) + ) + (sound-play "air-train" :id (-> self hover-sound) :position (-> self root trans)) + ) + ) + +(defstate use (air-train) + :virtual #t + :code (behavior ((arg0 continue-point)) + (kill-current-talker '() '() 'exit) + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not arg0) + (process-release? *target*) + (go-virtual idle) + ) + (set-setting! 'allow-progress #f 0.0 0) + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) #t) + (apply-settings *setting-control*) + (sound-stop (-> self hover-sound)) + (set! (-> self hover-sound) (new 'static 'sound-id)) + (script-eval (-> self on-activate)) + (sleep-code) + ) + ) + +(load-scene (new 'static 'scene + :name "desert-air-train-in" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "air-train-5" + :art-group "scenecamera" + :anim "desert-air-train-in" + :parts 4 + :command-list '((0 + (kill "air-train-5") + (fadein (frame-time-30 10)) + (apply ,(lambda () (kill-by-type v-marauder *active-pool*))) + ) + (260 + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 260 475) + ) + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 260 475) + ) + ) + (270 (part-tracker + "group-warp-fma-dust-takeoff" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 270 475) + ) + ) + (350 + (part-tracker + "group-warp-thruster-trail" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 350 475) + subsample-num + (new 'static 'bfloat :data 5.0) + ) + (part-tracker + "group-warp-thruster-trail" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 350 475) + subsample-num + (new 'static 'bfloat :data 5.0) + ) + ) + (475 (fadeout (frame-time-30 5))) + ) + :cut-list '(285) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'warpcast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min 290)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'warpcast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min 290)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'warpcast + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'desertb + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "desert-warp" + :end-point "ctyport-warp" + :borrow '() + :sfx-volume 0.75 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running #f + :on-complete #f + ) + ) + +(load-scene (new 'static 'scene + :name "desert-air-train-out" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "air-train-5" + :art-group "scenecamera" + :anim "desert-air-train-out" + :parts 3 + :command-list '((0 (kill "air-train-5") (fadein (frame-time-30 10))) + (1 + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 1 200) + ) + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 1 200) + ) + ) + (65 (part-tracker + "group-warp-fma-dust-takeoff" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 65 172) + ) + ) + (290 (fadeout (frame-time-30 5))) + ) + :cut-list '(180) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'warpcast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((180 max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'warpcast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((180 max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'warpcast + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'desertb + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "desert-warp" + :end-point "desert-warp" + :borrow '() + :sfx-volume 0.75 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running #f + :on-complete #f + ) + ) + +(load-scene (new 'static 'scene + :name "city-air-train-out" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "scene-stage-87" + :art-group "scenecamera" + :anim "city-air-train-out" + :parts 2 + :command-list '((0 (kill "air-train-1") (fadein (frame-time-30 10))) (235 (fadeout (frame-time-30 5)))) + :cut-list '(98 188) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'citycast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '(((min max) set-flags local-space)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'citycast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'ctyport + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "ctyport-air-train" + :end-point "ctyport-warp" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running '(begin + (sound-play-loop "port-amb-mov") + (sound-play-loop "port-water-mov") + (sound-play-loop "port-gulls-mov") + ) + :on-complete #f + ) + ) + +(load-scene (new 'static 'scene + :name "city-air-train-in-desert" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "scene-stage-87" + :art-group "scenecamera" + :anim "city-air-train-in-desert" + :parts 3 + :command-list '((0 (kill "air-train-1") (fadein (frame-time-30 10))) (275 (fadeout (frame-time-30 5)))) + :cut-list '(51 102 226) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'citycast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min 226)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '(((min max) set-flags local-space)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'citycast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'ctyport + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '((min max)) + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "ctyport-warp" + :end-point "desert-warp" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running '(begin + (sound-play-loop "port-amb-mov") + (sound-play-loop "port-water-mov") + (sound-play-loop "port-gulls-mov") + ) + :on-complete #f + ) + ) + +(defpartgroup group-warp-fma-dust-takeoff + :id 208 + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 64) + :parts ((sp-item 844 :flags (sp7))) + ) + +(defpart 844 + :init-specs ((:texture (dirtpuff01 level-default-sprite)) + (:birth-func 'birth-func-curve) + (:num 5.0) + (:x (meters 0) (meters 3)) + (:scale-x (meters 0.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 100.0) + (:b 60.0) + (:a 0.0) + (:vel-x (meters 0.033333335) (meters 0.06666667)) + (:accel-y (meters 0) (meters 0.00016666666)) + (:timer (seconds 3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 launch-along-z)) + (:userdata 0.0) + (:func 'live-func-curve) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +(if #t + (set! *range-warp-dust-color* (new 'static 'curve-color-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'inline-array vector 4 + (new 'static 'vector :x 140.0 :y 120.0 :z 80.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + ) + :one-over-x-deltas (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *range-warp-dust-alpha* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 32.0 :y 40.0 :z 41.0 :w 42.0) + :one-over-x-deltas (new 'static 'vector :x 8.0 :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *range-warp-dust-scale-x* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 3.0 :y 3.3 :z 4.3 :w 5.3) + :one-over-x-deltas (new 'static 'vector :x 0.29999995 :y 1.0000002 :z 1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *range-warp-dust-scale-y* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 3.0 :y 3.3 :z 4.3 :w 5.3) + :one-over-x-deltas (new 'static 'vector :x 0.29999995 :y 1.0000002 :z 1.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *curve-warp-dust-alpha* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.1 :z -0.5 :w -1.0) + :ys (new 'static 'vector :y 1.0 :z 1.0) + :one-over-x-deltas (new 'static 'vector :x 10.0 :z -2.0 :w 1.0) + ) + ) + ) + +(if #t + (set! *curve-warp-dust-scale-x* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.4 :w -1.0) + :ys (new 'static 'vector :y 5.0 :z 6.0 :w 6.5) + :one-over-x-deltas (new 'static 'vector :x 16.666666 :y 10.000001 :z 0.8333333 :w 1.0) + ) + ) + ) + +(if #t + (set! *curve-warp-dust-scale-y* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.4 :w -1.0) + :ys (new 'static 'vector :y 5.0 :z 6.0 :w 6.5) + :one-over-x-deltas (new 'static 'vector :x 16.666666 :y 10.000001 :z 0.8333333 :w 1.0) + ) + ) + ) + +(define *part-warp-fma-dust-takeoff-curve-settings* (new 'static 'particle-curve-settings + :lifetime-base (seconds 5) + :lifetime-offset (seconds 2) + :flags (particle-curve-flags pcf0) + ) + ) + +(set! (-> *part-id-table* 844 init-specs 15 initial-valuef) + (the-as float *part-warp-fma-dust-takeoff-curve-settings*) + ) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* color-start) *range-warp-dust-color*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* alpha-start) *range-warp-dust-alpha*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-x-start) *range-warp-dust-scale-x*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-y-start) *range-warp-dust-scale-y*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* r-scalar) #f) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* g-scalar) #f) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* b-scalar) #f) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* a-scalar) *curve-warp-dust-alpha*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-x-scalar) *curve-warp-dust-scale-x*) + +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-y-scalar) *curve-warp-dust-scale-y*) + +(defpartgroup group-warp-fma-drop-thrusters + :id 209 + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 640) + :parts ((sp-item 845 :flags (sp7)) + (sp-item 846 :flags (sp7) :period (seconds 0.017) :length (seconds 0.017)) + (sp-item 847 :flags (sp7) :period (seconds 0.017) :length (seconds 0.017)) + ) + ) + +(defpart 845 + :init-specs ((:num 1.0) + (:x (meters -2) (meters 4)) + (:y (meters -2) (meters 4)) + (:z (meters -2) (meters 4)) + (:rot-x 5) + (:r 20480.0) + (:g 10240.0) + (:b 8192.0 4096.0) + (:timer (seconds 0.5)) + (:flags (distort launch-along-z)) + ) + ) + +(defpart 846 + :init-specs ((:texture (colorflash level-default-sprite)) + (:num 4.0) + (:scale-x (meters 2) (meters 2)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 200.0) + (:b 128.0) + (:a 40.0 10.0) + (:vel-y (meters 0.1)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + +(defpart 847 + :init-specs ((:texture (glow level-default-sprite)) + (:num 3.0) + (:scale-x (meters 6) (meters 1)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 100.0 28.0) + (:b 0.0) + (:a 8.0 8.0) + (:vel-y (meters 0.1)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + +(defpartgroup group-warp-thruster-trail + :id 210 + :flags (sp0 sp4 sp13) + :bounds (static-bspherem 0 0 0 640) + :parts ((sp-item 848 :flags (sp7))) + ) + +(defpart 848 + :init-specs ((:texture (big-cloud level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 80.0 100.0) + (:g :copy r) + (:b :copy r) + (:a 20.0 10.0) + (:vel-y (meters 0.1)) + (:scalevel-x (meters 0.016666668) (meters 0.016666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.05 -0.05) + (:friction 0.9) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) diff --git a/goal_src/jak3/engine/common-obs/water-anim.gc b/goal_src/jak3/engine/common-obs/water-anim.gc index 942896a863c..49ca43dbb58 100644 --- a/goal_src/jak3/engine/common-obs/water-anim.gc +++ b/goal_src/jak3/engine/common-obs/water-anim.gc @@ -5,5 +5,435 @@ ;; name in dgo: water-anim ;; dgos: GAME +;; +++wanim-look +(defenum wanim-look + :type int32 + (nst-lake 0) + (forb-foresta 1) + (fora-forestb 2) + (fora-forestc 3) + (fora-forestd 4) + (fora-foreste 5) + (fora-forestf 6) + (waspala-thronesec 7) + (waspala-windowwall 8) + (waspala-frontthrone 9) + (waspala-frontwindowwall 10) + ) +;; ---wanim-look + + ;; DECOMP BEGINS +(deftype water-anim (process-drawable) + ((water-height meters) + (wade-height meters) + (swim-height meters) + (bottom-height meters) + (attack-event symbol) + (attack-id uint32) + (flow flow-control) + (target handle) + (flags water-flag) + (look wanim-look) + (play-ambient-sound? symbol) + (visible symbol) + ) + (:state-methods + unknown + idle + ) + (:methods + (move-to-point! (_type_ vector) int) + (get-ripple-height (_type_ vector) float) + (init-water! (_type_) object) + (alloc-root! (_type_) none) + (water-anim-init! (_type_) none) + (stub (_type_) none) + (set-offset-and-look! (_type_) none) + ) + ) + + +(defmethod relocate ((this water-anim) (offset int)) + (if (nonzero? (-> this flow)) + (&+! (-> this flow) offset) + ) + (call-parent-method this offset) + ) + +(defskelgroup skel-water-anim-nst-lake water-anim-nst water-anim-nst-lake-lod0-jg -1 + ((water-anim-nst-lake-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 300) + ) + +(defskelgroup skel-water-anim-forb-foresta water-anim-forb 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-fora-forestb water-anim-fora 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-fora-forestc water-anim-fora 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-fora-forestd water-anim-fora 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-fora-foreste water-anim-fora 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-fora-forestf water-anim-fora 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-waspala-thronesec water-anim-waspala water-anim-waspala-thronesec-lod0-jg -1 + ((water-anim-waspala-thronesec-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-waspala-windowwall water-anim-waspala water-anim-waspala-windowwall-lod0-jg -1 + ((water-anim-waspala-windowwall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-waspala-frontthrone water-anim-waspala water-anim-waspala-frontthrone-lod0-jg -1 + ((water-anim-waspala-frontthrone-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(defskelgroup skel-water-anim-waspala-frontwindowwall water-anim-waspala water-anim-waspala-frontwindowwall-lod0-jg -1 + ((water-anim-waspala-frontwindowwall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +(deftype water-anim-look (structure) + ((skel-group string) + (anim int32) + (ambient-sound-spec sound-spec) + ) + ) + + +(define *water-anim-look* + (new 'static 'boxed-array :type water-anim-look + (new 'static 'water-anim-look :skel-group "water-anim-nst-lake" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-forb-foresta" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestb" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestc" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestd" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-foreste" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestf" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-thronesec" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-windowwall" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-frontthrone" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-frontwindowwall" :anim 8 :ambient-sound-spec #f) + ) + ) + +(defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-1 object)) + (case arg2 + (('move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('move-to-y) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) + (move-to-point! self a1-2) + ) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('water) + (let* ((s5-0 (the-as object (-> arg3 param 0))) + (s4-0 (-> arg3 param 1)) + (gp-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flag deadly)) + (logtest? (water-flag touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) + ) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (focus-test? (the-as process-focusable gp-0) board)) + (send-event + (the-as process-tree gp-0) + 'attack-invinc + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode v1-15)) + ) + ) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (focus-test? (the-as process-focusable gp-0) board)) + (send-event + (the-as process-tree gp-0) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode v1-15)) + ) + ) + ) + (send-event self 'notify 'attack) + ) + ) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flag flow)) + (logtest? (water-flag touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + (push-process a0-40 (the-as process-focusable gp-0)) + ) + ) + ) + ) + ) + (('visible) + (cond + ((-> arg3 param 0) + (set! (-> self visible) #t) + ) + (else + (set! (-> self visible) #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) + ) + ) + +(defstate idle (water-anim) + :virtual #t + :event water-anim-event-handler + :trans (behavior () + (let ((a0-0 (-> self flow))) + (if (and (nonzero? a0-0) *display-vol-marks*) + (draw-path a0-0) + ) + ) + (cond + ((not (-> self visible)) + ) + ((< (-> (math-camera-pos) y) (+ -8192.0 (-> self root trans y))) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (if (and (-> self visible) (and (-> self play-ambient-sound?) (nonzero? (-> self sound)))) + (update! (-> self sound)) + ) + ) + :code (behavior () + (until #f + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + ) + ) + +(defmethod move-to-point! ((this water-anim) (arg0 vector)) + (set! (-> this root trans quad) (-> arg0 quad)) + (set! (-> this water-height) (-> this root trans y)) + (if (nonzero? (-> this sound)) + (update-trans! (-> this sound) (-> this root trans)) + ) + ) + +(defmethod get-ripple-height ((this water-anim) (arg0 vector)) + (ripple-find-height this 0 arg0) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod stub ((this water-anim)) + (none) + ) + +;; WARN: Return type mismatch quaternion vs none. +(defmethod set-offset-and-look! ((this water-anim)) + (local-vars (sv-16 res-tag)) + (set! (-> this play-ambient-sound?) #t) + (set! (-> this visible) #t) + (set! (-> this look) + (res-lump-value (-> this entity) 'look wanim-look :default (the-as uint128 -1) :time -1000000000.0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (when v1-4 + (+! (-> this root trans x) (-> v1-4 x)) + (+! (-> this root trans y) (-> v1-4 y)) + (+! (-> this root trans z) (-> v1-4 z)) + ) + ) + (let ((f0-6 (res-lump-float (-> this entity) 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-6) + ) + ) + (none) + ) + +;; WARN: Return type mismatch none vs object. +(defmethod init-water! ((this water-anim)) + (let ((s5-0 (-> this look))) + (if (or (< (the-as int s5-0) 0) (>= (the-as int s5-0) (-> *water-anim-look* length))) + (go process-drawable-art-error "skel group") + ) + (let ((s5-1 (-> *water-anim-look* s5-0))) + (initialize-skeleton-by-name this (-> s5-1 skel-group)) + (ja-channel-set! 1) + (let ((s4-0 (-> this skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> this draw art-group data (-> s5-1 anim))) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((a2-1 (-> s5-1 ambient-sound-spec))) + (when a2-1 + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector+! a3-0 (-> this root trans) (-> this draw bounds)) + (set! (-> this sound) (new 'process 'ambient-sound a2-1 a3-0 0.0)) + ) + ) + ) + ) + ) + (ja-post) + ) + +;; WARN: Return type mismatch trsqv vs none. +(defmethod alloc-root! ((this water-anim)) + (set! (-> this root) (new 'process 'trsqv)) + (none) + ) + +;; WARN: Return type mismatch water-flag vs none. +(defmethod water-anim-init! ((this water-anim)) + (local-vars (sv-16 res-tag)) + (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) + (-> this entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'drown) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! this (-> this entity)) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this vol) (new 'process 'vol-control this)) + (logior! (-> this vol flags) (vol-flags display? vol-flags-1)) + (set! (-> this bottom-height) 32768.0) + (let* ((v1-8 *game-info*) + (a0-7 (+ (-> v1-8 attack-id) 1)) + ) + (set! (-> v1-8 attack-id) a0-7) + (set! (-> this attack-id) a0-7) + ) + (set! (-> this target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> this entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-10 + (set! (-> this water-height) (-> v1-10 0)) + (set! (-> this wade-height) (-> v1-10 1)) + (set! (-> this swim-height) (-> v1-10 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> this flags) (the-as water-flag (the int (-> v1-10 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> this bottom-height) (-> v1-10 4)) + ) + ) + ) + (logior! (-> this flags) (water-flag part-water)) + (if (logtest? (-> this flags) (water-flag flow)) + (set! (-> this flow) (new 'process 'flow-control this (the-as res-lump #f))) + ) + (cond + ((zero? (-> this flags)) + (if (< 0.0 (-> this wade-height)) + (logior! (-> this flags) (water-flag can-wade)) + ) + (if (< 0.0 (-> this swim-height)) + (logior! (-> this flags) (water-flag can-swim)) + ) + ) + (else + ) + ) + (none) + ) + +(defbehavior water-anim-init-by-other water-anim ((arg0 entity-actor)) + (process-entity-set! self arg0) + (stub self) + (alloc-root! self) + (water-anim-init! self) + (set-offset-and-look! self) + (init-water! self) + (go-virtual idle) + ) + +(defmethod init-from-entity! ((this water-anim) (arg0 entity-actor)) + (stub this) + (alloc-root! this) + (water-anim-init! this) + (set-offset-and-look! this) + (init-water! this) + (go (method-of-object this idle)) + ) diff --git a/goal_src/jak3/engine/common-obs/water.gc b/goal_src/jak3/engine/common-obs/water.gc index a84f7a4e51e..72178afb8bb 100644 --- a/goal_src/jak3/engine/common-obs/water.gc +++ b/goal_src/jak3/engine/common-obs/water.gc @@ -699,66 +699,28 @@ (sp-group-flag sp13) ) (set! (-> *launch-matrix* trans quad) (-> arg1 quad)) - (let ((s4-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 - (the-as part-tracker-subsampler s4-0) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-2 run-function-in-process) - (a0-5 s4-0) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (if (zero? arg2) - (-> *part-group-id-table* 193) - (-> *part-group-id-table* 192) - ) - ) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) - (the-as (function part-tracker vector) part-water-splash-callback) - ) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint arg0)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-5 a1-3 *part-tracker-subsampler-params-default*) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (if (zero? arg2) + (-> *part-group-id-table* 193) + (-> *part-group-id-table* 192) ) - (-> s4-0 ppointer) - ) + :callback (the-as (function part-tracker vector) part-water-splash-callback) + :userdata (the-as uint arg0) ) ) (else (set! (-> *launch-matrix* trans quad) (-> arg1 quad)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker s4-1) *entity-pool* "part-tracker" (the-as pointer #x70004000)) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (if (zero? arg2) + (-> *part-group-id-table* 193) + (-> *part-group-id-table* 192) ) - (let ((t9-5 run-function-in-process) - (a0-10 s4-1) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (if (zero? arg2) - (-> *part-group-id-table* 193) - (-> *part-group-id-table* 192) - ) - ) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) - (the-as (function part-tracker vector) part-water-splash-callback) - ) - (set! (-> *part-tracker-params-default* userdata) (the-as uint arg0)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-10 a1-6 *part-tracker-params-default*) - ) - (-> s4-1 ppointer) - ) + :callback (the-as (function part-tracker vector) part-water-splash-callback) + :userdata (the-as uint arg0) ) ) ) diff --git a/goal_src/jak3/engine/entity/entity-h.gc b/goal_src/jak3/engine/entity/entity-h.gc index 9136acf1f94..580d58a5923 100644 --- a/goal_src/jak3/engine/entity/entity-h.gc +++ b/goal_src/jak3/engine/entity/entity-h.gc @@ -39,6 +39,7 @@ (define-extern process-drawable-from-entity! (function process-drawable entity-actor none)) (define-extern init-entity (function process entity-actor type none)) (define-extern entity-by-type (function type entity-actor)) +(define-extern entity-actor-from-level-name (function symbol entity-actor)) (define-extern *spawn-actors* symbol) diff --git a/goal_src/jak3/engine/game/effect-control-h.gc b/goal_src/jak3/engine/game/effect-control-h.gc index 3fed7b2913a..3662653794f 100644 --- a/goal_src/jak3/engine/game/effect-control-h.gc +++ b/goal_src/jak3/engine/game/effect-control-h.gc @@ -48,10 +48,10 @@ (new (symbol type process-drawable) _type_) (effect-control-method-9 (_type_) none) (do-effect (_type_ symbol float int) none) - (effect-control-method-11 () none) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none) (play-effect-sound (_type_ symbol float int basic sound-name) int) (set-channel-offset! (_type_ int) none) - (effect-control-method-14 () none) + (play-effects-from-res-lump (_type_ float float float) none) ) ) diff --git a/goal_src/jak3/engine/game/effect-control.gc b/goal_src/jak3/engine/game/effect-control.gc index fd8878caa07..9ad57dd85df 100644 --- a/goal_src/jak3/engine/game/effect-control.gc +++ b/goal_src/jak3/engine/game/effect-control.gc @@ -7,3 +7,1080 @@ ;; DECOMP BEGINS +(define *footstep-surface* (the-as object 7168)) + +(define *debug-effect-control* #f) + +(defun sound-name-with-material ((arg0 string) (arg1 pat-surface) (arg2 string)) + (format + (clear *temp-string*) + "~S~S~S" + arg0 + (-> (new 'static 'boxed-array :type string + "-unk" + "-ice" + "-qsd" + "-wtr" + "-tar" + "-san" + "-wod" + "-grs" + "-pmt" + "-snw" + "-dsn" + "-unk" + "-lav" + "-cwd" + "-grv" + "-drt" + "-mtl" + "-str" + "-pmt" + "-swm" + "-unk" + "-mtl" + "-neu" + "-stn" + "-cmt" + "-car" + "-gmt" + "-smt" + "-hwd" + "-sqi" + "-mhm" + "-for" + "-mhs" + "-dma" + ) + (-> arg1 material) + ) + arg2 + ) + (string->sound-name *temp-string*) + ) + +(defun effect-param->sound-spec ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int) (arg3 process-focusable)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) (sound-mask volume)) + (set! (-> arg0 volume) (the int (* 1024.0 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) (sound-mask volume)) + (+! (-> arg0 volume) (the int (* 1024.0 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) (sound-mask pitch)) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) (sound-mask pitch)) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) (sound-mask bend)) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) (sound-mask bend)) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) (sound-mask fo-min)) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) (sound-mask fo-max)) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) (sound-mask fo-curve)) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ((25) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (shr (shl (the-as int *footstep-surface*) 48) 58))) + (let* ((s2-3 arg3) + (v1-33 (if (type? s2-3 process-focusable) + s2-3 + ) + ) + ) + (when v1-33 + (cond + ((focus-test? v1-33 in-air) + (set! (-> arg0 reg 0) (the-as uint 126)) + ) + ((focus-test? v1-33 touch-water) + (set! (-> arg0 reg 0) (the-as uint 127)) + ) + (else + (let* ((s2-4 (-> v1-33 root)) + (v1-34 (if (type? s2-4 collide-shape-moving) + s2-4 + ) + ) + ) + (if v1-34 + (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) + ) + ) + ) + ) + ) + ) + ) + ((21) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (the int (-> arg1 1)))) + ) + ((22) + (logior! (-> arg0 mask) (sound-mask reg1)) + (set! (-> arg0 reg 1) (the-as uint (the int (-> arg1 1)))) + ) + ((23) + (logior! (-> arg0 mask) (sound-mask reg2)) + (set! (-> arg0 reg 2) (the-as uint (the int (-> arg1 1)))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +(defmethod effect-control-method-9 ((this effect-control)) + (let* ((a0-1 (-> this process skel)) + (v1-3 (if (< (the-as uint (-> this channel-offset)) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> this channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 (+ (* (-> v1-3 frame-num) (-> s5-0 artist-step)) (-> s5-0 artist-base))) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> this last-frame-group)) + (set! (-> this res) (-> s5-0 extra)) + (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) + (set! (-> this name) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) + (set! (-> this name) (&-> (-> this name) 1)) + ) + (play-effects-from-res-lump this f30-0 f30-0 f30-0) + ) + ((or (not (-> this name)) (= f30-0 (-> this last-frame-num))) + ) + (else + (let ((f28-0 (-> this last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let ((f0-6 (+ (* (-> v1-3 param 0) (-> s5-0 artist-step)) (-> s5-0 artist-base)))) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((or (= a0-3 num-func-loop!) (= a0-3 num-func-loop-speedless!) (= a0-3 num-func-loop-set!)) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (play-effects-from-res-lump this f28-0 9999999.0 f30-0) + (play-effects-from-res-lump this -100000000.0 f26-0 9999999.0) + ) + (else + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (play-effects-from-res-lump this f26-0 9999999.0 f30-0) + (play-effects-from-res-lump this -100000000.0 f28-0 9999999.0) + ) + (else + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (play-effects-from-res-lump this f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> this last-frame-group) s5-0) + (set! (-> this last-frame-num) f30-0) + ) + ) + (else + (set! (-> this last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +(defmethod play-effects-from-res-lump ((this effect-control) (arg0 float) (arg1 float) (arg2 float)) + (let ((s2-0 (-> this name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 this) + (t9-0 (method-of-object a0-1 do-effect)) + (v1-7 (-> this res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as symbol (-> (the-as (pointer int32) (&+ (-> v1-7 data-base) (-> a1-1 data-offset))))) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + 0 + (none) + ) + +;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. +(defmethod do-effect ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars (sv-288 res-lump)) + (let* ((v1-2 (rtype-of arg0)) + (s3-0 (the-as string (cond + ((= v1-2 symbol) + (symbol->string arg0) + ) + ((= v1-2 string) + arg0 + ) + (else + #f + ) + ) + ) + ) + ) + (cond + ((logtest? (-> this flags) (effect-control-flag ecf2)) + (return #f) + ) + ((string= s3-0 "script") + (let ((gp-1 (get-property-struct + (-> this res) + 'effect-script + 'exact + arg1 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (script-eval (the-as pair gp-1)) + ) + (return #f) + ) + ) + (set! arg2 (cond + ((< arg2 0) + (let ((v0-7 (get-property-value + (-> this res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-7) + 0 + (the-as int (+ v0-7 1)) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + (when (logtest? (-> this flags) (effect-control-flag ecf0)) + (if (send-event (-> this process) 'effect-control s3-0 arg1 arg2) + (return 0) + ) + ) + (cond + ((and (= (-> s3-0 data 0) 101) + (= (-> s3-0 data 1) 102) + (= (-> s3-0 data 2) 102) + (= (-> s3-0 data 3) 101) + (= (-> s3-0 data 4) 99) + (= (-> s3-0 data 5) 116) + (= (-> s3-0 data 6) 45) + ) + (let* ((s2-0 (-> this process root)) + (v1-38 (if (type? s2-0 collide-shape-moving) + s2-0 + ) + ) + (t1-2 (if v1-38 + (-> (the-as collide-shape-moving v1-38) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface this (the-as symbol s3-0) arg1 arg2 (-> this res) (the-as pat-surface t1-2)) + ) + ) + ((and (= (-> s3-0 data 0) 103) + (= (-> s3-0 data 1) 114) + (= (-> s3-0 data 2) 111) + (= (-> s3-0 data 3) 117) + (= (-> s3-0 data 4) 112) + (= (-> s3-0 data 5) 45) + ) + (let ((s2-1 (lookup-part-group-by-name s3-0))) + (when (and (nonzero? s2-1) s2-1 (= (-> s2-1 type) sparticle-launch-group)) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (current-time) + (-> this process name) + s3-0 + arg1 + arg2 + ) + ) + (cond + ((logtest? (-> s2-1 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (part-tracker-spawn part-tracker-subsampler :to (-> this process) :group s2-1) + ) + (else + (set! (-> *launch-matrix* trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (part-tracker-spawn part-tracker :to (-> this process) :group s2-1) + ) + ) + ) + ) + ) + ((and (= (-> s3-0 data 0) 101) + (= (-> s3-0 data 1) 118) + (= (-> s3-0 data 2) 101) + (= (-> s3-0 data 3) 110) + (= (-> s3-0 data 4) 116) + (= (-> s3-0 data 5) 45) + ) + (send-event (-> this process) (string->symbol s3-0) arg1 arg2) + ) + ((string= s3-0 "camera-shake") + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((and (= (-> s3-0 data 0) 100) + (= (-> s3-0 data 1) 101) + (= (-> s3-0 data 2) 97) + (= (-> s3-0 data 3) 116) + (= (-> s3-0 data 4) 104) + (= (-> s3-0 data 5) 45) + ) + (let ((s3-1 (-> (string->symbol s3-0) value))) + (when (and (logtest? (-> this flags) (effect-control-flag ecf1)) + (zero? (-> this process draw death-timer)) + (= (-> (the-as death-info s3-1) type) death-info) + ) + (let ((v1-131 (-> this process draw))) + (let ((a1-25 (-> (the-as death-info s3-1) vertex-skip)) + (a0-59 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-1) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-25) + (set! a1-25 (/ (the-as uint (* (the-as uint 50) a1-25)) (the-as uint 60))) + ) + ) + (let ((a2-29 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< 9000 (the-as int a2-29)) + (set! a1-25 (* a1-25 4)) + ) + ((< 7000 (the-as int a2-29)) + (set! a1-25 (* a1-25 2)) + ) + ) + ) + (set! (-> v1-131 death-vertex-skip) a1-25) + (set! (-> v1-131 death-effect) (-> (the-as death-info s3-1) effect)) + (set! (-> v1-131 death-timer) (the-as uint (+ a0-59 1))) + ) + (set! (-> v1-131 death-timer-org) (-> v1-131 death-timer)) + (set! (-> v1-131 death-draw-overlap) (-> (the-as death-info s3-1) overlap)) + ) + (when (-> (the-as death-info s3-1) sound) + (let* ((s2-3 this) + (s1-0 (method-of-object s2-3 play-effect-sound)) + (s0-0 (-> (the-as death-info s3-1) sound)) + ) + (set! sv-288 (-> this res)) + (let ((t1-5 (string->sound-name (the-as string (-> (the-as death-info s3-1) sound))))) + (s1-0 s2-3 s0-0 arg1 arg2 sv-288 t1-5) + ) + ) + ) + (send-event (-> this process) 'death-start (the-as death-info s3-1)) + ) + ) + ) + (else + (play-effect-sound this (the-as symbol s3-0) arg1 arg2 (-> this res) (string->sound-name s3-0)) + ) + ) + ) + 0 + (none) + ) + +(defmethod do-effect-for-surface ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) + (local-vars + (sv-64 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-80 sparticle-system) + (sv-96 vector) + (sv-112 matrix) + (sv-128 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-144 sparticle-system) + (sv-160 vector) + (sv-176 matrix) + (sv-192 symbol) + (sv-208 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-224 sparticle-system) + (sv-240 vector) + (sv-256 matrix) + ) + (let ((s1-0 (the-as sound-name #f))) + (-> *display* frames (-> *display* last-screen) run-time) + (set! sv-192 arg0) + (cond + ((string= (the-as string sv-192) "effect-walk-step-left") + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-run-step-left") + (set! s1-0 (sound-name-with-material "run" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-mech-step-left") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-walk-step-right") + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-run-step-right") + (set! s1-0 (sound-name-with-material "run" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-mech-step-right") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-roll") + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-slide") + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land") + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-land") + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-hit") + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-flut-land") + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-land-poof-unk" + "group-land-poof-ice" + "group-land-poof-qsd" + "group-land-poof-wtr" + "group-land-poof-tar" + "group-land-poof-san" + "group-land-poof-wod" + "group-land-poof-grs" + "group-land-poof-pmt" + "group-land-poof-snw" + "group-land-poof-dsn" + "group-land-poof-unk" + "group-land-poof-lav" + "group-land-poof-cwd" + "group-land-poof-grv" + "group-land-poof-drt" + "group-land-poof-mtl" + "group-land-poof-str" + "group-land-poof-pmt" + "group-land-poof-swm" + "group-land-poof-unk" + "group-land-poof-mtl" + "group-land-poof-neu" + "group-land-poof-stn" + "group-land-poof-cmt" + "group-land-poof-car" + "group-land-poof-gmt" + "group-land-poof-smt" + "group-land-poof-hwd" + "group-land-poof-sqi" + "group-land-poof-mhm" + "group-land-poof-for" + "group-land-poof-mhs" + "group-land-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-run-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-run-poof-unk" + "group-run-poof-ice" + "group-run-poof-qsd" + "group-run-poof-wtr" + "group-run-poof-tar" + "group-run-poof-san" + "group-run-poof-wod" + "group-run-poof-grs" + "group-run-poof-pmt" + "group-run-poof-snw" + "group-run-poof-dsn" + "group-run-poof-unk" + "group-run-poof-lav" + "group-run-poof-cwd" + "group-run-poof-grv" + "group-run-poof-drt" + "group-run-poof-mtl" + "group-run-poof-str" + "group-run-poof-pmt" + "group-run-poof-swm" + "group-run-poof-unk" + "group-run-poof-mtl" + "group-run-poof-neu" + "group-run-poof-stn" + "group-run-poof-cmt" + "group-run-poof-car" + "group-run-poof-gmt" + "group-run-poof-smt" + "group-run-poof-hwd" + "group-run-poof-sqi" + "group-run-poof-mhm" + "group-run-poof-for" + "group-run-poof-mhs" + "group-run-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-footprint") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-just-footprint-unk" + "group-just-footprint-ice" + "group-just-footprint-qsd" + "group-just-footprint-wtr" + "group-just-footprint-tar" + "group-just-footprint-san" + "group-just-footprint-wod" + "group-just-footprint-grs" + "group-just-footprint-pmt" + "group-just-footprint-snw" + "group-just-footprint-dsn" + "group-just-footprint-unk" + "group-just-footprint-lav" + "group-just-footprint-cwd" + "group-just-footprint-grv" + "group-just-footprint-drt" + "group-just-footprint-mtl" + "group-just-footprint-str" + "group-just-footprint-pmt" + "group-just-footprint-swm" + "group-just-footprint-unk" + "group-just-footprint-mtl" + "group-just-footprint-neu" + "group-just-footprint-stn" + "group-just-footprint-cmt" + "group-just-footprint-car" + "group-just-footprint-gmt" + "group-just-footprint-smt" + "group-just-footprint-hwd" + "group-just-footprint-sqi" + "group-just-footprint-mhm" + "group-just-footprint-for" + "group-just-footprint-mhs" + "group-just-footprint-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-just-poof-unk" + "group-just-poof-ice" + "group-just-poof-qsd" + "group-just-poof-wtr" + "group-just-poof-tar" + "group-just-poof-san" + "group-just-poof-wod" + "group-just-poof-grs" + "group-just-poof-pmt" + "group-just-poof-snw" + "group-just-poof-dsn" + "group-just-poof-unk" + "group-just-poof-lav" + "group-just-poof-cwd" + "group-just-poof-grv" + "group-just-poof-drt" + "group-just-poof-mtl" + "group-just-poof-str" + "group-just-poof-pmt" + "group-just-poof-swm" + "group-just-poof-unk" + "group-just-poof-mtl" + "group-just-poof-neu" + "group-just-poof-stn" + "group-just-poof-cmt" + "group-just-poof-car" + "group-just-poof-gmt" + "group-just-poof-smt" + "group-just-poof-hwd" + "group-just-poof-sqi" + "group-just-poof-mhm" + "group-just-poof-for" + "group-just-poof-mhs" + "group-just-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-slide-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-slide-poof-unk" + "group-slide-poof-ice" + "group-slide-poof-qsd" + "group-slide-poof-wtr" + "group-slide-poof-tar" + "group-slide-poof-san" + "group-slide-poof-wod" + "group-slide-poof-grs" + "group-slide-poof-pmt" + "group-slide-poof-snw" + "group-slide-poof-dsn" + "group-slide-poof-unk" + "group-slide-poof-lav" + "group-slide-poof-cwd" + "group-slide-poof-grv" + "group-slide-poof-drt" + "group-slide-poof-mtl" + "group-slide-poof-str" + "group-slide-poof-pmt" + "group-slide-poof-swm" + "group-slide-poof-unk" + "group-slide-poof-mtl" + "group-slide-poof-neu" + "group-slide-poof-stn" + "group-slide-poof-cmt" + "group-slide-poof-car" + "group-slide-poof-gmt" + "group-slide-poof-smt" + "group-slide-poof-hwd" + "group-slide-poof-sqi" + "group-slide-poof-mhm" + "group-slide-poof-for" + "group-slide-poof-mhs" + "group-slide-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-droppings") + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x8e + #x2a9 + #x2aa + #x2ab + #x2ac + #x75 + #x8b + #x77 + #x2ad + #x79 + #x2ae + #x8e + #x2af + #x8d + #x2b0 + #x76 + #x2b1 + #x2b2 + #x2ad + #x2b3 + #x8e + #x2b1 + #x2b4 + #x8c + #x2b5 + #x2b6 + #x2b7 + #x2b8 + #x2b9 + #x2ba + #x2bb + #x78 + #x2bc + #x2bd + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-64 sp-launch-particles-var) + (set! sv-80 *sp-particle-system-2d*) + (set! sv-112 *launch-matrix*) + (set! sv-96 (-> sv-112 trans)) + (let ((v1-80 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-96 quad) v1-80) + ) + (let ((a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + ) + ) + ) + ) + ((string= (the-as string sv-192) "effect-jump-droppings") + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2be + #x2bf + #x2c0 + #x2c1 + #x2c2 + #x86 + #x2c3 + #x89 + #x2c4 + #x88 + #x2c5 + #x2be + #x2c6 + #x2c7 + #x2c8 + #x87 + #x2c9 + #x2ca + #x2c4 + #x2cb + #x2be + #x2c9 + #x2cc + #x2cd + #x2ce + #x2cf + #x2d0 + #x2d1 + #x2d2 + #x2d3 + #x2d4 + #x8a + #x2d5 + #x2d6 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-2) + (set! sv-128 sp-launch-particles-var) + (set! sv-144 *sp-particle-system-2d*) + (set! sv-176 *launch-matrix*) + (set! sv-160 (-> sv-176 trans)) + (let ((v1-97 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-160 quad) v1-97) + ) + (let ((a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + ) + ) + ) + ) + ((let ((t9-40 string=) + (a1-45 "effect-board-poof") + ) + (t9-40 (the-as string sv-192) a1-45) + ) + (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2d7 + #x2d8 + #x2d9 + #x2da + #x2db + #x2dc + #x2dd + #x2de + #x2df + #x2e0 + #x2e1 + #x2d7 + #x2e2 + #x2e3 + #x2e4 + #x2e5 + #x2e6 + #x2e7 + #x2df + #x2e8 + #x2d7 + #x2e6 + #x2e9 + #x2a2 + #x2ea + #x2eb + #x2ec + #x2ed + #x2ee + #x2ef + #x2f0 + #x2f1 + #x2f2 + #x2f3 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-3) + (set! sv-208 sp-launch-particles-var) + (set! sv-224 *sp-particle-system-2d*) + (set! sv-256 *launch-matrix*) + (set! sv-240 (-> sv-256 trans)) + (let ((v1-114 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-240 quad) v1-114) + ) + (let ((a3-8 #f) + (t0-3 #f) + (t1-3 1.0) + ) + (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + ) + ) + ) + ) + ) + (if s1-0 + (play-effect-sound this arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +(defmethod play-effect-sound ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) + (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> this process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) + ) + ) + ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) + ) + ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~S (~S) frame ~F joint ~D " + (current-time) + (-> this process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) + ) + ) + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) + ) + 0 + ) + +(defbehavior target-land-effect target () + (cond + ((focus-test? self flut) + (do-effect (-> self skel effect) (the-as symbol "effect-land-poof") -1.0 -1) + (do-effect (-> self skel effect) (the-as symbol "effect-flut-land") -1.0 -1) + ) + ((focus-test? self pilot) + (sound-play-by-name + (sound-name-with-material "zoom-land" (-> self control ground-pat) "") + (new-sound-id) + (the int (* 1024.0 (* 0.000016276043 (-> self control ground-impact-vel)))) + 0 + 0 + (sound-group) + #t + ) + ) + ((logtest? (water-flag touch-water) (-> self water flags)) + (do-effect (-> self skel effect) (the-as symbol "effect-land-water") -1.0 -1) + ) + (else + (do-effect (-> self skel effect) (the-as symbol "effect-land-poof") -1.0 -1) + (do-effect (-> self skel effect) (the-as symbol "effect-land") -1.0 -1) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/game/fact-h.gc b/goal_src/jak3/engine/game/fact-h.gc index 95980f030a8..7436ff1391e 100644 --- a/goal_src/jak3/engine/game/fact-h.gc +++ b/goal_src/jak3/engine/game/fact-h.gc @@ -440,7 +440,7 @@ (trig-mask uint8 2) ) (:methods - (new (symbol type process (pointer float) pickup-type float) _type_) + (new (symbol type process (pointer float)) _type_) (clear-mask-bits (_type_ int) none) ) ) @@ -520,13 +520,7 @@ (new 'static 'fact-info-enemy-defaults :idle-distance (meters 80) :pickup-type 9) ) -(defmethod new fact-info-enemy ((allocation symbol) - (type-to-make type) - (arg0 process) - (arg1 (pointer float)) - (arg2 pickup-type) - (arg3 float) - ) +(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (arg0 process) (arg1 (pointer float))) (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as diff --git a/goal_src/jak3/engine/game/idle-control.gc b/goal_src/jak3/engine/game/idle-control.gc index 9b6488a5af5..c1754850a71 100644 --- a/goal_src/jak3/engine/game/idle-control.gc +++ b/goal_src/jak3/engine/game/idle-control.gc @@ -5,5 +5,123 @@ ;; name in dgo: idle-control ;; dgos: GAME +;; +++idle-control-cmd +(defenum idle-control-cmd + :type uint8 + (reset 0) + (play 1) + (push 2) + ) +;; ---idle-control-cmd + + ;; DECOMP BEGINS +(deftype idle-control-frame (structure) + ((command idle-control-cmd) + (anim uint32) + (param0 int32) + (param1 int32) + (param2 pair) + ) + ) + + +(deftype idle-control (structure) + ((anim (inline-array idle-control-frame)) + (anim-speed float) + (current-index int32) + (counter int32) + (target int32) + ) + (:methods + (init! (_type_ (inline-array idle-control-frame)) none) + (play-idle-frames! (_type_ process-drawable) none :behavior process-drawable) + ) + ) + + +;; WARN: Return type mismatch idle-control vs none. +(defmethod init! ((this idle-control) (arg0 (inline-array idle-control-frame))) + "Initialize this [[idle-control]]." + (set! (-> this anim) arg0) + (set! (-> this anim-speed) 0.0) + (set! (-> this current-index) 0) + (set! (-> this counter) 0) + (set! (-> this target) 0) + (none) + ) + +;; WARN: Function (method 10 idle-control) has a return type of none, but the expression builder found a return statement. +(defmethod play-idle-frames! ((this idle-control) (arg0 process-drawable)) + "Set the process pointer to the given [[process-drawable]] and run the idle frames for it." + (when (nonzero? (-> this anim)) + ;; og:preserve-this + (protect (PP) + ;; (set! self arg0) + (set! PP arg0) + (loop + (let ((s4-0 (-> this anim (-> this current-index)))) + (case (-> s4-0 command) + (((idle-control-cmd play)) + (if (< (-> s4-0 anim) 0) + (return #f) + ) + (when (zero? (-> this target)) + (set! (-> this target) (rand-vu-int-range (-> s4-0 param0) (-> s4-0 param1))) + (set! (-> this anim-speed) + (rand-vu-float-range + (command-get-float (-> s4-0 param2 car) 0.0) + (command-get-float (-> (the-as pair (-> s4-0 param2 cdr)) car) 0.0) + ) + ) + (ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) :num! min) + (return #f) + ) + (ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) + :num! (seek! max (-> this anim-speed)) + ) + (cond + ((ja-done? 0) + (+! (-> this counter) 1) + (cond + ((>= (-> this counter) (-> this target)) + (+! (-> this current-index) 1) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + (else + (ja :num-func num-func-identity :frame-num 0.0) + (return #f) + ) + ) + ) + (else + (return #f) + ) + ) + ) + (((idle-control-cmd push)) + (ja-channel-push! 1 (the-as time-frame (-> s4-0 param0))) + (+! (-> this current-index) 1) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + (((idle-control-cmd reset)) + (set! (-> this current-index) 0) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + ) + ) + ) + ;; og:preserve-this + ;; (set! self s5-0) + ) + ) + 0 + (none) + ) diff --git a/goal_src/jak3/engine/game/penetrate-h.gc b/goal_src/jak3/engine/game/penetrate-h.gc index 141fdb3b742..459e14cc50d 100644 --- a/goal_src/jak3/engine/game/penetrate-h.gc +++ b/goal_src/jak3/engine/game/penetrate-h.gc @@ -5,26 +5,25 @@ ;; name in dgo: penetrate-h ;; dgos: GAME -;; +++game-h:knocked-type +;; +++knocked-type (defenum knocked-type :type uint8 - (knocked-type-0 0) - (knocked-type-1 1) - (knocked-type-2 2) - (knocked-type-3 3) - (knocked-type-4 4) ;; what the heck is this! (its on gator, and cant trigger it for the life of me) - (knocked-type-5 5) - (knocked-type-6 6) - (knocked-type-7 7) - (knocked-type-8 8) - (knocked-type-9 9) - (knocked-type-10 10) + (none 0) + (mech-punch 1) + (explode-or-darkjak 2) + (dark-shot 3) + (yellow-shot 4) + (red-shot 5) + (blue-shot 6) + (vehicle 7) + (knocked-off 8) ) -;; ---game-h:knocked-type +;; ---knocked-type +;; +++penetrate (defenum penetrate - :bitfield #t :type uint64 + :bitfield #t (touch 0) (generic-attack 1) (lunge 2) @@ -64,6 +63,8 @@ (jak-dark-blackhole 36) (emp-blast 37) ) +;; ---penetrate + ;; DECOMP BEGINS diff --git a/goal_src/jak3/engine/geometry/path-h.gc b/goal_src/jak3/engine/geometry/path-h.gc index b1fcb0f5c35..cf79511bd6b 100644 --- a/goal_src/jak3/engine/geometry/path-h.gc +++ b/goal_src/jak3/engine/geometry/path-h.gc @@ -41,7 +41,7 @@ These path-controls are typically allocated on a process heap." (path-control-method-15 () none) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) (get-num-segments (_type_) float) - (path-control-method-18 () none) + (total-distance (_type_) float) (get-num-verts (_type_) int) (segement-duration->path-duration (_type_ float) float) (path-duration->segment-duration (_type_ float) float) diff --git a/goal_src/jak3/engine/gfx/foreground/shadow-cpu-h.gc b/goal_src/jak3/engine/gfx/foreground/shadow-cpu-h.gc index 48c3a249bcb..30f796b63e9 100644 --- a/goal_src/jak3/engine/gfx/foreground/shadow-cpu-h.gc +++ b/goal_src/jak3/engine/gfx/foreground/shadow-cpu-h.gc @@ -48,7 +48,7 @@ ((settings shadow-settings :inline) ) (:methods - (new (symbol type float float float vector float float) _type_) + (new (symbol type float float float vector shadow-flags float) _type_) (enable-draw (shadow-control) int) (disable-draw (shadow-control) int) (set-top-plane-offset (shadow-control float) int) @@ -216,14 +216,14 @@ (arg1 float) (arg2 float) (arg3 vector) - (arg4 float) + (arg4 shadow-flags) (arg5 float) ) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (if arg3 (set! (-> v0-0 settings center quad) (-> arg3 quad)) ) - (set! (-> v0-0 settings flags) (the-as shadow-flags arg4)) + (set! (-> v0-0 settings flags) arg4) (set-vector! (-> v0-0 settings shadow-dir) 0.0 -1.0 0.0 arg2) (set-vector! (-> v0-0 settings bot-plane) 0.0 1.0 0.0 (- arg0)) (set-vector! (-> v0-0 settings top-plane) 0.0 1.0 0.0 (- arg1)) diff --git a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc index 8d7852d9b09..78c80e0886c 100644 --- a/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc +++ b/goal_src/jak3/engine/gfx/mood/time-of-day-h.gc @@ -33,6 +33,7 @@ (define-extern *time-of-day* (pointer time-of-day-proc)) (define-extern update-time-of-day (function time-of-day-context none)) (define-extern init-time-of-day-context (function time-of-day-context symbol)) +(define-extern calc-fade-from-fog (function vector float)) ;; DECOMP BEGINS @@ -83,8 +84,8 @@ and the code in mood.gc, which set the actual fade values for time-of-day." (moon-count int32) (moon sparticle-launch-control) (day-star-count int32) - (day-star basic) - (day-star-enable basic) + (day-star sparticle-launch-control) + (day-star-enable symbol) (start-timer int32) ) ) diff --git a/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher-h.gc b/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher-h.gc index 6783910dac6..8db83bcd460 100644 --- a/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher-h.gc +++ b/goal_src/jak3/engine/gfx/sprite/particles/sparticle-launcher-h.gc @@ -593,6 +593,7 @@ particle system itself. This type just holds the launching-related state." (the float (sar (shl (the int (atan (-> arg0 y) (* -1.0 (-> arg0 x)))) 48) 48)) ) +(define-extern lookup-part-group-by-name (function string sparticle-launch-group)) (define-extern sparticle-motion-blur (function sparticle-system sparticle-cpuinfo vector none)) (define-extern sp-launch-particles-var (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none)) (define-extern *part-id-table* (array sparticle-launcher)) diff --git a/goal_src/jak3/engine/level/level-h.gc b/goal_src/jak3/engine/level/level-h.gc index 29f68ffe47f..54677f2b4d4 100644 --- a/goal_src/jak3/engine/level/level-h.gc +++ b/goal_src/jak3/engine/level/level-h.gc @@ -14,6 +14,7 @@ (declare-type entity-links structure) (declare-type level-group basic) (declare-type level-load-info structure) +(declare-type text-id uint32) (define-extern *level* level-group) (define-extern *draw-index* int) (define-extern *level-index* int) @@ -418,7 +419,7 @@ (debug-print-region-splitbox (_type_ vector object) none) (get-art-group-by-name (_type_ string) art-group) (level-method-22 () none) - (level-method-23 () none) + (lookup-text (_type_ text-id symbol) string) (level-method-24 () none) (birth (_type_) _type_) (level-status-update! (_type_ symbol) _type_) diff --git a/goal_src/jak3/engine/math/matrix-compose.gc b/goal_src/jak3/engine/math/matrix-compose.gc index f9bcacbd3e9..33dd360d780 100644 --- a/goal_src/jak3/engine/math/matrix-compose.gc +++ b/goal_src/jak3/engine/math/matrix-compose.gc @@ -51,7 +51,7 @@ arg0 ) -(defun matrix-u-f-compose ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 vector)) +(defun matrix-u-f-compose ((arg0 matrix) (arg1 vector) (arg2 vector)) (set! (-> arg0 uvec quad) (-> arg1 quad)) (vector-cross! (-> arg0 rvec) arg1 arg2) (vector-normalize! (-> arg0 rvec) 1.0) @@ -94,7 +94,7 @@ (defun matrix-u-compose ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 vector)) (set! (-> arg0 uvec quad) (-> arg1 quad)) (let ((a2-1 (vector-get-unique! (new 'stack-no-clear 'vector) arg1))) - (matrix-u-f-compose arg0 arg1 a2-1 arg3) + (matrix-u-f-compose arg0 arg1 a2-1) ) arg0 ) diff --git a/goal_src/jak3/engine/nav/nav-control-h.gc b/goal_src/jak3/engine/nav/nav-control-h.gc index 177ac40cb15..cd85091191d 100644 --- a/goal_src/jak3/engine/nav/nav-control-h.gc +++ b/goal_src/jak3/engine/nav/nav-control-h.gc @@ -125,13 +125,13 @@ (nav-state-method-31 () none) (nav-state-method-32 () none) (nav-state-method-33 () none) - (nav-state-method-34 () none) + (navigate-v1! (_type_) none) (nav-state-method-35 () none) (nav-state-method-36 () none) (nav-state-method-37 () none) (nav-state-method-38 () none) (nav-state-method-39 () none) - (nav-state-method-40 () none) + (do-navigation-to-destination (_type_ vector) none) (nav-state-method-41 () none) (nav-state-method-42 () none) (nav-state-method-43 () none) @@ -180,7 +180,7 @@ (nav-control-method-9 () none) (nav-control-method-10 () none) (find-poly-containing-point-1 (_type_ vector) nav-poly) - (nav-control-method-12 () none) + (cloest-point-on-mesh (_type_ vector vector nav-poly) nav-poly) (nav-control-method-13 () none) (nav-control-method-14 () none) (nav-control-method-15 () none) diff --git a/goal_src/jak3/engine/nav/nav-enemy-h.gc b/goal_src/jak3/engine/nav/nav-enemy-h.gc index fbfff86b92b..41790d195d4 100644 --- a/goal_src/jak3/engine/nav/nav-enemy-h.gc +++ b/goal_src/jak3/engine/nav/nav-enemy-h.gc @@ -7,3 +7,93 @@ ;; DECOMP BEGINS +(deftype nav-enemy-info (enemy-info) + ((callback-info nav-callback-info) + (use-momentum symbol) + (use-frustration symbol) + (use-stop-chase symbol) + (use-circling symbol) + (use-pacing symbol) + (walk-anim int32) + (turn-anim int32) + (run-anim int32) + (taunt-anim int32) + (run-travel-speed meters) + (run-acceleration meters) + (run-turning-acceleration meters) + (walk-travel-speed meters) + (walk-acceleration meters) + (walk-turning-acceleration meters) + (maximum-rotation-rate degrees) + (notice-nav-radius meters) + (frustration-distance meters) + (frustration-time time-frame) + (blocked-time time-frame) + (circle-dist-lo float) + (circle-dist-hi float) + (nav-mesh nav-mesh) + ) + (:methods + (copy! (_type_ nav-enemy-info) none) + ) + ) + + +(deftype nav-enemy (enemy) + ((enemy-info nav-enemy-info :override) + (frustration-point vector :inline) + (move-dest vector :inline) + (frustration-time time-frame) + (blocked-start-time time-frame) + (restore-nav-radius-time time-frame) + (nav-radius-backup float) + (circle-radial-dist float :overlay-at desired-angle) + ) + (:state-methods + taunt + pacing + circling + stop-chase + debug-control + ) + (:methods + (nav-enemy-method-160 (_type_) none) + (nav-enemy-method-161 (_type_) none) + (nav-enemy-method-162 (_type_) none) + (nav-enemy-method-163 (_type_) none) + (nav-enemy-method-164 (_type_) none) + (nav-enemy-method-165 (_type_) none) + (nav-enemy-method-166 (_type_) none) + (nav-enemy-method-167 (_type_) none) + (nav-enemy-method-168 (_type_) none) + (nav-enemy-method-169 (_type_) none) + (nav-enemy-method-170 (_type_) none) + (nav-enemy-method-171 (_type_) none) + (nav-enemy-method-172 (_type_) none) + (nav-enemy-method-173 (_type_) none) + (nav-enemy-method-174 (_type_) none) + (nav-enemy-method-175 (_type_) none) + (nav-enemy-method-176 (_type_) none) + (nav-enemy-method-177 (_type_) none) + (nav-enemy-method-178 (_type_) none) + (nav-enemy-method-179 (_type_) none) + (nav-enemy-method-180 (_type_) none) + (nav-enemy-method-181 (_type_) none) + (nav-enemy-method-182 (_type_) none) + (nav-enemy-method-183 (_type_) none) + (nav-enemy-method-184 (_type_) none) + (nav-enemy-method-185 (_type_) none) + (nav-enemy-method-186 (_type_) none) + (nav-enemy-method-187 (_type_) none) + (nav-enemy-method-188 (_type_) none) + (nav-enemy-method-189 (_type_) none) + ) + ) + + +(deftype nav-enemy-debug-control-info (basic) + ((enable symbol) + (steering float) + (throttle float) + ) + ) diff --git a/goal_src/jak3/engine/physics/cloth-h.gc b/goal_src/jak3/engine/physics/cloth-h.gc index 1e6d288479e..7666da53cac 100644 --- a/goal_src/jak3/engine/physics/cloth-h.gc +++ b/goal_src/jak3/engine/physics/cloth-h.gc @@ -13,6 +13,7 @@ (constraint-length-sqd float) (particle0 uint16) (particle1 uint16) + (vec vector :inline :overlay-at constraint-length-half) ) ) diff --git a/goal_src/jak3/engine/physics/ragdoll-edit.gc b/goal_src/jak3/engine/physics/ragdoll-edit.gc index 5001a96827e..22f651890e1 100644 --- a/goal_src/jak3/engine/physics/ragdoll-edit.gc +++ b/goal_src/jak3/engine/physics/ragdoll-edit.gc @@ -248,7 +248,7 @@ ) (let ((s3-0 (new 'stack-no-clear 'inline-array 'matrix 60))) (dotimes (v1-0 60) - (let ((a0-2 (the-as matrix (-> s3-0 v1-0 rvec)))) + (let ((a0-2 (-> s3-0 v1-0))) (set! (-> a0-2 rvec quad) (the-as uint128 0)) (set! (-> a0-2 uvec quad) (the-as uint128 0)) (set! (-> a0-2 fvec quad) (the-as uint128 0)) @@ -258,7 +258,7 @@ (dotimes (s2-0 (the-as int (-> arg0 num-joints))) (let ((s0-0 (-> arg0 ragdoll-joints s2-0))) (set! sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) - (set! sv-4368 (the-as matrix (-> s3-0 s2-0 rvec))) + (set! sv-4368 (-> s3-0 s2-0)) (let ((s1-0 (new 'stack-no-clear 'matrix))) (cond (sv-4352 @@ -268,15 +268,11 @@ (set! sv-4432 (new 'stack-no-clear 'vector)) (let* ((v1-11 s1-0) (a3-0 - (the-as - matrix - (-> s3-0 - (/ (the-as uint (&- (the-as pointer sv-4352) (the-as uint (the-as pointer (-> arg0 ragdoll-joints))))) - (the-as uint 192) - ) - rvec - ) - ) + (-> s3-0 + (/ (the-as uint (&- (the-as pointer sv-4352) (the-as uint (the-as pointer (-> arg0 ragdoll-joints))))) + (the-as uint 192) + ) + ) ) (a0-9 (-> a3-0 rvec quad)) (a1-5 (-> a3-0 uvec quad)) diff --git a/goal_src/jak3/engine/physics/ragdoll-h.gc b/goal_src/jak3/engine/physics/ragdoll-h.gc index 15b15de5fa0..8b4a4a7af25 100644 --- a/goal_src/jak3/engine/physics/ragdoll-h.gc +++ b/goal_src/jak3/engine/physics/ragdoll-h.gc @@ -46,7 +46,7 @@ (rf5 5) (rf6 6) (rf7 7) - (rf8 8) + (mirror 8) (rf9 9) (rf10 10) (rf11 11) @@ -146,7 +146,7 @@ (num-children int8) (old-param0 basic) (hit-sound sound-name) - (ground-pat uint32) + (ground-pat pat-surface) (user0 int32) (original-speed float) ) @@ -194,7 +194,7 @@ (ragdoll-method-17 (_type_ process-drawable) none) (ragdoll-method-18 (_type_) none) (ragdoll-method-19 (_type_ vector int object vector) none) - (ragdoll-method-20 (_type_ vector) none) + (reset-vec! (_type_ vector) none) (ragdoll-method-21 (_type_ vector vector float) vector) (get-max-angle-for-joint-idx (_type_ int) degrees) (ragdoll-method-23 (_type_ vector vector float symbol) none) @@ -214,9 +214,9 @@ ) (:methods (ragdoll-proc-method-15 (_type_ symbol vector symbol) none) - (ragdoll-proc-method-16 (_type_ int) none) - (ragdoll-proc-method-17 (_type_ matrix) none) - (ragdoll-proc-method-18 (_type_ ragdoll-edit-info process) none) + (disable-for-duration (_type_ time-frame) none) + (ragdoll-proc-method-17 (_type_ ragdoll-edit-info) none) + (ragdoll-proc-method-18 (_type_ ragdoll-edit-info) none) (ragdoll-proc-method-19 (_type_) none) ) ) diff --git a/goal_src/jak3/engine/physics/ragdoll.gc b/goal_src/jak3/engine/physics/ragdoll.gc index c388ff1a416..b26bf84be56 100644 --- a/goal_src/jak3/engine/physics/ragdoll.gc +++ b/goal_src/jak3/engine/physics/ragdoll.gc @@ -78,7 +78,7 @@ ) (set! (-> s4-1 action-mask) (collide-action solid)) (mem-copy! (the-as pointer (-> s4-1 bbox)) (the-as pointer s5-1) 32) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* s4-1) (when (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) (let ((s4-2 (new 'stack-no-clear 'inline-array 'water-sphere 2))) (dotimes (s3-1 2) @@ -191,7 +191,7 @@ ) ) -(defmethod ragdoll-method-20 ((this ragdoll) (arg0 vector)) +(defmethod reset-vec! ((this ragdoll) (arg0 vector)) (vector-reset! arg0) 0 (none) @@ -299,7 +299,7 @@ ) (let ((s4-1 (-> this ragdoll-joints arg1))) (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! arg0 arg0 (-> this mirror)) (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) ) @@ -361,7 +361,7 @@ (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) ) ) - (set! (-> s4-1 ground-pat) (the-as uint (-> s2-1 best-other-tri pat))) + (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) (let ((f0-7 (fmin 1.0 f30-0))) (vector+float*! arg0 arg0 s3-2 f0-7) (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) @@ -405,13 +405,13 @@ (set! (-> s3-3 reg 0) (the-as uint 0)) (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) (set! (-> s3-3 reg 0) (the-as uint 127)) - (set! (-> s3-3 reg 0) (shr (shl (-> s4-1 ground-pat) 48) 58)) + (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) ) (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) ) ) ) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! arg0 arg0 (-> this mirror)) (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) ) @@ -447,7 +447,7 @@ (s3-0 (new 'stack-no-clear 'vector)) ) (set! (-> s3-0 quad) (-> s4-0 0 position quad)) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! s3-0 s3-0 (-> this mirror)) ) (vector-! s2-0 s3-0 s2-0) @@ -611,7 +611,7 @@ ) (set! (-> s2-1 trans quad) (-> s1-1 position quad)) (set! (-> s2-1 trans w) 1.0) - (if (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag mirror)) (matrix*! s2-1 s2-1 (-> s3-1 mirror)) ) (cond @@ -771,7 +771,7 @@ (defmethod ragdoll-method-9 ((this ragdoll) (arg0 matrix) (arg1 process-drawable)) (cond ((= (-> arg1 node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) - (logior! (-> this ragdoll-flags) (ragdoll-flag rf8)) + (logior! (-> this ragdoll-flags) (ragdoll-flag mirror)) (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data 2))) (a1-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) @@ -784,7 +784,7 @@ ) ) (else - (logclear! (-> this ragdoll-flags) (ragdoll-flag rf8)) + (logclear! (-> this ragdoll-flags) (ragdoll-flag mirror)) (matrix-identity! arg0) ) ) @@ -811,7 +811,7 @@ (let ((s3-1 (-> this ragdoll-joints s4-1))) (new 'stack-no-clear 'vector) (vector<-cspace! (-> s3-1 position) (-> arg0 node-list data (-> s3-1 joint-index))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! (-> s3-1 position) (-> s3-1 position) (-> this mirror)) ) ) @@ -866,7 +866,7 @@ ((logtest? (-> this ragdoll-flags) (ragdoll-flag rf5)) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf5)) (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index)))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! sv-144 sv-144 (-> this mirror)) ) (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) @@ -875,7 +875,7 @@ ) (else (vector<-cspace! (-> s1-0 position) (-> arg0 node-list data (-> s1-0 joint-index))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! (-> s1-0 position) (-> s1-0 position) (-> this mirror)) ) (cond @@ -902,7 +902,7 @@ (set! (-> s0-0 quad) (-> arg0 root trans quad)) ) ) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! s0-0 s0-0 (-> this mirror)) ) (set! (-> s1-0 joint-length) (vector-vector-distance (-> s1-0 position) s0-0)) @@ -1199,7 +1199,7 @@ (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) ) (set! sv-336 (new 'stack-no-clear 'vector)) - (ragdoll-method-20 this sv-336) + (reset-vec! this sv-336) (let ((v1-104 sv-560)) (let ((a0-45 sv-560)) (.mov.vf vf6 vf0 :mask #b1000) @@ -1549,27 +1549,23 @@ (none) ) -(defmethod ragdoll-proc-method-16 ((this ragdoll-proc) (arg0 int)) +(defmethod disable-for-duration ((this ragdoll-proc) (arg0 time-frame)) (if (nonzero? (-> this ragdoll)) - (turn-off-for-duration! (-> this ragdoll) (the-as time-frame arg0)) + (turn-off-for-duration! (-> this ragdoll) arg0) ) 0 (none) ) -(defmethod ragdoll-proc-method-17 ((this ragdoll-proc) (arg0 matrix)) +(defmethod ragdoll-proc-method-17 ((this ragdoll-proc) (arg0 ragdoll-edit-info)) (if (nonzero? (-> this ragdoll)) - (ragdoll-method-15 - (-> this ragdoll) - (the-as process-drawable (ppointer->process (-> this parent))) - (the-as ragdoll-edit-info arg0) - ) + (ragdoll-method-15 (-> this ragdoll) (the-as process-drawable (ppointer->process (-> this parent))) arg0) ) 0 (none) ) -(defmethod ragdoll-proc-method-18 ((this ragdoll-proc) (arg0 ragdoll-edit-info) (arg1 process)) +(defmethod ragdoll-proc-method-18 ((this ragdoll-proc) (arg0 ragdoll-edit-info)) (if (and (nonzero? (-> this ragdoll)) (-> this ragdoll) (nonzero? arg0) arg0) (ragdoll-edit-info-method-17 arg0 diff --git a/goal_src/jak3/engine/physics/rigid-body-h.gc b/goal_src/jak3/engine/physics/rigid-body-h.gc index 38a77eaaa4f..b56e6402268 100644 --- a/goal_src/jak3/engine/physics/rigid-body-h.gc +++ b/goal_src/jak3/engine/physics/rigid-body-h.gc @@ -70,6 +70,8 @@ ) ;; ---rigid-body-h:rigid-body-object-flag +(declare-type rigid-body-object basic) + ;; DECOMP BEGINS (deftype rigid-body-info (structure) @@ -86,7 +88,7 @@ (inertial-tensor-box meters 3) ) (:methods - (rigid-body-info-method-9 () none) + (rigid-body-info-method-9 (_type_) none) ) ) @@ -131,7 +133,7 @@ (velocity vector :inline) (impulse float) (pat pat-surface) - (process basic) + (process process) (prim-id uint32) ) ) @@ -140,9 +142,9 @@ (deftype rigid-body-control (basic) ((flags rigid-body-flag) (info rigid-body-info) - (force-callback basic) + (force-callback (function rigid-body-object float none)) (process process) - (blocked-by basic) + (blocked-by process-focusable) (time-remaining float) (step-count int16) (linear-damping float) @@ -162,32 +164,32 @@ (inv-i-world matrix :inline) ) (:methods - (new (symbol type) _type_) - (rigid-body-control-method-9 () none) - (rigid-body-control-method-10 () none) - (rigid-body-control-method-11 () none) - (rigid-body-control-method-12 () none) - (rigid-body-control-method-13 () none) - (rigid-body-control-method-14 () none) - (rigid-body-control-method-15 () none) - (rigid-body-control-method-16 () none) - (rigid-body-control-method-17 () none) - (rigid-body-control-method-18 () none) - (rigid-body-control-method-19 () none) - (rigid-body-control-method-20 () none) - (rigid-body-control-method-21 () none) - (rigid-body-control-method-22 () none) - (rigid-body-control-method-23 () none) - (rigid-body-control-method-24 () none) - (rigid-body-control-method-25 () none) - (rigid-body-control-method-26 () none) - (rigid-body-control-method-27 () none) - (rigid-body-control-method-28 () none) - (rigid-body-control-method-29 () none) - (rigid-body-control-method-30 () none) - (rigid-body-control-method-31 () none) - (rigid-body-control-method-32 () none) - (rigid-body-control-method-33 () none) + (new (symbol type process) _type_) + (rigid-body-control-method-9 (_type_ collide-shape-moving float) none) + (rigid-body-control-method-10 (_type_ rigid-body-object float float) object) + (update-rbody-transform! (_type_ collide-shape-moving) none) + (rigid-body-control-method-12 (_type_ float) none) + (init-velocities! (_type_) none) + (rigid-body-control-method-14 (_type_ float) none) + (rigid-body-control-method-15 (_type_) none) + (reset-force-and-torque! (_type_) none) + (reset-momentum! (_type_) none) + (apply-impact! (_type_ vector vector) none) + (rigid-body-control-method-19 (_type_ vector vector) none) + (add-force! (_type_ vector) none) + (rigid-body-control-method-21 (_type_ vector vector float) none) + (rigid-body-control-method-22 (_type_ vector vector) none) + (rigid-body-control-method-23 (_type_ vector vector) none) + (rigid-body-control-method-24 (_type_ vector vector) none) + (rigid-body-control-method-25 (_type_ vector) none) + (rigid-body-control-method-26 (_type_) none) + (init! (_type_ rigid-body-info vector quaternion (function rigid-body-object float)) none) + (rigid-body-control-method-28 (_type_ vector quaternion) none) + (debug-print-info (_type_ object) none) + (debug-print-force-torque (_type_ object) none) + (debug-print-pos-rot (_type_ object) none) + (debug-print-momentum (_type_ object) none) + (debug-print-velocity (_type_ object) none) ) ) @@ -202,52 +204,54 @@ (player-force-position vector :inline) (player-force vector :inline) ) + (:state-methods + idle + active + ) (:methods - (rigid-body-object-method-28 () none) - (rigid-body-object-method-29 () none) - (rigid-body-object-method-30 () none) - (rigid-body-object-method-31 () none) - (rigid-body-object-method-32 () none) - (rigid-body-object-method-33 () none) - (rigid-body-object-method-34 () none) - (rigid-body-object-method-35 () none) - (rigid-body-object-method-36 () none) - (rigid-body-object-method-37 () none) - (rigid-body-object-method-38 () none) - (rigid-body-object-method-39 () none) - (rigid-body-object-method-40 () none) - (rigid-body-object-method-41 () none) - (rigid-body-object-method-42 () none) - (rigid-body-object-method-43 () none) - (rigid-body-object-method-44 () none) - (rigid-body-object-method-45 () none) - (rigid-body-object-method-46 () none) - (rigid-body-object-method-47 () none) - (rigid-body-object-method-48 () none) - (rigid-body-object-method-49 () none) - (rigid-body-object-method-50 () none) - (rigid-body-object-method-51 () none) - (rigid-body-object-method-52 () none) - (rigid-body-object-method-53 () none) - (rigid-body-object-method-54 () none) - (rigid-body-object-method-55 () none) + (rigid-body-object-method-30 (_type_) none) + (apply-gravity! (_type_ float) none) + (rigid-body-object-method-32 (_type_) none) + (alloc-rbody-control! (_type_ rigid-body-object-constants) none) + (init-collision! (_type_) none) + (init-rbody-control! (_type_) none) + (go-idle (_type_) object) + (rigid-body-object-method-37 (_type_) none) + (rigid-body-object-method-38 (_type_) none) + (rbody-post (_type_) none) + (apply-momentum! (_type_) none) + (disable-physics! (_type_) none) + (rigid-body-object-method-42 (_type_) none) + (rigid-body-object-method-43 (_type_) none) + (impulse-handler (_type_) none) + (go-active (_type_) object) + (rigid-body-object-method-46 (_type_) none) + (impulse-force<-penetrate (_type_ rigid-body-impact attack-info penetrate) none) + (rigid-body-object-method-48 (_type_) none) + (rbody-event-handler (_type_ process int symbol event-message-block) object) + (attack-handler (_type_ process-drawable attack-info touching-shapes-entry penetrate) symbol) + (touch-handler (_type_ process-focusable touching-shapes-entry) symbol) + (init-rbody-impact-from-tshape! (_type_ rigid-body-impact touching-shapes-entry) none) + (rigid-body-object-method-53 (_type_ float) none) + (rigid-body-object-method-54 (_type_) none) + (clear-impulse-force-flag! (_type_) none) ) ) (deftype rigid-body-queue (structure) ((count int8) - (manager uint64) + (manager handle) (array handle 128) ) (:methods - (rigid-body-queue-method-9 () none) - (rigid-body-queue-method-10 () none) - (rigid-body-queue-method-11 () none) - (rigid-body-queue-method-12 () none) - (rigid-body-queue-method-13 () none) - (rigid-body-queue-method-14 () none) - (rigid-body-queue-method-15 () none) - (rigid-body-queue-method-16 () none) + (init-queue! (_type_ process) none) + (rigid-body-queue-method-10 (_type_) none) + (rigid-body-queue-method-11 (_type_ process int) none) + (rigid-body-queue-method-12 (_type_ int int) none) + (rigid-body-queue-method-13 (_type_ int process) none) + (rigid-body-queue-method-14 (_type_ int) none) + (rigid-body-queue-method-15 (_type_ process) none) + (rigid-body-queue-method-16 (_type_) none) ) ) diff --git a/goal_src/jak3/engine/physics/rigid-body-queue.gc b/goal_src/jak3/engine/physics/rigid-body-queue.gc index 10fa8dea239..413ef0acc68 100644 --- a/goal_src/jak3/engine/physics/rigid-body-queue.gc +++ b/goal_src/jak3/engine/physics/rigid-body-queue.gc @@ -5,5 +5,309 @@ ;; name in dgo: rigid-body-queue ;; dgos: GAME +(declare-type rigid-body-queue-manager process) + ;; DECOMP BEGINS +(define *rigid-body-queue-manager* (the-as rigid-body-queue-manager #f)) + +(defmethod init-queue! ((this rigid-body-queue) (arg0 process)) + (set! (-> this count) 0) + (set! (-> this manager) (process->handle arg0)) + (dotimes (v1-3 128) + (set! (-> this array v1-3) (the-as handle #f)) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch symbol vs none. +(defmethod rigid-body-queue-method-16 ((this rigid-body-queue)) + (let ((gp-0 0)) + (dotimes (v1-0 (-> this count)) + (let ((a1-2 (-> this array v1-0)) + (a2-0 (+ v1-0 1)) + ) + (while (< a2-0 (-> this count)) + (if (= a1-2 (-> this array a2-0)) + (+! gp-0 1) + ) + (+! a2-0 1) + ) + ) + ) + (if (> gp-0 0) + (format 0 "rigid-body-queue::validate: duplicate count ~d~%" gp-0) + ) + (zero? gp-0) + ) + (none) + ) + +(defmethod rigid-body-queue-method-10 ((this rigid-body-queue)) + (with-pp + (let ((f0-0 (seconds-per-frame))) + (countdown (v1-1 (-> this count)) + (let ((a0-4 (handle->process (-> this array v1-1)))) + (cond + (a0-4 + (let ((a0-6 (-> (the-as process-focusable a0-4) rbody))) + (set! (-> a0-6 time-remaining) f0-0) + (set! (-> a0-6 blocked-by) #f) + (set! (-> a0-6 step-count) 0) + (logclear! (-> a0-6 flags) (rigid-body-flag blocker)) + ) + ) + (else + ) + ) + ) + ) + ) + (let ((s5-0 0)) + (let ((s4-0 (-> *kernel-context* prevent-from-run))) + (b! #t cfg-37 :delay (nop!)) + (label cfg-11) + (let ((s3-0 (handle->process (-> this array s5-0)))) + (when s3-0 + (let ((s2-0 (-> (the-as process-focusable s3-0) rbody))) + (when (and (logtest? (-> s2-0 flags) (rigid-body-flag enable-physics)) + (not (logtest? s4-0 (-> s3-0 mask))) + (and (< 0.001 (-> s2-0 time-remaining)) (< (-> s2-0 step-count) 4)) + ) + (let ((s1-0 pp)) + (set! pp s3-0) + (rigid-body-object-method-54 (the-as rigid-body-object s3-0)) + (set! pp s1-0) + ) + (+! (-> s2-0 step-count) 1) + (let ((a2-2 (-> s2-0 blocked-by))) + (when a2-2 + (when #t + (logior! (-> a2-2 rbody flags) (rigid-body-flag blocker)) + (rigid-body-queue-method-13 this s5-0 a2-2) + (let ((v1-34 (process->handle s3-0))) + (b! (!= (-> this array s5-0) v1-34) cfg-11 :delay (nop!)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! s5-0 1) + (label cfg-37) + (b! (< s5-0 (-> this count)) cfg-11) + ) + (let ((s5-1 (-> *kernel-context* prevent-from-run))) + (dotimes (s4-1 (-> this count)) + (let ((a0-20 (handle->process (-> this array s4-1)))) + (when (and a0-20 + (logtest? (-> (the-as process-focusable a0-20) rbody flags) (rigid-body-flag enable-physics)) + (not (logtest? s5-1 (-> a0-20 mask))) + ) + (let ((s3-1 pp)) + (set! pp a0-20) + (clear-impulse-force-flag! (the-as rigid-body-object a0-20)) + (set! pp s3-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +(defmethod rigid-body-queue-method-11 ((this rigid-body-queue) (arg0 process) (arg1 int)) + (let ((v1-0 -1)) + (let ((a2-1 0)) + (b! #t cfg-9 :delay (nop!)) + (label cfg-1) + (b! (handle->process (-> this array a2-1)) cfg-8 :delay (empty-form)) + (set! v1-0 a2-1) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a2-1 1) + (label cfg-9) + (b! (< a2-1 (-> this count)) cfg-1) + ) + (label cfg-11) + (cond + ((!= v1-0 -1) + (set! (-> this array v1-0) (process->handle arg0)) + ) + (else + (when (< (-> this count) 128) + (set! (-> this array (-> this count)) (process->handle arg0)) + (+! (-> this count) 1) + ) + ) + ) + ) + 0 + 0 + (none) + ) + +(defmethod rigid-body-queue-method-12 ((this rigid-body-queue) (arg0 int) (arg1 int)) + (when (< arg0 arg1) + (let ((v1-1 arg1) + (a3-0 (+ arg1 -1)) + (a2-3 (-> this array arg1)) + ) + (while (>= a3-0 arg0) + (set! (-> this array v1-1) (-> this array a3-0)) + (+! a3-0 -1) + (+! v1-1 -1) + ) + (set! (-> this array arg0) a2-3) + ) + ) + 0 + (none) + ) + +(defmethod rigid-body-queue-method-13 ((this rigid-body-queue) (arg0 int) (arg1 process)) + (let ((v1-2 (process->handle arg1)) + (a2-4 (+ arg0 1)) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-6) + (b! (!= (-> this array a2-4) v1-2) cfg-8 :delay (empty-form)) + (rigid-body-queue-method-12 this arg0 a2-4) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a2-4 1) + (label cfg-9) + (b! (< a2-4 (-> this count)) cfg-6) + ) + (label cfg-11) + 0 + 0 + (none) + ) + +(defmethod rigid-body-queue-method-14 ((this rigid-body-queue) (arg0 int)) + (let ((v1-0 arg0) + (a1-1 (+ arg0 1)) + ) + (while (< a1-1 (-> this count)) + (set! (-> this array v1-0) (-> this array a1-1)) + (+! a1-1 1) + (+! v1-0 1) + ) + ) + (+! (-> this count) -1) + 0 + (none) + ) + +(defmethod rigid-body-queue-method-15 ((this rigid-body-queue) (arg0 process)) + (let ((v1-2 (process->handle arg0)) + (a1-4 0) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-6) + (b! (!= (-> this array a1-4) v1-2) cfg-8 :delay (empty-form)) + (rigid-body-queue-method-14 this a1-4) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a1-4 1) + (label cfg-9) + (b! (< a1-4 (-> this count)) cfg-6) + ) + (label cfg-11) + 0 + 0 + (none) + ) + +(deftype rigid-body-queue-manager (process) + ((queue rigid-body-queue) + ) + (:state-methods + idle + ) + ) + + +(defmethod deactivate ((this rigid-body-queue-manager)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *rigid-body-queue-manager* #f) + ((method-of-type process deactivate) this) + (none) + ) + +;; WARN: Return type mismatch process vs rigid-body-queue-manager. +(defmethod relocate ((this rigid-body-queue-manager) (offset int)) + (set! *rigid-body-queue-manager* this) + (if *rigid-body-queue-manager* + (set! *rigid-body-queue-manager* (&+ *rigid-body-queue-manager* offset)) + ) + (the-as rigid-body-queue-manager ((method-of-type process relocate) this offset)) + ) + +(defstate idle (rigid-body-queue-manager) + :virtual #t + :exit (behavior () + (set! (-> self queue count) 0) + 0 + ) + :code sleep-code + :post (behavior () + (local-vars (a0-3 int) (a0-5 int)) + (let* ((v1-1 (-> *perf-stats* data 17)) + (a0-0 (-> v1-1 ctrl)) + ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-0) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-0) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (rigid-body-queue-method-10 (-> self queue)) + (let ((v1-6 (-> *perf-stats* data 17))) + (b! (zero? (-> v1-6 ctrl)) cfg-4 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-3 pcr0) + (+! (-> v1-6 accum0) a0-3) + (.mfpc a0-5 pcr1) + (+! (-> v1-6 accum1) a0-5) + ) + (label cfg-4) + 0 + ) + ) + +(defbehavior rigid-body-queue-manager-init-by-other rigid-body-queue-manager ((arg0 rigid-body-queue)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self queue) arg0) + (init-queue! (-> self queue) self) + (go-virtual idle) + ) + +(defun rigid-body-queue-manager-spawn ((arg0 rigid-body-queue) (arg1 process-tree)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn rigid-body-queue-manager arg0 :name "rigid-body-queue-manager" :to arg1))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + gp-0 + ) + ) diff --git a/goal_src/jak3/engine/physics/rigid-body.gc b/goal_src/jak3/engine/physics/rigid-body.gc index c4022d2f9ba..30f7b06e09c 100644 --- a/goal_src/jak3/engine/physics/rigid-body.gc +++ b/goal_src/jak3/engine/physics/rigid-body.gc @@ -7,3 +7,1416 @@ ;; DECOMP BEGINS +(deftype rigid-body-work (structure) + ((max-ang-momentum float) + (max-ang-velocity float) + ) + ) + + +(define *rigid-body-work* (new 'static 'rigid-body-work)) + +(defmethod new rigid-body-control ((allocation symbol) (type-to-make type) (arg0 process)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 process) arg0) + v0-0 + ) + ) + +(defmethod relocate ((this rigid-body-control) (offset int)) + (&+! (-> this process) offset) + this + ) + +(defmethod rigid-body-info-method-9 ((this rigid-body-info)) + (let ((f24-0 (-> this mass)) + (f28-0 (-> this inertial-tensor-box 0)) + (f30-0 (-> this inertial-tensor-box 1)) + (f26-0 (-> this inertial-tensor-box 2)) + ) + (let ((f0-0 f24-0)) + (set! (-> this inv-mass) (/ 1.0 f0-0)) + ) + (matrix-identity! (-> this inertial-tensor)) + (matrix-identity! (-> this inv-inertial-tensor)) + (let ((f0-4 (* 0.083333336 f24-0))) + (let* ((f1-1 f30-0) + (f1-3 (* f1-1 f1-1)) + (f2-0 f26-0) + ) + (set! (-> this inertial-tensor rvec x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) + ) + (let ((f1-6 f28-0)) + (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) + ) + (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + ) + ) + (let ((f0-6 (-> this inertial-tensor rvec x))) + (set! (-> this inv-inertial-tensor rvec x) (/ 1.0 f0-6)) + ) + (let ((f0-9 (-> this inertial-tensor uvec y))) + (set! (-> this inv-inertial-tensor uvec y) (/ 1.0 f0-9)) + ) + (let ((f0-12 (-> this inertial-tensor fvec z))) + (set! (-> this inv-inertial-tensor fvec z) (/ 1.0 f0-12)) + ) + 0 + (none) + ) + +(defmethod reset-force-and-torque! ((this rigid-body-control)) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + (none) + ) + +(defmethod reset-momentum! ((this rigid-body-control)) + (set! (-> this lin-momentum quad) (the-as uint128 0)) + (set! (-> this ang-momentum quad) (the-as uint128 0)) + 0 + (none) + ) + +(defmethod rigid-body-control-method-26 ((this rigid-body-control)) + (when #t + (quaternion->matrix (-> this matrix) (the-as quaternion (-> this rot))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-rotate*! s5-0 (-> this info cm-offset-joint) (-> this matrix)) + (vector-! (-> this matrix trans) (-> this position) s5-0) + ) + ) + 0 + (none) + ) + +(defmethod rigid-body-control-method-28 ((this rigid-body-control) (arg0 vector) (arg1 quaternion)) + (let ((s3-0 (new 'stack-no-clear 'rigid-body-impact))) + (quaternion->matrix (the-as matrix (-> s3-0 normal)) arg1) + (vector-rotate*! (-> s3-0 point) (-> this info cm-offset-joint) (the-as matrix (-> s3-0 normal))) + (vector+! (-> this position) arg0 (-> s3-0 point)) + ) + (quaternion-copy! (the-as quaternion (-> this rot)) arg1) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) + ) + +(defmethod init! ((this rigid-body-control) + (arg0 rigid-body-info) + (arg1 vector) + (arg2 quaternion) + (arg3 (function rigid-body-object float)) + ) + (set! (-> this info) arg0) + (set! (-> this force-callback) (the-as (function rigid-body-object float none) arg3)) + (rigid-body-info-method-9 (-> this info)) + (let ((v1-2 this)) + (set! (-> v1-2 force quad) (the-as uint128 0)) + (set! (-> v1-2 torque quad) (the-as uint128 0)) + ) + 0 + (reset-momentum! this) + (rigid-body-control-method-28 this arg1 arg2) + (init-velocities! this) + (set! (-> this linear-damping) (-> arg0 linear-damping)) + (set! (-> this angular-damping) (-> arg0 angular-damping)) + (set! (-> this friction-factor) (-> arg0 friction-factor)) + (set! (-> this bounce-factor) (-> arg0 bounce-factor)) + 0 + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-23 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this ang-velocity) (-> v1-0 0)) + (vector+! arg1 (-> v1-0 1) (-> this lin-velocity)) + ) + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-24 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (local-vars (t0-5 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) + (let ((a1-2 (-> v1-0 1)) + (a3-3 (-> v1-0 1)) + (f0-0 1.0) + ) + (.lvf vf1 (&-> (-> v1-0 0) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov t0-5 vf1) + (vector-float*! a1-2 a3-3 (/ f0-0 t0-5)) + ) + (vector+! arg1 (-> v1-0 1) (-> this force)) + ) + (none) + ) + ) + +(defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'matrix 3))) + (let* ((v1-0 (-> s5-0 0)) + (a3-0 arg1) + (a0-1 (-> a3-0 rvec quad)) + (a1-1 (-> a3-0 uvec quad)) + (a2-1 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-0 rvec quad) a0-1) + (set! (-> v1-0 uvec quad) a1-1) + (set! (-> v1-0 fvec quad) a2-1) + (set! (-> v1-0 trans quad) a3-1) + ) + (vector-reset! (-> s5-0 0 trans)) + (matrix-transpose! (-> s5-0 1) (-> s5-0 0)) + (matrix*! (-> s5-0 2) arg2 (-> s5-0 0)) + (matrix*! arg0 (-> s5-0 1) (-> s5-0 2)) + ) + arg0 + ) + +(defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) + (local-vars (v1-6 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((a2-0 (-> this lin-momentum))) + (let ((v1-0 (-> this lin-momentum))) + (let ((a0-1 (-> this force))) + (let ((a3-0 arg0)) + (.mov vf7 a3-0) + ) + (.lvf vf5 (&-> a0-1 quad)) + ) + (.lvf vf4 (&-> v1-0 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a2-0 quad) vf6) + ) + (let ((a2-1 (-> this ang-momentum))) + (let ((v1-1 (-> this ang-momentum))) + (let ((a0-2 (-> this torque))) + (let ((a1-1 arg0)) + (.mov vf7 a1-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-1 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a2-1 quad) vf6) + ) + (let* ((f0-3 (* 500000000.0 (-> this info mass))) + (f1-1 f0-3) + (f1-3 (* f1-1 f1-1)) + ) + (.lvf vf1 (&-> (-> this ang-momentum) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-6 vf1) + (if (< f1-3 v1-6) + (vector-normalize! (-> this ang-momentum) f0-3) + ) + ) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + 0 + (none) + ) + ) + +(defmethod init-velocities! ((this rigid-body-control)) + (let ((v1-0 (-> this info))) + (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> v1-0 inv-mass)) + (matrix-3x3-triple-transpose-product (-> this inv-i-world) (-> this matrix) (-> v1-0 inv-inertial-tensor)) + ) + (vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world)) + 0 + (none) + ) + +(defmethod rigid-body-control-method-14 ((this rigid-body-control) (arg0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((a1-1 (-> this position))) + (let ((v1-0 (-> this position))) + (let ((a0-1 (-> this lin-velocity))) + (let ((a2-0 arg0)) + (.mov vf7 a2-0) + ) + (.lvf vf5 (&-> a0-1 quad)) + ) + (.lvf vf4 (&-> v1-0 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-1 quad) vf6) + ) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) + (set! (-> s4-0 w) 0.0) + (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) + (quaternion-float*! s4-0 s4-0 0.5) + (+! (-> this rot x) (* (-> s4-0 x) arg0)) + (+! (-> this rot y) (* (-> s4-0 y) arg0)) + (+! (-> this rot z) (* (-> s4-0 z) arg0)) + (+! (-> this rot w) (* (-> s4-0 w) arg0)) + ) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) + ) + ) + +(defun damping-time-adjust ((arg0 float) (arg1 float)) + (let ((f0-0 0.0) + (f1-0 1.0) + (f2-2 (* -1.0 (- 1.0 arg0) arg1)) + (f3-3 0.016666668) + ) + (fmax f0-0 (+ f1-0 (* f2-2 (/ 1.0 f3-3)))) + ) + ) + +(defmethod rigid-body-control-method-9 ((this rigid-body-control) (arg0 collide-shape-moving) (arg1 float)) + (rigid-body-control-method-12 this arg1) + (-> this info) + (let* ((v1-3 (-> this lin-momentum)) + (a0-2 (-> this lin-momentum)) + (f3-0 (-> this linear-damping)) + (f2-0 arg1) + (f0-0 0.0) + (f1-0 1.0) + (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) + (f3-3 0.016666668) + ) + (vector-float*! v1-3 a0-2 (fmax f0-0 (+ f1-0 (* f2-1 (/ 1.0 f3-3))))) + ) + (let* ((v1-5 (-> this ang-momentum)) + (a0-3 (-> this ang-momentum)) + (f3-6 (-> this angular-damping)) + (f2-3 arg1) + (f0-3 0.0) + (f1-2 1.0) + (f2-4 (* -1.0 (- 1.0 f3-6) f2-3)) + (f3-9 0.016666668) + ) + (vector-float*! v1-5 a0-3 (fmax f0-3 (+ f1-2 (* f2-4 (/ 1.0 f3-9))))) + ) + (init-velocities! this) + (if (logtest? (-> this flags) (rigid-body-flag enable-collision)) + (rbody-collision arg0 this arg1) + (rigid-body-control-method-14 this arg1) + ) + 0 + (none) + ) + +(defmethod collide-with-all-collide-cache-prims ((this collide-shape-moving) (arg0 matrix) (arg1 collide-query)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 *collide-cache*) + (s3-0 (-> this root-prim)) + (s2-0 1) + ) + (when (zero? (-> s3-0 prim-core prim-type)) + (let ((v1-2 s3-0)) + (set! s3-0 (-> (the-as collide-shape-prim-group v1-2) child 0)) + (set! s2-0 (the-as int (-> v1-2 specific 0))) + ) + ) + (b! #t cfg-13 :delay (nop!)) + (label cfg-3) + (+! s2-0 -1) + (let ((v1-4 -1)) + (b! (!= (-> s3-0 prim-core prim-type) v1-4) cfg-12 :delay (nop!)) + ) + (.lvf vf5 (&-> s3-0 local-sphere quad)) + (.lvf vf1 (&-> arg0 rvec quad)) + (.lvf vf2 (&-> arg0 uvec quad)) + (.lvf vf3 (&-> arg0 fvec quad)) + (.lvf vf4 (&-> arg0 trans quad)) + (.lvf vf6 (&-> s3-0 prim-core world-sphere quad)) + (.mul.x.vf acc vf1 vf5) + (.add.mul.y.vf acc vf2 vf5 acc) + (.add.mul.z.vf acc vf3 vf5 acc) + (.add.mul.w.vf vf7 vf4 vf0 acc :mask #b111) + (.sub.vf vf8 vf7 vf6 :mask #b111) + (.svf (&-> arg1 move-dist quad) vf8) + (let ((s1-0 (the-as collide-cache-prim (-> s4-0 prims)))) + (countdown (s0-0 (-> s4-0 num-prims)) + (when (logtest? (-> s3-0 prim-core collide-with) (-> s1-0 prim-core collide-as)) + (if (>= (-> s1-0 prim-core prim-type) 0) + ((method-of-object s3-0 collide-shape-prim-method-15)) + (collide-with-collide-cache-prim-sphere s3-0 arg1 s1-0) + ) + ) + (&+! s1-0 48) + ) + ) + (label cfg-12) + (&+! s3-0 80) + (label cfg-13) + (b! (nonzero? s2-0) cfg-3 :delay (nop!)) + ) + 0 + (none) + ) + ) + +(defun transform-rigid-body-prims ((arg0 collide-shape-prim) (arg1 matrix)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 arg0) + (a0-1 1) + ) + (when (zero? (-> v1-0 prim-core prim-type)) + (let ((a0-2 (the-as collide-shape-prim-group v1-0))) + (set! v1-0 (-> a0-2 child 0)) + (set! a0-1 (the-as int (-> a0-2 num-children))) + ) + ) + (while (nonzero? a0-1) + (+! a0-1 -1) + (.lvf vf5 (&-> v1-0 local-sphere quad)) + (.lvf vf1 (&-> arg1 rvec quad)) + (.lvf vf2 (&-> arg1 uvec quad)) + (.lvf vf3 (&-> arg1 fvec quad)) + (.lvf vf4 (&-> arg1 trans quad)) + (.mul.x.vf acc vf1 vf5) + (.add.mul.y.vf acc vf2 vf5 acc) + (.add.mul.z.vf acc vf3 vf5 acc) + (.add.mul.w.vf vf5 vf4 vf0 acc :mask #b111) + (.svf (&-> v1-0 prim-core world-sphere quad) vf5) + (&+! v1-0 80) + ) + ) + #f + ) + ) + +(deftype rigid-body-move-work (structure) + ((cquery collide-query :inline) + (best-dist float :overlay-at (-> cquery best-u)) + (mat matrix :inline) + (impact-info rigid-body-impact :inline) + (impact-info2 rigid-body-impact :inline) + (orig-position vector :inline) + (orig-rotation quaternion :inline) + (force vector :inline) + (vel vector :inline) + (p-body vector :inline) + (tmp vector :inline) + (tangent-dir vector :inline) + (proc2 process-focusable) + (rbody2 rigid-body-control) + (vel-dot-norm float) + (denom float) + (denom2 float) + (time-step float) + (time-step-scale float) + (step-count int8) + ) + ) + + +(defmethod rbody-collision ((this collide-shape-moving) (arg0 rigid-body-control) (arg1 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'rigid-body-move-work))) + (set! (-> s5-0 time-step) arg1) + (set! (-> s5-0 time-step-scale) 1.0) + (set! (-> s5-0 step-count) 0) + (until (not (and (< 0.05 (-> s5-0 time-step-scale)) (< (-> s5-0 step-count) (the-as int (-> this max-iteration-count)))) + ) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 cquery best-my-prim) #f) + (set! (-> s5-0 cquery best-other-prim) #f) + (set! (-> s5-0 orig-position quad) (-> arg0 position quad)) + (quaternion-copy! (-> s5-0 orig-rotation) (the-as quaternion (-> arg0 rot))) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (mem-copy! (the-as pointer (-> s5-0 mat)) (the-as pointer (-> arg0 matrix)) 64) + (set! (-> arg0 position quad) (-> s5-0 orig-position quad)) + (quaternion-copy! (the-as quaternion (-> arg0 rot)) (-> s5-0 orig-rotation)) + (rigid-body-control-method-26 arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (collide-with-all-collide-cache-prims this (-> s5-0 mat) (-> s5-0 cquery)) + (let ((f30-0 (-> s5-0 best-dist))) + (b! (>= f30-0 0.0) cfg-3 :delay #f) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (set! (-> s5-0 time-step-scale) 0.0) + (b! #t cfg-55 :delay (nop!)) + (label cfg-3) + *touching-list* + ((method-of-type touching-list touching-list-method-11)) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step) f30-0)) + ) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (let* ((a2-3 (-> s5-0 mat)) + (a3-0 (-> arg0 matrix)) + (v1-21 (-> a3-0 rvec quad)) + (a0-19 (-> a3-0 uvec quad)) + (a1-12 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-3 rvec quad) v1-21) + (set! (-> a2-3 uvec quad) a0-19) + (set! (-> a2-3 fvec quad) a1-12) + (set! (-> a2-3 trans quad) a3-1) + ) + (set! (-> s5-0 rbody2) #f) + (set! (-> s5-0 proc2) #f) + (when (-> s5-0 cquery best-other-prim) + (set! (-> s5-0 proc2) (the-as process-focusable (-> s5-0 cquery best-other-prim cshape process))) + (let ((v1-28 (-> s5-0 proc2 rbody))) + (when (nonzero? v1-28) + (set! (-> s5-0 rbody2) v1-28) + (cond + ((logtest? (-> v1-28 flags) (rigid-body-flag active)) + (if (not (logtest? (-> v1-28 flags) (rigid-body-flag enable-physics))) + (send-event (-> s5-0 proc2) 'enable-physics) + ) + ) + (else + (set! (-> s5-0 rbody2) #f) + ) + ) + ) + ) + ) + (let ((v1-33 (-> s5-0 cquery best-my-prim))) + (.lvf vf7 (&-> (-> s5-0 cquery) best-other-tri intersect quad)) + (.lvf vf6 (&-> v1-33 prim-core world-sphere quad)) + (.sub.vf vf8 vf6 vf7) + (.mul.vf vf9 vf8 vf8 :mask #b111) + (.mul.x.vf acc vf0 vf9 :mask #b1000) + (.add.mul.y.vf acc vf0 vf9 acc :mask #b1000) + (.add.mul.z.vf vf9 vf0 vf9 acc :mask #b1000) + (.isqrt.vf Q vf0 vf9 :fsf #b11 :ftf #b11) + (.mov.vf vf8 vf0 :mask #b1000) + (.mov.vf vf7 vf0 :mask #b1000) + (.wait.vf) + (.mul.vf vf8 vf8 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> s5-0 impact-info normal quad) vf8) + (.svf (&-> s5-0 impact-info point quad) vf7) + (set! (-> s5-0 impact-info prim-id) (-> v1-33 prim-id)) + ) + (set! (-> s5-0 impact-info pat) (-> s5-0 cquery best-other-tri pat)) + (rigid-body-control-method-23 arg0 (the-as vector (-> s5-0 impact-info)) (-> s5-0 impact-info velocity)) + (when (-> s5-0 rbody2) + (init-velocities! (-> s5-0 rbody2)) + (rigid-body-control-method-23 (-> s5-0 rbody2) (the-as vector (-> s5-0 impact-info)) (-> s5-0 vel)) + (vector-! (-> s5-0 impact-info velocity) (-> s5-0 impact-info velocity) (-> s5-0 vel)) + ) + (set! (-> s5-0 impact-info impulse) 0.0) + (set! (-> s5-0 vel-dot-norm) + (+ -409.6 (vector-dot (-> s5-0 impact-info velocity) (-> s5-0 impact-info normal))) + ) + (set! (-> s5-0 denom) 0.0) + (set! (-> s5-0 denom2) 0.0) + (b! (>= (-> s5-0 vel-dot-norm) 0.0) cfg-50) + (vector-! (-> s5-0 p-body) (the-as vector (-> s5-0 impact-info)) (-> arg0 position)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 p-body) (-> s5-0 impact-info normal)) + (vector-rotate*! (-> s5-0 tmp) (-> s5-0 tmp) (-> arg0 inv-i-world)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 p-body)) + (set! (-> s5-0 denom) (+ (-> arg0 info inv-mass) (vector-dot (-> s5-0 impact-info normal) (-> s5-0 tmp)))) + (let ((f30-1 (-> arg0 bounce-factor))) + (cond + ((-> s5-0 proc2) + (set! f30-1 + (cond + ((-> s5-0 rbody2) + (vector-! (-> s5-0 p-body) (the-as vector (-> s5-0 impact-info)) (-> s5-0 rbody2 position)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 p-body) (-> s5-0 impact-info normal)) + (vector-rotate*! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 rbody2 inv-i-world)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 p-body)) + (set! (-> s5-0 denom2) + (+ (-> s5-0 rbody2 info inv-mass) (vector-dot (-> s5-0 impact-info normal) (-> s5-0 tmp))) + ) + (fmax + (fmax f30-1 (-> s5-0 rbody2 bounce-factor)) + (* (-> arg0 info bounce-mult-factor) (-> s5-0 rbody2 info bounce-mult-factor)) + ) + ) + (else + (let* ((s3-0 (-> s5-0 proc2)) + (a0-46 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (if a0-46 + (set! (-> s5-0 denom2) (get-inv-mass a0-46)) + ) + ) + f30-1 + ) + ) + ) + ) + (else + ) + ) + (set! (-> s5-0 impact-info impulse) + (* (+ 1.0 f30-1) (- (-> s5-0 vel-dot-norm)) (/ 1.0 (+ (-> s5-0 denom) (-> s5-0 denom2)))) + ) + ) + (set! (-> s5-0 impact-info process) (-> s5-0 proc2)) + (when (-> s5-0 proc2) + (set! (-> s5-0 impact-info2 point quad) (-> s5-0 impact-info point quad)) + (vector-float*! (-> s5-0 impact-info2 normal) (-> s5-0 impact-info normal) -1.0) + (vector-float*! (-> s5-0 impact-info2 velocity) (-> s5-0 impact-info velocity) -1.0) + (set! (-> s5-0 impact-info2 impulse) (-> s5-0 impact-info impulse)) + (set! (-> s5-0 impact-info2 pat) (-> s5-0 impact-info pat)) + (set! (-> s5-0 impact-info2 prim-id) (-> s5-0 cquery best-other-prim prim-id)) + (set! (-> s5-0 impact-info2 process) (-> arg0 process)) + (send-event (-> s5-0 proc2) 'impact-impulse :from (-> arg0 process) (-> s5-0 impact-info2)) + (if (or (-> s5-0 rbody2) (let ((a0-53 (-> s5-0 proc2 root))) + (logtest? (-> a0-53 penetrated-by) (penetrate vehicle)) + ) + ) + 0 + (set! (-> s5-0 impact-info impulse) + (* (-> s5-0 impact-info impulse) (/ (+ (-> s5-0 denom) (-> s5-0 denom2)) (-> s5-0 denom))) + ) + ) + ) + (send-event (-> arg0 process) 'impact-impulse :from (-> arg0 process) (-> s5-0 impact-info)) + (vector-float*! (-> s5-0 force) (-> s5-0 impact-info normal) (-> s5-0 impact-info impulse)) + (let ((f30-2 (-> arg0 info mass))) + (if (-> s5-0 rbody2) + (set! f30-2 (fmin f30-2 (-> s5-0 rbody2 info mass))) + ) + (vector+float*! + (-> s5-0 tangent-dir) + (-> s5-0 impact-info velocity) + (-> s5-0 impact-info normal) + (- (-> s5-0 vel-dot-norm)) + ) + (vector-normalize! (-> s5-0 tangent-dir) 1.0) + (let ((f0-39 (* -1.0 (fmin + (* (vector-dot (-> s5-0 tangent-dir) (-> s5-0 impact-info velocity)) f30-2) + (* (-> arg0 friction-factor) (-> s5-0 impact-info impulse)) + ) + ) + ) + ) + (vector+float*! (-> s5-0 force) (-> s5-0 force) (-> s5-0 tangent-dir) f0-39) + ) + ) + (apply-impact! arg0 (the-as vector (-> s5-0 impact-info)) (-> s5-0 force)) + (when (-> s5-0 rbody2) + (vector-float*! (-> s5-0 force) (-> s5-0 force) -1.0) + (apply-impact! (-> s5-0 rbody2) (the-as vector (-> s5-0 impact-info)) (-> s5-0 force)) + ) + (rigid-body-control-method-12 arg0 1.0) + (init-velocities! arg0) + (let ((f30-3 (-> s5-0 best-dist))) + (when (< f30-3 0.0001) + (vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 impact-info normal) 40.96) + (rigid-body-control-method-26 arg0) + ) + (set! (-> s5-0 time-step-scale) (- (-> s5-0 time-step-scale) (* f30-3 (-> s5-0 time-step-scale)))) + ) + (when (-> s5-0 rbody2) + (rigid-body-control-method-12 (-> s5-0 rbody2) 1.0) + (init-velocities! (-> s5-0 rbody2)) + 0 + ) + (+! (-> s5-0 step-count) 1) + ) + (b! #t cfg-53 :delay (nop!)) + (label cfg-50) + (when (-> s5-0 rbody2) + (set! (-> arg0 blocked-by) (the-as process-focusable (-> s5-0 cquery best-other-prim cshape process))) + 0 + ) + (vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 impact-info normal) 40.96) + (rigid-body-control-method-26 arg0) + 0 + (label cfg-53) + (when (< 0.0 (-> s5-0 time-step-scale)) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (set! (-> s5-0 time-step-scale) 0.0) + ) + (label cfg-55) + (let ((f0-53 (* (- 1.0 (-> s5-0 time-step-scale)) (-> s5-0 time-step)))) + (set! (-> arg0 time-remaining) (- (-> arg0 time-remaining) f0-53)) + ) + ) + 0 + (none) + ) + ) + +(defmethod apply-impact! ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (vector+! (-> this force) (-> this force) arg1) + (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-1 0) arg0 (-> this position)) + (vector-cross! (-> v1-1 1) (-> v1-1 0) arg1) + (vector+! (-> this torque) (-> this torque) (-> v1-1 1)) + ) + 0 + (none) + ) + +(defmethod rigid-body-control-method-22 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> v1-0 0) arg1) + (vector+! (-> this torque) (-> this torque) (-> v1-0 1)) + ) + 0 + (none) + ) + +(defmethod rigid-body-control-method-21 ((this rigid-body-control) (arg0 vector) (arg1 vector) (arg2 float)) + (vector+! (-> this force) (-> this force) arg1) + (let* ((t0-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position))) + (v1-3 (vector-cross! (new 'stack-no-clear 'vector) t0-2 arg1)) + ) + (let ((f0-0 (vector-length t0-2))) + (if (< arg2 f0-0) + (vector-float*! v1-3 v1-3 (/ arg2 f0-0)) + ) + ) + (vector+! (-> this torque) (-> this torque) v1-3) + ) + 0 + (none) + ) + +(defmethod rigid-body-control-method-19 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-rotate*! s4-0 arg1 (-> this matrix)) + (vector-rotate*! s5-0 arg0 (-> this matrix)) + (vector+! s5-0 s5-0 (-> this position)) + (apply-impact! this s5-0 s4-0) + ) + 0 + (none) + ) + +(defmethod add-force! ((this rigid-body-control) (arg0 vector)) + (vector+! (-> this force) (-> this force) arg0) + 0 + (none) + ) + +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-25 ((this rigid-body-control) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-rotate*! gp-0 (-> this info cm-offset-joint) (-> this matrix)) + (vector-! arg0 (-> this position) gp-0) + ) + (none) + ) + +(defmethod debug-print-force-torque ((this rigid-body-control) (arg0 object)) + (format arg0 " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z)) + (format arg0 " torque ~M ~M ~M~%" (-> this torque x) (-> this torque y) (-> this torque z)) + 0 + (none) + ) + +(defmethod debug-print-momentum ((this rigid-body-control) (arg0 object)) + (format arg0 " lin-mom ~M ~M ~M" (-> this lin-momentum x) (-> this lin-momentum y) (-> this lin-momentum z)) + (format + arg0 + " ang-mom ~M ~M ~M~%" + (-> this ang-momentum x) + (-> this ang-momentum y) + (-> this ang-momentum z) + ) + 0 + (none) + ) + +(defmethod debug-print-velocity ((this rigid-body-control) (arg0 object)) + (format arg0 " lin-vel ~M ~M ~M" (-> this lin-velocity x) (-> this lin-velocity y) (-> this lin-velocity z)) + (format + arg0 + " ang-vel ~f ~f ~f~%" + (-> this ang-velocity x) + (-> this ang-velocity y) + (-> this ang-velocity z) + ) + 0 + (none) + ) + +(defmethod debug-print-pos-rot ((this rigid-body-control) (arg0 object)) + (format arg0 " position ~M ~M ~M" (-> this position x) (-> this position y) (-> this position z)) + (format arg0 " rotation ~f ~f ~f ~f~%" (-> this rot x) (-> this rot y) (-> this rot z) (-> this rot w)) + 0 + (none) + ) + +(defmethod debug-print-info ((this rigid-body-control) (arg0 object)) + (debug-print-force-torque this arg0) + (debug-print-pos-rot this arg0) + (debug-print-momentum this arg0) + (debug-print-velocity this arg0) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod rigid-body-control-method-10 ((this rigid-body-control) (arg0 rigid-body-object) (arg1 float) (arg2 float)) + (let* ((s4-1 (max 1 (min 4 (+ (the int (* 0.9999 (/ arg1 arg2))) 1)))) + (f30-0 (/ arg1 (the float s4-1))) + (s3-0 (-> this force-callback)) + ) + (while (nonzero? s4-1) + (+! s4-1 -1) + (s3-0 arg0 f30-0) + (rigid-body-control-method-9 this (the-as collide-shape-moving (-> arg0 root)) f30-0) + ) + ) + 0 + ) + +(defmethod update-rbody-transform! ((this rigid-body-control) (arg0 collide-shape-moving)) + (quaternion-copy! (-> arg0 quat) (the-as quaternion (-> this rot))) + (rigid-body-control-method-25 this (-> arg0 trans)) + (set! (-> arg0 transv quad) (-> this lin-velocity quad)) + 0 + (none) + ) + +(defmethod get-inv-mass ((this rigid-body-object)) + (-> this info info inv-mass) + ) + +(defmethod rigid-body-object-method-37 ((this rigid-body-object)) + (let ((a0-1 (-> this info name))) + (when (nonzero? a0-1) + (set! (-> this info) (the-as rigid-body-object-constants (-> a0-1 value))) + (set! (-> this rbody info) (-> this info info)) + ) + ) + (rigid-body-info-method-9 (-> this info info)) + (set! (-> this rbody force-callback) (method-of-object this apply-gravity!)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-53 ((this rigid-body-object) (arg0 float)) + (when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + (when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force)) + (vector-float*! (-> this player-force) (-> this player-force) (/ 1.0 arg0)) + ) + (apply-impact! (-> this rbody) (-> this player-force-position) (-> this player-force)) + ) + 0 + (none) + ) + +(defmethod apply-gravity! ((this rigid-body-object) (arg0 float)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-reset! a1-1) + (set! (-> a1-1 y) (* -1.0 (-> this info extra gravity) (-> this rbody info mass))) + (add-force! (-> this rbody) a1-1) + ) + 0 + (none) + ) + +(defmethod rigid-body-object-method-32 ((this rigid-body-object)) + (rigid-body-control-method-10 (-> this rbody) this (seconds-per-frame) (-> this max-time-step)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-54 ((this rigid-body-object)) + (rigid-body-control-method-10 (-> this rbody) this (-> this rbody time-remaining) (-> this max-time-step)) + 0 + (none) + ) + +(defmethod clear-impulse-force-flag! ((this rigid-body-object)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod go-idle ((this rigid-body-object)) + (go (method-of-object this idle)) + 0 + ) + +(defmethod alloc-rbody-control! ((this rigid-body-object) (arg0 rigid-body-object-constants)) + (set! (-> this info) arg0) + (set! (-> this rbody) (new 'process 'rigid-body-control this)) + (update-transforms (-> this root)) + (init! + (-> this rbody) + (-> this info info) + (-> this root trans) + (-> this root quat) + (the-as (function rigid-body-object float) (method-of-object this apply-gravity!)) + ) + (rigid-body-object-method-37 this) + (set! (-> this max-time-step) (-> arg0 extra max-time-step)) + (set! (-> this root max-iteration-count) (the-as uint 4)) + (when (nonzero? (-> this skel)) + (let ((v1-16 (-> this skel root-channel 0))) + (set! (-> v1-16 num-func) num-func-identity) + (set! (-> v1-16 frame-num) 0.0) + ) + ) + 0 + (none) + ) + +(defmethod init-collision! ((this rigid-body-object)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + ((method-of-object s5-0 collide-shape-method-54)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-16 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(define *rigid-body-object-constants* (new 'static 'rigid-body-object-constants + :info (new 'static 'rigid-body-info + :mass 2.0 + :inv-mass 0.5 + :linear-damping 1.0 + :angular-damping 1.0 + :bounce-factor 0.5 + :friction-factor 0.1 + :cm-offset-joint (new 'static 'vector :w 1.0) + :inertial-tensor-box (new 'static 'array meters 3 (meters 4) (meters 4) (meters 4)) + ) + :extra (new 'static 'rigid-body-object-extra-info + :max-time-step 0.033333335 + :gravity (meters 80) + :idle-distance (meters 50) + :attack-force-scale 1.0 + ) + :name '*rigid-body-object-constants* + ) + ) + +(defmethod init-rbody-control! ((this rigid-body-object)) + (alloc-rbody-control! this *rigid-body-object-constants*) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod init-from-entity! ((this rigid-body-object) (arg0 entity-actor)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (init-rbody-control! this) + (go-idle this) + 0 + ) + +(defmethod rigid-body-object-method-38 ((this rigid-body-object)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-30 ((this rigid-body-object)) + (ja-post) + 0 + (none) + ) + +(defmethod rbody-post ((this rigid-body-object)) + (rigid-body-object-method-32 this) + (rigid-body-object-method-38 this) + (update-rbody-transform! (-> this rbody) (the-as collide-shape-moving (-> this root))) + (rigid-body-object-method-30 this) + (update-transforms (-> this root)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-42 ((this rigid-body-object)) + (logior! (-> this flags) (rigid-body-object-flag enable-collision)) + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> this root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> this root backup-collide-with)) + ) + 0 + (none) + ) + +(defmethod rigid-body-object-method-43 ((this rigid-body-object)) + (logclear! (-> this flags) (rigid-body-object-flag enable-collision)) + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + 0 + (none) + ) + +(defmethod apply-momentum! ((this rigid-body-object)) + (when (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (logior! (-> this rbody flags) (rigid-body-flag enable-physics)) + (rigid-body-control-method-28 (-> this rbody) (-> this root trans) (-> this root quat)) + (vector-float*! (-> this rbody lin-momentum) (-> this root transv) (-> this info info mass)) + (vector-reset! (-> this rbody ang-momentum)) + ) + 0 + (none) + ) + +(defmethod disable-physics! ((this rigid-body-object)) + (logclear! (-> this rbody flags) (rigid-body-flag enable-physics)) + 0 + (none) + ) + +(defmethod impulse-handler ((this rigid-body-object)) + (logior! (-> this flags) (rigid-body-object-flag disturbed)) + (set-time! (-> this disturbed-time)) + (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (apply-momentum! this) + ) + 0 + (none) + ) + +;; WARN: Return type mismatch int vs object. +(defmethod go-active ((this rigid-body-object)) + (go (method-of-object this active)) + 0 + ) + +(defmethod rigid-body-object-method-46 ((this rigid-body-object)) + 0 + (none) + ) + +(defmethod rigid-body-object-method-48 ((this rigid-body-object)) + 0 + (none) + ) + +(defmethod init-rbody-impact-from-tshape! ((this rigid-body-object) (arg0 rigid-body-impact) (arg1 touching-shapes-entry)) + (set! (-> arg0 process) #f) + (set! (-> arg0 prim-id) (the-as uint 0)) + (vector-reset! (-> arg0 normal)) + (vector-reset! (-> arg0 velocity)) + (set! (-> arg0 point quad) (-> this root trans quad)) + (when arg1 + (let ((s3-0 (-> arg1 head))) + (when s3-0 + (get-intersect-point (-> arg0 point) s3-0 (-> this root) arg1) + (let ((s5-1 (get-touched-prim s3-0 (-> this root) arg1))) + (when s5-1 + (set! (-> arg0 prim-id) (-> s5-1 prim-id)) + (vector-! (-> arg0 normal) (-> arg0 point) (the-as vector (-> s5-1 prim-core))) + (vector-normalize! (-> arg0 normal) 1.0) + (vector+float*! + (-> arg0 point) + (the-as vector (-> s5-1 prim-core)) + (-> arg0 normal) + (-> s5-1 prim-core world-sphere w) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +(defmethod impulse-force<-penetrate ((this rigid-body-object) (arg0 rigid-body-impact) (arg1 attack-info) (arg2 penetrate)) + (local-vars (f1-1 float)) + 0.0 + (let ((f0-1 0.0)) + (cond + ((logtest? (penetrate jak-red-shockwave) arg2) + (set! f0-1 (* 81920.0 (-> arg1 control))) + (set! f1-1 (-> arg1 damage)) + ) + ((logtest? arg2 (penetrate punch)) + (set! f0-1 40960.0) + (set! f1-1 4.0) + ) + ((logtest? arg2 (penetrate flop spin)) + (set! f0-1 20480.0) + (set! f1-1 2.0) + ) + ((logtest? (attack-mask vehicle-damage-factor) (-> arg1 mask)) + (set! f1-1 (* (-> arg1 damage) (-> arg1 vehicle-damage-factor))) + (if (logtest? (attack-mask vehicle-impulse-factor) (-> arg1 mask)) + (set! f0-1 (* 49152.0 (-> arg1 vehicle-impulse-factor) (-> arg1 damage))) + ) + 0 + ) + (else + (set! f0-1 8192.0) + (set! f1-1 2.0) + ) + ) + (set! (-> arg0 impulse) (* f0-1 (-> this info extra attack-force-scale))) + ) + (rigid-body-object-method-46 this) + 0 + (none) + ) + +(defmethod attack-handler ((this rigid-body-object) + (arg0 process-drawable) + (arg1 attack-info) + (arg2 touching-shapes-entry) + (arg3 penetrate) + ) + (when arg2 + (let ((s5-0 (new 'stack-no-clear 'rigid-body-impact))) + (init-rbody-impact-from-tshape! this s5-0 arg2) + (if (logtest? (attack-mask attacker-velocity) (-> arg1 mask)) + (set! (-> s5-0 velocity quad) (-> arg1 attacker-velocity quad)) + (vector-! (-> s5-0 velocity) (-> s5-0 point) (-> arg0 root trans)) + ) + (impulse-force<-penetrate this s5-0 arg1 arg3) + (impulse-handler this) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> s5-0 velocity quad)) + (vector-normalize! s4-1 1.0) + (vector-float*! s4-1 s4-1 (-> s5-0 impulse)) + (apply-impact! (-> this rbody) (-> s5-0 point) s4-1) + (rigid-body-control-method-12 (-> this rbody) 1.0) + (init-velocities! (-> this rbody)) + (when #f + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 point) s4-1 (meters 0.00024414062) *color-blue*) + ) + ) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + #t + ) + ) + +(defmethod touch-handler ((this rigid-body-object) (arg0 process-focusable) (arg1 touching-shapes-entry)) + (b! + (or (not (logtest? (process-mask target crate enemy) (-> arg0 mask))) + (and (logtest? (-> arg0 mask) (process-mask target)) (focus-test? arg0 dangerous pilot)) + ) + cfg-17 + :delay (nop!) + ) + (let ((s5-0 (new 'stack-no-clear 'rigid-body-impact)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (get-inv-mass arg0)) + ) + (init-rbody-impact-from-tshape! this s5-0 arg1) + (if (logtest? (-> this rbody flags) (rigid-body-flag enable-physics)) + (rigid-body-control-method-23 (-> this rbody) (-> s5-0 point) (-> s5-0 velocity)) + (set! (-> s5-0 velocity quad) (-> this root transv quad)) + ) + (let ((v1-17 (-> arg0 root))) + (set! (-> s4-0 quad) (-> v1-17 transv quad)) + (vector-! (-> s5-0 velocity) (-> v1-17 transv) (-> s5-0 velocity)) + ) + (let ((f0-1 (vector-dot (-> s5-0 velocity) (-> s5-0 normal)))) + (when (< f0-1 0.0) + (set! (-> s5-0 impulse) (/ f0-1 (+ f30-0 (-> this info info inv-mass)))) + (vector+float*! s4-0 s4-0 (-> s5-0 normal) (* -3.1 f30-0 (-> s5-0 impulse))) + (set! (-> s4-0 y) (fmax (* 49152.0 f30-0) (-> s4-0 y))) + (impulse-handler this) + (let ((a2-4 (new 'stack-no-clear 'vector))) + (vector-float*! a2-4 (-> s5-0 normal) (-> s5-0 impulse)) + (apply-impact! (-> this rbody) (-> s5-0 point) a2-4) + ) + (rigid-body-control-method-12 (-> this rbody) 1.0) + (init-velocities! (-> this rbody)) + (when #f + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 point) + (-> s5-0 normal) + (- (-> s5-0 impulse)) + *color-blue* + ) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + ) + ) + ) + (label cfg-17) + #t + ) + +(defmethod rbody-event-handler ((this rigid-body-object) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('impact-impulse) + (-> arg3 param 0) + (if (!= this arg0) + (impulse-handler this) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + #t + ) + (('touched) + (if (= this *debug-actor*) + (format *stdcon* "rigid-body-object got touched~%") + ) + (when (zero? (-> (the-as process-focusable arg0) rbody)) + (let ((s3-0 (if (type? arg0 process-focusable) + arg0 + ) + ) + ) + (when s3-0 + (when (logtest? (-> s3-0 mask) (process-mask target)) + (logior! (-> this flags) (rigid-body-object-flag player-touching)) + (set-time! (-> this player-touch-time)) + (impulse-handler this) + ) + (if (not (logtest? (-> s3-0 mask) (process-mask target))) + (touch-handler this (the-as process-focusable s3-0) (the-as touching-shapes-entry (-> arg3 param 0))) + ) + ) + ) + ) + ) + (('attack) + (let ((s3-1 (the-as object (-> arg3 param 1))) + (t0-1 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3)) + ) + (when (!= (-> (the-as attack-info s3-1) id) (-> this incoming-attack-id)) + (set! (-> this incoming-attack-id) (-> (the-as attack-info s3-1) id)) + (attack-handler + this + (the-as process-drawable arg0) + (the-as attack-info s3-1) + (the-as touching-shapes-entry (-> arg3 param 0)) + t0-1 + ) + ) + ) + ) + (('edge-grabbed 'pilot-edge-grab) + (let ((s5-2 (the-as object (-> arg3 param 0)))) + (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) + (let ((a0-25 (if (type? arg0 process-focusable) + (the-as process-focusable arg0) + ) + ) + ) + (when a0-25 + (let ((f0-1 (/ 163840.0 (get-inv-mass a0-25)))) + (logior! (-> this flags) (rigid-body-object-flag player-touching player-edge-grabbing player-contact-force)) + (set! (-> this player-force-position quad) (-> (the-as attack-info s5-2) attacker-velocity quad)) + (vector-reset! (-> this player-force)) + (set! (-> this player-force y) (* -1.0 f0-1)) + ) + ) + ) + ) + ) + (not (logtest? (-> this focus-status) (focus-status dead inactive))) + ) + (('ridden) + (let ((v1-47 (the-as object (-> arg3 param 0)))) + (when (the-as uint v1-47) + (let* ((s5-3 (handle->process (-> (the-as focus v1-47) handle))) + (a0-34 (if (type? s5-3 process-focusable) + s5-3 + ) + ) + ) + (when (and a0-34 + (logtest? (-> a0-34 mask) (process-mask target)) + (not (logtest? (-> (the-as process-focusable a0-34) focus-status) (focus-status on-water under-water))) + ) + (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) + (logior! (-> this flags) (rigid-body-object-flag player-touching player-standing-on player-contact-force)) + (set! (-> this player-force-position quad) (-> (the-as process-focusable a0-34) root trans quad)) + (vector-reset! (-> this player-force)) + (let ((f0-4 (/ 163840.0 (get-inv-mass (the-as process-focusable a0-34)))) + (f1-1 1.0) + ) + (set! (-> this player-force y) (* -1.0 f0-4 f1-1)) + ) + ) + ) + ) + ) + ) + ) + (('bonk) + (when #t + (let* ((s3-2 arg0) + (s4-1 (if (type? s3-2 process-focusable) + s3-2 + ) + ) + ) + (when s4-1 + (logior! (-> this flags) (rigid-body-object-flag player-touching player-impulse-force)) + (set-time! (-> this player-touch-time)) + (impulse-handler this) + (set! (-> this player-force-position quad) (-> (the-as process-focusable s4-1) root trans quad)) + (let ((f30-2 (* 0.00012207031 (the-as float (-> arg3 param 1)))) + (f0-9 (/ 163840.0 (get-inv-mass (the-as process-focusable s4-1)))) + ) + (vector-reset! (-> this player-force)) + (set! (-> this player-force y) (* -0.1 f0-9 f30-2)) + ) + ) + ) + ) + ) + (('enable-physics) + (impulse-handler this) + ) + ) + ) + +(defbehavior rigid-body-object-event-handler rigid-body-object ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (rbody-event-handler self arg0 arg1 arg2 arg3) + ) + +(defstate idle (rigid-body-object) + :virtual #t + :trans (behavior () + (if (and *target* (and (>= (-> self info extra idle-distance) + (vector-vector-distance (-> self root trans) (-> *target* control trans)) + ) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (go-virtual active) + ) + ) + :code sleep-code + :post ja-post + ) + +(defstate active (rigid-body-object) + :virtual #t + :event rigid-body-object-event-handler + :trans (behavior () + (if (or (not *target*) (or (< (+ 4096.0 (-> self info extra idle-distance)) + (vector-vector-distance (-> self root trans) (-> *target* control trans)) + ) + (focus-test? *target* teleporting) + ) + ) + (go-virtual idle) + ) + ) + :code sleep-code + :post (behavior () + (rbody-post self) + ) + ) diff --git a/goal_src/jak3/engine/process-drawable/focus.gc b/goal_src/jak3/engine/process-drawable/focus.gc index ec594ec8c98..febfac2ab47 100644 --- a/goal_src/jak3/engine/process-drawable/focus.gc +++ b/goal_src/jak3/engine/process-drawable/focus.gc @@ -14,7 +14,7 @@ ) (:methods (clear-focused (_type_) none) - (collide-check? (_type_ process-focusable) object) + (collide-spec-match? (_type_ process-focusable) object) (reset-to-collide-spec (_type_ collide-spec) none) (try-update-focus (_type_ process-focusable) symbol) ) @@ -29,7 +29,7 @@ (none) ) -(defmethod collide-check? ((this focus) (proc process-focusable)) +(defmethod collide-spec-match? ((this focus) (proc process-focusable)) "If the focused process is not dead, check that the [[collide-spec]] of the focus and the process match." (when (and proc (not (logtest? (-> proc focus-status) (focus-status disable dead)))) diff --git a/goal_src/jak3/engine/process-drawable/process-drawable-h.gc b/goal_src/jak3/engine/process-drawable/process-drawable-h.gc index ae03f84f34d..79fe5aef5be 100644 --- a/goal_src/jak3/engine/process-drawable/process-drawable-h.gc +++ b/goal_src/jak3/engine/process-drawable/process-drawable-h.gc @@ -210,9 +210,11 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) &key (eval? #t) ) @@ -225,8 +227,10 @@ num-func = sets the num-func field for the channel. this lets you change the function with eval'ing. param0 = 1st parameter for the playback function. ONLY USE THESE WITH num-func !! param1 = 2nd parameter for the playback function. ONLY USE THESE WITH num-func !! + param2 = 3rd parameter for the playback function. ONLY USE THESE WITH num-func !! frame-num = set the frame-num field. - frame-interp = set the frame-interp field. + frame-interp0 = set the first value of the frame-interp array. + frame-interp1 = set the second value of the frame-interp array. dist = set the dist field. available num! functions: - (+!) = advance anim. @@ -282,6 +286,10 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) + (p2 (if param2 param2 + (cond + ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) + ))) (frame-num (cond ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) @@ -292,11 +300,13 @@ (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan))) - ,(if frame-interp `(set! (-> ja-ch frame-interp) ,frame-interp) `(none)) + ,(if frame-interp0 `(set! (-> ja-ch frame-interp 0) ,frame-interp0) `(none)) + ,(if frame-interp1 `(set! (-> ja-ch frame-interp 1) ,frame-interp1) `(none)) ,(if dist `(set! (-> ja-ch dist) ,dist) `(none)) ,(if frame-group `(set! (-> ja-ch frame-group) (the art-joint-anim ,frame-group)) `(none)) ,(if p0 `(set! (-> ja-ch param 0) ,p0) `(none)) ,(if p1 `(set! (-> ja-ch param 1) ,p1) `(none)) + ,(if p2 `(set! (-> ja-ch param 2) ,p2) `(none)) ,(if num-func `(set! (-> ja-ch num-func) ,num-func) `(none)) ,(if frame-num `(set! (-> ja-ch frame-num) ,frame-num) `(none)) ,(if nf @@ -309,7 +319,7 @@ `(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) frames num-frames)))) `(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group frames num-frames)))) )) - ((eq? num! 'identity) `(set! (-> ja-ch frame-num) ,(car num-args))) + ((and (eq? num! 'identity) (not (null? num-args))) `(set! (-> ja-ch frame-num) ,(car num-args))) (#t `(none)) ) )) @@ -320,10 +330,12 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) ) - `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :num-func ,num-func :frame-num ,frame-num :frame-interp ,frame-interp :dist ,dist) + `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :param2 ,param2 :num-func ,num-func :frame-num ,frame-num :frame-interp0 ,frame-interp0 :frame-interp1 ,frame-interp1 :dist ,dist) ) \ No newline at end of file diff --git a/goal_src/jak3/engine/process-drawable/process-taskable-h.gc b/goal_src/jak3/engine/process-drawable/process-taskable-h.gc index ff725e2964d..a6b5c47e78c 100644 --- a/goal_src/jak3/engine/process-drawable/process-taskable-h.gc +++ b/goal_src/jak3/engine/process-drawable/process-taskable-h.gc @@ -9,6 +9,15 @@ (defenum process-taskable-flags :type uint32 :bitfield #t + (ptf0 0) + (ptf1 1) + (ptf2 2) + (ptf3 3) + (ptf4 4) + (ptf5 5) + (ptf6 6) + (ptf7 7) + (ptf8 8) ) ;; ---process-taskable-flags @@ -37,12 +46,12 @@ (play-game game-task-event) ) (:methods - (process-taskable-method-33 () none) - (process-taskable-method-34 () none) - (process-taskable-method-35 () none) - (process-taskable-method-36 () none) - (process-taskable-method-37 () none) - (process-taskable-method-38 () none) - (process-taskable-method-39 () none) + (init-collision! (_type_) none) + (init-defaults! (_type_) none) + (init-skeleton! (_type_) none) + (process-taskable-method-36 (_type_) symbol) + (get-art-element (_type_) art-element) + (process-taskable-method-38 (_type_) none) + (update-cloth-and-shadow (_type_) none) ) ) diff --git a/goal_src/jak3/engine/process-drawable/process-taskable.gc b/goal_src/jak3/engine/process-drawable/process-taskable.gc index ba4dac591e3..284d2d84551 100644 --- a/goal_src/jak3/engine/process-drawable/process-taskable.gc +++ b/goal_src/jak3/engine/process-drawable/process-taskable.gc @@ -7,3 +7,522 @@ ;; DECOMP BEGINS +;; WARN: Return type mismatch process-focusable vs process-taskable. +(defmethod relocate ((this process-taskable) (offset int)) + (if (nonzero? (-> this task)) + (&+! (-> this task) offset) + ) + (the-as process-taskable ((method-of-type process-focusable relocate) this offset)) + ) + +(defbehavior process-taskable-anim-loop process-taskable ((arg0 (function process-taskable object))) + (while (arg0 self) + (let ((s5-0 (get-art-element self))) + (when (!= (ja-group) s5-0) + (ja-channel-push! 1 0) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-0)) + ) + ) + (suspend) + (if (ja-group) + (ja :num! (loop!)) + ) + (process-taskable-method-38 self) + ) + 0 + (none) + ) + +(defmethod process-taskable-method-36 ((this process-taskable)) + #t + ) + +;; WARN: Return type mismatch art-joint-anim vs art-element. +(defmethod get-art-element ((this process-taskable)) + (the-as art-element (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + +(defmethod process-taskable-method-38 ((this process-taskable)) + 0 + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod update-cloth-and-shadow ((this process-taskable)) + (if (logtest? (-> this draw status) (draw-control-status no-draw)) + (process-drawable-show-all-cloth this #f) + (process-drawable-show-all-cloth this #t) + ) + (let ((a0-3 (-> this draw shadow-ctrl))) + (cond + ((and (-> this draw shadow) + (and (zero? (-> this draw cur-lod)) (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + (probe-line-for-shadow a0-3 (-> this draw origin) -4096.0 4096.0 32768.0) + ) + (else + (let ((v1-14 a0-3)) + (logior! (-> v1-14 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (none) + ) + +(defstate hide (process-taskable) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('say) + (let ((v0-0 (current-time))) + (set! (-> self want-to-say) v0-0) + v0-0 + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (let ((v1-6 (-> self root root-prim))) + (set! (-> v1-6 prim-core collide-as) (collide-spec)) + (set! (-> v1-6 prim-core collide-with) (collide-spec)) + ) + 0 + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) + ) + (process-drawable-show-all-cloth self #t) + ) + :trans (behavior () + (let ((v1-1 (get-current-task-event (-> self task)))) + (if (and (nonzero? (-> v1-1 action)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (logtest? (-> v1-1 flags) (game-task-flags gatflag-01)) + (not (time-elapsed? (-> self birth-time) (seconds 0.1))) + ) + ) + (go-virtual idle) + ) + ) + ) + :code sleep-code + ) + +(defstate idle (process-taskable) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (cond + ((logtest? (-> self flags) (process-taskable-flags ptf4)) + (go-virtual die) + ) + ((logtest? (-> self flags) (process-taskable-flags ptf0)) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + ) + ) + ) + (('touch) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + ) + (('say) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> self want-to-say) (the-as time-frame v0-0)) + v0-0 + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + :trans (behavior () + (if (< (vector-vector-distance (-> self draw origin) (math-camera-pos)) (-> self draw origin w)) + (logclear! (-> self draw status) (draw-control-status force-vu1)) + (logior! (-> self draw status) (draw-control-status force-vu1)) + ) + (let ((gp-1 (get-current-task-event (-> self task)))) + (cond + ((= (-> gp-1 action) (game-task-action hide)) + (if (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (logtest? (-> gp-1 flags) (game-task-flags gatflag-01)) + ) + (go-virtual hide) + ) + ) + ((or (not *target*) *scene-player*) + ) + ((not (logtest? (-> self flags) (process-taskable-flags ptf1))) + (if (>= (- (-> *display* game-clock frame-counter) (-> self last-talk)) (seconds 5)) + (logior! (-> self flags) (process-taskable-flags ptf1)) + ) + ) + ((and (-> gp-1 scene) + (begin + (when (not (or (= (-> gp-1 action) (game-task-action play)) + (-> *setting-control* user-current movie-name) + (name= (-> gp-1 scene) (-> *setting-control* user-current movie-name)) + ) + ) + (let ((v1-42 (scene-lookup (-> gp-1 scene)))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (if v1-42 + (-> v1-42 anim) + (-> gp-1 scene) + ) + 0 + -99.0 + (new 'static 'sound-id) + ) + ) + ) + (and (not (logtest? (focus-status dead in-air in-head pole tube mech) (-> *target* focus-status))) + (and (or (and (< (-> (target-pos 0) y) (+ (-> self root root-prim prim-core world-sphere y) (-> self talk-height))) + (let ((s5-1 (get-trans self 2)) + (f30-0 (if (= (-> gp-1 distance) 0.0) + (-> self talk-distance) + (-> gp-1 distance) + ) + ) + ) + (< (vector-vector-distance (target-pos 0) s5-1) f30-0) + ) + ) + (not (time-elapsed? (-> self want-to-say) (seconds 4))) + ) + (or (not (load-in-progress? *level*)) (= (-> gp-1 action) (game-task-action say))) + (and (not (movie?)) + (or (not (logtest? (-> self flags) (process-taskable-flags ptf6))) (not (talker-displayed?))) + (none-reserved? *art-control*) + (not *progress-process*) + (not (-> *setting-control* user-current movie)) + ) + ) + ) + ) + ) + (when (and (or (= (-> gp-1 action) (game-task-action say)) + (= (-> gp-1 action) (game-task-action talk)) + (= (-> gp-1 action) (game-task-action trade)) + (= (-> gp-1 action) (game-task-action play)) + ) + (process-taskable-method-36 self) + ) + (when (or (= (-> gp-1 action) (game-task-action say)) (not (time-elapsed? (-> self want-to-say) (seconds 4)))) + (case (-> gp-1 action) + (((game-task-action play)) + (go-virtual play-game gp-1) + ) + (else + (go-virtual active gp-1) + ) + ) + ) + (kill-current-talker '() '(daxter voicebox ambient) 'exit) + (talker-surpress!) + (when (can-display-query? self "process-taskable" -99.0) + (let ((s5-2 + (new 'stack 'font-context *font-default-matrix* 32 280 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-96 s5-2)) + (set! (-> v1-96 width) (the float 340)) + ) + (let ((v1-97 s5-2)) + (set! (-> v1-97 height) (the float 80)) + ) + (let ((v1-98 s5-2) + (a0-39 (-> *setting-control* user-default language)) + ) + (set! (-> v1-98 scale) (if (or (= a0-39 (language-enum korean)) (= a0-39 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> s5-2 flags) (font-flags shadow kerning middle-vert large)) + (print-game-text + (lookup-text! *common-text* (-> self talk-message) #f) + s5-2 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (when (cpad-pressed? 0 triangle) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (case (-> gp-1 action) + (((game-task-action play)) + (go-virtual play-game gp-1) + ) + (else + (go-virtual active gp-1) + ) + ) + ) + ) + ) + ) + ) + ) + (update-cloth-and-shadow self) + ) + :code (behavior () + (process-taskable-anim-loop (the-as (function process-taskable object) true-func)) + ) + :post (behavior () + (if (and (logtest? (-> self flags) (process-taskable-flags ptf3)) (movie?)) + (logior! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + (when (logtest? (-> self flags) (process-taskable-flags ptf2)) + (if *target* + (look-at! (-> *target* neck) (get-trans self 2) 'nothing-special self) + ) + ) + (transform-post) + ) + ) + +(defstate active (process-taskable) + :virtual #t + :event (-> (method-of-type process-taskable hide) event) + :enter (behavior ((arg0 game-task-event)) + (set! (-> self want-to-say) 0) + (process-entity-status! self (entity-perm-status no-kill) #t) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :exit (behavior () + (set! (-> self last-talk) (-> *display* game-clock frame-counter)) + (if (not (time-elapsed? (-> self want-to-say) (seconds 4))) + (logior! (-> self flags) (process-taskable-flags ptf1)) + (logclear! (-> self flags) (process-taskable-flags ptf1)) + ) + (process-entity-status! self (entity-perm-status no-kill) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-15 (-> self root root-prim))) + (set! (-> v1-15 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-15 prim-core collide-with) (-> self root backup-collide-with)) + ) + ) + :code (behavior ((arg0 game-task-event)) + (when (-> arg0 scene) + (let ((gp-1 (ppointer->handle + (process-spawn scene-player :init scene-player-init (-> arg0 scene) #t #f :name "scene-player") + ) + ) + ) + (while (and (handle->process (the-as handle gp-1)) (not (movie?))) + (suspend) + ) + (process-drawable-show-all-cloth self #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-15 (-> self root root-prim))) + (set! (-> v1-15 prim-core collide-as) (collide-spec)) + (set! (-> v1-15 prim-core collide-with) (collide-spec)) + ) + 0 + (while (handle->process (the-as handle gp-1)) + (suspend) + ) + ) + ) + (go-virtual hide) + ) + ) + +(defstate die (process-taskable) + :virtual #t + :enter (behavior () + (set! (-> self want-to-say) 0) + (process-entity-status! self (entity-perm-status no-kill) #t) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :exit (behavior () + (process-entity-status! self (entity-perm-status no-kill) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-5 (-> self root root-prim))) + (set! (-> v1-5 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-5 prim-core collide-with) (-> self root backup-collide-with)) + ) + ) + :code (behavior () + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 1)) + (suspend) + ) + ) + (if (logtest? (-> self flags) (process-taskable-flags ptf5)) + (restart-mission) + ) + (cleanup-for-death self) + ) + :post (-> (method-of-type process-taskable idle) post) + ) + +(defstate play-game (process-taskable) + :virtual #t + :enter (-> (method-of-type process-taskable active) enter) + :exit (-> (method-of-type process-taskable active) exit) + :code (behavior ((arg0 game-task-event)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.5)) + (suspend) + ) + ) + (go-virtual hide) + ) + :post (-> (method-of-type process-taskable idle) post) + ) + +(defmethod init-collision! ((this process-taskable)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) + (set! (-> s5-0 total-prims) (the-as uint 4)) + (set! (-> s4-0 prim-core collide-as) (collide-spec civilian)) + (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 -1024.0 0.0 7372.8) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set! (-> v1-7 transform-index) 0) + (set-vector! (-> v1-7 local-sphere) 0.0 -4096.0 0.0 4096.0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 0) + (set-vector! (-> v1-9 local-sphere) 0.0 -1024.0 0.0 4096.0) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-11 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-11 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-11 transform-index) 0) + (set-vector! (-> v1-11 local-sphere) 0.0 2048.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-14 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +(defmethod init-defaults! ((this process-taskable)) + (logior! (-> this skel status) (joint-control-status eye-anim)) + (set! (-> this talk-message) (text-id press-triangle-to-talk)) + (set! (-> this flags) (process-taskable-flags ptf0 ptf1 ptf2 ptf3 ptf5)) + (set! (-> this neck-joint-index) -1) + (set! (-> this talk-distance) (res-lump-float (-> this entity) 'distance :default 32768.0)) + (set! (-> this talk-height) (res-lump-float (-> this entity) 'height :default 8192.0)) + (set! (-> this slave) (the-as handle #f)) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + 0.0 + 0.0 + 614400.0 + (the-as vector #f) + (shadow-flags shdf02 shdf03 shdf04 disable-draw) + 245760.0 + ) + ) + (let ((s5-0 0)) + (let ((v1-12 (the-as joint (get-art-by-name-method (-> this draw jgeo) "main" (the-as type #f))))) + (if v1-12 + (set! s5-0 (+ (-> v1-12 number) 1)) + ) + ) + (let ((v1-16 (-> this root root-prim))) + (set! (-> v1-16 transform-index) s5-0) + (dotimes (a0-7 (the-as int (-> v1-16 specific 0))) + (set! (-> (the-as collide-shape-prim-group v1-16) child a0-7 transform-index) s5-0) + ) + ) + ) + 0 + (none) + ) + +(defmethod init-skeleton! ((this process-taskable)) + 0 + (none) + ) + +(defmethod init-from-entity! ((this process-taskable) (entity entity-actor)) + (stack-size-set! (-> this main-thread) 512) + (init-collision! this) + (process-drawable-from-entity! this entity) + (set! (-> this task) + (new 'process 'game-task-control (res-lump-value entity 'task-actor game-task-actor :time -1000000000.0)) + ) + (init-skeleton! this) + (init-defaults! this) + (logior! (-> this skel status) (joint-control-status blend-shape eye-anim)) + (when (logtest? #x1000000 (res-lump-value entity 'options uint128 :time -1000000000.0)) + (let* ((s5-1 *level*) + (s4-2 (method-of-object s5-1 art-group-get-by-name)) + ) + (format (clear *temp-string*) "skel-~S" (-> this draw art-group name)) + (let ((s4-3 (s4-2 s5-1 *temp-string* (the-as (pointer level) #f)))) + (when s4-3 + (let ((s5-2 (process-spawn + manipy + :init manipy-init + (-> this root trans) + (-> this entity) + s4-3 + #f + 0 + :name "manipy" + :to this + :stack-size #x20000 + ) + ) + ) + (send-event (ppointer->process s5-2) 'anim-mode 'mirror) + (send-event (ppointer->process s5-2) 'mirror #t) + ) + ) + ) + ) + ) + (set! (-> this event-hook) (-> (method-of-object this idle) event)) + (go (method-of-object this hide)) + ) diff --git a/goal_src/jak3/engine/scene/scene-h.gc b/goal_src/jak3/engine/scene/scene-h.gc index eb28fe559f7..a5af2ca0096 100644 --- a/goal_src/jak3/engine/scene/scene-h.gc +++ b/goal_src/jak3/engine/scene/scene-h.gc @@ -5,14 +5,35 @@ ;; name in dgo: scene-h ;; dgos: GAME +;; +++scene-flags (defenum scene-flags :bitfield #t :type uint32 + (scf0 0) + (scf1 1) + (scf2 2) + (scf3 3) + (scf4 4) + (scf5 5) + (scf6 6) + (scf7 7) + (scf8 8) + (scf9 9) + (scf10 10) + (scf11 11) + (scf12 12) + (scf13 13) + (scf14 14) + (scf15 15) ) +;; ---scene-flags + (declare-type scene-player process-drawable) +(declare-type scene art-group) (define-extern scene-player-init (function object symbol string none :behavior scene-player)) +(define-extern scene-lookup (function basic scene)) ;; DECOMP BEGINS @@ -23,24 +44,24 @@ (prefix string) (draw-frames pair) (scissor-frames pair) - (shadow-frames basic) - (cloth-reset-frames basic) - (cloth-commands basic) + (shadow-frames pair) + (cloth-reset-frames pair) + (cloth-commands pair) (camera int16) (light-index uint8) (shadow-mask uint8) (shadow-values uint32) (flags uint32) - (command-list basic) + (command-list pair) (shadow-flags int32) (shadow-volume-joint basic) (draw-seg uint64) (no-draw-seg uint64) (last-frame float) - (process uint64) + (process handle) ) (:methods - (scene-actor-method-9 () none) + (setup-manipy-for-scene! (_type_ scene-player) (pointer process)) ) ) @@ -58,20 +79,20 @@ (wait-air-time time-frame) (wait-ground-time time-frame) (actor (array scene-actor)) - (load-point continue-point) - (end-point continue-point) + (load-point basic) + (end-point basic) (borrow pair) (sfx-volume float) (ambient-volume float) (music-volume float) (music-delay float) (scene-task uint16) - (on-running basic) - (on-complete basic) + (on-running pair) + (on-complete pair) ) (:methods - (scene-method-16 () none) - (scene-method-17 () none) + (init-spool-by-scene! (_type_ spool-anim) spool-anim) + (load-scene (_type_) scene) ) ) @@ -103,17 +124,19 @@ (last-frame float) (end-point basic) (blackout-end basic) - (new-trans-hook basic) - (cur-trans-hook basic) + (new-trans-hook (function none)) + (cur-trans-hook (function none)) (user-data uint64) ) + (:state-methods + (wait symbol) + release + play-anim + ) (:methods - (scene-player-method-20 () none) - (scene-player-method-21 () none) - (scene-player-method-22 () none) - (scene-player-method-23 () none) - (scene-player-method-24 () none) - (scene-player-method-25 () none) + (scene-player-method-23 (_type_ string symbol) none) + (scene-player-method-24 (_type_ scene symbol) scene) + (scene-player-method-25 (_type_ float float) none) ) ) diff --git a/goal_src/jak3/engine/target/board/board-states.gc b/goal_src/jak3/engine/target/board/board-states.gc index eb12e03038f..5dc5b6e98d4 100644 --- a/goal_src/jak3/engine/target/board/board-states.gc +++ b/goal_src/jak3/engine/target/board/board-states.gc @@ -430,50 +430,11 @@ (cond ((logtest? (-> *part-group-id-table* 189 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> gp-2 quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-11 (method-of-type part-tracker-subsampler activate))) - (t9-11 (the-as part-tracker-subsampler s5-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-15 s5-1) - (a1-9 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 189)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-12) a0-15 a1-9 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 189)) ) (else (set! (-> *launch-matrix* trans quad) (-> gp-2 quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-14 (method-of-type part-tracker activate))) - (t9-14 (the-as part-tracker s5-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-15 run-function-in-process) - (a0-20 s5-2) - (a1-12 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 189)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-15) a0-20 a1-12 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 189)) ) ) (let ((s5-3 (process-spawn @@ -887,53 +848,20 @@ ) (sound-play "board-launch") (when (!= (-> self board charge-progress) 0.0) - (cond - ((logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker-subsampler activate))) - (t9-8 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-35 gp-2) - (a1-7 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) (-> self node-list data 0 bone transform)) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-9) a0-35 a1-7 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-38 gp-3) - (a1-10 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) (-> self node-list data 0 bone transform)) - ((the-as (function object object object none) t9-12) a0-38 a1-10 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) ) ) - ) ) (set-time! (-> self board halfpipe-jump-time)) (set! (-> self board charge-progress) 0.0) @@ -1031,53 +959,20 @@ (when (and (cpad-hold? (-> self control cpad number) l1) (!= (-> self board charge-progress) 0.0)) (+! f30-0 (* (-> self board charge-progress) (-> *TARGET_BOARD-bank* charge-jump-height))) (sound-play "board-launch") - (cond - ((logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) - (let ((s3-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s3-3 - (let ((t9-7 (method-of-type part-tracker-subsampler activate))) - (t9-7 (the-as part-tracker-subsampler s3-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-14 s3-3) - (a1-8 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) (-> self node-list data 0 bone transform)) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-8) a0-14 a1-8 *part-tracker-subsampler-params-default*) - ) - (-> s3-3 ppointer) - ) - ) - ) - (else - (let ((s3-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s3-4 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker s3-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-17 s3-4) - (a1-11 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) (-> self node-list data 0 bone transform)) - ((the-as (function object object object none) t9-11) a0-17 a1-11 *part-tracker-params-default*) - ) - (-> s3-4 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) ) ) - ) ) (set! (-> self board charge-progress) 0.0) (sound-stop (-> self board charge-sound-id)) @@ -1092,50 +987,11 @@ (cond ((logtest? (-> *part-group-id-table* 190 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> s3-5 quad)) - (let ((s2-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s2-2 - (let ((t9-14 (method-of-type part-tracker-subsampler activate))) - (t9-14 (the-as part-tracker-subsampler s2-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-15 run-function-in-process) - (a0-28 s2-2) - (a1-14 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 190)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-15) a0-28 a1-14 *part-tracker-subsampler-params-default*) - ) - (-> s2-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 190)) ) (else (set! (-> *launch-matrix* trans quad) (-> s3-5 quad)) - (let ((s2-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s2-3 - (let ((t9-17 (method-of-type part-tracker activate))) - (t9-17 (the-as part-tracker s2-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-33 s2-3) - (a1-17 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 190)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-18) a0-33 a1-17 *part-tracker-params-default*) - ) - (-> s2-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 190)) ) ) (let* ((s1-1 (get-process *default-dead-pool* manipy #x20000 1)) @@ -2987,7 +2843,7 @@ (logclear! (-> gp-2 options) (projectile-options po14 po15 po16)) (set! (-> gp-2 notify-handle) (the-as handle #f)) (set! (-> gp-2 owner-handle) (the-as handle #f)) - (set! (-> gp-2 target-handle) (the-as uint #f)) + (set! (-> gp-2 target-handle) (the-as handle #f)) (set! (-> gp-2 target-pos quad) (the-as uint128 0)) (set! (-> gp-2 ignore-handle) (process->handle self)) (let* ((v1-27 *game-info*) @@ -3504,7 +3360,7 @@ (set! (-> v1-8 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) (set! (-> v1-8 speed) 1.0) (set! (-> v1-8 damage) (-> *FACT-bank* health-default-inc)) - (set! (-> v1-8 knock) (knocked-type knocked-type-0)) + (set! (-> v1-8 knock) (knocked-type none)) ) (case arg0 (('shove) @@ -3602,7 +3458,7 @@ ) ) (when (not (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health)))) - (when (= (-> gp-0 knock) (knocked-type knocked-type-8)) + (when (= (-> gp-0 knock) (knocked-type knocked-off)) (set-quaternion! (-> self control) (-> self control dir-targ)) (set-forward-vel (* -3.0 (-> gp-0 shove-back))) (go target-board-get-off (the-as handle #f) 'hit) diff --git a/goal_src/jak3/engine/target/board/target-board.gc b/goal_src/jak3/engine/target/board/target-board.gc index eb05ac67fe0..2109a03760d 100644 --- a/goal_src/jak3/engine/target/board/target-board.gc +++ b/goal_src/jak3/engine/target/board/target-board.gc @@ -688,53 +688,16 @@ ) (case (-> self control danger-mode) (('board-spin) - (cond - ((logtest? (-> *part-group-id-table* 184 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-12 (method-of-type part-tracker-subsampler activate))) - (t9-12 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-53 gp-2) - (a1-12 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 184)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-13) a0-53 a1-12 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-15 (method-of-type part-tracker activate))) - (t9-15 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-16 run-function-in-process) - (a0-56 gp-3) - (a1-15 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 184)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-16) a0-56 a1-15 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 184 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 184) + :target self + :mat-joint 37 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 184) :target self :mat-joint 37) ) - ) ) ) (target-timed-invulnerable (seconds 0.5) self 2) @@ -1584,50 +1547,11 @@ (cond ((logtest? (-> *part-group-id-table* 23 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-9 (method-of-type part-tracker-subsampler activate))) - (t9-9 (the-as part-tracker-subsampler gp-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-10 run-function-in-process) - (a0-31 gp-3) - (a1-8 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 23)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-10) a0-31 a1-8 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 23)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-12 (method-of-type part-tracker activate))) - (t9-12 (the-as part-tracker gp-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-37 gp-4) - (a1-11 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 23)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-13) a0-37 a1-11 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 23)) ) ) ) @@ -2280,100 +2204,30 @@ (focus-test? self board) (< 0.0 (-> self fact eco-green)) ) - (cond - ((logtest? (-> *part-group-id-table* 187 flags) (sp-group-flag sp13)) - (let ((s5-7 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-7 - (let ((t9-52 (method-of-type part-tracker-subsampler activate))) - (t9-52 (the-as part-tracker-subsampler s5-7) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-53 run-function-in-process) - (a0-113 s5-7) - (a1-46 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 187)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-53) a0-113 a1-46 *part-tracker-subsampler-params-default*) - ) - (-> s5-7 ppointer) - ) - ) - ) - (else - (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-8 - (let ((t9-55 (method-of-type part-tracker activate))) - (t9-55 (the-as part-tracker s5-8) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-56 run-function-in-process) - (a0-116 s5-8) - (a1-49 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 187)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-56) a0-116 a1-49 *part-tracker-params-default*) - ) - (-> s5-8 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 187 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 187) + :target self + :mat-joint 37 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 187) :target self :mat-joint 37) ) - ) (target-board-green-eco-attack #t) (target-board-green-eco-use 5.0) ) ((logtest? (-> *part-group-id-table* 188 flags) (sp-group-flag sp13)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-9 - (let ((t9-60 (method-of-type part-tracker-subsampler activate))) - (t9-60 (the-as part-tracker-subsampler s5-9) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-61 run-function-in-process) - (a0-121 s5-9) - (a1-52 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 188)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-61) a0-121 a1-52 *part-tracker-subsampler-params-default*) - ) - (-> s5-9 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 188) + :target self + :mat-joint 37 ) ) (else - (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-10 - (let ((t9-63 (method-of-type part-tracker activate))) - (t9-63 (the-as part-tracker s5-10) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-64 run-function-in-process) - (a0-124 s5-10) - (a1-55 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 188)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-64) a0-124 a1-55 *part-tracker-params-default*) - ) - (-> s5-10 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 188) :target self :mat-joint 37) ) ) (target-timed-invulnerable (-> *TARGET_BOARD-bank* zap-duration) self 2) diff --git a/goal_src/jak3/engine/target/gun/gun-util.gc b/goal_src/jak3/engine/target/gun/gun-util.gc index de5c72eac90..3f464e12ff7 100644 --- a/goal_src/jak3/engine/target/gun/gun-util.gc +++ b/goal_src/jak3/engine/target/gun/gun-util.gc @@ -12,7 +12,7 @@ ) -(defmethod projectile-method-31 ((this gun-eject)) +(defmethod init-proj-settings! ((this gun-eject)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-gun" (the-as (pointer level) #f))) @@ -22,7 +22,7 @@ (let ((v1-5 (-> this skel root-channel 0))) (set! (-> v1-5 frame-group) (-> this parent 0 skel channel 0 frame-group)) ) - (let ((t9-3 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-3 (method-of-type projectile-bounce init-proj-settings!))) (t9-3 this) ) (quaternion-copy! (-> this root quat) (-> this parent 0 root quat)) @@ -38,13 +38,13 @@ ) -(defmethod projectile-method-31 ((this gun-mag-yellow)) +(defmethod init-proj-settings! ((this gun-mag-yellow)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-yellow" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -58,13 +58,13 @@ ) -(defmethod projectile-method-31 ((this gun-mag-red)) +(defmethod init-proj-settings! ((this gun-mag-red)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-red" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -78,13 +78,13 @@ ) -(defmethod projectile-method-31 ((this gun-mag-blue)) +(defmethod init-proj-settings! ((this gun-mag-blue)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-blue" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -98,13 +98,13 @@ ) -(defmethod projectile-method-31 ((this gun-mag-dark)) +(defmethod init-proj-settings! ((this gun-mag-dark)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-dark" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -362,7 +362,7 @@ ) (set! (-> s5-2 notify-handle) (the-as handle #f)) (set! (-> s5-2 owner-handle) (the-as handle #f)) - (set! (-> s5-2 target-handle) (the-as uint #f)) + (set! (-> s5-2 target-handle) (the-as handle #f)) (set! (-> s5-2 target-pos quad) (the-as uint128 0)) (set! (-> s5-2 ignore-handle) (process->handle self)) (let* ((v1-133 *game-info*) @@ -899,7 +899,7 @@ ) (set! (-> gp-0 notify-handle) (the-as handle #f)) (set! (-> gp-0 owner-handle) (the-as handle #f)) - (set! (-> gp-0 target-handle) (the-as uint #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) (set! (-> gp-0 target-pos quad) (the-as uint128 0)) (set! (-> gp-0 ignore-handle) (process->handle self)) (let* ((v1-16 *game-info*) @@ -1116,7 +1116,7 @@ ) ;; WARN: Return type mismatch object vs float. -(defun adjust-player-ammo ((arg0 int) (arg1 pickup-type)) +(defun adjust-player-ammo ((arg0 float) (arg1 pickup-type)) (if (and *target* (and (focus-test? *target* light) (nonzero? (-> *target* lightjak))) (not (logtest? (-> *target* lightjak stage) (lightjak-stage ls1))) @@ -1130,7 +1130,7 @@ (let* ((f0-2 (* 0.0033333334 (the float arg0) arg1)) (f30-0 (fmin (fmax 0.0 f0-2) arg3)) ) - (adjust-player-ammo (the-as int (- f30-0)) arg2) + (adjust-player-ammo (- f30-0) arg2) f30-0 ) ) @@ -1140,7 +1140,7 @@ (let* ((f0-0 (get-remaining-player-ammo arg0)) (f0-1 (- f0-0 (the float (the int f0-0)))) ) - (adjust-player-ammo (the-as int (- f0-1)) arg0) + (adjust-player-ammo (- f0-1) arg0) ) (none) ) diff --git a/goal_src/jak3/engine/target/lightjak-wings.gc b/goal_src/jak3/engine/target/lightjak-wings.gc index a33996fc17f..e4f737c0624 100644 --- a/goal_src/jak3/engine/target/lightjak-wings.gc +++ b/goal_src/jak3/engine/target/lightjak-wings.gc @@ -538,7 +538,7 @@ :exit (behavior () (let ((a0-1 (handle->process (-> self ragdoll-proc)))) (if a0-1 - (ragdoll-proc-method-16 (the-as ragdoll-proc a0-1) 60) + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.2)) ) ) ) diff --git a/goal_src/jak3/engine/target/logic-target.gc b/goal_src/jak3/engine/target/logic-target.gc index 3ea7267992a..2b22f084e33 100644 --- a/goal_src/jak3/engine/target/logic-target.gc +++ b/goal_src/jak3/engine/target/logic-target.gc @@ -860,7 +860,7 @@ (set! (-> gp-0 ignore-process0) self) (set! (-> gp-0 ignore-process1) #f) (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* gp-0) (dotimes (s5-0 3) (set! (-> gp-0 start-pos quad) (-> self control collision-spheres s5-0 prim-core world-sphere quad)) (vector-float*! (-> gp-0 move-dist) (-> self control wall-contact-normal) -8192.0) @@ -1534,7 +1534,7 @@ (set! (-> gp-0 ignore-process0) self) (set! (-> gp-0 ignore-process1) #f) (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* gp-0) (dotimes (s5-0 2) (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) (and (logtest? (-> self control mod-surface flags) (surface-flag air)) diff --git a/goal_src/jak3/engine/target/target-anim.gc b/goal_src/jak3/engine/target/target-anim.gc index 69184187e6a..467551b9640 100644 --- a/goal_src/jak3/engine/target/target-anim.gc +++ b/goal_src/jak3/engine/target/target-anim.gc @@ -1271,10 +1271,7 @@ ) ) ) - (let ((v1-257 (-> self skel root-channel 6))) - (set! (-> v1-257 frame-interp 1) f26-0) - (set! (-> v1-257 frame-interp 0) f26-0) - ) + (ja :chan 6 :frame-interp0 f26-0 :frame-interp1 f26-0) (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) (f0-70 (/ (-> self control ctrl-xz-vel) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) ) diff --git a/goal_src/jak3/engine/target/target-death.gc b/goal_src/jak3/engine/target/target-death.gc index d534fb40659..eda91bf58ff 100644 --- a/goal_src/jak3/engine/target/target-death.gc +++ b/goal_src/jak3/engine/target/target-death.gc @@ -71,7 +71,7 @@ (when a2-0 (set! (-> s5-1 quad) (-> a2-0 extra trans quad)) (+! (-> s5-1 y) 9011.2) - (go target-warp-in s5-1 (-> arg0 trans)) + (go target-warp-in s5-1 (-> arg0 trans) a2-0) ) ) ) @@ -963,27 +963,7 @@ quad ) ) - (let ((s5-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler s5-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-9 s5-0) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-9 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> s5-0 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 10)) ) (else (set! (-> *launch-matrix* trans quad) @@ -995,26 +975,7 @@ quad ) ) - (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker s5-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-18 s5-1) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-18 a1-5 *part-tracker-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 10)) ) ) (let ((v1-32 (-> arg0 mode))) @@ -1527,55 +1488,11 @@ (cond ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-18 (method-of-type part-tracker-subsampler activate))) - (t9-18 - (the-as part-tracker-subsampler gp-3) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-19 run-function-in-process) - (a0-66 gp-3) - (a1-13 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-19) a0-66 a1-13 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-21 (method-of-type part-tracker activate))) - (t9-21 (the-as part-tracker gp-4) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-22 run-function-in-process) - (a0-72 gp-4) - (a1-16 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-22) a0-72 a1-16 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) ) ) ) @@ -1592,55 +1509,11 @@ (cond ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-6 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-6 - (let ((t9-28 (method-of-type part-tracker-subsampler activate))) - (t9-28 - (the-as part-tracker-subsampler gp-6) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-29 run-function-in-process) - (a0-89 gp-6) - (a1-23 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-29) a0-89 a1-23 *part-tracker-subsampler-params-default*) - ) - (-> gp-6 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-7 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-7 - (let ((t9-31 (method-of-type part-tracker activate))) - (t9-31 (the-as part-tracker gp-7) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-95 gp-7) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-32) a0-95 a1-26 *part-tracker-params-default*) - ) - (-> gp-7 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) ) ) ) @@ -1702,53 +1575,17 @@ ) ) ) - (cond - ((logtest? (-> gp-9 flags) (sp-group-flag sp13)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-5 - (let ((t9-44 (method-of-type part-tracker-subsampler activate))) - (t9-44 (the-as part-tracker-subsampler s5-5) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-45 run-function-in-process) - (a0-133 s5-5) - (a1-49 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) gp-9) - (set! (-> *part-tracker-subsampler-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-45) a0-133 a1-49 *part-tracker-subsampler-params-default*) - ) - (-> s5-5 ppointer) - ) - ) - ) - (else - (let ((s5-6 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-6 - (let ((t9-47 (method-of-type part-tracker activate))) - (t9-47 (the-as part-tracker s5-6) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-48 run-function-in-process) - (a0-136 s5-6) - (a1-52 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) gp-9) - (set! (-> *part-tracker-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-48) a0-136 a1-52 *part-tracker-params-default*) - ) - (-> s5-6 ppointer) - ) + (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group gp-9 + :duration (seconds 1) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) ) - ) ) (let ((gp-10 (-> self post-hook))) (set! (-> self control mod-surface) *turn-around-mods*) @@ -2440,55 +2277,11 @@ (cond ((logtest? (-> *part-group-id-table* 62 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-3 - (let ((t9-15 (method-of-type part-tracker-subsampler activate))) - (t9-15 - (the-as part-tracker-subsampler s5-3) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-16 run-function-in-process) - (a0-66 s5-3) - (a1-29 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 62)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-16) a0-66 a1-29 *part-tracker-subsampler-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 62)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-4 - (let ((t9-18 (method-of-type part-tracker activate))) - (t9-18 (the-as part-tracker s5-4) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-19 run-function-in-process) - (a0-72 s5-4) - (a1-32 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 62)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-19) a0-72 a1-32 *part-tracker-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 62)) ) ) (let ((v1-110 (-> self control root-prim))) @@ -2525,55 +2318,11 @@ (cond ((logtest? (-> *part-group-id-table* 65 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-8 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-8 - (let ((t9-27 (method-of-type part-tracker-subsampler activate))) - (t9-27 - (the-as part-tracker-subsampler s5-8) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-28 run-function-in-process) - (a0-92 s5-8) - (a1-41 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 65)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-28) a0-92 a1-41 *part-tracker-subsampler-params-default*) - ) - (-> s5-8 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 65)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-9 - (let ((t9-30 (method-of-type part-tracker activate))) - (t9-30 (the-as part-tracker s5-9) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-31 run-function-in-process) - (a0-98 s5-9) - (a1-44 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 65)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-31) a0-98 a1-44 *part-tracker-params-default*) - ) - (-> s5-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 65)) ) ) (set-vector! (-> self control transv) 0.0 65502.96 0.0 1.0) @@ -2758,55 +2507,11 @@ (cond ((logtest? (-> *part-group-id-table* 66 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-12 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-12 - (let ((t9-45 (method-of-type part-tracker-subsampler activate))) - (t9-45 - (the-as part-tracker-subsampler s5-12) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-46 run-function-in-process) - (a0-130 s5-12) - (a1-56 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 66)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-46) a0-130 a1-56 *part-tracker-subsampler-params-default*) - ) - (-> s5-12 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 66)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-13 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-13 - (let ((t9-48 (method-of-type part-tracker activate))) - (t9-48 (the-as part-tracker s5-13) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-49 run-function-in-process) - (a0-136 s5-13) - (a1-59 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 66)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-49) a0-136 a1-59 *part-tracker-params-default*) - ) - (-> s5-13 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 66)) ) ) (target-death-anim (the-as spool-anim #f)) @@ -2825,55 +2530,11 @@ (cond ((logtest? (-> gp-1 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-3 (method-of-type part-tracker-subsampler activate))) - (t9-3 - (the-as part-tracker-subsampler s5-1) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-4 run-function-in-process) - (a0-9 s5-1) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) gp-1) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-4) a0-9 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group gp-1) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker s5-2) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-15 s5-2) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) gp-1) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-7) a0-15 a1-6 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group gp-1) ) ) ) diff --git a/goal_src/jak3/engine/target/target-h.gc b/goal_src/jak3/engine/target/target-h.gc index 6edc52720bb..70972d3a211 100644 --- a/goal_src/jak3/engine/target/target-h.gc +++ b/goal_src/jak3/engine/target/target-h.gc @@ -84,7 +84,7 @@ (define-extern target-collide-set! (function symbol float int :behavior target)) (define-extern target-move-dist (function time-frame float :behavior target)) (define-extern get-intersect-point (function vector touching-prims-entry collide-shape touching-shapes-entry vector)) -(define-extern target-update-segs (function process-drawable none)) +(define-extern target-update-segs (function process-drawable float)) ;; logic-target (define-extern target-darkjak-setup (function symbol none :behavior target)) @@ -161,6 +161,9 @@ (define-extern target-gun-can-fire-dark? (function pickup-type symbol :behavior target)) (define-extern target-gun-fire-dark (function pickup-type (pointer process) :behavior target)) +;; powerups +(define-extern target-darkjak-process (function none :behavior target)) + ;; +++lightjak-stage (defenum lightjak-stage :bitfield #t @@ -201,6 +204,7 @@ (defenum target-anim :type int32 (uninitialized -2) + (unknown -1) (default 0) (board 1) (dark 2) @@ -497,8 +501,8 @@ target-wade-stance target-wade-walk target-walk - (target-warp-in vector vector) - target-warp-out + (target-warp-in vector vector object) + (target-warp-out vector vector handle) target-yellow-jump-blast tobot-stance ) diff --git a/goal_src/jak3/engine/target/target-handler.gc b/goal_src/jak3/engine/target/target-handler.gc index 51bc9edadd1..e00ec824b6f 100644 --- a/goal_src/jak3/engine/target/target-handler.gc +++ b/goal_src/jak3/engine/target/target-handler.gc @@ -153,27 +153,7 @@ quad ) ) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-7 (method-of-type part-tracker-subsampler activate))) - (t9-7 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-39 gp-1) - (a1-14 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-8) a0-39 a1-14 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 10)) ) (else (set! (-> *launch-matrix* trans quad) @@ -185,26 +165,7 @@ quad ) ) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-48 gp-2) - (a1-17 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-11) a0-48 a1-17 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 10)) ) ) (target-timed-invulnerable @@ -221,53 +182,24 @@ (sound-play "oof") ) (else - (cond - ((logtest? (-> *part-group-id-table* 67 flags) (sp-group-flag sp13)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-4 - (let ((t9-17 (method-of-type part-tracker-subsampler activate))) - (t9-17 (the-as part-tracker-subsampler gp-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-55 gp-4) - (a1-23 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 67)) - (set! (-> *part-tracker-subsampler-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-18) a0-55 a1-23 *part-tracker-subsampler-params-default*) - ) - (-> gp-4 ppointer) - ) - ) - ) - (else - (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-5 - (let ((t9-20 (method-of-type part-tracker activate))) - (t9-20 (the-as part-tracker gp-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-21 run-function-in-process) - (a0-58 gp-5) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 67)) - (set! (-> *part-tracker-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-21) a0-58 a1-26 *part-tracker-params-default*) - ) - (-> gp-5 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 67 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 67) + :duration (seconds 1) + :target self + :mat-joint 6 + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 67) + :duration (seconds 1) + :target self + :mat-joint 6 ) ) - ) (process-spawn-function process (lambda :behavior target @@ -561,50 +493,11 @@ (cond ((logtest? (-> *part-group-id-table* 11 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-13 (method-of-type part-tracker-subsampler activate))) - (t9-13 (the-as part-tracker-subsampler s5-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-14 run-function-in-process) - (a0-46 s5-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 11)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-14) a0-46 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 11)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker s5-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-17 run-function-in-process) - (a0-51 s5-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 11)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-17) a0-51 a1-19 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 11)) ) ) ) @@ -641,50 +534,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-23 (method-of-type part-tracker-subsampler activate))) - (t9-23 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-24 run-function-in-process) - (a0-71 gp-1) - (a1-26 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-24) a0-71 a1-26 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-76 gp-2) - (a1-29 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-76 a1-29 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) @@ -714,50 +568,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-31 (method-of-type part-tracker-subsampler activate))) - (t9-31 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-91 s5-4) - (a1-36 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-32) a0-91 a1-36 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-34 (method-of-type part-tracker activate))) - (t9-34 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-35 run-function-in-process) - (a0-96 s5-5) - (a1-39 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-35) a0-96 a1-39 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) @@ -810,50 +625,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-43 (method-of-type part-tracker-subsampler activate))) - (t9-43 (the-as part-tracker-subsampler gp-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-44 run-function-in-process) - (a0-116 gp-3) - (a1-47 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-44) a0-116 a1-47 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-46 (method-of-type part-tracker activate))) - (t9-46 (the-as part-tracker gp-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-47 run-function-in-process) - (a0-121 gp-4) - (a1-50 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-47) a0-121 a1-50 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) diff --git a/goal_src/jak3/engine/target/target-invisible.gc b/goal_src/jak3/engine/target/target-invisible.gc index 6d8daeabf7d..bd059f7658b 100644 --- a/goal_src/jak3/engine/target/target-invisible.gc +++ b/goal_src/jak3/engine/target/target-invisible.gc @@ -450,50 +450,11 @@ (cond ((logtest? (-> *part-group-id-table* 182 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-5 gp-1) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 182)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-5 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 182)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-11 gp-2) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 182)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-11 a1-5 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 182)) ) ) (if *target* diff --git a/goal_src/jak3/engine/target/target-launch.gc b/goal_src/jak3/engine/target/target-launch.gc index 985cfbd98b5..643c9a80977 100644 --- a/goal_src/jak3/engine/target/target-launch.gc +++ b/goal_src/jak3/engine/target/target-launch.gc @@ -7,3 +7,146 @@ ;; DECOMP BEGINS +(defstate target-launch-dir (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + 'target-launch-dir + ) + ((= message 'launch-dir) + #f + ) + (else + (target-standard-event-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (sound-play "jak-launch") + (set! (-> self control unknown-vector37 y) + (- (-> self control unknown-vector37 y) (* 0.5 (the-as float (-> self control unknown-word04)))) + ) + (set! (-> self control unknown-vector39 quad) (-> self control trans quad)) + ) + :exit (behavior () + (target-state-hook-exit) + ) + :trans (behavior () + (cond + ((not (time-elapsed? (-> self state-time) (-> self control sliding-start-time))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control unknown-vector37 quad)) + (let ((gp-0 (new 'stack-no-clear 'quaternion))) + (set! (-> gp-0 quad) (-> self control unknown-vector37 quad)) + (set! (-> gp-0 y) 0.0) + (vector-normalize! (the-as vector gp-0) 1.0) + (let ((f30-0 (vector-normalize-ret-len! s5-0 1.0))) + 0.0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + (quaternion-rotate-y-to-vector! (-> self control dir-targ) (-> self control dir-targ) gp-0 18204.445) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (let* ((f0-4 + (/ (the float (- (current-time) (-> self state-time))) (the float (-> self control sliding-start-time))) + ) + (f0-5 (- 1.0 f0-4)) + ) + (let ((f1-5 (* 1.4 f0-5 (/ f30-0 (* 0.0033333334 (the float (-> self control sliding-start-time))))))) + (* 0.0033333334 f1-5 (the float (- (current-time) (-> self clock old-frame-counter)))) + ) + (let ((f0-6 (- 1.0 f0-5))) + (vector+float*! + (-> self control trans) + (-> self control unknown-vector39) + (-> self control unknown-vector37) + f0-6 + ) + (+! (-> self control trans y) (* 0.5 f0-6 f0-6 (the-as float (-> self control unknown-word04)))) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control transv quad) (-> self control unknown-vector37 quad)) + (+! (-> self control transv y) (* f0-6 (the-as float (-> self control unknown-word04)))) + ) + ) + ) + ) + ) + (+! (-> self control did-move-to-pole-or-max-jump-height) + (* (the float (-> self control sliding-start-time)) (seconds-per-frame)) + ) + ) + (else + (let ((v1-53 (logclear (-> self control status) (collide-status on-surface))) + (a0-19 (-> self control)) + ) + (set! (-> a0-19 status) v1-53) + (go target-falling (the-as symbol a0-19)) + ) + ) + ) + ) + :code (behavior () + (send-event self 'end-mode 'gun) + (ja-channel-push! 1 (seconds 0.15)) + (set-forward-vel 0.0) + (cond + ((and (focus-test? self dark) (nonzero? (-> self darkjak))) + (ja-no-eval :group! (-> self draw art-group data 474) :num! (seek! (ja-aframe 15.0 0) 3.0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 15.0 0) 3.0)) + ) + ) + ((= (-> self ext-anim) (target-anim default)) + (ja-no-eval :group! jakb-duck-stance-ja :num! (seek! (ja-aframe 15.0 0) 3.0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 15.0 0) 3.0)) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (ja :group! (-> self draw art-group data 444) :num! min) + (ja :group! jakb-jump-ja :num! min) + ) + (until #f + (ja-no-eval :group! jakb-launch-jump-loop-ja :num! (seek! max 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + #f + (until (time-elapsed? (-> self state-time) (-> self control sliding-start-time)) + (ja :num! (identity + (* 20.0 + (/ (the float (- (current-time) (-> self state-time))) (the float (-> self control sliding-start-time))) + ) + ) + ) + (suspend) + ) + (until #f + (suspend) + ) + #f + ) + :post (behavior () + (target-no-move-post) + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-3 (-> self control))) + (set! (-> a2-0 collide-with) (-> v1-3 backup-collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> v1-3 pat-ignore-mask)) + ) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-for-shape (-> self control) (+ 4096.0 (vector-length (-> self control transv))) a2-0) + ) + (target-method-28 *target* *collide-cache* *collide-edge-spec*) + ) + ) + ) diff --git a/goal_src/jak3/engine/target/target-lightjak.gc b/goal_src/jak3/engine/target/target-lightjak.gc index a9ca55f22dd..eec18ce4b81 100644 --- a/goal_src/jak3/engine/target/target-lightjak.gc +++ b/goal_src/jak3/engine/target/target-lightjak.gc @@ -1194,53 +1194,16 @@ ) ) ) - (cond - ((logtest? (-> *part-group-id-table* 176 flags) (sp-group-flag sp13)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-10 (method-of-type part-tracker-subsampler activate))) - (t9-10 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-23 gp-1) - (a1-15 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 176)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-11) a0-23 a1-15 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) - ) - (else - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-13 (method-of-type part-tracker activate))) - (t9-13 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-14 run-function-in-process) - (a0-26 gp-2) - (a1-18 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 176)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-14) a0-26 a1-18 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 176 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 176) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 176) :target self :mat-joint 6) ) - ) ) (logand! (-> self target-effect) -3) (logand! (-> self target-effect) -17) @@ -1659,53 +1622,16 @@ (set! (-> self control dynam gravity-length) 0.0) (set! (-> self control transv quad) (the-as uint128 0)) (let ((s5-2 - (cond - ((logtest? (-> *part-group-id-table* 174 flags) (sp-group-flag sp13)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-1 - (let ((t9-24 (method-of-type part-tracker-subsampler activate))) - (t9-24 (the-as part-tracker-subsampler s4-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-25 run-function-in-process) - (a0-42 s4-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 174)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-25) a0-42 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-2 - (let ((t9-27 (method-of-type part-tracker activate))) - (t9-27 (the-as part-tracker s4-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-28 run-function-in-process) - (a0-45 s4-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 174)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-28) a0-45 a1-19 *part-tracker-params-default*) - ) - (-> s4-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 174 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 174) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 174) :target self :mat-joint 6) ) - ) ) ) (while (!= (-> self ext-anim) (target-anim light)) @@ -1774,53 +1700,16 @@ (the-as (function gui-connection symbol) #f) (the-as process #f) ) - (cond - ((logtest? (-> *part-group-id-table* 175 flags) (sp-group-flag sp13)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-41 (method-of-type part-tracker-subsampler activate))) - (t9-41 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-42 run-function-in-process) - (a0-94 s5-4) - (a1-32 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 175)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-42) a0-94 a1-32 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) - ) - (else - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-44 (method-of-type part-tracker activate))) - (t9-44 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-45 run-function-in-process) - (a0-97 s5-5) - (a1-35 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 175)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-45) a0-97 a1-35 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 175 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 175) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 175) :target self :mat-joint 6) ) - ) (cond ((logtest? arg0 (lightjak-stage regen)) (go target-lightjak-regen (the-as int (-> self control lightjak-sound-id))) @@ -2760,100 +2649,26 @@ (send-event (handle->process (-> self notify)) 'notify 'attack 27) (set! (-> self neck flex-blend) 0.0) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (cond - ((logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-0 - (let ((t9-2 (method-of-type part-tracker-subsampler activate))) - (t9-2 (the-as part-tracker-subsampler gp-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-10 gp-0) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 19) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-3) a0-10 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> gp-0 ppointer) - ) - ) - ) - (else - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-1 - (let ((t9-5 (method-of-type part-tracker activate))) - (t9-5 (the-as part-tracker gp-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-6 run-function-in-process) - (a0-13 gp-1) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 19) - ((the-as (function object object object none) t9-6) a0-13 a1-6 *part-tracker-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (if (logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 180) + :target self + :mat-joint 19 + ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 180) :target self :mat-joint 19) + ) + (if (logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 180) + :target self + :mat-joint 28 + ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 180) :target self :mat-joint 28) ) - ) - (cond - ((logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker-subsampler activate))) - (t9-8 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-16 gp-2) - (a1-9 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 28) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-9) a0-16 a1-9 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-19 gp-3) - (a1-12 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 28) - ((the-as (function object object object none) t9-12) a0-19 a1-12 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) - ) - ) - ) (set! (-> self control mod-surface) *roll-flip-mods*) (let ((f30-0 0.0)) (if (time-elapsed? (-> self fact lightjak-start-time) (seconds 2)) @@ -2871,52 +2686,13 @@ (set! (-> *launch-matrix* trans quad) (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)) quad) ) - (let ((gp-7 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-7 - (let ((t9-22 (method-of-type part-tracker-subsampler activate))) - (t9-22 (the-as part-tracker-subsampler gp-7) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-33 gp-7) - (a1-22 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 181)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-23) a0-33 a1-22 *part-tracker-subsampler-params-default*) - ) - (-> gp-7 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 181)) ) (else (set! (-> *launch-matrix* trans quad) (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)) quad) ) - (let ((gp-9 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-9 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker gp-9) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-37 gp-9) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 181)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-37 a1-26 *part-tracker-params-default*) - ) - (-> gp-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 181)) ) ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) @@ -3144,55 +2920,11 @@ (cond ((logtest? (-> *part-group-id-table* 177 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-19 (method-of-type part-tracker-subsampler activate))) - (t9-19 - (the-as part-tracker-subsampler s5-2) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-20 run-function-in-process) - (a0-46 s5-2) - (a1-12 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 177)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-20) a0-46 a1-12 *part-tracker-subsampler-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 177)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s5-3) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-52 s5-3) - (a1-15 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 177)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-23) a0-52 a1-15 *part-tracker-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 177)) ) ) ) @@ -3267,53 +2999,16 @@ ) ) :code (behavior () - (cond - ((logtest? (-> *part-group-id-table* 178 flags) (sp-group-flag sp13)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler gp-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-2 gp-0) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 178)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 3) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-2 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> gp-0 ppointer) - ) - ) - ) - (else - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker gp-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-5 gp-1) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 178)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 3) - ((the-as (function object object object none) t9-5) a0-5 a1-5 *part-tracker-params-default*) - ) - (-> gp-1 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 178 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 178) + :target self + :mat-joint 3 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 178) :target self :mat-joint 3) ) - ) (let ((v1-30 (ja-group))) (when (not (and v1-30 (= v1-30 jakb-shield-start-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -3433,53 +3128,16 @@ ) (sound-play "shield-hit") (ja-channel-push! 1 (seconds 0.05)) - (cond - ((logtest? (-> *part-group-id-table* 179 flags) (sp-group-flag sp13)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-5 (method-of-type part-tracker-subsampler activate))) - (t9-5 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-6 run-function-in-process) - (a0-8 gp-1) - (a1-5 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 179)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 3) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-6) a0-8 a1-5 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) - ) - (else - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker activate))) - (t9-8 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-11 gp-2) - (a1-8 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 179)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 3) - ((the-as (function object object object none) t9-9) a0-11 a1-8 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 179 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 179) + :target self + :mat-joint 3 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 179) :target self :mat-joint 3) ) - ) (ja-no-eval :group! jakb-shield-hit-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) diff --git a/goal_src/jak3/engine/target/target-swim.gc b/goal_src/jak3/engine/target/target-swim.gc index 410ac2b8a16..e77969831e8 100644 --- a/goal_src/jak3/engine/target/target-swim.gc +++ b/goal_src/jak3/engine/target/target-swim.gc @@ -270,10 +270,7 @@ (set! f30-1 (seek f30-1 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 4.0 (seconds-per-frame))) ) - (let ((v1-107 (-> self skel root-channel 1))) - (set! (-> v1-107 frame-interp 1) f24-1) - (set! (-> v1-107 frame-interp 0) f24-1) - ) + (ja :chan 1 :frame-interp0 f24-1 :frame-interp1 f24-1) (ja :num! (loop! (/ (-> self control ctrl-xz-vel) (* 60.0 diff --git a/goal_src/jak3/engine/target/target.gc b/goal_src/jak3/engine/target/target.gc index 7249057c9bb..dec8fbeca73 100644 --- a/goal_src/jak3/engine/target/target.gc +++ b/goal_src/jak3/engine/target/target.gc @@ -2821,50 +2821,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> s5-3 best-other-tri intersect quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-36 (method-of-type part-tracker-subsampler activate))) - (t9-36 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-37 run-function-in-process) - (a0-72 s5-4) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-37) a0-72 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> s5-3 best-other-tri intersect quad)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-39 (method-of-type part-tracker activate))) - (t9-39 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-40 run-function-in-process) - (a0-77 s5-5) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-40) a0-77 a1-19 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) (let ((name (if (using-gun? self) diff --git a/goal_src/jak3/engine/ui/hud-h.gc b/goal_src/jak3/engine/ui/hud-h.gc index bee11a715e8..9f803d009a8 100644 --- a/goal_src/jak3/engine/ui/hud-h.gc +++ b/goal_src/jak3/engine/ui/hud-h.gc @@ -17,6 +17,7 @@ (define-extern hide-hud (function symbol none)) +(define-extern hide-hud-quick (function symbol none)) (define-extern show-hud (function object none)) ;; +++hud-sprite-flags diff --git a/goal_src/jak3/engine/ui/text-h.gc b/goal_src/jak3/engine/ui/text-h.gc index 63335a03b46..d65b644a5d5 100644 --- a/goal_src/jak3/engine/ui/text-h.gc +++ b/goal_src/jak3/engine/ui/text-h.gc @@ -127,7 +127,7 @@ (progress-memcard-insufficient-space-retry? #x007f) (text-0080 #x0080) (text-0081 #x0081) - (text-0082 #x0082) + (press-triangle-to-talk #x0082) (text-0083 #x0083) (text-0084 #x0084) (text-0085 #x0085) @@ -925,6 +925,7 @@ ((id text-id) (text string) ) + :pack-me ) @@ -932,7 +933,7 @@ ((length int32) (language-id int32) (group-name string) - (data game-text :dynamic) + (data game-text :inline :dynamic) ) (:methods (lookup-text! (_type_ text-id symbol) string) diff --git a/goal_src/jak3/engine/ui/text.gc b/goal_src/jak3/engine/ui/text.gc index 0ec4ede4583..ef9cdc04640 100644 --- a/goal_src/jak3/engine/ui/text.gc +++ b/goal_src/jak3/engine/ui/text.gc @@ -7,3 +7,577 @@ ;; DECOMP BEGINS +(kmemopen global "text-buffers") + +(define *expand-buf-number* 0) + +(define *game-text-word* (new 'global 'string 256 (the-as string #f))) + +(define *game-text-line* (new 'global 'string 1024 (the-as string #f))) + +(define *expanded-text-line0* (new 'global 'string 1024 (the-as string #f))) + +(define *expanded-text-line1* (new 'global 'string 1024 (the-as string #f))) + +(define *level-text-file-load-flag* #t) + +(when (zero? (-> *common-text-heap* base)) + (let ((gp-0 *common-text-heap*)) + (set! (-> gp-0 base) (kmalloc global #x12000 (kmalloc-flags) "heap")) + (set! (-> gp-0 current) (-> gp-0 base)) + (set! (-> gp-0 top-base) (&+ (-> gp-0 base) #x12000)) + (set! (-> gp-0 top) (-> gp-0 top-base)) + ) + ) + +(kmemclose) + +(defmethod relocate ((this game-text-info) (offset int)) + (let ((v1-1 (-> *level* loading-level))) + (when v1-1 + (set! (-> v1-1 loaded-text-info (-> v1-1 loaded-text-info-count)) this) + (+! (-> v1-1 loaded-text-info-count) 1) + ) + ) + this + ) + +(defmethod length ((this game-text-info)) + (-> this length) + ) + +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this game-text-info)) + (the-as int (+ (-> this type size) (* (-> this length) 8))) + ) + + +(defmethod mem-usage ((this game-text-info) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "string") + (+! (-> usage data 84 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 84 used) v1-6) + (+! (-> usage data 84 total) (logand -16 (+ v1-6 15))) + ) + (dotimes (s4-0 (-> this length)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "string") + (+! (-> usage data 84 count) 1) + (let ((v1-18 (asize-of (-> this data s4-0 text)))) + (+! (-> usage data 84 used) v1-18) + (+! (-> usage data 84 total) (logand -16 (+ v1-18 15))) + ) + ) + this + ) + +(defun convert-korean-text ((arg0 string)) + (local-vars (v1-21 int)) + (let ((gp-0 (-> arg0 data))) + *expanded-text-line0* + (let ((s4-0 0)) + 0 + (let ((s1-0 0) + (s5-0 (length arg0)) + ) + (set! *expand-buf-number* (logxor *expand-buf-number* 1)) + (let ((s3-0 (if (zero? *expand-buf-number*) + *expanded-text-line0* + *expanded-text-line1* + ) + ) + ) + (let ((s2-0 (+ (-> s3-0 allocated-length) -1))) + (clear s3-0) + (while (< s4-0 s5-0) + (cond + ((= (-> gp-0 s4-0) 3) + (+! s4-0 1) + (while (and (< s4-0 s5-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) + (set! (-> s3-0 data s1-0) (-> gp-0 s4-0)) + (+! s4-0 1) + (+! s1-0 1) + ) + ) + (else + (let ((v1-17 (+ s4-0 1))) + (-> gp-0 v1-17) + (set! s4-0 (+ v1-17 1)) + ) + (set! (-> s3-0 data s1-0) (the-as uint 126)) + (let ((v1-19 (+ s1-0 1))) + (set! (-> s3-0 data v1-19) (the-as uint 89)) + (let ((v1-20 (+ v1-19 1))) + (while (and (< s4-0 s5-0) (< v1-20 s2-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) + (cond + ((= (-> gp-0 s4-0) 5) + (set! (-> s3-0 data v1-20) (the-as uint 1)) + (+! s4-0 1) + (set! v1-21 (+ v1-20 1)) + ) + (else + (set! (-> s3-0 data v1-20) (the-as uint 3)) + (set! v1-21 (+ v1-20 1)) + ) + ) + (set! (-> s3-0 data v1-21) (-> gp-0 s4-0)) + (+! s4-0 1) + (let ((v1-22 (+ v1-21 1))) + (set! (-> s3-0 data v1-22) (the-as uint 126)) + (let ((v1-23 (+ v1-22 1))) + (set! (-> s3-0 data v1-23) (the-as uint 90)) + (set! v1-20 (+ v1-23 1)) + ) + ) + ) + (set! (-> s3-0 data v1-20) (the-as uint 126)) + (let ((v1-24 (+ v1-20 1))) + (set! (-> s3-0 data v1-24) (the-as uint 43)) + (let ((v1-25 (+ v1-24 1))) + (set! (-> s3-0 data v1-25) (the-as uint 50)) + (let ((v1-26 (+ v1-25 1))) + (set! (-> s3-0 data v1-26) (the-as uint 54)) + (let ((v1-27 (+ v1-26 1))) + (set! (-> s3-0 data v1-27) (the-as uint 72)) + (set! s1-0 (+ v1-27 1)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> s3-0 data s1-0) (the-as uint 0)) + s3-0 + ) + ) + ) + ) + ) + +(defmethod lookup-text! ((this game-text-info) (arg0 text-id) (arg1 symbol)) + (cond + ((= this #f) + (cond + (arg1 + (the-as string #f) + ) + (else + (format (clear *temp-string*) "NO GAME TEXT") + *temp-string* + ) + ) + ) + (else + (let* ((a1-2 0) + (a3-0 (+ (-> this length) 1)) + (v1-2 (/ (+ a1-2 a3-0) 2)) + ) + (let ((t0-0 -1)) + (while (and (!= (-> this data v1-2 id) arg0) (!= v1-2 t0-0)) + (if (< (the-as uint arg0) (the-as uint (-> this data v1-2 id))) + (set! a3-0 v1-2) + (set! a1-2 v1-2) + ) + (set! t0-0 v1-2) + (set! v1-2 (/ (+ a1-2 a3-0) 2)) + ) + ) + (cond + ((!= (-> this data v1-2 id) arg0) + (cond + (arg1 + (the-as string #f) + ) + (else + (format (clear *temp-string*) "UNKNOWN ID ~X" arg0) + *temp-string* + ) + ) + ) + ((= (-> this language-id) 7) + (convert-korean-text (-> this data v1-2 text)) + ) + (else + (-> this data v1-2 text) + ) + ) + ) + ) + ) + ) + +(defmethod lookup-text ((this level) (arg0 text-id) (arg1 symbol)) + (let ((v1-0 *common-text*)) + (dotimes (a3-0 (-> this loaded-text-info-count)) + (if (= (-> this loaded-text-info a3-0 language-id) (-> *setting-control* user-current language)) + (set! v1-0 (-> this loaded-text-info a3-0)) + ) + ) + (lookup-text! v1-0 arg0 arg1) + ) + ) + +(define text-is-loading #f) + +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +(defun load-game-text-info ((arg0 string) (arg1 (pointer object)) (arg2 kheap)) + (local-vars (v0-4 int) (sv-16 object) (sv-20 int) (sv-24 int) (sv-32 int)) + (set! sv-16 (-> arg1 0)) + (set! sv-20 (the-as int (-> *setting-control* user-current language))) + (set! sv-24 0) + (set! sv-32 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) + (if (and (= (scf-get-territory) 1) (= sv-20 (language-enum english)) (not (demo?))) + (set! sv-20 11) + ) + (when (and (or (= sv-16 #f) + (!= (-> (the-as game-text-info sv-16) language-id) sv-20) + (not (string= (-> (the-as game-text-info sv-16) group-name) arg0)) + ) + (not (load-in-progress? *level*)) + ) + (let ((v1-19 arg2)) + (set! (-> v1-19 current) (-> v1-19 base)) + ) + (b! #t cfg-21 :delay (nop!)) + (label cfg-20) + (set! v0-4 0) + (b! #t cfg-34 :delay (nop!)) + (label cfg-21) + (let ((s3-0 str-load)) + (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> arg2 current) 63)) + (&- (-> arg2 top) (the-as uint (-> arg2 current))) + ) + ) + cfg-20 + :delay (nop!) + ) + ) + (label cfg-23) + (let ((v1-23 (str-load-status (the-as (pointer int32) (& sv-24))))) + (cond + ((= v1-23 'error) + (format 0 "Error loading text~%") + (return 0) + ) + ((>= sv-24 (+ sv-32 -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-23 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-23) + ) + ) + ) + (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) + (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-24 arg2 0)) + ) + ) + (if (<= (the-as int (-> arg1 0)) 0) + (set! (-> arg1 0) (the-as object #f)) + ) + ) + (set! v0-4 0) + (label cfg-34) + v0-4 + ) + +(defun load-level-text-files ((arg0 int)) + (if (or *level-text-file-load-flag* (>= arg0 0)) + (load-game-text-info "common" (&-> '*common-text* value) *common-text-heap*) + ) + 0 + (none) + ) + +(defun draw-debug-text-box ((arg0 font-context)) + (when *cheat-mode* + (let ((s5-0 (new 'static 'vector4w)) + (gp-0 + (new 'static 'inline-array vector4w 4 + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + ) + ) + ) + (set-vector! (-> gp-0 0) (the int (+ -256.0 (-> arg0 origin x))) (the int (+ -208.0 (-> arg0 origin y))) 0 1) + (set-vector! + (-> gp-0 1) + (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! + (-> gp-0 2) + (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! + (-> gp-0 3) + (the int (+ -256.0 (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! s5-0 128 128 128 128) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 0) (-> gp-0 1) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 1) (-> gp-0 2) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 2) (-> gp-0 3) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 3) (-> gp-0 0) s5-0) + ) + ) + 0 + (none) + ) + +(defun print-game-text-scaled ((arg0 string) (arg1 float) (arg2 font-context) (arg3 bucket-id)) + (let ((f26-0 (-> arg2 width)) + (f30-0 (-> arg2 height)) + (f24-0 (-> arg2 origin x)) + (f22-0 (-> arg2 origin y)) + (f28-0 (-> arg2 scale)) + ) + (let ((f0-1 (* (-> arg2 width) arg1)) + (f1-2 (* (-> arg2 height) arg1)) + ) + (if (logtest? (-> arg2 flags) (font-flags middle)) + (+! (-> arg2 origin x) (* 0.5 (- f26-0 f0-1))) + ) + (if (logtest? (-> arg2 flags) (font-flags middle-vert)) + (+! (-> arg2 origin y) (* 0.5 (- f30-0 f1-2))) + ) + (let ((v1-10 arg2)) + (set! (-> v1-10 scale) (* f28-0 arg1)) + ) + (set! (-> arg2 width) f0-1) + (set! (-> arg2 height) f1-2) + ) + (print-game-text arg0 arg2 #f 44 (bucket-id hud-draw-hud-alpha)) + (set! (-> arg2 origin x) f24-0) + (set! (-> arg2 origin y) f22-0) + (set! (-> arg2 width) f26-0) + (set! (-> arg2 height) f30-0) + (set! (-> arg2 scale) f28-0) + ) + 0 + (none) + ) + +(defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 bucket-id)) + (local-vars + (sv-16 float) + (sv-20 float) + (sv-24 font-flags) + (sv-28 font-color) + (sv-32 (pointer uint8)) + (sv-36 float) + (sv-40 float) + (sv-44 float) + (sv-48 float) + (sv-52 float) + (sv-56 float) + (sv-64 int) + (sv-72 uint) + (sv-80 int) + (sv-88 int) + (sv-96 int) + (sv-104 uint) + (sv-108 symbol) + (sv-112 int) + (sv-120 int) + ) + (cond + ((< 0.1 (-> arg1 scale)) + (set! sv-16 (-> arg1 origin x)) + (set! sv-20 (-> arg1 origin y)) + (set! sv-24 (-> arg1 flags)) + (set! sv-28 (-> arg1 color)) + (set-context! *font-work* arg1) + (set! (-> arg1 max-x) sv-16) + (when (logtest? (-> arg1 flags) (font-flags middle-vert)) + (logclear! (-> arg1 flags) (font-flags middle-vert)) + (+! (-> arg1 origin y) + (the float + (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 (bucket-id hud-draw-hud-alpha))))) + ) + ) + ) + (set! sv-32 (-> arg0 data)) + (set! sv-36 (-> arg1 origin x)) + (set! sv-40 (-> arg1 origin x)) + (set! sv-44 (+ (-> arg1 origin x) (-> arg1 width))) + (set! sv-48 (+ (-> arg1 origin y) (-> arg1 height))) + (set! sv-52 (-> (get-string-length " " arg1) length)) + (set! sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large)) + (the float arg3) + 28.0 + ) + (-> arg1 scale) + ) + ) + (set! sv-64 0) + (if (logtest? (-> arg1 flags) (font-flags middle)) + (+! (-> arg1 origin x) (* 0.5 (-> arg1 width))) + ) + (set! sv-72 (-> sv-32 0)) + (set! sv-80 0) + (set! sv-88 0) + (set! sv-96 0) + (set! sv-104 (-> sv-32 1)) + (set! sv-108 (the-as symbol #f)) + (set! sv-112 0) + (set! sv-120 0) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y))) + (set! sv-120 0) + (set! sv-32 (&-> sv-32 1)) + (set! sv-104 (-> sv-32 0)) + (set! sv-32 (&-> sv-32 -1)) + (cond + ((and (> sv-72 0) (< sv-72 (the-as uint 4))) + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + (set! (-> *game-text-word* data sv-80) sv-104) + (set! sv-80 (+ sv-80 1)) + (set! sv-32 (&-> sv-32 1)) + ) + ((or (= sv-72 32) (= sv-72 47) (and (= sv-72 45) (!= (-> sv-32 -1) 126))) + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + (set! sv-108 #t) + ) + ((zero? sv-72) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (set! sv-112 (+ sv-112 1)) + ) + ((and (= sv-72 92) (= sv-104 92)) + (set! sv-32 (&-> sv-32 1)) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (set! sv-112 (+ sv-112 1)) + ) + ((and (= sv-72 95) (= sv-104 95)) + (set! sv-32 (&-> sv-32 1)) + (set! (-> *game-text-word* data sv-80) (the-as uint 32)) + (set! sv-80 (+ sv-80 1)) + ) + (else + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + ) + ) + (when sv-108 + (set! (-> *game-text-word* data sv-80) (the-as uint 0)) + (let ((f30-1 sv-36)) + (set! sv-120 (the int (-> (get-string-length *game-text-word* arg1) length))) + (let ((f0-27 (+ f30-1 (the float sv-120)))) + (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) + (set! f0-27 (- f0-27 sv-52)) + ) + (cond + ((< sv-44 f0-27) + (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (set! sv-112 (+ sv-112 1)) + ) + (else + (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) + (set! sv-88 (+ sv-88 sv-80)) + (set! sv-80 0) + (set! sv-36 (+ sv-36 (the float sv-120))) + (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (set! sv-108 (the-as symbol #f)) + ) + ) + ) + ) + ) + (while (> sv-112 0) + (let ((f30-2 (+ (-> arg1 origin y) sv-56))) + (when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t) + (when (= (-> *game-text-line* data (+ sv-88 -1)) 32) + (set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0)) + 0 + ) + (if (nonzero? (-> *game-text-line* data 0)) + (set! sv-64 (+ sv-64 1)) + ) + (when (not arg2) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + arg4 + ) + (draw-string *game-text-line* s2-1 arg1) + ) + ) + (set! (-> arg1 origin y) f30-2) + ) + ) + (set! sv-96 (+ sv-96 1)) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! sv-88 0) + (set! sv-112 (+ sv-112 -1)) + (set! sv-36 sv-40) + (when sv-108 + (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) + (set! sv-88 (+ sv-88 sv-80)) + (set! sv-80 0) + (set! sv-108 (the-as symbol #f)) + (set! sv-36 (+ sv-36 (the float sv-120))) + ) + ) + (when (nonzero? sv-72) + (set! sv-32 (&-> sv-32 1)) + (set! sv-72 (-> sv-32 0)) + ) + ) + (set! (-> arg1 origin x) sv-16) + (set! (-> arg1 origin y) sv-20) + (set! (-> arg1 flags) sv-24) + (set! (-> arg1 color) sv-28) + (if (> sv-64 0) + (* sv-56 (the float sv-64)) + 0.0 + ) + ) + (else + 0.0 + ) + ) + ) + +(defun disable-level-text-file-loading () + (set! *level-text-file-load-flag* #f) + 0 + (none) + ) + +(defun enable-level-text-file-loading () + (set! *level-text-file-load-flag* #t) + 0 + (none) + ) diff --git a/goal_src/jak3/kernel/gstate.gc b/goal_src/jak3/kernel/gstate.gc index de0d382ffef..eb1c203f1a5 100644 --- a/goal_src/jak3/kernel/gstate.gc +++ b/goal_src/jak3/kernel/gstate.gc @@ -185,6 +185,13 @@ ;; This way it can check the individual function types, make sure they make sense, and create ;; a state with the appropriate type. ,(cond + ((and virtual parent) + `(begin + (inherit-state ,new-state (the state ,parent)) + (set! (-> ,new-state parent) (the state ,parent)) + `(define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) + ) + ) (virtual `(define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) ) diff --git a/goalc/compiler/Compiler.cpp b/goalc/compiler/Compiler.cpp index 2290da945ce..7873f798d56 100644 --- a/goalc/compiler/Compiler.cpp +++ b/goalc/compiler/Compiler.cpp @@ -196,6 +196,8 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) { bool term; auto loc_info = m_goos.reader.db.get_info_for(code, &term); if (term) { + lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Function:\n"); + lg::print("{}\n", env->function_env()->name()); lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Location:\n"); lg::print("{}", loc_info); } @@ -223,6 +225,8 @@ Val* Compiler::compile_error_guard(const goos::Object& code, Env* env) { bool term; auto loc_info = m_goos.reader.db.get_info_for(code, &term); if (term) { + lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Function:\n"); + lg::print("{}\n", env->function_env()->name()); lg::print(fg(fmt::color::yellow) | fmt::emphasis::bold, "Location:\n"); lg::print("{}", loc_info); } diff --git a/test/decompiler/reference/jak2/decompiler-macros.gc b/test/decompiler/reference/jak2/decompiler-macros.gc index 983bd34a4c1..ece299a6d32 100644 --- a/test/decompiler/reference/jak2/decompiler-macros.gc +++ b/test/decompiler/reference/jak2/decompiler-macros.gc @@ -841,9 +841,11 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) &key (eval? #t) ) @@ -856,8 +858,10 @@ num-func = sets the num-func field for the channel. this lets you change the function with eval'ing. param0 = 1st parameter for the playback function. ONLY USE THESE WITH num-func !! param1 = 2nd parameter for the playback function. ONLY USE THESE WITH num-func !! + param2 = 3rd parameter for the playback function. ONLY USE THESE WITH num-func !! frame-num = set the frame-num field. - frame-interp = set the frame-interp field. + frame-interp0 = set the first value of the frame-interp array. + frame-interp1 = set the second value of the frame-interp array. dist = set the dist field. available num! functions: - (+!) = advance anim. @@ -913,6 +917,10 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) + (p2 (if param2 param2 + (cond + ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) + ))) (frame-num (cond ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) @@ -923,11 +931,13 @@ (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan))) - ,(if frame-interp `(set! (-> ja-ch frame-interp) ,frame-interp) `(none)) + ,(if frame-interp0 `(set! (-> ja-ch frame-interp 0) ,frame-interp0) `(none)) + ,(if frame-interp1 `(set! (-> ja-ch frame-interp 1) ,frame-interp1) `(none)) ,(if dist `(set! (-> ja-ch dist) ,dist) `(none)) ,(if frame-group `(set! (-> ja-ch frame-group) (the art-joint-anim ,frame-group)) `(none)) ,(if p0 `(set! (-> ja-ch param 0) ,p0) `(none)) ,(if p1 `(set! (-> ja-ch param 1) ,p1) `(none)) + ,(if p2 `(set! (-> ja-ch param 2) ,p2) `(none)) ,(if num-func `(set! (-> ja-ch num-func) ,num-func) `(none)) ,(if frame-num `(set! (-> ja-ch frame-num) ,frame-num) `(none)) ,(if nf @@ -940,7 +950,7 @@ `(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) frames num-frames)))) `(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group frames num-frames)))) )) - ((eq? num! 'identity) `(set! (-> ja-ch frame-num) ,(car num-args))) + ((and (eq? num! 'identity) (not (null? num-args))) `(set! (-> ja-ch frame-num) ,(car num-args))) (#t `(none)) ) )) @@ -951,12 +961,14 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) ) - `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :num-func ,num-func :frame-num ,frame-num :frame-interp ,frame-interp :dist ,dist) + `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :param2 ,param2 :num-func ,num-func :frame-num ,frame-num :frame-interp0 ,frame-interp0 :frame-interp1 ,frame-interp1 :dist ,dist) ) (defconstant GIF_REGS_ALL_AD diff --git a/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc b/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc index 7899d070572..1b52e3583ec 100644 --- a/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/mech/mech-states_REF.gc @@ -150,12 +150,7 @@ ) 0 (ja :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) - (let ((a0-41 (-> self skel root-channel 1))) - (set! (-> a0-41 frame-interp 1) f30-0) - (set! (-> a0-41 frame-interp 0) f30-0) - (set! (-> a0-41 param 0) 0.0) - (joint-control-channel-group-eval! a0-41 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (ja-no-eval :chan 1 :num! (loop! (/ f26-1 (current-cycle-distance (-> self skel))))) ) ) @@ -310,18 +305,8 @@ 0 (ja :num! (loop! f26-1)) ) - (let ((a0-24 (-> self skel root-channel 1))) - (set! (-> a0-24 frame-interp 1) f30-0) - (set! (-> a0-24 frame-interp 0) f30-0) - (set! (-> a0-24 param 0) 0.0) - (joint-control-channel-group-eval! a0-24 (the-as art-joint-anim #f) num-func-chan) - ) - (let ((a0-25 (-> self skel root-channel 2))) - (set! (-> a0-25 frame-interp 1) f28-0) - (set! (-> a0-25 frame-interp 0) f28-0) - (set! (-> a0-25 param 0) 0.0) - (joint-control-channel-group-eval! a0-25 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) + (ja :chan 2 :num! (chan 0) :frame-interp0 f28-0 :frame-interp1 f28-0) ) ) #f @@ -1462,13 +1447,7 @@ ) (ja-channel-push! 2 1) (ja :group! jakb-mech-carry-pickup-high-ja :num! min) - (let ((a0-2 (-> self skel root-channel 1))) - (set! (-> a0-2 frame-interp 1) f30-0) - (set! (-> a0-2 frame-interp 0) f30-0) - (set! (-> a0-2 frame-group) (the-as art-joint-anim jakb-mech-carry-pickup-low-ja)) - (set! (-> a0-2 param 0) 0.0) - (joint-control-channel-group-eval! a0-2 (the-as art-joint-anim jakb-mech-carry-pickup-low-ja) num-func-chan) - ) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja :num! (seek!)) (ja :chan 1 :num! (chan 0)) @@ -1556,10 +1535,7 @@ (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-120 (-> self skel root-channel 1))) - (set! (-> v1-120 frame-interp 1) f30-0) - (set! (-> v1-120 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1597,10 +1573,7 @@ (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-174 (-> self skel root-channel 1))) - (set! (-> v1-174 frame-interp 1) f30-0) - (set! (-> v1-174 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1618,20 +1591,14 @@ (else (ja-no-eval :num! (seek! (ja-aframe 11.0 0))) (while (not (ja-done? 0)) - (let ((v1-190 (-> self skel root-channel 1))) - (set! (-> v1-190 frame-interp 1) f30-0) - (set! (-> v1-190 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) (suspend) (ja-no-eval :num! (seek! 0.0)) (while (not (ja-done? 0)) - (let ((v1-199 (-> self skel root-channel 1))) - (set! (-> v1-199 frame-interp 1) f30-0) - (set! (-> v1-199 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -1701,13 +1668,7 @@ ) (ja-channel-push! 2 (seconds 0.1)) (ja :group! jakb-mech-carry-pickup-high-ja :num! max) - (let ((a0-19 (-> self skel root-channel 1))) - (set! (-> a0-19 frame-interp 1) f30-0) - (set! (-> a0-19 frame-interp 0) f30-0) - (set! (-> a0-19 frame-group) (the-as art-joint-anim jakb-mech-carry-pickup-low-ja)) - (set! (-> a0-19 param 0) 0.0) - (joint-control-channel-group-eval! a0-19 (the-as art-joint-anim jakb-mech-carry-pickup-low-ja) num-func-chan) - ) + (ja :chan 1 :group! jakb-mech-carry-pickup-low-ja :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-no-eval :num! (seek! (ja-aframe 8.0 0))) (while (not (ja-done? 0)) @@ -2001,12 +1962,7 @@ ) (ja :num! (loop! f28-1)) ) - (let ((a0-16 (-> self skel root-channel 1))) - (set! (-> a0-16 frame-interp 1) f30-0) - (set! (-> a0-16 frame-interp 0) f30-0) - (set! (-> a0-16 param 0) 0.0) - (joint-control-channel-group-eval! a0-16 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) #f diff --git a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc index 4295826dc54..6ef41ac71b5 100644 --- a/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-anim_REF.gc @@ -1116,10 +1116,7 @@ ) ) ) - (let ((v1-252 (-> self skel root-channel 6))) - (set! (-> v1-252 frame-interp 1) f26-0) - (set! (-> v1-252 frame-interp 0) f26-0) - ) + (ja :chan 6 :frame-interp0 f26-0 :frame-interp1 f26-0) (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) (f0-70 (/ (-> self control ctrl-xz-vel) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) ) diff --git a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc index 79ee8c3089d..23a3e1273a1 100644 --- a/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-carry_REF.gc @@ -186,17 +186,12 @@ (ja-channel-push! 2 (seconds 0.1)) (target-danger-set! 'carry? #f) (ja :group! (-> self draw art-group data 319) :num! min) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim (-> self draw art-group data 318))) - (set! (-> a0-3 param 0) 0.0) - (joint-control-channel-group-eval! - a0-3 - (the-as art-joint-anim (-> self draw art-group data 318)) - num-func-chan + (ja :chan 1 + :group! (-> self draw art-group data 318) + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 ) - ) (suspend) (format #t "carry picked ~A~%" (handle->process (-> self carry other))) (let ((a1-5 (new 'stack-no-clear 'event-message-block))) @@ -234,10 +229,7 @@ (ja-no-eval :num! (seek! (ja-aframe 5.0 0))) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-45 (-> self skel root-channel 1))) - (set! (-> v1-45 frame-interp 1) f30-0) - (set! (-> v1-45 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -246,10 +238,7 @@ (ja-no-eval :num! (seek!)) (while (not (ja-done? 0)) (set! f30-0 (seek f30-0 f28-0 (* 5.0 (seconds-per-frame)))) - (let ((v1-70 (-> self skel root-channel 1))) - (set! (-> v1-70 frame-interp 1) f30-0) - (set! (-> v1-70 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (when (< 22.0 (ja-aframe-num 0)) (let ((a1-22 (new 'stack-no-clear 'event-message-block))) (set! (-> a1-22 from) (process->ppointer self)) @@ -270,10 +259,7 @@ ) (ja-no-eval :num! (seek! 0.0)) (while (not (ja-done? 0)) - (let ((v1-93 (-> self skel root-channel 1))) - (set! (-> v1-93 frame-interp 1) f30-0) - (set! (-> v1-93 frame-interp 0) f30-0) - ) + (ja :chan 1 :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) (ja-eval) ) @@ -328,17 +314,12 @@ ) (ja-channel-push! 2 (seconds 0.1)) (ja :group! (-> self draw art-group data 319) :num! max) - (let ((a0-16 (-> self skel root-channel 1))) - (set! (-> a0-16 frame-interp 1) f30-0) - (set! (-> a0-16 frame-interp 0) f30-0) - (set! (-> a0-16 frame-group) (the-as art-joint-anim (-> self draw art-group data 318))) - (set! (-> a0-16 param 0) 0.0) - (joint-control-channel-group-eval! - a0-16 - (the-as art-joint-anim (-> self draw art-group data 318)) - num-func-chan + (ja :chan 1 + :group! (-> self draw art-group data 318) + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 ) - ) ) (suspend) (ja-no-eval :num! (seek! (ja-aframe 5.0 0))) diff --git a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc index 0bf1c010b7c..b9998230a1a 100644 --- a/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-swim_REF.gc @@ -260,10 +260,7 @@ (set! f30-1 (seek f30-1 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 4.0 (seconds-per-frame))) ) - (let ((v1-107 (-> self skel root-channel 1))) - (set! (-> v1-107 frame-interp 1) f24-1) - (set! (-> v1-107 frame-interp 0) f24-1) - ) + (ja :chan 1 :frame-interp0 f24-1 :frame-interp1 f24-1) (ja :num! (loop! (/ (-> self control ctrl-xz-vel) (* 60.0 diff --git a/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc b/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc index 022fed5bc21..dc7ae0b99c1 100644 --- a/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc +++ b/test/decompiler/reference/jak2/levels/castle/roboguard-level_REF.gc @@ -402,11 +402,7 @@ 0 ) :code (behavior () - (let ((a0-0 (-> self skel root-channel 0))) - (set! (-> a0-0 frame-group) (the-as art-joint-anim roboguard-idle-to-ball-ja)) - (set! (-> a0-0 frame-num) 3.0) - (joint-control-channel-group! a0-0 (the-as art-joint-anim roboguard-idle-to-ball-ja) num-func-identity) - ) + (ja-no-eval :group! roboguard-idle-to-ball-ja :num! (identity 3.0)) (until (logtest? (-> self root status) (collide-status on-surface)) (nav-enemy-falling-post) (suspend) diff --git a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc index 0caeec8de79..2db49db6349 100644 --- a/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/common/pilot-states_REF.gc @@ -29,13 +29,13 @@ (let ((gp-0 (-> self pilot))) (let ((f30-0 (* 5.0 (- 1.0 (-> gp-0 left-right-interp))))) (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) - (let ((f0-3 (fmax 0.0 (fmin 1.0 (* 0.5 (+ 1.0 (* 1.42 (+ -0.3 (-> gp-0 front-back-interp)))))))) - (s5-1 (-> self skel root-channel 1)) + (let ((f0-3 (fmax 0.0 (fmin 1.0 (* 0.5 (+ 1.0 (* 1.42 (+ -0.3 (-> gp-0 front-back-interp))))))))) + (ja :chan 1 + :frame-interp0 f0-3 + :frame-interp1 f0-3 + :num-func num-func-identity + :frame-num (ja-aframe f30-0 1) ) - (set! (-> s5-1 frame-interp 1) f0-3) - (set! (-> s5-1 frame-interp 0) f0-3) - (set! (-> s5-1 num-func) num-func-identity) - (set! (-> s5-1 frame-num) (ja-aframe f30-0 1)) ) ) (let ((f0-6 (* 5.0 (- 1.0 (-> gp-0 up-down-interp)))) diff --git a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc index 6ef7255b39d..c7dabd4edec 100644 --- a/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/kiddogescort/kidesc-states_REF.gc @@ -507,12 +507,12 @@ ) ) (ja :num-func num-func-identity :frame-num (ja-aframe f30-0 0)) - (let ((gp-2 (-> self skel root-channel 1))) - (set! (-> gp-2 frame-interp 1) f26-0) - (set! (-> gp-2 frame-interp 0) f26-0) - (set! (-> gp-2 num-func) num-func-identity) - (set! (-> gp-2 frame-num) (ja-aframe f28-0 0)) - ) + (ja :chan 1 + :frame-interp0 f26-0 + :frame-interp1 f26-0 + :num-func num-func-identity + :frame-num (ja-aframe f28-0 0) + ) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc index 06c23232ef0..ee2379276e9 100644 --- a/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/city/traffic/citizen/metalhead-flitter_REF.gc @@ -857,24 +857,18 @@ (ja-channel-push! 2 (seconds 0.1)) (let ((f30-0 (metalhead-flitter-method-209 self))) (ja-no-eval :group! flitter-attack-ja :num! (seek! max 0.8) :frame-num 0.0) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim flitter-attack-high-ja)) - (set! (-> a0-3 param 0) 0.0) - (set! (-> a0-3 frame-num) 0.0) - (joint-control-channel-group! a0-3 (the-as art-joint-anim flitter-attack-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! flitter-attack-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (set! f30-0 (seek f30-0 (metalhead-flitter-method-209 self) (* 0.2 (seconds-per-frame)))) (ja :num! (seek! max 0.8)) - (let ((a0-7 (-> self skel root-channel 1))) - (set! (-> a0-7 frame-interp 1) f30-0) - (set! (-> a0-7 frame-interp 0) f30-0) - (set! (-> a0-7 param 0) 0.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) (let ((v1-40 self)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc index 89695a68ac8..f895c3a7547 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/flitter_REF.gc @@ -1245,24 +1245,18 @@ (ja-channel-push! 2 (seconds 0.1)) (let ((f30-0 (flitter-method-183 self))) (ja-no-eval :group! flitter-attack-ja :num! (seek! max 0.8) :frame-num 0.0) - (let ((a0-3 (-> self skel root-channel 1))) - (set! (-> a0-3 frame-interp 1) f30-0) - (set! (-> a0-3 frame-interp 0) f30-0) - (set! (-> a0-3 frame-group) (the-as art-joint-anim flitter-attack-high-ja)) - (set! (-> a0-3 param 0) 0.0) - (set! (-> a0-3 frame-num) 0.0) - (joint-control-channel-group! a0-3 (the-as art-joint-anim flitter-attack-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! flitter-attack-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (set! f30-0 (seek f30-0 (flitter-method-183 self) (* 0.2 (seconds-per-frame)))) (ja :num! (seek! max 0.8)) - (let ((a0-7 (-> self skel root-channel 1))) - (set! (-> a0-7 frame-interp 1) f30-0) - (set! (-> a0-7 frame-interp 0) f30-0) - (set! (-> a0-7 param 0) 0.0) - (joint-control-channel-group-eval! a0-7 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) ) ) (let ((v1-40 self)) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc index 7ea436e1e50..3da7654f1eb 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/spyder_REF.gc @@ -1116,14 +1116,13 @@ (ja-channel-push! 2 (seconds 0.2)) (let ((f30-0 0.0)) (ja-no-eval :group! spyder-shoot-low-ja :num! (loop!) :frame-num 0.0) - (let ((a0-12 (-> self skel root-channel 1))) - (set! (-> a0-12 frame-interp 1) f30-0) - (set! (-> a0-12 frame-interp 0) f30-0) - (set! (-> a0-12 frame-group) (the-as art-joint-anim spyder-shoot-high-ja)) - (set! (-> a0-12 param 0) 0.0) - (set! (-> a0-12 frame-num) 0.0) - (joint-control-channel-group! a0-12 (the-as art-joint-anim spyder-shoot-high-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! spyder-shoot-high-ja + :num! (chan 0) + :frame-interp0 f30-0 + :frame-interp1 f30-0 + :frame-num 0.0 + ) (let ((a0-14 (handle->process (-> self focus handle)))) (when a0-14 (let ((gp-0 (new 'stack-no-clear 'vector))) @@ -1147,12 +1146,7 @@ (until (time-elapsed? s3-1 (seconds 0.2)) (set! f30-0 (seek f30-0 (lerp-scale 0.0 1.0 (the float s4-0) 0.0 8.0) (seconds-per-frame))) (ja :num! (loop!)) - (let ((a0-27 (-> self skel root-channel 1))) - (set! (-> a0-27 frame-interp 1) f30-0) - (set! (-> a0-27 frame-interp 0) f30-0) - (set! (-> a0-27 param 0) 0.0) - (joint-control-channel-group-eval! a0-27 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-0 :frame-interp1 f30-0) (suspend) ) ) diff --git a/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc b/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc index e20b3a6b0c8..570645a416c 100644 --- a/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/drill/drill-obs_REF.gc @@ -407,11 +407,8 @@ This commonly includes things such as: (until #f (let ((f30-0 (- (-> self extent 1 y) (-> self extent 0 y)))) (when (!= f30-0 (-> self length)) - (let ((f0-3 (* 0.000010172526 f30-0)) - (a0-0 (-> self skel root-channel 0)) - ) - (set! (-> a0-0 frame-num) f0-3) - (joint-control-channel-group-eval! a0-0 (the-as art-joint-anim #f) num-func-identity) + (let ((f0-3 (* 0.000010172526 f30-0))) + (ja :num! (identity f0-3)) ) (transform-post) (set! (-> self length) f30-0) diff --git a/test/decompiler/reference/jak2/levels/forest/wren_REF.gc b/test/decompiler/reference/jak2/levels/forest/wren_REF.gc index 3f8382140e1..fc2cedac2ac 100644 --- a/test/decompiler/reference/jak2/levels/forest/wren_REF.gc +++ b/test/decompiler/reference/jak2/levels/forest/wren_REF.gc @@ -339,11 +339,7 @@ If so, it transitions from [[wren::peck]] to [[wren::hunt]]" ) (set! (-> v1-59 frame-group) (the-as art-joint-anim wren-glide-ja)) ) - (let ((v1-62 (-> self skel root-channel 1))) - (set! (-> v1-62 frame-interp 1) f30-1) - (set! (-> v1-62 frame-interp 0) f30-1) - (set! (-> v1-62 frame-group) (the-as art-joint-anim wren-fly-ja)) - ) + (ja :chan 1 :group! wren-fly-ja :frame-interp0 f30-1 :frame-interp1 f30-1) (let ((f30-2 (lerp 0.6 2.4 f30-1))) (ja :num! (loop! f30-2)) (ja :chan 1 :num! (loop! f30-2)) diff --git a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc index c97b3483023..0320bc0460d 100644 --- a/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc +++ b/test/decompiler/reference/jak2/levels/nest/boss/metalkor-states_REF.gc @@ -535,10 +535,7 @@ ) ) ) - (let ((v1-24 (-> self skel root-channel 1))) - (set! (-> v1-24 frame-interp 1) f30-2) - (set! (-> v1-24 frame-interp 0) f30-2) - ) + (ja :chan 1 :frame-interp0 f30-2 :frame-interp1 f30-2) ) ) (none) diff --git a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc index d48c5edf39c..fbc5ee211a6 100644 --- a/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc +++ b/test/decompiler/reference/jak2/levels/stadium/stadium-obs_REF.gc @@ -2327,12 +2327,7 @@ This commonly includes things such as: ) ) ) - (let ((a0-10 (-> self skel root-channel 0))) - (set! (-> a0-10 frame-interp 1) f28-0) - (set! (-> a0-10 frame-interp 0) f28-0) - (set! (-> a0-10 param 0) f30-0) - (joint-control-channel-group-eval! a0-10 (the-as art-joint-anim #f) num-func-loop!) - ) + (ja :num! (loop! f30-0) :frame-interp0 f28-0 :frame-interp1 f28-0) (let ((a0-11 (-> self skel root-channel 1))) (let ((f0-9 (- 1.0 f28-0))) (set! (-> a0-11 frame-interp 1) f0-9) diff --git a/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc b/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc index 3944a46c2cb..b5507f80932 100644 --- a/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/monster-frog_REF.gc @@ -552,43 +552,31 @@ 0 (ja-channel-push! 2 (seconds 0.01)) (ja-no-eval :group! monster-frog-hop-small-start-ja :num! (seek! max f28-1) :frame-num 0.0) - (let ((a0-15 (-> self skel root-channel 1))) - (set! (-> a0-15 frame-interp 1) f30-1) - (set! (-> a0-15 frame-interp 0) f30-1) - (set! (-> a0-15 frame-group) (the-as art-joint-anim monster-frog-hop-slow-start-ja)) - (set! (-> a0-15 param 0) 0.0) - (set! (-> a0-15 frame-num) 0.0) - (joint-control-channel-group! a0-15 (the-as art-joint-anim monster-frog-hop-slow-start-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! monster-frog-hop-slow-start-ja + :num! (chan 0) + :frame-interp0 f30-1 + :frame-interp1 f30-1 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (ja :num! (seek! max f28-1)) - (let ((a0-17 (-> self skel root-channel 1))) - (set! (-> a0-17 frame-interp 1) f30-1) - (set! (-> a0-17 frame-interp 0) f30-1) - (set! (-> a0-17 param 0) 0.0) - (joint-control-channel-group-eval! a0-17 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-1 :frame-interp1 f30-1) ) (nav-enemy-method-167 self) (ja-no-eval :group! monster-frog-hop-small-end-ja :num! (seek! max f28-1) :frame-num 0.0) - (let ((a0-21 (-> self skel root-channel 1))) - (set! (-> a0-21 frame-interp 1) f30-1) - (set! (-> a0-21 frame-interp 0) f30-1) - (set! (-> a0-21 frame-group) (the-as art-joint-anim monster-frog-hop-slow-end-ja)) - (set! (-> a0-21 param 0) 0.0) - (set! (-> a0-21 frame-num) 0.0) - (joint-control-channel-group! a0-21 (the-as art-joint-anim monster-frog-hop-slow-end-ja) num-func-chan) - ) + (ja-no-eval :chan 1 + :group! monster-frog-hop-slow-end-ja + :num! (chan 0) + :frame-interp0 f30-1 + :frame-interp1 f30-1 + :frame-num 0.0 + ) (until (ja-done? 0) (suspend) (ja :num! (seek! max f28-1)) - (let ((a0-23 (-> self skel root-channel 1))) - (set! (-> a0-23 frame-interp 1) f30-1) - (set! (-> a0-23 frame-interp 0) f30-1) - (set! (-> a0-23 param 0) 0.0) - (joint-control-channel-group-eval! a0-23 (the-as art-joint-anim #f) num-func-chan) - ) + (ja :chan 1 :num! (chan 0) :frame-interp0 f30-1 :frame-interp1 f30-1) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/tomb/target-indax_REF.gc b/test/decompiler/reference/jak2/levels/tomb/target-indax_REF.gc index a82e61f3059..9d4fd1bf81a 100644 --- a/test/decompiler/reference/jak2/levels/tomb/target-indax_REF.gc +++ b/test/decompiler/reference/jak2/levels/tomb/target-indax_REF.gc @@ -679,10 +679,7 @@ ) (set! f30-0 (seek f30-0 f26-1 (* 4.0 (seconds-per-frame)))) ) - (let ((v1-94 (-> self skel root-channel 1))) - (set! (-> v1-94 frame-interp 1) f28-0) - (set! (-> v1-94 frame-interp 0) f28-0) - ) + (ja :chan 1 :frame-interp0 f28-0 :frame-interp1 f28-0) (let ((v1-98 (-> self skel root-channel 2)) (f0-23 (- 1.0 f30-0)) ) @@ -1465,7 +1462,3 @@ ) :post target-no-stick-post ) - - - - diff --git a/test/decompiler/reference/jak3/decompiler-macros.gc b/test/decompiler/reference/jak3/decompiler-macros.gc index 69fede4dec6..015a1d17770 100644 --- a/test/decompiler/reference/jak3/decompiler-macros.gc +++ b/test/decompiler/reference/jak3/decompiler-macros.gc @@ -213,6 +213,13 @@ ;; This way it can check the individual function types, make sure they make sense, and create ;; a state with the appropriate type. ,(cond + ((and virtual parent) + `(begin + (inherit-state ,new-state (the state ,parent)) + (set! (-> ,new-state parent) (the state ,parent)) + `(define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) + ) + ) (virtual `(define-virtual-state-hook ,state-name ,defstate-type ,new-state ,(eq? virtual 'override) :event ,event :enter ,enter :trans ,trans :exit ,exit :code ,code :post ,post) ) @@ -970,7 +977,6 @@ ) ) -;; og:preserve-this ;; look up the index of an art element in an art group. (desfun art-elt-index (ag-name elt-name) (if (number? elt-name) @@ -1126,9 +1132,11 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) &key (eval? #t) ) @@ -1141,8 +1149,10 @@ num-func = sets the num-func field for the channel. this lets you change the function with eval'ing. param0 = 1st parameter for the playback function. ONLY USE THESE WITH num-func !! param1 = 2nd parameter for the playback function. ONLY USE THESE WITH num-func !! + param2 = 3rd parameter for the playback function. ONLY USE THESE WITH num-func !! frame-num = set the frame-num field. - frame-interp = set the frame-interp field. + frame-interp0 = set the first value of the frame-interp array. + frame-interp1 = set the second value of the frame-interp array. dist = set the dist field. available num! functions: - (+!) = advance anim. @@ -1198,6 +1208,10 @@ (cond ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) ))) + (p2 (if param2 param2 + (cond + ((eq? num! 'seek!) (if (or (null? num-args) (null? (cdr num-args))) 1.0 (cadr num-args))) + ))) (frame-num (cond ((eq? 'max frame-num) (if group! `(the float (1- (-> (the art-joint-anim ,group!) frames num-frames))) @@ -1208,11 +1222,13 @@ (frame-group (if (or p0 p1 frame-num (not nf)) group! #f)) ) `(let ((ja-ch (-> self skel root-channel ,chan))) - ,(if frame-interp `(set! (-> ja-ch frame-interp) ,frame-interp) `(none)) + ,(if frame-interp0 `(set! (-> ja-ch frame-interp 0) ,frame-interp0) `(none)) + ,(if frame-interp1 `(set! (-> ja-ch frame-interp 1) ,frame-interp1) `(none)) ,(if dist `(set! (-> ja-ch dist) ,dist) `(none)) ,(if frame-group `(set! (-> ja-ch frame-group) (the art-joint-anim ,frame-group)) `(none)) ,(if p0 `(set! (-> ja-ch param 0) ,p0) `(none)) ,(if p1 `(set! (-> ja-ch param 1) ,p1) `(none)) + ,(if p2 `(set! (-> ja-ch param 2) ,p2) `(none)) ,(if num-func `(set! (-> ja-ch num-func) ,num-func) `(none)) ,(if frame-num `(set! (-> ja-ch frame-num) ,frame-num) `(none)) ,(if nf @@ -1225,7 +1241,7 @@ `(set! (-> ja-ch frame-num) (the float (1- (-> (the art-joint-anim ,group!) frames num-frames)))) `(set! (-> ja-ch frame-num) (the float (1- (-> ja-ch frame-group frames num-frames)))) )) - ((eq? num! 'identity) `(set! (-> ja-ch frame-num) ,(car num-args))) + ((and (eq? num! 'identity) (not (null? num-args))) `(set! (-> ja-ch frame-num) ,(car num-args))) (#t `(none)) ) )) @@ -1236,12 +1252,14 @@ &key (num! #f) &key (param0 #f) &key (param1 #f) + &key (param2 #f) &key (num-func #f) &key (frame-num #f) - &key (frame-interp #f) + &key (frame-interp0 #f) + &key (frame-interp1 #f) &key (dist #f) ) - `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :num-func ,num-func :frame-num ,frame-num :frame-interp ,frame-interp :dist ,dist) + `(ja :eval? #f :chan ,chan :group! ,group! :num! ,num! :param0 ,param0 :param1 ,param1 :param2 ,param2 :num-func ,num-func :frame-num ,frame-num :frame-interp0 ,frame-interp0 :frame-interp1 ,frame-interp1 :dist ,dist) ) (defmacro script-eval (script &key (key (process->ppointer PP)) &key (proc PP) &key (vector (the-as vector #f))) @@ -1612,5 +1630,55 @@ ) ) +(defmacro set-part-tracker-params (type group duration callback userdata target mat-joint subsample-num) + `(case ,type + ((part-tracker) + (set! (-> *part-tracker-params-default* group) ,group) + (set! (-> *part-tracker-params-default* duration) ,duration) + (set! (-> *part-tracker-params-default* callback) ,callback) + (set! (-> *part-tracker-params-default* userdata) ,userdata) + (set! (-> *part-tracker-params-default* target) ,target) + (set! (-> *part-tracker-params-default* mat-joint) ,mat-joint) + ) + (else + (set! (-> *part-tracker-subsampler-params-default* group) ,group) + (set! (-> *part-tracker-subsampler-params-default* duration) ,duration) + (set! (-> *part-tracker-subsampler-params-default* callback) ,callback) + (set! (-> *part-tracker-subsampler-params-default* userdata) ,userdata) + (set! (-> *part-tracker-subsampler-params-default* target) ,target) + (set! (-> *part-tracker-subsampler-params-default* mat-joint) ,mat-joint) + (set! (-> *part-tracker-subsampler-params-default* subsample-num) ,subsample-num) + ) + ) + ) + +(defmacro part-tracker-spawn (type &key (group #f) + &key (to #f) + &key (name #f) + &key (stack-size #x4000) + &key (stack *scratch-memory-top*) + &key (unk 0) + &key (duration (seconds 0)) + &key (callback #f) + &key (userdata (the uint #f)) + &key (target #f) + &key (mat-joint *launch-matrix*) + &key (subsample-num 1.0)) + "Specialized `process-spawn` macro for [[part-tracker]]s. + Returns a pointer to the new process, or #f (or is it 0?) if something goes wrong." + (with-gensyms (new-tracker) + `(let ((,new-tracker (the-as ,type (get-process *default-dead-pool* ,type ,stack-size ,unk)))) + (when ,new-tracker + ((method-of-type ,type activate) ,new-tracker ,to ,(if name name `(symbol->string (quote ,type))) ,stack) + (set-part-tracker-params ,type ,group ,duration ,callback ,userdata ,target ,mat-joint ,subsample-num) + (run-now-in-process ,new-tracker + (if (= ,type part-tracker) part-tracker-init part-tracker-subsampler-init) + (if (= ,type part-tracker) *part-tracker-params-default* *part-tracker-subsampler-params-default*)) + (the (pointer ,type) (-> ,new-tracker ppointer)) + ) + ) + ) + ) + (import "goal_src/jak3/engine/data/tpages.gc") (import "goal_src/jak3/engine/data/textures.gc") \ No newline at end of file diff --git a/test/decompiler/reference/jak3/engine/ai/enemy-h_REF.gc b/test/decompiler/reference/jak3/engine/ai/enemy-h_REF.gc new file mode 100644 index 00000000000..9efe877b58c --- /dev/null +++ b/test/decompiler/reference/jak3/engine/ai/enemy-h_REF.gc @@ -0,0 +1,758 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type enemy-focus +(deftype enemy-focus (focus) + ((aware enemy-aware) + (flags enemy-flag) + ) + (:methods + (try-update-focus (_type_ process-focusable enemy) symbol :replace) + (enemy-focus-method-13 (_type_ process-focusable enemy-aware) symbol) + ) + ) + +;; definition for method 3 of type enemy-focus +(defmethod inspect ((this enemy-focus)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-focus) + (format #t "~1Thandle: ~D~%" (-> this handle)) + (format #t "~1Tcollide-with: ~D~%" (-> this collide-with)) + (format #t "~1Taware: ~D~%" (-> this aware)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (label cfg-4) + this + ) + +;; definition of type enemy-info +(deftype enemy-info (basic) + ((fact-defaults fact-info-enemy-defaults) + (use-die-falling symbol) + (use-victory symbol) + (use-jump-blocked symbol) + (debug-draw-neck symbol) + (jump-debug-draw symbol) + (move-to-ground symbol) + (hover-if-no-ground symbol) + (idle-anim-script (inline-array idle-control-frame)) + (idle-anim int32) + (notice-anim int32) + (hostile-anim int32) + (hit-anim int32) + (knocked-anim int32) + (knocked-land-anim int32) + (die-anim int32) + (die-falling-anim int32) + (victory-anim int32) + (jump-wind-up-anim int32) + (jump-in-air-anim int32) + (jump-land-anim int32) + (neck-joint int32) + (look-at-joint int32) + (bullseye-joint int32) + (sound-hit sound-name) + (sound-die sound-name) + (notice-distance meters) + (notice-distance-delta meters) + (proximity-notice-distance meters) + (default-hit-points float) + (gnd-collide-with collide-spec) + (overlaps-others-collide-with-filter collide-spec) + (penetrate-flinch penetrate) + (penetrate-knocked penetrate) + (movement-gravity meters) + (friction float) + (slip-factor float) + (attack-shove-back meters) + (attack-shove-up meters) + (attack-mode symbol) + (attack-damage int32) + (recover-gnd-collide-with collide-spec) + (knocked-can-land-timeout time-frame) + (knocked-recover-timeout time-frame) + (ragdoll-blend-out-time time-frame) + (ragdoll-rotate-velocity-mult float) + (jump-height-min meters) + (jump-height-factor float) + (knocked-seek-ry-clamp float) + (knocked-soft-vxz-lo float) + (knocked-soft-vxz-hi float) + (knocked-soft-vy-lo float) + (knocked-soft-vy-hi float) + (knocked-medium-vxz-lo float) + (knocked-medium-vxz-hi float) + (knocked-medium-vy-lo float) + (knocked-medium-vy-hi float) + (knocked-hard-vxz-lo float) + (knocked-hard-vxz-hi float) + (knocked-hard-vy-lo float) + (knocked-hard-vy-hi float) + (knocked-huge-vxz-lo float) + (knocked-huge-vxz-hi float) + (knocked-huge-vy-lo float) + (knocked-huge-vy-hi float) + (knocked-yellow-vxz-lo float) + (knocked-yellow-vxz-hi float) + (knocked-yellow-vy-lo float) + (knocked-yellow-vy-hi float) + (knocked-red-vxz-lo float) + (knocked-red-vxz-hi float) + (knocked-red-vy-lo float) + (knocked-red-vy-hi float) + (knocked-blue-vxz-lo float) + (knocked-blue-vxz-hi float) + (knocked-blue-vy-lo float) + (knocked-blue-vy-hi float) + (ragdoll-info ragdoll-setup) + (shadow-size meters) + (shadow-max-y meters) + (shadow-min-y meters) + (shadow-locus-dist meters) + (gem-joint int32) + (gem-seg uint32) + (gem-no-seg uint32) + (gem-offset sphere :inline) + (knocked-off basic) + ) + (:methods + (copy-enemy-info! (_type_ _type_) none) + ) + ) + +;; definition for method 3 of type enemy-info +;; INFO: Used lq/sq +(defmethod inspect ((this enemy-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tfact-defaults: ~A~%" (-> this fact-defaults)) + (format #t "~1Tuse-die-falling: ~A~%" (-> this use-die-falling)) + (format #t "~1Tuse-victory: ~A~%" (-> this use-victory)) + (format #t "~1Tuse-jump-blocked: ~A~%" (-> this use-jump-blocked)) + (format #t "~1Tdebug-draw-neck: ~A~%" (-> this debug-draw-neck)) + (format #t "~1Tjump-debug-draw: ~A~%" (-> this jump-debug-draw)) + (format #t "~1Tmove-to-ground: ~A~%" (-> this move-to-ground)) + (format #t "~1Thover-if-no-ground: ~A~%" (-> this hover-if-no-ground)) + (format #t "~1Tidle-anim-script: #x~X~%" (-> this idle-anim-script)) + (format #t "~1Tidle-anim: ~D~%" (-> this idle-anim)) + (format #t "~1Tnotice-anim: ~D~%" (-> this notice-anim)) + (format #t "~1Thostile-anim: ~D~%" (-> this hostile-anim)) + (format #t "~1Thit-anim: ~D~%" (-> this hit-anim)) + (format #t "~1Tknocked-anim: ~D~%" (-> this knocked-anim)) + (format #t "~1Tknocked-land-anim: ~D~%" (-> this knocked-land-anim)) + (format #t "~1Tdie-anim: ~D~%" (-> this die-anim)) + (format #t "~1Tdie-falling-anim: ~D~%" (-> this die-falling-anim)) + (format #t "~1Tvictory-anim: ~D~%" (-> this victory-anim)) + (format #t "~1Tjump-wind-up-anim: ~D~%" (-> this jump-wind-up-anim)) + (format #t "~1Tjump-in-air-anim: ~D~%" (-> this jump-in-air-anim)) + (format #t "~1Tjump-land-anim: ~D~%" (-> this jump-land-anim)) + (format #t "~1Tneck-joint: ~D~%" (-> this neck-joint)) + (format #t "~1Tlook-at-joint: ~D~%" (-> this look-at-joint)) + (format #t "~1Tbullseye-joint: ~D~%" (-> this bullseye-joint)) + (format #t "~1Tsound-hit: ~D~%" (-> this sound-hit)) + (format #t "~1Tsound-die: ~D~%" (-> this sound-die)) + (format #t "~1Tnotice-distance: (meters ~m)~%" (-> this notice-distance)) + (format #t "~1Tnotice-distance-delta: (meters ~m)~%" (-> this notice-distance-delta)) + (format #t "~1Tproximity-notice-distance: (meters ~m)~%" (-> this proximity-notice-distance)) + (format #t "~1Tdefault-hit-points: ~f~%" (-> this default-hit-points)) + (format #t "~1Tgnd-collide-with: ~D~%" (-> this gnd-collide-with)) + (format #t "~1Toverlaps-others-collide-with-filter: ~D~%" (-> this overlaps-others-collide-with-filter)) + (format #t "~1Tpenetrate-flinch: ~D~%" (-> this penetrate-flinch)) + (format #t "~1Tpenetrate-knocked: ~D~%" (-> this penetrate-knocked)) + (format #t "~1Tmovement-gravity: (meters ~m)~%" (-> this movement-gravity)) + (format #t "~1Tfriction: ~f~%" (-> this friction)) + (format #t "~1Tslip-factor: ~f~%" (-> this slip-factor)) + (format #t "~1Tattack-shove-back: (meters ~m)~%" (-> this attack-shove-back)) + (format #t "~1Tattack-shove-up: (meters ~m)~%" (-> this attack-shove-up)) + (format #t "~1Tattack-mode: ~A~%" (-> this attack-mode)) + (format #t "~1Tattack-damage: ~D~%" (-> this attack-damage)) + (format #t "~1Trecover-gnd-collide-with: ~D~%" (-> this recover-gnd-collide-with)) + (format #t "~1Tknocked-can-land-timeout: ~D~%" (-> this knocked-can-land-timeout)) + (format #t "~1Tknocked-recover-timeout: ~D~%" (-> this knocked-recover-timeout)) + (format #t "~1Tragdoll-blend-out-time: ~D~%" (-> this ragdoll-blend-out-time)) + (format #t "~1Tragdoll-rotate-velocity-mult: ~f~%" (-> this ragdoll-rotate-velocity-mult)) + (format #t "~1Tjump-height-min: (meters ~m)~%" (-> this jump-height-min)) + (format #t "~1Tjump-height-factor: ~f~%" (-> this jump-height-factor)) + (format #t "~1Tknocked-seek-ry-clamp: ~f~%" (-> this knocked-seek-ry-clamp)) + (format #t "~1Tknocked-soft-vxz-lo: ~f~%" (-> this knocked-soft-vxz-lo)) + (format #t "~1Tknocked-soft-vxz-hi: ~f~%" (-> this knocked-soft-vxz-hi)) + (format #t "~1Tknocked-soft-vy-lo: ~f~%" (-> this knocked-soft-vy-lo)) + (format #t "~1Tknocked-soft-vy-hi: ~f~%" (-> this knocked-soft-vy-hi)) + (format #t "~1Tknocked-medium-vxz-lo: ~f~%" (-> this knocked-medium-vxz-lo)) + (format #t "~1Tknocked-medium-vxz-hi: ~f~%" (-> this knocked-medium-vxz-hi)) + (format #t "~1Tknocked-medium-vy-lo: ~f~%" (-> this knocked-medium-vy-lo)) + (format #t "~1Tknocked-medium-vy-hi: ~f~%" (-> this knocked-medium-vy-hi)) + (format #t "~1Tknocked-hard-vxz-lo: ~f~%" (-> this knocked-hard-vxz-lo)) + (format #t "~1Tknocked-hard-vxz-hi: ~f~%" (-> this knocked-hard-vxz-hi)) + (format #t "~1Tknocked-hard-vy-lo: ~f~%" (-> this knocked-hard-vy-lo)) + (format #t "~1Tknocked-hard-vy-hi: ~f~%" (-> this knocked-hard-vy-hi)) + (format #t "~1Tknocked-huge-vxz-lo: ~f~%" (-> this knocked-huge-vxz-lo)) + (format #t "~1Tknocked-huge-vxz-hi: ~f~%" (-> this knocked-huge-vxz-hi)) + (format #t "~1Tknocked-huge-vy-lo: ~f~%" (-> this knocked-huge-vy-lo)) + (format #t "~1Tknocked-huge-vy-hi: ~f~%" (-> this knocked-huge-vy-hi)) + (format #t "~1Tknocked-yellow-vxz-lo: ~f~%" (-> this knocked-yellow-vxz-lo)) + (format #t "~1Tknocked-yellow-vxz-hi: ~f~%" (-> this knocked-yellow-vxz-hi)) + (format #t "~1Tknocked-yellow-vy-lo: ~f~%" (-> this knocked-yellow-vy-lo)) + (format #t "~1Tknocked-yellow-vy-hi: ~f~%" (-> this knocked-yellow-vy-hi)) + (format #t "~1Tknocked-red-vxz-lo: ~f~%" (-> this knocked-red-vxz-lo)) + (format #t "~1Tknocked-red-vxz-hi: ~f~%" (-> this knocked-red-vxz-hi)) + (format #t "~1Tknocked-red-vy-lo: ~f~%" (-> this knocked-red-vy-lo)) + (format #t "~1Tknocked-red-vy-hi: ~f~%" (-> this knocked-red-vy-hi)) + (format #t "~1Tknocked-blue-vxz-lo: ~f~%" (-> this knocked-blue-vxz-lo)) + (format #t "~1Tknocked-blue-vxz-hi: ~f~%" (-> this knocked-blue-vxz-hi)) + (format #t "~1Tknocked-blue-vy-lo: ~f~%" (-> this knocked-blue-vy-lo)) + (format #t "~1Tknocked-blue-vy-hi: ~f~%" (-> this knocked-blue-vy-hi)) + (format #t "~1Tragdoll-info: #~%" (-> this ragdoll-info)) + (format #t "~1Tshadow-size: (meters ~m)~%" (-> this shadow-size)) + (format #t "~1Tshadow-max-y: (meters ~m)~%" (-> this shadow-max-y)) + (format #t "~1Tshadow-min-y: (meters ~m)~%" (-> this shadow-min-y)) + (format #t "~1Tshadow-locus-dist: (meters ~m)~%" (-> this shadow-locus-dist)) + (format #t "~1Tgem-joint: ~D~%" (-> this gem-joint)) + (format #t "~1Tgem-seg: ~D~%" (-> this gem-seg)) + (format #t "~1Tgem-no-seg: ~D~%" (-> this gem-no-seg)) + (format #t "~1Tgem-offset: #~%" (-> this gem-offset)) + (format #t "~1Tknocked-off: ~A~%" (-> this knocked-off)) + (label cfg-4) + this + ) + +;; definition of type enemy-knocked-info +(deftype enemy-knocked-info (structure) + ((anim-speed float) + (on-surface-count int32) + (move-count int32) + (land-can-land-time time-frame) + ) + ) + +;; definition for method 3 of type enemy-knocked-info +(defmethod inspect ((this enemy-knocked-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-knocked-info) + (format #t "~1Tanim-speed: ~f~%" (-> this anim-speed)) + (format #t "~1Ton-surface-count: ~D~%" (-> this on-surface-count)) + (format #t "~1Tmove-count: ~D~%" (-> this move-count)) + (format #t "~1Tland-can-land-time: ~D~%" (-> this land-can-land-time)) + (label cfg-4) + this + ) + +;; definition of type enemy-jump-info +(deftype enemy-jump-info (structure) + ((flags enemy-jump-flags) + (anim-speed float) + (hang-time time-frame) + (start-pos vector :inline) + (dest-pos vector :inline) + (traj trajectory :inline) + ) + ) + +;; definition for method 3 of type enemy-jump-info +(defmethod inspect ((this enemy-jump-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-jump-info) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (format #t "~1Tanim-speed: ~f~%" (-> this anim-speed)) + (format #t "~1Thang-time: ~D~%" (-> this hang-time)) + (format #t "~1Tstart-pos: #~%" (-> this start-pos)) + (format #t "~1Tdest-pos: #~%" (-> this dest-pos)) + (format #t "~1Ttraj: #~%" (-> this traj)) + (label cfg-4) + this + ) + +;; definition of type enemy-init-by-other-params +(deftype enemy-init-by-other-params (structure) + ((trans vector :inline) + (quat quaternion :inline) + (entity entity) + (directed? symbol) + (no-initial-move-to-ground? symbol) + (art-level level) + ) + ) + +;; definition for method 3 of type enemy-init-by-other-params +(defmethod inspect ((this enemy-init-by-other-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-init-by-other-params) + (format #t "~1Ttrans: #~%" (-> this trans)) + (format #t "~1Tquat: #~%" (-> this quat)) + (format #t "~1Tentity: ~A~%" (-> this entity)) + (format #t "~1Tdirected?: ~A~%" (-> this directed?)) + (format #t "~1Tno-initial-move-to-ground?: ~A~%" (-> this no-initial-move-to-ground?)) + (format #t "~1Tart-level: ~A~%" (-> this art-level)) + (label cfg-4) + this + ) + +;; definition of type enemy-attack-info +(deftype enemy-attack-info (structure) + ((attack-id uint32) + (knocked-type knocked-type) + (blue-juggle-count uint8) + (attacker-handle handle) + (attack-time time-frame) + (penetrate-using penetrate) + (attacker-pos vector :inline) + (attack-direction vector :inline) + (attack-position vector :inline) + (intensity float) + ) + ) + +;; definition for method 3 of type enemy-attack-info +(defmethod inspect ((this enemy-attack-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-attack-info) + (format #t "~1Tattack-id: ~D~%" (-> this attack-id)) + (format #t "~1Tknocked-type: ~D~%" (-> this knocked-type)) + (format #t "~1Tblue-juggle-count: ~D~%" (-> this blue-juggle-count)) + (format #t "~1Tattacker-handle: ~D~%" (-> this attacker-handle)) + (format #t "~1Tattack-time: ~D~%" (-> this attack-time)) + (format #t "~1Tpenetrate-using: ~D~%" (-> this penetrate-using)) + (format #t "~1Tattacker-pos: ~`vector`P~%" (-> this attacker-pos)) + (format #t "~1Tattack-direction: ~`vector`P~%" (-> this attack-direction)) + (format #t "~1Tattack-position: ~`vector`P~%" (-> this attack-position)) + (format #t "~1Tintensity: ~f~%" (-> this intensity)) + (label cfg-4) + this + ) + +;; definition of type enemy-best-focus +(deftype enemy-best-focus (structure) + ((proc process) + (rating float) + (aware enemy-aware) + ) + ) + +;; definition for method 3 of type enemy-best-focus +(defmethod inspect ((this enemy-best-focus)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'enemy-best-focus) + (format #t "~1Tproc: ~A~%" (-> this proc)) + (format #t "~1Trating: ~f~%" (-> this rating)) + (format #t "~1Taware: ~D~%" (-> this aware)) + (label cfg-4) + this + ) + +;; definition of type enemy +(deftype enemy (process-focusable) + ((fact fact-info-enemy :override) + (root collide-shape-moving :override) + (enemy-flags enemy-flag) + (enemy-info enemy-info) + (hit-points float) + (gnd-collide-with collide-spec) + (attack-id uint32) + (persistent-attack-id uint32) + (water-max-height float) + (water-surface-height float) + (desired-angle degrees) + (jump-why uint64) + (penetrated-by-all penetrate) + (penetrate-flinch penetrate) + (penetrate-knocked penetrate) + (ragdoll-proc handle) + (reaction-time time-frame) + (notice-time time-frame) + (state-timeout time-frame) + (auto-reset-penetrate-time time-frame) + (hit-focus-time time-frame) + (last-draw-time time-frame) + (starting-time time-frame) + (fated-time time-frame) + (focus-pos vector :inline) + (event-param-point vector :inline) + (jump-dest vector :inline :overlay-at event-param-point) + (focus enemy-focus :inline) + (incoming enemy-attack-info :inline) + (actor-group (pointer actor-group)) + (actor-group-count int32) + (neck joint-mod) + (on-notice pair) + (on-active pair) + (on-hostile pair) + (on-death pair) + (idle-anim-player idle-control :inline) + (rand-gen symbol) + ) + (:state-methods + dormant + dormant-aware + hit + knocked + knocked-recover + idle + active + notice + flee + stare + hostile + victory + die + die-falling + die-fast + directed + jump + jump-blocked + ambush-delay + ambush + view-anims + gun-dark-2-stretch + ) + (:methods + (enemy-method-50 (_type_ int) none) + (accelerate-fall! (_type_ vector) float) + (damage-enemy! (_type_ object event-message-block) float) + (reset-penetrate! (_type_) none) + (get-knockback-dir! (_type_ vector) vector) + (get-knockback-angle (_type_) degrees) + (knocked-handler (_type_ vector) object) + (can-collide-with-focus? (_type_ process-focusable) object) + (check-water (_type_) object) + (enemy-common-post (_type_) none) + (lerp-damage (_type_ float) float) + (scale-impact-vel-y! (_type_ vector vector float) vector) + (get-damage-from-attack (_type_ object event-message-block) float) + (enemy-method-63 (_type_ float) float) + (update-awareness! (_type_ process-focusable enemy-best-focus) enemy-aware) + (penetrate->next-state (_type_) symbol) + (get-penetrated-by (_type_) penetrate) + (coin-flip? (_type_) symbol) + (get-enemy-aware (_type_ enemy-aware) enemy-aware) + (enemy-method-69 (_type_) none) + (enemy-method-70 (_type_ process-focusable enemy-aware) none) + (go-dormant (_type_) object) + (go-dormant-aware (_type_) object) + (go-idle (_type_) object) + (go-ambush-delay (_type_) object) + (go-stare (_type_) object) + (go-stare2 (_type_) object) + (go-directed (_type_) object) + (go-hostile (_type_) object) + (go-flee (_type_) object) + (go-best-state (_type_) object) + (go-die (_type_) object) + (event-handler (_type_ process int symbol event-message-block) object :behavior enemy) + (enemy-touch-handler (_type_ process event-message-block) none) + (send-attack-on-jump-or-knocked (_type_ process event-message-block) none) + (knocked-anim (_type_ enemy-knocked-info) symbol) + (knocked-land-anim (_type_ enemy-knocked-info) symbol) + (knocked-anim-handler (_type_ int enemy-knocked-info) symbol) + (enemy-method-88 (_type_ enemy-knocked-info) symbol) + (within-gspot-range? (_type_) symbol) + (enemy-method-90 (_type_ ragdoll-proc) none) + (enemy-method-91 (_type_) symbol) + (init-jump-info! (_type_ enemy-jump-info) none) + (setup-jump! (_type_ enemy-jump-info) none) + (move-to-gspot! (_type_) float) + (on-ground? (_type_) symbol) + (jump-in-air-anim (_type_ enemy-jump-info) symbol) + (jump-land-anim (_type_ enemy-jump-info) symbol) + (jump-wind-up-anim (_type_ enemy-jump-info) symbol) + (jump-anim-handler (_type_ int enemy-jump-info) symbol) + (in-jump-handler (_type_ int enemy-jump-info) none) + (enemy-method-101 (_type_) none) + (go-directed2 (_type_) object) + (enemy-method-103 (_type_ vector float) symbol) + (enemy-method-104 (_type_ vector float) symbol) + (enemy-method-105 (_type_ float symbol) symbol) + (find-best-focus (_type_) process) + (enemy-method-107 (_type_) symbol) + (enemy-method-108 (_type_) symbol) + (enemy-method-109 (_type_) symbol) + (send-attack (_type_ process touching-shapes-entry uint) symbol) + (on-attack (_type_ process-focusable) none) + (get-incoming-attack! (_type_ process-drawable event-message-block penetrate attack-info touching-shapes-entry) none) + (get-focus! (_type_) process-focusable) + (send-attack-to-all-tshapes (_type_ process-focusable event-message-block) int) + (set-look-at-mode! (_type_ int) none) + (stop-look-at! (_type_) none) + (apply-friction (_type_) none) + (init-enemy-info! (_type_ enemy-info) none) + (init-enemy-defaults! (_type_ enemy-info) none) + (init-enemy-collision! (_type_) none) + (init-enemy! (_type_) none) + (go-idle2 (_type_) object) + (enemy-method-123 (_type_) symbol) + (disable-ragdoll (_type_) none) + (ragdoll-settled? (_type_) object) + (ragdoll-spawn! (_type_ symbol symbol) vector) + (deactivate-ragdoll! (_type_) none) + (rnd-float (_type_) float) + (rnd-float-range (_type_ float float) float) + (rnd-int (_type_ int) int) + (enemy-method-131 (_type_ int int) int) + (set-reaction-time! (_type_ time-frame time-frame) time-frame) + (rnd-chance? (_type_ float) symbol) + (enemy-method-134 (_type_ float) symbol) + (enemy-method-135 (_type_) none) + (set-ground-pat! (_type_ collide-query collide-spec float float float) pat-surface) + (enemy-above-ground? (_type_ collide-query vector collide-spec float float float) symbol) + (try-locate-ground (_type_ meters meters symbol collide-spec) symbol) + (move-above-ground! (_type_ vector move-above-ground-params) none) + (update-focus (_type_) process) + (enemy-method-141 (_type_ float) symbol) + (penetrate->knocked-type (_type_ penetrate) knocked-type) + (on-dying (_type_) none) + (falling? (_type_) symbol) + (find-offending-pfoc (_type_ process attack-info) process-focusable) + (play-damage-sound (_type_ int) sound-id) + (check-victory (_type_) none) + (go-gun-dark-2-stretch (_type_) object) + (have-less-than-10-joints? (_type_) object) + (enemy-method-150 (_type_) symbol) + (should-move-to-ground? (_type_) symbol) + (enemy-method-152 (_type_) float) + (get-gem-pool-idx (_type_) int) + (mark-as-dead (_type_) none) + ) + ) + +;; definition for method 3 of type enemy +(defmethod inspect ((this enemy)) + (when (not this) + (set! this this) + (goto cfg-81) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 this) + ) + (format #t "~2Tenemy-flags: #x~X : (enemy-flag " (-> this enemy-flags)) + (let ((s5-0 (-> this enemy-flags))) + (if (= (logand (enemy-flag auto-death-phase-out) s5-0) (shl 8 32)) + (format #t "auto-death-phase-out ") + ) + (if (= (logand (enemy-flag lock-focus) s5-0) (enemy-flag lock-focus)) + (format #t "lock-focus ") + ) + (if (= (logand (enemy-flag death-start) s5-0) (shl 4 32)) + (format #t "death-start ") + ) + (if (= (logand (enemy-flag checking-water) s5-0) (enemy-flag checking-water)) + (format #t "checking-water ") + ) + (if (= (logand s5-0 (enemy-flag enable-on-active)) (enemy-flag enable-on-active)) + (format #t "enable-on-active ") + ) + (if (= (logand (enemy-flag check-water) s5-0) (enemy-flag check-water)) + (format #t "check-water ") + ) + (if (= (logand (enemy-flag spawn-gem) s5-0) (enemy-flag spawn-gem)) + (format #t "spawn-gem ") + ) + (if (= (logand (enemy-flag chase-startup) s5-0) (enemy-flag chase-startup)) + (format #t "chase-startup ") + ) + (if (= (logand s5-0 (enemy-flag attackable-backup)) (enemy-flag attackable-backup)) + (format #t "attackable-backup ") + ) + (if (= (logand s5-0 (enemy-flag attackable)) (enemy-flag attackable)) + (format #t "attackable ") + ) + (if (= (logand s5-0 (enemy-flag look-at-focus)) (enemy-flag look-at-focus)) + (format #t "look-at-focus ") + ) + (if (= (logand s5-0 (enemy-flag use-notice-distance)) (enemy-flag use-notice-distance)) + (format #t "use-notice-distance ") + ) + (if (= (logand s5-0 (enemy-flag enable-on-notice)) (enemy-flag enable-on-notice)) + (format #t "enable-on-notice ") + ) + (if (= (logand s5-0 (enemy-flag look-at-move-dest)) (enemy-flag look-at-move-dest)) + (format #t "look-at-move-dest ") + ) + (if (= (logand s5-0 (enemy-flag notice)) (enemy-flag notice)) + (format #t "notice ") + ) + (if (= (logand s5-0 (enemy-flag auto-reset-penetrate)) (enemy-flag auto-reset-penetrate)) + (format #t "auto-reset-penetrate ") + ) + (if (= (logand (enemy-flag jump-check-blocked) s5-0) (shl 2 32)) + (format #t "jump-check-blocked ") + ) + (if (= (logand (enemy-flag drawn-mirrored) s5-0) (enemy-flag drawn-mirrored)) + (format #t "drawn-mirrored ") + ) + (if (= (logand (enemy-flag multi-focus) s5-0) (enemy-flag multi-focus)) + (format #t "multi-focus ") + ) + (if (= (logand s5-0 (enemy-flag alert)) (enemy-flag alert)) + (format #t "alert ") + ) + (if (= (logand s5-0 (enemy-flag victory)) (enemy-flag victory)) + (format #t "victory ") + ) + (if (= (logand s5-0 (enemy-flag dangerous-backup)) (enemy-flag dangerous-backup)) + (format #t "dangerous-backup ") + ) + (if (= (logand s5-0 (enemy-flag actor-pause-backup)) (enemy-flag actor-pause-backup)) + (format #t "actor-pause-backup ") + ) + (if (= (logand (enemy-flag trackable) s5-0) (enemy-flag trackable)) + (format #t "trackable ") + ) + (if (= (logand (enemy-flag called-dying) s5-0) (shl #x8000 16)) + (format #t "called-dying ") + ) + (if (= (logand (enemy-flag check-water-backup) s5-0) (enemy-flag check-water-backup)) + (format #t "check-water-backup ") + ) + (if (= (logand (enemy-flag no-initial-move-to-ground) s5-0) (shl 1 32)) + (format #t "no-initial-move-to-ground ") + ) + (if (= (logand s5-0 (enemy-flag cam-attack-mode)) (enemy-flag cam-attack-mode)) + (format #t "cam-attack-mode ") + ) + (if (= (logand (enemy-flag has-gem) s5-0) (shl 16 32)) + (format #t "has-gem ") + ) + (if (= (logand (enemy-flag trackable-backup) s5-0) (enemy-flag trackable-backup)) + (format #t "trackable-backup ") + ) + (if (= (logand (enemy-flag enable-on-hostile) s5-0) (enemy-flag enable-on-hostile)) + (format #t "enable-on-hostile ") + ) + (if (= (logand (enemy-flag directed-ready) s5-0) (enemy-flag directed-ready)) + (format #t "directed-ready ") + ) + (if (= (logand (enemy-flag use-trigger) s5-0) (enemy-flag use-trigger)) + (format #t "use-trigger ") + ) + (if (= (logand (enemy-flag directed) s5-0) (enemy-flag directed)) + (format #t "directed ") + ) + (if (= (logand (enemy-flag dislike-combo) s5-0) (enemy-flag dislike-combo)) + (format #t "dislike-combo ") + ) + (if (= (logand s5-0 (enemy-flag vulnerable-backup)) (enemy-flag vulnerable-backup)) + (format #t "vulnerable-backup ") + ) + (if (= (logand s5-0 (enemy-flag vulnerable)) (enemy-flag vulnerable)) + (format #t "vulnerable ") + ) + ) + (format #t ")~%") + (format #t "~2Tenemy-info: ~A~%" (-> this enemy-info)) + (format #t "~2Thit-points: ~f~%" (-> this hit-points)) + (format #t "~2Tgnd-collide-with: ~D~%" (-> this gnd-collide-with)) + (format #t "~2Tattack-id: ~D~%" (-> this attack-id)) + (format #t "~2Tpersistent-attack-id: ~D~%" (-> this persistent-attack-id)) + (format #t "~2Twater-max-height: ~f~%" (-> this water-max-height)) + (format #t "~2Twater-surface-height: ~f~%" (-> this water-surface-height)) + (format #t "~2Tdesired-angle: ~f~%" (-> this desired-angle)) + (format #t "~2Tjump-why: ~D~%" (-> this jump-why)) + (format #t "~2Tpenetrated-by-all: ~D~%" (-> this penetrated-by-all)) + (format #t "~2Tpenetrate-flinch: ~D~%" (-> this penetrate-flinch)) + (format #t "~2Tpenetrate-knocked: ~D~%" (-> this penetrate-knocked)) + (format #t "~2Tragdoll-proc: ~D~%" (-> this ragdoll-proc)) + (format #t "~2Treaction-time: ~D~%" (-> this reaction-time)) + (format #t "~2Tnotice-time: ~D~%" (-> this notice-time)) + (format #t "~2Tstate-timeout: ~D~%" (-> this state-timeout)) + (format #t "~2Tauto-reset-penetrate-time: ~D~%" (-> this auto-reset-penetrate-time)) + (format #t "~2Thit-focus-time: ~D~%" (-> this hit-focus-time)) + (format #t "~2Tlast-draw-time: ~D~%" (-> this last-draw-time)) + (format #t "~2Tstarting-time: ~D~%" (-> this starting-time)) + (format #t "~2Tfated-time: ~D~%" (-> this fated-time)) + (format #t "~2Tfocus-pos: ~`vector`P~%" (-> this focus-pos)) + (format #t "~2Tevent-param-point: ~`vector`P~%" (-> this event-param-point)) + (format #t "~2Tjump-dest: ~`vector`P~%" (-> this event-param-point)) + (format #t "~2Tfocus: #~%" (-> this focus)) + (format #t "~2Tincoming: #~%" (-> this incoming)) + (format #t "~2Tactor-group: #x~X~%" (-> this actor-group)) + (dotimes (s5-1 (-> this actor-group-count)) + (format #t "~T [~D]~2Tactor-group: ~`actor-group`P~%" s5-1 (-> this actor-group s5-1)) + ) + (format #t "~2Tactor-group-count: ~D~%" (-> this actor-group-count)) + (format #t "~2Tneck: ~A~%" (-> this neck)) + (format #t "~2Ton-notice: ~A~%" (-> this on-notice)) + (format #t "~2Ton-active: ~A~%" (-> this on-active)) + (format #t "~2Ton-hostile: ~A~%" (-> this on-hostile)) + (format #t "~2Ton-death: ~A~%" (-> this on-death)) + (format #t "~2Tidle-anim-player: #~%" (-> this idle-anim-player)) + (format #t "~2Trand-gen: ~A~%" (-> this rand-gen)) + (label cfg-81) + this + ) + +;; definition of type anim-info +(deftype anim-info (structure) + ((anim-index int32) + (travel-speed meters) + ) + ) + +;; definition for method 3 of type anim-info +(defmethod inspect ((this anim-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'anim-info) + (format #t "~1Tanim-index: ~D~%" (-> this anim-index)) + (format #t "~1Ttravel-speed: (meters ~m)~%" (-> this travel-speed)) + (label cfg-4) + this + ) + +;; definition for method 12 of type enemy-focus +(defmethod try-update-focus ((this enemy-focus) (arg0 process-focusable) (arg1 enemy)) + (let* ((t9-0 (method-of-type focus try-update-focus)) + (s3-0 (t9-0 this arg0)) + ) + (when (not s3-0) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + (set! (-> this aware) (get-enemy-aware arg1 (update-awareness! arg1 arg0 (the-as enemy-best-focus #f)))) + ) + s3-0 + ) + ) + +;; definition for method 13 of type enemy-focus +(defmethod enemy-focus-method-13 ((this enemy-focus) (arg0 process-focusable) (arg1 enemy-aware)) + (let* ((t9-0 (method-of-type focus try-update-focus)) + (v0-0 (t9-0 this arg0)) + ) + (set! (-> this aware) arg1) + (if (not v0-0) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + ) + v0-0 + ) + ) + +;; definition for method 9 of type enemy-focus +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod clear-focused ((this enemy-focus)) + "Reset the focus' handle." + (let ((t9-0 (method-of-type focus clear-focused))) + (t9-0 this) + ) + (set! (-> this aware) (enemy-aware ea0)) + (logclear! (-> this flags) (enemy-flag look-at-focus)) + (none) + ) diff --git a/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc b/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc new file mode 100644 index 00000000000..e8c72feadd3 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/ai/enemy_REF.gc @@ -0,0 +1,3155 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type enemy-info +;; WARN: Return type mismatch int vs none. +(defmethod copy-enemy-info! ((this enemy-info) (arg0 enemy-info)) + (mem-copy! (&-> this type) (&-> arg0 type) 420) + 0 + (none) + ) + +;; definition for symbol *enemy-dummy-shadow-control*, type shadow-control +(define *enemy-dummy-shadow-control* + (new 'static 'shadow-control :settings (new 'static 'shadow-settings + :center (new 'static 'vector :w (the-as float #x28)) + :shadow-dir (new 'static 'vector :y -1.0 :w 614400.0) + :bot-plane (new 'static 'plane :y 1.0 :w 4096.0) + :top-plane (new 'static 'plane :y 1.0 :w -4096.0) + ) + ) + ) + +;; definition for method 7 of type enemy +(defmethod relocate ((this enemy) (offset int)) + (if (nonzero? (-> this neck)) + (&+! (-> this neck) offset) + ) + (call-parent-method this offset) + ) + +;; definition for method 128 of type enemy +(defmethod rnd-float ((this enemy)) + (rand-vu) + ) + +;; definition for method 129 of type enemy +(defmethod rnd-float-range ((this enemy) (arg0 float) (arg1 float)) + (+ arg0 (* (rand-vu) (- arg1 arg0))) + ) + +;; definition for method 130 of type enemy +(defmethod rnd-int ((this enemy) (arg0 int)) + (the int (* (rand-vu) (the float arg0))) + ) + +;; definition for method 132 of type enemy +(defmethod set-reaction-time! ((this enemy) (arg0 time-frame) (arg1 time-frame)) + (+ arg0 (the int (* (rand-vu) (the float (+ (- 1 arg0) arg1))))) + ) + +;; definition for method 133 of type enemy +(defmethod rnd-chance? ((this enemy) (arg0 float)) + (>= arg0 (rand-vu)) + ) + +;; definition for method 131 of type enemy +;; WARN: new jak 2 until loop case, check carefully +(defmethod enemy-method-131 ((this enemy) (arg0 int) (arg1 int)) + (let ((v1-0 0) + (s5-0 0) + ) + (let ((a2-1 1)) + (while (nonzero? arg0) + (+! arg0 -1) + (if (not (logtest? arg1 a2-1)) + (+! v1-0 1) + ) + (set! a2-1 (* a2-1 2)) + ) + ) + (when (> v1-0 0) + (let ((v1-1 (rnd-int this v1-0)) + (a0-1 1) + ) + (until #f + (while (logtest? arg1 a0-1) + (nop!) + (nop!) + (+! s5-0 1) + (set! a0-1 (* a0-1 2)) + ) + (if (zero? v1-1) + (goto cfg-14) + ) + (+! v1-1 -1) + (+! s5-0 1) + (set! a0-1 (* a0-1 2)) + ) + ) + #f + ) + (label cfg-14) + s5-0 + ) + ) + +;; definition for method 134 of type enemy +(defmethod enemy-method-134 ((this enemy) (arg0 float)) + (let* ((v1-5 (-> *display* frames (-> *display* last-screen) run-time)) + (f1-2 (fmax 0.0 (fmin 1.0 (* 0.001 (+ -7000.0 (the float v1-5)))))) + ) + (>= (+ arg0 (* f1-2 (- 1.0 arg0))) (rand-vu)) + ) + ) + +;; definition for method 67 of type enemy +(defmethod coin-flip? ((this enemy)) + (zero? (rnd-int this 2)) + ) + +;; definition for method 12 of type enemy +;; WARN: disable def twice: 40. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defmethod run-logic? ((this enemy)) + "Should this process be run? Checked by execute-process-tree." + (cond + ((logtest? (-> this mask) (process-mask actor-pause)) + (let ((gp-0 (-> this draw))) + (or (and (nonzero? gp-0) + (>= (+ (-> *ACTOR-bank* pause-dist) (-> this root pause-adjust-distance)) + (vector-vector-distance (-> this root trans) (camera-pos)) + ) + (or (logtest? (-> gp-0 status) (draw-control-status on-screen)) + (not (and (-> this next-state) (= (-> this next-state name) 'idle))) + ) + ) + (and (nonzero? (-> this skel)) (!= (-> this skel root-channel 0) (-> this skel channel))) + (and (nonzero? gp-0) (logtest? (-> gp-0 status) (draw-control-status uninited))) + ) + ) + ) + (else + #t + ) + ) + ) + +;; definition for method 57 of type enemy +(defmethod can-collide-with-focus? ((this enemy) (arg0 process-focusable)) + (and arg0 (!= this arg0) (collide-spec-match? (-> this focus) arg0)) + ) + +;; definition for method 20 of type enemy +;; WARN: Return type mismatch int vs search-info-flag. +(defmethod process-mask->search-info-flag ((this enemy)) + (let ((v1-0 (-> this enemy-flags)) + (v0-0 0) + ) + (when (and (!= (-> this hit-points) 0.0) + (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (logtest? (enemy-flag trackable) (-> this enemy-flags)) + ) + (if (logtest? (process-mask enemy) (-> this mask)) + (set! v0-0 (logior v0-0 16)) + ) + (if (logtest? v1-0 (enemy-flag attackable)) + (set! v0-0 (logior v0-0 8)) + ) + ) + (the-as search-info-flag v0-0) + ) + ) + +;; definition for method 21 of type enemy +(defmethod get-trans ((this enemy) (arg0 int)) + "Get the `trans` for this process." + (let ((s4-0 (-> this root))) + (cond + ((zero? arg0) + (-> s4-0 trans) + ) + ((and (= arg0 1) (type? s4-0 collide-shape-moving)) + (-> s4-0 gspot-pos) + ) + ((= arg0 2) + (vector<-cspace! (new 'static 'vector) (-> this node-list data (-> this enemy-info look-at-joint))) + ) + ((= arg0 3) + (let ((v0-0 (vector<-cspace! (new 'static 'vector) (-> this node-list data (-> this enemy-info bullseye-joint))))) + (set! (-> v0-0 w) (-> this root root-prim prim-core world-sphere w)) + v0-0 + ) + ) + (else + ((method-of-type process-focusable get-trans) this arg0) + ) + ) + ) + ) + +;; definition for method 66 of type enemy +(defmethod get-penetrated-by ((this enemy)) + (penetrated-by-all&hit-points->penetrated-by (-> this penetrated-by-all) (the int (-> this hit-points))) + ) + +;; definition for method 25 of type enemy +;; WARN: Return type mismatch float vs meters. +(defmethod get-water-height ((this enemy)) + (the-as meters (-> this water-surface-height)) + ) + +;; definition for method 58 of type enemy +;; INFO: Used lq/sq +;; WARN: Return type mismatch enemy-flag vs object. +(defmethod check-water ((this enemy)) + (let ((s4-0 (-> this root))) + (when (>= (-> this water-max-height) (-> s4-0 trans y)) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! s4-0 s5-0 (collide-action solid semi-solid)) + (let ((s3-0 (-> s5-0 flags))) + (when (logtest? (water-flag touch-water) s3-0) + (set! (-> this water-surface-height) (-> s5-0 trans y)) + (when (not (focus-test? this touch-water under-water)) + (let ((v1-9 (new 'stack-no-clear 'vector))) + (set! (-> v1-9 quad) (-> this root trans quad)) + (set! (-> v1-9 y) (+ 409.6 (-> s5-0 trans y))) + (cond + ((logtest? (-> *part-group-id-table* 192 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-9 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 192)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-9 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 192)) + ) + ) + ) + (cond + ((logtest? s3-0 (water-flag dark-eco)) + (sound-play "eco-splash") + (send-event this 'instant-death) + ) + (else + (play-damage-sound this 2) + ) + ) + ) + (logior! (-> this focus-status) (focus-status touch-water)) + (let* ((v1-46 (-> s4-0 root-prim prim-core)) + (f0-6 (+ (-> v1-46 world-sphere y) (-> v1-46 world-sphere w))) + ) + (if (focus-test? this under-water) + (set! f0-6 (+ -819.2 f0-6)) + ) + (if (< f0-6 (-> s5-0 trans y)) + (logior! (-> this focus-status) (focus-status under-water)) + (logclear! (-> this focus-status) (focus-status under-water)) + ) + ) + (return (the-as object #f)) + ) + ) + ) + ) + ) + (logclear! (-> this focus-status) (focus-status touch-water under-water)) + (let ((v0-11 (logclear (-> this enemy-flags) (enemy-flag checking-water)))) + (set! (-> this enemy-flags) v0-11) + v0-11 + ) + ) + +;; definition for method 59 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod enemy-common-post ((this enemy)) + (if (and (nonzero? (-> this draw)) (logtest? (-> this draw status) (draw-control-status on-screen))) + (set-time! (-> this last-draw-time)) + ) + (update-focus this) + (when *target* + (if *target* + (look-at! + (-> *target* neck) + (the-as vector (-> this root root-prim prim-core)) + (if (logtest? (-> this enemy-flags) (enemy-flag cam-attack-mode)) + 'attacking + ) + this + ) + ) + ) + (when (nonzero? (-> this neck)) + (when (logtest? (-> this enemy-flags) (enemy-flag look-at-focus)) + (let ((a0-7 (handle->process (-> this focus handle)))) + (if a0-7 + (target-set! (-> this neck) (get-trans (the-as process-focusable a0-7) 2)) + ) + ) + ) + ) + (when (and (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (time-elapsed? (-> this auto-reset-penetrate-time) (seconds 0.1)) + ) + (logclear! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (let ((v1-43 0)) + (if (logtest? (penetrate knocked) (-> this root penetrate-using)) + (set! v1-43 (logior (shl 2 32) v1-43)) + ) + (set! (-> this root penetrate-using) (the-as penetrate v1-43)) + ) + ) + (if (logtest? (-> this enemy-flags) (enemy-flag victory)) + (check-victory this) + ) + (if (logtest? (enemy-flag check-water checking-water) (-> this enemy-flags)) + (check-water this) + ) + (if (and *debug-segment* (-> this enemy-info debug-draw-neck) (nonzero? (-> this neck))) + (joint-mod-debug-draw (-> this neck)) + ) + (ja-post) + 0 + (none) + ) + +;; definition for method 147 of type enemy +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod check-victory ((this enemy)) + (if (or (time-elapsed? (-> this hit-focus-time) (seconds 2)) + (and (handle->process (-> this focus handle)) + (not (logtest? (-> (the-as process-focusable (handle->process (-> this focus handle))) focus-status) + (focus-status disable dead ignore grabbed) + ) + ) + ) + ) + (logclear! (-> this enemy-flags) (enemy-flag victory)) + ) + (none) + ) + +;; definition for function get-penetrate-using-from-attack-event +;; WARN: Return type mismatch int vs penetrate. +(defun get-penetrate-using-from-attack-event ((arg0 process-drawable) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (if (logtest? (attack-mask penetrate-using) (-> (the-as attack-info v1-0) mask)) + (return (the-as penetrate (-> (the-as attack-info v1-0) penetrate-using))) + ) + ) + (let* ((gp-0 arg0) + (v1-3 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when v1-3 + (let* ((gp-1 (-> v1-3 root)) + (v1-4 (if (type? gp-1 collide-shape) + gp-1 + ) + ) + ) + (if v1-4 + (return + (the-as penetrate (logior (-> (the-as collide-shape v1-4) penetrate-using) (penetrate generic-attack))) + ) + ) + ) + ) + ) + (the-as penetrate 2) + ) + +;; definition for method 113 of type enemy +;; WARN: Return type mismatch process vs process-focusable. +(defmethod get-focus! ((this enemy)) + (let ((v0-0 (handle->process (-> this focus handle)))) + (if (and v0-0 + (not (and v0-0 + (not (logtest? (-> (the-as process-focusable v0-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + ) + ) + (set! v0-0 (the-as process #f)) + ) + (the-as process-focusable v0-0) + ) + ) + +;; definition for method 70 of type enemy +;; WARN: Return type mismatch symbol vs none. +(defmethod enemy-method-70 ((this enemy) (arg0 process-focusable) (arg1 enemy-aware)) + (if arg1 + (enemy-focus-method-13 (-> this focus) arg0 arg1) + (try-update-focus (-> this focus) arg0 this) + ) + (none) + ) + +;; definition for method 69 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-69 ((this enemy)) + (when (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (let* ((s4-0 (handle->process (-> this incoming attacker-handle))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (can-collide-with-focus? this (the-as process-focusable s5-0)) + (enemy-method-70 this (the-as process-focusable s5-0) (the-as enemy-aware #f)) + (logior! (-> this focus flags) (enemy-flag look-at-focus)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 114 of type enemy +(defmethod send-attack-to-all-tshapes ((this enemy) (arg0 process-focusable) (arg1 event-message-block)) + (let ((s4-0 (the-as touching-shapes-entry (-> arg1 param 0)))) + (when (and s4-0 + (and (logtest? (-> this incoming penetrate-using) (penetrate board)) + (not (logtest? (-> this incoming penetrate-using) (penetrate spin))) + ) + (begin + (let ((s3-0 (-> s4-0 head))) + (while s3-0 + (let ((s2-0 (get-touched-prim s3-0 (-> arg0 root) s4-0))) + (get-touched-prim s3-0 (-> this root) s4-0) + (when (logtest? (-> s2-0 prim-core action) (collide-action solid semi-solid deadly)) + (let* ((a0-5 this) + (t9-2 (method-of-object a0-5 send-attack)) + (a1-3 arg0) + (a2-3 s4-0) + (v1-13 *game-info*) + (a3-1 (+ (-> v1-13 attack-id) 1)) + ) + (set! (-> v1-13 attack-id) a3-1) + (if (t9-2 a0-5 a1-3 a2-3 a3-1) + (return 0) + ) + ) + ) + ) + (set! s3-0 (-> s3-0 next)) + ) + ) + #f + ) + ) + ) + ) + 0 + ) + +;; definition for method 71 of type enemy +(defmethod go-dormant ((this enemy)) + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> this draw status) (draw-control-status no-draw)) + (logior! (-> this focus-status) (focus-status disable)) + (go (method-of-object this dormant)) + ) + +;; definition for method 72 of type enemy +(defmethod go-dormant-aware ((this enemy)) + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> this draw status) (draw-control-status no-draw)) + (logior! (-> this focus-status) (focus-status disable)) + (go (method-of-object this dormant-aware)) + ) + +;; definition for method 73 of type enemy +(defmethod go-idle ((this enemy)) + (go (method-of-object this idle)) + ) + +;; definition for method 75 of type enemy +(defmethod go-stare ((this enemy)) + (go (method-of-object this stare)) + ) + +;; definition for method 76 of type enemy +(defmethod go-stare2 ((this enemy)) + (go (method-of-object this stare)) + ) + +;; definition for method 78 of type enemy +(defmethod go-hostile ((this enemy)) + (go (method-of-object this hostile)) + ) + +;; definition for method 149 of type enemy +(defmethod have-less-than-10-joints? ((this enemy)) + (and (nonzero? (-> this node-list)) (-> this node-list) (< 10 (-> this node-list length))) + ) + +;; definition for method 150 of type enemy +(defmethod enemy-method-150 ((this enemy)) + #t + ) + +;; definition for method 148 of type enemy +(defmethod go-gun-dark-2-stretch ((this enemy)) + (if (not (and (-> this next-state) (= (-> this next-state name) 'gun-dark-2-stretch))) + (go (method-of-object this gun-dark-2-stretch)) + ) + ) + +;; definition for method 74 of type enemy +(defmethod go-ambush-delay ((this enemy)) + (if (< 0.0 (res-lump-float (-> this entity) 'ambush-delay)) + (go (method-of-object this ambush-delay)) + (go (method-of-object this ambush)) + ) + ) + +;; definition for method 79 of type enemy +(defmethod go-flee ((this enemy)) + (go (method-of-object this flee)) + ) + +;; definition for method 77 of type enemy +(defmethod go-directed ((this enemy)) + (go (method-of-object this directed)) + ) + +;; definition for method 80 of type enemy +(defmethod go-best-state ((this enemy)) + (let ((s5-0 (-> this focus aware))) + (cond + ((and (= s5-0 (enemy-aware ea3)) (get-focus! this)) + (go-hostile this) + ) + ((<= (the-as int s5-0) 0) + (go-idle this) + ) + ((>= 1 (the-as int s5-0)) + (go (method-of-object this active)) + ) + ((= s5-0 (enemy-aware ea4)) + (go-flee this) + ) + (else + (go-stare this) + ) + ) + ) + ) + +;; definition for method 102 of type enemy +(defmethod go-directed2 ((this enemy)) + (if (logtest? (enemy-flag directed) (-> this enemy-flags)) + (go-directed this) + (go-best-state this) + ) + ) + +;; definition for method 81 of type enemy +(defmethod go-die ((this enemy)) + (if (-> this enemy-info use-die-falling) + (go (method-of-object this die-falling)) + (go (method-of-object this die)) + ) + ) + +;; definition for method 146 of type enemy +;; INFO: Used lq/sq +(defmethod play-damage-sound ((this enemy) (arg0 int)) + (let ((name (static-sound-name ""))) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (set! name (-> this enemy-info sound-hit)) + ) + ((= v1-0 1) + (set! name (-> this enemy-info sound-die)) + ) + ((= v1-0 2) + (sound-play "splash") + ) + ) + ) + (if (nonzero? (the-as uint name)) + (sound-play-by-name (the-as sound-name name) (new-sound-id) 1024 0 0 (sound-group) #t) + ) + ) + ) + +;; definition for method 103 of type enemy +;; INFO: Used lq/sq +(defmethod enemy-method-103 ((this enemy) (arg0 vector) (arg1 float)) + (let ((s4-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s5-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-0 quad) (-> arg0 quad)) + (set! (-> s4-0 y) 0.0) + (vector-normalize! s4-0 1.0) + (set! (-> s5-0 y) 0.0) + (vector-normalize! s5-0 1.0) + (>= (vector-dot s4-0 s5-0) (cos arg1)) + ) + ) + +;; definition for method 104 of type enemy +(defmethod enemy-method-104 ((this enemy) (arg0 vector) (arg1 float)) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this root trans)))) + (enemy-method-103 this v1-1 arg1) + ) + ) + +;; definition for method 105 of type enemy +(defmethod enemy-method-105 ((this enemy) (arg0 float) (arg1 symbol)) + (let ((a0-2 (handle->process (-> this focus handle)))) + (cond + (a0-2 + (let ((s4-1 + (vector-! (new 'stack-no-clear 'vector) (get-trans (the-as process-focusable a0-2) 0) (-> this root trans)) + ) + ) + (enemy-method-103 this s4-1 arg0) + ) + ) + (else + arg1 + ) + ) + ) + ) + +;; definition for method 110 of type enemy +(defmethod send-attack ((this enemy) (arg0 process) (arg1 touching-shapes-entry) (arg2 uint)) + (let ((a0-1 (-> this enemy-info attack-damage))) + (if (and (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) (= a0-1 1)) + (set! a0-1 2) + ) + (when (send-event + arg0 + 'attack + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id arg2) + (damage (the float a0-1)) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (-> this enemy-info attack-shove-back)) + (shove-up (-> this enemy-info attack-shove-up)) + (mode (-> this enemy-info attack-mode)) + (knock (if (-> this enemy-info knocked-off) + (knocked-type knocked-off) + (knocked-type none) + ) + ) + ) + ) + ) + (on-attack this (the-as process-focusable arg0)) + #t + ) + ) + ) + +;; definition for method 111 of type enemy +;; WARN: Return type mismatch enemy-flag vs none. +(defmethod on-attack ((this enemy) (arg0 process-focusable)) + (when (logtest? (process-mask target bot) (-> arg0 mask)) + (set! (-> this root penetrated-by) (the-as penetrate -1)) + (reset-penetrate! this) + ) + (let ((s5-0 (if (type? arg0 process-focusable) + arg0 + ) + ) + ) + (when (can-collide-with-focus? this s5-0) + (let ((v1-10 (handle->process (-> this focus handle)))) + (when (or (= s5-0 v1-10) (and (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (or (not v1-10) (not (logtest? (-> this focus flags) (enemy-flag look-at-focus)))) + ) + ) + (enemy-method-70 this s5-0 (the-as enemy-aware #f)) + (set-time! (-> this hit-focus-time)) + (logior! (-> this enemy-flags) (enemy-flag victory)) + ) + ) + ) + ) + (none) + ) + +;; definition for method 53 of type enemy +;; WARN: Return type mismatch time-frame vs none. +(defmethod reset-penetrate! ((this enemy)) + (logior! (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (set-time! (-> this auto-reset-penetrate-time)) + (none) + ) + +;; definition for method 54 of type enemy +;; INFO: Used lq/sq +(defmethod get-knockback-dir! ((this enemy) (arg0 vector)) + (set! (-> arg0 quad) (-> this incoming attack-direction quad)) + (let ((v1-1 arg0)) + (when (= (+ (* (-> v1-1 x) (-> v1-1 x)) (* (-> v1-1 z) (-> v1-1 z))) 0.0) + (vector-z-quaternion! arg0 (-> this root quat)) + (vector-negate-in-place! arg0) + ) + ) + (set! (-> arg0 y) 0.0) + (vector-xz-normalize! arg0 1.0) + ) + +;; definition for method 142 of type enemy +;; WARN: Return type mismatch int vs knocked-type. +(defmethod penetrate->knocked-type ((this enemy) (arg0 penetrate)) + (the-as knocked-type (cond + ((logtest? arg0 (penetrate vehicle)) + 7 + ) + ((logtest? (penetrate jak-blue-shot) arg0) + 6 + ) + ((logtest? (penetrate jak-yellow-shot enemy-yellow-shot) arg0) + 4 + ) + ((logtest? (penetrate jak-red-shot) arg0) + 5 + ) + ((logtest? (penetrate dark-bomb dark-smack) arg0) + 3 + ) + ((logtest? (penetrate explode jak-dark-shot enemy-dark-shot) arg0) + 2 + ) + ((logtest? arg0 (penetrate mech-punch)) + 1 + ) + (else + 0 + ) + ) + ) + ) + +;; definition for method 112 of type enemy +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod get-incoming-attack! ((this enemy) + (arg0 process-drawable) + (arg1 event-message-block) + (arg2 penetrate) + (arg3 attack-info) + (arg4 touching-shapes-entry) + ) + (set! (-> this incoming penetrate-using) arg2) + (set! (-> this incoming attack-id) (-> arg3 id)) + (let ((v1-3 (if (logtest? (attack-mask knock) (-> arg3 mask)) + (-> arg3 knock) + (penetrate->knocked-type this arg2) + ) + ) + ) + (set! (-> this incoming knocked-type) v1-3) + (let ((a0-4 (current-time))) + (cond + ((!= v1-3 (knocked-type blue-shot)) + (set! (-> this incoming blue-juggle-count) (the-as uint 0)) + 0 + ) + ((time-elapsed? (-> this incoming attack-time) (seconds 1)) + (set! (-> this incoming blue-juggle-count) (the-as uint 1)) + ) + (else + (+! (-> this incoming blue-juggle-count) 1) + ) + ) + (set! (-> this incoming attack-time) a0-4) + ) + (cond + ((= v1-3 (knocked-type vehicle)) + (set! (-> this incoming attack-direction quad) (-> arg3 vector quad)) + ) + (else + (let ((s2-0 (new 'stack-no-clear 'attack-info))) + (attack-info-method-9 arg3 s2-0 arg0 this) + (set! (-> this incoming attacker-pos quad) (-> s2-0 intersection quad)) + (set! (-> this incoming attack-direction quad) (-> s2-0 attacker-velocity quad)) + ) + ) + ) + ) + (set! (-> this incoming intensity) (-> arg3 control)) + (set! (-> this incoming attacker-handle) (process->handle (find-offending-pfoc this arg0 arg3))) + (cond + (arg4 + (let ((a1-12 (-> arg4 head))) + (get-intersect-point (-> this incoming attack-position) a1-12 (-> this root) arg4) + ) + ) + (else + (vector-! (-> this incoming attack-position) (-> this root trans) (-> this incoming attack-direction)) + ) + ) + 0 + (none) + ) + +;; definition for method 115 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod set-look-at-mode! ((this enemy) (arg0 int)) + (case arg0 + ((1) + (logclear! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + (logior! (-> this enemy-flags) (enemy-flag look-at-focus)) + ) + ((2) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus)) + (logior! (-> this enemy-flags) (enemy-flag look-at-move-dest)) + ) + ) + (if (nonzero? (-> this neck)) + (mode-set! (-> this neck) (joint-mod-mode look-at)) + ) + 0 + (none) + ) + +;; definition for method 116 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod stop-look-at! ((this enemy)) + (when (nonzero? (-> this neck)) + (logclear! (-> this enemy-flags) (enemy-flag look-at-focus look-at-move-dest)) + (shut-down (-> this neck)) + ) + 0 + (none) + ) + +;; definition for method 136 of type enemy +(defmethod set-ground-pat! ((this enemy) (arg0 collide-query) (arg1 collide-spec) (arg2 float) (arg3 float) (arg4 float)) + (when (find-ground (-> this root) arg0 arg1 arg2 arg3 arg4) + (let ((v0-1 (-> arg0 best-other-tri pat))) + (set! (-> this root ground-pat) v0-1) + v0-1 + ) + ) + ) + +;; definition for method 137 of type enemy +(defmethod enemy-above-ground? ((this enemy) (arg0 collide-query) (arg1 vector) (arg2 collide-spec) (arg3 float) (arg4 float) (arg5 float)) + (above-ground? (-> this root) arg0 arg1 arg2 arg3 arg4 arg5) + ) + +;; definition for method 138 of type enemy +;; INFO: Used lq/sq +(defmethod try-locate-ground ((this enemy) (arg0 meters) (arg1 meters) (arg2 symbol) (arg3 collide-spec)) + (let* ((s4-0 (new 'stack-no-clear 'collide-query)) + (a0-1 this) + (t9-0 (method-of-object a0-1 set-ground-pat!)) + (v1-1 s4-0) + (t3-0 arg3) + (a3-1 arg0) + (t0-1 arg1) + (t1-0 1024.0) + ) + (cond + ((t9-0 a0-1 v1-1 t3-0 a3-1 t0-1 t1-0) + (let ((s5-1 (-> this root))) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (set! (-> s3-0 quad) (-> this root trans quad)) + (set! (-> s3-0 y) (-> s4-0 best-other-tri intersect y)) + (move-to-point! s5-1 s3-0) + (let ((a0-3 (-> s4-0 best-other-tri normal)) + (v1-8 (-> s4-0 best-other-tri pat)) + ) + (set! (-> s5-1 ground-touch-point quad) (-> s3-0 quad)) + (set! (-> s5-1 poly-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 surface-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 local-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 ground-poly-normal quad) (-> a0-3 quad)) + (set! (-> s5-1 poly-pat) v1-8) + (set! (-> s5-1 cur-pat) v1-8) + (set! (-> s5-1 ground-pat) v1-8) + ) + ) + (logior! (-> s5-1 status) (collide-status on-surface on-ground touch-surface)) + ) + #t + ) + (else + (let ((v1-11 (-> this root))) + (logclear! (-> v1-11 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> v1-11 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((a0-12 (-> v1-11 dynam gravity-normal))) + (set! (-> v1-11 local-normal quad) (-> a0-12 quad)) + (set! (-> v1-11 surface-normal quad) (-> a0-12 quad)) + (set! (-> v1-11 poly-normal quad) (-> a0-12 quad)) + ) + (set! (-> v1-11 coverage) 0.0) + (set! (-> v1-11 touch-angle) 0.0) + ) + ) + (if arg2 + (format 0 "WARNING: enemy::move-to-ground: failed to locate ground for ~S!~%" (-> this name)) + ) + #f + ) + ) + ) + ) + +;; definition for method 139 of type enemy +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-above-ground! ((this enemy) (arg0 vector) (arg1 move-above-ground-params)) + (let ((gp-0 (-> this root))) + (set! (-> arg1 on-ground?) #f) + (set! (-> arg1 do-move?) #t) + (set! (-> arg1 old-gspot-pos quad) (-> gp-0 gspot-pos quad)) + (set! (-> arg1 old-gspot-normal quad) (-> gp-0 gspot-normal quad)) + (set! (-> gp-0 trans-old-old-old quad) (-> gp-0 trans-old-old quad)) + (set! (-> gp-0 trans-old-old quad) (-> gp-0 trans-old quad)) + (set! (-> gp-0 trans-old quad) (-> gp-0 trans quad)) + (set! (-> gp-0 prev-status) (-> gp-0 status)) + (vector-v+! (-> gp-0 trans) (-> gp-0 trans) arg0) + (set! (-> arg1 new-pos quad) (-> gp-0 trans quad)) + (let* ((s2-0 (new 'stack-no-clear 'collide-query)) + (t9-1 (method-of-object this set-ground-pat!)) + (a1-2 s2-0) + (a2-2 (-> arg1 gnd-collide-with)) + (a3-0 (-> arg1 popup)) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (cond + ((t9-1 this a1-2 a2-2 a3-0 t0-0 t1-0) + (when (>= (-> gp-0 gspot-pos y) (-> arg1 new-pos y)) + (set! (-> arg1 on-ground?) #t) + (set! (-> arg1 pat) (-> s2-0 best-other-tri pat)) + (set! (-> arg1 new-pos y) (-> s2-0 best-other-tri intersect y)) + (set! (-> gp-0 ground-impact-vel) (- (vector-dot arg0 (-> gp-0 dynam gravity-normal)))) + (set! (-> arg0 y) 0.0) + ) + ) + (else + (if (-> arg1 hover-if-no-ground?) + (set! (-> arg1 new-pos y) (-> gp-0 trans-old y)) + ) + ) + ) + ) + (set! (-> gp-0 trans quad) (-> gp-0 trans-old quad)) + (move-to-point! gp-0 (-> arg1 new-pos)) + (when (logtest? (logand (-> arg1 overlaps-params collide-with-filter) + (collide-spec hit-by-player-list hit-by-others-list player-list) + ) + (-> gp-0 root-prim prim-core collide-with) + ) + (when (find-overlapping-shapes gp-0 (-> arg1 overlaps-params)) + (when (-> arg1 dont-move-if-overlaps?) + (set! (-> arg1 do-move?) #f) + (move-to-point! gp-0 (-> gp-0 trans-old)) + (set! (-> gp-0 gspot-pos quad) (-> arg1 old-gspot-pos quad)) + (set! (-> gp-0 gspot-normal quad) (-> arg1 old-gspot-normal quad)) + ) + ) + ) + (when (-> arg1 do-move?) + (cond + ((-> arg1 on-ground?) + (let ((a1-6 (-> gp-0 gspot-pos)) + (a0-21 (-> gp-0 gspot-normal)) + (v1-39 (-> arg1 pat)) + ) + (set! (-> gp-0 ground-touch-point quad) (-> a1-6 quad)) + (set! (-> gp-0 poly-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 surface-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 local-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 ground-poly-normal quad) (-> a0-21 quad)) + (set! (-> gp-0 poly-pat) v1-39) + (set! (-> gp-0 cur-pat) v1-39) + (set! (-> gp-0 ground-pat) v1-39) + ) + (logior! (-> gp-0 status) (collide-status on-surface on-ground touch-surface)) + ) + (else + (logclear! (-> gp-0 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> gp-0 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((v1-49 (-> gp-0 dynam gravity-normal))) + (set! (-> gp-0 local-normal quad) (-> v1-49 quad)) + (set! (-> gp-0 surface-normal quad) (-> v1-49 quad)) + (set! (-> gp-0 poly-normal quad) (-> v1-49 quad)) + ) + (set! (-> gp-0 coverage) 0.0) + (set! (-> gp-0 touch-angle) 0.0) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 117 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod apply-friction ((this enemy)) + (let ((v1-0 (-> this root))) + (when (logtest? (-> v1-0 status) (collide-status touch-surface)) + (let ((f0-1 (fmax 0.0 (+ 1.0 (* 60.0 (seconds-per-frame) (+ -1.0 (-> this enemy-info friction))))))) + (vector-float*! (-> v1-0 transv) (-> v1-0 transv) f0-1) + ) + 0 + ) + ) + 0 + (none) + ) + +;; definition for method 120 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy-collision! ((this enemy)) + 0 + (none) + ) + +;; definition for method 121 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy! ((this enemy)) + 0 + (none) + ) + +;; definition for method 122 of type enemy +(defmethod go-idle2 ((this enemy)) + (go (method-of-object this idle)) + ) + +;; definition for method 118 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy-info! ((this enemy) (arg0 enemy-info)) + (set! (-> this enemy-info) arg0) + (when (and (!= (-> this enemy-info neck-joint) -1) (zero? (-> this neck))) + (set! (-> this neck) + (new 'process 'joint-mod (joint-mod-mode flex-blend) this (-> this enemy-info neck-joint)) + ) + (set-vector! (-> this neck twist-max) 8192.0 8192.0 0.0 1.0) + (set! (-> this neck up) (the-as uint 1)) + (set! (-> this neck nose) (the-as uint 2)) + (set! (-> this neck ear) (the-as uint 0)) + (set! (-> this neck max-dist) 102400.0) + (set! (-> this neck ignore-angle) 16384.0) + ) + 0 + (none) + ) + +;; definition for method 119 of type enemy +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-enemy-defaults! ((this enemy) (arg0 enemy-info)) + (local-vars (sv-16 res-tag)) + (when (coin-flip? this) + (let ((a0-2 (-> this node-list data 2))) + (set! (-> a0-2 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) + (set! (-> a0-2 param1) #f) + (set! (-> a0-2 param2) #f) + ) + (logior! (-> this enemy-flags) (enemy-flag drawn-mirrored)) + ) + (logior! (-> this mask) (process-mask enemy)) + (logior! (-> this mask) (process-mask actor-pause)) + (logior! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (init-enemy-info! this arg0) + (set! (-> this ragdoll-proc) (the-as handle #f)) + (let ((a1-2 (-> this enemy-info idle-anim-script))) + (if a1-2 + (init! (-> this idle-anim-player) a1-2) + ) + ) + (if (-> this draw shadow) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + (-> this enemy-info shadow-min-y) + (-> this enemy-info shadow-max-y) + (-> this enemy-info shadow-locus-dist) + (the-as vector #f) + (shadow-flags shdf00 shdf04) + 245760.0 + ) + ) + (set! (-> this draw shadow-ctrl) *enemy-dummy-shadow-control*) + ) + (set! (-> this water-max-height) 8192.0) + (if (logtest? (-> *game-info* secrets) (game-secrets hero-mode)) + (set! (-> this hit-points) (* 2.0 (-> this enemy-info default-hit-points))) + (set! (-> this hit-points) (-> this enemy-info default-hit-points)) + ) + (let* ((v1-37 *game-info*) + (a0-10 (+ (-> v1-37 attack-id) 1)) + ) + (set! (-> v1-37 attack-id) a0-10) + (set! (-> this attack-id) a0-10) + ) + (let* ((v1-38 *game-info*) + (a0-12 (+ (-> v1-38 attack-id) 1)) + ) + (set! (-> v1-38 attack-id) a0-12) + (set! (-> this persistent-attack-id) a0-12) + ) + (set! (-> this incoming attacker-handle) (the-as handle #f)) + (set! (-> this gnd-collide-with) (-> this enemy-info gnd-collide-with)) + (set! (-> this fact) (new 'process 'fact-info-enemy this (the-as (pointer float) (-> arg0 fact-defaults)))) + (let ((cspec (if (logtest? (enemy-option multi-focus) (-> this fact enemy-options)) + (the-as collide-spec (collide-spec jak bot player-list jak-vehicle)) + (the-as collide-spec (collide-spec jak player-list jak-vehicle)) + ) + ) + ) + (reset-to-collide-spec (-> this focus) (the-as collide-spec cspec)) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-47 (res-lump-data (-> this entity) 'actor-groups (pointer actor-group) :tag-ptr (& sv-16)))) + (cond + ((and v1-47 (nonzero? (-> sv-16 elt-count))) + (set! (-> this actor-group) v1-47) + (set! (-> this actor-group-count) (the-as int (-> sv-16 elt-count))) + ) + (else + (set! (-> this actor-group) (the-as (pointer actor-group) #f)) + (set! (-> this actor-group-count) 0) + 0 + ) + ) + ) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-active) (res-lump-struct (-> this entity) 'on-active pair)) + (set! (-> this on-hostile) (res-lump-struct (-> this entity) 'on-hostile pair)) + (set! (-> this on-death) (res-lump-struct (-> this entity) 'on-death pair)) + (if (-> this on-notice) + (logior! (-> this enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> this on-active) + (logior! (-> this enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> this on-hostile) + (logior! (-> this enemy-flags) (enemy-flag enable-on-hostile)) + ) + (let ((s4-0 (-> this root))) + (set! (-> this penetrated-by-all) (-> s4-0 penetrated-by)) + (set! (-> s4-0 penetrated-by) (get-penetrated-by this)) + (set! (-> s4-0 event-self) 'touched) + ) + (set! (-> this penetrate-flinch) (-> arg0 penetrate-flinch)) + (set! (-> this penetrate-knocked) (-> arg0 penetrate-knocked)) + (set! (-> this reaction-time) (set-reaction-time! this (seconds 0.1) (seconds 0.6))) + (let* ((v1-77 (-> this enemy-flags)) + (a0-28 (-> this fact enemy-options)) + (v1-78 + (logior (enemy-flag vulnerable vulnerable-backup use-notice-distance attackable-backup trackable trackable-backup) + v1-77 + ) + ) + ) + (if (logtest? (enemy-option multi-focus) a0-28) + (set! v1-78 (logior (enemy-flag multi-focus) v1-78)) + ) + (if (logtest? (enemy-option has-trigger) a0-28) + (set! v1-78 (logior (enemy-flag use-trigger) v1-78)) + ) + (set! (-> this enemy-flags) v1-78) + ) + (if (and (should-move-to-ground? this) + (not (logtest? (enemy-flag no-initial-move-to-ground) (-> this enemy-flags))) + (not (logtest? (enemy-option ambush) (-> this fact enemy-options))) + ) + (try-locate-ground this (meters 10) (meters 10) #t (-> this gnd-collide-with)) + ) + (if (zero? (-> this draw light-index)) + (set! (-> this draw light-index) (the-as uint 10)) + ) + 0 + (none) + ) + +;; definition for method 152 of type enemy +(defmethod enemy-method-152 ((this enemy)) + 1.0 + ) + +;; definition for method 153 of type enemy +(defmethod get-gem-pool-idx ((this enemy)) + (-> *setting-control* user-current gem-pool-index) + ) + +;; definition for function enemy-setup-gem +(defbehavior enemy-setup-gem enemy () + (set! (-> self enemy-flags) (the-as enemy-flag (logclear (-> self enemy-flags) (enemy-flag has-gem)))) + (when (> (-> self enemy-info gem-joint) 0) + (let ((gp-0 (get-gem-pool-idx self))) + (when (gems-available? gp-0) + (if (or (and (zero? gp-0) + (-> self entity) + (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status save)))) + ) + (and (nonzero? gp-0) (let* ((v1-14 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-15 (the-as number (logior #x3f800000 v1-14))) + ) + (< (+ -1.0 (the-as float v1-15)) (enemy-method-152 self)) + ) + ) + ) + (set! (-> self enemy-flags) (the-as enemy-flag (logior (enemy-flag has-gem) (-> self enemy-flags)))) + ) + ) + ) + (cond + ((logtest? (enemy-flag has-gem) (-> self enemy-flags)) + (setup-masks + (-> self draw) + (the-as int (-> self enemy-info gem-seg)) + (the-as int (-> self enemy-info gem-no-seg)) + ) + (add-connection *part-engine* self (-> self enemy-info gem-joint) self 464 (-> self enemy-info gem-offset)) + ) + (else + (setup-masks + (-> self draw) + (the-as int (-> self enemy-info gem-seg)) + (the-as int (-> self enemy-info gem-no-seg)) + ) + ) + ) + ) + ) + +;; definition for function enemy-init-by-other +;; INFO: Used lq/sq +(defbehavior enemy-init-by-other enemy ((arg0 process-drawable) (arg1 enemy-init-by-other-params)) + (let ((a1-1 (-> arg1 entity))) + (if a1-1 + (process-entity-set! self a1-1) + ) + ) + (when (-> arg1 art-level) + (let ((v1-5 (level-get *level* (the-as symbol (-> arg1 art-level))))) + (if v1-5 + (set! (-> self level) v1-5) + ) + ) + ) + (if (-> arg1 directed?) + (logior! (-> self enemy-flags) (enemy-flag directed)) + ) + (if (-> arg1 no-initial-move-to-ground?) + (set! (-> self enemy-flags) + (the-as enemy-flag (logior (enemy-flag no-initial-move-to-ground) (-> self enemy-flags))) + ) + ) + (init-enemy-collision! self) + (set! (-> self root trans quad) (-> arg1 trans quad)) + (quaternion-copy! (-> self root quat) (-> arg1 quat)) + (vector-identity! (-> self root scale)) + (init-enemy! self) + (enemy-setup-gem) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (let ((v1-24 (-> self fact enemy-options))) + (cond + (*debug-view-anims* + (go-virtual view-anims) + ) + ((logtest? (enemy-option dormant) v1-24) + (go-dormant self) + ) + ((logtest? (enemy-flag directed) (-> self enemy-flags)) + (go-directed self) + ) + ((logtest? (enemy-option dormant-aware) v1-24) + (go-dormant-aware self) + ) + ((logtest? (enemy-option ambush) (-> self fact enemy-options)) + (go-ambush-delay self) + ) + (else + (go-idle2 self) + ) + ) + ) + ) + +;; definition for method 11 of type enemy +(defmethod init-from-entity! ((this enemy) (arg0 entity-actor)) + (let ((a1-2 (res-lump-struct arg0 'art-level symbol))) + (when a1-2 + (let ((a0-3 (level-get *level* a1-2))) + (if a0-3 + (set! (-> this level) a0-3) + ) + ) + ) + ) + (init-enemy-collision! this) + (process-drawable-from-entity! this arg0) + (init-enemy! this) + (enemy-setup-gem) + (let ((v1-10 (-> this fact enemy-options))) + (cond + ((logtest? (enemy-option spawner) v1-10) + (process-entity-status! this (entity-perm-status dead) #t) + (go (method-of-object this die-fast)) + ) + (*debug-view-anims* + (go (method-of-object this view-anims)) + ) + ((logtest? (enemy-option dormant) v1-10) + (go-dormant this) + ) + ((logtest? (enemy-option dormant-aware) v1-10) + (go-dormant-aware this) + ) + (else + (go-idle2 this) + ) + ) + ) + ) + +;; definition for method 107 of type enemy +(defmethod enemy-method-107 ((this enemy)) + #t + ) + +;; definition for method 108 of type enemy +(defmethod enemy-method-108 ((this enemy)) + #f + ) + +;; definition for method 11 of type enemy-focus +;; WARN: Return type mismatch int vs none. +(defmethod reset-to-collide-spec ((this enemy-focus) (arg0 collide-spec)) + "Reset this focus with the given [[collide-spec]]." + (let ((t9-0 (method-of-type focus reset-to-collide-spec))) + (t9-0 this arg0) + ) + (set! (-> this aware) (enemy-aware ea0)) + 0 + (none) + ) + +;; definition for method 140 of type enemy +(defmethod update-focus ((this enemy)) + (let ((gp-0 (-> this focus))) + (let ((a1-0 (handle->process (-> gp-0 handle)))) + (when a1-0 + (let ((v1-4 (-> this enemy-flags))) + (cond + ((and a1-0 (not (logtest? (-> (the-as process-focusable a1-0) focus-status) (focus-status disable dead)))) + (when (and (logtest? (enemy-flag multi-focus) v1-4) + (not (logtest? (enemy-flag lock-focus) v1-4)) + (not (logtest? (-> gp-0 flags) (enemy-flag look-at-focus))) + ) + (find-best-focus this) + (return (the-as process #f)) + ) + (let ((v1-14 + (get-enemy-aware this (update-awareness! this (the-as process-focusable a1-0) (the-as enemy-best-focus #f))) + ) + ) + (set! (-> gp-0 aware) v1-14) + (if (>= 1 (the-as int v1-14)) + (logclear! (-> gp-0 flags) (enemy-flag look-at-focus)) + ) + ) + (return (the-as process #f)) + ) + (else + (clear-focused gp-0) + ) + ) + ) + ) + ) + (if (!= (-> gp-0 handle) #f) + (clear-focused gp-0) + ) + ) + (if (not (logtest? (enemy-flag lock-focus) (-> this enemy-flags))) + (find-best-focus this) + ) + ) + +;; definition for method 106 of type enemy +(defmethod find-best-focus ((this enemy)) + (let ((s4-0 (-> this focus collide-with)) + (gp-0 (new 'stack-no-clear 'enemy-best-focus)) + ) + (set! (-> gp-0 proc) #f) + (set! (-> gp-0 rating) 409600000.0) + (set! (-> gp-0 aware) (enemy-aware ea0)) + (when (logtest? s4-0 (collide-spec player-list)) + (let ((v1-4 (-> *collide-player-list* alive-list next0))) + *collide-player-list* + (let ((s3-0 (-> v1-4 next0))) + (while (!= v1-4 (-> *collide-player-list* alive-list-end)) + (let ((v1-5 (the-as collide-shape (-> (the-as connection v1-4) param1)))) + (when (logtest? s4-0 (-> v1-5 root-prim prim-core collide-as)) + (let* ((s2-0 (-> v1-5 process)) + (a1-1 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (if (and a1-1 + (and a1-1 (not (logtest? (-> (the-as process-focusable a1-1) focus-status) (focus-status disable dead)))) + (!= this a1-1) + ) + (update-awareness! this (the-as process-focusable a1-1) gp-0) + ) + ) + ) + ) + (set! v1-4 s3-0) + *collide-player-list* + (set! s3-0 (-> s3-0 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-player-list hit-by-others-list)) + (when (logtest? s4-0 (collide-spec hit-by-player-list)) + (let ((v1-19 (-> *collide-hit-by-player-list* alive-list next0))) + *collide-hit-by-player-list* + (let ((s3-1 (-> v1-19 next0))) + (while (!= v1-19 (-> *collide-hit-by-player-list* alive-list-end)) + (let ((v1-20 (the-as collide-shape (-> (the-as connection v1-19) param1)))) + (when (logtest? s4-0 (-> v1-20 root-prim prim-core collide-as)) + (let* ((s2-1 (-> v1-20 process)) + (a1-3 (if (type? s2-1 process-focusable) + s2-1 + ) + ) + ) + (if (and a1-3 + (and a1-3 (not (logtest? (-> (the-as process-focusable a1-3) focus-status) (focus-status disable dead)))) + (!= this a1-3) + ) + (update-awareness! this (the-as process-focusable a1-3) gp-0) + ) + ) + ) + ) + (set! v1-19 s3-1) + *collide-hit-by-player-list* + (set! s3-1 (-> s3-1 next0)) + ) + ) + ) + ) + (when (logtest? s4-0 (collide-spec hit-by-others-list)) + (let ((v1-32 (-> *collide-hit-by-others-list* alive-list next0))) + *collide-hit-by-others-list* + (let ((s3-2 (-> v1-32 next0))) + (while (!= v1-32 (-> *collide-hit-by-others-list* alive-list-end)) + (let ((v1-33 (the-as collide-shape (-> (the-as connection v1-32) param1)))) + (when (logtest? s4-0 (-> v1-33 root-prim prim-core collide-as)) + (let* ((s2-2 (-> v1-33 process)) + (a1-5 (if (type? s2-2 process-focusable) + s2-2 + ) + ) + ) + (if (and a1-5 + (and a1-5 (not (logtest? (-> (the-as process-focusable a1-5) focus-status) (focus-status disable dead)))) + (!= this a1-5) + ) + (update-awareness! this (the-as process-focusable a1-5) gp-0) + ) + ) + ) + ) + (set! v1-32 s3-2) + *collide-hit-by-others-list* + (set! s3-2 (-> s3-2 next0)) + ) + ) + ) + ) + ) + (let ((s4-1 (-> gp-0 proc))) + (when s4-1 + (enemy-method-70 this (the-as process-focusable s4-1) (get-enemy-aware this (-> gp-0 aware))) + s4-1 + ) + ) + ) + ) + +;; definition for method 64 of type enemy +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod update-awareness! ((this enemy) (arg0 process-focusable) (arg1 enemy-best-focus)) + (let ((f30-0 (vector-vector-distance (get-trans arg0 0) (-> this root trans))) + (s3-1 #f) + (s2-0 #f) + ) + (cond + ((< f30-0 (-> this enemy-info proximity-notice-distance)) + (set! s3-1 #t) + (let* ((a0-3 this) + (t9-2 (method-of-object a0-3 enemy-method-107)) + ) + (set! s2-0 (t9-2 a0-3)) + ) + ) + (else + (let ((f0-1 (the-as float (-> this enemy-info notice-distance)))) + (if (< 1 (the-as int (-> this focus aware))) + (set! f0-1 (+ (the-as meters f0-1) (-> this enemy-info notice-distance-delta))) + ) + (when (or (< f30-0 f0-1) (not (logtest? (-> this enemy-flags) (enemy-flag use-notice-distance)))) + (let* ((a0-7 this) + (t9-3 (method-of-object a0-7 enemy-method-107)) + ) + (set! s2-0 (t9-3 a0-7)) + ) + (if s2-0 + (set! s3-1 #t) + ) + ) + ) + ) + ) + (let ((aware (cond + (s3-1 + (cond + ((enemy-method-108 this) + (the-as enemy-aware (enemy-aware ea4)) + ) + (s2-0 + (the-as enemy-aware (enemy-aware ea3)) + ) + (else + (the-as enemy-aware (enemy-aware ea2)) + ) + ) + ) + ((< f30-0 (-> this fact idle-distance)) + (the-as enemy-aware (enemy-aware ea1)) + ) + (else + (the-as enemy-aware (enemy-aware ea0)) + ) + ) + ) + ) + (when (and (> (the-as int aware) 0) (logtest? (enemy-flag use-trigger) (-> this enemy-flags))) + (cond + ((logtest? (enemy-option idle-til-trigger) (-> this fact enemy-options)) + (if (not (enemy-method-141 this f30-0)) + (set! aware (enemy-aware ea0)) + ) + ) + (else + (if (and (< 1 (the-as int aware)) (not (enemy-method-141 this f30-0))) + (set! aware (enemy-aware ea1)) + ) + ) + ) + ) + (when arg1 + (when (and (>= (the-as int aware) (the-as int (-> arg1 aware))) (< f30-0 (-> arg1 rating))) + (set! (-> arg1 aware) (the-as enemy-aware aware)) + (set! (-> arg1 rating) f30-0) + (set! (-> arg1 proc) arg0) + ) + ) + (the-as enemy-aware aware) + ) + ) + ) + +;; definition for method 141 of type enemy +(defmethod enemy-method-141 ((this enemy) (arg0 float)) + (let* ((v1-0 (-> this fact)) + (a2-0 (-> v1-0 trig-mask-count)) + (a3-0 (-> v1-0 trig-mask)) + ) + (dotimes (t0-0 a2-0) + (let ((t1-1 (the-as int (-> a3-0 t0-0)))) + (if (and (logtest? (the-as uint t1-1) 1) (>= (-> v1-0 trig-dist) arg0)) + (set! t1-1 (the-as int (logand -2 (the-as uint t1-1)))) + ) + (when (logtest? (the-as uint t1-1) 2) + (let ((t2-8 (-> v1-0 trig-actor-group 0))) + (countdown (t3-0 (-> t2-8 length)) + (let ((t5-0 (-> t2-8 data t3-0 actor))) + (when (and t5-0 (logtest? (-> t5-0 extra perm status) (entity-perm-status subtask-complete))) + (set! t1-1 (the-as int (logand -3 (the-as uint t1-1)))) + (goto cfg-17) + ) + ) + ) + ) + ) + (label cfg-17) + (when (zero? t1-1) + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (return #t) + ) + ) + ) + ) + #f + ) + +;; definition for method 68 of type enemy +;; WARN: Return type mismatch int vs enemy-aware. +(defmethod get-enemy-aware ((this enemy) (arg0 enemy-aware)) + (let ((v1-1 (< 1 (the-as int arg0)))) + (cond + (v1-1 + (when (not (logtest? (-> this enemy-flags) (enemy-flag notice))) + (logior! (-> this enemy-flags) (enemy-flag notice)) + (set-time! (-> this notice-time)) + ) + (if (and (not (logtest? (-> this enemy-flags) (enemy-flag alert))) + (not (time-elapsed? (-> this notice-time) (-> this reaction-time))) + ) + (set! v1-1 #f) + ) + ) + (else + (logclear! (-> this enemy-flags) (enemy-flag notice)) + ) + ) + (the-as enemy-aware (cond + (v1-1 + (the-as int arg0) + ) + ((or (= arg0 (enemy-aware ea0)) (time-elapsed? (-> this last-draw-time) (seconds 2))) + 0 + ) + (else + 1 + ) + ) + ) + ) + ) + +;; definition for method 82 of type enemy +;; INFO: Used lq/sq +(defmethod event-handler ((this enemy) (proc process) (argc int) (msg symbol) (block event-message-block)) + (local-vars (s5-6 rgbaf) (sv-640 event-message-block) (sv-656 process) (sv-672 event-message-block)) + (cond + ((= msg 'go-gun-dark-2-stretch) + (go-gun-dark-2-stretch this) + ) + ((= msg 'go-gun-dark-3-nuke) + (on-dying this) + (send-event (ppointer->process (-> this parent)) 'child-die) + (mark-as-dead this) + (cleanup-for-death this) + (go (method-of-object this die-fast)) + ) + ((= msg 'combo) + (and (not (logtest? (enemy-flag dislike-combo) (-> this enemy-flags))) (!= (-> this hit-points) 0.0)) + ) + ((= msg 'touch) + (enemy-touch-handler this proc block) + ) + ((= msg 'touched) + (when (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate)) + (let* ((s3-1 proc) + (v1-27 (if (type? s3-1 process-drawable) + s3-1 + ) + ) + ) + (when v1-27 + (let* ((s3-2 (-> (the-as process-drawable v1-27) root)) + (a1-5 (if (type? s3-2 collide-shape) + s3-2 + ) + ) + (s3-3 (-> block param 0)) + ) + (if (and a1-5 + s3-3 + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (the-as collide-shape a1-5) + (collide-action solid) + (collide-action) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s3-3) + (-> this root) + (collide-action solid) + (collide-action) + ) + ) + (set-time! (-> this auto-reset-penetrate-time)) + ) + ) + ) + ) + ) + (send-attack-on-jump-or-knocked this proc block) + ) + ((= msg 'attack-invinc) + (case (-> (the-as attack-info (-> block param 1)) mode) + (('endlessfall) + (let ((v1-39 (-> this root root-prim))) + (set! (-> v1-39 prim-core collide-as) (collide-spec)) + (set! (-> v1-39 prim-core collide-with) (collide-spec)) + ) + 0 + (go-die this) + ) + ) + ) + ((= msg 'attack-no-avoid) + (let* ((s2-0 (-> block param 1)) + (s3-4 this) + (s1-0 (method-of-object s3-4 get-incoming-attack!)) + (s0-0 proc) + ) + (set! sv-640 block) + (let ((a3-3 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-0 (-> block param 0)) + ) + (s1-0 + s3-4 + (the-as process-drawable s0-0) + sv-640 + a3-3 + (the-as attack-info s2-0) + (the-as touching-shapes-entry t1-0) + ) + ) + ) + (damage-enemy! this proc block) + ) + ((= msg 'attack) + (let ((s2-1 (the-as object (-> block param 1)))) + (when (!= (-> (the-as attack-info s2-1) id) (-> this incoming attack-id)) + (cond + ((and (logtest? (-> this enemy-flags) (enemy-flag vulnerable)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (let* ((s1-1 this) + (s0-1 (method-of-object s1-1 get-incoming-attack!)) + ) + (set! sv-656 proc) + (set! sv-672 block) + (let ((a3-4 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-1 (-> block param 0)) + ) + (s0-1 + s1-1 + (the-as process-drawable sv-656) + sv-672 + a3-4 + (the-as attack-info s2-1) + (the-as touching-shapes-entry t1-1) + ) + ) + ) + (send-event (ppointer->process (-> this parent)) 'child-hit) + (let ((f0-1 (the-as number 0.0))) + (if (not *debug-unkillable*) + (set! f0-1 (damage-enemy! this proc block)) + ) + ) + (let ((s2-2 (penetrate->next-state this))) + (when s2-2 + (logclear! (-> this enemy-flags) (enemy-flag use-trigger)) + (send-attack-to-all-tshapes this (the-as process-focusable proc) block) + (let ((a1-17 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-17 from) (process->ppointer proc)) + (set! (-> a1-17 num-params) argc) + (set! (-> a1-17 message) s2-2) + (set! (-> a1-17 param 0) (-> block param 0)) + (set! (-> a1-17 param 1) (-> block param 1)) + (set! (-> a1-17 param 2) (-> block param 2)) + (set! (-> a1-17 param 3) (-> block param 3)) + (set! (-> a1-17 param 4) (-> block param 4)) + (set! (-> a1-17 param 5) (-> block param 5)) + (send-event-function this a1-17) + ) + #t + ) + ) + ) + (else + (set! (-> this incoming attack-id) (-> (the-as attack-info s2-1) id)) + (enemy-touch-handler this proc block) + ) + ) + ) + ) + ) + ((= msg 'impact-impulse) + (let* ((s4-1 (the-as object (-> block param 0))) + (s3-5 (if (type? proc process-focusable) + proc + ) + ) + (f30-1 (* (-> (the-as rigid-body-impact s4-1) impulse) (get-inv-mass this))) + ) + (when (and s3-5 (< 20480.0 f30-1)) + (let ((s5-1 (new 'stack-no-clear 'attack-info))) + (let ((v1-85 (process->handle s3-5))) + (let ((a0-41 s5-1)) + (set! (-> a0-41 mode) 'impact) + (set! (-> a0-41 penetrate-using) (penetrate vehicle)) + (set! (-> a0-41 mask) (attack-mask mode penetrate-using)) + ) + (cond + ((and (= v1-85 (-> this incoming attacker-handle)) + (not (time-elapsed? (-> this incoming attack-time) (seconds 0.1))) + ) + (set! (-> s5-1 id) (-> this incoming attack-id)) + ) + (else + (let* ((a0-48 *game-info*) + (a1-26 (+ (-> a0-48 attack-id) 1)) + ) + (set! (-> a0-48 attack-id) a1-26) + (set! (-> s5-1 id) a1-26) + ) + ) + ) + (logior! (-> s5-1 mask) (attack-mask id)) + (set! (-> s5-1 attacker) (the-as handle v1-85)) + ) + (logior! (-> s5-1 mask) (attack-mask attacker)) + (let ((v1-89 (scale-impact-vel-y! + this + (new 'stack-no-clear 'vector) + (vector-negate! (new 'stack-no-clear 'vector) (-> (the-as rigid-body-impact s4-1) velocity)) + f30-1 + ) + ) + ) + (set! (-> s5-1 attacker-velocity quad) (-> v1-89 quad)) + (set! (-> s5-1 vector quad) (-> v1-89 quad)) + ) + (logior! (-> s5-1 mask) (attack-mask attacker-velocity)) + (logior! (-> s5-1 mask) (attack-mask vector)) + (set! (-> s5-1 intersection quad) (-> (the-as rigid-body-impact s4-1) point quad)) + (logior! (-> s5-1 mask) (attack-mask intersection)) + (set! (-> s5-1 damage) (lerp-damage this f30-1)) + (logior! (-> s5-1 mask) (attack-mask damage)) + (when (< 0.0 (-> s5-1 damage)) + (format + 0 + "Sending impact-impulse attack with ~f damage (~m impulse, ~m attacker-velocity)~%" + (-> s5-1 damage) + f30-1 + (vector-length (-> s5-1 attacker-velocity)) + ) + (send-event this 'attack #f s5-1) + (when (= (-> this hit-points) 0.0) + (logior! (-> this root penetrated-by) (penetrate vehicle)) + #t + ) + ) + ) + ) + ) + ) + ((= msg 'hit-flinch) + (when (= (-> this hit-points) 0.0) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (go-die this) + ) + #t + ) + ((= msg 'hit-knocked) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (when (= (-> this hit-points) 0.0) + (case (-> this incoming knocked-type) + (((knocked-type yellow-shot) (knocked-type blue-shot)) + (set! (-> this incoming knocked-type) (knocked-type none)) + 0 + ) + ) + ) + (go (method-of-object this knocked)) + ) + ((= msg 'hit) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (process-contact-action proc) + (send-event proc 'get-attack-count 1) + (freeze-hit-begin) + (if (= (-> this hit-points) 0.0) + (go-die this) + (go (method-of-object this hit)) + ) + ) + ((= msg 'cue-chase) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (let ((v1-202 (logtest? (enemy-flag directed) (-> this enemy-flags)))) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance directed directed-ready use-trigger)) + (logior! (-> this enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (cond + (v1-202 + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go-hostile this) + ) + ) + ((and (-> this next-state) (let ((v1-213 (-> this next-state name))) + (or (= v1-213 'dormant) (= v1-213 'dormant-aware)) + ) + ) + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go (method-of-object this notice)) + ) + ) + ) + ) + #t + ) + ) + ((= msg 'cue-wake) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (logclear! (-> this enemy-flags) (enemy-flag directed directed-ready use-trigger)) + (if (logtest? (enemy-option ambush) (-> this fact enemy-options)) + (go-ambush-delay this) + (go-best-state this) + ) + #t + ) + ) + ((= msg 'jump) + (when (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this jump-why) (-> block param 0)) + (set! (-> this event-param-point quad) (-> (the-as vector (-> block param 1)) quad)) + (go (method-of-object this jump)) + ) + ) + ((= msg 'birth-pickup) + (if (not (-> *setting-control* user-current gun-special-mode)) + (drop-pickup (-> this fact) #t *entity-pool* (-> this fact) 0 #f) + ) + ) + ((= msg 'death-start) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag death-start) (-> this enemy-flags)))) + (send-event (ppointer->process (-> this parent)) 'child-die) + (when (< (-> *event-queue* length) (-> *event-queue* allocated-length)) + (let ((v1-269 (-> *event-queue* data (-> *event-queue* length)))) + (+! (-> *event-queue* length) 1) + (set! (-> v1-269 from-handle) (process->handle self)) + (set! (-> v1-269 to-handle) (process->handle this)) + (set! (-> v1-269 num-params) 0) + (set! (-> v1-269 message) 'birth-pickup) + ) + ) + (let ((s5-2 (-> this on-death))) + (if s5-2 + (script-eval s5-2 :vector (-> this root trans)) + ) + ) + ) + ((= msg 'death-end) + (if (-> this skel effect) + (logior! (-> this skel effect flags) (effect-control-flag ecf2)) + ) + (logior! (-> this draw status) (draw-control-status no-draw)) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (set! (-> this enemy-flags) (logclear (-> this enemy-flags) (enemy-flag dangerous-backup))) + ) + ((= msg 'instant-death) + (when (and (< 0.0 (-> this hit-points)) (zero? (-> this fated-time))) + (set! (-> this hit-points) 0.0) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + (let ((s5-3 (get-knockback-dir! this (new 'stack-no-clear 'vector)))) + (vector-z-quaternion! s5-3 (-> this root quat)) + (vector-float*! s5-3 s5-3 -1.0) + (vector-normalize! s5-3 1.0) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag use-notice-distance)) + (logior! (-> this enemy-flags) (enemy-flag alert)) + (logior! (-> this focus-status) (focus-status hit)) + (if (= (-> this hit-points) 0.0) + (logior! (-> this focus-status) (focus-status dead)) + ) + (logclear! (-> this enemy-flags) (enemy-flag lock-focus)) + (enemy-method-69 this) + (logior! (-> this enemy-flags) (enemy-flag lock-focus)) + (go-die this) + ) + ) + ((= msg 'die-fast) + (logior! (-> this draw status) (draw-control-status no-draw)) + (on-dying this) + (send-event (ppointer->process (-> this parent)) 'child-die) + (let ((s5-4 (-> this on-death))) + (if s5-4 + (script-eval s5-4 :vector (-> this root trans)) + ) + ) + (cleanup-for-death this) + (go (method-of-object this die-fast)) + ) + ((= msg 'victory) + (if (and (-> this enemy-info use-victory) + (not (and (-> this next-state) (= (-> this next-state name) 'victory))) + (and (< 0.0 (-> this hit-points)) + (zero? (-> this fated-time)) + (not (logtest? (-> this focus-status) (focus-status grabbed))) + ) + ) + (go (method-of-object this victory)) + ) + ) + ((= msg 'nav-control) + (if (nonzero? (-> this nav)) + (-> this nav) + ) + ) + ((= msg 'push-trans) + (move-by-vector! (-> this root) (the-as vector (-> block param 0))) + ) + ((= msg 'move-trans) + (move-to-point! (-> this root) (the-as vector (-> block param 0))) + ) + ((= msg 'shadow) + (cond + ((-> block param 0) + (let ((v1-371 (-> this draw shadow-ctrl))) + (logclear! (-> v1-371 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (else + (let ((v1-374 (-> this draw shadow-ctrl))) + (logior! (-> v1-374 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + ((= msg 'color-effect) + (case (-> block param 0) + (('dark) + (let ((f30-2 (rand-vu-float-range 0.2 1.0))) + (set-vector! (-> this draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.0 f30-2) (lerp 1.0 1.0 f30-2) 1.0) + (set! s5-6 (-> this draw color-emissive)) + (set! (-> s5-6 x) (lerp 0.0 0.3 f30-2)) + (set! (-> s5-6 y) (lerp 0.0 0.0 f30-2)) + (set! (-> s5-6 z) (lerp 0.0 0.3 f30-2)) + ) + (set! (-> s5-6 w) 1.0) + s5-6 + ) + ((#f) + (set-vector! (-> this draw color-mult) 1.0 1.0 1.0 1.0) + (set! s5-6 (-> this draw color-emissive)) + (set! (-> s5-6 quad) (the-as uint128 0)) + s5-6 + ) + ) + ) + ((= msg 'enable-envmap) + (cond + ((-> block param 0) + (logclear! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) + #t + ) + (else + (logior! (-> this draw global-effect) (draw-control-global-effect disable-envmap)) + #t + ) + ) + ) + ) + ) + +;; definition for method 60 of type enemy +(defmethod lerp-damage ((this enemy) (arg0 float)) + (lerp-scale 0.0 (-> this enemy-info default-hit-points) arg0 20480.0 122880.0) + ) + +;; definition for method 61 of type enemy +;; INFO: Used lq/sq +(defmethod scale-impact-vel-y! ((this enemy) (arg0 vector) (arg1 vector) (arg2 float)) + (set! (-> arg0 quad) (-> arg1 quad)) + (vector-normalize! arg0 arg2) + (set! (-> arg0 y) (lerp-scale + (-> this enemy-info knocked-hard-vy-lo) + (-> this enemy-info knocked-hard-vy-hi) + arg2 + 20480.0 + 204800.0 + ) + ) + (vector-normalize! arg0 arg2) + arg0 + ) + +;; definition for method 62 of type enemy +(defmethod get-damage-from-attack ((this enemy) (arg0 object) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (if (logtest? (attack-mask damage) (-> (the-as attack-info v1-0) mask)) + (-> (the-as attack-info v1-0) damage) + (penetrate-using->damage (-> this incoming penetrate-using)) + ) + ) + ) + +;; definition for method 63 of type enemy +(defmethod enemy-method-63 ((this enemy) (arg0 float)) + (let ((f0-1 (fmax 0.0 (fmin arg0 (-> this hit-points))))) + (cond + ((and (= (-> this incoming knocked-type) (knocked-type blue-shot)) (= f0-1 (-> this hit-points)) (< 0.0 f0-1)) + (cond + ((zero? (-> this fated-time)) + (set-time! (-> this fated-time)) + (+ -1.0 f0-1) + ) + ((not (time-elapsed? (-> this fated-time) (seconds 1))) + (+ -1.0 f0-1) + ) + (else + f0-1 + ) + ) + ) + (else + f0-1 + ) + ) + ) + ) + +;; definition for method 65 of type enemy +(defmethod penetrate->next-state ((this enemy)) + (let ((gp-0 (-> this incoming penetrate-using))) + (cond + ((and (logtest? (penetrate jak-dark-blackhole) gp-0) #t) + 'go-gun-dark-2-stretch + ) + ((and (logtest? (penetrate jak-dark-nuke) (-> this incoming penetrate-using)) (enemy-method-150 this)) + 'go-gun-dark-3-nuke + ) + ((logtest? gp-0 (-> this penetrate-flinch)) + 'hit-flinch + ) + ((logtest? gp-0 (-> this penetrate-knocked)) + 'hit-knocked + ) + (else + 'hit + ) + ) + ) + ) + +;; definition for method 52 of type enemy +(defmethod damage-enemy! ((this enemy) (arg0 object) (arg1 event-message-block)) + (let* ((f0-0 (get-damage-from-attack this arg0 arg1)) + (f30-0 (enemy-method-63 this f0-0)) + ) + (set! (-> this hit-points) (- (-> this hit-points) f30-0)) + (if (not (logtest? (-> this enemy-flags) (enemy-flag auto-reset-penetrate))) + (set! (-> this root penetrated-by) (get-penetrated-by this)) + ) + f30-0 + ) + ) + +;; definition for method 145 of type enemy +(defmethod find-offending-pfoc ((this enemy) (arg0 process) (arg1 attack-info)) + (find-offending-process-focusable arg0 arg1) + ) + +;; definition for method 83 of type enemy +;; WARN: Return type mismatch object vs none. +(defmethod enemy-touch-handler ((this enemy) (arg0 process) (arg1 event-message-block)) + (let* ((s4-0 (-> arg1 param 0)) + (s2-0 arg0) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and s4-0 s3-0) + (cond + ((and (focus-test? this dangerous) + (and s3-0 + (not (logtest? (-> (the-as process-focusable s3-0) focus-status) (focus-status disable dead ignore grabbed))) + ) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action deadly) + (collide-action) + ) + ) + (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action persistent-attack) + (collide-action) + ) + (-> this persistent-attack-id) + (-> this attack-id) + ) + ) + ) + (send-attack this arg0 (the-as touching-shapes-entry s4-0) a3-2) + ) + ) + ((and ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action no-standon) + (collide-action) + ) + (not (logtest? (-> this root penetrated-by) + (-> (the-as collide-shape (-> (the-as process-drawable s3-0) root)) penetrate-using) + ) + ) + ) + (if (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s4-0) 0.7 6144.0 16384.0) + (send-event this 'bouncing-off arg0) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 84 of type enemy +;; WARN: Return type mismatch symbol vs none. +(defmethod send-attack-on-jump-or-knocked ((this enemy) (arg0 process) (arg1 event-message-block)) + (let ((s4-0 (-> arg1 param 0))) + (when s4-0 + (when (or (and (and (-> this next-state) (= (-> this next-state name) 'knocked)) + (logtest? (process-mask crate) (-> arg0 mask)) + ) + (and (and (-> this next-state) (= (-> this next-state name) 'jump)) + (logtest? (process-mask target sidekick crate bot) (-> arg0 mask)) + ) + ) + (when ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action solid semi-solid deadly) + (collide-action) + ) + (let ((a3-2 (if ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s4-0) + (-> this root) + (collide-action persistent-attack) + (collide-action) + ) + (-> this persistent-attack-id) + (-> this attack-id) + ) + ) + ) + (send-attack this arg0 (the-as touching-shapes-entry s4-0) a3-2) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function enemy-event-handler +(defbehavior enemy-event-handler enemy ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (event-handler self arg0 arg1 arg2 arg3) + ) + +;; definition for function enemy-simple-post +;; WARN: Return type mismatch int vs none. +(defbehavior enemy-simple-post enemy () + (enemy-common-post self) + (update-transforms (-> self root)) + 0 + (none) + ) + +;; definition for function enemy-falling-post +;; INFO: Used lq/sq +(defbehavior enemy-falling-post enemy () + (let ((gp-0 (-> self root))) + (cond + ((focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + ) + (else + (let ((a1-1 (new-stack-vector0))) + (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 a1-1 (-> self enemy-info slip-factor))) + ) + ) + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (-> gp-0 root-prim prim-core collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> gp-0 pat-ignore-mask))) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-1 (meters 0)) + ) + ) + (apply-friction self) + (enemy-common-post self) + (none) + ) + +;; definition for method 51 of type enemy +(defmethod accelerate-fall! ((this enemy) (arg0 vector)) + (let* ((f2-0 0.8) + (f0-1 (fmax 0.0 (+ 1.0 (* 60.0 (seconds-per-frame) (+ -1.0 f2-0))))) + ) + (vector-float*! arg0 arg0 f0-1) + ) + (set! (-> arg0 y) (+ (-> arg0 y) (* -204800.0 (seconds-per-frame)))) + ) + +;; definition for function enemy-die-falling-post +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior enemy-die-falling-post enemy () + (let ((gp-0 (-> self root))) + (if (focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + (vector-v++! (-> gp-0 transv) (compute-acc-due-to-gravity gp-0 (new-stack-vector0) 0.0)) + ) + (let ((s4-1 (new 'stack-no-clear 'collide-query)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 quad) (-> gp-0 trans quad)) + (vector-v++! s5-1 (-> gp-0 transv)) + (let* ((a0-6 gp-0) + (t9-4 (method-of-object a0-6 find-ground)) + (a2-1 (-> self enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (t9-4 a0-6 s4-1 a2-1 a3-0 t0-0 t1-0) + (when (>= (-> gp-0 gspot-pos y) (-> s5-1 y)) + (set! (-> s5-1 y) (-> gp-0 gspot-pos y)) + (vector-reset! (-> gp-0 transv)) + ) + ) + ) + (move-to-point! gp-0 s5-1) + ) + ) + (enemy-common-post self) + 0 + (none) + ) + +;; definition for method 91 of type enemy +(defmethod enemy-method-91 ((this enemy)) + #f + ) + +;; definition for method 92 of type enemy +;; INFO: Used lq/sq +(defmethod init-jump-info! ((this enemy) (arg0 enemy-jump-info)) + (set! (-> arg0 flags) (enemy-jump-flags ejf0)) + (set! (-> arg0 anim-speed) (rnd-float-range this 0.9 1.1)) + (set! (-> arg0 hang-time) 0) + (set! (-> arg0 dest-pos quad) (-> this event-param-point quad)) + (set! (-> arg0 start-pos quad) (-> this root trans quad)) + (let ((s4-0 (new 'stack-no-clear 'collide-query))) + (if (enemy-above-ground? this s4-0 (-> arg0 dest-pos) (-> this gnd-collide-with) 8192.0 81920.0 1024.0) + (set! (-> arg0 dest-pos y) (-> s4-0 best-other-tri intersect y)) + ) + ) + (setup-jump! this arg0) + (none) + ) + +;; definition for method 93 of type enemy +(defmethod setup-jump! ((this enemy) (arg0 enemy-jump-info)) + (let* ((f0-0 (vector-vector-xz-distance (-> arg0 start-pos) (-> arg0 dest-pos))) + (f0-2 (fmax (-> this enemy-info jump-height-min) (* (-> this enemy-info jump-height-factor) f0-0))) + ) + (setup-from-to-height! (-> arg0 traj) (-> arg0 start-pos) (-> arg0 dest-pos) f0-2 -4.551111) + ) + (none) + ) + +;; definition for method 95 of type enemy +(defmethod on-ground? ((this enemy)) + (let ((gp-0 (-> this root))) + (when (< (-> gp-0 transv y) 0.0) + (let* ((a1-0 (new 'stack-no-clear 'collide-query)) + (v1-0 (-> this root)) + (t9-0 (method-of-object v1-0 find-ground)) + (a2-1 (-> this gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (t9-0 v1-0 a1-0 a2-1 a3-0 t0-0 t1-0) + ) + (>= (+ 409.6 (-> gp-0 gspot-pos y)) (-> gp-0 trans y)) + ) + ) + ) + +;; definition for method 94 of type enemy +(defmethod move-to-gspot! ((this enemy)) + (let* ((v1-0 (-> this root)) + (f0-0 (-> v1-0 gspot-pos y)) + ) + (if (< (-> v1-0 trans y) f0-0) + (set! (-> v1-0 trans y) f0-0) + ) + ) + (set! (-> this root transv y) 0.0) + ) + +;; definition for method 101 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-101 ((this enemy)) + 0 + (none) + ) + +;; definition for method 100 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod in-jump-handler ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + (case arg0 + ((2 3) + (let ((f30-0 (the float (-> arg1 hang-time)))) + (let ((a1-3 (compute-trans-at-time (-> arg1 traj) f30-0 (new 'stack-no-clear 'vector)))) + (move-to-point! (-> this root) a1-3) + ) + (let ((s5-1 (-> this root transv))) + (compute-transv-at-time (-> arg1 traj) f30-0 s5-1) + (vector-float*! s5-1 s5-1 300.0) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 98 of type enemy +(defmethod jump-wind-up-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((a0-1 (-> this skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.1)) + (let ((a1-3 (-> this draw art-group data (-> this enemy-info jump-wind-up-anim))) + (a0-5 (-> this skel root-channel 0)) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) + (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) + ) + #t + ) + +;; definition for method 96 of type enemy +(defmethod jump-in-air-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((s5-0 (-> this draw art-group data (-> this enemy-info jump-in-air-anim)))) + (let ((v1-6 (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + (cond + ((and v1-6 (= v1-6 (-> this draw art-group data (-> this enemy-info jump-wind-up-anim)))) + (ja-channel-push! 1 0) + ) + (else + (let ((a0-10 (-> this skel root-channel 0))) + (set! (-> a0-10 param 0) 1.0) + (joint-control-channel-group! a0-10 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.1)) + ) + ) + ) + (let ((a0-12 (-> this skel root-channel 0))) + (set! (-> a0-12 frame-group) (the-as art-joint-anim s5-0)) + (set! (-> a0-12 param 0) (the float (+ (-> (the-as art-joint-anim s5-0) frames num-frames) -1))) + (set! (-> a0-12 param 1) (-> arg0 anim-speed)) + (set! (-> a0-12 frame-num) 0.0) + (joint-control-channel-group! a0-12 (the-as art-joint-anim s5-0) num-func-seek!) + ) + ) + #t + ) + +;; definition for method 97 of type enemy +(defmethod jump-land-anim ((this enemy) (arg0 enemy-jump-info)) + (let ((a0-1 (-> this skel root-channel 0))) + (set! (-> a0-1 param 0) 1.0) + (joint-control-channel-group! a0-1 (the-as art-joint-anim #f) num-func-loop!) + ) + (ja-channel-push! 1 (seconds 0.075)) + (let ((a1-3 (-> this draw art-group data (-> this enemy-info jump-land-anim))) + (a0-5 (-> this skel root-channel 0)) + ) + (set! (-> a0-5 frame-group) (the-as art-joint-anim a1-3)) + (set! (-> a0-5 param 0) (the float (+ (-> (the-as art-joint-anim a1-3) frames num-frames) -1))) + (set! (-> a0-5 param 1) (-> arg0 anim-speed)) + (set! (-> a0-5 frame-num) 0.0) + (joint-control-channel-group! a0-5 (the-as art-joint-anim a1-3) num-func-seek!) + ) + #t + ) + +;; definition for method 99 of type enemy +(defmethod jump-anim-handler ((this enemy) (arg0 int) (arg1 enemy-jump-info)) + (local-vars (s5-0 symbol)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (not (jump-wind-up-anim this arg1)) + ) + ((= v1-0 1) + (set! s5-0 (ja-done? 0)) + (let ((a0-4 (-> this skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + ((= v1-0 2) + (jump-in-air-anim this arg1) + #f + ) + ((= v1-0 3) + (set! s5-0 (ja-done? 0)) + (let ((a0-9 (-> this skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + ((= v1-0 4) + (not (jump-land-anim this arg1)) + ) + ((= v1-0 5) + (set! s5-0 (ja-done? 0)) + (let ((a0-14 (-> this skel root-channel 0))) + (set! (-> a0-14 param 0) (the float (+ (-> a0-14 frame-group frames num-frames) -1))) + (set! (-> a0-14 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-14 (the-as art-joint-anim #f) num-func-seek!) + ) + (ja-blend-eval) + s5-0 + ) + (else + #t + ) + ) + ) + ) + +;; definition for method 109 of type enemy +(defmethod enemy-method-109 ((this enemy)) + #f + ) + +;; definition for method 50 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-50 ((this enemy) (arg0 int)) + 0 + (none) + ) + +;; failed to figure out what this is: +(if #t + (set! *shockwave-knock-scalar* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -1.0 :w -2.0) + :ys (new 'static 'vector :x 0.5 :y 1.0 :z 1.5 :w 2.5) + :one-over-x-deltas (new 'static 'vector :x 1.6666666 :y 0.71428573 :z 1.0 :w 1.0) + ) + ) + ) + +;; definition for method 56 of type enemy +;; INFO: Used lq/sq +(defmethod knocked-handler ((this enemy) (arg0 vector)) + (local-vars (v0-22 number)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf24 :class vf) + (vf25 :class vf) + (vf26 :class vf) + (vf27 :class vf) + (vf28 :class vf) + (vf29 :class vf) + ) + (init-vf0-vector) + (get-knockback-dir! this arg0) + (let ((s5-0 (-> this enemy-info))) + (case (-> this incoming knocked-type) + (((knocked-type explode-or-darkjak)) + (let ((f30-0 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-hard-vxz-lo) (-> s5-0 knocked-hard-vxz-hi) f30-0)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-hard-vy-lo) (-> s5-0 knocked-hard-vy-hi) f30-0)) + ) + ) + (((knocked-type mech-punch)) + (let ((f30-1 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-medium-vxz-lo) (-> s5-0 knocked-medium-vxz-hi) f30-1)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-medium-vy-lo) (-> s5-0 knocked-medium-vy-hi) f30-1)) + ) + ) + (((knocked-type dark-shot)) + (let ((f30-2 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-huge-vxz-lo) (-> s5-0 knocked-huge-vxz-hi) f30-2)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-huge-vy-lo) (-> s5-0 knocked-huge-vy-hi) f30-2)) + ) + ) + (((knocked-type yellow-shot)) + (vector-rotate90-around-y! arg0 arg0) + (let ((v1-9 (new 'stack-no-clear 'vector))) + (vector-! v1-9 (-> this incoming attacker-pos) (-> this root trans)) + (set! (-> v1-9 y) 0.0) + (if (< 0.0 (vector-dot v1-9 arg0)) + (vector-negate! arg0 arg0) + ) + ) + (let ((f30-3 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-yellow-vxz-lo) (-> s5-0 knocked-yellow-vxz-hi) f30-3)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-yellow-vy-lo) (-> s5-0 knocked-yellow-vy-hi) f30-3)) + ) + ) + (((knocked-type red-shot)) + (let ((f30-4 0.0)) + (cond + ((logtest? (penetrate jak-red-shockwave) (-> this incoming penetrate-using)) + (format 0 "Intensity ~f (handle ~d)~%" f30-4 (process->handle this)) + ) + (else + (let* ((f1-2 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f0-26 1.0) + (f2-0 61440.0) + (f1-3 (fmin f1-2 (* f2-0 f2-0))) + (f2-3 61440.0) + ) + (set! f30-4 (* (- f0-26 (/ f1-3 (* f2-3 f2-3))) (rnd-float-range this 0.8 1.0))) + ) + ) + ) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-red-vxz-lo) (-> s5-0 knocked-red-vxz-hi) f30-4)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-red-vy-lo) (-> s5-0 knocked-red-vy-hi) f30-4)) + ) + (when (logtest? (penetrate jak-red-shockwave) (-> this incoming penetrate-using)) + (let ((a0-31 *shockwave-knock-scalar*) + (f0-34 (-> this incoming intensity)) + (a1-23 (new 'stack-no-clear 'vector)) + (v1-33 (new 'stack-no-clear 'vector)) + ) + (let ((a2-18 f0-34)) + (.mov vf27 a2-18) + ) + (.lvf vf24 (&-> a0-31 xs quad)) + (.lvf vf25 (&-> a0-31 ys quad)) + (.lvf vf26 (&-> a0-31 one-over-x-deltas quad)) + (.min.w.vf vf27 vf27 vf0) + (.max.x.vf vf27 vf27 vf0) + (.add.x.vf vf28 vf24 vf27) + (.mul.w.vf acc vf25 vf0) + (.add.mul.vf vf29 vf28 vf26 acc) + (.svf (&-> a1-23 quad) vf28) + (.svf (&-> v1-33 quad) vf29) + (let ((a0-32 (-> a1-23 z)) + (a1-24 (-> a1-23 y)) + ) + (b! (>= (the-as int a0-32) 0) cfg-23 :delay (set! v0-22 (-> v1-33 z))) + (b! (>= (the-as int a1-24) 0) cfg-23 :delay (set! v0-22 (-> v1-33 y))) + ) + (set! v0-22 (-> v1-33 x)) + ) + (label cfg-23) + (let ((f0-35 (the-as float v0-22))) + (vector-float*! arg0 arg0 f0-35) + ) + ) + ) + (((knocked-type blue-shot)) + (let* ((f1-5 (vector-vector-xz-distance-squared (target-pos 0) (-> this root trans))) + (f0-36 1.0) + (f2-6 122880.0) + (f1-6 (fmin f1-5 (* f2-6 f2-6))) + (f2-9 122880.0) + (f30-7 (* (- f0-36 (/ f1-6 (* f2-9 f2-9))) (rnd-float-range this 0.8 1.0))) + ) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-blue-vxz-lo) (-> s5-0 knocked-blue-vxz-hi) f30-7)) + (cond + ((or (>= (the-as uint 4) (-> this incoming blue-juggle-count)) (handle->process (-> this ragdoll-proc))) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-blue-vy-lo) (-> s5-0 knocked-blue-vy-hi) f30-7)) + ) + (else + (if (zero? (rnd-int this 3)) + (set! (-> arg0 y) 40960.0) + ) + ) + ) + ) + ) + (((knocked-type vehicle)) + (let ((v0-4 (the-as object arg0))) + (set! (-> (the-as vector v0-4) quad) (-> this incoming attack-direction quad)) + v0-4 + ) + ) + (else + (let ((f30-8 (rnd-float-range this 0.0 1.0))) + (vector-float*! arg0 arg0 (lerp (-> s5-0 knocked-soft-vxz-lo) (-> s5-0 knocked-soft-vxz-hi) f30-8)) + (set! (-> arg0 y) (lerp (-> s5-0 knocked-soft-vy-lo) (-> s5-0 knocked-soft-vy-hi) f30-8)) + ) + ) + ) + ) + ) + ) + +;; definition for method 55 of type enemy +;; WARN: Return type mismatch float vs degrees. +(defmethod get-knockback-angle ((this enemy)) + (let ((f30-0 (quaternion-y-angle (-> this root quat)))) + (case (-> this incoming knocked-type) + (((knocked-type yellow-shot) (knocked-type blue-shot)) + (let ((a0-5 (handle->process (-> this focus handle)))) + (when a0-5 + (let ((v1-9 (get-trans (the-as process-focusable a0-5) 0))) + (set! f30-0 (atan (- (-> v1-9 x) (-> this root trans x)) (- (-> v1-9 z) (-> this root trans z)))) + ) + ) + ) + ) + (else + (let* ((v1-13 (-> this root transv)) + (f28-0 (atan (-> v1-13 x) (-> v1-13 z))) + (f1-2 (deg- f30-0 f28-0)) + (f2-0 (fabs f1-2)) + (f0-6 (-> this enemy-info knocked-seek-ry-clamp)) + ) + (when (and (< f0-6 f2-0) (< f2-0 (- 32768.0 f0-6))) + (set! f30-0 (+ (cond + ((< f2-0 16384.0) + (if (>= f1-2 0.0) + f0-6 + (- f0-6) + ) + ) + ((>= f1-2 0.0) + (- 32768.0 f0-6) + ) + (else + (+ -32768.0 f0-6) + ) + ) + f28-0 + ) + ) + (if (< f30-0 0.0) + (set! f30-0 (+ 65536.0 f30-0)) + ) + ) + ) + ) + ) + (the-as degrees f30-0) + ) + ) + +;; definition for method 85 of type enemy +(defmethod knocked-anim ((this enemy) (arg0 enemy-knocked-info)) + (ja-channel-push! 1 0) + (let ((a1-2 (-> this draw art-group data (-> this enemy-info knocked-anim))) + (a0-4 (-> this skel root-channel 0)) + ) + (set! (-> a0-4 frame-group) (the-as art-joint-anim a1-2)) + (set! (-> a0-4 param 0) (the float (+ (-> (the-as art-joint-anim a1-2) frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg0 anim-speed)) + (set! (-> a0-4 frame-num) 0.0) + (joint-control-channel-group! a0-4 (the-as art-joint-anim a1-2) num-func-seek!) + ) + #t + ) + +;; definition for method 86 of type enemy +(defmethod knocked-land-anim ((this enemy) (arg0 enemy-knocked-info)) + (let ((v1-4 (-> this draw art-group data (-> this enemy-info knocked-land-anim))) + (a0-3 (-> this skel root-channel 0)) + ) + (set! (-> a0-3 frame-group) (the-as art-joint-anim v1-4)) + (set! (-> a0-3 param 0) (the float (+ (-> (the-as art-joint-anim v1-4) frames num-frames) -1))) + (set! (-> a0-3 param 1) (-> arg0 anim-speed)) + (set! (-> a0-3 frame-num) 0.0) + (joint-control-channel-group! a0-3 (the-as art-joint-anim v1-4) num-func-seek!) + ) + #t + ) + +;; definition for method 88 of type enemy +(defmethod enemy-method-88 ((this enemy) (arg0 enemy-knocked-info)) + (let ((gp-0 (-> this root))) + (or (>= (-> arg0 on-surface-count) 3) + (and (logtest? (-> gp-0 status) (collide-status on-ground)) (>= 16384.0 (-> gp-0 transv y))) + (and (>= (-> arg0 move-count) 3) + (let ((f0-1 40.96)) + (>= (* f0-1 f0-1) (vector-vector-distance-squared (-> gp-0 trans-old) (-> gp-0 trans-old-old))) + ) + (let ((f0-4 40.96)) + (>= (* f0-4 f0-4) (vector-vector-distance-squared (-> gp-0 trans-old-old) (-> gp-0 trans-old-old-old))) + ) + ) + ) + ) + ) + +;; definition for method 89 of type enemy +(defmethod within-gspot-range? ((this enemy)) + (let ((gp-0 (-> this root)) + (a1-0 (new 'stack-no-clear 'collide-query)) + ) + (if (or (< 0.0 (-> this root transv y)) (begin + (let* ((v1-3 gp-0) + (t9-0 (method-of-object v1-3 find-ground)) + (a2-1 (-> this enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (t9-0 v1-3 a1-0 a2-1 a3-0 t0-0 t1-0) + ) + (let ((f0-2 (- (-> gp-0 trans y) (-> gp-0 gspot-pos y)))) + (and (>= f0-2 -1228.8) (>= 6144.0 f0-2)) + ) + ) + ) + #f + #t + ) + ) + ) + +;; definition for method 90 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod enemy-method-90 ((this enemy) (arg0 ragdoll-proc)) + (let* ((s4-0 (-> arg0 ragdoll)) + (s2-0 (-> s4-0 ragdoll-joints)) + (s1-0 + (quaternion-vector-angle! (new 'stack-no-clear 'quaternion) (-> s4-0 orient-tform) (-> s4-0 orient-tform w)) + ) + (s3-0 (new 'stack-no-clear 'matrix)) + (s5-0 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> this root quat))) + ) + (quaternion-normalize! (quaternion*! s1-0 (the-as quaternion (-> s2-0 0)) s1-0)) + (quaternion->matrix s3-0 s1-0) + (if (logtest? (-> s4-0 ragdoll-flags) (ragdoll-flag mirror)) + (matrix*! s3-0 s3-0 (-> s4-0 mirror)) + ) + (vector-flatten! (-> s5-0 fvec) (-> s3-0 uvec) (-> s5-0 uvec)) + (vector-normalize! (-> s5-0 fvec) 1.0) + (vector-cross! (-> s5-0 rvec) (-> s5-0 uvec) (-> s5-0 fvec)) + (matrix->quaternion (-> this root quat) s5-0) + ) + 0 + (none) + ) + +;; definition for method 87 of type enemy +(defmethod knocked-anim-handler ((this enemy) (arg0 int) (arg1 enemy-knocked-info)) + (local-vars (s5-0 symbol)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (knocked-anim this arg1) + (set! s5-0 #f) + ) + ((= v1-0 1) + (set! s5-0 (ja-done? 0)) + (let ((a0-4 (-> this skel root-channel 0))) + (set! (-> a0-4 param 0) (the float (+ (-> a0-4 frame-group frames num-frames) -1))) + (set! (-> a0-4 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-4 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ((= v1-0 2) + (freeze-hit-end) + (set! s5-0 (not (knocked-land-anim this arg1))) + (set! (-> this incoming blue-juggle-count) (the-as uint 0)) + ) + ((= v1-0 3) + (set! s5-0 (ja-done? 0)) + (let ((a0-9 (-> this skel root-channel 0))) + (set! (-> a0-9 param 0) (the float (+ (-> a0-9 frame-group frames num-frames) -1))) + (set! (-> a0-9 param 1) (-> arg1 anim-speed)) + (joint-control-channel-group-eval! a0-9 (the-as art-joint-anim #f) num-func-seek!) + ) + ) + ((= v1-0 4) + (vector-reset! (-> this root transv)) + (set! s5-0 #t) + ) + (else + (set! s5-0 #t) + ) + ) + ) + s5-0 + ) + +;; definition for function ja-group-index? +(defbehavior ja-group-index? enemy ((arg0 int)) + (ja-group? (-> self draw art-group data arg0)) + ) + +;; definition for method 123 of type enemy +(defmethod enemy-method-123 ((this enemy)) + #t + ) + +;; definition for method 126 of type enemy +;; INFO: Used lq/sq +(defmethod ragdoll-spawn! ((this enemy) (arg0 symbol) (arg1 symbol)) + (local-vars (s2-0 process)) + (with-pp + (when (and (enemy-method-123 this) (-> this enemy-info ragdoll-info)) + (let ((s3-0 (handle->process (-> this ragdoll-proc)))) + (cond + (s3-0 + (set! s2-0 s3-0) + ) + (else + (set! (-> this ragdoll-proc) + (ppointer->handle + (process-spawn + ragdoll-proc + (-> this enemy-info ragdoll-info) + :name "ragdoll-proc" + :to this + :stack-size #x5000 + ) + ) + ) + (set! s2-0 (handle->process (-> this ragdoll-proc))) + (when (not s2-0) + (format 0 "deactivated ~A because a ragdoll allocate failed~%" (-> this name)) + (deactivate this) + ) + (set! (-> this enemy-flags) + (the-as enemy-flag (logior (enemy-flag auto-death-phase-out) (-> this enemy-flags))) + ) + ) + ) + (when (and (-> this draw) (-> this draw shadow-ctrl)) + (let ((v1-29 (-> this draw shadow-ctrl))) + (logior! (-> v1-29 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (if (-> (the-as ragdoll-proc s2-0) ragdoll) + (logior! (-> (the-as ragdoll-proc s2-0) ragdoll ragdoll-flags) (ragdoll-flag rf3 rf4)) + ) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (vector-float*! s1-0 (-> this root transv) (seconds-per-frame)) + (if s3-0 + (ragdoll-proc-method-15 (the-as ragdoll-proc s2-0) arg1 (the-as vector #f) #f) + (ragdoll-proc-method-15 (the-as ragdoll-proc s2-0) arg1 (the-as vector #f) #t) + ) + (if arg0 + (ragdoll-method-23 + (-> (the-as ragdoll-proc s2-0) ragdoll) + (-> this incoming attack-position) + s1-0 + (-> this enemy-info ragdoll-rotate-velocity-mult) + #t + ) + ) + (vector-float*! s1-0 s1-0 (/ 1.0 (-> pp clock time-adjust-ratio))) + (let ((v0-1 (-> (the-as ragdoll-proc s2-0) ragdoll ragdoll-joints 0 velocity))) + (set! (-> v0-1 quad) (-> s1-0 quad)) + v0-1 + ) + ) + ) + ) + ) + ) + +;; definition for method 127 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod deactivate-ragdoll! ((this enemy)) + (when (and (enemy-method-123 this) (-> this enemy-info ragdoll-info)) + (let ((a0-3 (handle->process (-> this ragdoll-proc)))) + (when a0-3 + (when (and (-> this draw) (-> this draw shadow-ctrl)) + (let ((v1-14 (-> this draw shadow-ctrl))) + (logclear! (-> v1-14 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + (deactivate a0-3) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 125 of type enemy +(defmethod ragdoll-settled? ((this enemy)) + (let ((s5-0 (handle->process (-> this ragdoll-proc)))) + (or (not s5-0) + (or (ragdoll-proc-method-19 (the-as ragdoll-proc s5-0)) + (and (time-elapsed? (-> this state-time) (seconds 0.1)) + (let ((f0-1 (if (= (-> this hit-points) 0.0) + 4096.0 + 49152.0 + ) + ) + (f1-2 (if (= (-> this hit-points) 0.0) + 364.0889 + 16384.0 + ) + ) + ) + (and (and (< (vector-length (-> (the-as ragdoll-proc s5-0) ragdoll ragdoll-joints 0 velocity)) + (* f0-1 (seconds-per-frame)) + ) + (< (cos (* f1-2 (seconds-per-frame))) (-> (the-as ragdoll-proc s5-0) ragdoll rotate-vel w)) + ) + (and (not (enemy-method-109 this)) (not (within-gspot-range? this))) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 124 of type enemy +;; WARN: Return type mismatch int vs none. +(defmethod disable-ragdoll ((this enemy)) + (let ((s5-0 (handle->process (-> this ragdoll-proc)))) + (when s5-0 + (disable-for-duration (the-as ragdoll-proc s5-0) (-> this enemy-info ragdoll-blend-out-time)) + (logclear! (-> (the-as ragdoll-proc s5-0) ragdoll ragdoll-flags) (ragdoll-flag rf9)) + (enemy-method-90 this (the-as ragdoll-proc s5-0)) + ) + ) + 0 + (none) + ) + +;; definition for method 151 of type enemy +(defmethod should-move-to-ground? ((this enemy)) + (-> this enemy-info move-to-ground) + ) diff --git a/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc b/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc index 3e0df106374..a01b98d49f0 100644 --- a/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/aligner-h_REF.gc @@ -17,9 +17,9 @@ (new (symbol type process) _type_) (compute-alignment! (_type_) transformq) (align! (_type_ align-opts float float float) trsqv) - (align-control-method-11 () none) - (align-control-method-12 () none) - (align-control-method-13 () none) + (align-vel-and-quat-only! (_type_ align-opts vector int float float) trsqv) + (first-transform (_type_) transform) + (second-transform (_type_) transform) ) ) diff --git a/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc b/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc new file mode 100644 index 00000000000..31415136919 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/anim/aligner_REF.gc @@ -0,0 +1,213 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 9 of type align-control +;; INFO: Used lq/sq +;; ERROR: Unsupported inline assembly instruction kind - [lw ra, return-from-thread(s7)] +;; ERROR: Unsupported inline assembly instruction kind - [jr ra] +(defmethod compute-alignment! ((this align-control)) + (local-vars (a0-10 symbol) (s7-0 none) (ra-0 int)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (update-anim-data (-> this process skel)) + (let ((s5-0 (-> this process skel active-channels))) + (dotimes (s4-0 (the-as int s5-0)) + (let* ((a0-4 (-> this process skel channel s4-0)) + (v1-7 (-> a0-4 frame-group)) + ) + (case (-> a0-4 command) + (((joint-control-command stack) (joint-control-command stack1)) + ) + (else + (when (!= (-> v1-7 type) art-joint-anim) + (go process-drawable-art-error "align joint-anim") + (.lw ra-0 return-from-thread s7-0) + (.jr ra-0) + (nop!) + 0 + ) + ) + ) + ) + ) + ) + (let* ((a0-9 (-> this process skel root-channel 0)) + (v1-18 (-> a0-9 frame-group)) + (f0-0 (-> a0-9 frame-num)) + ) + (= (-> a0-9 num-func) num-func-loop!) + (cond + ((or (not v1-18) (!= (-> this frame-group) v1-18)) + (set! a0-10 #t) + ) + ((= (-> a0-9 num-func) num-func-loop!) + (set! a0-10 (< (* (-> a0-9 param 0) (- f0-0 (-> this frame-num))) 0.0)) + ) + (else + (set! a0-10 (= f0-0 0.0)) + ) + ) + (if a0-10 + (logior! (-> this flags) (align-flags disabled)) + (logclear! (-> this flags) (align-flags disabled)) + ) + (set! (-> this frame-group) v1-18) + (set! (-> this frame-num) f0-0) + ) + (mem-copy! (the-as pointer (-> this transform 1)) (the-as pointer (-> this transform)) 48) + (quaternion-copy! (the-as quaternion (-> this transform 1 rot)) (-> this align quat)) + (set! (-> this transform 1 scale quad) (-> this align scale quad)) + (let* ((a2-5 (-> this matrix 1)) + (a3-0 (-> this matrix)) + (v1-21 (-> a3-0 0 rvec quad)) + (a0-19 (-> a3-0 0 uvec quad)) + (a1-13 (-> a3-0 0 fvec quad)) + (a3-1 (-> a3-0 0 trans quad)) + ) + (set! (-> a2-5 rvec quad) v1-21) + (set! (-> a2-5 uvec quad) a0-19) + (set! (-> a2-5 fvec quad) a1-13) + (set! (-> a2-5 trans quad) a3-1) + ) + (let ((s5-1 (-> this process node-list data 1))) + (cspace<-matrix-no-push-joint! s5-1 (-> this process skel)) + (let* ((v1-25 (-> this matrix)) + (a3-2 (-> s5-1 bone transform)) + (a0-22 (-> a3-2 rvec quad)) + (a1-15 (-> a3-2 uvec quad)) + (a2-6 (-> a3-2 fvec quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> v1-25 0 rvec quad) a0-22) + (set! (-> v1-25 0 uvec quad) a1-15) + (set! (-> v1-25 0 fvec quad) a2-6) + (set! (-> v1-25 0 trans quad) a3-3) + ) + (let ((v1-26 (-> this transform))) + (let ((a0-24 (-> s5-1 bone transform trans)) + (a1-18 (-> this process root scale)) + ) + (.lvf vf4 (&-> a0-24 quad)) + (.lvf vf5 (&-> a1-18 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> v1-26 0 trans quad) vf6) + ) + ) + (vector-! + (the-as vector (-> this delta)) + (the-as vector (-> this transform)) + (the-as vector (-> this transform 1)) + ) + (set-vector! + (-> this align scale) + (vector-length (the-as vector (-> this matrix))) + (vector-length (-> this matrix 0 uvec)) + (vector-length (-> this matrix 0 fvec)) + 1.0 + ) + (vector-! (-> this delta scale) (-> this align scale) (-> this transform 1 scale)) + (let ((a2-7 (matrix-inv-scale! (new 'stack-no-clear 'matrix) (-> this align scale)))) + (quaternion-normalize! + (matrix->quaternion (-> this align quat) (matrix*! a2-7 (the-as matrix (-> this matrix)) a2-7)) + ) + ) + (let ((a1-27 (quaternion-inverse! (new 'stack-no-clear 'quaternion) (the-as quaternion (-> this transform 1 rot)))) + ) + (quaternion-normalize! (quaternion*! (-> this delta quat) a1-27 (-> this align quat))) + ) + (-> this delta) + ) + ) + +;; definition for method 12 of type align-control +;; WARN: Return type mismatch (inline-array transform) vs transform. +(defmethod first-transform ((this align-control)) + (the-as transform (-> this transform)) + ) + +;; definition for method 13 of type align-control +(defmethod second-transform ((this align-control)) + (-> this transform 1) + ) + +;; definition for method 10 of type align-control +(defmethod align! ((this align-control) (arg0 align-opts) (arg1 float) (arg2 float) (arg3 float)) + (when (not (logtest? (-> this flags) (align-flags disabled))) + (let* ((a0-1 (-> this process)) + (t9-0 (method-of-object a0-1 apply-alignment)) + (v1-4 (-> this delta)) + (t1-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> t1-0 x) arg1) + (set! (-> t1-0 y) arg2) + (set! (-> t1-0 z) arg3) + (set! (-> t1-0 w) 1.0) + (t9-0 a0-1 arg0 v1-4 t1-0) + ) + ) + (-> this process root) + ) + +;; definition for method 26 of type trsqv +(defmethod set-and-limit-velocity ((this trsqv) (arg0 int) (arg1 vector) (arg2 float)) + (with-pp + (let ((a0-1 (-> this transv))) + (when (logtest? arg0 4) + (set! (-> a0-1 x) (-> arg1 x)) + (set! (-> a0-1 z) (-> arg1 z)) + (let* ((v1-2 arg1) + (f0-8 + (fmin + (* (sqrtf (+ (* (-> v1-2 x) (-> v1-2 x)) (* (-> v1-2 z) (-> v1-2 z)))) (-> pp clock frames-per-second)) + arg2 + ) + ) + ) + (vector-xz-normalize! a0-1 f0-8) + ) + ) + ) + this + ) + ) + +;; definition for method 11 of type align-control +(defmethod align-vel-and-quat-only! ((this align-control) (arg0 align-opts) (arg1 vector) (arg2 int) (arg3 float) (arg4 float)) + (with-pp + (when (not (logtest? (-> this flags) (align-flags disabled))) + (let ((s5-0 (-> this delta))) + (let ((a0-1 (-> this process root transv))) + (if (logtest? arg0 (align-opts adjust-y-vel)) + (set! (-> a0-1 y) (* (-> s5-0 trans y) arg3 (-> pp clock frames-per-second))) + ) + (when (logtest? arg0 (align-opts adjust-xz-vel)) + (set! (-> a0-1 x) (-> arg1 x)) + (set! (-> a0-1 z) (-> arg1 z)) + (let* ((v1-11 arg1) + (f0-9 (sqrtf (+ (* (-> v1-11 x) (-> v1-11 x)) (* (-> v1-11 z) (-> v1-11 z))))) + (v1-13 (-> s5-0 trans)) + (f0-11 (* (fmin f0-9 (* (sqrtf (+ (* (-> v1-13 x) (-> v1-13 x)) (* (-> v1-13 z) (-> v1-13 z)))) arg4)) + (-> pp clock frames-per-second) + ) + ) + (t9-0 vector-xz-normalize!) + ) + (set! (-> this last-speed) f0-11) + (t9-0 a0-1 f0-11) + ) + ) + ) + (if (logtest? arg0 (align-opts adjust-quat)) + (quaternion-normalize! (quaternion*! (-> this process root quat) (-> this process root quat) (-> s5-0 quat))) + ) + ) + ) + (-> this process root) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/anim/fma-sphere_REF.gc b/test/decompiler/reference/jak3/engine/anim/fma-sphere_REF.gc index 93f668307f2..a14b8bb8fa6 100644 --- a/test/decompiler/reference/jak3/engine/anim/fma-sphere_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/fma-sphere_REF.gc @@ -99,7 +99,7 @@ (vehicle-impulse-factor 1.0) (mode 'eco-red) (attacker-velocity (-> self root transv)) - (knock (knocked-type knocked-type-2)) + (knock (knocked-type explode-or-darkjak)) ) ) ) @@ -301,7 +301,3 @@ ) (go-virtual idle) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc new file mode 100644 index 00000000000..4c96e6501aa --- /dev/null +++ b/test/decompiler/reference/jak3/engine/anim/joint-exploder_REF.gc @@ -0,0 +1,1014 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type joint-exploder-tuning +(deftype joint-exploder-tuning (structure) + ((explosion uint64) + (duration time-frame) + (gravity float) + (rot-speed float) + (bounds-inflate float) + (max-probes uint8) + (max-probe-width float) + (max-probe-height float) + (max-probe-depth float) + (friction float) + (fountain-rand-transv-lo vector :inline) + (fountain-rand-transv-hi vector :inline) + (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) + (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi data 0)) + (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi data 1)) + (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi data 2)) + (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi data 3)) + (hit-xz-reaction float) + (hit-y-reaction float) + ) + (:methods + (new (symbol type uint) _type_) + ) + ) + +;; definition for method 3 of type joint-exploder-tuning +(defmethod inspect ((this joint-exploder-tuning)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-exploder-tuning) + (format #t "~1Texplosion: ~D~%" (-> this explosion)) + (format #t "~1Tduration: ~D~%" (-> this duration)) + (format #t "~1Tgravity: ~f~%" (-> this gravity)) + (format #t "~1Trot-speed: ~f~%" (-> this rot-speed)) + (format #t "~1Tbounds-inflate: ~f~%" (-> this bounds-inflate)) + (format #t "~1Tmax-probes: ~D~%" (-> this max-probes)) + (format #t "~1Tmax-probe-width: ~f~%" (-> this max-probe-width)) + (format #t "~1Tmax-probe-height: ~f~%" (-> this max-probe-height)) + (format #t "~1Tmax-probe-depth: ~f~%" (-> this max-probe-depth)) + (format #t "~1Tfriction: ~f~%" (-> this friction)) + (format #t "~1Tfountain-rand-transv-lo: #~%" (-> this fountain-rand-transv-lo)) + (format #t "~1Tfountain-rand-transv-hi: #~%" (-> this fountain-rand-transv-hi)) + (format #t "~1Taway-from-focal-pt: #~%" (-> this fountain-rand-transv-lo)) + (format #t "~1Taway-from-rand-transv-xz-lo: ~f~%" (-> this fountain-rand-transv-hi x)) + (format #t "~1Taway-from-rand-transv-xz-hi: ~f~%" (-> this fountain-rand-transv-hi y)) + (format #t "~1Taway-from-rand-transv-y-lo: ~f~%" (-> this fountain-rand-transv-hi z)) + (format #t "~1Taway-from-rand-transv-y-hi: ~f~%" (-> this fountain-rand-transv-hi w)) + (format #t "~1Thit-xz-reaction: ~f~%" (-> this hit-xz-reaction)) + (format #t "~1Thit-y-reaction: ~f~%" (-> this hit-y-reaction)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-static-joint-params +(deftype joint-exploder-static-joint-params (structure) + ((joint-index int16) + (parent-joint-index int16) + ) + ) + +;; definition for method 3 of type joint-exploder-static-joint-params +(defmethod inspect ((this joint-exploder-static-joint-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-exploder-static-joint-params) + (format #t "~1Tjoint-index: ~D~%" (-> this joint-index)) + (format #t "~1Tparent-joint-index: ~D~%" (-> this parent-joint-index)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-static-params +(deftype joint-exploder-static-params (basic) + ((joints (array joint-exploder-static-joint-params)) + (collide-spec collide-spec) + (art-level symbol) + (collide-sound sound-name) + (collide-sound-interval time-frame) + ) + ) + +;; definition for method 3 of type joint-exploder-static-params +;; INFO: Used lq/sq +(defmethod inspect ((this joint-exploder-static-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tjoints: ~A~%" (-> this joints)) + (format #t "~1Tcollide-spec: ~D~%" (-> this collide-spec)) + (format #t "~1Tart-level: ~A~%" (-> this art-level)) + (format #t "~1Tcollide-sound: ~D~%" (-> this collide-sound)) + (format #t "~1Tcollide-sound-interval: ~D~%" (-> this collide-sound-interval)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-joint +(deftype joint-exploder-joint (structure) + ((next int16) + (prev int16) + (joint-index int16) + (mat matrix :inline) + (rmat matrix :inline) + (update-rmat matrix :inline) + (transv vector :inline) + (prev-pos vector :inline) + ) + ) + +;; definition for method 3 of type joint-exploder-joint +(defmethod inspect ((this joint-exploder-joint)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-exploder-joint) + (format #t "~1Tnext: ~D~%" (-> this next)) + (format #t "~1Tprev: ~D~%" (-> this prev)) + (format #t "~1Tjoint-index: ~D~%" (-> this joint-index)) + (format #t "~1Tmat: #~%" (-> this mat)) + (format #t "~1Trmat: #~%" (-> this rmat)) + (format #t "~1Tupdate-rmat: #~%" (-> this update-rmat)) + (format #t "~1Ttransv: #~%" (-> this transv)) + (format #t "~1Tprev-pos: #~%" (-> this prev-pos)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-joints +(deftype joint-exploder-joints (basic) + ((num-joints int32) + (joint joint-exploder-joint :inline :dynamic) + ) + (:methods + (new (symbol type joint-exploder-static-params) _type_) + ) + ) + +;; definition for method 3 of type joint-exploder-joints +(defmethod inspect ((this joint-exploder-joints)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tnum-joints: ~D~%" (-> this num-joints)) + (format #t "~1Tjoint[0] @ #x~X~%" (-> this joint)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-list +(deftype joint-exploder-list (structure) + ((head int32) + (pre-moved? symbol) + (bbox-valid? symbol) + (probeless? symbol) + (bbox bounding-box :inline) + ) + ) + +;; definition for method 3 of type joint-exploder-list +(defmethod inspect ((this joint-exploder-list)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'joint-exploder-list) + (format #t "~1Thead: ~D~%" (-> this head)) + (format #t "~1Tpre-moved?: ~A~%" (-> this pre-moved?)) + (format #t "~1Tbbox-valid?: ~A~%" (-> this bbox-valid?)) + (format #t "~1Tprobeless?: ~A~%" (-> this probeless?)) + (format #t "~1Tbbox: #~%" (-> this bbox)) + (label cfg-4) + this + ) + +;; definition of type joint-exploder-list-array +(deftype joint-exploder-list-array (inline-array-class) + ((data joint-exploder-list :inline :dynamic) + ) + ) + +;; definition for method 3 of type joint-exploder-list-array +(defmethod inspect ((this joint-exploder-list-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> joint-exploder-list-array heap-base) (the-as uint 48)) + +;; definition of type joint-exploder +(deftype joint-exploder (process-drawable) + ((parent (pointer process-drawable) :override) + (die-if-below-y float) + (die-if-beyond-xz-dist-sqrd float) + (joints joint-exploder-joints) + (static-params joint-exploder-static-params) + (anim art-joint-anim) + (scale-vector vector :inline) + (tuning joint-exploder-tuning :inline) + (lists joint-exploder-list-array) + (last-colsound-time time-frame) + ) + (:methods + (add-joint-to-list (_type_ joint-exploder-list int) int) + (update-bbox-for-joint (_type_ joint-exploder-list joint-exploder-joint) none) + (do-collision-response (_type_ joint-exploder-list) none) + (init-joint-list (_type_) none) + (remove-from-list-and-reset (_type_ joint-exploder-list int) int) + (final-adjust (_type_ joint-exploder-list int) int) + (integrate-and-kill (_type_ joint-exploder-list) none) + (remove-joint-from-list (_type_ joint-exploder-list int) int) + (adjust-bbox-for-limits-along-axis (_type_ joint-exploder-list int) joint-exploder-list) + (adjust-bbox-for-limits (_type_ joint-exploder-list) none) + ) + (:states + joint-exploder-shatter + ) + ) + +;; definition for method 3 of type joint-exploder +(defmethod inspect ((this joint-exploder)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tdie-if-below-y: ~f~%" (-> this die-if-below-y)) + (format #t "~2Tdie-if-beyond-xz-dist-sqrd: ~f~%" (-> this die-if-beyond-xz-dist-sqrd)) + (format #t "~2Tjoints: ~A~%" (-> this joints)) + (format #t "~2Tstatic-params: ~A~%" (-> this static-params)) + (format #t "~2Tanim: ~A~%" (-> this anim)) + (format #t "~2Tscale-vector: #~%" (-> this scale-vector)) + (format #t "~2Ttuning: #~%" (-> this tuning)) + (format #t "~2Tlists: ~A~%" (-> this lists)) + (format #t "~2Tlast-colsound-time: ~D~%" (-> this last-colsound-time)) + (label cfg-4) + this + ) + +;; definition for method 5 of type joint-exploder-joints +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this joint-exploder-joints)) + (the-as int (+ (-> this type size) (* 240 (-> this num-joints)))) + ) + +;; definition for method 0 of type joint-exploder-joints +(defmethod new joint-exploder-joints ((allocation symbol) (type-to-make type) (arg0 joint-exploder-static-params)) + (let* ((gp-0 (-> arg0 joints length)) + (v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) (* 240 gp-0))))) + ) + (set! (-> v0-0 num-joints) gp-0) + v0-0 + ) + ) + +;; definition for function joint-exploder-joint-callback +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun joint-exploder-joint-callback ((arg0 draw-control) (arg1 cspace-array) (arg2 joint-control)) + (let ((s4-0 (the-as joint-exploder (-> arg0 process)))) + (let ((s3-0 (-> s4-0 joints))) + (countdown (s2-0 (-> s3-0 num-joints)) + (let* ((v1-3 (-> s3-0 joint s2-0)) + (a0-5 (-> arg1 data (-> v1-3 joint-index) bone transform)) + ) + (matrix*! a0-5 (-> v1-3 rmat) (-> v1-3 mat)) + ) + ) + ) + (let ((s4-1 (-> s4-0 scale-vector))) + (countdown (s3-1 (-> arg1 length)) + (let ((a2-2 (-> arg1 data s3-1 bone transform))) + (scale-matrix! a2-2 s4-1 a2-2) + ) + ) + ) + ) + (let ((s4-2 (new 'stack-no-clear 'matrix))) + (set! (-> s4-2 rvec quad) (the-as uint128 0)) + (set! (-> s4-2 uvec quad) (the-as uint128 0)) + (set! (-> s4-2 fvec quad) (the-as uint128 0)) + (set! (-> s4-2 trans quad) (the-as uint128 0)) + (let ((f30-0 (-> arg0 bounds w))) + (matrix-4x4-inverse! s4-2 (-> arg1 data 0 bone transform)) + (set! (-> arg0 bounds w) 1.0) + (vector-matrix*! (-> arg0 bounds) (-> arg0 bounds) s4-2) + (set! (-> arg0 bounds w) f30-0) + ) + ) + 0 + (none) + ) + +;; definition for method 24 of type joint-exploder +;; INFO: Used lq/sq +(defmethod remove-from-list-and-reset ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let ((v0-0 (remove-joint-from-list this arg0 arg1))) + (let* ((v1-1 (-> this joints)) + (v1-2 (-> v1-1 joint arg1)) + ) + (set! (-> v1-2 mat rvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat uvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat fvec quad) (the-as uint128 0)) + (set! (-> v1-2 mat trans quad) (-> this root trans quad)) + ) + v0-0 + ) + ) + +;; definition for method 27 of type joint-exploder +(defmethod remove-joint-from-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let* ((v1-0 (-> this joints)) + (a2-1 (-> v1-0 joint arg1)) + (a0-4 (-> a2-1 prev)) + (v0-0 (-> a2-1 next)) + ) + (cond + ((>= a0-4 0) + (set! (-> v1-0 joint a0-4 next) v0-0) + (if (>= v0-0 0) + (set! (-> v1-0 joint v0-0 prev) a0-4) + ) + ) + (else + (set! (-> arg0 head) v0-0) + (cond + ((>= v0-0 0) + (let ((v1-2 (-> v1-0 joint v0-0))) + (set! (-> v1-2 prev) -1) + ) + ) + (else + (set! (-> arg0 bbox-valid?) #f) + ) + ) + ) + ) + v0-0 + ) + ) + +;; definition for method 20 of type joint-exploder +(defmethod add-joint-to-list ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (let* ((v1-0 (-> this joints)) + (a3-0 (-> v1-0 joint arg1)) + (a0-4 (-> arg0 head)) + ) + (set! (-> arg0 head) arg1) + (set! (-> a3-0 prev) -1) + (set! (-> a3-0 next) a0-4) + (when (>= a0-4 0) + (set! (-> v1-0 joint a0-4 prev) arg1) + arg1 + ) + ) + ) + +;; definition for method 21 of type joint-exploder +;; INFO: Used lq/sq +(defmethod update-bbox-for-joint ((this joint-exploder) (arg0 joint-exploder-list) (arg1 joint-exploder-joint)) + (let ((a1-1 (-> arg1 mat trans))) + (cond + ((-> arg0 bbox-valid?) + (add-point! (-> arg0 bbox) a1-1) + ) + (else + (set! (-> arg0 bbox-valid?) #t) + (set! (-> arg0 bbox min quad) (-> a1-1 quad)) + (set! (-> arg0 bbox max quad) (-> a1-1 quad)) + ) + ) + ) + (add-point! (-> arg0 bbox) (-> arg1 prev-pos)) + (none) + ) + +;; definition for method 28 of type joint-exploder +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs joint-exploder-list. +(defmethod adjust-bbox-for-limits-along-axis ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (local-vars + (sv-16 int) + (sv-32 int) + (sv-48 joint-exploder-joint) + (sv-64 int) + (sv-80 joint-exploder-joint) + (sv-96 int) + (sv-112 joint-exploder-joint) + ) + (let ((s4-0 (the-as object #f))) + (let ((v1-0 1)) + (until (= v1-0 (+ (-> this tuning max-probes) 1)) + (let ((a0-4 (-> this lists data v1-0))) + (when (< (-> a0-4 head) 0) + (set! s4-0 a0-4) + (goto cfg-6) + ) + ) + (+! v1-0 1) + ) + ) + (label cfg-6) + (cond + ((the-as joint-exploder-list s4-0) + (set! (-> (the-as joint-exploder-list s4-0) pre-moved?) #t) + (set! (-> (the-as joint-exploder-list s4-0) bbox-valid?) #f) + ) + (else + (set! s4-0 (-> this lists data)) + ) + ) + (set! (-> arg0 bbox-valid?) #f) + (let ((s2-0 (-> this joints))) + (set! sv-32 (-> arg0 head)) + (let ((s1-0 0) + (s0-0 0) + ) + (let ((v1-8 arg1)) + (cond + ((zero? v1-8) + (let ((f30-0 (* 0.5 (+ (-> arg0 bbox min x) (-> arg0 bbox max x))))) + (while (>= sv-32 0) + (set! sv-48 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-48 mat trans x) f30-0) + (set! sv-16 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-16) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-48) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-48) + (set! sv-32 (-> sv-48 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ((= v1-8 1) + (let ((f30-1 (* 0.5 (+ (-> arg0 bbox min y) (-> arg0 bbox max y))))) + (while (>= sv-32 0) + (set! sv-80 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-80 mat trans y) f30-1) + (set! sv-64 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-64) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-80) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-80) + (set! sv-32 (-> sv-80 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ((= v1-8 2) + (let ((f30-2 (* 0.5 (+ (-> arg0 bbox min z) (-> arg0 bbox max z))))) + (while (>= sv-32 0) + (set! sv-112 (-> s2-0 joint sv-32)) + (cond + ((>= (-> sv-112 mat trans z) f30-2) + (set! sv-96 (remove-joint-from-list this arg0 sv-32)) + (add-joint-to-list this (the-as joint-exploder-list s4-0) sv-32) + (set! sv-32 sv-96) + (update-bbox-for-joint this (the-as joint-exploder-list s4-0) sv-112) + (+! s0-0 1) + ) + (else + (update-bbox-for-joint this arg0 sv-112) + (set! sv-32 (-> sv-112 next)) + (+! s1-0 1) + ) + ) + ) + ) + ) + ) + ) + (cond + ((zero? s0-0) + (final-adjust this arg0 arg1) + ) + ((zero? s1-0) + (if (not (-> (the-as joint-exploder-list s4-0) probeless?)) + (final-adjust this (the-as joint-exploder-list s4-0) arg1) + ) + ) + ) + ) + ) + (the-as joint-exploder-list s4-0) + ) + ) + +;; definition for method 25 of type joint-exploder +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs int. +(defmethod final-adjust ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int)) + (local-vars (sv-48 int) (sv-64 (inline-array joint-exploder-list)) (sv-80 joint-exploder-joint)) + (set! (-> arg0 bbox-valid?) #f) + (let ((s3-0 (-> this joints)) + (s2-0 (-> arg0 head)) + ) + (while (>= s2-0 0) + (set! sv-80 (-> s3-0 joint s2-0)) + (let ((s1-0 (new 'stack-no-clear 'bounding-box)) + (s0-0 (-> arg0 bbox-valid?)) + ) + (set! (-> s1-0 min quad) (-> arg0 bbox min quad)) + (set! (-> s1-0 max quad) (-> arg0 bbox max quad)) + (update-bbox-for-joint this arg0 sv-80) + (let* ((v1-7 arg1) + (v1-8 (cond + ((zero? v1-7) + (< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x))) + ) + ((= v1-7 1) + (< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y))) + ) + ((= v1-7 2) + (< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z))) + ) + ) + ) + ) + (set! s2-0 (cond + (v1-8 + (set! sv-48 (remove-joint-from-list this arg0 s2-0)) + (set! sv-64 (-> this lists data)) + (add-joint-to-list this (the-as joint-exploder-list sv-64) s2-0) + (set! s2-0 sv-48) + (update-bbox-for-joint this (the-as joint-exploder-list sv-64) sv-80) + (set! (-> arg0 bbox-valid?) s0-0) + (set! (-> arg0 bbox min quad) (-> s1-0 min quad)) + (set! (-> arg0 bbox max quad) (-> s1-0 max quad)) + s2-0 + ) + (else + (-> sv-80 next) + ) + ) + ) + ) + ) + ) + ) + (the-as int #f) + ) + +;; definition for method 29 of type joint-exploder +;; WARN: Return type mismatch int vs none. +(defmethod adjust-bbox-for-limits ((this joint-exploder) (arg0 joint-exploder-list)) + (when (and (-> arg0 bbox-valid?) (>= (-> arg0 head) 0) (not (-> arg0 probeless?))) + (let ((a2-0 -1)) + (cond + ((< (-> this tuning max-probe-width) (- (-> arg0 bbox max x) (-> arg0 bbox min x))) + (set! a2-0 0) + ) + ((< (-> this tuning max-probe-height) (- (-> arg0 bbox max y) (-> arg0 bbox min y))) + (set! a2-0 1) + ) + ((< (-> this tuning max-probe-depth) (- (-> arg0 bbox max z) (-> arg0 bbox min z))) + (set! a2-0 2) + ) + ) + (when (>= a2-0 0) + (let ((a1-2 (adjust-bbox-for-limits-along-axis this arg0 a2-0))) + (if (not (-> a1-2 probeless?)) + (adjust-bbox-for-limits this a1-2) + ) + ) + (adjust-bbox-for-limits this arg0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 26 of type joint-exploder +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod integrate-and-kill ((this joint-exploder) (arg0 joint-exploder-list)) + (local-vars (v1-8 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (set! (-> arg0 bbox-valid?) #f) + (set! (-> arg0 pre-moved?) #t) + (let ((s4-0 (-> this joints)) + (f30-0 (* (-> this tuning gravity) (seconds-per-frame))) + (s3-0 (-> arg0 head)) + ) + (while (>= s3-0 0) + (let* ((s2-0 (-> s4-0 joint s3-0)) + (s1-0 (-> s2-0 mat trans)) + ) + (set! (-> s2-0 prev-pos quad) (-> s1-0 quad)) + (+! (-> s2-0 transv y) f30-0) + (when (< 0.0 (-> this tuning friction)) + (.lvf vf1 (&-> (-> s2-0 transv) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-8 vf1) + (let* ((f0-4 v1-8) + (f1-5 (* 0.00001 (seconds-per-frame) (-> this tuning friction) f0-4)) + (f0-6 (- (sqrtf f0-4) f1-5)) + ) + (if (< f0-6 0.0) + (set! f0-6 0.0) + ) + (vector-normalize! (-> s2-0 transv) f0-6) + ) + ) + (vector-v+! s1-0 s1-0 (-> s2-0 transv)) + (matrix*! (-> s2-0 rmat) (-> s2-0 rmat) (-> s2-0 update-rmat)) + (cond + ((or (< (-> s1-0 y) (-> this die-if-below-y)) + (< (-> this die-if-beyond-xz-dist-sqrd) (vector-vector-xz-distance s1-0 (-> this root trans))) + ) + (set! s3-0 (remove-from-list-and-reset this arg0 s3-0)) + ) + (else + (update-bbox-for-joint this arg0 s2-0) + (set! s3-0 (-> s2-0 next)) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 22 of type joint-exploder +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-collision-response ((this joint-exploder) (arg0 joint-exploder-list)) + (let ((s5-0 (new 'stack-no-clear 'collide-query))) + (set! (-> s5-0 collide-with) (-> this static-params collide-spec)) + (set! (-> s5-0 ignore-process0) this) + (set! (-> s5-0 ignore-process1) #f) + (set! (-> s5-0 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> s5-0 action-mask) (collide-action solid)) + (mem-copy! (the-as pointer (-> s5-0 bbox)) (the-as pointer (-> arg0 bbox)) 32) + (fill-using-bounding-box *collide-cache* s5-0) + ) + (let ((s5-1 (-> this joints)) + (v1-6 (-> arg0 head)) + ) + (while (>= v1-6 0) + (let ((s4-1 (-> s5-1 joint v1-6))) + (let ((s3-0 (-> s4-1 mat trans)) + (s2-0 (new 'stack-no-clear 'collide-query)) + ) + (vector-! (-> s2-0 move-dist) s3-0 (-> s4-1 prev-pos)) + (set! (-> s2-0 start-pos quad) (-> s4-1 prev-pos quad)) + (let ((v1-11 s2-0)) + (set! (-> v1-11 radius) 40.96) + (set! (-> v1-11 collide-with) (-> this static-params collide-spec)) + (set! (-> v1-11 ignore-process0) #f) + (set! (-> v1-11 ignore-process1) #f) + (set! (-> v1-11 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-11 action-mask) (collide-action solid)) + ) + (when (>= (probe-using-line-sphere *collide-cache* s2-0) 0.0) + (set! (-> s3-0 quad) (-> s2-0 best-other-tri intersect quad)) + (let* ((v1-16 (-> s4-1 transv)) + (f28-0 (sqrtf (+ (* (-> v1-16 x) (-> v1-16 x)) (* (-> v1-16 z) (-> v1-16 z))))) + ) + (vector-reflect! (-> s4-1 transv) (-> s4-1 transv) (-> s2-0 best-other-tri normal)) + (let ((f30-0 (-> s4-1 transv y))) + (set! (-> s4-1 transv y) 0.0) + (vector-normalize! (-> s4-1 transv) (* f28-0 (-> this tuning hit-xz-reaction))) + (set! (-> s4-1 transv y) (* f30-0 (-> this tuning hit-y-reaction))) + ) + ) + (let ((v1-20 (-> this static-params collide-sound))) + (when (and v1-20 + (nonzero? v1-20) + (< (-> this static-params collide-sound-interval) (- (current-time) (-> this last-colsound-time))) + ) + (sound-play-by-name + (-> this static-params collide-sound) + (new-sound-id) + 1024 + 0 + 0 + (sound-group) + (-> s4-1 transv) + ) + (set-time! (-> this last-colsound-time)) + ) + ) + (+! (-> s3-0 y) (* 40.96 (-> s2-0 best-other-tri normal y))) + (set! (-> s3-0 w) 1.0) + (matrix-lerp! (-> s4-1 update-rmat) (-> s4-1 update-rmat) *identity-matrix* 0.5) + ) + ) + (set! v1-6 (-> s4-1 next)) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate joint-exploder-shatter (joint-exploder) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (let* ((f1-0 (the float (- (current-time) (-> self state-time)))) + (f0-2 (- 1.0 (/ f1-0 (the float (-> self tuning duration))))) + (f1-2 (- 1.0 (/ f1-0 (* 0.75 (the float (-> self tuning duration)))))) + (f1-3 (fmax 0.0001 f1-2)) + (f0-3 (fmax 0.0001 f0-2)) + ) + (set-vector! (-> self scale-vector) f0-3 f1-3 f0-3 1.0) + ) + (dotimes (v1-11 (the-as int (+ (-> self tuning max-probes) 1))) + (set! (-> self lists data v1-11 pre-moved?) #f) + ) + (dotimes (gp-0 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((s5-0 (-> self lists data gp-0))) + (when (>= (-> s5-0 head) 0) + (when (not (-> s5-0 pre-moved?)) + (integrate-and-kill self s5-0) + (if (nonzero? gp-0) + (adjust-bbox-for-limits self s5-0) + ) + ) + ) + ) + ) + (let ((gp-1 (new 'stack-no-clear 'bounding-box))) + (let ((v1-31 (-> self root trans))) + (set! (-> gp-1 min quad) (-> v1-31 quad)) + (set! (-> gp-1 max quad) (-> v1-31 quad)) + ) + (dotimes (s5-1 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((s4-0 (-> self lists data s5-1))) + (if (-> s4-0 bbox-valid?) + (add-box! gp-1 (-> s4-0 bbox)) + ) + (if (nonzero? s5-1) + (do-collision-response self s4-0) + ) + ) + ) + (let ((s5-2 (-> self draw bounds))) + (vector-average! s5-2 (-> gp-1 min) (-> gp-1 max)) + (set! (-> s5-2 w) (+ (vector-vector-distance s5-2 (-> gp-1 max)) (-> self tuning bounds-inflate))) + ) + ) + 0 + ) + :code (behavior () + (set-time! (-> self state-time)) + (until (time-elapsed? (-> self state-time) (-> self tuning duration)) + (suspend) + (ja :num! (loop!)) + ) + ) + :post ja-post + ) + +;; definition for method 23 of type joint-exploder +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-joint-list ((this joint-exploder)) + (let ((gp-0 (-> this joints))) + (dotimes (s4-0 (-> gp-0 num-joints)) + (let ((v1-2 (-> this static-params joints s4-0)) + (s3-0 (-> gp-0 joint s4-0)) + ) + (let ((a0-6 (-> v1-2 parent-joint-index))) + (set! (-> s3-0 prev) (+ s4-0 -1)) + (set! (-> s3-0 next) (+ s4-0 1)) + (set! (-> s3-0 joint-index) (-> v1-2 joint-index)) + (cond + ((>= a0-6 0) + (if (zero? a0-6) + (set! a0-6 (-> v1-2 joint-index)) + ) + (let* ((a3-0 (-> this parent 0 node-list data a0-6 bone transform)) + (a2-0 (-> s3-0 mat)) + (v1-9 (-> a3-0 rvec quad)) + (a0-8 (-> a3-0 uvec quad)) + (a1-4 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-0 rvec quad) v1-9) + (set! (-> a2-0 uvec quad) a0-8) + (set! (-> a2-0 fvec quad) a1-4) + (set! (-> a2-0 trans quad) a3-1) + ) + (matrix-identity! (-> s3-0 rmat)) + ) + (else + (let* ((a3-2 (-> this node-list data (-> v1-2 joint-index) bone transform)) + (a2-1 (-> s3-0 mat)) + (v1-15 (-> a3-2 rvec quad)) + (a0-11 (-> a3-2 uvec quad)) + (a1-5 (-> a3-2 fvec quad)) + (a3-3 (-> a3-2 trans quad)) + ) + (set! (-> a2-1 rvec quad) v1-15) + (set! (-> a2-1 uvec quad) a0-11) + (set! (-> a2-1 fvec quad) a1-5) + (set! (-> a2-1 trans quad) a3-3) + ) + (matrix-identity! (-> s3-0 rmat)) + ) + ) + ) + (case (-> this tuning explosion) + ((1) + (vector-! (-> s3-0 transv) (-> s3-0 mat trans) (-> this tuning fountain-rand-transv-lo)) + (vector-normalize! + (-> s3-0 transv) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi x) (-> this tuning fountain-rand-transv-hi y)) + ) + (+! (-> s3-0 transv y) + (rand-vu-float-range (-> this tuning fountain-rand-transv-hi z) (-> this tuning fountain-rand-transv-hi w)) + ) + (set! (-> s3-0 transv w) 1.0) + ) + (else + (let ((s0-0 (-> this tuning fountain-rand-transv-lo)) + (s1-1 (-> this tuning fountain-rand-transv-hi)) + ) + (set-vector! + (-> s3-0 transv) + (rand-vu-float-range (-> s0-0 x) (-> s1-1 x)) + (rand-vu-float-range (-> s0-0 y) (-> s1-1 y)) + (rand-vu-float-range (-> s0-0 z) (-> s1-1 z)) + 1.0 + ) + ) + ) + ) + (let ((s2-3 (new 'stack-no-clear 'vector)) + (s1-2 (new 'stack-no-clear 'quaternion)) + ) + (rand-vu-sphere-point-uniform! s2-3 1.0) + (vector-normalize! s2-3 1.0) + (quaternion-vector-angle! s1-2 s2-3 (* 182.04445 (-> this tuning rot-speed))) + (quaternion->matrix (-> s3-0 update-rmat) s1-2) + ) + ) + ) + (when (nonzero? (-> gp-0 num-joints)) + (let ((v1-31 (-> gp-0 joint (+ (-> gp-0 num-joints) -1)))) + (set! (-> v1-31 next) -1) + ) + (let ((v1-33 (-> this lists data 1))) + (set! (-> v1-33 head) 0) + (let ((s5-1 (-> v1-33 bbox))) + (let ((v1-34 (-> gp-0 joint 0 mat trans))) + (set! (-> s5-1 min quad) (-> v1-34 quad)) + (set! (-> s5-1 max quad) (-> v1-34 quad)) + ) + (dotimes (s4-1 (-> gp-0 num-joints)) + (add-point! s5-1 (the-as vector (+ (the-as uint (-> gp-0 joint 0 mat trans)) (* 240 s4-1)))) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 7 of type joint-exploder +;; WARN: Return type mismatch process-drawable vs joint-exploder. +(defmethod relocate ((this joint-exploder) (offset int)) + (if (nonzero? (-> this joints)) + (&+! (-> this joints) offset) + ) + (if (nonzero? (-> this lists)) + (&+! (-> this lists) offset) + ) + (the-as joint-exploder ((method-of-type process-drawable relocate) this offset)) + ) + +;; definition for function joint-exploder-init-by-other +;; INFO: Used lq/sq +(defbehavior joint-exploder-init-by-other joint-exploder ((arg0 skeleton-group) (arg1 int) (arg2 joint-exploder-tuning) (arg3 joint-exploder-static-params)) + (set! (-> self static-params) arg3) + (set! (-> self die-if-beyond-xz-dist-sqrd) 10485760000.0) + (mem-copy! (the-as pointer (-> self tuning)) (the-as pointer arg2) 88) + (set! (-> self joints) (new 'process 'joint-exploder-joints arg3)) + (set! (-> self lists) + (new 'process 'joint-exploder-list-array (the-as int (+ (-> self tuning max-probes) 1))) + ) + (dotimes (v1-4 (the-as int (+ (-> self tuning max-probes) 1))) + (let ((a0-7 (-> self lists data v1-4))) + (set! (-> a0-7 head) -1) + (set! (-> a0-7 bbox-valid?) #f) + (set! (-> a0-7 pre-moved?) #f) + (set! (-> a0-7 probeless?) #f) + ) + ) + (let ((v1-8 (-> self lists data))) + (set! (-> v1-8 0 probeless?) #t) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> self parent 0 root trans quad)) + (quaternion-copy! (-> self root quat) (-> self parent 0 root quat)) + (set! (-> self root scale quad) (-> self parent 0 root scale quad)) + (when (-> arg3 art-level) + (let ((a1-8 (entity-actor-from-level-name (-> arg3 art-level)))) + (if a1-8 + (process-entity-set! self a1-8) + ) + ) + ) + (initialize-skeleton self arg0 (the-as pair 0)) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! (-> self anim) (the-as art-joint-anim (-> self draw art-group data arg1))) + (ja-channel-set! 1) + (ja :group! (-> self anim) :num! min) + (ja-post) + (init-joint-list self) + (set! (-> self die-if-below-y) (+ -102400.0 (-> self root trans y))) + (set! (-> self skel postbind-function) joint-exploder-joint-callback) + (set! (-> self last-colsound-time) 0) + (go joint-exploder-shatter) + ) + +;; definition for method 0 of type joint-exploder-tuning +;; WARN: Return type mismatch structure vs joint-exploder-tuning. +(defmethod new joint-exploder-tuning ((allocation symbol) (type-to-make type) (arg0 uint)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((v0-0 (t9-0 allocation v1-1))) + (set! (-> (the-as joint-exploder-tuning v0-0) explosion) arg0) + (set! (-> (the-as joint-exploder-tuning v0-0) duration) (seconds 2)) + (set! (-> (the-as joint-exploder-tuning v0-0) gravity) -286720.0) + (set! (-> (the-as joint-exploder-tuning v0-0) rot-speed) 8.4) + (set! (-> (the-as joint-exploder-tuning v0-0) friction) 0.0) + (set! (-> (the-as joint-exploder-tuning v0-0) bounds-inflate) 16384.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-width) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-height) 24576.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probe-depth) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) max-probes) (the-as uint 4)) + (set! (-> (the-as joint-exploder-tuning v0-0) hit-xz-reaction) 0.75) + (set! (-> (the-as joint-exploder-tuning v0-0) hit-y-reaction) 0.7) + (cond + ((zero? arg0) + (set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0) + (set-vector! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0) + ) + ((= arg0 1) + (vector-reset! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-lo)) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi x) 49152.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi y) 163840.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi z) 20480.0) + (set! (-> (the-as joint-exploder-tuning v0-0) fountain-rand-transv-hi w) 61440.0) + ) + ) + (the-as joint-exploder-tuning v0-0) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/anim/joint_REF.gc b/test/decompiler/reference/jak3/engine/anim/joint_REF.gc index e137e2b0a23..c7d4f26bb4a 100644 --- a/test/decompiler/reference/jak3/engine/anim/joint_REF.gc +++ b/test/decompiler/reference/jak3/engine/anim/joint_REF.gc @@ -679,11 +679,11 @@ ) ;; definition for function joint-control-cleanup -;; WARN: Return type mismatch symbol vs none. (defun joint-control-cleanup ((jc joint-control) (heap kheap) (ja art-joint-anim)) "Remove all animations that are stored on the given heap and return those slots to a safe default." (let ((v1-0 (-> heap base)) (a1-1 (-> heap top-base)) + (v0-0 #f) ) (countdown (a3-1 (+ (-> jc active-channels) (-> jc float-channels))) (let ((t0-3 (-> jc channel a3-1))) @@ -693,12 +693,12 @@ (set! (-> t0-3 frame-group) ja) (set! (-> t0-3 frame-num) 0.0) (set! (-> t0-3 num-func) num-func-identity) - #t + (set! v0-0 #t) ) ) ) + v0-0 ) - (none) ) ;; definition for function joint-control-channel-eval @@ -2044,8 +2044,8 @@ (let ((a0-9 (-> jc interp-select 0))) (dotimes (a1-5 2) (when (logtest? a0-9 1) - (let* ((a2-7 (the-as object (-> dst matrices a1-5 rvec))) - (t2-0 (the-as (inline-array vector) (-> v1-9 matrices a1-5 rvec))) + (let* ((a2-7 (the-as object (-> dst matrices a1-5))) + (t2-0 (the-as (inline-array vector) (-> v1-9 matrices a1-5))) (a3-3 (-> t2-0 0 quad)) (t0-0 (-> t2-0 1 quad)) (t1-0 (-> t2-0 2 quad)) diff --git a/test/decompiler/reference/jak3/engine/camera/pov-camera-h_REF.gc b/test/decompiler/reference/jak3/engine/camera/pov-camera-h_REF.gc index f5541cffe54..e5dc0837c7d 100644 --- a/test/decompiler/reference/jak3/engine/camera/pov-camera-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/camera/pov-camera-h_REF.gc @@ -20,11 +20,11 @@ pov-camera-startup ) (:methods - (pov-camera-method-25 () none) - (pov-camera-method-26 () none) - (pov-camera-method-27 () none) - (pov-camera-method-28 () none) - (pov-camera-method-29 () none) + (abort? (_type_) symbol) + (target-grabbed? (_type_) symbol) + (set-stack-size! (_type_) none) + (pov-camera-method-28 (_type_) none) + (target-released? (_type_) symbol) ) ) diff --git a/test/decompiler/reference/jak3/engine/camera/pov-camera_REF.gc b/test/decompiler/reference/jak3/engine/camera/pov-camera_REF.gc new file mode 100644 index 00000000000..ea0a60106ad --- /dev/null +++ b/test/decompiler/reference/jak3/engine/camera/pov-camera_REF.gc @@ -0,0 +1,429 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 25 of type pov-camera +(defmethod abort? ((this pov-camera)) + (when (or (and (time-elapsed? (-> this debounce-start-time) (seconds 0.2)) (cpad-pressed? 0 triangle)) + (logtest? (-> this flags) (pov-camera-flag allow-abort)) + ) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (when (logtest? (-> this flags) (pov-camera-flag notify-of-abort)) + (send-event (handle->process (-> this notify-handle)) 'notify 'abort-request) + #t + ) + ) + ) + +;; definition for method 26 of type pov-camera +(defmethod target-grabbed? ((this pov-camera)) + (or (not *target*) (process-grab? *target* #f)) + ) + +;; definition for method 29 of type pov-camera +(defmethod target-released? ((this pov-camera)) + (or (not *target*) (process-release? *target*)) + ) + +;; failed to figure out what this is: +(defstate pov-camera-startup (pov-camera) + :virtual #t + :code (behavior () + (go-virtual pov-camera-start-playing) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-start-playing (pov-camera) + :virtual #t + :code (behavior () + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not (logtest? (-> self flags) (pov-camera-flag pcf3))) + (while (not (target-grabbed? self)) + (suspend) + ) + ) + (let ((gp-0 0)) + (let ((v1-10 (the-as joint (get-art-by-name-method (-> self draw jgeo) "camera" (the-as type #f))))) + (if v1-10 + (set! gp-0 (+ (-> v1-10 number) 1)) + ) + ) + (let ((v1-13 (process-spawn othercam self gp-0 #t #t :name "othercam" :to self))) + (send-event (ppointer->process v1-13) 'mask (-> self mask-to-clear)) + ) + ) + (go-virtual pov-camera-playing) + ) + ) + +;; definition for function pov-camera-play-and-reposition +;; WARN: Return type mismatch int vs none. +(defbehavior pov-camera-play-and-reposition pov-camera ((arg0 art-joint-anim) (arg1 vector) (arg2 float)) + (let ((s4-0 #f)) + (ja-no-eval :group! arg0 :num! (seek! max arg2) :frame-num 0.0) + (until (ja-done? 0) + (let ((v1-4 (and (not s4-0) (< (the float (+ (-> (ja-group) frames num-frames) -4)) (ja-frame-num 0))))) + (when v1-4 + (set! s4-0 #t) + (send-event *camera* 'teleport-to-vector-start-string arg1) + ) + ) + (suspend) + (ja :num! (seek! max arg2)) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate pov-camera-playing (pov-camera) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('abort) + (when (logtest? (-> self flags) (pov-camera-flag notify-of-abort)) + (logior! (-> self flags) (pov-camera-flag allow-abort)) + (if (= (-> self anim-name type) string) + (go-virtual pov-camera-abort) + ) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self debounce-start-time)) + (if (= (-> self anim-name type) string) + (backup-load-state-and-set-cmds *load-state* (-> self command-list)) + ) + ) + :exit (behavior () + (if (= (-> self anim-name type) string) + (restore-load-state-and-cleanup *load-state*) + ) + (remove-setting! 'music-volume) + (remove-setting! 'sfx-volume) + ) + :code (behavior () + (add-setting! 'music-volume 'rel (-> self music-volume-movie) 0) + (add-setting! 'sfx-volume 'rel (-> self sfx-volume-movie) 0) + (cond + ((= (-> self anim-name type) string) + (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (abort? self) + (suspend) + (ja :num! (seek!)) + ) + ) + ((= (-> self anim-name type) spool-anim) + (ja-play-spooled-anim + (the-as spool-anim (-> self anim-name)) + (the-as art-joint-anim #f) + (the-as art-joint-anim #f) + (method-of-object self abort?) + (spooler-flags blackout-on-stall) + ) + ) + ) + (go-virtual pov-camera-done-playing) + ) + :post (behavior () + (if (= (-> self anim-name type) string) + (execute-commands-up-to *load-state* (ja-aframe-num 0)) + ) + (ja-post) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-abort (pov-camera) + :virtual #t + :enter (behavior () + (logior! (-> self flags) (pov-camera-flag allow-abort)) + ) + :code (behavior () + (set-blackout-frames (seconds 0.035)) + (suspend) + (suspend) + (go-virtual pov-camera-done-playing) + ) + ) + +;; failed to figure out what this is: +(defstate pov-camera-done-playing (pov-camera) + :virtual #t + :code (behavior () + (while (not (target-released? self)) + (suspend) + ) + (send-event (handle->process (-> self notify-handle)) 'notify 'die) + (suspend) + (suspend) + (cleanup-for-death self) + (deactivate self) + ) + ) + +;; definition for method 28 of type pov-camera +;; WARN: Return type mismatch int vs none. +(defmethod pov-camera-method-28 ((this pov-camera)) + 0 + (none) + ) + +;; definition for method 27 of type pov-camera +;; WARN: Return type mismatch int vs none. +(defmethod set-stack-size! ((this pov-camera)) + (stack-size-set! (-> this main-thread) 512) + 0 + (none) + ) + +;; definition for function pov-camera-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior pov-camera-init-by-other pov-camera ((arg0 vector) (arg1 skeleton-group) (arg2 string) (arg3 pov-camera-flag) (arg4 process-drawable) (arg5 pair)) + (set-stack-size! self) + (set! (-> *game-info* pov-camera-handle) (process->handle self)) + (set! (-> self flags) arg3) + (set! (-> self command-list) arg5) + (set! (-> self music-volume-movie) 100.0) + (set! (-> self sfx-volume-movie) 100.0) + (if arg4 + (set! (-> self notify-handle) (process->handle arg4)) + (set! (-> self notify-handle) (the-as handle #f)) + ) + (set-time! (-> self debounce-start-time)) + (logclear! (-> self mask) (process-mask actor-pause movie enemy platform projectile)) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> arg0 quad)) + (when (and (logtest? (-> self flags) (pov-camera-flag inherit-orientation)) arg4) + (let ((v1-22 (if (type? arg4 process-drawable) + arg4 + ) + ) + ) + (quaternion-copy! (-> self root quat) (-> v1-22 root quat)) + ) + ) + (initialize-skeleton self arg1 (the-as pair 0)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! (-> self anim-name) arg2) + (cond + ((= (-> arg2 type) string) + (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) + (let ((s5-1 (get-art-by-name (-> self draw art-group) arg2 art-joint-anim))) + (if (not s5-1) + (go process-drawable-art-error arg2) + ) + (ja-channel-set! 1) + (set! (-> self skel root-channel 0 frame-group) s5-1) + ) + ) + ((= (-> arg2 type) spool-anim) + ) + ) + (set! (-> self mask-to-clear) (process-mask movie enemy platform projectile)) + (set! (-> self event-hook) (lambda :behavior pov-camera + ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('mask) + (let ((v0-0 (the-as number (-> arg3 param 0)))) + (set! (-> self mask-to-clear) (the-as process-mask v0-0)) + v0-0 + ) + ) + (('music-movie-volume) + (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0))) + ) + (('sfx-movie-volume) + (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 0))) + ) + ) + ) + ) + (pov-camera-method-28 self) + (go-virtual pov-camera-startup) + (none) + ) + +;; definition for function othercam-calc +(defun othercam-calc ((arg0 float)) + (set! (-> *camera-other-fov* data) (* 2.0 (atan (/ 14.941477 (* 20.3 arg0)) 1.0))) + ) + +;; failed to figure out what this is: +(defstate othercam-running (othercam) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('die) + (set! v0-0 #t) + (set! (-> self die?) (the-as symbol v0-0)) + v0-0 + ) + (('joint) + (cond + ((type? (-> block param 0) string) + (let ((v1-7 (the-as joint (get-art-by-name-method + (-> (the-as process-drawable (-> self hand process 0)) draw jgeo) + (the-as string (-> block param 0)) + (the-as type #f) + ) + ) + ) + ) + (when v1-7 + (set! v0-0 (+ (-> v1-7 number) 1)) + (set! (-> self cam-joint-index) (the-as int v0-0)) + v0-0 + ) + ) + ) + ((not (logtest? (-> block param 0) 7)) + (set! v0-0 (/ (the-as int (-> block param 0)) 8)) + (set! (-> self cam-joint-index) (the-as int v0-0)) + v0-0 + ) + ) + ) + (('target) + (set! v0-0 (process->handle (the-as process (-> block param 0)))) + (set! (-> self hand) (the-as handle v0-0)) + v0-0 + ) + (('mask) + (set! v0-0 (-> block param 0)) + (set! (-> self mask-to-clear) (the-as process-mask v0-0)) + v0-0 + ) + ) + ) + :enter (behavior () + (hide-hud-quick #f) + (case (-> self spooling?) + (('logo 'scene-player) + ) + (else + (add-setting! 'process-mask 'set 0.0 (-> self mask-to-clear)) + (add-setting! 'movie (process->ppointer self) 0.0 0) + (if (not (-> self border-value)) + (add-setting! 'border-mode (-> self border-value) 0.0 0) + ) + ) + ) + (set! (-> self had-valid-frame) #f) + (let ((gp-0 (-> self hand process 0))) + (vector<-cspace! + (-> self old-pos) + (-> (the-as process-drawable gp-0) node-list data (-> self cam-joint-index)) + ) + (let ((v1-20 (-> (the-as process-drawable gp-0) node-list data (-> self cam-joint-index) bone transform))) + (vector-normalize-copy! (-> self old-mat-z) (-> v1-20 fvec) -1.0) + ) + ) + (apply-settings *setting-control*) + ) + :exit (behavior () + (remove-setting! 'process-mask) + (apply-settings *setting-control*) + ) + :code (behavior () + (until #f + (let ((s2-0 (-> self hand process 0))) + (when (not s2-0) + (format #t "ERROR: othercam parent invalid~%") + (deactivate self) + ) + (set! (-> *camera-other-root* quad) (-> (the-as process-drawable s2-0) root trans quad)) + (let ((s4-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index) bone transform)) + (s3-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index) bone scale)) + (gp-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + (s1-0 + (or (!= (-> self spooling?) #t) + (logtest? (-> (the-as process-drawable s2-0) skel status) (joint-control-status valid-spooled-frame)) + ) + ) + ) + (vector<-cspace! s5-0 (-> (the-as process-drawable s2-0) node-list data (-> self cam-joint-index))) + (vector-normalize-copy! gp-0 (-> s4-0 fvec) -1.0) + (cond + ((< (vector-length (-> s4-0 fvec)) 0.1) + (set-blackout-frames (seconds 0.017)) + (if (not (logtest? (-> (the-as process-drawable s2-0) draw status) (draw-control-status no-draw no-draw-temp))) + (format 0 "ERROR: other camera zero matrix!~%") + ) + ) + (s1-0 + (when (not (-> self had-valid-frame)) + (set! (-> self had-valid-frame) #t) + (set! (-> self old-pos quad) (-> s5-0 quad)) + (set! (-> self old-mat-z quad) (-> gp-0 quad)) + ) + (set! (-> *camera-other-trans* quad) (-> s5-0 quad)) + (vector-normalize-copy! (-> *camera-other-matrix* rvec) (-> s4-0 rvec) -1.0) + (set! (-> *camera-other-matrix* rvec w) 0.0) + (vector-normalize-copy! (-> *camera-other-matrix* uvec) (-> s4-0 uvec) 1.0) + (set! (-> *camera-other-matrix* uvec w) 0.0) + (vector-normalize-copy! (-> *camera-other-matrix* fvec) (-> s4-0 fvec) -1.0) + (set! (-> *camera-other-matrix* fvec w) 0.0) + (vector-reset! (-> *camera-other-matrix* trans)) + (set! (-> self fov) (othercam-calc (-> s3-0 x))) + (set! *camera-look-through-other* 2) + (set! (-> self old-pos quad) (-> s5-0 quad)) + (set! (-> self old-mat-z quad) (-> gp-0 quad)) + ) + ) + ) + ) + (suspend) + (let ((a0-27 (-> self hand process 0))) + (when (or (-> self die?) (and (not (-> self survive-anim-end?)) (ja-anim-done? a0-27))) + (let ((gp-1 (current-time))) + (while (and (not (time-elapsed? gp-1 (seconds 60))) + (or (and (-> self entity) (not (is-object-visible? (-> self level) (-> self entity extra vis-id)))) + (< 81920.0 (vector-vector-distance (camera-pos) (-> *math-camera* trans))) + ) + ) + (suspend) + ) + ) + (deactivate self) + ) + ) + ) + #f + ) + ) + +;; definition for function othercam-init-by-other +;; WARN: Return type mismatch int vs none. +(defbehavior othercam-init-by-other othercam ((arg0 pov-camera) (arg1 int) (arg2 symbol) (arg3 symbol)) + (set! (-> self spooling?) arg3) + (case (-> self spooling?) + (('logo) + ) + (else + (set! (-> *game-info* other-camera-handle) (process->handle self)) + ) + ) + (set! (-> self hand) (process->handle arg0)) + (set! (-> self cam-joint-index) arg1) + (logclear! (-> self mask) (process-mask freeze pause menu actor-pause)) + (set! (-> self border-value) #f) + (set! (-> self die?) #f) + (set! (-> self survive-anim-end?) arg2) + (set! (-> self mask-to-clear) (process-mask movie enemy platform projectile)) + (set! (-> self event-hook) (-> othercam-running event)) + (go othercam-running) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/collide/collide-cache-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-cache-h_REF.gc index 17afe706d7a..40c7d9018ee 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-cache-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-cache-h_REF.gc @@ -153,7 +153,7 @@ It is not useful for ollision queries against a specific foreground object, like (collide-cache-method-9 () none) (fill-and-probe-using-line-sphere (_type_ collide-query) float) (fill-and-probe-using-spheres (_type_ collide-query) symbol) - (collide-cache-method-12 () none) + (fill-using-bounding-box (_type_ collide-query) none) (fill-using-line-sphere (_type_ collide-query) none) (collide-cache-method-14 () none) (collide-cache-method-15 () none) diff --git a/test/decompiler/reference/jak3/engine/collide/collide-shape-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-shape-h_REF.gc index 3e95259e15d..9dc30c46c8d 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-shape-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-shape-h_REF.gc @@ -222,7 +222,7 @@ (collide-shape-prim-method-13 () none) (collide-shape-prim-method-14 () none) (collide-shape-prim-method-15 () none) - (collide-shape-prim-method-16 () none) + (collide-with-collide-cache-prim-sphere (_type_ collide-query collide-cache-prim) none) (collide-shape-prim-method-17 () none) (collide-shape-prim-method-18 () none) (collide-shape-prim-method-19 () none) @@ -1424,8 +1424,8 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t (set-collide-with! (_type_ collide-spec) none) (set-collide-as! (_type_ collide-spec) none) (collide-shape-method-49 () none) - (collide-shape-method-50 () none) - (collide-shape-method-51 () none) + (send-shoves (_type_ process touching-shapes-entry float float float) symbol) + (above-ground? (_type_ collide-query vector collide-spec float float float) symbol) (water-info-init! (_type_ water-info collide-action) water-info) (collide-shape-method-53 () none) (collide-shape-method-54 () none) @@ -1479,14 +1479,16 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t ((rider-time time-frame) (rider-last-move vector :inline) (trans-old vector :inline) - (poly-pat pat-surface :offset 272) + (trans-old-old vector :inline :offset 240) + (trans-old-old-old vector :inline :offset 256) + (poly-pat pat-surface :offset 272) (cur-pat pat-surface) (ground-pat pat-surface) (status collide-status) (old-status collide-status) (prev-status collide-status) (reaction-flag cshape-reaction-flags) - (reaction (function control-info collide-query vector vector collide-status) :offset 316) + (reaction (function control-info collide-query vector vector collide-status) :offset 316) (no-reaction (function collide-shape-moving collide-query vector vector object)) (local-normal vector :inline) (surface-normal vector :inline) @@ -1513,11 +1515,11 @@ Most [[process-drawable]]s have a [[collide-shape]] that represents their root t (collide-shape-moving-method-60 () none) (move-to-ground-point (_type_ vector vector vector) none) (compute-acc-due-to-gravity (_type_ vector float) vector) - (collide-shape-moving-method-63 () none) + (rbody-collision (_type_ rigid-body-control float) none) (collide-shape-moving-method-64 () none) (fill-and-try-snap-to-surface (_type_ vector float float float collide-query) symbol) (collide-shape-moving-method-66 () none) - (collide-shape-moving-method-67 () none) + (collide-with-all-collide-cache-prims (_type_ matrix collide-query) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/collide/collide-touch-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/collide-touch-h_REF.gc index 7be41fba4c8..7877d970baa 100644 --- a/test/decompiler/reference/jak3/engine/collide/collide-touch-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/collide/collide-touch-h_REF.gc @@ -38,8 +38,8 @@ Potentially also stores the triangle that is involved." (:methods (touching-prims-entry-method-9 () none) (touching-prims-entry-method-10 () none) - (touching-prims-entry-method-11 () none) - (touching-prims-entry-method-12 () none) + (get-touched-prim (_type_ collide-shape touching-shapes-entry) collide-shape-prim) + (get-touched-tri (_type_ collide-shape touching-shapes-entry) collide-tri-result) ) ) @@ -139,7 +139,7 @@ storing a record of the primitives involved." (:methods (get-head (_type_) touching-prims-entry) (get-next (_type_ touching-shapes-entry) touching-prims-entry) - (touching-shapes-entry-method-11 () none) + (get-touched-shape (_type_ collide-shape) collide-shape) (prims-touching? (_type_ collide-shape uint) touching-prims-entry) (prims-touching-action? (_type_ collide-shape collide-action collide-action) basic) (touching-shapes-entry-method-14 () none) diff --git a/test/decompiler/reference/jak3/engine/collide/los-control-h_REF.gc b/test/decompiler/reference/jak3/engine/collide/los-control-h_REF.gc new file mode 100644 index 00000000000..965cd914def --- /dev/null +++ b/test/decompiler/reference/jak3/engine/collide/los-control-h_REF.gc @@ -0,0 +1,46 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type los-control +(deftype los-control (structure) + ((src-proc handle) + (dst-proc handle) + (last-lost-los time-frame) + (last-gained-los time-frame) + (check-interval time-frame) + (max-check-distance float) + (last-check-time time-frame) + (last-collide-result collide-tri-result :inline) + (collide-with collide-spec :offset 160) + ) + (:methods + (los-control-method-9 (_type_ process-focusable vector float float) none :behavior process-focusable) + (should-check-los? (_type_ time-frame) symbol) + (los-control-method-11 (_type_ time-frame) symbol) + (init-los! (_type_ process-focusable time-frame float collide-spec) none) + (los-control-method-13 (_type_ collide-query vector int float) float) + ) + ) + +;; definition for method 3 of type los-control +(defmethod inspect ((this los-control)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'los-control) + (format #t "~1Tsrc-proc: ~D~%" (-> this src-proc)) + (format #t "~1Tdst-proc: ~D~%" (-> this dst-proc)) + (format #t "~1Tlast-lost-los: ~D~%" (-> this last-lost-los)) + (format #t "~1Tlast-gained-los: ~D~%" (-> this last-gained-los)) + (format #t "~1Tcheck-interval: ~D~%" (-> this check-interval)) + (format #t "~1Tmax-check-distance: ~f~%" (-> this max-check-distance)) + (format #t "~1Tlast-check-time: ~D~%" (-> this last-check-time)) + (format #t "~1Tlast-collide-result: #~%" (-> this last-collide-result)) + (format #t "~1Tcollide-with: ~D~%" (-> this collide-with)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 diff --git a/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc b/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc new file mode 100644 index 00000000000..c981b504337 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/collide/los-control_REF.gc @@ -0,0 +1,165 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *los-time-offset*, type time-frame +(define *los-time-offset* (the-as time-frame 0)) + +;; definition for method 13 of type los-control +;; INFO: Used lq/sq +(defmethod los-control-method-13 ((this los-control) (arg0 collide-query) (arg1 vector) (arg2 int) (arg3 float)) + (set! (-> arg0 move-dist quad) (-> arg1 quad)) + (vector-length-max! (-> arg0 move-dist) (-> this max-check-distance)) + (set! (-> arg0 radius) arg3) + (set! (-> arg0 collide-with) (the-as collide-spec (logand (the-as collide-spec arg2) (-> this collide-with)))) + (fill-using-line-sphere *collide-cache* arg0) + (let ((f30-0 (probe-using-line-sphere *collide-cache* arg0)) + (f28-0 (vector-length arg1)) + ) + (cond + ((>= f30-0 0.0) + (quad-copy! (the-as pointer (-> this last-collide-result)) (the-as pointer (-> arg0 best-other-tri)) 6) + (* f30-0 f28-0) + ) + (else + f28-0 + ) + ) + ) + ) + +;; definition for method 9 of type los-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod los-control-method-9 ((this los-control) (arg0 process-focusable) (arg1 vector) (arg2 float) (arg3 float)) + (local-vars (a0-22 int) (a0-24 int) (sv-592 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (let* ((v1-1 (-> *perf-stats* data 56)) + (a0-1 (-> v1-1 ctrl)) + ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-1) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-1) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (when (and (time-elapsed? (-> this last-check-time) (-> this check-interval)) + (-> this src-proc) + (or arg0 (-> this dst-proc)) + ) + (let* ((s0-0 (handle->process (-> this src-proc))) + (s1-0 (if (type? s0-0 process-focusable) + s0-0 + ) + ) + ) + (when s1-0 + (when (and (not arg0) (not arg1)) + (let ((s0-1 (handle->process (-> this dst-proc)))) + (set! arg0 (if (type? s0-1 process-focusable) + (the-as process-focusable s0-1) + ) + ) + ) + ) + (when (or (the-as process arg0) arg1) + (set! sv-592 (new 'stack-no-clear 'vector)) + (let ((v1-24 (-> (get-trans (the-as process-focusable s1-0) 10) quad))) + (set! (-> sv-592 quad) v1-24) + ) + (let ((s0-2 (new 'stack-no-clear 'collide-query))) + (if (not arg1) + (set! arg1 (get-trans arg0 3)) + ) + (set! (-> s0-2 start-pos quad) (-> sv-592 quad)) + (set! (-> s0-2 ignore-process0) s1-0) + (set! (-> s0-2 ignore-process1) (the-as process arg0)) + (set! (-> s0-2 ignore-pat) (-> (the-as process-focusable s1-0) root pat-ignore-mask)) + (set! (-> s0-2 action-mask) (collide-action solid semi-solid)) + (let ((s2-1 (new 'stack-no-clear 'vector))) + (.lvf vf4 (&-> arg1 quad)) + (.lvf vf5 (&-> sv-592 quad)) + (.mov.vf vf6 vf0 :mask #b1000) + (.sub.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> s2-1 quad) vf6) + (let ((f30-0 (vector-length s2-1))) + (let ((f0-0 (los-control-method-13 this s0-2 s2-1 -2 arg3))) + (if (< f0-0 f30-0) + (vector-normalize! s2-1 f0-0) + ) + ) + (if (< (los-control-method-13 this s0-2 s2-1 1 arg2) f30-0) + (set-time! (-> this last-lost-los)) + (set-time! (-> this last-gained-los)) + ) + ) + ) + ) + (set-time! (-> this last-check-time)) + ) + ) + ) + ) + (let ((v1-45 (-> *perf-stats* data 56))) + (b! (zero? (-> v1-45 ctrl)) cfg-45 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-22 pcr0) + (+! (-> v1-45 accum0) a0-22) + (.mfpc a0-24 pcr1) + (+! (-> v1-45 accum1) a0-24) + ) + (label cfg-45) + 0 + 0 + (none) + ) + ) + +;; definition for method 10 of type los-control +(defmethod should-check-los? ((this los-control) (arg0 time-frame)) + (and (time-elapsed? (-> this last-lost-los) (+ (-> this check-interval) arg0)) + (not (time-elapsed? (-> this last-gained-los) (-> this check-interval))) + ) + ) + +;; definition for method 11 of type los-control +(defmethod los-control-method-11 ((this los-control) (arg0 time-frame)) + (and (time-elapsed? (-> this last-gained-los) (+ (-> this check-interval) arg0)) + (not (time-elapsed? (-> this last-lost-los) (-> this check-interval))) + ) + ) + +;; definition for method 12 of type los-control +;; WARN: Return type mismatch int vs none. +(defmethod init-los! ((this los-control) (arg0 process-focusable) (arg1 time-frame) (arg2 float) (arg3 collide-spec)) + (set! (-> this src-proc) (process->handle arg0)) + (set! (-> this dst-proc) (the-as handle #f)) + (set! (-> this last-lost-los) 0) + (set! (-> this last-gained-los) 0) + (set! (-> this last-check-time) 0) + (set! (-> this check-interval) (+ arg1 *los-time-offset*)) + (set! (-> this max-check-distance) arg2) + (set! (-> this collide-with) arg3) + (set! *los-time-offset* (the-as time-frame (mod (+ *los-time-offset* (seconds 0.045)) 30))) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc new file mode 100644 index 00000000000..26655e739f9 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/airlock_REF.gc @@ -0,0 +1,1523 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type com-airlock +(deftype com-airlock (process-drawable) + ((level-name pair) + (open-test pair) + (on-running pair) + (were-behind? symbol) + (inner? symbol) + (sound-behind? symbol) + (visible-move? symbol) + (saw-pilot? handle) + (last-distance meters) + (y-height vector) + (pre-open-speed float) + (open? symbol) + (latch-closed-time time-frame) + (latch-open-time time-frame) + (gear joint-mod) + (gear-rot degrees) + (gear-rotv degrees) + (gear-start-frame float) + (gear-stop-frame float) + (gear-play-time time-frame) + (open-frame float) + (pre-open-frame float) + (lock-frame float) + (close-speed-multiplier float) + (open-distance meters 2) + (active-distance meters 2) + (sound-id sound-id) + (gear-sound-id sound-id) + (sound-gear sound-spec) + (sound-pre-open sound-spec) + (sound-pre-open-stop sound-spec) + (sound-lock-loop sound-spec) + (sound-lock-stop sound-spec) + (sound-open sound-spec) + (sound-open-loop sound-spec) + (sound-open-stop sound-spec) + (sound-close sound-spec) + (sound-close-loop sound-spec) + (sound-close-stop sound-spec) + (sound-post-close sound-spec) + (sound-post-close-stop sound-spec) + (spool-sound-time time-frame) + (start-open-time time-frame) + (door-radius float) + (allow-pilot? symbol) + (allow-flut? symbol) + (blocking-plane? symbol) + ) + (:state-methods + (open symbol) + (close symbol) + ) + (:methods + (init-airlock! (_type_) _type_) + (want-cross-airlock? (_type_) object) + (destination-loaded? (_type_ symbol) symbol) + (check-crossing-distance (_type_ vector symbol) float) + (com-airlock-method-26 (_type_ vector symbol) symbol) + (rotate-gear! (_type_ float) degrees) + (play-city-voice-sound (_type_ symbol) none) + (spawn-blocking-plane (_type_ symbol) none) + ) + ) + +;; definition for method 3 of type com-airlock +(defmethod inspect ((this com-airlock)) + (when (not this) + (set! this this) + (goto cfg-10) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tlevel-name: ~A~%" (-> this level-name)) + (format #t "~2Topen-test: ~A~%" (-> this open-test)) + (format #t "~2Ton-running: ~A~%" (-> this on-running)) + (format #t "~2Twere-behind?: ~A~%" (-> this were-behind?)) + (format #t "~2Tinner?: ~A~%" (-> this inner?)) + (format #t "~2Tsound-behind?: ~A~%" (-> this sound-behind?)) + (format #t "~2Tvisible-move?: ~A~%" (-> this visible-move?)) + (format #t "~2Tsaw-pilot?: ~D~%" (-> this saw-pilot?)) + (format #t "~2Tlast-distance: (meters ~m)~%" (-> this last-distance)) + (format #t "~2Ty-height: #x~X~%" (-> this y-height)) + (format #t "~2Tpre-open-speed: ~f~%" (-> this pre-open-speed)) + (format #t "~2Topen?: ~A~%" (-> this open?)) + (format #t "~2Tlatch-closed-time: ~D~%" (-> this latch-closed-time)) + (format #t "~2Tlatch-open-time: ~D~%" (-> this latch-open-time)) + (format #t "~2Tgear: ~A~%" (-> this gear)) + (format #t "~2Tgear-rot: (deg ~r)~%" (-> this gear-rot)) + (format #t "~2Tgear-rotv: (deg ~r)~%" (-> this gear-rotv)) + (format #t "~2Tgear-start-frame: ~f~%" (-> this gear-start-frame)) + (format #t "~2Tgear-stop-frame: ~f~%" (-> this gear-stop-frame)) + (format #t "~2Tgear-play-time: ~D~%" (-> this gear-play-time)) + (format #t "~2Topen-frame: ~f~%" (-> this open-frame)) + (format #t "~2Tpre-open-frame: ~f~%" (-> this pre-open-frame)) + (format #t "~2Tlock-frame: ~f~%" (-> this lock-frame)) + (format #t "~2Tclose-speed-multiplier: ~f~%" (-> this close-speed-multiplier)) + (format #t "~2Topen-distance[2] @ #x~X~%" (-> this open-distance)) + (dotimes (s5-0 2) + (format #t "~T [~D]~2Topen-distance: (meters ~m)~%" s5-0 (-> this open-distance s5-0)) + ) + (format #t "~2Tactive-distance[2] @ #x~X~%" (-> this active-distance)) + (dotimes (s5-1 2) + (format #t "~T [~D]~2Tactive-distance: (meters ~m)~%" s5-1 (-> this active-distance s5-1)) + ) + (format #t "~2Tsound-id: ~D~%" (-> this sound-id)) + (format #t "~2Tgear-sound-id: ~D~%" (-> this gear-sound-id)) + (format #t "~2Tsound-gear: ~A~%" (-> this sound-gear)) + (format #t "~2Tsound-pre-open: ~A~%" (-> this sound-pre-open)) + (format #t "~2Tsound-pre-open-stop: ~A~%" (-> this sound-pre-open-stop)) + (format #t "~2Tsound-lock-loop: ~A~%" (-> this sound-lock-loop)) + (format #t "~2Tsound-lock-stop: ~A~%" (-> this sound-lock-stop)) + (format #t "~2Tsound-open: ~A~%" (-> this sound-open)) + (format #t "~2Tsound-open-loop: ~A~%" (-> this sound-open-loop)) + (format #t "~2Tsound-open-stop: ~A~%" (-> this sound-open-stop)) + (format #t "~2Tsound-close: ~A~%" (-> this sound-close)) + (format #t "~2Tsound-close-loop: ~A~%" (-> this sound-close-loop)) + (format #t "~2Tsound-close-stop: ~A~%" (-> this sound-close-stop)) + (format #t "~2Tsound-post-close: ~A~%" (-> this sound-post-close)) + (format #t "~2Tsound-post-close-stop: ~A~%" (-> this sound-post-close-stop)) + (format #t "~2Tspool-sound-time: ~D~%" (-> this spool-sound-time)) + (format #t "~2Tstart-open-time: ~D~%" (-> this start-open-time)) + (format #t "~2Tdoor-radius: (meters ~m)~%" (-> this door-radius)) + (format #t "~2Tallow-pilot?: ~A~%" (-> this allow-pilot?)) + (format #t "~2Tallow-flut?: ~A~%" (-> this allow-flut?)) + (format #t "~2Tblocking-plane?: ~A~%" (-> this blocking-plane?)) + (label cfg-10) + this + ) + +;; definition for method 10 of type com-airlock +(defmethod deactivate ((this com-airlock)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (process-entity-status! this (entity-perm-status subtask-complete) #f) + (if (nonzero? (-> this sound-id)) + (sound-stop (-> this sound-id)) + ) + (if (nonzero? (-> this gear-sound-id)) + (sound-stop (-> this gear-sound-id)) + ) + ((method-of-type process-drawable deactivate) this) + (none) + ) + +;; definition for method 7 of type com-airlock +;; WARN: Return type mismatch process-drawable vs com-airlock. +(defmethod relocate ((this com-airlock) (offset int)) + (if (nonzero? (-> this gear)) + (&+! (-> this gear) offset) + ) + (the-as com-airlock ((method-of-type process-drawable relocate) this offset)) + ) + +;; definition for method 22 of type com-airlock +;; INFO: Used lq/sq +(defmethod init-airlock! ((this com-airlock)) + (local-vars (sv-16 res-tag) (sv-32 res-tag)) + (process-entity-status! this (entity-perm-status subtask-complete) #f) + (set! (-> this open?) #f) + (process-drawable-from-entity! this (-> this entity)) + (let ((f0-0 (res-lump-float (-> this entity) 'rotoffset))) + (if (!= f0-0 0.0) + (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-0) + ) + ) + (logclear! (-> this mask) (process-mask actor-pause)) + (let ((s5-0 (res-lump-value (-> this entity) 'options airlock-options :time -1000000000.0))) + (set! (-> this were-behind?) #f) + (set! (-> this inner?) (logtest? s5-0 (airlock-options ao0))) + (set! (-> this on-running) (res-lump-struct (-> this entity) 'on-running pair)) + (set! (-> this sound-behind?) #f) + (set! (-> this saw-pilot?) (the-as handle #f)) + (set! (-> this open-frame) 0.0) + (set! (-> this pre-open-frame) 0.0) + (set! (-> this lock-frame) 0.0) + (set! (-> this pre-open-speed) 2.0) + (set! (-> this allow-pilot?) #f) + (set! (-> this allow-flut?) (not (logtest? s5-0 (airlock-options block-flut)))) + (let ((v1-16 (cond + ((logtest? s5-0 (airlock-options front)) + 'front + ) + ((logtest? s5-0 (airlock-options back)) + 'back + ) + ) + ) + ) + (set! (-> this blocking-plane?) v1-16) + ) + ) + (set! (-> this open-distance 0) 143360.0) + (set! (-> this open-distance 1) 143360.0) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-21 (res-lump-data (-> this entity) 'distance (pointer float) :tag-ptr (& sv-16)))) + (when v1-21 + (if (>= (-> sv-16 elt-count) (the-as uint 1)) + (set! (-> this open-distance 0) (-> v1-21 0)) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 2)) + (set! (-> this open-distance 1) (-> v1-21 1)) + ) + ) + ) + (set! (-> this active-distance 0) (+ 143360.0 (-> this open-distance 0))) + (set! (-> this active-distance 1) (+ 143360.0 (-> this open-distance 1))) + (set! sv-32 (new 'static 'res-tag)) + (let ((v1-25 (res-lump-data (-> this entity) 'idle-distance (pointer float) :tag-ptr (& sv-32)))) + (when v1-25 + (if (>= (-> sv-32 elt-count) (the-as uint 1)) + (set! (-> this active-distance 0) (-> v1-25 0)) + ) + (if (>= (-> sv-32 elt-count) (the-as uint 2)) + (set! (-> this active-distance 1) (-> v1-25 1)) + ) + ) + ) + (set! (-> this y-height) (res-lump-data (-> this entity) 'height vector)) + (set! (-> this level-name) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this open-test) + (the-as pair ((method-of-type res-lump get-property-struct) + (-> this entity) + 'open-test + 'interp + -1000000000.0 + (the-as structure '(not (or (scene-player?) (focus-test? *target* grabbed)))) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (set! (-> this gear-start-frame) -1.0) + (set! (-> this gear-stop-frame) 10000.0) + (set! (-> this sound-gear) #f) + (set! (-> this sound-pre-open) #f) + (set! (-> this sound-pre-open-stop) #f) + (set! (-> this sound-lock-loop) #f) + (set! (-> this sound-lock-stop) #f) + (set! (-> this sound-post-close) #f) + (set! (-> this sound-post-close-stop) #f) + (set! (-> this sound-open) #f) + (set! (-> this sound-close) #f) + (set! (-> this sound-open-loop) #f) + (set! (-> this sound-close-loop) #f) + (set! (-> this sound-open-stop) #f) + (set! (-> this sound-close-stop) #f) + (set! (-> this door-radius) 20480.0) + (set! (-> this close-speed-multiplier) 2.0) + this + ) + +;; definition for function airlock-stop-part-trackers +;; WARN: Return type mismatch int vs none. +(defbehavior airlock-stop-part-trackers com-airlock () + (let ((gp-0 (ppointer->process (-> self child)))) + (while gp-0 + (if (type? gp-0 part-tracker) + (send-event gp-0 'draw #f) + ) + (set! gp-0 (ppointer->process (-> gp-0 brother))) + ) + ) + 0 + (none) + ) + +;; definition for function airlock-command-lookup +(defun airlock-command-lookup ((arg0 pair)) + (let* ((s5-0 (the-as object (-> *setting-control* user-current airlock-command))) + (s4-0 (-> (the-as pair s5-0) car)) + ) + (while (not (null? s5-0)) + (let ((a0-1 (-> (the-as pair s4-0) car))) + (if (or (= a0-1 'any) (string= (the-as string a0-1) (the-as string arg0))) + (return (-> (the-as pair (-> (the-as pair s4-0) cdr)) car)) + ) + ) + (set! s5-0 (-> (the-as pair s5-0) cdr)) + (set! s4-0 (-> (the-as pair s5-0) car)) + ) + ) + #f + ) + +;; definition for method 26 of type com-airlock +(defmethod com-airlock-method-26 ((this com-airlock) (arg1 vector) (side symbol)) + (case side + (('front) + (let ((f0-0 (check-crossing-distance this arg1 #f))) + (and (< 0.0 f0-0) (or (< (vector-vector-xz-distance (-> this root trans) arg1) (-> this active-distance 0)) + (< 0.0 (-> this last-distance)) + ) + ) + ) + ) + ) + ) + +;; definition for method 25 of type com-airlock +(defmethod check-crossing-distance ((this com-airlock) (arg0 vector) (arg1 symbol)) + (let ((s5-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> this root quat))) + (s4-1 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this root trans))) + ) + (set! (-> s4-1 y) 0.0) + (let ((f30-0 (vector-dot s4-1 s5-0))) + (cond + ((not arg1) + ) + ((or (< (vector-vector-xz-distance (-> this root trans) arg0) 40960.0) + (< 0.7 (fabs (vector-dot s5-0 (vector-normalize! s4-1 1.0)))) + ) + (when (and (< f30-0 0.0) + (< 0.0 (-> this last-distance)) + (and (not (and *target* (focus-test? *target* grabbed teleporting))) + (< (fabs (- f30-0 (-> this last-distance))) 81920.0) + ) + ) + (let ((s5-1 (res-lump-struct (-> this entity) 'on-cross pair))) + (if s5-1 + (script-eval s5-1) + ) + ) + ) + (set! (-> this last-distance) f30-0) + ) + ((< 0.0 (-> this last-distance)) + (set! f30-0 (fmax 4096.0 f30-0)) + ) + ((< (-> this last-distance) 0.0) + (set! f30-0 (fmin -4096.0 f30-0)) + ) + ) + f30-0 + ) + ) + ) + +;; definition for method 23 of type com-airlock +(defmethod want-cross-airlock? ((this com-airlock)) + (local-vars (a0-22 entity-actor)) + (let* ((tpos (target-pos 0)) + (f30-0 (check-crossing-distance this tpos #t)) + (target-dist (vector-vector-xz-distance (-> this root trans) tpos)) + (s5-0 (< (current-time) (-> this latch-open-time))) + (cmd (airlock-command-lookup (the-as pair (-> this name)))) + ) + (if (= cmd 'open) + (set! s5-0 #t) + ) + (and (or s5-0 (< target-dist (if (>= f30-0 0.0) + (-> this active-distance 0) + (-> this active-distance 1) + ) + ) + ) + (and (or s5-0 (not (-> this y-height)) (and (>= (-> tpos y) (- (-> this root trans y) (-> this y-height y))) + (< (-> tpos y) (+ (-> this root trans y) (-> this y-height x))) + ) + ) + (begin + (if (and (not (-> this were-behind?)) (and (< f30-0 0.0) (-> this inner?))) + (set! (-> this were-behind?) #t) + ) + (< (-> this latch-closed-time) (current-time)) + ) + (or (not (and *target* (or (focus-test? *target* teleporting) + (and (not (-> this allow-pilot?)) (focus-test? *target* pilot)) + (and (not (-> this allow-flut?)) (focus-test? *target* flut)) + ) + ) + ) + (< f30-0 -409.6) + ) + (let ((f28-0 (check-crossing-distance this (camera-pos) #f))) + (if (and *target* + (< target-dist 81920.0) + (or (< (* f30-0 f28-0) 0.0) (and (>= 32768.0 (fabs f30-0)) (if (= (-> this blocking-plane?) 'front) + (< f30-0 0.0) + (< 0.0 f30-0) + ) + ) + ) + (and (or (not (-> this allow-flut?)) (not (-> this allow-pilot?))) + (not (logtest? (focus-status flut pilot) (-> *target* focus-status))) + ) + ) + (persist-with-delay *setting-control* 'pilot (seconds 0.1) 'pilot #f 0.0 0) + ) + (or (and (< f30-0 (-> this open-distance 0)) + (or (not (-> this were-behind?)) (< f30-0 20480.0)) + (and (or (< 409.6 f30-0) + (begin + (let ((a0-21 (-> this entity))) + (set! a0-22 (entity-actor-lookup a0-21 'next-actor 0)) + ) + (not a0-22) + ) + (logtest? (-> a0-22 extra perm status) (entity-perm-status subtask-complete)) + ) + (script-eval (-> this open-test)) + (and (-> *setting-control* user-current airlock) + (!= cmd 'close) + (not (and (-> this blocking-plane?) *target* (or (and (not (-> this allow-pilot?)) (focus-test? *target* pilot)) + (and (not (-> this allow-flut?)) (focus-test? *target* flut)) + ) + ) + ) + ) + ) + ) + s5-0 + (and (or (not *target*) (not (logtest? (-> *target* focus-status) (focus-status in-head)))) + (not (and (and (-> this next-state) (= (-> this next-state name) 'close)) + (= (-> this skel root-channel 0 frame-num) 0.0) + ) + ) + (or (< (* f30-0 f28-0) 0.0) + (and (< (fabs f28-0) 4096.0) + (< (vector-vector-xz-distance (camera-pos) (-> this root trans)) (-> this door-radius)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 24 of type com-airlock +(defmethod destination-loaded? ((this com-airlock) (level-status symbol)) + (let ((s5-1 (script-eval (-> this level-name)))) + (cond + ((not s5-1) + (if level-status + 'unknown + #f + ) + ) + (level-status + (let ((a1-3 (car s5-1))) + (while (not (null? s5-1)) + (let ((v1-4 (status-of-level-and-borrows *level* (the-as symbol a1-3) level-status))) + (case level-status + (('display) + (if (!= v1-4 'active) + (return #f) + ) + ) + (else + (if (not (or (= v1-4 'loaded) (= v1-4 'active))) + (return #f) + ) + ) + ) + ) + (set! s5-1 (cdr s5-1)) + (set! a1-3 (car (the-as pair s5-1))) + ) + ) + #t + ) + (else + (let* ((v1-13 s5-1) + (a0-8 (car v1-13)) + ) + (while (not (null? v1-13)) + (dotimes (a1-6 10) + (if (= a0-8 (-> *load-state* want a1-6 name)) + (goto cfg-32) + ) + ) + #t + (return #f) + (label cfg-32) + (set! v1-13 (cdr v1-13)) + (set! a0-8 (car (the-as pair v1-13))) + ) + ) + #t + ) + ) + ) + ) + +;; definition for method 27 of type com-airlock +(defmethod rotate-gear! ((this com-airlock) (arg0 float)) + (cond + ((and (>= (ja-aframe-num 0) (-> this gear-start-frame)) (< (ja-aframe-num 0) (-> this gear-stop-frame))) + (if (and (zero? (-> this gear-sound-id)) + (-> this sound-gear) + (and (-> this next-state) (= (-> this next-state name) 'open)) + (>= (check-crossing-distance this (target-pos 0) #f) 0.0) + ) + (set! (-> this gear-sound-id) (sound-play-by-spec (-> this sound-gear) (new-sound-id) (the-as vector #t))) + ) + (set-time! (-> this gear-play-time)) + (when (nonzero? (-> this gear)) + (seek! (-> this gear-rotv) arg0 (* 131072.0 (seconds-per-frame))) + (+! (-> this gear-rot) (* (-> this gear-rotv) (seconds-per-frame))) + (twist-set! (-> this gear) (the-as float #f) (the-as float #f) (-> this gear-rot)) + ) + ) + (else + (when (and (nonzero? (-> this gear-sound-id)) (time-elapsed? (-> this gear-play-time) (seconds 1.5))) + (let ((v1-28 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-28 command) (sound-command set-param)) + (set! (-> v1-28 id) (-> this gear-sound-id)) + (set! (-> v1-28 params volume) -4) + (set! (-> v1-28 auto-time) 120) + (set! (-> v1-28 auto-from) 2) + (set! (-> v1-28 params mask) (the-as uint 17)) + (-> v1-28 id) + ) + (set! (-> this gear-sound-id) (new 'static 'sound-id)) + 0 + ) + ) + ) + (-> this gear-rotv) + ) + +;; definition for method 28 of type com-airlock +;; WARN: Return type mismatch int vs none. +(defmethod play-city-voice-sound ((this com-airlock) (arg0 symbol)) + (let ((gp-0 (the-as (array string) #f))) + (case arg0 + (('enter) + (set! gp-0 (new 'static 'boxed-array :type string "cityv005" "cityv006" "cityv007" "cityv008" "cityv009")) + ) + (('exit) + (set! gp-0 (new 'static 'boxed-array :type string "cityv001" "cityv002" "cityv003" "cityv004")) + ) + ) + (cond + ((and gp-0 (time-elapsed? (-> this spool-sound-time) (seconds 2))) + (set-time! (-> this spool-sound-time)) + (add-process + *gui-control* + this + (gui-channel alert) + (gui-action play) + (-> gp-0 (rand-vu-int-range 0 (+ (-> gp-0 length) -1))) + -99.0 + 0 + ) + ) + (else + 0 + ) + ) + ) + (none) + ) + +;; definition for method 29 of type com-airlock +;; WARN: Return type mismatch int vs none. +(defmethod spawn-blocking-plane ((this com-airlock) (side symbol)) + (case side + (('front) + (let ((s5-0 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (vector-matrix*! + (-> s5-0 0) + (new 'static 'vector :x 40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (vector-matrix*! + (-> s5-0 1) + (new 'static 'vector :x -40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (blocking-plane-spawn (the-as curve-control #f) s5-0 122880.0) + ) + ) + (('back) + (let ((s5-1 (new 'static 'inline-array vector 2 (new 'static 'vector) (new 'static 'vector)))) + (vector-matrix*! + (-> s5-1 0) + (new 'static 'vector :x -40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (vector-matrix*! + (-> s5-1 1) + (new 'static 'vector :x 40960.0 :w 1.0) + (-> this node-list data 0 bone transform) + ) + (blocking-plane-spawn (the-as curve-control #f) s5-1 122880.0) + ) + ) + (else + (blocking-plane-destroy) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defskelgroup skel-com-airlock-outer com-airlock-outer com-airlock-outer-lod0-jg com-airlock-outer-idle-ja + ((com-airlock-outer-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +;; failed to figure out what this is: +(defskelgroup skel-com-airlock-inner com-airlock-inner com-airlock-inner-lod0-jg com-airlock-inner-idle-ja + ((com-airlock-inner-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +;; failed to figure out what this is: +(defstate close (com-airlock) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('close) + (set! (-> self latch-closed-time) (+ (current-time) (if (>= argc 1) + (the-as int (-> block param 0)) + 3000 + ) + ) + ) + (if (and (>= argc 2) (and (= (-> block param 1) #t) (not (want-cross-airlock? self)))) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + ) + (and (-> self next-state) (= (-> self next-state name) 'open)) + ) + (('open) + (set! (-> self latch-open-time) (+ (current-time) (if (>= argc 1) + (the-as int (-> block param 0)) + 3000 + ) + ) + ) + (if (and (>= argc 2) (and (= (-> block param 1) #t) (want-cross-airlock? self) (destination-loaded? self #f))) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! max) + ) + (and (-> self next-state) (= (-> self next-state name) 'close)) + ) + (('front) + (let ((f30-0 (check-crossing-distance self (target-pos 0) #f)) + (f0-3 (check-crossing-distance self (camera-pos) #f)) + ) + (and (< 2048.0 f30-0) (>= (* f30-0 f0-3) 0.0)) + ) + ) + (('back) + (let ((f30-1 (check-crossing-distance self (target-pos 0) #f)) + (f0-5 (check-crossing-distance self (camera-pos) #f)) + ) + (and (< f30-1 -2048.0) (>= (* f30-1 f0-5) 0.0)) + ) + ) + (('sound) + (if (>= (check-crossing-distance self (target-pos 0) #f) 0.0) + (play-city-voice-sound self (the-as symbol (-> block param 0))) + ) + ) + (('distance) + (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) + (('open?) + (-> self open?) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + (set! (-> self visible-move?) #f) + ) + :exit (behavior () + (spawn-blocking-plane self #f) + (when (nonzero? (-> self sound-id)) + (let ((v1-4 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-4 command) (sound-command set-param)) + (set! (-> v1-4 id) (-> self sound-id)) + (set! (-> v1-4 params volume) -4) + (set! (-> v1-4 auto-time) 24) + (set! (-> v1-4 auto-from) 2) + (set! (-> v1-4 params mask) (the-as uint 17)) + (-> v1-4 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-9 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-9 command) (sound-command set-param)) + (set! (-> v1-9 id) (-> self gear-sound-id)) + (set! (-> v1-9 params volume) -4) + (set! (-> v1-9 auto-time) 24) + (set! (-> v1-9 auto-from) 2) + (set! (-> v1-9 params mask) (the-as uint 17)) + (-> v1-9 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + ) + :trans (behavior () + (if (logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self visible-move?) #t) + ) + (when (and (want-cross-airlock? self) + (and (!= (-> self state-time) (current-time)) + (begin + (let ((gp-0 (res-lump-struct (-> self entity) 'on-activate structure))) + (if gp-0 + (script-eval (the-as pair gp-0)) + ) + ) + (destination-loaded? self #f) + ) + ) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-19 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-19 command) (sound-command set-param)) + (set! (-> v1-19 id) (-> self sound-id)) + (set! (-> v1-19 params volume) -4) + (set! (-> v1-19 auto-time) 24) + (set! (-> v1-19 auto-from) 2) + (set! (-> v1-19 params mask) (the-as uint 17)) + (-> v1-19 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (go-virtual open #f) + ) + (let ((gp-1 (-> self on-running))) + (if gp-1 + (script-eval gp-1) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (when (not arg0) + ((lambda :behavior com-airlock () (when (ja-max? 0) + (let ((gp-0 (res-lump-struct (-> self entity) 'on-start-close pair))) + (if (and gp-0 (not *scene-player*)) + (script-eval gp-0) + ) + ) + ) + ) + ) + (spawn-blocking-plane self #t) + (if (and (-> self sound-close) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (sound-play-by-spec (-> self sound-close) (new-sound-id) (the-as vector #t)) + ) + (if (and (-> self sound-close-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-close-loop) (new-sound-id) (the-as vector #t))) + ) + (while (< (-> self open-frame) (ja-aframe-num 0)) + (rotate-gear! self 65536.0) + (when (and (-> self were-behind?) + (< 0.4 (vector-dot + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)) + (-> (math-camera-matrix) fvec) + ) + ) + (< 0.0 (check-crossing-distance self (target-pos 0) #f)) + ) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self open-frame) 0)) + (goto cfg-42) + ) + (suspend) + (ja :num! (seek! 0.0 (-> self close-speed-multiplier))) + (transform-post) + ) + (label cfg-42) + (if (com-airlock-method-26 self (target-pos 0) 'front) + ((lambda :behavior com-airlock + () + (let ((gp-0 (res-lump-struct (-> self entity) 'on-exit structure))) + (if (and gp-0 (not *scene-player*)) + (script-eval (the-as pair gp-0)) + ) + ) + (when (-> self were-behind?) + (let ((gp-1 (res-lump-struct (-> self entity) 'on-inside structure))) + (set! (-> self were-behind?) #f) + (if (and gp-1 (not *scene-player*)) + (script-eval (the-as pair gp-1)) + ) + ) + ) + ) + ) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-48 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-48 command) (sound-command set-param)) + (set! (-> v1-48 id) (-> self sound-id)) + (set! (-> v1-48 params volume) -4) + (set! (-> v1-48 auto-time) 24) + (set! (-> v1-48 auto-from) 2) + (set! (-> v1-48 params mask) (the-as uint 17)) + (-> v1-48 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (if (and (-> self sound-close-stop) (not arg0) (-> self visible-move?)) + (sound-play-by-spec (-> self sound-close-stop) (new-sound-id) (the-as vector #t)) + ) + (while (not (ja-min? 0)) + (if (and (zero? (-> self sound-id)) + (-> self sound-post-close) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-post-close) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! 0.0)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-73 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-73 command) (sound-command set-param)) + (set! (-> v1-73 id) (-> self sound-id)) + (set! (-> v1-73 params volume) -4) + (set! (-> v1-73 auto-time) 24) + (set! (-> v1-73 auto-from) 2) + (set! (-> v1-73 params mask) (the-as uint 17)) + (-> v1-73 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-post-close-stop) + (sound-play-by-spec (-> self sound-post-close-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (set! (-> self open?) #f) + (when (com-airlock-method-26 self (target-pos 0) 'front) + (let ((gp-3 (res-lump-struct (-> self entity) 'on-deactivate structure))) + (if (and gp-3 (not *scene-player*)) + (script-eval (the-as pair gp-3)) + ) + ) + ) + (while (!= (-> self gear-rotv) 0.0) + (rotate-gear! self 0.0) + (suspend) + (transform-post) + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-93 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-93 command) (sound-command set-param)) + (set! (-> v1-93 id) (-> self gear-sound-id)) + (set! (-> v1-93 params volume) -4) + (set! (-> v1-93 auto-time) 24) + (set! (-> v1-93 auto-from) 2) + (set! (-> v1-93 params mask) (the-as uint 17)) + (-> v1-93 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + ) + (spawn-blocking-plane self #f) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + (transform-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + ) + +;; failed to figure out what this is: +(defstate open (com-airlock) + :virtual #t + :event (-> (method-of-type com-airlock close) event) + :enter (behavior ((arg0 symbol)) + (set! (-> self visible-move?) #f) + ) + :exit (-> (method-of-type com-airlock close) exit) + :trans (behavior () + (if (logtest? (-> self draw status) (draw-control-status on-screen)) + (set! (-> self visible-move?) #t) + ) + (if (not (want-cross-airlock? self)) + (go-virtual close #f) + ) + (when (logtest? (-> self mask) (process-mask sleep-code)) + (let ((v1-15 (destination-loaded? self 'display))) + (when (or (not v1-15) (= v1-15 'unknown)) + (if (and (not v1-15) (< (-> self open-frame) (ja-aframe-num 0))) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self open-frame) 0)) + ) + (go-virtual close #f) + ) + ) + ) + (let ((gp-1 (-> self on-running))) + (if gp-1 + (script-eval gp-1) + ) + ) + ) + :code (behavior ((arg0 symbol)) + (when (not arg0) + ((lambda :behavior com-airlock + () + (when (ja-min? 0) + (let ((gp-0 (res-lump-struct (-> self entity) 'on-start-open pair))) + (if (and gp-0 (not *scene-player*) (time-elapsed? (-> self start-open-time) (seconds 0.1))) + (script-eval gp-0) + ) + ) + ) + ) + ) + (set-time! (-> self start-open-time)) + (when (< (check-crossing-distance self (target-pos 0) #f) 0.0) + (if (< (ja-aframe-num 0) (-> self pre-open-frame)) + (ja :num-func num-func-identity :frame-num (ja-aframe (-> self pre-open-frame) 0)) + ) + ) + (while (< (ja-aframe-num 0) (-> self lock-frame)) + (if (and (zero? (-> self sound-id)) + (-> self sound-pre-open) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-pre-open) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! (ja-aframe (-> self lock-frame) 0) (-> self pre-open-speed))) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-29 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-29 command) (sound-command set-param)) + (set! (-> v1-29 id) (-> self sound-id)) + (set! (-> v1-29 params volume) -4) + (set! (-> v1-29 auto-time) 24) + (set! (-> v1-29 auto-from) 2) + (set! (-> v1-29 params mask) (the-as uint 17)) + (-> v1-29 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-pre-open-stop) + (sound-play-by-spec (-> self sound-pre-open-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (while (< (ja-aframe-num 0) (-> self open-frame)) + (if (and (zero? (-> self sound-id)) + (-> self sound-lock-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-lock-loop) (new-sound-id) (the-as vector #t))) + ) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek! (ja-aframe (-> self open-frame) 0) 2.0)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-52 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-52 command) (sound-command set-param)) + (set! (-> v1-52 id) (-> self sound-id)) + (set! (-> v1-52 params volume) -4) + (set! (-> v1-52 auto-time) 24) + (set! (-> v1-52 auto-from) 2) + (set! (-> v1-52 params mask) (the-as uint 17)) + (-> v1-52 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + (if (-> self sound-lock-stop) + (sound-play-by-spec (-> self sound-lock-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (while (not (destination-loaded? self #t)) + (if (not (destination-loaded? self #f)) + (go-virtual close #f) + ) + (rotate-gear! self 65536.0) + (suspend) + (transform-post) + ) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self open?) #t) + (let ((s5-10 (res-lump-struct (-> self entity) 'on-enter structure))) + (if s5-10 + (script-eval (the-as pair s5-10)) + ) + ) + (if (and (-> self sound-open) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (sound-play-by-spec (-> self sound-open) (new-sound-id) (the-as vector #t)) + ) + (if (and (-> self sound-open-loop) + (and (or (-> self sound-behind?) (>= (check-crossing-distance self (target-pos 0) #f) 0.0)) + (not arg0) + (-> self visible-move?) + ) + ) + (set! (-> self sound-id) (sound-play-by-spec (-> self sound-open-loop) (new-sound-id) (the-as vector #t))) + ) + (set! (-> *ACTOR-bank* birth-max) 1000) + (while (not (ja-max? 0)) + (rotate-gear! self 65536.0) + (suspend) + (ja :num! (seek!)) + (transform-post) + ) + (when (nonzero? (-> self sound-id)) + (let ((v1-104 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-104 command) (sound-command set-param)) + (set! (-> v1-104 id) (-> self sound-id)) + (set! (-> v1-104 params volume) -4) + (set! (-> v1-104 auto-time) 24) + (set! (-> v1-104 auto-from) 2) + (set! (-> v1-104 params mask) (the-as uint 17)) + (-> v1-104 id) + ) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 + ) + (when (nonzero? (-> self gear-sound-id)) + (let ((v1-109 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-109 command) (sound-command set-param)) + (set! (-> v1-109 id) (-> self gear-sound-id)) + (set! (-> v1-109 params volume) -4) + (set! (-> v1-109 auto-time) 24) + (set! (-> v1-109 auto-from) 2) + (set! (-> v1-109 params mask) (the-as uint 17)) + (-> v1-109 id) + ) + (set! (-> self gear-sound-id) (new 'static 'sound-id)) + 0 + ) + (airlock-stop-part-trackers) + (if (and (-> self sound-open-stop) (not arg0) (-> self visible-move?)) + (sound-play-by-spec (-> self sound-open-stop) (new-sound-id) (the-as vector #t)) + ) + ) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self open?) #t) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! max) + (transform-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + ) + +;; definition of type com-airlock-outer +(deftype com-airlock-outer (com-airlock) + () + ) + +;; definition for method 3 of type com-airlock-outer +(defmethod inspect ((this com-airlock-outer)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type com-airlock-outer +(defmethod init-from-entity! ((this com-airlock-outer) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 7) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (init-airlock! this) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-com-airlock-outer" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set! (-> this pre-open-frame) 35.0) + (set! (-> this lock-frame) 45.0) + (set! (-> this open-frame) 45.0) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-post-close) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-post-close-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (go (method-of-object this close) #t) + ) + +;; definition of type com-airlock-inner +(deftype com-airlock-inner (com-airlock) + () + ) + +;; definition for method 3 of type com-airlock-inner +(defmethod inspect ((this com-airlock-inner)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type com-airlock-inner +(defmethod init-from-entity! ((this com-airlock-inner) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 8) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-com-airlock-inner" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this lock-frame) 37.0) + (set! (-> this pre-open-frame) 65.0) + (set! (-> this open-frame) 75.0) + (set! (-> this gear) (new 'process 'joint-mod (joint-mod-mode rotate) this 12)) + (set! (-> this inner?) + (logtest? (the-as + int + (res-lump-value (-> this entity) 'options uint128 :default (the-as uint128 1) :time -1000000000.0) + ) + 1 + ) + ) + (set! (-> this pre-open-speed) 0.9) + (set! (-> this sound-gear) (static-sound-spec "airlock-gear" :group 1)) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-lock-loop) (static-sound-spec "airlock-turn" :group 1)) + (set! (-> this sound-lock-stop) (static-sound-spec "airlock-unlock" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (go (method-of-object this close) #t) + ) + +;; failed to figure out what this is: +(defskelgroup skel-cty-door cty-door cty-door-lod0-jg cty-door-idle-ja + ((cty-door-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 8) + ) + +;; definition of type cty-door +(deftype cty-door (com-airlock) + () + ) + +;; definition for method 3 of type cty-door +(defmethod inspect ((this cty-door)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type cty-door +(defmethod init-from-entity! ((this cty-door) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 32768.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 28672.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 28672.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-cty-door" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open) (static-sound-spec "hqdoor-open" :group 1)) + (set! (-> this sound-close) (static-sound-spec "hqdoor-close" :group 1)) + (go (method-of-object this close) #t) + ) + +;; failed to figure out what this is: +(defskelgroup skel-vin-door-ctyinda vin-door-ctyinda vin-door-ctyinda-lod0-jg vin-door-ctyinda-idle-ja + ((vin-door-ctyinda-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 6) + ) + +;; definition of type vin-door-ctyinda +(deftype vin-door-ctyinda (com-airlock) + () + ) + +;; definition for method 3 of type vin-door-ctyinda +(defmethod inspect ((this vin-door-ctyinda)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type vin-door-ctyinda +(defmethod init-from-entity! ((this vin-door-ctyinda) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 12288.0 0.0 24576.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 8192.0 16384.0 0.0 20480.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) -8192.0 16384.0 0.0 20480.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-vin-door-ctyinda" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open) (static-sound-spec "vindoor-open" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "vindoor-close" :group 1)) + (set! (-> this door-radius) 8192.0) + (go (method-of-object this close) #t) + ) + +;; failed to figure out what this is: +(defskelgroup skel-com-airlock-outer-mhcity com-airlock-outer-mhcity com-airlock-outer-mhcity-lod0-jg com-airlock-outer-mhcity-idle-ja + ((com-airlock-outer-mhcity-lod0-mg (meters 999999))) + :bounds (static-spherem 0 5 0 14) + ) + +;; definition of type com-airlock-outer-mhcity +(deftype com-airlock-outer-mhcity (com-airlock) + () + ) + +;; definition for method 3 of type com-airlock-outer-mhcity +(defmethod inspect ((this com-airlock-outer-mhcity)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type com-airlock-outer-mhcity +(defmethod init-from-entity! ((this com-airlock-outer-mhcity) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 20480.0 0.0 57344.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 20480.0 0.0 32768.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (init-airlock! this) + (initialize-skeleton + this + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-com-airlock-outer-mhcity" (the-as (pointer level) #f)) + ) + (the-as pair 0) + ) + (set! (-> this sound-pre-open) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-pre-open-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (set! (-> this sound-open) (static-sound-spec "airlock-seal" :group 1)) + (set! (-> this sound-open-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "airlock-open" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "airlock-hit" :group 1)) + (set! (-> this sound-post-close) (static-sound-spec "airlock-slider" :group 1)) + (set! (-> this sound-post-close-stop) (static-sound-spec "airlock-slide-e" :group 1)) + (go (method-of-object this close) #t) + ) + +;; failed to figure out what this is: +(defskelgroup skel-hip-door-a hip-door-a hip-door-a-lod0-jg hip-door-a-idle-ja + ((hip-door-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 0 5) + ) + +;; definition of type hip-door-a +(deftype hip-door-a (com-airlock) + () + ) + +;; definition for method 3 of type hip-door-a +(defmethod inspect ((this hip-door-a)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type com-airlock inspect))) + (t9-0 this) + ) + (label cfg-4) + this + ) + +;; definition for method 11 of type hip-door-a +(defmethod init-from-entity! ((this hip-door-a) (arg0 entity-actor)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 8192.0 0.0 20480.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-8 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-8 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-8 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-8 prim-core action) (collide-action solid)) + (set! (-> v1-8 transform-index) 4) + (set-vector! (-> v1-8 local-sphere) 0.0 8192.0 0.0 16384.0) + ) + (let ((v1-10 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-10 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-10 prim-core collide-with) (collide-spec jak bot player-list)) + (set! (-> v1-10 prim-core action) (collide-action solid)) + (set! (-> v1-10 transform-index) 5) + (set-vector! (-> v1-10 local-sphere) 0.0 8192.0 0.0 16384.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-13 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-13 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-13 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-hip-door-a" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (init-airlock! this) + (set! (-> this sound-open-loop) (static-sound-spec "wood-door-open" :group 1)) + (set! (-> this sound-open-stop) (static-sound-spec "wood-open-hit" :group 1)) + (set! (-> this sound-close-loop) (static-sound-spec "wood-door-close" :group 1)) + (set! (-> this sound-close-stop) (static-sound-spec "wood-close-hit" :group 1)) + (set! (-> this door-radius) 8192.0) + (go (method-of-object this close) #t) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/base-plat_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/base-plat_REF.gc new file mode 100644 index 00000000000..8898bb76f26 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/base-plat_REF.gc @@ -0,0 +1,430 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type base-plat +(deftype base-plat (process-focusable) + ((smush smush-control :inline) + (basetrans vector :inline) + (bounce-time time-frame) + (bouncing symbol) + (bounce-scale meters) + ) + (:methods + (update-part-and-sfx! (_type_) none) + (init-bounce-params! (_type_) none) + (start-bounce! (_type_) none :behavior base-plat) + (get-art-group (_type_) art-group) + (init-collision! (_type_) none) + (base-plat-method-33 (_type_) none) + (base-plat-method-34 (_type_) none) + ) + ) + +;; definition for method 3 of type base-plat +(defmethod inspect ((this base-plat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 this) + ) + (format #t "~2Tsmush: #~%" (-> this smush)) + (format #t "~2Tbasetrans: #~%" (-> this basetrans)) + (format #t "~2Tbounce-time: ~D~%" (-> this bounce-time)) + (format #t "~2Tbouncing: ~A~%" (-> this bouncing)) + (format #t "~2Tbounce-scale: (meters ~m)~%" (-> this bounce-scale)) + (label cfg-4) + this + ) + +;; definition for method 34 of type base-plat +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-34 ((this base-plat)) + 0 + (none) + ) + +;; definition for method 29 of type base-plat +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-bounce-params! ((this base-plat)) + (set! (-> this basetrans quad) (-> this root trans quad)) + (set! (-> this bouncing) #f) + (set! (-> this bounce-scale) 819.2) + 0 + (none) + ) + +;; definition for method 30 of type base-plat +;; WARN: Return type mismatch int vs none. +(defmethod start-bounce! ((this base-plat)) + (activate! (-> this smush) -1.0 60 150 1.0 1.0 (-> self clock)) + (set-time! (-> this bounce-time)) + (set! (-> this bouncing) #t) + (sound-play "plat-bounce" :position (-> this root trans)) + (logclear! (-> this mask) (process-mask sleep)) + (logclear! (-> this mask) (process-mask sleep-code)) + 0 + (none) + ) + +;; definition for function plat-code +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior plat-code base-plat () + (transform-post) + (suspend) + (transform-post) + (suspend) + (until #f + (when (not (-> self bouncing)) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + (while (-> self bouncing) + (suspend) + ) + ) + #f + (none) + ) + +;; definition for function plat-trans +;; INFO: Used lq/sq +(defbehavior plat-trans base-plat () + (rider-trans) + (cond + ((-> self bouncing) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (set! (-> gp-0 quad) (-> self basetrans quad)) + (+! (-> gp-0 y) (* (-> self bounce-scale) (update! (-> self smush)))) + (move-to-point! (-> self root) gp-0) + ) + (if (not (!= (-> self smush amp) 0.0)) + (set! (-> self bouncing) #f) + ) + ) + (else + (move-to-point! (-> self root) (-> self basetrans)) + ) + ) + (none) + ) + +;; definition for function plat-post +(defbehavior plat-post base-plat () + (update-part-and-sfx! self) + (rider-post) + (none) + ) + +;; definition for method 33 of type base-plat +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-33 ((this base-plat)) + 0 + (none) + ) + +;; definition for method 28 of type base-plat +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update-part-and-sfx! ((this base-plat)) + (if (nonzero? (-> this part)) + (spawn (-> this part) (-> this root trans)) + ) + (when (nonzero? (-> this sound)) + (set! (-> this sound trans quad) (-> this root trans quad)) + (update! (-> this sound)) + ) + (none) + ) + +;; definition for function plat-event +;; WARN: Return type mismatch none vs object. +(defbehavior plat-event base-plat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('bonk) + (start-bounce! self) + ) + ) + ) + +;; definition of type eco-door +(deftype eco-door (process-drawable) + ((root collide-shape :override) + (speed float) + (open-distance float) + (close-distance float) + (out-dir vector :inline) + (open-sound sound-name) + (close-sound sound-name) + (state-actor entity-actor) + (flags eco-door-flags) + (locked symbol) + (auto-close symbol) + (one-way symbol) + ) + (:state-methods + door-closed + door-opening + door-open + door-closing + ) + (:methods + (update-lock-status! (_type_) none) + (init-collision! (_type_) none) + (eco-door-method-26 (_type_) none) + ) + ) + +;; definition for method 3 of type eco-door +;; INFO: Used lq/sq +(defmethod inspect ((this eco-door)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tspeed: ~f~%" (-> this speed)) + (format #t "~2Topen-distance: ~f~%" (-> this open-distance)) + (format #t "~2Tclose-distance: ~f~%" (-> this close-distance)) + (format #t "~2Tout-dir: #~%" (-> this out-dir)) + (format #t "~2Topen-sound: ~D~%" (-> this open-sound)) + (format #t "~2Tclose-sound: ~D~%" (-> this close-sound)) + (format #t "~2Tstate-actor: ~A~%" (-> this state-actor)) + (format #t "~2Tflags: ~D~%" (-> this flags)) + (format #t "~2Tlocked: ~A~%" (-> this locked)) + (format #t "~2Tauto-close: ~A~%" (-> this auto-close)) + (format #t "~2Tone-way: ~A~%" (-> this one-way)) + (label cfg-4) + this + ) + +;; definition for function eco-door-event-handler +;; WARN: Return type mismatch symbol vs object. +(defbehavior eco-door-event-handler eco-door ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('trigger) + (set! (-> self locked) (not (-> self locked))) + (cond + ((-> self locked) + (if (and (-> self next-state) (= (-> self next-state name) 'door-closed)) + (sound-play "door-lock") + ) + ) + (else + (sound-play "door-unlock") + ) + ) + #t + ) + ) + ) + +;; failed to figure out what this is: +(defstate door-closed (eco-door) + :virtual #t + :code (behavior () + (ja :num-func num-func-identity :frame-num 0.0) + (suspend) + (update-transforms (-> self root)) + (ja-post) + (until #f + (when (and *target* + (and (>= (-> self open-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (update-lock-status! self) + (if (and (not (-> self locked)) + (or (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + (send-event *target* 'query 'powerup (pickup-type eco-blue)) + (and (-> self one-way) (< (vector4-dot (-> self out-dir) (target-pos 0)) -8192.0)) + ) + ) + (go-virtual door-opening) + ) + ) + (suspend) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate door-opening (eco-door) + :virtual #t + :code (behavior () + (if (and (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status subtask-complete))) + ) + (send-event *target* 'query 'powerup (pickup-type eco-blue)) + ) + (sound-play "blue-eco-on" :position (-> self root trans)) + ) + (sound-play-by-name (-> self open-sound) (new-sound-id) 1024 0 0 (sound-group) #t) + (let ((v1-14 (-> self root root-prim))) + (set! (-> v1-14 prim-core collide-as) (collide-spec)) + (set! (-> v1-14 prim-core collide-with) (collide-spec)) + ) + 0 + (until (ja-done? 0) + (ja :num! (seek! max (-> self speed))) + (suspend) + ) + (go-virtual door-open) + ) + :post transform-post + ) + +;; failed to figure out what this is: +(defstate door-open (eco-door) + :virtual #t + :code (behavior () + (set-time! (-> self state-time)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (ja :num-func num-func-identity :frame-num max) + (logior! (-> self draw status) (draw-control-status no-draw)) + (suspend) + (update-transforms (-> self root)) + (ja-post) + (until #f + (let ((f30-0 (vector4-dot (-> self out-dir) (target-pos 0))) + (f28-0 (vector4-dot (-> self out-dir) (camera-pos))) + ) + (when (and (-> self auto-close) + (or (not *target*) + (or (< (-> self close-distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (focus-test? *target* teleporting) + ) + ) + ) + (if (and (>= (* f30-0 f28-0) 0.0) (< 16384.0 (fabs f28-0))) + (go-virtual door-closing) + ) + ) + ) + (suspend) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate door-closing (eco-door) + :virtual #t + :code (behavior () + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> self root backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((gp-0 (new 'stack 'overlaps-others-params))) + (set! (-> gp-0 options) (overlaps-others-options oo0)) + (set! (-> gp-0 tlist) #f) + (while (find-overlapping-shapes (-> self root) gp-0) + (suspend) + ) + ) + (sound-play-by-name (-> self close-sound) (new-sound-id) 1024 0 0 (sound-group) #t) + (until (ja-done? 0) + (ja :num! (seek! 0.0 (-> self speed))) + (suspend) + ) + (if (-> self locked) + (sound-play "door-lock") + ) + (go-virtual door-closed) + ) + :post transform-post + ) + +;; definition for method 24 of type eco-door +;; WARN: Return type mismatch int vs none. +(defmethod update-lock-status! ((this eco-door)) + (when (-> this state-actor) + (if (logtest? (-> this state-actor extra perm status) (entity-perm-status subtask-complete)) + (set! (-> this locked) (logtest? (-> this flags) (eco-door-flags unlocked))) + (set! (-> this locked) (logtest? (-> this flags) (eco-door-flags locked))) + ) + ) + 0 + (none) + ) + +;; definition for method 25 of type eco-door +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this eco-door)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 0) + (set-vector! (-> v1-2 local-sphere) 0.0 0.0 0.0 16384.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 26 of type eco-door +;; WARN: Return type mismatch int vs none. +(defmethod eco-door-method-26 ((this eco-door)) + 0 + (none) + ) + +;; definition for method 11 of type eco-door +(defmethod init-from-entity! ((this eco-door) (arg0 entity-actor)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (let ((f0-0 (res-lump-float (-> this entity) 'scale :default 1.0))) + (set-vector! (-> this root scale) f0-0 f0-0 f0-0 1.0) + ) + (set! (-> this open-distance) 32768.0) + (set! (-> this close-distance) 49152.0) + (set! (-> this speed) 1.0) + (set! (-> this state-actor) #f) + (let ((v1-8 (entity-actor-lookup arg0 'state-actor 0))) + (if v1-8 + (set! (-> this state-actor) v1-8) + ) + ) + (set! (-> this locked) #f) + (set! (-> this flags) (res-lump-value arg0 'flags eco-door-flags :time -1000000000.0)) + (update-lock-status! this) + (set! (-> this auto-close) (logtest? (-> this flags) (eco-door-flags auto-close))) + (set! (-> this one-way) (logtest? (-> this flags) (eco-door-flags one-way))) + (vector-z-quaternion! (-> this out-dir) (-> this root quat)) + (set! (-> this out-dir w) (- (vector-dot (-> this out-dir) (-> this root trans)))) + (update-transforms (-> this root)) + (eco-door-method-26 this) + (if (and (not (-> this auto-close)) + (-> this entity) + (logtest? (-> this entity extra perm status) (entity-perm-status subtask-complete)) + ) + (go (method-of-object this door-open)) + (go (method-of-object this door-closed)) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc new file mode 100644 index 00000000000..9715b516675 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/blocking-plane_REF.gc @@ -0,0 +1,292 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type blocking-plane +(deftype blocking-plane (process-drawable) + ((root collide-shape :override) + (current-attack-mode symbol) + ) + (:state-methods + idle + ) + (:methods + (init! (_type_ (inline-array vector) float) none) + ) + ) + +;; definition for method 3 of type blocking-plane +(defmethod inspect ((this blocking-plane)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tcurrent-attack-mode: ~A~%" (-> this current-attack-mode)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defskelgroup skel-blocking-plane blocking-plane blocking-plane-lod0-jg blocking-plane-idle-ja + ((blocking-plane-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 100.1) + :texture-level 10 + ) + +;; failed to figure out what this is: +(defstate idle (blocking-plane) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-0 object)) + (case message + (('on) + (cond + ((nonzero? (-> self root)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! v0-0 (-> self root backup-collide-with)) + (set! (-> v1-3 prim-core collide-with) (the-as collide-spec v0-0)) + ) + v0-0 + ) + (else + (let ((gp-1 (-> self child))) + (while gp-1 + (let ((s5-0 (ppointer->process gp-1))) + (set! gp-1 (-> gp-1 0 brother)) + (if (type? s5-0 blocking-plane) + (send-event s5-0 'on) + ) + ) + ) + ) + #f + ) + ) + ) + (('off) + (cond + ((nonzero? (-> self root)) + (let ((v1-13 (-> self root root-prim))) + (set! (-> v1-13 prim-core collide-as) (collide-spec)) + (set! (-> v1-13 prim-core collide-with) (collide-spec)) + ) + 0 + ) + (else + (let ((gp-2 (-> self child))) + (while gp-2 + (let ((s5-1 (ppointer->process gp-2))) + (set! gp-2 (-> gp-2 0 brother)) + (if (type? s5-1 blocking-plane) + (send-event s5-1 'off) + ) + ) + ) + ) + #f + ) + ) + ) + (('collide-as) + (set! v0-0 (-> block param 0)) + (set! (-> self root root-prim prim-core collide-as) (the-as collide-spec v0-0)) + v0-0 + ) + (('attack-mode) + (set! v0-0 (-> block param 0)) + (set! (-> self current-attack-mode) (the-as symbol v0-0)) + v0-0 + ) + (('touch 'bonk 'attack) + (when (-> self current-attack-mode) + (let ((v1-25 (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self root quat)))) + (if (< (vector-dot + (vector-! (new 'stack-no-clear 'vector) (-> (the-as process-drawable proc) root trans) (-> self root trans)) + v1-25 + ) + 0.0 + ) + (vector-float*! v1-25 v1-25 -1.0) + ) + (send-event + proc + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (mode (-> self current-attack-mode)) + (vector v1-25) + (shove-up (meters 2)) + (shove-back (meters 4)) + ) + ) + ) + ) + ) + ) + (('impact-impulse) + (send-event (ppointer->process (-> self parent)) 'blocking-plane-hit (-> block param 0)) + ) + ) + ) + :code sleep-code + ) + +;; definition for method 21 of type blocking-plane +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init! ((this blocking-plane) (arg0 (inline-array vector)) (arg1 float)) + (let ((s3-0 (-> arg0 0)) + (s4-0 (-> arg0 1)) + ) + 0.0 + (* 0.5 (vector-vector-distance s3-0 s4-0)) + (let ((s2-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (let ((v1-3 (new 'process 'collide-shape-prim-mesh s2-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-3 prim-core collide-as) (collide-spec obstacle blocking-plane)) + (set! (-> v1-3 prim-core collide-with) (collide-spec jak vehicle-sphere hit-by-others-list player-list)) + (set! (-> v1-3 prim-core action) (collide-action solid)) + (set! (-> v1-3 transform-index) 3) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-3) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-6 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> this root) s2-0) + ) + (let ((s1-0 (new 'stack-no-clear 'matrix)) + (s2-1 (-> this root)) + ) + (vector+! (-> s2-1 trans) s3-0 s4-0) + (vector-float*! (-> s2-1 trans) (-> s2-1 trans) 0.5) + (+! (-> s2-1 trans y) (* 0.5 arg1)) + (vector-! (-> s1-0 rvec) s4-0 s3-0) + (let ((f30-1 (vector-normalize-ret-len! (-> s1-0 rvec) 1.0))) + (set! (-> s2-1 scale x) (* 0.00024414062 f30-1)) + (set! (-> s2-1 scale y) (* 0.00024414062 arg1)) + (set! (-> s2-1 scale z) 0.0) + (set! (-> s1-0 uvec quad) (-> (new 'static 'vector :y 1.0 :w 1.0) quad)) + (vector-cross! (-> s1-0 fvec) (-> s1-0 rvec) (-> s1-0 uvec)) + (vector-normalize! (-> s1-0 fvec) 1.0) + (matrix->quaternion (-> s2-1 quat) s1-0) + (let ((v1-20 (-> this root root-prim local-sphere))) + (set! (-> v1-20 x) 0.0) + (set! (-> v1-20 y) (* 0.00024414062 (* 0.5 arg1))) + (set! (-> v1-20 z) 0.0) + (let ((f0-17 0.5) + (f1-7 (* f30-1 f30-1)) + (f2-2 arg1) + ) + (set! (-> v1-20 w) (* f0-17 (sqrtf (+ f1-7 (* f2-2 f2-2))))) + ) + ) + ) + ) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-blocking-plane" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (logior! (-> this draw status) (draw-control-status no-draw-bounds)) + (transform-post) + (none) + ) + +;; definition for function blocking-plane-init-by-other +(defbehavior blocking-plane-init-by-other blocking-plane ((arg0 (inline-array vector)) (arg1 float)) + (if (not arg0) + (deactivate self) + ) + (init! self arg0 arg1) + (set! (-> self current-attack-mode) #f) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (go-virtual idle) + ) + +;; definition for method 11 of type blocking-plane +;; INFO: Used lq/sq +(defmethod init-from-entity! ((this blocking-plane) (arg0 entity-actor)) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this current-attack-mode) #f) + (let ((s5-0 (new 'process 'path-control this 'path 0.0 (the-as entity #f) #f)) + (f30-0 (res-lump-float (-> this entity) 'height :default 122880.0)) + ) + (set! (-> this path) s5-0) + (if (or (not s5-0) (< (-> s5-0 curve num-cverts) 2)) + (go process-drawable-art-error "bad path") + ) + (logior! (-> s5-0 flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((s4-0 (+ (-> s5-0 curve num-cverts) -1)) + (s3-0 (new 'stack-no-clear 'inline-array 'vector 2)) + ) + (dotimes (v1-14 2) + (set! (-> s3-0 v1-14 quad) (the-as uint128 0)) + ) + (dotimes (s2-0 s4-0) + (get-point-in-path! s5-0 (-> s3-0 0) (the float s2-0) 'interp) + (get-point-in-path! s5-0 (-> s3-0 1) (the float (+ s2-0 1)) 'interp) + (process-spawn blocking-plane s3-0 f30-0 :name "blocking-plane" :to this) + ) + ) + ) + (go (method-of-object this idle)) + ) + +;; definition for function blocking-plane-spawn +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior blocking-plane-spawn process ((arg0 curve-control) (arg1 (inline-array vector)) (arg2 float)) + (cond + ((and arg1 (or (not arg0) (logtest? (-> arg0 flags) (path-control-flag not-found)))) + (process-spawn blocking-plane arg1 arg2 :name "blocking-plane" :to self) + ) + (else + (let ((s4-1 (the int (get-num-segments arg0))) + (s3-0 0) + (s2-0 (new 'stack-no-clear 'inline-array 'vector 2)) + ) + (dotimes (v1-8 2) + (set! (-> s2-0 v1-8 quad) (the-as uint128 0)) + ) + (while (< s3-0 s4-1) + (get-point-in-path! arg0 (-> s2-0 0) (the float s3-0) 'interp) + (get-point-in-path! arg0 (-> s2-0 1) (the float (+ s3-0 1)) 'interp) + (process-spawn blocking-plane s2-0 arg2 :name "blocking-plane" :to self) + (+! s3-0 2) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for function blocking-plane-destroy +;; WARN: Return type mismatch int vs none. +(defbehavior blocking-plane-destroy blocking-plane () + (let ((gp-0 (-> self child))) + (while gp-0 + (let ((s5-0 (ppointer->process gp-0))) + (set! gp-0 (-> gp-0 0 brother)) + (if (type? s5-0 blocking-plane) + (deactivate s5-0) + ) + ) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/bouncer_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/bouncer_REF.gc new file mode 100644 index 00000000000..be7b2d0b7c0 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/bouncer_REF.gc @@ -0,0 +1,277 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type bouncer +(deftype bouncer (process-drawable) + ((root collide-shape :override) + (spring-height meters) + (smush float) + (mods basic) + (use-alternate-jump? symbol) + ) + (:state-methods + idle + fire + smush + ) + (:methods + (bouncer-method-23 (_type_) none) + (bouncer-method-24 (_type_) none) + (play-sound (_type_) none) + (bouncer-method-26 (_type_) none) + ) + ) + +;; definition for method 3 of type bouncer +(defmethod inspect ((this bouncer)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tspring-height: (meters ~m)~%" (-> this spring-height)) + (format #t "~2Tsmush: ~f~%" (-> this smush)) + (format #t "~2Tmods: ~A~%" (-> this mods)) + (format #t "~2Tuse-alternate-jump?: ~A~%" (-> this use-alternate-jump?)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(method-set! bouncer 12 (method-of-type process run-logic?)) + +;; failed to figure out what this is: +(defstate idle (bouncer) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('bonk) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> block param 0)) + (-> self root) + (the-as uint 1) + ) + (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + (play-sound self) + (go-virtual fire) + ) + ) + ) + (('touch) + (let ((gp-1 (-> block param 0))) + (cond + (((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (collide-action solid) + (collide-action) + ) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (the-as uint 1) + ) + (if (not (and (-> self next-state) (let ((v1-22 (-> self next-state name))) + (or (= v1-22 'smush) (= v1-22 'fire)) + ) + ) + ) + (go-virtual smush) + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-1) + (-> self root) + (the-as uint 4) + ) + (persist-with-delay + *setting-control* + (the-as symbol (process->ppointer self)) + (seconds 0.05) + 'double-jump + #f + 0.0 + 0 + ) + ) + ) + ) + ) + (('attack) + (let ((v1-29 (the-as object (-> block param 1))) + (a0-16 (-> block param 0)) + (a2-6 0) + ) + (cond + ((= (-> (the-as attack-info v1-29) mode) 'flop) + (set! a2-6 1) + ) + ((= (-> (the-as attack-info v1-29) mode) 'board) + (set! a2-6 9) + ) + ) + (when (and (nonzero? a2-6) + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry a0-16) + (-> self root) + (the-as uint a2-6) + ) + (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + ) + ) + (play-sound self) + (go-virtual fire) + #f + ) + ) + ) + ) + ) + :code (behavior () + (if (nonzero? (-> self draw)) + (ja :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) :num! min) + ) + (transform-post) + (until #f + (logior! (-> self mask) (process-mask sleep)) + (suspend) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate smush (bouncer) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touch) + (set-time! (-> self state-time)) + #f + ) + (else + ((-> (method-of-object self idle) event) proc argc message block) + ) + ) + ) + :code (behavior () + (set-time! (-> self state-time)) + (set! (-> self smush) 0.0) + (until #f + (if (and (nonzero? (-> self draw)) (time-elapsed? (-> self state-time) (seconds 0.2))) + (ja :num! (seek! 0.0 0.1)) + (ja :num! (seek! + (lerp-scale + (ja-aframe 6.0 0) + (ja-aframe 2.0 0) + (vector-vector-xz-distance (target-pos 0) (-> self root trans)) + 0.0 + 4096.0 + ) + 0.2 + ) + ) + ) + (suspend) + (let ((v1-17 (and (nonzero? (-> self draw)) (ja-min? 0)))) + (if v1-17 + (go-virtual idle) + (go-virtual idle) + ) + ) + ) + #f + ) + :post transform-post + ) + +;; failed to figure out what this is: +(defstate fire (bouncer) + :virtual #t + :code (behavior () + (when (or (-> self use-alternate-jump?) (-> *setting-control* user-current use-alternate-bouncer?)) + (persist-with-delay *setting-control* 'slave-options (seconds 2.5) 'slave-options 'clear 0.0 16) + (persist-with-delay *setting-control* 'slave-options2 (seconds 2.5) 'slave-options 'set 0.0 #x2000000) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 178 (seconds 0.1)) + (bouncer-method-26 self) + (when (nonzero? (-> self draw)) + (ja-no-eval :group! (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) + :num! (seek!) + :frame-num (ja-aframe 6.0 0) + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (go-virtual idle) + ) + :post transform-post + ) + +;; definition for method 25 of type bouncer +;; WARN: Return type mismatch int vs none. +(defmethod play-sound ((this bouncer)) + (sound-play "trampoline") + 0 + (none) + ) + +;; definition for method 26 of type bouncer +;; WARN: Return type mismatch int vs none. +(defmethod bouncer-method-26 ((this bouncer)) + 0 + (none) + ) + +;; definition for method 23 of type bouncer +;; WARN: Return type mismatch int vs none. +(defmethod bouncer-method-23 ((this bouncer)) + (break!) + 0 + (none) + ) + +;; definition for method 24 of type bouncer +;; WARN: Return type mismatch int vs none. +(defmethod bouncer-method-24 ((this bouncer)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec crate)) + (set! (-> v1-2 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 0) + (set-vector! (-> v1-2 local-sphere) 0.0 3072.0 0.0 6963.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 11 of type bouncer +(defmethod init-from-entity! ((this bouncer) (arg0 entity-actor)) + (set! (-> this mods) #f) + (bouncer-method-24 this) + (process-drawable-from-entity! this arg0) + (bouncer-method-23 this) + (nav-mesh-connect-from-ent this) + (set! (-> this spring-height) (res-lump-float arg0 'spring-height :default 45056.0)) + (set! (-> this use-alternate-jump?) (= (res-lump-value arg0 'behavior-type uint128 :time -1000000000.0) 1)) + (go (method-of-object this idle)) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc index a8e7eb4934e..89af356e5fe 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/collectables_REF.gc @@ -521,50 +521,16 @@ (cond ((logtest? (-> this collect-effect flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s4-10 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-10 - (let ((t9-23 (method-of-type part-tracker-subsampler activate))) - (t9-23 (the-as part-tracker-subsampler s4-10) s5-1 "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-24 run-function-in-process) - (a0-77 s4-10) - (a1-33 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> this collect-effect)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-24) a0-77 a1-33 *part-tracker-subsampler-params-default*) - ) - (-> s4-10 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to s5-1 + :group (-> this collect-effect) + :callback part-tracker-track-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s4-11 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-11 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker s4-11) s5-1 "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-84 s4-11) - (a1-36 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> this collect-effect)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-84 a1-36 *part-tracker-params-default*) - ) - (-> s4-11 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to s5-1 :group (-> this collect-effect) :callback part-tracker-track-target) ) ) ) @@ -572,99 +538,68 @@ (cond ((logtest? (-> this collect-effect2 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-29 (method-of-type part-tracker-subsampler activate))) - (t9-29 (the-as part-tracker-subsampler s5-2) this "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-30 run-function-in-process) - (a0-91 s5-2) - (a1-39 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> this collect-effect2)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) - (lambda ((arg0 part-tracker)) - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) + (part-tracker-spawn + part-tracker-subsampler + :to this + :group (-> this collect-effect2) + :callback (lambda ((arg0 part-tracker)) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) - ) - ) - ) - ) - ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) ) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint (process->handle this))) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-30) a0-91 a1-39 *part-tracker-subsampler-params-default*) + ) + ) ) - (-> s5-2 ppointer) ) + :userdata (the-as uint (process->handle this)) ) ) (else (set! (-> *launch-matrix* trans quad) (-> this root root-prim prim-core world-sphere quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-32 (method-of-type part-tracker activate))) - (t9-32 (the-as part-tracker s5-3) this "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-33 run-function-in-process) - (a0-98 s5-3) - (a1-42 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> this collect-effect2)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) - (lambda ((arg0 part-tracker)) - (let ((v1-1 (handle->process (-> arg0 userdata)))) - (when (the-as process v1-1) - (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) - (a0-9 (if (type? s5-0 process-focusable) - s5-0 - ) - ) - (a2-0 (if (not a0-9) - (-> arg0 root trans) - (get-trans (the-as process-focusable a0-9) 3) - ) - ) + (part-tracker-spawn + part-tracker + :to this + :group (-> this collect-effect2) + :callback (lambda ((arg0 part-tracker)) + (let ((v1-1 (handle->process (-> arg0 userdata)))) + (when (the-as process v1-1) + (let* ((s5-0 (handle->process (-> (the-as collectable v1-1) pickup-handle))) + (a0-9 (if (type? s5-0 process-focusable) + s5-0 ) - (vector-lerp! - (-> arg0 root trans) - (-> arg0 offset) - a2-0 - (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) - ) - ) - ) - ) - ) + ) + (a2-0 (if (not a0-9) + (-> arg0 root trans) + (get-trans (the-as process-focusable a0-9) 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (/ (the float (- (current-time) (-> arg0 state-time))) (the float (-> arg0 part group duration))) ) - (set! (-> *part-tracker-params-default* userdata) (the-as uint (process->handle this))) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-33) a0-98 a1-42 *part-tracker-params-default*) + ) + ) ) - (-> s5-3 ppointer) ) + :userdata (the-as uint (process->handle this)) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/crates_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/crates_REF.gc index 4f664099917..191d10ac8a4 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/crates_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/crates_REF.gc @@ -1032,50 +1032,11 @@ (cond ((logtest? (-> *part-group-id-table* 197 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-9 - (let ((t9-19 (method-of-type part-tracker-subsampler activate))) - (t9-19 (the-as part-tracker-subsampler s5-9) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-20 run-function-in-process) - (a0-41 s5-9) - (a1-20 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 197)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-20) a0-41 a1-20 *part-tracker-subsampler-params-default*) - ) - (-> s5-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 197)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-10 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s5-10) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-47 s5-10) - (a1-23 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 197)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-23) a0-47 a1-23 *part-tracker-params-default*) - ) - (-> s5-10 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 197)) ) ) ) @@ -1083,99 +1044,21 @@ (cond ((logtest? (-> *part-group-id-table* 196 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-11 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-11 - (let ((t9-25 (method-of-type part-tracker-subsampler activate))) - (t9-25 (the-as part-tracker-subsampler s5-11) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-26 run-function-in-process) - (a0-55 s5-11) - (a1-27 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 196)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-26) a0-55 a1-27 *part-tracker-subsampler-params-default*) - ) - (-> s5-11 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 196)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-12 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-12 - (let ((t9-28 (method-of-type part-tracker activate))) - (t9-28 (the-as part-tracker s5-12) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-29 run-function-in-process) - (a0-61 s5-12) - (a1-30 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 196)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-29) a0-61 a1-30 *part-tracker-params-default*) - ) - (-> s5-12 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 196)) ) ) ) ((logtest? (-> *part-group-id-table* 195 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-13 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-13 - (let ((t9-31 (method-of-type part-tracker-subsampler activate))) - (t9-31 (the-as part-tracker-subsampler s5-13) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-67 s5-13) - (a1-33 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 195)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-32) a0-67 a1-33 *part-tracker-subsampler-params-default*) - ) - (-> s5-13 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 195)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((s5-14 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-14 - (let ((t9-34 (method-of-type part-tracker activate))) - (t9-34 (the-as part-tracker s5-14) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-35 run-function-in-process) - (a0-73 s5-14) - (a1-36 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 195)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-35) a0-73 a1-36 *part-tracker-params-default*) - ) - (-> s5-14 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 195)) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc new file mode 100644 index 00000000000..3b8f4e6eb4b --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/debris_REF.gc @@ -0,0 +1,742 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type debris-static-joint-params +(deftype debris-static-joint-params (structure) + ((parent-joint-index int16) + (group string) + (offset vector) + ) + ) + +;; definition for method 3 of type debris-static-joint-params +(defmethod inspect ((this debris-static-joint-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'debris-static-joint-params) + (format #t "~1Tparent-joint-index: ~D~%" (-> this parent-joint-index)) + (format #t "~1Tgroup: ~A~%" (-> this group)) + (format #t "~1Toffset: #~%" (-> this offset)) + (label cfg-4) + this + ) + +;; definition of type debris-static-params +(deftype debris-static-params (basic) + ((joints (array debris-static-joint-params)) + (collide-spec collide-spec) + (sound-hit sound-name) + (art-level symbol) + ) + ) + +;; definition for method 3 of type debris-static-params +;; INFO: Used lq/sq +(defmethod inspect ((this debris-static-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tjoints: ~A~%" (-> this joints)) + (format #t "~1Tcollide-spec: ~D~%" (-> this collide-spec)) + (format #t "~1Tsound-hit: ~D~%" (-> this sound-hit)) + (format #t "~1Tart-level: ~A~%" (-> this art-level)) + (label cfg-4) + this + ) + +;; definition of type debris +(deftype debris (basic) + ((root transformq :inline) + (node-list cspace-array) + (draw draw-control) + (duration float) + (hit-xz-reaction float) + (hit-y-reaction float) + (prev-pos vector :inline) + (gravity float) + (rot-axis vector :inline) + (rot-angle float) + (transv vector :inline) + (time-fade-out time-frame) + (params debris-static-params) + ) + ) + +;; definition for method 3 of type debris +(defmethod inspect ((this debris)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Troot: #~%" (-> this root)) + (format #t "~1Tnode-list: ~A~%" (-> this node-list)) + (format #t "~1Tdraw: ~A~%" (-> this draw)) + (format #t "~1Tduration: ~f~%" (-> this duration)) + (format #t "~1Thit-xz-reaction: ~f~%" (-> this hit-xz-reaction)) + (format #t "~1Thit-y-reaction: ~f~%" (-> this hit-y-reaction)) + (format #t "~1Tprev-pos: #~%" (-> this prev-pos)) + (format #t "~1Tgravity: ~f~%" (-> this gravity)) + (format #t "~1Trot-axis: #~%" (-> this rot-axis)) + (format #t "~1Trot-angle: ~f~%" (-> this rot-angle)) + (format #t "~1Ttransv: #~%" (-> this transv)) + (format #t "~1Ttime-fade-out: ~D~%" (-> this time-fade-out)) + (format #t "~1Tparams: ~A~%" (-> this params)) + (label cfg-4) + this + ) + +;; definition of type debris-box +(deftype debris-box (structure) + ((start uint32) + (num uint32) + (bbox bounding-box :inline) + ) + ) + +;; definition for method 3 of type debris-box +(defmethod inspect ((this debris-box)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'debris-box) + (format #t "~1Tstart: ~D~%" (-> this start)) + (format #t "~1Tnum: ~D~%" (-> this num)) + (format #t "~1Tbbox: #~%" (-> this bbox)) + (label cfg-4) + this + ) + +;; definition of type debris-group +(deftype debris-group (process) + ((dead-debris-num int32) + (debris-num int32) + (debris (array debris)) + (max-probe-width float) + (state-time time-frame) + (num-boxes uint32) + (boxes debris-box 16 :inline) + ) + (:state-methods + idle + ) + (:methods + (do-collision (_type_ int) none) + (update-box! (_type_ int) none) + ) + ) + +;; definition for method 3 of type debris-group +(defmethod inspect ((this debris-group)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tdead-debris-num: ~D~%" (-> this dead-debris-num)) + (format #t "~2Tdebris-num: ~D~%" (-> this debris-num)) + (format #t "~2Tdebris: ~A~%" (-> this debris)) + (format #t "~2Tmax-probe-width: ~f~%" (-> this max-probe-width)) + (format #t "~2Tstate-time: ~D~%" (-> this state-time)) + (format #t "~2Tnum-boxes: ~D~%" (-> this num-boxes)) + (format #t "~2Tboxes[16] @ #x~X~%" (-> this boxes)) + (label cfg-4) + this + ) + +;; definition of type debris-tuning +(deftype debris-tuning (structure) + ((explosion uint64) + (duration time-frame) + (gravity float) + (rot-speed float) + (bounds-inflate float) + (max-probe-width float) + (max-probe-height float) + (max-probe-depth float) + (fountain-rand-transv-lo vector :inline) + (fountain-rand-transv-hi vector :inline) + (away-from-focal-pt vector :inline :overlay-at fountain-rand-transv-lo) + (away-from-rand-transv-xz-lo float :overlay-at (-> fountain-rand-transv-hi data 0)) + (away-from-rand-transv-xz-hi float :overlay-at (-> fountain-rand-transv-hi data 1)) + (away-from-rand-transv-y-lo float :overlay-at (-> fountain-rand-transv-hi data 2)) + (away-from-rand-transv-y-hi float :overlay-at (-> fountain-rand-transv-hi data 3)) + (hit-xz-reaction float) + (hit-y-reaction float) + (scale-rand-lo float) + (scale-rand-hi float) + ) + (:methods + (new (symbol type uint) _type_) + ) + ) + +;; definition for method 3 of type debris-tuning +(defmethod inspect ((this debris-tuning)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'debris-tuning) + (format #t "~1Texplosion: ~D~%" (-> this explosion)) + (format #t "~1Tduration: ~D~%" (-> this duration)) + (format #t "~1Tgravity: ~f~%" (-> this gravity)) + (format #t "~1Trot-speed: ~f~%" (-> this rot-speed)) + (format #t "~1Tbounds-inflate: ~f~%" (-> this bounds-inflate)) + (format #t "~1Tmax-probe-width: ~f~%" (-> this max-probe-width)) + (format #t "~1Tmax-probe-height: ~f~%" (-> this max-probe-height)) + (format #t "~1Tmax-probe-depth: ~f~%" (-> this max-probe-depth)) + (format #t "~1Tfountain-rand-transv-lo: #~%" (-> this fountain-rand-transv-lo)) + (format #t "~1Tfountain-rand-transv-hi: #~%" (-> this fountain-rand-transv-hi)) + (format #t "~1Taway-from-focal-pt: #~%" (-> this fountain-rand-transv-lo)) + (format #t "~1Taway-from-rand-transv-xz-lo: ~f~%" (-> this fountain-rand-transv-hi x)) + (format #t "~1Taway-from-rand-transv-xz-hi: ~f~%" (-> this fountain-rand-transv-hi y)) + (format #t "~1Taway-from-rand-transv-y-lo: ~f~%" (-> this fountain-rand-transv-hi z)) + (format #t "~1Taway-from-rand-transv-y-hi: ~f~%" (-> this fountain-rand-transv-hi w)) + (format #t "~1Thit-xz-reaction: ~f~%" (-> this hit-xz-reaction)) + (format #t "~1Thit-y-reaction: ~f~%" (-> this hit-y-reaction)) + (format #t "~1Tscale-rand-lo: ~f~%" (-> this scale-rand-lo)) + (format #t "~1Tscale-rand-hi: ~f~%" (-> this scale-rand-hi)) + (label cfg-4) + this + ) + +;; definition for method 0 of type debris-tuning +;; WARN: Return type mismatch structure vs debris-tuning. +(defmethod new debris-tuning ((allocation symbol) (type-to-make type) (arg0 uint)) + (let ((t9-0 (method-of-type structure new)) + (v1-1 type-to-make) + ) + (-> type-to-make size) + (let ((v0-0 (t9-0 allocation v1-1))) + (set! (-> (the-as debris-tuning v0-0) explosion) arg0) + (set! (-> (the-as debris-tuning v0-0) duration) (seconds 1)) + (set! (-> (the-as debris-tuning v0-0) gravity) -286720.0) + (set! (-> (the-as debris-tuning v0-0) rot-speed) 180.0) + (set! (-> (the-as debris-tuning v0-0) bounds-inflate) 16384.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-width) 40960.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-height) 24576.0) + (set! (-> (the-as debris-tuning v0-0) max-probe-depth) 20480.0) + (set! (-> (the-as debris-tuning v0-0) hit-xz-reaction) 0.75) + (set! (-> (the-as debris-tuning v0-0) hit-y-reaction) 0.7) + (set! (-> (the-as debris-tuning v0-0) scale-rand-lo) 0.8) + (set! (-> (the-as debris-tuning v0-0) scale-rand-hi) 2.0) + (cond + ((zero? arg0) + (set-vector! (-> (the-as debris-tuning v0-0) fountain-rand-transv-lo) -81920.0 20480.0 -81920.0 1.0) + (set-vector! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi) 81920.0 61440.0 81920.0 1.0) + ) + ((= arg0 1) + (vector-reset! (-> (the-as debris-tuning v0-0) fountain-rand-transv-lo)) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi x) 49152.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi y) 163840.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi z) 20480.0) + (set! (-> (the-as debris-tuning v0-0) fountain-rand-transv-hi w) 61440.0) + ) + ) + (the-as debris-tuning v0-0) + ) + ) + ) + +;; definition for method 16 of type debris-group +;; WARN: Return type mismatch int vs none. +(defmethod update-box! ((this debris-group) (idx int)) + (let ((debris-box (-> this boxes idx))) + (dotimes (i (the-as int (-> debris-box num))) + (let ((debris (-> this debris (+ i (-> debris-box start))))) + (if (zero? i) + (set-to-point! (-> debris-box bbox) (the-as vector (-> debris root))) + (add-point! (-> debris-box bbox) (the-as vector (-> debris root))) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 15 of type debris-group +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-collision ((this debris-group) (idx int)) + (local-vars + (sv-80 (function sound-name sound-id int int int sound-group object sound-id :behavior process-drawable)) + (name sound-name) + ) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((debris-box (-> this boxes idx)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) + ) + (when (> box-num 0) + (let ((cquery (new 'static 'collide-query))) + (let ((debris-start (-> this debris box-start))) + (let ((a3-0 (-> cquery bbox)) + (a1-2 (-> bbox min)) + (a2-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-0 x) 4096.0) + (set! (-> a2-0 y) 4096.0) + (set! (-> a2-0 z) 4096.0) + (set! (-> a2-0 w) 1.0) + (vector-! (the-as vector a3-0) a1-2 a2-0) + ) + (let ((a1-3 (-> cquery bbox max)) + (a0-2 (-> bbox max)) + (a2-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> a2-1 x) 4096.0) + (set! (-> a2-1 y) 4096.0) + (set! (-> a2-1 z) 4096.0) + (set! (-> a2-1 w) 1.0) + (vector+! a1-3 a0-2 a2-1) + ) + (set! (-> cquery collide-with) (-> debris-start params collide-spec)) + ) + (set! (-> cquery ignore-process0) #f) + (set! (-> cquery ignore-process1) #f) + (set! (-> cquery ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> cquery action-mask) (collide-action solid)) + (fill-using-bounding-box *collide-cache* cquery) + (dotimes (s2-0 (the-as int box-num)) + (let ((s1-0 (-> this debris (+ s2-0 box-start)))) + (when (not (logtest? (-> this debris (+ s2-0 box-start) draw status) (draw-control-status no-draw))) + (let ((f0-9 (* (-> s1-0 gravity) (seconds-per-frame))) + (s0-0 (new 'stack-no-clear 'quaternion)) + ) + (set! (-> s1-0 prev-pos quad) (-> s1-0 root trans quad)) + (+! (-> s1-0 transv y) f0-9) + (vector-v+! (the-as vector (-> s1-0 root)) (the-as vector (-> s1-0 root)) (-> s1-0 transv)) + (quaternion-vector-angle! s0-0 (-> s1-0 rot-axis) (* (-> s1-0 rot-angle) (seconds-per-frame))) + (quaternion*! (-> s1-0 root quat) (-> s1-0 root quat) s0-0) + ) + (quaternion-normalize! (-> s1-0 root quat)) + (set! (-> s1-0 rot-angle) (- (-> s1-0 rot-angle) (* (seconds-per-frame) (-> s1-0 rot-angle)))) + (when (nonzero? (-> s1-0 params collide-spec)) + (let ((s0-1 (new 'stack-no-clear 'vector))) + (vector-! (-> cquery move-dist) (the-as vector (-> s1-0 root)) (-> s1-0 prev-pos)) + (set! (-> cquery start-pos quad) (-> s1-0 prev-pos quad)) + (let ((v1-34 cquery)) + (set! (-> v1-34 radius) 2048.0) + (set! (-> v1-34 collide-with) (-> s1-0 params collide-spec)) + (set! (-> v1-34 ignore-process0) #f) + (set! (-> v1-34 ignore-process1) #f) + (set! (-> v1-34 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-34 action-mask) (collide-action solid)) + ) + (let ((f0-16 (probe-using-line-sphere *collide-cache* cquery))) + (when (>= f0-16 0.0) + (let ((a1-12 s0-1)) + (let ((v1-37 (-> cquery start-pos))) + (let ((a0-21 (-> cquery move-dist))) + (let ((a2-5 f0-16)) + (.mov vf7 a2-5) + ) + (.lvf vf5 (&-> a0-21 quad)) + ) + (.lvf vf4 (&-> v1-37 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-12 quad) vf6) + ) + (let* ((v1-38 (-> s1-0 transv)) + (f30-0 (sqrtf (+ (* (-> v1-38 x) (-> v1-38 x)) (* (-> v1-38 z) (-> v1-38 z))))) + ) + (let ((f28-0 (vector-length (-> s1-0 transv)))) + (when (< (-> s1-0 transv y) -61440.0) + (set! sv-80 sound-play-by-name) + (set! name (-> s1-0 params sound-hit)) + (let ((id (new-sound-id)) + (a2-6 1024) + (a3-6 0) + (t0-4 0) + (t1-0 0) + (t2-0 (-> s1-0 root)) + ) + (sv-80 name id a2-6 a3-6 t0-4 (the-as sound-group t1-0) t2-0) + ) + ) + (vector-reflect! (-> s1-0 transv) (-> s1-0 transv) (-> cquery best-other-tri normal)) + (vector-reflect! (-> s1-0 rot-axis) (-> s1-0 rot-axis) (-> cquery best-other-tri normal)) + (set! (-> s1-0 rot-angle) f28-0) + ) + (let ((f28-1 (-> s1-0 transv y))) + (vector-xz-normalize! (-> s1-0 transv) (* f30-0 (-> s1-0 hit-xz-reaction))) + (set! (-> s1-0 transv y) (* f28-1 (-> s1-0 hit-y-reaction))) + ) + ) + (+! (-> s0-1 y) (* 40.96 (-> cquery best-other-tri normal y))) + (set! (-> s0-1 w) 1.0) + (set! (-> s1-0 root trans quad) (-> s0-1 quad)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (debris-group) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (set! (-> self dead-debris-num) (-> self debris-num)) + (dotimes (i (-> self debris-num)) + (let ((debris (-> self debris i)) + (draw-ctrl (-> self debris i draw)) + ) + (matrix<-transformq+trans! + (the-as matrix (-> draw-ctrl skeleton bones 3)) + (-> debris root) + (-> draw-ctrl skeleton bones 0 transform trans) + ) + (logclear! (-> draw-ctrl status) (draw-control-status no-draw-temp uninited)) + (vector+! (-> draw-ctrl origin) (-> draw-ctrl skeleton bones 3 transform trans) (-> draw-ctrl bounds)) + (set! (-> draw-ctrl origin w) (-> draw-ctrl bounds w)) + (cond + ((zero? (-> debris time-fade-out)) + (if (or (< (vector-length (-> debris transv)) 4096.0) + (time-elapsed? (-> self state-time) (the int (-> debris duration))) + ) + (set-time! (-> debris time-fade-out)) + ) + ) + ((time-elapsed? (-> debris time-fade-out) (seconds 0.5)) + (logior! (-> draw-ctrl status) (draw-control-status no-draw)) + (+! (-> self dead-debris-num) -1) + ) + (else + (logior! (-> draw-ctrl status) (draw-control-status force-fade)) + (set! (-> draw-ctrl force-fade) + (the-as uint (the int (- 128.0 (* 0.85333335 (the float (- (current-time) (-> debris time-fade-out))))))) + ) + ) + ) + ) + ) + (if (zero? (-> self dead-debris-num)) + (deactivate self) + ) + (dotimes (ii (the-as int (-> self num-boxes))) + (let* ((debris-box (-> self boxes ii)) + (box-num (-> debris-box num)) + (box-start (-> debris-box start)) + (bbox (-> debris-box bbox)) + (s2-0 0) + ) + (update-box! self ii) + (if (< (- (-> bbox max data s2-0) (-> bbox min data s2-0)) (- (-> bbox max y) (-> bbox min y))) + (set! s2-0 1) + ) + (if (< (- (-> bbox max data s2-0) (-> bbox min data s2-0)) (- (-> bbox max z) (-> bbox min z))) + (set! s2-0 2) + ) + (when (and (< (-> self max-probe-width) (- (-> debris-box bbox max data s2-0) (-> bbox min data s2-0))) + (< (-> self num-boxes) (the-as uint 15)) + ) + 0.0 + (let ((a1-3 (new 'static 'boxed-array :type debris :length 0 :allocated-length 32)) + (a0-12 0) + (v1-72 0) + (a2-4 (-> self boxes (-> self num-boxes))) + ) + (let ((f0-14 (* 0.5 (+ (-> debris-box bbox min data s2-0) (-> debris-box bbox max data s2-0))))) + (dotimes (a3-6 (the-as int box-num)) + (let ((t0-4 (-> self debris (+ a3-6 (-> debris-box start))))) + (cond + ((< (-> t0-4 root trans data s2-0) f0-14) + (set! (-> self debris (+ a0-12 box-start)) (-> self debris (+ a3-6 box-start))) + (+! a0-12 1) + ) + (else + (set! (-> a1-3 v1-72) (-> self debris (+ a3-6 box-start))) + (+! v1-72 1) + ) + ) + ) + ) + ) + (dotimes (a3-9 v1-72) + (set! (-> self debris (+ a0-12 box-start a3-9)) (-> a1-3 a3-9)) + ) + (set! (-> debris-box num) (the-as uint a0-12)) + (set! (-> a2-4 start) (+ box-start a0-12)) + (set! (-> a2-4 num) (the-as uint v1-72)) + ) + (update-box! self ii) + (update-box! self (the-as int (-> self num-boxes))) + (+! (-> self num-boxes) 1) + ) + ) + ) + (dotimes (gp-2 (the-as int (-> self num-boxes))) + (do-collision self gp-2) + ) + ) + :code sleep-code + ) + +;; definition for method 7 of type debris-group +;; WARN: Return type mismatch process vs debris-group. +(defmethod relocate ((this debris-group) (offset int)) + (dotimes (v1-0 (-> this debris length)) + (if (nonzero? (-> this debris v1-0 node-list)) + (&+! (-> this debris v1-0 node-list) offset) + ) + (if (nonzero? (-> this debris v1-0 draw)) + (&+! (-> this debris v1-0 draw) offset) + ) + (if (nonzero? (-> this debris v1-0)) + (&+! (-> this debris v1-0) offset) + ) + ) + (if (nonzero? (-> this debris)) + (&+! (-> this debris) offset) + ) + (the-as debris-group ((method-of-type process relocate) this offset)) + ) + +;; definition for function debris-group-init-by-other +;; INFO: Used lq/sq +(defbehavior debris-group-init-by-other debris-group ((tuning debris-tuning) (params debris-static-params) (pdraw process-drawable)) + (local-vars (tuning-scale vector) (debris-scale vector) (sv-80 vector) (sv-96 vector) (sv-112 vector)) + (rlet ((vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + ) + (init-vf0-vector) + (stack-size-set! (-> self main-thread) 512) + (set! (-> self debris-num) (-> params joints length)) + (set! (-> self debris) (new 'process 'boxed-array debris (-> self debris-num))) + (set! (-> self debris length) (-> self debris allocated-length)) + (dotimes (i (-> params joints length)) + (set! (-> self debris i) (new 'process 'debris)) + (let ((skel (art-group-get-by-name *level* (-> params joints i group) (the-as (pointer level) #f))) + (debris (-> self debris i)) + ) + (cond + ((and skel (nonzero? skel)) + (set! (-> debris params) params) + (let ((joint-transform (-> pdraw node-list data (-> params joints i parent-joint-index) bone transform))) + (matrix->quaternion (-> debris root quat) joint-transform) + (matrix->trans joint-transform (the-as vector (-> debris root))) + (set! (-> debris root scale quad) (-> pdraw root scale quad)) + (if (nonzero? (-> params joints i offset)) + (vector-matrix*! (the-as vector (-> debris root)) (-> params joints i offset) joint-transform) + ) + ) + (set! debris-scale (-> debris root scale)) + (let ((s0-1 (-> debris root scale))) + (set! tuning-scale (new 'stack-no-clear 'vector)) + (set! (-> tuning-scale x) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale y) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale z) (rand-vu-float-range (-> tuning scale-rand-lo) (-> tuning scale-rand-hi))) + (set! (-> tuning-scale w) 1.0) + (.lvf vf4 (&-> s0-1 quad)) + ) + (.lvf vf5 (&-> tuning-scale quad)) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.vf vf6 vf4 vf5 :mask #b111) + (.svf (&-> debris-scale quad) vf6) + (case (-> tuning explosion) + ((1) + (vector-! (-> debris transv) (the-as vector (-> debris root)) (-> tuning fountain-rand-transv-lo)) + (let ((s0-2 vector-normalize!)) + (set! sv-80 (-> debris transv)) + (let ((a1-17 (rand-vu-float-range (-> tuning fountain-rand-transv-hi x) (-> tuning fountain-rand-transv-hi y)))) + (s0-2 sv-80 a1-17) + ) + ) + (+! (-> debris transv y) + (rand-vu-float-range (-> tuning fountain-rand-transv-hi z) (-> tuning fountain-rand-transv-hi w)) + ) + (set! (-> debris transv w) 1.0) + ) + (else + (set! sv-96 (-> tuning fountain-rand-transv-lo)) + (set! sv-112 (-> tuning fountain-rand-transv-hi)) + (set-vector! + (-> debris transv) + (rand-vu-float-range (-> sv-96 x) (-> sv-112 x)) + (rand-vu-float-range (-> sv-96 y) (-> sv-112 y)) + (rand-vu-float-range (-> sv-96 z) (-> sv-112 z)) + 1.0 + ) + ) + ) + (let ((s0-5 (new 'stack-no-clear 'vector))) + (rand-vu-sphere-point-uniform! s0-5 1.0) + (vector-normalize! s0-5 1.0) + (set! (-> debris rot-axis quad) (-> s0-5 quad)) + ) + (set! (-> debris rot-angle) (* 182.04445 (-> tuning rot-speed))) + (set! (-> debris duration) (the float (-> tuning duration))) + (set! (-> debris hit-xz-reaction) (-> tuning hit-xz-reaction)) + (set! (-> debris hit-y-reaction) (-> tuning hit-y-reaction)) + (set! (-> debris gravity) (-> tuning gravity)) + (set! (-> debris time-fade-out) 0) + (let ((draw (skeleton-group->draw-control + (the-as process-drawable self) + (the-as skeleton-group skel) + (&-> debris node-list) + ) + ) + ) + (set! (-> debris draw) draw) + (set! (-> draw skeleton bones 0 transform trans quad) (-> *null-vector* quad)) + ) + ) + (else + ) + ) + ) + ) + (set! (-> self max-probe-width) (-> tuning max-probe-width)) + (set! (-> self num-boxes) (the-as uint 1)) + (set! (-> self boxes 0 start) (the-as uint 0)) + (set! (-> self boxes 0 num) (the-as uint (-> self debris-num))) + (go-virtual idle) + ) + ) + +;; definition for function debris-spawn +;; WARN: Return type mismatch (pointer process) vs (pointer debris-group). +(defun debris-spawn ((arg0 process-drawable) (arg1 debris-tuning) (arg2 debris-static-params) (arg3 process-drawable)) + (if (not arg3) + (set! arg3 arg0) + ) + (process-spawn debris-group arg1 arg2 arg3 :name "debris-group" :to arg0 :stack-size #x8000) + ) + +;; failed to figure out what this is: +(defskelgroup skel-kg-debris-a kg-debris kg-debris-a-lod0-jg -1 + ((kg-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-kg-debris-b kg-debris kg-debris-b-lod0-jg -1 + ((kg-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-kg-debris-c kg-debris kg-debris-c-lod0-jg -1 + ((kg-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-kg-debris-d kg-debris kg-debris-d-lod0-jg -1 + ((kg-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-neo-debris-a neo-debris neo-debris-a-lod0-jg -1 + ((neo-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-neo-debris-b neo-debris neo-debris-b-lod0-jg -1 + ((neo-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-neo-debris-c neo-debris neo-debris-c-lod0-jg -1 + ((neo-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-neo-debris-d neo-debris neo-debris-d-lod0-jg -1 + ((neo-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-v-marauder-debris-ring interceptor interceptor-debris-ring-lod0-jg -1 + ((interceptor-debris-ring-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-v-marauder-debris-nut interceptor interceptor-debris-nut-lod0-jg -1 + ((interceptor-debris-nut-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-v-marauder-debris-rod interceptor interceptor-debris-rod-lod0-jg -1 + ((interceptor-debris-rod-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-v-marauder-debris-panel interceptor interceptor-debris-panel-lod0-jg -1 + ((interceptor-debris-panel-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-dm-debris-a dm-debris dm-debris-a-lod0-jg -1 + ((dm-debris-a-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-dm-debris-b dm-debris dm-debris-b-lod0-jg -1 + ((dm-debris-b-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-dm-debris-c dm-debris dm-debris-c-lod0-jg -1 + ((dm-debris-c-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + +;; failed to figure out what this is: +(defskelgroup skel-dm-debris-d dm-debris dm-debris-d-lod0-jg -1 + ((dm-debris-d-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 2) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc new file mode 100644 index 00000000000..9868db3c6a1 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/elevator_REF.gc @@ -0,0 +1,1027 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type elevator-params +(deftype elevator-params (structure) + ((xz-threshold float) + (y-threshold float) + (start-pos float) + (move-rate float) + (flags elevator-flags) + ) + ) + +;; definition for method 3 of type elevator-params +(defmethod inspect ((this elevator-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'elevator-params) + (format #t "~1Txz-threshold: ~f~%" (-> this xz-threshold)) + (format #t "~1Ty-threshold: ~f~%" (-> this y-threshold)) + (format #t "~1Tstart-pos: ~f~%" (-> this start-pos)) + (format #t "~1Tmove-rate: ~f~%" (-> this move-rate)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (label cfg-4) + this + ) + +;; definition of type path-step +(deftype path-step (structure) + ((next-pos float) + (dist float) + ) + ) + +;; definition for method 3 of type path-step +(defmethod inspect ((this path-step)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'path-step) + (format #t "~1Tnext-pos: ~f~%" (-> this next-pos)) + (format #t "~1Tdist: ~f~%" (-> this dist)) + (label cfg-4) + this + ) + +;; definition of type path-step-inline-array +(deftype path-step-inline-array (inline-array-class) + ((data path-step :inline :dynamic) + ) + ) + +;; definition for method 3 of type path-step-inline-array +(defmethod inspect ((this path-step-inline-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> path-step-inline-array heap-base) (the-as uint 16)) + +;; definition of type elevator +(deftype elevator (base-plat) + ((params elevator-params :inline) + (path-seq path-step-inline-array) + (path-dest float) + (bottom-top float 2) + (move-pos float 2) + (move-dist float) + (path-pos float) + (path-eased-pos float) + (ride-timer time-frame) + (sticky-player-last-ride-time time-frame) + (elevator-status elevator-status) + (on-activate pair) + (on-deactivate pair) + (on-up pair) + (on-down pair) + (on-running pair) + (on-notice pair) + (on-wait pair) + (sound-id sound-id) + (sound-running-loop sound-spec) + (sound-arrived sound-spec) + (fence-prim-index uint32) + (speed float) + (sound-start sound-spec) + (activate-test pair) + ) + (:state-methods + dormant + waiting + running + arrived + unknown + die + ) + (:methods + (calc-dist-between-points! (_type_ int int) none) + (go-arrived-or-waiting (_type_) none) + (init-params! (_type_) none) + (init-sound! (_type_) none) + (point-inside-shaft? (_type_ vector float float) symbol) + (elevator-method-46 (_type_) object) + (elevator-method-47 (_type_) symbol) + (elevator-method-48 (_type_) none) + (find-closest-point-in-path! (_type_ vector (pointer float) symbol symbol) symbol) + (elevator-method-50 (_type_) none) + (toggle-fence-collision (_type_ symbol) none) + ) + ) + +;; definition for method 3 of type elevator +(defmethod inspect ((this elevator)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type base-plat inspect))) + (t9-0 this) + ) + (format #t "~2Tparams: #~%" (-> this params)) + (format #t "~2Tpath-seq: ~A~%" (-> this path-seq)) + (format #t "~2Tpath-dest: ~f~%" (-> this path-dest)) + (format #t "~2Tbottom-top[2] @ #x~X~%" (-> this bottom-top)) + (format #t "~2Tmove-pos[2] @ #x~X~%" (-> this move-pos)) + (format #t "~2Tmove-dist: ~f~%" (-> this move-dist)) + (format #t "~2Tpath-pos: ~f~%" (-> this path-pos)) + (format #t "~2Tpath-eased-pos: ~f~%" (-> this path-eased-pos)) + (format #t "~2Tride-timer: ~D~%" (-> this ride-timer)) + (format #t "~2Tsticky-player-last-ride-time: ~D~%" (-> this sticky-player-last-ride-time)) + (format #t "~2Televator-status: ~D~%" (-> this elevator-status)) + (format #t "~2Ton-activate: ~A~%" (-> this on-activate)) + (format #t "~2Ton-deactivate: ~A~%" (-> this on-deactivate)) + (format #t "~2Ton-up: ~A~%" (-> this on-up)) + (format #t "~2Ton-down: ~A~%" (-> this on-down)) + (format #t "~2Ton-running: ~A~%" (-> this on-running)) + (format #t "~2Ton-notice: ~A~%" (-> this on-notice)) + (format #t "~2Ton-wait: ~A~%" (-> this on-wait)) + (format #t "~2Tsound-id: ~D~%" (-> this sound-id)) + (format #t "~2Tsound-running-loop: ~A~%" (-> this sound-running-loop)) + (format #t "~2Tsound-arrived: ~A~%" (-> this sound-arrived)) + (format #t "~2Tfence-prim-index: ~D~%" (-> this fence-prim-index)) + (format #t "~2Tspeed: ~f~%" (-> this speed)) + (format #t "~2Tsound-start: ~A~%" (-> this sound-start)) + (format #t "~2Tactivate-test: ~A~%" (-> this activate-test)) + (label cfg-4) + this + ) + +;; definition for method 45 of type elevator +(defmethod point-inside-shaft? ((this elevator) (arg0 vector) (arg1 float) (arg2 float)) + #f + ) + +;; definition for method 50 of type elevator +;; INFO: Used lq/sq +(defmethod elevator-method-50 ((this elevator)) + (let ((gp-0 *target*)) + (when gp-0 + (let ((s4-0 (-> gp-0 control collision-spheres 0)) + (s5-0 (new 'stack-no-clear 'collide-query)) + ) + (set! (-> s5-0 start-pos quad) (-> s4-0 prim-core world-sphere quad)) + (+! (-> s5-0 start-pos y) 8192.0) + (set! (-> s5-0 start-pos w) 1.0) + (vector-reset! (-> s5-0 move-dist)) + (set! (-> s5-0 move-dist y) -90112.0) + (let ((v1-6 s5-0)) + (set! (-> v1-6 radius) (-> s4-0 local-sphere w)) + (set! (-> v1-6 collide-with) (collide-spec hit-by-others-list pusher)) + (set! (-> v1-6 ignore-process0) gp-0) + (set! (-> v1-6 ignore-process1) #f) + (set! (-> v1-6 ignore-pat) (-> gp-0 control pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (let ((f0-5 (fill-and-probe-using-line-sphere *collide-cache* s5-0))) + (when (< 0.0 f0-5) + (vector-float*! (-> s5-0 move-dist) (-> s5-0 move-dist) f0-5) + (vector+! (-> s5-0 move-dist) (-> s5-0 move-dist) (-> s5-0 start-pos)) + (vector-! (-> s5-0 move-dist) (-> s5-0 move-dist) (the-as vector (-> s4-0 prim-core))) + (move-by-vector! (-> gp-0 control) (-> s5-0 move-dist)) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for method 51 of type elevator +(defmethod toggle-fence-collision ((this elevator) (arg0 symbol)) + (when (and (logtest? (-> this params flags) (elevator-flags fence)) (nonzero? (-> this fence-prim-index))) + (let ((v1-7 (-> (the-as collide-shape-prim-group (-> this root root-prim)) child (-> this fence-prim-index)))) + (cond + (arg0 + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle pusher)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak player-list)) + (set-setting! 'jump #f 0.0 0) + ) + (else + (set! (-> v1-7 prim-core collide-as) (collide-spec)) + (set! (-> v1-7 prim-core collide-with) (collide-spec)) + (remove-setting! 'jump) + ) + ) + ) + ) + (none) + ) + +;; definition for method 10 of type elevator +(defmethod deactivate ((this elevator)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (sound-stop (-> this sound-id)) + (call-parent-method this) + (none) + ) + +;; definition for method 43 of type elevator +;; WARN: Return type mismatch int vs none. +(defmethod init-params! ((this elevator)) + (set! (-> this params xz-threshold) (res-lump-float (-> this entity) 'elevator-xz-threshold :default 81920.0)) + (set! (-> this params y-threshold) (res-lump-float (-> this entity) 'elevator-y-threshold :default 20480.0)) + (set! (-> this params start-pos) (res-lump-float (-> this entity) 'elevator-start-pos)) + (set! (-> this params move-rate) (res-lump-float (-> this entity) 'elevator-move-rate :default 25600.0)) + (set! (-> this params flags) (res-lump-value + (-> this entity) + 'elevator-flags + elevator-flags + :default (the-as uint128 1) + :time -1000000000.0 + ) + ) + 0 + (none) + ) + +;; definition for function ease-value-in-out +(defun ease-value-in-out ((arg0 float) (arg1 float)) + (let* ((f0-0 arg1) + (f4-0 (- 1.0 arg1)) + (f3-0 (/ f0-0 (- 1.0 f4-0))) + (f2-1 (* f0-0 f0-0)) + (f1-6 (+ (* 2.0 f0-0 (- f4-0 f0-0)) f2-1)) + (f1-7 (+ (* (- 1.0 f4-0) (- 1.0 f4-0) f3-0) f1-6)) + ) + (/ (cond + ((< arg0 f0-0) + (* arg0 arg0) + ) + ((< arg0 f4-0) + (+ (* 2.0 f0-0 (- arg0 f0-0)) f2-1) + ) + (else + (let ((f0-7 (- 1.0 arg0))) + (- f1-7 (* f0-7 f0-7 f3-0)) + ) + ) + ) + f1-7 + ) + ) + ) + +;; definition for function elevator-event +;; WARN: disable def twice: 11. This may happen when a cond (no else) is nested inside of another conditional, but it should be rare. +(defbehavior elevator-event elevator ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('status?) + (and (= (the float (/ (the-as int (-> arg3 param 0)) 8)) (-> self move-pos 0)) + (= (the float (/ (the-as int (-> arg3 param 1)) 8)) (-> self move-pos 1)) + ) + ) + (('ridden) + (let ((v1-8 (handle->process (-> (the-as focus (-> arg3 param 0)) handle)))) + (if (= (-> v1-8 type) target) + (set-time! (-> self sticky-player-last-ride-time)) + ) + ) + #t + ) + (('use-camera) + (if (-> arg3 param 0) + (set-setting! 'entity-name (-> arg3 param 0) 0.0 0) + (remove-setting! 'entity-name) + ) + ) + (('move-to) + (when (and (-> self next-state) (let ((v1-20 (-> self next-state name))) + (or (= v1-20 'waiting) (= v1-20 'arrived)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (cond + ((not (logtest? (-> arg3 param 0) 7)) + (let ((gp-0 (-> arg3 param 0))) + (set! (-> self move-pos 1) (the-as float (if (type? gp-0 float) + (the-as float gp-0) + ) + ) + ) + ) + ) + (else + (case (-> arg3 param 0) + (('quote 'bottom) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('quote 'top) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + ) + (go-virtual running) + ) + ) + (('jump-to) + (cond + ((not (logtest? (-> arg3 param 0) 7)) + (let ((gp-1 (-> arg3 param 0))) + (set! (-> self move-pos 1) (the-as float (if (type? gp-1 float) + (the-as float gp-1) + ) + ) + ) + ) + ) + (else + (case (-> arg3 param 0) + (('quote 'bottom) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('quote 'top) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (get-point-in-path! (-> self path) (-> self basetrans) (-> self move-pos 0) 'interp) + (go-virtual waiting) + ) + (('trigger) + (when (and (-> self next-state) (let ((v1-48 (-> self next-state name))) + (or (= v1-48 'waiting) (= v1-48 'arrived)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (cond + ((= (-> self move-pos 0) (-> self bottom-top 0)) + (set! (-> self move-pos 1) (-> self bottom-top 1)) + ) + ((= (-> self move-pos 0) (-> self bottom-top 1)) + (set! (-> self move-pos 1) (-> self bottom-top 0)) + ) + ) + (go-virtual running) + ) + ) + (('query) + (case (-> arg3 param 0) + (('waiting?) + (and (-> self next-state) (= (-> self next-state name) 'waiting)) + ) + (('arrived?) + (and (-> self next-state) (let ((v1-61 (-> self next-state name))) + (or (= v1-61 'arrived) (= v1-61 'waiting)) + ) + ) + ) + (('running?) + (and (-> self next-state) (= (-> self next-state name) 'running)) + ) + (('path-pos?) + (+ (-> self move-pos 0) (* (-> self path-pos) (- (-> self move-pos 1) (-> self move-pos 0)))) + ) + (('player-standing-on?) + (= (-> self sticky-player-last-ride-time) (current-time)) + ) + (('point-inside-shaft?) + (point-inside-shaft? self (the-as vector (-> arg3 param 1)) (-> self bottom-top 1) (-> self bottom-top 0)) + ) + (('going-down?) + (< (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 1) 'interp) y) + (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 0) 'interp) y) + ) + ) + (('going-up?) + (< (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 0) 'interp) y) + (-> (get-point-in-path! (-> self path) (new 'stack-no-clear 'vector) (-> self move-pos 1) 'interp) y) + ) + ) + (('bottom?) + (= (-> self move-pos 1) (-> self bottom-top 0)) + ) + (('top?) + (= (-> self move-pos 1) (-> self bottom-top 1)) + ) + ) + ) + (('reset) + (go-virtual die) + ) + (('go-dormant) + (go-virtual dormant) + ) + (('set-path-pos) + (set! (-> self path-pos) (the-as float (-> arg3 param 0))) + ) + (else + (plat-event arg0 arg1 arg2 arg3) + ) + ) + ) + +;; definition for method 49 of type elevator +;; INFO: Used lq/sq +(defmethod find-closest-point-in-path! ((this elevator) (arg0 vector) (arg1 (pointer float)) (arg2 symbol) (arg3 symbol)) + (local-vars (sv-32 vector)) + (let ((s1-0 (-> this params)) + (f28-0 0.0) + (f30-0 -1.0) + ) + (dotimes (s0-0 (-> this path curve num-cverts)) + (set! sv-32 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s0-0) 'interp)) + (when (and (or (not arg2) (< (vector-vector-xz-distance sv-32 arg0) (-> s1-0 xz-threshold))) + (or (not arg3) + (< (fabs (- (-> sv-32 y) (-> arg0 y))) (-> s1-0 y-threshold)) + (and (= s0-0 (the int (-> this bottom-top 0))) (< (-> arg0 y) (-> sv-32 y))) + (and (= s0-0 (the int (-> this bottom-top 1))) (< (-> sv-32 y) (-> arg0 y))) + ) + ) + (let* ((t9-2 vector-vector-distance) + (a1-3 arg0) + (f0-12 (t9-2 sv-32 a1-3)) + ) + (when (or (= f30-0 -1.0) (< f0-12 f28-0)) + (set! f28-0 f0-12) + (set! f30-0 (the float s0-0)) + ) + ) + ) + ) + (when (!= f30-0 -1.0) + (set! (-> arg1 0) f30-0) + #t + ) + ) + ) + +;; definition for method 46 of type elevator +(defmethod elevator-method-46 ((this elevator)) + (let* ((s5-0 *target*) + (a0-2 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (and a0-2 (point-inside-shaft? this (get-trans a0-2 0) (-> this move-pos 0) (-> this move-pos 1))) + ) + ) + +;; definition for method 47 of type elevator +(defmethod elevator-method-47 ((this elevator)) + #t + ) + +;; definition for method 48 of type elevator +;; WARN: Return type mismatch int vs none. +(defmethod elevator-method-48 ((this elevator)) + (local-vars (sv-16 float)) + (let ((a0-1 *target*)) + (when (and a0-1 + (not (logtest? (focus-status dead inactive in-air grabbed edge-grab pole pilot-riding pilot teleporting) + (-> a0-1 focus-status) + ) + ) + ) + (set! sv-16 (the-as float 0.0)) + (when (and (find-closest-point-in-path! this (get-trans a0-1 0) (& sv-16) #t #t) (!= (-> this move-pos 1) sv-16)) + (set! (-> this move-pos 0) (-> this move-pos 1)) + (set! (-> this move-pos 1) sv-16) + (logior! (-> this elevator-status) (elevator-status moving)) + (go (method-of-object this running)) + ) + ) + ) + 0 + (none) + ) + +;; definition for function move-post +(defbehavior move-post elevator () + (when (nonzero? (-> self sound)) + (let ((f0-3 (sqrtf (sin-rad (* 3.1415925 (-> self path-pos)))))) + (update-vol! (-> self sound) f0-3) + ) + (update-trans! (-> self sound) (-> self root trans)) + (update! (-> self sound)) + ) + (plat-post) + (none) + ) + +;; definition for function teleport-check +;; WARN: Return type mismatch vector vs none. +(defbehavior teleport-check elevator () + (local-vars (sv-16 float)) + (when (and *target* (logtest? (-> self params flags) (elevator-flags teleport)) (focus-test? *target* teleporting)) + (set! sv-16 (the-as float 0.0)) + (when (find-closest-point-in-path! self (target-pos 0) (& sv-16) #f #t) + (set! (-> self move-pos 0) sv-16) + (set! (-> self move-pos 1) sv-16) + (get-point-in-path! (-> self path) (-> self basetrans) sv-16 'interp) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate dormant (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('trigger) + (go-virtual waiting) + ) + (('bonk) + #f + ) + (else + (plat-event proc argc message block) + ) + ) + ) + :trans plat-trans + :code sleep-code + :post plat-post + ) + +;; failed to figure out what this is: +(defstate waiting (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('ridden) + (if (elevator-method-47 self) + (logior! (-> self elevator-status) (elevator-status waiting-to-descend)) + ) + (elevator-event proc argc message block) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (if (logtest? (-> self params flags) (elevator-flags dormant)) + (go-virtual dormant) + ) + (set-time! (-> self ride-timer)) + (logclear! (-> self elevator-status) (elevator-status waiting-to-descend moving)) + (logior! (-> self mask) (process-mask actor-pause)) + (if (nonzero? (-> self sound)) + (update-vol! (-> self sound) 0.0) + ) + (let ((gp-0 (-> self on-notice))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :trans (behavior () + (teleport-check) + (plat-trans) + (when (not (logtest? (-> self elevator-status) (elevator-status waiting-to-descend))) + (set-time! (-> self ride-timer)) + (-> self params) + (if (and (logtest? (-> self params flags) (elevator-flags running)) + (not (logtest? (-> self params flags) (elevator-flags ef3))) + ) + (elevator-method-48 self) + ) + ) + (when (and (not (logtest? (-> self params flags) (elevator-flags ef3))) + (time-elapsed? (-> self ride-timer) (seconds 1)) + (or (not (-> self activate-test)) + (script-eval (-> self activate-test) :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (set! (-> self move-pos 1) (-> self path-seq data (the int (-> self move-pos 1)) next-pos)) + (go-virtual running) + ) + (let ((gp-0 (-> self on-wait))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :code sleep-code + :post (behavior () + (logclear! (-> self elevator-status) (elevator-status waiting-to-descend)) + (path-control-method-9 (-> self path)) + (plat-post) + ) + ) + +;; failed to figure out what this is: +(defstate running (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('running?) + #t + ) + (('player-ridden?) + (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (if (not (logtest? (-> self params flags) (elevator-flags ef7))) + (process-entity-status! self (entity-perm-status no-kill) #t) + ) + (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) + (when (logtest? (-> self params flags) (elevator-flags waiting)) + (logclear! (-> self params flags) (elevator-flags waiting)) + (logior! (-> self params flags) (elevator-flags running)) + ) + (set! (-> self move-dist) 0.0) + (let ((v1-13 (the int (-> self move-pos 0))) + (a0-3 (the int (-> self move-pos 1))) + (a1-1 0) + ) + (while (let ((a2-3 (abs (- a0-3 v1-13)))) + (< a1-1 a2-3) + ) + (+! (-> self move-dist) (-> self path-seq data (+ (min v1-13 a0-3) a1-1) dist)) + (+! a1-1 1) + ) + ) + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self path-pos) 0.0) + (if (nonzero? (-> self sound)) + (update-vol! (-> self sound) 0.0) + ) + (if (-> self sound-start) + (sound-play-by-spec (-> self sound-start) (new-sound-id) (the-as vector #t)) + ) + (when (logtest? (-> self params flags) (elevator-flags prevent-jump)) + (set-setting! 'jump #f 0.0 0) + (apply-settings *setting-control*) + ) + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (set-setting! 'board #f 0.0 0) + (set-setting! 'lightjak #f 0.0 0) + (toggle-fence-collision self #t) + (if (logtest? (-> self params flags) (elevator-flags grab)) + (process-grab? *target* #f) + ) + ) + (let ((gp-1 (-> self on-activate))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + :exit (behavior () + (if (not (logtest? (-> self params flags) (elevator-flags ef7))) + (process-entity-status! self (entity-perm-status no-kill) #f) + ) + (remove-setting! 'board) + (remove-setting! 'jump) + (remove-setting! 'lightjak) + (set! (-> self speed) 0.0) + ) + :trans (behavior () + (teleport-check) + (if (and (not (logtest? (-> self elevator-status) (elevator-status waiting-to-ascend))) + (= (-> self path-pos) 1.0) + ) + (go-virtual arrived) + ) + (if (elevator-method-46 self) + (set! (-> self path-dest) 0.0) + (set! (-> self path-dest) 1.0) + ) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) + (and *target* (not (logtest? (-> *target* focus-status) (focus-status grabbed)))) + ) + (process-grab? *target* #f) + ) + (if (and (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) *target*) + (process-drawable-cloth-command *target* '(set-flags local-space-y)) + ) + (if (>= (+ (current-time) (seconds -1)) (-> self sticky-player-last-ride-time)) + (remove-setting! 'board) + (set-setting! 'board #f 0.0 0) + ) + (if (logtest? (-> self params flags) (elevator-flags prevent-jump)) + (elevator-method-50 self) + ) + (let ((gp-0 (-> self on-running))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + (plat-trans) + ) + :code (behavior () + (logior! (-> self elevator-status) (elevator-status waiting-to-ascend)) + (suspend) + (let ((a1-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-0 from) (process->ppointer self)) + (set! (-> a1-0 num-params) 1) + (set! (-> a1-0 message) 'query) + (set! (-> a1-0 param 0) (the-as uint 'player-standing-on?)) + (cond + ((and (send-event-function self a1-0) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 1) + (set! (-> a1-1 message) 'query) + (set! (-> a1-1 param 0) (the-as uint 'going-up?)) + (and (send-event-function self a1-1) (logtest? (-> self params flags) (elevator-flags fence))) + ) + ) + (let ((gp-0 (-> self on-up))) + (if gp-0 + (script-eval gp-0 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + ((let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer self)) + (set! (-> a1-4 num-params) 1) + (set! (-> a1-4 message) 'query) + (set! (-> a1-4 param 0) (the-as uint 'player-standing-on?)) + (and (send-event-function self a1-4) + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (process->ppointer self)) + (set! (-> a1-5 num-params) 1) + (set! (-> a1-5 message) 'query) + (set! (-> a1-5 param 0) (the-as uint 'going-down?)) + (and (send-event-function self a1-5) (logtest? (-> self params flags) (elevator-flags fence))) + ) + ) + ) + (let ((gp-1 (-> self on-down))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 0)) 8) :vector (-> self root trans)) + ) + ) + ) + ) + ) + (until #f + (suspend) + (if (= (-> self path-pos) 1.0) + (logclear! (-> self elevator-status) (elevator-status waiting-to-ascend)) + ) + ) + #f + ) + :post (behavior () + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-ascend)) + (seek! + (-> self path-pos) + (-> self path-dest) + (* (/ (-> self params move-rate) (-> self move-dist)) (seconds-per-frame)) + ) + (let* ((f30-0 (-> self move-pos 0)) + (f28-0 (-> self move-pos 1)) + (f0-9 (+ f30-0 (* (ease-value-in-out (-> self path-pos) 0.08) (- f28-0 f30-0)))) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> gp-0 quad) (-> self basetrans quad)) + (get-point-in-path! (-> self path) (-> self basetrans) f0-9 'interp) + (set! (-> self speed) (* (- (-> self basetrans y) (-> gp-0 y)) (-> self clock frames-per-second))) + ) + (if (-> self sound-running-loop) + (sound-play-by-spec (-> self sound-running-loop) (-> self sound-id) (-> self root trans)) + ) + ) + (move-post) + ) + ) + +;; failed to figure out what this is: +(defstate arrived (elevator) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('ridden) + (set-time! (-> self ride-timer)) + (elevator-event proc argc message block) + ) + (else + (elevator-event proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self ride-timer)) + (if (not (-> *setting-control* user-current jump)) + (remove-setting! 'jump) + ) + (sound-stop (-> self sound-id)) + (if (-> self sound-arrived) + (sound-play-by-spec (-> self sound-arrived) (new-sound-id) (the-as vector #t)) + ) + (when (logtest? (-> self elevator-status) (elevator-status waiting-to-descend)) + (toggle-fence-collision self #f) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) *target* (focus-test? *target* grabbed)) + (process-release? *target*) + ) + ) + (let ((gp-1 (-> self on-deactivate))) + (if gp-1 + (script-eval gp-1 :key (* (the int (-> self move-pos 1)) 8) :vector (-> self root trans)) + ) + ) + ) + :trans (behavior () + (teleport-check) + (if (and (< (- (-> self ride-timer) (-> self sticky-player-last-ride-time)) (seconds 2)) + (begin *target* *target*) + (focus-test? *target* in-air) + ) + (set-time! (-> self ride-timer)) + ) + (if (and (logtest? (-> self params flags) (elevator-flags grab)) *target* (focus-test? *target* grabbed)) + (process-release? *target*) + ) + (when (or (logtest? (-> self elevator-status) (elevator-status moving)) + (time-elapsed? (-> self ride-timer) (seconds 0.5)) + ) + (cond + ((and (logtest? (-> self params flags) (elevator-flags ef1)) + (!= (-> self move-pos 1) (-> self params start-pos)) + ) + (set! (-> self move-pos 0) (-> self move-pos 1)) + (set! (-> self move-pos 1) (-> self params start-pos)) + (go-virtual running) + ) + (else + (go-virtual waiting) + ) + ) + ) + (plat-trans) + ) + :code sleep-code + :post plat-post + ) + +;; failed to figure out what this is: +(defstate die (elevator) + :virtual #t + :event (the-as (function process int symbol event-message-block object) eco-door-event-handler) + :code (behavior () + '() + ) + ) + +;; definition for method 41 of type elevator +;; WARN: Return type mismatch int vs none. +(defmethod calc-dist-between-points! ((this elevator) (arg0 int) (arg1 int)) + (set! (-> this path-seq data arg0 next-pos) (the float arg1)) + (let ((s3-0 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float arg0) 'interp)) + (a1-3 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float arg1) 'interp)) + ) + (set! (-> this path-seq data arg0 dist) (vector-vector-distance s3-0 a1-3)) + ) + 0 + (none) + ) + +;; definition for method 44 of type elevator +;; WARN: Return type mismatch int vs none. +(defmethod init-sound! ((this elevator)) + (set! (-> this sound) (the-as ambient-sound 0)) + (if (-> this sound-running-loop) + (set! (-> this sound-id) (new-sound-id)) + ) + 0 + (none) + ) + +;; definition for method 34 of type elevator +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-34 ((this elevator)) + 0 + (none) + ) + +;; definition for method 7 of type elevator +(defmethod relocate ((this elevator) (offset int)) + (if (nonzero? (-> this path-seq)) + (&+! (-> this path-seq) offset) + ) + (call-parent-method this offset) + ) + +;; definition for method 42 of type elevator +;; WARN: Return type mismatch object vs none. +(defmethod go-arrived-or-waiting ((this elevator)) + (if (logtest? (-> this params flags) (elevator-flags arrived)) + (go (method-of-object this arrived)) + (go (method-of-object this waiting)) + ) + (none) + ) + +;; definition for method 11 of type elevator +;; WARN: Return type mismatch none vs object. +(defmethod init-from-entity! ((this elevator) (arg0 entity-actor)) + (local-vars (sv-32 float) (sv-36 path-control) (sv-40 target)) + (stack-size-set! (-> this main-thread) 512) + (set! (-> this sound-running-loop) #f) + (set! (-> this sound-arrived) #f) + (set! (-> this sound-start) #f) + (init-params! this) + (init-collision! this) + (when (type? (-> this root root-prim) collide-shape-prim-group) + (let ((v1-9 (-> this root root-prim))) + (dotimes (a0-5 (the-as int (-> v1-9 specific 0))) + (when (= (-> (the-as collide-shape-prim-group v1-9) child a0-5 prim-id) (shl #xfe00 16)) + (set! (-> this fence-prim-index) (the-as uint a0-5)) + (toggle-fence-collision this #f) + #t + (goto cfg-8) + ) + ) + ) + ) + (label cfg-8) + (process-drawable-from-entity! this arg0) + (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) + (init-bounce-params! this) + (set! (-> this elevator-status) (elevator-status)) + (update-transforms (-> this root)) + (base-plat-method-33 this) + (set! (-> this on-activate) (res-lump-struct (-> this entity) 'on-activate pair)) + (set! (-> this on-deactivate) (res-lump-struct (-> this entity) 'on-deactivate pair)) + (set! (-> this on-up) (res-lump-struct (-> this entity) 'on-up pair)) + (set! (-> this on-down) (res-lump-struct (-> this entity) 'on-down pair)) + (set! (-> this on-running) (res-lump-struct (-> this entity) 'on-running pair)) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-wait) (res-lump-struct (-> this entity) 'on-wait pair)) + (set! (-> this activate-test) (res-lump-struct (-> this entity) 'activate-test pair)) + (set! (-> this path) (new 'process 'path-control this 'path 0.0 arg0 #f)) + (when (logtest? (-> this path flags) (path-control-flag not-found)) + (if (logtest? (-> this params flags) (elevator-flags dormant)) + (go (method-of-object this dormant)) + ) + (go process-drawable-art-error "error in path") + ) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (let ((s5-1 (-> this path curve num-cverts)) + (s4-1 0) + (f30-0 0.0) + (f28-0 0.0) + ) + (set! (-> this path-seq) (new 'process 'path-step-inline-array s5-1)) + (dotimes (s3-1 s5-1) + (calc-dist-between-points! this s3-1 (mod (+ s3-1 1) s5-1)) + (let ((v1-55 (get-point-in-path! (-> this path) (new 'stack-no-clear 'vector) (the float s3-1) 'interp))) + (when (or (not (logtest? s4-1 1)) (< (-> v1-55 y) f28-0)) + (set! (-> this bottom-top 0) (the float s3-1)) + (set! f28-0 (-> v1-55 y)) + (set! s4-1 (logior s4-1 1)) + ) + (when (or (not (logtest? s4-1 2)) (< f30-0 (-> v1-55 y))) + (set! (-> this bottom-top 1) (the float s3-1)) + (set! f30-0 (-> v1-55 y)) + (set! s4-1 (logior s4-1 2)) + ) + ) + ) + ) + (set! sv-32 (the-as float 0.0)) + (set! sv-36 (-> this path)) + (let ((s5-2 *target*)) + (set! sv-40 (if (type? s5-2 process-focusable) + s5-2 + ) + ) + ) + (if (not (and sv-40 + (logtest? (-> this params flags) (elevator-flags teleport)) + (find-closest-point-in-path! this (get-trans sv-40 0) (& sv-32) #f #t) + ) + ) + (set! sv-32 (-> this params start-pos)) + ) + (set! (-> this move-pos 0) sv-32) + (set! (-> this move-pos 1) sv-32) + (get-point-in-path! sv-36 (-> this basetrans) sv-32 'interp) + (set! (-> this root pause-adjust-distance) + (+ 122880.0 (-> this params xz-threshold) (total-distance (-> this path))) + ) + (base-plat-method-34 this) + (init-sound! this) + (go-arrived-or-waiting this) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc new file mode 100644 index 00000000000..cb507aa9d14 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/enemy-states_REF.gc @@ -0,0 +1,1675 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate idle (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (stop-look-at! self) + (logclear! (-> self enemy-flags) (enemy-flag notice alert cam-attack-mode)) + (logior! (-> self enemy-flags) (enemy-flag use-notice-distance)) + (set! (-> self state-timeout) (seconds 0.5)) + (if (-> self on-notice) + (logior! (-> self enemy-flags) (enemy-flag enable-on-notice)) + ) + (if (-> self on-active) + (logior! (-> self enemy-flags) (enemy-flag enable-on-active)) + ) + (if (-> self on-hostile) + (logior! (-> self enemy-flags) (enemy-flag enable-on-hostile)) + ) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + ) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (-> self state-timeout)) + (let ((v1-3 (-> self focus aware))) + (cond + ((< 1 (the-as int v1-3)) + (go-virtual notice) + ) + ((> (the-as int v1-3) 0) + (go-virtual active) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + ) + :post (behavior () + (play-idle-frames! (-> self idle-anim-player) self) + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set-time! (-> self last-draw-time)) + ) + (update-focus self) + (ja-post) + ) + ) + +;; failed to figure out what this is: +(defstate dormant (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + ((-> (method-of-type enemy idle) enter)) + (set! (-> self root nav-flags) (the-as uint 0)) + (let ((v1-4 (-> self root root-prim))) + (set! (-> v1-4 prim-core collide-as) (collide-spec)) + (set! (-> v1-4 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (set! (-> self draw origin quad) (-> self root trans quad)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + ) + (logior! (-> self focus-status) (focus-status disable)) + ) + :exit (behavior () + (logclear! (-> self focus-status) (focus-status disable)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) + (logior! (-> self root nav-flags) 1) + ) + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate dormant-aware (enemy) + :virtual #t + :event enemy-event-handler + :enter (-> (method-of-type enemy dormant) enter) + :exit (-> (method-of-type enemy dormant) exit) + :trans (behavior () + (when (and (time-elapsed? (-> self state-time) (-> self state-timeout)) (> (the-as int (-> self focus aware)) 0)) + (if (logtest? (enemy-option ambush) (-> self fact enemy-options)) + (go-ambush-delay self) + (go-virtual active) + ) + ) + ) + :code sleep-code + :post (behavior () + (if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) (draw-control-status on-screen))) + (set-time! (-> self last-draw-time)) + ) + (update-focus self) + ) + ) + +;; failed to figure out what this is: +(defstate ambush-delay (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self desired-angle) (fmax 0.0 (res-lump-float (-> self entity) 'ambush-delay))) + (logior! (-> self focus-status) (focus-status disable)) + (let ((v1-6 (-> self root root-prim))) + (set! (-> v1-6 prim-core collide-as) (collide-spec)) + (set! (-> v1-6 prim-core collide-with) (collide-spec)) + ) + 0 + (logior! (-> self draw status) (draw-control-status no-draw)) + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + (logand! (-> self root nav-flags) -2) + ) + :exit (behavior () + ((-> (method-of-type enemy dormant) exit)) + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :trans (behavior () + (if (time-elapsed? (-> self state-time) (the int (* 300.0 (-> self desired-angle)))) + (go-virtual ambush) + ) + ) + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate ambush (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :code (behavior () + (go-virtual notice) + ) + ) + +;; failed to figure out what this is: +(defstate active (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-active)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-active)) + (let ((gp-0 (-> self on-active))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + (when (not (logtest? (enemy-flag chase-startup) (-> self enemy-flags))) + (if (logtest? (-> self enemy-flags) (enemy-flag actor-pause-backup)) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + ) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((v1-3 (-> self focus aware))) + (cond + ((< (the-as int v1-3) 1) + (go-idle self) + ) + ((< 1 (the-as int v1-3)) + (go-virtual notice) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (sleep-code) + ) + :post (behavior () + (play-idle-frames! (-> self idle-anim-player) self) + (enemy-simple-post) + ) + ) + +;; failed to figure out what this is: +(defstate notice (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (let ((v1-3 (logior (-> self enemy-flags) (enemy-flag cam-attack-mode)))) + (set! (-> self enemy-flags) (logclear v1-3 (enemy-flag use-trigger))) + ) + (logclear! (-> self mask) (process-mask actor-pause)) + (set-look-at-mode! self 1) + (when (logtest? (-> self enemy-flags) (enemy-flag enable-on-notice)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-notice)) + (let ((gp-0 (-> self on-notice))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + (let ((gp-1 (-> self focus aware))) + (when (logtest? (-> self enemy-flags) (enemy-flag alert)) + (cond + ((and (= gp-1 (enemy-aware ea3)) (get-focus! self)) + (go-hostile self) + ) + ((= gp-1 (enemy-aware ea4)) + (go-flee self) + ) + (else + (go-stare self) + ) + ) + ) + ) + (logior! (-> self enemy-flags) (enemy-flag alert)) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2)) + (gp-0 (new 'stack-no-clear 'vector)) + ) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info notice-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (vector-! gp-0 (target-pos 0) (-> self root trans)) + (seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.05)) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (go-best-state self) + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate hostile (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set-look-at-mode! self 1) + (logior! (-> self enemy-flags) (enemy-flag cam-attack-mode)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (logtest? (enemy-flag enable-on-hostile) (-> self enemy-flags)) + (logclear! (-> self enemy-flags) (enemy-flag enable-on-hostile)) + (let ((gp-0 (-> self on-hostile))) + (if gp-0 + (script-eval gp-0 :vector (-> self root trans)) + ) + ) + ) + ) + :trans (behavior () + (if (and (logtest? (-> self enemy-flags) (enemy-flag victory)) (-> self enemy-info use-victory)) + (go-virtual victory) + ) + (let ((gp-0 (-> self focus aware))) + (when (time-elapsed? (-> self state-time) (-> self reaction-time)) + (cond + ((or (>= 2 (the-as int gp-0)) (not (get-focus! self))) + (go-stare self) + ) + ((= gp-0 (enemy-aware ea4)) + (go-flee self) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data (-> self enemy-info hostile-anim))) + (ja :num-func num-func-identity :frame-num 0.0) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (until #f + (suspend) + (ja :num! (loop! f30-0)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate stare (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((gp-0 (-> self focus aware))) + (cond + ((>= 1 (the-as int gp-0)) + (go-virtual active) + ) + ((and (= gp-0 (enemy-aware ea3)) (get-focus! self)) + (go-hostile self) + ) + ((= gp-0 (enemy-aware ea4)) + (go-flee self) + ) + ) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.1)) + (let ((f30-0 (rnd-float-range self 0.9 1.1)) + (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) + ) + (until #f + (ja-no-eval :group! gp-0 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + #f + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate victory (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logclear! (-> self enemy-flags) (enemy-flag victory)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info victory-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (go-best-state self) + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate flee (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (set-look-at-mode! self 1) + (logclear! (-> self enemy-flags) (enemy-flag chase-startup)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (-> self reaction-time)) + (if (!= (-> self focus aware) (enemy-aware ea4)) + (go-stare self) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 (seconds 0.2)) + (until #f + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate jump (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (logior! (-> self focus-status) (focus-status dangerous)) + (let* ((v1-6 *game-info*) + (a0-2 (+ (-> v1-6 attack-id) 1)) + ) + (set! (-> v1-6 attack-id) a0-2) + (set! (-> self attack-id) a0-2) + ) + (logclear! (-> self focus-status) (focus-status in-air)) + ) + :exit (behavior () + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + ) + :code (behavior () + (let ((gp-0 (new 'stack-no-clear 'enemy-jump-info))) + (let ((s5-0 0)) + (init-jump-info! self gp-0) + (if (and (-> self enemy-info use-jump-blocked) + (logtest? (enemy-flag jump-check-blocked) (-> self enemy-flags)) + (enemy-method-91 self) + ) + (go-virtual jump-blocked) + ) + (when (logtest? (-> gp-0 flags) (enemy-jump-flags ejf0)) + (until #f + (if (jump-anim-handler self s5-0 gp-0) + (goto cfg-12) + ) + (in-jump-handler self s5-0 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-0 1) + ) + #f + ) + ) + (label cfg-12) + (logclear! (-> self root status) (collide-status on-surface on-ground touch-surface)) + (let ((s5-1 2)) + (logior! (-> self focus-status) (focus-status in-air)) + (until (on-ground? self) + (+! (-> gp-0 hang-time) (- (current-time) (-> self clock old-frame-counter))) + (jump-anim-handler self s5-1 gp-0) + (in-jump-handler self s5-1 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-1 3) + ) + ) + (logclear! (-> self focus-status) (focus-status in-air)) + (move-to-gspot! self) + (let ((s5-2 4)) + (until #f + (if (jump-anim-handler self s5-2 gp-0) + (goto cfg-19) + ) + (in-jump-handler self s5-2 gp-0) + (enemy-method-101 self) + (suspend) + (set! s5-2 5) + ) + ) + ) + #f + (label cfg-19) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + ((lambda :behavior enemy () (send-event (ppointer->process (-> self parent)) 'child-jumped))) + ) + (go-directed2 self) + ) + :post (behavior () + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (-> self enemy-info overlaps-others-collide-with-filter)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root) a1-0) + ) + (enemy-simple-post) + ) + ) + +;; failed to figure out what this is: +(defstate jump-blocked (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :trans (behavior () + (when (time-elapsed? (-> self state-time) (seconds 0.5)) + (if (logtest? (enemy-flag directed) (-> self enemy-flags)) + (go-virtual jump) + (go-directed2 self) + ) + ) + ) + :code (behavior () + (let ((v1-2 (ja-group))) + (when (not (and v1-2 (= v1-2 (-> self draw art-group data (-> self enemy-info idle-anim))))) + (ja-channel-push! 1 (seconds 0.2)) + (ja :group! (-> self draw art-group data (-> self enemy-info idle-anim)) + :num! (identity (rand-vu-float-range 0.0 (the float (+ (-> (ja-group) frames num-frames) -1)))) + ) + ) + ) + (let ((f30-0 (rnd-float-range self 0.75 1.25))) + (until #f + (suspend) + (ja :num! (loop! f30-0)) + ) + ) + #f + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate hit (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (stop-look-at! self) + (logclear! (-> self mask) (process-mask actor-pause)) + (play-damage-sound self 0) + ) + :code (behavior () + (local-vars (v1-37 enemy-flag) (v1-39 enemy-flag) (v1-41 enemy-flag)) + (ja-channel-push! 1 (seconds 0.2)) + (let ((f30-0 (rnd-float-range self 0.9 1.1))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info hit-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-36 (-> self enemy-flags))) + (if (logtest? v1-36 (enemy-flag vulnerable-backup)) + (set! v1-37 (logior v1-36 (enemy-flag vulnerable))) + (set! v1-37 (logclear v1-36 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-37) + (let ((v1-38 (-> self enemy-flags))) + (if (logtest? v1-38 (enemy-flag attackable-backup)) + (set! v1-39 (logior v1-38 (enemy-flag attackable))) + (set! v1-39 (logclear v1-38 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-39) + (let ((v1-40 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-40) + (set! v1-41 (logior (enemy-flag trackable) v1-40)) + (set! v1-41 (logclear v1-40 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-41) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + (go-hostile self) + ) + :post enemy-simple-post + ) + +;; failed to figure out what this is: +(defstate knocked (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (when (>= 0.0 (-> self hit-points)) + (let ((v1-2 (handle->process (-> self incoming attacker-handle)))) + (when (or (not (-> self draw)) + (and (or (not v1-2) (!= (-> v1-2 type) target)) + (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (let ((f0-1 450560.0)) + (< (* f0-1 f0-1) (vector-vector-xz-distance-squared (-> self root trans) (math-camera-pos))) + ) + ) + ) + ) + (send-event (ppointer->process (-> self parent)) 'child-die) + (go-virtual die-fast) + ) + ) + ) + (set-time! (-> self state-time)) + (stop-look-at! self) + (logior! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self mask) (process-mask actor-pause)) + (let* ((v1-30 *game-info*) + (a0-13 (+ (-> v1-30 attack-id) 1)) + ) + (set! (-> v1-30 attack-id) a0-13) + (set! (-> self attack-id) a0-13) + ) + (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) + ) + (if (and (enemy-method-123 self) (-> self enemy-info ragdoll-info)) + (set! (-> self root transv y) 0.0) + ) + (let ((v1-43 (-> self root))) + (logclear! (-> v1-43 status) (collide-status + on-surface + on-ground + touch-surface + touch-wall + touch-ceiling + touch-actor + on-special-surface + touch-edge + blocked + on-water + impact-surface + touch-background + stuck + glance + ) + ) + (when (not (logtest? (-> v1-43 root-prim prim-core action) (collide-action no-normal-reset))) + (let ((a0-25 (-> v1-43 dynam gravity-normal))) + (set! (-> v1-43 local-normal quad) (-> a0-25 quad)) + (set! (-> v1-43 surface-normal quad) (-> a0-25 quad)) + (set! (-> v1-43 poly-normal quad) (-> a0-25 quad)) + ) + (set! (-> v1-43 coverage) 0.0) + (set! (-> v1-43 touch-angle) 0.0) + ) + (knocked-handler self (-> v1-43 transv)) + ) + (if (>= (-> self enemy-info knocked-seek-ry-clamp) 0.0) + (set! (-> self desired-angle) (get-knockback-angle self)) + ) + (if (or (= (-> self hit-points) 0.0) (nonzero? (-> self fated-time))) + (on-dying self) + (play-damage-sound self 0) + ) + (logclear! (-> self focus-status) (focus-status dangerous)) + (if (= (-> self incoming knocked-type) (knocked-type yellow-shot)) + (logclear! (-> self enemy-flags) (enemy-flag trackable)) + ) + (set! (-> self root penetrate-using) (penetrate lunge vehicle knocked)) + (reset-penetrate! self) + (enemy-method-50 self 1) + (ragdoll-spawn! self #t #f) + ) + :exit (behavior () + (disable-ragdoll self) + ) + :trans (behavior () + (if (>= (-> self enemy-info knocked-seek-ry-clamp) 0.0) + (seek-toward-yaw-angle! (-> self root) (-> self desired-angle) 138353.78 (seconds 0.1)) + ) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.2)) + (suspend) + ) + ) + (until (ragdoll-settled? self) + (if (or (time-elapsed? (-> self state-time) (seconds 4)) (enemy-method-109 self)) + (go-die self) + ) + (suspend) + ) + (if (within-gspot-range? self) + (go-die self) + ) + ) + (else + (let ((gp-1 (new 'stack-no-clear 'enemy-knocked-info))) + (let ((s5-0 0)) + (set! (-> gp-1 anim-speed) (rnd-float-range self 0.9 1.1)) + (set! (-> gp-1 on-surface-count) 0) + (set! (-> gp-1 move-count) 0) + (until (enemy-method-88 self gp-1) + (if (time-elapsed? (-> self state-time) (seconds 2)) + (go-die self) + ) + (if (logtest? (-> self root status) (collide-status on-surface)) + (+! (-> gp-1 on-surface-count) 1) + ) + (knocked-anim-handler self s5-0 gp-1) + (suspend) + (+! (-> gp-1 move-count) 1) + (set! s5-0 1) + ) + ) + (let ((s5-1 2)) + (set-time! (-> gp-1 land-can-land-time)) + (until #f + (if (logtest? (-> self root status) (collide-status on-surface)) + (+! (-> gp-1 on-surface-count) 1) + ) + (if (knocked-anim-handler self s5-1 gp-1) + (goto cfg-33) + ) + (suspend) + (+! (-> gp-1 move-count) 1) + (set! s5-1 3) + (if (enemy-method-88 self gp-1) + (set-time! (-> gp-1 land-can-land-time)) + ) + ) + ) + #f + (label cfg-33) + (if (and (not (logtest? (enemy-flag death-start) (-> self enemy-flags))) + (or (within-gspot-range? self) + (enemy-method-109 self) + (time-elapsed? (-> gp-1 land-can-land-time) (-> self enemy-info knocked-can-land-timeout)) + ) + ) + (go-die self) + ) + (while (not (knocked-anim-handler self 4 gp-1)) + (suspend) + ) + ) + ) + ) + (cond + ((or (= (-> self hit-points) 0.0) (nonzero? (-> self fated-time))) + (cond + ((logtest? (enemy-flag death-start) (-> self enemy-flags)) + (set! (-> self hit-points) 0.0) + (let ((v1-90 (-> self root root-prim))) + (set! (-> v1-90 prim-core collide-as) (collide-spec)) + (set! (-> v1-90 prim-core collide-with) (collide-spec)) + ) + 0 + (send-event self 'death-end) + (let ((gp-2 (-> self child))) + (while gp-2 + (send-event (ppointer->process gp-2) 'notice 'die) + (set! gp-2 (-> gp-2 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + (else + (when (and (-> self skel effect) (logtest? (enemy-flag auto-death-phase-out) (-> self enemy-flags))) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + (suspend) + 0 + ) + (go-die self) + ) + ) + ) + (else + (go-virtual knocked-recover) + ) + ) + ) + :post enemy-falling-post + ) + +;; failed to figure out what this is: +(defstate knocked-recover (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (local-vars (v1-1 enemy-flag) (v1-13 enemy-flag) (v1-15 enemy-flag) (v1-17 enemy-flag)) + (let ((v1-0 (-> self enemy-flags))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v1-1 (logior (enemy-flag check-water) v1-0)) + (set! v1-1 (logclear v1-0 (enemy-flag check-water))) + ) + ) + (set! (-> self enemy-flags) v1-1) + (when (!= (-> self hit-points) 0.0) + (set! (-> self root penetrate-using) + (the-as penetrate (logclear (-> self root penetrate-using) (penetrate knocked))) + ) + (enemy-method-50 self 2) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-12 (-> self enemy-flags))) + (if (logtest? v1-12 (enemy-flag vulnerable-backup)) + (set! v1-13 (logior v1-12 (enemy-flag vulnerable))) + (set! v1-13 (logclear v1-12 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-13) + (let ((v1-14 (-> self enemy-flags))) + (if (logtest? v1-14 (enemy-flag attackable-backup)) + (set! v1-15 (logior v1-14 (enemy-flag attackable))) + (set! v1-15 (logclear v1-14 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-15) + (let ((v1-16 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-16) + (set! v1-17 (logior (enemy-flag trackable) v1-16)) + (set! v1-17 (logclear v1-16 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-17) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) (seconds 0.01)) + (and (not (handle->process (-> self ragdoll-proc))) + (or (within-gspot-range? self) + (time-elapsed? (-> self state-time) (-> self enemy-info knocked-recover-timeout)) + ) + ) + ) + (go-die self) + ) + ) + :code (behavior () + (local-vars (v1-58 symbol)) + (cond + ((handle->process (-> self ragdoll-proc)) + (ja-channel-push! 1 0) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (seek!) :frame-num 0.0) + (ragdoll-method-25 (-> (the-as ragdoll-proc (handle->process (-> self ragdoll-proc))) ragdoll) self) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info idle-anim)) :num! (loop!) :frame-num 0.0) + (until v1-58 + (suspend) + (ja :num! (loop!)) + (set! v1-58 (and (logtest? (-> self root status) (collide-status on-surface)) + (< (vector-length (-> self root transv)) 2048.0) + ) + ) + ) + ) + ) + (if (enemy-method-109 self) + (go-die self) + (go-hostile self) + ) + ) + :post (behavior () + (when (not (handle->process (-> self ragdoll-proc))) + (let ((gp-0 (-> self root))) + (if (focus-test? self under-water) + (accelerate-fall! self (-> gp-0 transv)) + (vector-v++! + (-> gp-0 transv) + (compute-acc-due-to-gravity gp-0 (new 'stack-no-clear 'vector) (-> self enemy-info slip-factor)) + ) + ) + (let ((a2-1 (new 'stack-no-clear 'collide-query))) + (set! (-> a2-1 collide-with) (-> self enemy-info recover-gnd-collide-with)) + (set! (-> a2-1 ignore-process0) self) + (set! (-> a2-1 ignore-process1) #f) + (set! (-> a2-1 ignore-pat) (logior (new 'static 'pat-surface :noendlessfall #x1) (-> gp-0 pat-ignore-mask))) + (set! (-> a2-1 action-mask) (collide-action solid)) + (fill-cache-integrate-and-collide gp-0 (-> gp-0 transv) a2-1 (meters 0)) + ) + ) + (apply-friction self) + ) + (let ((gp-1 (-> self root)) + (a1-5 (new 'stack-no-clear 'collide-query)) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> s5-1 quad) (-> gp-1 gspot-pos quad)) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> gp-1 gspot-normal quad)) + (let* ((a0-10 gp-1) + (t9-5 (method-of-object a0-10 find-ground)) + (a2-2 (-> self enemy-info gnd-collide-with)) + (a3-1 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (not (t9-5 a0-10 a1-5 a2-2 a3-1 t0-0 t1-0)) + (set! (-> gp-1 gspot-pos quad) (-> s5-1 quad)) + (set! (-> gp-1 gspot-normal quad) (-> s4-1 quad)) + ) + ) + ) + ) + (enemy-simple-post) + ) + ) + +;; definition for method 154 of type enemy +;; WARN: Return type mismatch entity-perm-status vs none. +(defmethod mark-as-dead ((this enemy)) + (cond + ((logtest? (process-mask enemy) (-> this mask)) + (+! (-> *game-info* enemies-killed) 1.0) + ) + ((logtest? (process-mask guard civilian) (-> this mask)) + (+! (-> *game-info* civilians-killed) 1.0) + ) + ) + (logior! (-> this focus-status) (focus-status dead)) + (process-entity-status! this (entity-perm-status subtask-complete) #t) + (none) + ) + +;; definition for method 143 of type enemy +(defmethod on-dying ((this enemy)) + (when (not (logtest? (enemy-flag called-dying) (-> this enemy-flags))) + (set! (-> this enemy-flags) (the-as enemy-flag (logior (enemy-flag called-dying) (-> this enemy-flags)))) + (play-damage-sound this 1) + (when (and (logtest? (enemy-flag has-gem) (-> this enemy-flags)) + (not (logtest? (enemy-flag spawn-gem) (-> this enemy-flags))) + ) + (logior! (-> this enemy-flags) (enemy-flag spawn-gem)) + (remove-from-process *part-engine* this) + (setup-masks + (-> this draw) + (the-as int (-> this enemy-info gem-no-seg)) + (the-as int (-> this enemy-info gem-seg)) + ) + (let* ((a0-11 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this node-list data (-> this enemy-info gem-joint))) + ) + (s4-0 (ppointer->process (birth-pickup-at-point a0-11 (pickup-type gem) 1.0 #t *entity-pool* (-> this fact)))) + (s5-0 (if (type? s4-0 gem) + s4-0 + ) + ) + ) + (if s5-0 + (set! (-> (the-as gem s5-0) gem-pool) (the-as uint (get-gem-pool-idx this))) + ) + ) + ) + (logclear! (-> this enemy-flags) (enemy-flag vulnerable vulnerable-backup)) + (logclear! (-> this focus-status) (focus-status dangerous)) + (logclear! (-> this enemy-flags) (enemy-flag dangerous-backup)) + (logclear! (-> this enemy-flags) (enemy-flag attackable attackable-backup)) + (logclear! (-> this mask) (process-mask actor-pause)) + (logclear! (-> this enemy-flags) (enemy-flag actor-pause-backup)) + (mark-as-dead this) + (if (-> this skel effect) + (logior! (-> this skel effect flags) (effect-control-flag ecf1)) + ) + (stop-look-at! this) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate die (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (on-dying self) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (set-time! (-> self state-time)) + (set! (-> self hit-points) 0.0) + (ragdoll-spawn! self #f #t) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.2)) + (suspend) + ) + ) + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 0.8)) + (suspend) + ) + ) + ) + (else + (ja-channel-push! 1 (seconds 0.075)) + (let ((f30-0 (rnd-float-range self 0.8 1.2))) + (ja-no-eval :group! (-> self draw art-group data (-> self enemy-info die-anim)) + :num! (seek! max f30-0) + :frame-num 0.0 + ) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (send-event self 'death-end) + (let ((gp-2 (-> self child))) + (while gp-2 + (send-event (ppointer->process gp-2) 'notice 'die) + (set! gp-2 (-> gp-2 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + :post enemy-simple-post + ) + +;; definition for method 144 of type enemy +(defmethod falling? ((this enemy)) + (let ((s5-0 (-> this root)) + (a1-0 (new 'stack-no-clear 'collide-query)) + (gp-0 #t) + ) + (let* ((v1-0 s5-0) + (t9-0 (method-of-object v1-0 find-ground)) + (a2-1 (-> this enemy-info recover-gnd-collide-with)) + (a3-0 8192.0) + (t0-0 81920.0) + (t1-0 1024.0) + ) + (when (t9-0 v1-0 a1-0 a2-1 a3-0 t0-0 t1-0) + (if (< (- (-> s5-0 trans y) (-> s5-0 gspot-pos y)) 8192.0) + (set! gp-0 #f) + ) + ) + ) + gp-0 + ) + ) + +;; failed to figure out what this is: +(defstate die-falling (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (on-dying self) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + (set! (-> self hit-points) 0.0) + (if (logtest? (enemy-option knocked-into-water) (-> self fact enemy-options)) + (logior! (-> self enemy-flags) (enemy-flag check-water)) + ) + (ragdoll-spawn! self #f #t) + ) + :exit (behavior () + (local-vars (v0-0 enemy-flag)) + (let ((v1-0 (-> self enemy-flags))) + (if (logtest? (enemy-flag check-water-backup) v1-0) + (set! v0-0 (logior (enemy-flag check-water) v1-0)) + (set! v0-0 (logclear v1-0 (enemy-flag check-water))) + ) + ) + (set! (-> self enemy-flags) v0-0) + ) + :code (behavior () + (cond + ((handle->process (-> self ragdoll-proc)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 1)) + (suspend) + ) + ) + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 1)) + (suspend) + ) + ) + (deactivate-ragdoll! self) + ) + (else + (ja-channel-push! 1 (seconds 0.1)) + (let ((gp-2 (-> self draw art-group data (if (falling? self) + (-> self enemy-info die-falling-anim) + (-> self enemy-info die-anim) + ) + ) + ) + (f30-0 (rnd-float-range self 0.8 1.2)) + ) + (ja-no-eval :group! gp-2 :num! (seek! max f30-0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max f30-0)) + ) + ) + ) + ) + (send-event self 'death-end) + (let ((gp-3 (-> self child))) + (while gp-3 + (send-event (ppointer->process gp-3) 'notice 'die) + (set! gp-3 (-> gp-3 0 brother)) + ) + ) + (while (-> self child) + (suspend) + ) + (cleanup-for-death self) + ) + :post enemy-die-falling-post + ) + +;; failed to figure out what this is: +(defstate directed (enemy) + :virtual #t + :event enemy-event-handler + :enter (behavior () + (logior! (-> self enemy-flags) (enemy-flag directed-ready)) + ((-> (method-of-type enemy idle) enter)) + ) + :exit (behavior () + (logclear! (-> self enemy-flags) (enemy-flag directed-ready)) + ) + :code (-> (method-of-type enemy idle) code) + :post (-> (method-of-type enemy idle) post) + ) + +;; failed to figure out what this is: +(defstate die-fast (enemy) + :virtual #t + :code nothing + ) + +;; failed to figure out what this is: +(defstate view-anims (enemy) + :virtual #t + :enter (behavior () + '() + ) + :trans (behavior () + '() + ) + :code (behavior () + (let ((gp-0 (-> self draw art-group))) + (until #f + (dotimes (s5-0 (-> gp-0 length)) + (let ((s4-0 (-> gp-0 data s5-0))) + (when (and s4-0 (= (-> s4-0 type) art-joint-anim)) + (ja-channel-set! 1) + (ja-no-eval :group! s4-0 :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + ) + ) + ) + ) + #f + ) + :post transform-post + ) + +;; definition for function gun-dark-2-anim-code +;; WARN: Return type mismatch symbol vs object. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior gun-dark-2-anim-code enemy () + 0.0 + (let ((f28-0 (the float (ja-num-frames 0)))) + 0.0 + 0.0 + (let ((f30-0 1.0)) + 0.0 + (let* ((f26-0 (/ (ja-frame-num 0) f28-0)) + (f0-12 (cond + ((< 0.5 f26-0) + (let* ((f24-0 0.3) + (v1-4 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-5 (the-as number (logior #x3f800000 v1-4))) + ) + (- f26-0 (+ f24-0 (* (+ -1.0 (the-as float v1-5)) (+ -0.3 f26-0)))) + ) + ) + (else + (let* ((f24-1 0.3) + (v1-11 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-12 (the-as number (logior #x3f800000 v1-11))) + ) + (+ f24-1 (* (+ -1.0 (the-as float v1-12)) (- 0.7 f26-0)) f26-0) + ) + ) + ) + ) + (f26-1 (fmax 0.0 (fmin 1.0 f0-12))) + (f28-1 (* f28-0 f26-1)) + ) + (let* ((f1-8 (* 0.000061035156 (-> self root root-prim local-sphere w))) + (f0-21 (fmax 0.0 (fmin 1.0 f1-8))) + ) + (* f30-0 (lerp 2.0 1.0 f0-21)) + ) + (cond + ((>= (-> self enemy-info idle-anim) 0) + (let ((s5-0 (ja-group)) + (f30-1 (ja-frame-num 0)) + (gp-0 (-> self draw art-group data (-> self enemy-info idle-anim))) + ) + (ja-channel-push! 2 (seconds 1)) + (ja :group! s5-0 :num! (identity f30-1)) + (ja :chan 1 + :group! gp-0 + :num! (identity (* f26-1 (the float (+ (-> (the-as art-joint-anim gp-0) frames num-frames) -1)))) + ) + ) + (let* ((gp-1 (current-time)) + (f30-2 18.0) + (f28-2 6.0) + (v1-45 (/ (the-as int (rand-uint31-gen *random-generator*)) 256)) + (v1-46 (the-as number (logior #x3f800000 v1-45))) + (f30-3 (+ f30-2 (* f28-2 (+ -1.0 (the-as float v1-46))))) + ) + (until #f + (let* ((f0-32 (* 0.0033333334 (the float (- (current-time) gp-1)))) + (f0-34 (/ (- f0-32 (* (the float (the int (/ f0-32 f30-3))) f30-3)) f30-3)) + (f0-36 (cos (* 65536.0 f0-34))) + (f0-37 (+ 1.0 f0-36)) + (f28-3 (* 0.5 f0-37)) + ) + (ja :num! identity :frame-interp0 f28-3 :frame-interp1 f28-3) + (let ((a0-20 (-> self skel root-channel 1))) + (let ((f0-39 (- 1.0 f28-3))) + (set! (-> a0-20 frame-interp 1) f0-39) + (set! (-> a0-20 frame-interp 0) f0-39) + ) + (joint-control-channel-group-eval! a0-20 (the-as art-joint-anim #f) num-func-identity) + ) + ) + (suspend) + 0 + ) + ) + #f + ) + (else + (until (time-elapsed? (-> self state-time) (seconds 2)) + (let* ((f1-22 (* 0.0016666667 (the float (- (current-time) (-> self state-time))))) + (f0-42 (fmax 0.0 (fmin 1.0 f1-22))) + ) + (ja :num! (seek! f28-1 (lerp 0.2 0.01 f0-42))) + ) + (suspend) + 0 + ) + ) + ) + ) + ) + ) + (sleep-code) + ) + +;; definition for function gun-dark-2-ragdoll-start +;; INFO: Used lq/sq +(defun gun-dark-2-ragdoll-start ((arg0 enemy)) + (local-vars (s4-0 process)) + (when (-> arg0 enemy-info ragdoll-info) + (let ((s5-0 (handle->process (-> arg0 ragdoll-proc)))) + (cond + (s5-0 + (set! s4-0 s5-0) + ) + (else + (set! (-> arg0 ragdoll-proc) + (ppointer->handle + (process-spawn + ragdoll-proc + (-> arg0 enemy-info ragdoll-info) + :name "ragdoll-proc" + :to arg0 + :stack-size #x5000 + ) + ) + ) + (set! s4-0 (handle->process (-> arg0 ragdoll-proc))) + (if (not s4-0) + (return 0) + ) + (set! (-> arg0 enemy-flags) + (the-as enemy-flag (logior (enemy-flag auto-death-phase-out) (-> arg0 enemy-flags))) + ) + ) + ) + (if (-> (the-as ragdoll-proc s4-0) ragdoll) + (logior! (-> (the-as ragdoll-proc s4-0) ragdoll ragdoll-flags) (ragdoll-flag rf3 rf4)) + ) + (let ((s3-0 (new 'stack-no-clear 'vector))) + (vector-float*! s3-0 (-> arg0 root transv) (seconds-per-frame)) + (if s5-0 + (ragdoll-proc-method-15 (the-as ragdoll-proc s4-0) #f (the-as vector #f) #f) + (ragdoll-proc-method-15 (the-as ragdoll-proc s4-0) #f (the-as vector #f) #t) + ) + (let ((v0-0 (the-as object (-> (the-as ragdoll-proc s4-0) ragdoll ragdoll-joints 0 velocity)))) + (set! (-> (the-as vector v0-0) quad) (-> s3-0 quad)) + v0-0 + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate gun-dark-2-stretch (enemy) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (local-vars (v0-4 object) (sv-112 event-message-block) (sv-128 event-message-block)) + (case message + (('attack) + (let* ((s5-0 (the-as object (-> block param 1))) + (s4-0 (new 'stack-no-clear 'vector)) + (v1-1 (-> (the-as attack-info s5-0) mode)) + ) + (set! v0-4 (cond + ((= v1-1 'gravity-end) + (set! (-> self root transv quad) (the-as uint128 0)) + (gun-dark-2-ragdoll-start self) + (let* ((s4-1 self) + (s1-0 (method-of-object s4-1 get-incoming-attack!)) + (s0-0 proc) + ) + (set! sv-112 block) + (let ((a3-1 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t1-0 #f) + ) + (s1-0 + s4-1 + (the-as process-drawable s0-0) + sv-112 + a3-1 + (the-as attack-info s5-0) + (the-as touching-shapes-entry t1-0) + ) + ) + ) + (damage-enemy! self proc block) + (set! (-> self incoming penetrate-using) (penetrate vehicle)) + (set! (-> self incoming knocked-type) (knocked-type vehicle)) + (set! (-> self incoming attack-direction quad) (the-as uint128 0)) + (set! (-> self starting-time) 0) + (let ((a1-4 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-4 from) (process->ppointer proc)) + (set! (-> a1-4 num-params) argc) + (set! (-> a1-4 message) 'hit-knocked) + (set! (-> a1-4 param 0) (-> block param 0)) + (set! (-> a1-4 param 1) (-> block param 1)) + (set! (-> a1-4 param 2) (-> block param 2)) + (set! (-> a1-4 param 3) (-> block param 3)) + (set! (-> a1-4 param 4) (-> block param 4)) + (set! (-> a1-4 param 5) (-> block param 5)) + (send-event-function self a1-4) + ) + ) + (else + (when (!= (-> (the-as attack-info s5-0) id) (-> self incoming attack-id)) + (let* ((s2-1 self) + (s1-1 (method-of-object s2-1 get-incoming-attack!)) + (s0-1 proc) + ) + (set! sv-128 block) + (let ((a3-2 (get-penetrate-using-from-attack-event (the-as process-drawable proc) block)) + (t0-1 (the-as uint s5-0)) + (t1-1 (-> block param 0)) + ) + (s1-1 + s2-1 + (the-as process-drawable s0-1) + sv-128 + a3-2 + (the-as attack-info t0-1) + (the-as touching-shapes-entry t1-1) + ) + ) + ) + (knocked-handler self s4-0) + (let ((gp-1 (-> self child))) + (while gp-1 + (when (send-event (-> gp-1 0) 'is-gravity) + (send-event + (-> gp-1 0) + 'attack-forward + (-> self incoming attack-direction) + (-> self incoming attack-position) + (the-as uint s5-0) + (-> self incoming penetrate-using) + s4-0 + (-> self incoming attack-position) + ) + (set! v0-4 0) + (goto cfg-17) + ) + (set! gp-1 (-> gp-1 0 brother)) + ) + ) + #f + ) + ) + ) + ) + ) + (label cfg-17) + v0-4 + ) + (else + (if (zero? (-> self starting-time)) + (enemy-event-handler proc argc message block) + ) + ) + ) + ) + :enter (behavior () + (local-vars (v1-7 enemy-flag) (v1-9 enemy-flag) (v1-11 enemy-flag) (v1-34 enemy-flag)) + (if (logtest? (-> self enemy-flags) (enemy-flag dangerous-backup)) + (logior! (-> self focus-status) (focus-status dangerous)) + (logclear! (-> self focus-status) (focus-status dangerous)) + ) + (let ((v1-6 (-> self enemy-flags))) + (if (logtest? v1-6 (enemy-flag vulnerable-backup)) + (set! v1-7 (logior v1-6 (enemy-flag vulnerable))) + (set! v1-7 (logclear v1-6 (enemy-flag vulnerable))) + ) + ) + (set! (-> self enemy-flags) v1-7) + (let ((v1-8 (-> self enemy-flags))) + (if (logtest? v1-8 (enemy-flag attackable-backup)) + (set! v1-9 (logior v1-8 (enemy-flag attackable))) + (set! v1-9 (logclear v1-8 (enemy-flag attackable))) + ) + ) + (set! (-> self enemy-flags) v1-9) + (let ((v1-10 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-10) + (set! v1-11 (logior (enemy-flag trackable) v1-10)) + (set! v1-11 (logclear v1-10 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-11) + (logclear! (-> self enemy-flags) (enemy-flag lock-focus)) + (logclear! (-> self focus-status) (focus-status hit)) + (vector-float*! (-> self root transv) (-> self root transv) 0.5) + (set! (-> self root penetrated-by) (penetrate)) + (+! (-> self root transv y) 2048.0) + (set-time! (-> self state-time)) + (set! (-> self root penetrated-by) (logior (get-penetrated-by self) (penetrate vehicle))) + (set-time! (-> self starting-time)) + (set! (-> self focus-status) (the-as focus-status (logior (focus-status no-gravity) (-> self focus-status)))) + (let ((v1-33 (-> self enemy-flags))) + (if (logtest? (enemy-flag trackable-backup) v1-33) + (set! v1-34 (logior (enemy-flag trackable) v1-33)) + (set! v1-34 (logclear v1-33 (enemy-flag trackable))) + ) + ) + (set! (-> self enemy-flags) v1-34) + (stop-look-at! self) + (when (and (-> self draw) (-> self draw shadow-ctrl)) + (let ((v1-41 (-> self draw shadow-ctrl))) + (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + :exit (behavior () + (set! (-> self focus-status) + (the-as focus-status (logclear (-> self focus-status) (focus-status no-gravity))) + ) + (when (and (-> self draw) (-> self draw shadow-ctrl)) + (let ((v1-6 (-> self draw shadow-ctrl))) + (logclear! (-> v1-6 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + :trans (behavior () + (let ((gp-0 (-> self child))) + (while gp-0 + (when (send-event (-> gp-0 0) 'is-gravity) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer self)) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'get-float-speed) + (let ((f0-0 (the-as float (send-event-function (-> gp-0 0) a1-1)))) + (+! (-> self root transv y) (* f0-0 (seconds-per-frame))) + ) + ) + 0 + (goto cfg-11) + ) + (set! gp-0 (-> gp-0 0 brother)) + ) + ) + (label cfg-11) + (vector-float*! (-> self root transv) (-> self root transv) (- 1.0 (* 0.5 (seconds-per-frame)))) + (let ((s3-0 (new 'stack 'collide-query)) + (gp-2 (vector-float*! (new 'stack-no-clear 'vector) (-> self root transv) (seconds-per-frame))) + ) + (set! (-> s3-0 start-pos quad) (-> (get-trans self 3) quad)) + (set! (-> s3-0 move-dist quad) (-> gp-2 quad)) + (let ((v1-26 s3-0)) + (set! (-> v1-26 radius) (* 0.7 (-> self root root-prim prim-core world-sphere w))) + (set! (-> v1-26 collide-with) + (collide-spec backgnd civilian enemy obstacle hit-by-others-list pusher vehicle-mesh) + ) + (set! (-> v1-26 ignore-process0) self) + (set! (-> v1-26 ignore-process1) #f) + (set! (-> v1-26 ignore-pat) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1 :board #x1) + ) + (set! (-> v1-26 action-mask) (collide-action solid)) + ) + (let ((f30-0 (fill-and-probe-using-line-sphere *collide-cache* s3-0))) + (set! f30-0 + (cond + ((>= f30-0 0.0) + (vector-float*! gp-2 gp-2 f30-0) + (let ((s5-1 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + (v1-31 (-> s3-0 best-other-tri)) + (f28-0 0.9) + ) + (set! (-> s5-1 quad) (-> v1-31 normal quad)) + (set! (-> s4-0 quad) (-> v1-31 intersect quad)) + (let ((v1-32 (and (-> v1-31 collide-ptr) (let ((s2-0 (-> v1-31 collide-ptr))) + (if (type? s2-0 collide-shape-prim-sphere) + s2-0 + ) + ) + ) + ) + ) + (when v1-32 + (let ((s2-1 (-> (the-as collide-shape-prim-sphere v1-32) cshape process))) + (let ((s1-0 (new 'stack-no-clear 'vector))) + (set! (-> s1-0 quad) (-> self root transv quad)) + (let* ((s0-0 s2-1) + (v1-37 (if (type? s0-0 process-focusable) + s0-0 + ) + ) + ) + (when v1-37 + (when (focus-test? (the-as process-focusable v1-37) no-gravity) + (vector-float*! s1-0 s1-0 0.5) + (set! f28-0 0.5) + ) + ) + ) + ) + (let ((f1-6 (fmax 0.0 (fmin 1.0 (* 0.000008138021 (vector-length (-> self root transv)))))) + (f0-12 0.0) + ) + (if (< 0.1 f1-6) + (set! f0-12 (lerp 3.0 12.0 f1-6)) + ) + (send-event + s2-1 + 'attack + #f + (static-attack-info :mask (vehicle-impulse-factor) ((id (-> self attack-id)) + (damage f0-12) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (penetrate-using (penetrate vehicle)) + (vector (-> self root transv)) + (attacker-velocity (-> self root transv)) + (intersection s4-0) + ) + ) + ) + ) + ) + ) + ) + (let ((s2-3 (vector-! (new 'stack-no-clear 'vector) (-> s3-0 start-pos) s4-0))) + 0.0 + (let* ((f0-16 (vector-normalize-ret-len! s2-3 1.0)) + (f0-18 (* 1.3 (- (* 0.7 (-> self root root-prim prim-core world-sphere w)) f0-16))) + ) + (vector-normalize! s2-3 f0-18) + ) + (vector+! (-> self root trans) (-> self root trans) s2-3) + ) + (let ((f26-0 (vector-dot (-> self root transv) s5-1))) + (vector+float*! (-> self root transv) (-> self root transv) s5-1 (* -2.0 f26-0)) + (vector-float*! (-> self root transv) (-> self root transv) f28-0) + (let ((s3-1 (-> self child))) + (while s3-1 + (when (send-event (-> s3-1 0) 'is-gravity) + (send-event (-> s3-1 0) 'impact s4-0 (vector-float*! (new 'stack-no-clear 'vector) s5-1 (- f26-0))) + 0 + (goto cfg-38) + ) + (set! s3-1 (-> s3-1 0 brother)) + ) + ) + ) + ) + (label cfg-38) + f30-0 + ) + (else + 1.0 + ) + ) + ) + (vector+! (-> self root trans) (-> self root trans) gp-2) + (if (< f30-0 1.0) + (vector+float*! (-> self root trans) (-> self root trans) (-> self root transv) (* f30-0 (seconds-per-frame))) + ) + ) + ) + ) + :code (behavior () + (gun-dark-2-anim-code) + ) + :post (behavior () + (let ((gp-0 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (ja-post) + (update-transforms (-> self root)) + (set! (-> self skel status) gp-0) + ) + (let ((gp-1 (-> self child))) + (while gp-1 + (when (send-event (-> gp-1 0) 'is-gravity) + (send-event (-> gp-1 0) 'update-rotation) + (return 0) + ) + (set! gp-1 (-> gp-1 0 brother)) + ) + ) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc index 361caf752b4..b648255f1b9 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/generic-obs_REF.gc @@ -1460,7 +1460,7 @@ 0.0 614400.0 (the-as vector #f) - 0.000000000000000000000000000000000000000000084 + (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0 ) ) @@ -3561,12 +3561,12 @@ ;; definition for function explosion-spawn ;; WARN: Return type mismatch process vs none. -(defun explosion-spawn ((arg0 process-drawable) (arg1 type) (arg2 explosion-init-params)) +(defun explosion-spawn ((arg0 explosion-init-params) (arg1 process-drawable)) (let* ((gp-0 (the-as process #f)) (s3-0 (get-process *default-dead-pool* explosion #x4000 1)) (v1-1 (when s3-0 (let ((t9-1 (method-of-type explosion activate))) - (t9-1 (the-as explosion s3-0) (the-as process-tree arg1) "explosion" (the-as pointer #x70004000)) + (t9-1 (the-as explosion s3-0) arg1 "explosion" (the-as pointer #x70004000)) ) (run-now-in-process s3-0 explosion-init-by-other arg0) (-> s3-0 ppointer) @@ -4298,56 +4298,18 @@ (cond ((logtest? (-> self particle-launchers (-> self current-part-index) 0 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> gp-1 quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-4 (method-of-type part-tracker-subsampler activate))) - (t9-4 - (the-as part-tracker-subsampler gp-2) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-5 run-function-in-process) - (a0-18 gp-2) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) - (-> self particle-launchers (-> self current-part-index) 0) - ) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-5) a0-18 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (-> self particle-launchers (-> self current-part-index) 0) ) ) (else (set! (-> *launch-matrix* trans quad) (-> gp-1 quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-7 (method-of-type part-tracker activate))) - (t9-7 (the-as part-tracker gp-3) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-23 gp-3) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self particle-launchers (-> self current-part-index) 0)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-8) a0-23 a1-6 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (-> self particle-launchers (-> self current-part-index) 0) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc new file mode 100644 index 00000000000..eb4c7d6ad88 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/guard-projectile_REF.gc @@ -0,0 +1,664 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 849 + :init-specs ((:texture (common-white common)) + (:num 10.0 1.0) + (:x (meters 0)) + (:y (meters 0)) + (:z (meters 0)) + (:scale-x (meters 1)) + (:rot-x (degrees 90)) + (:rot-y (degrees 0)) + (:rot-z (degrees 0)) + (:scale-y (meters 0.1)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0 32.0) + (:accel-y (meters -0.00033333333) (meters -0.001)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-14)) + ) + ) + +;; failed to figure out what this is: +(defpart 850 + :init-specs ((:texture (gun-yellow-beam level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 0.25)) + (:scale-y (meters 9)) + (:r 128.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 128.0) + (:scalevel-x (meters 0.0016666667)) + (:fade-a -2.1333334) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +;; failed to figure out what this is: +(defpart 851 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 32.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters -0.016666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.6) + (:timer (seconds 0.085)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +;; failed to figure out what this is: +(defpart 852 + :init-specs ((:texture (glow level-default-sprite)) + (:num 0.0) + (:scale-x (meters 0.3) (meters 0.3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0 32.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +;; failed to figure out what this is: +(defpart 853 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 8.0 8.0) + (:z (meters 0) (meters -3)) + (:scale-x (meters 0.4) (meters 0.4)) + (:scale-y (meters 0.4) (meters 0.4)) + (:r 192.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters -0.00234375)) + (:scalevel-y :copy scalevel-x) + (:fade-g -1.2 -2.4) + (:fade-a -0.53333336 -2.1333334) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:timer (seconds 0.8)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 854 + :init-specs ((:texture (gun-enemy-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 2)) + (:scale-y (meters 4.5)) + (:r 128.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 128.0) + (:fade-a -3.6571429) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +;; failed to figure out what this is: +(defpart 855 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1) (meters 1)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 0.0) + (:a 255.0) + (:omega (degrees 4515.75)) + (:scalevel-x (meters 0.053333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -3.6571429) + (:fade-a -7.285714) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1024.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-shot-hit-object + :id 211 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 856 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 857 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 858 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-shot-hit + :id 212 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 856 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 857 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 858 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 859 :period (seconds 2) :length (seconds 0.017)) + ) + ) + +;; failed to figure out what this is: +(defpart 858 + :init-specs ((:texture (explosion-nebula level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2)) + (:rot-x (degrees 1.125)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 64.0) + (:scalevel-x (meters 0.075)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.8285714) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 8192.0) + ) + ) + +;; failed to figure out what this is: +(defpart 859 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 8.0 8.0) + (:scale-x (meters 0.75) (meters 0.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 0.0) + (:a 16.0 48.0) + (:vel-y (meters 0.026666667) (meters 0.026666667)) + (:scalevel-x (meters 0.0016666667) (meters 0.006666667)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.30476192) + (:fade-g 0.15238096) + (:fade-b 0.30476192) + (:fade-a -0.15238096) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:friction 0.9) + (:timer (seconds 1.4)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 857 + :init-specs ((:texture (glow level-default-sprite)) + (:num 2.0) + (:scale-x (meters 2)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 128.0 64.0) + (:b 0.0 32.0) + (:a 48.0) + (:scalevel-x (meters 0.125)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.1333334) + (:fade-b -2.1333334) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow)) + (:userdata 0.0) + (:next-time (seconds 0.067)) + (:next-launcher 860) + ) + ) + +;; failed to figure out what this is: +(defpart 860 + :init-specs ((:scale-x (meters 4.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.05)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.53333336) + (:fade-a -0.8) + ) + ) + +;; failed to figure out what this is: +(defpart 856 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 96.0) + (:scalevel-x (meters 0.1)) + (:rotvel-z (degrees 0.3)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.185)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.05)) + (:next-launcher 861) + ) + ) + +;; failed to figure out what this is: +(defpart 861 + :init-specs ((:scale-x (meters 3.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.0625)) + (:scalevel-y :copy scalevel-x) + (:fade-b -6.4) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-guard-grenade + :id 213 + :duration (seconds 0.5) + :flags (sp0) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 862 :fade-after (meters 200) :falloff-to (meters 200))) + ) + +;; failed to figure out what this is: +(defpart 862 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.5) (meters 0.25)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 64.0 128.0) + (:g :copy r) + (:b :copy g) + (:a 16.0 32.0) + (:vel-y (meters 0) (meters 0.016666668)) + (:scalevel-x (meters 0.006666667) (meters 0.013333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16 -0.16) + (:friction 0.96) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + (:conerot-radius (meters 0)) + ) + ) + +;; definition of type guard-shot +(deftype guard-shot (projectile) + ((hit-actor? symbol) + (tail-pos vector :inline) + ) + ) + +;; definition for method 3 of type guard-shot +(defmethod inspect ((this guard-shot)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 this) + ) + (format #t "~2Thit-actor?: ~A~%" (-> this hit-actor?)) + (format #t "~2Ttail-pos: #~%" (-> this tail-pos)) + (label cfg-4) + this + ) + +;; definition for method 37 of type guard-shot +(defmethod deal-damage! ((this guard-shot) (arg0 process) (arg1 event-message-block)) + (let ((t9-0 (method-of-type projectile deal-damage!))) + (when (t9-0 this arg0 arg1) + (set! (-> this hit-actor?) #t) + #t + ) + ) + ) + +;; definition for method 24 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-24 ((this guard-shot)) + (draw-beam (-> *part-id-table* 854) (-> this tail-pos) (-> this starting-dir) #f) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> this tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 855)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +;; definition for method 25 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-25 ((this guard-shot)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 850 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) (vector-length s5-1)) + (draw-beam (-> *part-id-table* 850) a1-0 s5-1 #f) + (set! (-> *part-id-table* 850 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 851) s4-0) + (launch-particles (-> *part-id-table* 852) s4-0) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000027126736 f30-0)) + (f30-1 (-> *part-id-table* 853 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 853 init-specs 4 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 853) s4-1 :origin-is-matrix #t) + (set! (-> *part-id-table* 853 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 853 init-specs 4 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 26 of type guard-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-26 ((this guard-shot)) + (let* ((s5-0 (-> this root)) + (a0-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> s5-0 trans)) 2048.0)) + (v1-1 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-1 quad) (-> s5-0 trans quad)) + (vector+! v1-1 v1-1 a0-3) + (cond + ((-> this hit-actor?) + (cond + ((logtest? (-> *part-group-id-table* 211 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 211)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 211)) + ) + ) + ) + ((logtest? (-> *part-group-id-table* 212 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 212)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-1 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 212)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type guard-shot +;; WARN: Return type mismatch int vs none. +(defmethod play-impact-sound ((this guard-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "guard-shot-fire") + ) + ((= v1-0 (projectile-options po0)) + (sound-play "guard-shot-hit") + ) + ) + ) + 0 + (none) + ) + +;; definition for function guard-shot-move +;; WARN: Return type mismatch int vs none. +(defun guard-shot-move ((arg0 guard-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 36864.0 f0-0) + (vector-normalize! s4-0 36864.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (when (logtest? (-> s5-0 status) (collide-status touch-surface)) + (if (logtest? (-> arg0 root status) (collide-status touch-actor)) + (set! (-> arg0 hit-actor?) #t) + ) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +;; definition for method 38 of type guard-shot +(defmethod made-impact? ((this guard-shot)) + (let ((v1-0 (-> this root)) + (t1-0 (new 'stack-no-clear 'collide-query)) + ) + (let ((a0-1 t1-0)) + (set! (-> a0-1 radius) (-> v1-0 root-prim prim-core world-sphere w)) + (set! (-> a0-1 collide-with) (-> v1-0 root-prim prim-core collide-with)) + (set! (-> a0-1 ignore-process0) this) + (set! (-> a0-1 ignore-process1) (ppointer->process (-> this parent))) + (set! (-> a0-1 ignore-pat) (-> v1-0 pat-ignore-mask)) + (set! (-> a0-1 action-mask) (collide-action solid)) + ) + (when (fill-and-try-snap-to-surface v1-0 (-> v1-0 transv) -6144.0 0.0 -2048.0 t1-0) + (if (logtest? (-> this root status) (collide-status touch-actor)) + (set! (-> this hit-actor?) #t) + ) + #t + ) + ) + ) + +;; definition for method 30 of type guard-shot +;; WARN: Return type mismatch int vs none. +(defmethod setup-collision! ((this guard-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 2457.6) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec + backgnd + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec + jak + bot + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-others-list + player-list + pusher + shield + ) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + 0 + (none) + ) + +;; definition for method 31 of type guard-shot +;; INFO: Used lq/sq +(defmethod init-proj-settings! ((this guard-shot)) + (set! (-> this hit-actor?) #f) + (set! (-> this tail-pos quad) (-> this root trans quad)) + (set! (-> this attack-mode) 'guard-shot) + (set! (-> this max-speed) 819200.0) + (set! (-> this move) guard-shot-move) + (set! (-> this update-velocity) projectile-update-velocity-space-wars) + (set! (-> this timeout) (seconds 0.5)) + (logior! (-> this options) (projectile-options po13)) + (set-gravity-length (-> this root dynam) 573440.0) + (none) + ) + +;; definition for function spawn-guard-projectile +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer guard-shot). +(defun spawn-guard-projectile ((arg0 process-focusable) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (if arg4 + (set! (-> gp-0 pos quad) (-> arg4 quad)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + ) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer guard-shot) (spawn-projectile guard-shot gp-0 arg0 *default-dead-pool*)) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc new file mode 100644 index 00000000000..7d4f178da8a --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/metalhead-projectile_REF.gc @@ -0,0 +1,966 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpart 863 + :init-specs ((:texture (gun-enemy-beam level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 0.25)) + (:scale-y (meters 12)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 32.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +;; failed to figure out what this is: +(defpart 864 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0) + (:b 128.0) + (:a 64.0) + (:scalevel-x (meters -0.075)) + (:scalevel-y :copy scalevel-x) + (:fade-a -1.6) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14)) + ) + ) + +;; failed to figure out what this is: +(defpart 865 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 16.0) + (:z (meters 0) (meters -2)) + (:scale-x (meters 0.5) (meters 0.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 0.5) (meters 0.5)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 64.0) + (:fade-g -3.2 -6.4) + (:fade-a -1.6 -6.4) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 866 + :init-specs ((:texture (gun-enemy-muzzleflash level-default-sprite)) + (:birth-func 'birth-func-set-quat) + (:num 1.0) + (:scale-x (meters 2)) + (:scale-y (meters 4.5)) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 128.0) + (:fade-a -3.6571429) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 left-multiply-quat)) + ) + ) + +;; failed to figure out what this is: +(defpart 867 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 64.0) + (:b 128.0) + (:a 255.0) + (:omega (degrees 4515.75)) + (:scalevel-x (meters 0.10666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -7.285714) + (:timer (seconds 0.117)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 1024.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-shot-hit + :id 214 + :duration (seconds 1) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 868 :period (seconds 2) :length (seconds 0.017)) + (sp-item 869 :fade-after (meters 100) :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 870 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 871 :flags (sp6) :period (seconds 2) :length (seconds 0.017)) + (sp-item 872 :period (seconds 2) :length (seconds 0.017)) + (sp-item 873 :fade-after (meters 50) :falloff-to (meters 50) :period (seconds 2) :length (seconds 0.017)) + ) + ) + +;; failed to figure out what this is: +(defpart 871 + :init-specs ((:texture (explosion-nebula level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-x (degrees 1.125)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 128.0) + (:b 255.0) + (:a 12.0) + (:scalevel-x (meters 0.26666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.34285715) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 4096.0) + ) + ) + +;; failed to figure out what this is: +(defpart 872 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 8.0 8.0) + (:scale-x (meters 1) (meters 0.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0 128.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:a 16.0 48.0) + (:vel-y (meters 0.013333334) (meters 0.04)) + (:scalevel-x (meters 0.0016666667) (meters 0.013333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.30476192) + (:fade-g -0.35555556) + (:fade-b -0.17777778) + (:fade-a -0.15238096) + (:accel-y (meters -0.00016666666) (meters -0.00016666666)) + (:friction 0.9) + (:timer (seconds 1.4)) + (:flags (sp-cpuinfo-flag-2)) + (:conerot-x (degrees 0) (degrees 3600)) + (:conerot-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 873 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 20.0 10.0) + (:y (meters 0.25)) + (:scale-x (meters 0.075) (meters 0.05)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 0.0 128.0) + (:b 128.0) + (:a 64.0 32.0) + (:omega (degrees 0.0225) (degrees 0.0225)) + (:vel-y (meters 0.033333335) (meters 0.1)) + (:rotvel-z (degrees -2.4) 1 (degrees 4.8)) + (:fade-g -0.85333335) + (:fade-a 0.0) + (:accel-y (meters -0.00033333333) (meters -0.0013333333)) + (:friction 0.9 0.02) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:func 'sparticle-motion-blur) + (:next-time (seconds 0.335)) + (:next-launcher 874) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 874 + :init-specs ((:fade-a -0.48 -0.48)) + ) + +;; failed to figure out what this is: +(defpart 869 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 4)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 128.0) + (:b 128.0 128.0) + (:a 128.0) + (:rotvel-z (degrees -0.1)) + (:fade-a -1.6) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata -4096.0) + (:next-launcher 875) + ) + ) + +;; failed to figure out what this is: +(defpart 875 + :init-specs ((:scale-x (meters 2) (meters 0.5)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:next-time (seconds 0.017)) + (:next-launcher 875) + ) + ) + +;; failed to figure out what this is: +(defpart 870 + :init-specs ((:texture (glow level-default-sprite)) + (:num 2.0) + (:scale-x (meters 1)) + (:rot-x (degrees 4.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 128.0 128.0) + (:a 48.0) + (:scalevel-x (meters 0.12857144)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-g -2.1333334) + (:fade-b -2.1333334) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 glow)) + (:userdata -4096.0) + (:next-time (seconds 0.067)) + (:next-launcher 876) + ) + ) + +;; failed to figure out what this is: +(defpart 876 + :init-specs ((:scale-x (meters 4.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.06666667)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.53333336) + (:fade-a -0.8) + ) + ) + +;; failed to figure out what this is: +(defpart 868 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 96.0) + (:scalevel-x (meters 0.16666667)) + (:rotvel-z (degrees 0.3)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.185)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.05)) + (:next-launcher 877) + ) + ) + +;; failed to figure out what this is: +(defpart 877 + :init-specs ((:scale-x (meters 3.5)) + (:scale-y :copy scale-x) + (:scalevel-x (meters -0.0875)) + (:scalevel-y :copy scalevel-x) + (:fade-b -6.4) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-shot-die + :id 215 + :duration (seconds 0.017) + :flags (sp0) + :bounds (static-bspherem 0 0 0 8) + :parts ((sp-item 249)) + ) + +;; failed to figure out what this is: +(defpart 878 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:scale-x (meters 2.5)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 192.0) + (:b 64.0) + (:a 16.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 819.2) + ) + ) + +;; definition of type metalhead-shot +(deftype metalhead-shot (projectile) + ((tail-pos vector :inline) + ) + ) + +;; definition for method 3 of type metalhead-shot +(defmethod inspect ((this metalhead-shot)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 this) + ) + (format #t "~2Ttail-pos: #~%" (-> this tail-pos)) + (label cfg-4) + this + ) + +;; definition for method 24 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-24 ((this metalhead-shot)) + (draw-beam (-> *part-id-table* 866) (-> this tail-pos) (-> this starting-dir) #f) + (let* ((a0-3 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> this starting-dir) 2048.0)) + (v1-2 (vector+! (new 'stack-no-clear 'vector) (-> this tail-pos) a0-3)) + (t9-2 sp-launch-particles-var) + (a0-4 *sp-particle-system-2d*) + (a1-4 (-> *part-id-table* 867)) + (a2-2 *launch-matrix*) + ) + (set! (-> a2-2 trans quad) (-> v1-2 quad)) + (t9-2 a0-4 a1-4 a2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + 0 + (none) + ) + +;; definition for method 25 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-25 ((this metalhead-shot)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let* ((gp-0 (-> this root trans)) + (a1-0 (-> this tail-pos)) + (s5-1 (vector-! (new 'stack-no-clear 'vector) gp-0 a1-0)) + (f30-0 (vector-length s5-1)) + ) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (let ((v1-4 a1-0)) + (let ((a0-2 s5-1)) + (let ((a2-1 0.8)) + (.mov vf7 a2-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-4 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> s4-0 quad) vf6) + (let ((f28-0 (-> *part-id-table* 863 init-specs 4 initial-valuef))) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) (fmin f28-0 (vector-length s5-1))) + (draw-beam (-> *part-id-table* 863) a1-0 s5-1 #f) + (set! (-> *part-id-table* 863 init-specs 4 initial-valuef) f28-0) + ) + (vector-normalize! s5-1 1.0) + (launch-particles (-> *part-id-table* 864) s4-0) + ) + (let ((s4-1 (new 'stack-no-clear 'matrix)) + (f26-0 (* 0.000020345053 f30-0)) + (f30-1 (-> *part-id-table* 865 init-specs 3 initial-valuef)) + (f28-1 (-> *part-id-table* 865 init-specs 5 initial-valuef)) + ) + (forward-up->inv-matrix s4-1 s5-1 *up-vector*) + (set! (-> s4-1 trans quad) (-> gp-0 quad)) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) (* f26-0 f30-1)) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) (* f26-0 f28-1)) + (launch-particles (-> *part-id-table* 865) s4-1 :origin-is-matrix #t) + (set! (-> *part-id-table* 865 init-specs 3 initial-valuef) f30-1) + (set! (-> *part-id-table* 865 init-specs 5 initial-valuef) f28-1) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 26 of type metalhead-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-26 ((this metalhead-shot)) + (let* ((gp-0 (-> this root)) + (a0-3 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> this tail-pos) (-> gp-0 trans)) 2048.0)) + (v1-2 (new 'stack-no-clear 'vector)) + ) + (set! (-> v1-2 quad) (-> gp-0 trans quad)) + (vector+! v1-2 v1-2 a0-3) + (cond + ((logtest? (-> *part-group-id-table* 214 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> v1-2 quad)) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 214)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> v1-2 quad)) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 214)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type metalhead-shot +;; WARN: Return type mismatch sound-id vs none. +(defmethod play-impact-sound ((this metalhead-shot) (arg0 projectile-options)) + (with-pp + (case arg0 + (((projectile-options po0 po1)) + (when (nonzero? (-> this sound-id)) + (when *sound-player-enable* + (let ((gp-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> gp-0 command) (sound-command set-param)) + (set! (-> gp-0 id) (-> this sound-id)) + (let ((a1-1 (-> this root trans))) + (let ((s5-1 pp)) + (when (= a1-1 #t) + (if (and s5-1 (type? s5-1 process-drawable) (nonzero? (-> (the-as process-drawable s5-1) root))) + (set! a1-1 (-> (the-as process-drawable s5-1) root trans)) + (set! a1-1 (the-as vector #f)) + ) + ) + ) + (sound-trans-convert (-> gp-0 params trans) a1-1) + ) + (set! (-> gp-0 params mask) (the-as uint 32)) + (-> gp-0 id) + ) + ) + ) + ) + ) + (none) + ) + ) + +;; definition for function metalhead-shot-move +;; WARN: Return type mismatch int vs none. +(defun metalhead-shot-move ((arg0 metalhead-shot)) + (projectile-move-fill-line-sphere arg0) + (let ((s5-0 (-> arg0 root))) + (let ((s4-0 (new 'stack-no-clear 'vector))) + (vector-! s4-0 (-> arg0 tail-pos) (-> s5-0 trans)) + (let ((f0-0 (vector-length s4-0))) + (when (< 49152.0 f0-0) + (vector-normalize! s4-0 49152.0) + (vector+! (-> arg0 tail-pos) (-> s5-0 trans) s4-0) + ) + ) + ) + (if (logtest? (-> s5-0 status) (collide-status touch-surface)) + (go (method-of-object arg0 impact)) + ) + ) + 0 + (none) + ) + +;; definition for method 30 of type metalhead-shot +;; WARN: Return type mismatch int vs none. +(defmethod setup-collision! ((this metalhead-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) cshape-reaction-just-move) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-yellow-shot)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec projectile)) + (set! (-> s4-0 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 819.2) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-13 prim-core collide-with) + (collide-spec backgnd jak bot crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-13 prim-core action) (collide-action solid deadly)) + (set-vector! (-> v1-13 local-sphere) 0.0 0.0 0.0 819.2) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-15 prim-core collide-with) + (collide-spec jak bot crate civilian enemy vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-15 prim-core action) (collide-action deadly)) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 2457.6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 1)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + (none) + ) + +;; definition for method 31 of type metalhead-shot +;; INFO: Used lq/sq +(defmethod init-proj-settings! ((this metalhead-shot)) + (set! (-> this tail-pos quad) (-> this root trans quad)) + (set! (-> this attack-mode) 'metalhead-shot) + (set! (-> this max-speed) 532480.0) + (set! (-> this move) metalhead-shot-move) + (set! (-> this timeout) (seconds 0.767)) + (set-gravity-length (-> this root dynam) 573440.0) + (none) + ) + +;; definition for function spawn-metalhead-projectile +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-shot). +(defun spawn-metalhead-projectile ((arg0 metalhead-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-metalhead-grenade-shot + :id 216 + :duration (seconds 0.5) + :flags (sp0) + :bounds (static-bspherem 0 0 0 4) + :parts ((sp-item 879) (sp-item 880) (sp-item 881)) + ) + +;; failed to figure out what this is: +(defpart 879 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3) (meters 1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0) + (:fade-r -5.5) + (:fade-g -51.0) + (:fade-b -5.5) + (:fade-a -8.533334) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-14 glow)) + (:userdata 409.6) + ) + ) + +;; failed to figure out what this is: +(defpart 880 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 4.0) + (:scale-x (meters 1) (meters 0.2)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 128.0) + (:scalevel-x (meters -0.01)) + (:rotvel-z (degrees -1.2) (degrees 1.2)) + (:scalevel-y :copy scalevel-x) + (:fade-r -1.375) + (:fade-g -6.375) + (:fade-b -1.375) + (:fade-a -3.2 -3.2) + (:timer (seconds 0.135)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0) (meters 0.2)) + ) + ) + +;; failed to figure out what this is: +(defpart 881 + :init-specs ((:texture (radial-gradient level-default-sprite)) + (:num 2.0 1.0) + (:scale-x (meters 0.8) (meters 0.4)) + (:scale-y (meters 0.6) (meters 0.2)) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 64.0 32.0) + (:scalevel-x (meters -0.0026666666) (meters -0.0026666666)) + (:scalevel-y :copy scalevel-x) + (:fade-r -0.73333335) + (:fade-g -3.4) + (:fade-b -0.73333335) + (:accel-y (meters -0.00033333333) (meters -0.001)) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.25)) + (:next-launcher 882) + (:conerot-x (degrees 0) (degrees 360)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0) (meters 0.35)) + ) + ) + +;; failed to figure out what this is: +(defpart 882 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b 0.0) (:fade-a -0.48 -0.48)) + ) + +;; definition of type metalhead-grenade-shot +(deftype metalhead-grenade-shot (projectile) + ((tumble-quat quaternion :inline) + (blast-radius float) + ) + ) + +;; definition for method 3 of type metalhead-grenade-shot +(defmethod inspect ((this metalhead-grenade-shot)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type projectile inspect))) + (t9-0 this) + ) + (format #t "~2Ttumble-quat: #~%" (-> this tumble-quat)) + (format #t "~2Tblast-radius: ~f~%" (-> this blast-radius)) + (label cfg-4) + this + ) + +;; definition for method 26 of type metalhead-grenade-shot +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-26 ((this metalhead-grenade-shot)) + (cond + ((logtest? (-> *part-group-id-table* 104 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) (-> this root trans quad)) + (part-tracker-spawn part-tracker-subsampler :to this :group (-> *part-group-id-table* 104)) + ) + (else + (set! (-> *launch-matrix* trans quad) (-> this root trans quad)) + (part-tracker-spawn part-tracker :to this :group (-> *part-group-id-table* 104)) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs none. +(defmethod play-impact-sound ((this metalhead-grenade-shot) (arg0 projectile-options)) + (let ((v1-0 arg0)) + (cond + ((zero? v1-0) + (sound-play "gren-launch") + ) + ((= v1-0 (projectile-options po0)) + (sound-play "gren-shot-hit") + ) + ((= v1-0 (projectile-options po0 po1)) + (sound-play-by-name + (static-sound-name "gren-missile") + (-> this sound-id) + 1024 + (the int (* 1524.0 (doppler-pitch-shift (-> this root trans) (-> this root transv)))) + 0 + (sound-group) + (-> this root trans) + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate impact (metalhead-grenade-shot) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + (the-as process-focusable s4-0) + ) + ) + ) + (when v1-1 + (let ((s4-1 (-> v1-1 root)) + (a1-3 (new 'stack 'collide-query)) + ) + 0.0 + (set! (-> a1-3 start-pos quad) (-> self root root-prim prim-core world-sphere quad)) + (vector-! (-> a1-3 move-dist) (the-as vector (-> s4-1 root-prim prim-core)) (-> a1-3 start-pos)) + (let ((v1-6 a1-3)) + (set! (-> v1-6 radius) 40.96) + (set! (-> v1-6 collide-with) (collide-spec backgnd)) + (set! (-> v1-6 ignore-process0) self) + (set! (-> v1-6 ignore-process1) (ppointer->process (-> self parent))) + (set! (-> v1-6 ignore-pat) (-> self root pat-ignore-mask)) + (set! (-> v1-6 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-3) 0.0) + (deal-damage! self proc (the-as event-message-block (-> block param 0))) + (let ((v1-11 (-> self notify-handle))) + (if (handle->process v1-11) + (send-event (-> v1-11 process 0) 'notify 'attack proc) + ) + ) + ) + ) + ) + ) + ) + ) + ) + :enter (behavior () + (let ((t9-0 (-> (method-of-type projectile impact) enter))) + (if t9-0 + (t9-0) + ) + ) + (let ((v1-5 (-> self root root-prim))) + (set! (-> v1-5 local-sphere w) (-> self blast-radius)) + (set! (-> v1-5 prim-core world-sphere w) (-> self blast-radius)) + (set! (-> v1-5 prim-core collide-with) + (collide-spec jak crate civilian enemy obstacle vehicle-sphere hit-by-others-list player-list) + ) + (set! (-> v1-5 prim-core collide-as) (collide-spec enemy)) + ) + (update-transforms (-> self root)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root) a1-0) + ) + ) + :code (behavior () + (suspend) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (while (-> self child) + (suspend) + ) + (deactivate self) + ) + ) + +;; failed to figure out what this is: +(defstate dissipate (metalhead-grenade-shot) + :virtual #t + :enter (behavior () + (go-virtual impact) + ) + ) + +;; definition for method 25 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs none. +(defmethod projectile-method-25 ((this metalhead-grenade-shot)) + (spawn (-> this part) (-> this root trans)) + 0 + (none) + ) + +;; definition for function gren-canister-move +;; WARN: Return type mismatch int vs none. +(defun gren-canister-move ((arg0 metalhead-grenade-shot)) + (quaternion*! (-> arg0 root quat) (-> arg0 root quat) (-> arg0 tumble-quat)) + (projectile-move-fill-all-dirs arg0) + (let ((s5-0 (new 'stack-no-clear 'water-info))) + (water-info-init! (-> arg0 root) s5-0 (collide-action solid semi-solid)) + (if (and (logtest? (-> s5-0 flags) (water-flag active)) (< (-> arg0 root trans y) (-> s5-0 trans y))) + (go (method-of-object arg0 impact)) + ) + ) + (if (logtest? (-> arg0 root status) (collide-status touch-surface)) + (go (method-of-object arg0 impact)) + ) + 0 + (none) + ) + +;; definition for function gren-cshape-reaction-canister +;; WARN: Return type mismatch int vs none. +(defun gren-cshape-reaction-canister ((arg0 collide-shape-moving) (arg1 metalhead-grenade-shot)) + (let ((s5-0 0)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-float*! a1-1 (the-as vector (&-> arg1 starting-dir y)) (the-as float (-> arg1 connection-list prev0))) + (move-by-vector! arg0 a1-1) + ) + (let ((f30-0 (vector-dot (-> arg0 transv) (the-as vector (&-> arg1 prev-state)))) + (s3-0 (new 'stack-no-clear 'vector)) + ) + (vector-float*! s3-0 (the-as vector (&-> arg1 prev-state)) (* f30-0 (rand-vu-float-range 1.6 2.2))) + (vector-! (-> arg0 transv) (-> arg0 transv) s3-0) + ) + (let ((v0-2 (logior s5-0 7))) + (logior! (-> arg0 status) v0-2) + ) + ) + (vector-float*! (-> arg0 transv) (-> arg0 transv) 0.88) + (none) + ) + +;; definition for method 30 of type metalhead-grenade-shot +;; WARN: Return type mismatch int vs none. +(defmethod setup-collision! ((this metalhead-grenade-shot)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) + (the-as (function control-info collide-query vector vector collide-status) gren-cshape-reaction-canister) + ) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrate-using) (penetrate enemy-dark-shot)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec projectile)) + (set! (-> v1-7 prim-core collide-with) + (collide-spec backgnd jak crate obstacle hit-by-others-list player-list pusher) + ) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 1228.8) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> s5-0 max-iteration-count) (the-as uint 2)) + (set! (-> s5-0 event-self) 'touched) + (set! (-> this root) s5-0) + ) + (set! (-> this root pat-ignore-mask) + (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noproj #x1 :noendlessfall #x1 :board #x1) + ) + (none) + ) + +;; definition for method 31 of type metalhead-grenade-shot +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-proj-settings! ((this metalhead-grenade-shot)) + (set! (-> this attack-mode) 'explode) + (set! (-> this blast-radius) 4096.0) + (set! (-> this max-speed) 135168.0) + (set! (-> this timeout) (seconds 4)) + (set! (-> this update-velocity) projectile-update-velocity-add-gravity) + (set! (-> this move) gren-canister-move) + (set! (-> this root dynam gravity y) 102400.0) + (set! (-> this root dynam gravity-length) 102400.0) + (set! (-> this root dynam gravity-max) 102400.0) + (let ((f0-5 1092.2667)) + (quaternion-axis-angle! (-> this tumble-quat) 1.0 0.0 0.0 f0-5) + ) + (set! (-> this part) (create-launch-control (-> *part-group-id-table* 216) this)) + (set! (-> this sound-id) (new-sound-id)) + (none) + ) + +;; definition for function spawn-metalhead-grenade +;; INFO: Used lq/sq +;; WARN: Return type mismatch (pointer process) vs (pointer metalhead-grenade-shot). +(defun spawn-metalhead-grenade ((arg0 metalhead-grenade-shot) (arg1 vector) (arg2 vector) (arg3 float)) + (let ((gp-0 (new 'stack-no-clear 'projectile-init-by-other-params))) + (let ((v1-1 (vector-! (new 'stack-no-clear 'vector) arg2 arg1))) + (set! (-> gp-0 ent) (-> arg0 entity)) + (set! (-> gp-0 charge) 1.0) + (set! (-> gp-0 options) (projectile-options)) + (logclear! (-> gp-0 options) (projectile-options po14 po15 po16)) + (set! (-> gp-0 notify-handle) (process->handle arg0)) + (set! (-> gp-0 owner-handle) (the-as handle #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) + (set! (-> gp-0 target-pos quad) (the-as uint128 0)) + (set! (-> gp-0 ignore-handle) (process->handle arg0)) + (let* ((a0-13 *game-info*) + (a2-12 (+ (-> a0-13 attack-id) 1)) + ) + (set! (-> a0-13 attack-id) a2-12) + (set! (-> gp-0 attack-id) a2-12) + ) + (set! (-> gp-0 timeout) (seconds 4)) + (set! (-> gp-0 pos quad) (-> arg1 quad)) + (vector-normalize-copy! (-> gp-0 vel) v1-1 arg3) + ) + (the-as (pointer metalhead-grenade-shot) (spawn-projectile metalhead-shot gp-0 arg0 *default-dead-pool*)) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/particle-curves_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/particle-curves_REF.gc new file mode 100644 index 00000000000..88ee49abb26 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/particle-curves_REF.gc @@ -0,0 +1,201 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type particle-curve-settings +(deftype particle-curve-settings (structure) + ((color-start basic) + (alpha-start basic) + (scale-x-start basic) + (scale-y-start basic) + (r-scalar basic) + (g-scalar basic) + (b-scalar basic) + (a-scalar basic) + (scale-x-scalar basic) + (scale-y-scalar basic) + (lifetime-base time-frame) + (lifetime-offset time-frame) + (flags particle-curve-flags) + ) + ) + +;; definition for method 3 of type particle-curve-settings +(defmethod inspect ((this particle-curve-settings)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'particle-curve-settings) + (format #t "~1Tcolor-start: ~A~%" (-> this color-start)) + (format #t "~1Talpha-start: ~A~%" (-> this alpha-start)) + (format #t "~1Tscale-x-start: ~A~%" (-> this scale-x-start)) + (format #t "~1Tscale-y-start: ~A~%" (-> this scale-y-start)) + (format #t "~1Tr-scalar: ~A~%" (-> this r-scalar)) + (format #t "~1Tg-scalar: ~A~%" (-> this g-scalar)) + (format #t "~1Tb-scalar: ~A~%" (-> this b-scalar)) + (format #t "~1Ta-scalar: ~A~%" (-> this a-scalar)) + (format #t "~1Tscale-x-scalar: ~A~%" (-> this scale-x-scalar)) + (format #t "~1Tscale-y-scalar: ~A~%" (-> this scale-y-scalar)) + (format #t "~1Tlifetime-base: ~D~%" (-> this lifetime-base)) + (format #t "~1Tlifetime-offset: ~D~%" (-> this lifetime-offset)) + (format #t "~1Tflags: ~D~%" (-> this flags)) + (label cfg-4) + this + ) + +;; definition for function birth-func-curve +;; INFO: function output is handled by mips2c +(def-mips2c birth-func-curve (function int sparticle-cpuinfo sparticle-launchinfo none)) + +;; definition for function live-func-curve +;; INFO: function output is handled by mips2c +(def-mips2c live-func-curve (function sparticle-system sparticle-cpuinfo vector none)) + +;; failed to figure out what this is: +(defpart 69 + :init-specs ((:texture (middot level-default-sprite)) + (:birth-func 'birth-func-curve) + (:num 1.0) + (:scale-x (meters 1)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 128.0) + (:b 128.0) + (:a 128.0) + (:vel-y (meters 0.01)) + (:timer (seconds 16.667)) + (:flags ()) + (:userdata 0.0) + (:func 'live-func-curve) + (:conerot-x (degrees -30) (degrees 60)) + (:conerot-z (degrees -30) (degrees 60)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *alpha-fast* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.25 :z -0.5 :w -1.0) + :ys (new 'static 'vector :x 1.0 :y 0.75 :z 0.5) + :one-over-x-deltas (new 'static 'vector :x -1.0 :y -1.0 :z -1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *unity-fast* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 1.0 :y 1.0 :z 2.0 :w 3.0) + :one-over-x-deltas (new 'static 'vector :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *ccro* (new 'static 'curve-color-fast + :xs (new 'static 'vector :y -0.4 :z -0.7 :w -1.0) + :ys (new 'static 'inline-array vector 4 + (new 'static 'vector :x 128.0 :w 128.0) + (new 'static 'vector :x 128.0 :y 128.0 :w 128.0) + (new 'static 'vector :x 128.0 :y 128.0 :z 128.0 :w 128.0) + (new 'static 'vector :y 128.0 :w 128.0) + ) + :one-over-x-deltas (new 'static 'vector :x 2.5 :y 3.3333335 :z 3.3333333 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *scale-curve* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.7 :w -1.0) + :ys (new 'static 'vector :x 1.0 :y 0.1 :z 0.1 :w 6.0) + :one-over-x-deltas (new 'static 'vector :x -2.9999998 :z 19.666666 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *scale-range* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 0.3 :y 0.4 :z 1.4 :w 2.4) + :one-over-x-deltas (new 'static 'vector :x 0.099999994 :y 1.0 :z 1.0000001 :w 1.0) + ) + ) + ) + +;; definition for symbol *part-function-curve-test-curve-settings*, type particle-curve-settings +(define *part-function-curve-test-curve-settings* (new 'static 'particle-curve-settings + :lifetime-base (seconds 1.5) + :lifetime-offset (seconds 1) + :flags (particle-curve-flags pcf0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 69 init-specs 12 initial-valuef) + (the-as float *part-function-curve-test-curve-settings*) + ) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* color-start) *ccro*) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* alpha-start) *unity-fast*) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* scale-x-start) *scale-range*) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* scale-y-start) #f) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* r-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* g-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* b-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* a-scalar) *alpha-fast*) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* scale-x-scalar) *scale-curve*) + +;; failed to figure out what this is: +(set! (-> *part-function-curve-test-curve-settings* scale-y-scalar) #f) + +;; definition for function ptest +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +(defun ptest () + (dotimes (gp-0 1000) + (let ((t9-0 sp-launch-particles-var) + (a0-0 *sp-particle-system-2d*) + (a1-0 (-> *part-id-table* 69)) + (a2-0 *launch-matrix*) + ) + (let ((v1-1 (-> a2-0 trans)) + (a3-0 (new 'stack-no-clear 'vector)) + ) + (set! (-> a3-0 x) 0.0) + (set! (-> a3-0 y) 40960.0) + (set! (-> a3-0 z) 0.0) + (set! (-> a3-0 w) 1.0) + (set! (-> v1-1 quad) (-> a3-0 quad)) + ) + (t9-0 a0-0 a1-0 a2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/plat_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/plat_REF.gc new file mode 100644 index 00000000000..9298619a887 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/plat_REF.gc @@ -0,0 +1,363 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type plat +(deftype plat (base-plat) + ((path-pos float) + (sound-id sound-id) + (sync sync-eased :inline) + ) + (:state-methods + plat-idle + plat-path-active + ) + (:methods + (go-initial-state (_type_) object) + ) + ) + +;; definition for method 3 of type plat +(defmethod inspect ((this plat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type base-plat inspect))) + (t9-0 this) + ) + (format #t "~2Tpath-pos: ~f~%" (-> this path-pos)) + (format #t "~2Tsound-id: ~D~%" (-> this sound-id)) + (format #t "~2Tsync: #~%" (-> this sync)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defskelgroup skel-plat plat plat-lod0-jg plat-idle-ja + ((plat-lod0-mg (meters 20)) (plat-lod1-mg (meters 40)) (plat-lod2-mg (meters 999999))) + :bounds (static-spherem 0 -0.5 0 3) + ) + +;; definition for method 31 of type plat +(defmethod get-art-group ((this plat)) + (art-group-get-by-name *level* "skel-plat" (the-as (pointer level) #f)) + ) + +;; definition for method 32 of type plat +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this plat)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid rideable)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 13107.2) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + ((method-of-object s5-0 collide-shape-method-54)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-11 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-11 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-11 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 34 of type plat +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-34 ((this plat)) + 0 + (none) + ) + +;; definition for method 33 of type plat +;; WARN: Return type mismatch int vs none. +(defmethod base-plat-method-33 ((this plat)) + 0 + (none) + ) + +;; definition for method 37 of type plat +(defmethod go-initial-state ((this plat)) + (cond + ((logtest? (-> this path flags) (path-control-flag not-found)) + (go (method-of-object this plat-idle)) + ) + ((> (-> this sync period) 0) + (go (method-of-object this plat-path-active)) + ) + (else + (go (method-of-object this plat-idle)) + ) + ) + ) + +;; failed to figure out what this is: +(defstate plat-idle (plat) + :virtual #t + :event plat-event + :trans (behavior () + (update-part-and-sfx! self) + ) + :code (behavior () + (plat-trans) + (rider-post) + (suspend) + (until #f + (when (not (-> self bouncing)) + (plat-trans) + (rider-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + (while (-> self bouncing) + (plat-trans) + (rider-post) + (suspend) + ) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate plat-path-active (plat) + :virtual #t + :event plat-event + :exit (behavior () + (sound-stop (-> self sound-id)) + ) + :trans (behavior () + (set! (-> self path-pos) (get-norm! (-> self sync) 0)) + (get-point-at-percent-along-path! (-> self path) (-> self basetrans) (-> self path-pos) 'interp) + (if (< (vector-vector-distance (-> self root trans) (ear-trans 0)) 81920.0) + (sound-play "eco-plat-hover" :id (-> self sound-id) :position (-> self root trans)) + ) + (plat-trans) + ) + :code (behavior () + (until #f + (ja-no-eval :group! (ja-group) :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + ) + #f + ) + :post plat-post + ) + +;; definition for method 11 of type plat +(defmethod init-from-entity! ((this plat) (arg0 entity-actor)) + (logior! (-> this mask) (process-mask platform)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (initialize-skeleton this (the-as skeleton-group (get-art-group this)) (the-as pair 0)) + (update-transforms (-> this root)) + (init-bounce-params! this) + (base-plat-method-33 this) + (set! (-> this fact) + (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-eco-pill-green-inc)) + ) + (let ((a1-4 (new 'stack-no-clear 'sync-info-params))) + (let ((v1-15 0)) + (if (not (logtest? (-> this fact options) (actor-option loop))) + (set! v1-15 (logior v1-15 1)) + ) + (set! (-> a1-4 sync-type) 'sync-eased) + (set! (-> a1-4 sync-flags) (the-as sync-flags v1-15)) + ) + (set! (-> a1-4 period) (the-as uint 1200)) + (set! (-> a1-4 entity) arg0) + (set! (-> a1-4 percent) 0.0) + (set! (-> a1-4 ease-in) 0.15) + (set! (-> a1-4 ease-out) 0.15) + (set! (-> a1-4 pause-in) 0.0) + (set! (-> a1-4 pause-out) 0.0) + (initialize! (-> this sync) a1-4) + ) + (set! (-> this path) (new 'process 'curve-control this 'path -1000000000.0)) + (logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text)) + (set! (-> this sound-id) (new-sound-id)) + (cond + ((logtest? (-> this path flags) (path-control-flag not-found)) + (set! (-> this path-pos) 0.0) + (base-plat-method-34 this) + (go-initial-state this) + ) + ((> (-> this sync period) 0) + (set! (-> this path-pos) (get-norm! (-> this sync) 0)) + (get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp) + (base-plat-method-34 this) + (go-initial-state this) + ) + (else + (set! (-> this path-pos) 0.0) + (get-point-at-percent-along-path! (-> this path) (-> this root trans) (-> this path-pos) 'interp) + (base-plat-method-34 this) + (go-initial-state this) + ) + ) + ) + +;; definition of type drop-plat +(deftype drop-plat (base-plat) + ((art-name string) + (anim spool-anim) + (break-anim-name string) + (safe-time time-frame) + (hit-point vector :inline) + ) + (:state-methods + idle + (fall symbol) + ) + ) + +;; definition for method 3 of type drop-plat +(defmethod inspect ((this drop-plat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type base-plat inspect))) + (t9-0 this) + ) + (format #t "~2Tart-name: ~A~%" (-> this art-name)) + (format #t "~2Tanim: ~A~%" (-> this anim)) + (format #t "~2Tbreak-anim-name: ~A~%" (-> this break-anim-name)) + (format #t "~2Tsafe-time: ~D~%" (-> this safe-time)) + (format #t "~2Thit-point: ~`vector`P~%" (-> this hit-point)) + (label cfg-4) + this + ) + +;; definition for method 7 of type drop-plat +;; WARN: Return type mismatch base-plat vs drop-plat. +(defmethod relocate ((this drop-plat) (offset int)) + (if (nonzero? (-> this break-anim-name)) + (&+! (-> this break-anim-name) offset) + ) + (let ((v1-5 (-> this anim anim-name))) + (if (and (>= (the-as int v1-5) (-> *kernel-context* relocating-min)) + (< (the-as int v1-5) (-> *kernel-context* relocating-max)) + ) + (&+! (-> this anim anim-name) offset) + ) + ) + (the-as drop-plat ((method-of-type base-plat relocate) this offset)) + ) + +;; failed to figure out what this is: +(defstate idle (drop-plat) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('touch 'attack 'bonk) + (let* ((s5-0 proc) + (a0-5 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (cond + ((and a0-5 (focus-test? (the-as process-focusable a0-5) edge-grab)) + (set! (-> self safe-time) (+ (current-time) (seconds 0.2))) + (return (the-as object #f)) + ) + ((not (time-elapsed? (-> self safe-time) (seconds 0.05))) + (return (the-as object #f)) + ) + ) + ) + (set! (-> self hit-point quad) (-> self root trans quad)) + (let ((a0-13 (if (type? proc process-focusable) + proc + ) + ) + ) + (set! (-> self hit-point quad) (-> (get-trans (the-as process-focusable a0-13) 0) quad)) + ) + (if (zero? (-> self bounce-time)) + (start-bounce! self) + ) + #f + ) + ) + ) + :trans plat-trans + :code (behavior () + (add-process *gui-control* self (gui-channel art-load) (gui-action queue) (-> self anim name) -99.0 0) + (until #f + (when (not (-> self bouncing)) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + 0 + ) + (while (-> self bouncing) + (suspend) + ) + (go-virtual fall #f) + ) + #f + ) + :post plat-post + ) + +;; failed to figure out what this is: +(defstate fall (drop-plat) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('edge-grabbed) + (if (time-elapsed? (-> self state-time) (seconds 0.5)) + (send-event proc 'end-mode 'edge-grab) + ) + ) + (('die) + (go-virtual fall #t) + ) + ) + ) + :enter (behavior ((arg0 symbol)) + (set-time! (-> self state-time)) + ) + :exit (behavior () + (ja-abort-spooled-anim (-> self anim) (the-as art-joint-anim #f) -1) + ) + :trans rider-trans + :code (behavior ((arg0 symbol)) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (let ((v1-1 (-> self root root-prim))) + (set! (-> v1-1 prim-core collide-as) (collide-spec)) + (set! (-> v1-1 prim-core collide-with) (collide-spec)) + ) + 0 + (if (not arg0) + (ja-play-spooled-anim + (-> self anim) + (ja-group) + (the-as art-joint-anim #f) + (the-as (function process-drawable symbol) false-func) + (spooler-flags) + ) + ) + (ja-channel-set! 0) + (suspend) + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + :post rider-post + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/powerups_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/powerups_REF.gc new file mode 100644 index 00000000000..7c98cf83780 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/powerups_REF.gc @@ -0,0 +1,1309 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for function cloud-track +;; INFO: Used lq/sq +;; WARN: Return type mismatch symbol vs none. +;; WARN: new jak 2 until loop case, check carefully +(defbehavior cloud-track process ((arg0 process-tree) + (arg1 process-tree) + (arg2 (function vector none)) + (arg3 time-frame) + (arg4 time-frame) + (arg5 time-frame) + ) + (change-parent self arg0) + (let ((s1-1 (process->handle arg0)) + (s2-1 (process->handle arg1)) + ) + (let ((s0-0 (current-time))) + (until (time-elapsed? s0-0 (+ arg3 arg4)) + (let ((v1-8 (or (not (handle->process s1-1)) (not (handle->process s2-1))))) + (if v1-8 + (deactivate self) + ) + ) + (let* ((f0-1 (fmax 0.0 (fmin 1.0 (/ (- (the float (- (current-time) s0-0)) (the float arg3)) (the float arg4))))) + (a0-18 (process-drawable-pair-random-point! + (the-as process-drawable (-> s1-1 process 0)) + (the-as process-drawable (-> s2-1 process 0)) + (new-stack-vector0) + f0-1 + ) + ) + ) + (arg2 a0-18) + ) + (suspend) + ) + ) + (cond + ((zero? arg5) + (until #f + (suspend) + ) + #f + ) + (else + (let ((s4-1 (current-time))) + (until (time-elapsed? s4-1 arg5) + (let ((a0-21 (process-drawable-random-point! (the-as process-drawable (-> s2-1 process 0)) (new-stack-vector0)))) + (arg2 a0-21) + ) + (suspend) + ) + ) + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defpart 784 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 64.0) + (:g 64.0) + (:b 192.0) + (:a 64.0) + (:fade-a -1.0666667) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 785 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 64.0) + (:g 64.0) + (:b 192.0) + (:a 64.0) + (:fade-a -1.0666667) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 786 + :init-specs ((:texture (common-white common)) + (:num 1.0 3.0) + (:scale-x (meters 0.5) (meters 1.5)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y (meters 0.2) (meters 0.1)) + (:r 64.0) + (:g 64.0) + (:b 128.0) + (:a 128.0) + (:fade-a -1.6) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.035)) + (:next-launcher 787) + ) + ) + +;; failed to figure out what this is: +(defpart 788 + :init-specs ((:texture (common-white common)) + (:num 0.0 3.0) + (:scale-x (meters 1.5) (meters 1.5)) + (:rot-x 4) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y (meters 0.2) (meters 0.1)) + (:r 128.0) + (:g 128.0) + (:b 255.0) + (:a 128.0) + (:fade-a -1.6) + (:timer (seconds 0.305)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.035)) + (:next-launcher 787) + ) + ) + +;; failed to figure out what this is: +(defpart 787 + :init-specs ((:r 64.0) (:g 64.0) (:fade-r -1.0) (:fade-g -0.4) (:fade-a -2.0)) + ) + +;; failed to figure out what this is: +(defpart 789 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0) + (:scale-x (meters 0.1) (meters 0.15)) + (:scale-y :copy scale-x) + (:r 32.0) + (:g 32.0 64.0) + (:b 192.0 64.0) + (:a 64.0 128.0) + (:scalevel-x (meters -0.00033333333)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.2) + (:accel-y (meters -0.000016666667)) + (:timer (seconds 1.5)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-blue-hit-ground-effect + :id 194 + :duration (seconds 0.017) + :linger-duration (seconds 1.5) + :bounds (static-bspherem 0 0 0 2) + :parts ((sp-item 790) (sp-item 791) (sp-item 792 :flags (is-3d)) (sp-item 793) (sp-item 794 :flags (is-3d))) + ) + +;; failed to figure out what this is: +(defpart 793 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 32.0) + (:y (meters 0.5)) + (:scale-x (meters 1) (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 0.0 63 1.0) + (:vel-y (meters 0.093333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-3)) + (:next-time (seconds 0.067) (seconds 0.065)) + (:next-launcher 795) + (:conerot-x (degrees 90)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 795 + :init-specs ((:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 0.0 63 1.0) + (:next-time (seconds 0.067) (seconds 0.065)) + (:next-launcher 795) + ) + ) + +;; failed to figure out what this is: +(defpart 794 + :init-specs ((:texture (splash-foam level-default-sprite)) + (:num 1.0) + (:y (meters 0.5)) + (:scale-x (meters 0)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 96.0 32.0) + (:scalevel-x (meters 0.21333334)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.4)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat)) + (:next-time (seconds 0.2)) + (:next-launcher 796) + ) + ) + +;; failed to figure out what this is: +(defpart 796 + :init-specs ((:fade-a -2.1333334)) + ) + +;; failed to figure out what this is: +(defpart 792 + :init-specs ((:texture (middot level-default-sprite)) + (:num 1.0) + (:y (meters 0.5)) + (:scale-x (meters 0)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 32.0 32.0) + (:scalevel-x (meters 0.22666667)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.7111111) + (:timer (seconds 0.3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 left-multiply-quat)) + (:next-time (seconds 0.15)) + (:next-launcher 797) + ) + ) + +;; failed to figure out what this is: +(defpart 797 + :init-specs ((:fade-a -1.4222223)) + ) + +;; failed to figure out what this is: +(defpart 790 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 32.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 16.0 32.0) + (:vel-y (meters 0.053333335) (meters 0.026666667)) + (:scalevel-x (meters 0.0033333334)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.16) + (:accel-y (meters -0.00033333333)) + (:friction 0.95) + (:timer (seconds 1)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 60) (degrees 30)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 791 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 12.0) + (:scale-x (meters 0.5) (meters 0.25)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 32.0 32.0) + (:b 192.0 63.0) + (:a 16.0 16.0) + (:vel-y (meters 0.10666667) (meters 0.053333335)) + (:scalevel-x (meters 0.0016666667)) + (:rotvel-z (degrees -0.2) (degrees 0.4)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.21333334) + (:accel-y (meters -0.00033333333)) + (:friction 0.95) + (:timer (seconds 0.5)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-x (degrees 60) (degrees 30)) + (:conerot-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 798 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 32.0 92.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 799 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 32.0 92.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 800 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 100.0 28.0) + (:g 64.0 64.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 801) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 801 + :init-specs ((:fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 802 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 0.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 803 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 92.0 32.0) + (:g 0.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 804 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 100.0 28.0) + (:g 0.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 805) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 805 + :init-specs ((:fade-r 0.0)) + ) + +;; failed to figure out what this is: +(defpart 806 + :init-specs ((:texture (starflash level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 92.0 32.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 807 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:scale-x (meters 1.5) (meters 0.4)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 92.0 32.0) + (:b 0.0) + (:a 64.0) + (:fade-a -1.0) + (:timer (seconds 0.2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.5)) + ) + ) + +;; failed to figure out what this is: +(defpart 808 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.5 2.0) + (:y (meters -0.05)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 0.0) + (:g 100.0 28.0) + (:b 0.0) + (:a 64.0 64.0) + (:vel-y (meters 0.0023333333) (meters 0.0016666667)) + (:scalevel-x (meters -0.00083333335)) + (:scalevel-y :copy scalevel-x) + (:fade-g -0.4) + (:fade-a -0.024242423) + (:accel-y (meters -0.000100000005) (meters -0.0003)) + (:friction 0.93) + (:timer (seconds 0.1) (seconds 0.697)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:next-time (seconds 0.3)) + (:next-launcher 809) + (:conerot-x (degrees 0) (degrees 180)) + (:conerot-y (degrees 0) (degrees 360)) + (:conerot-radius (meters 0.05)) + ) + ) + +;; failed to figure out what this is: +(defpart 809 + :init-specs ((:fade-g 0.0)) + ) + +;; definition for function eco-blue-glow +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defun eco-blue-glow ((arg0 vector)) + (launch-particles (-> *part-id-table* 784) arg0) + (if (rand-vu-percent? 0.5) + (launch-particles (-> *part-id-table* 786) arg0) + ) + 0 + (none) + ) + +;; definition for function target-eco-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-eco-process target () + (when (and (!= (-> self fact eco-level) 0.0) + (>= (- (-> *display* game-clock frame-counter) (-> self fact eco-pickup-time)) + (the-as time-frame (-> self fact eco-timeout)) + ) + ) + (set! (-> self fact eco-level) 0.0) + (set! (-> self fact eco-timeout) 0) + (logclear! (-> self target-flags) (target-flags tf4)) + (send-event self 'reset-collide) + (stop! (-> self sound)) + ) + (if (logtest? (game-secrets endless-dark) (-> self game secrets)) + (set! (-> self game eco-pill-dark) (-> *FACT-bank* eco-pill-dark-max-default)) + ) + (if (logtest? (game-secrets endless-light) (-> self game secrets)) + (set! (-> self game eco-pill-light) (-> *FACT-bank* eco-pill-light-max-default)) + ) + (when (and (< 0.0 (-> self fact eco-level)) + (not (focus-test? self in-head)) + (not (logtest? (-> self draw status) (draw-control-status no-draw no-draw-temp))) + (not (movie?)) + (rand-vu-percent? + (lerp-scale + 0.0 + 1.0 + (the float (- (-> self fact eco-timeout) + (the-as uint (- (-> *display* game-clock frame-counter) (-> self fact eco-pickup-time))) + ) + ) + 0.0 + 900.0 + ) + ) + ) + (case (-> self fact eco-type) + ((1) + (change-sound! (-> self sound) (static-sound-name "yel-eco-jak")) + (let ((s1-0 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-1 sp-launch-particles-var) + (s5-0 *sp-particle-system-2d*) + (s4-0 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 798 + 799 + ) + ) + ) + (s2-0 *launch-matrix*) + ) + (set! (-> s2-0 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-0)) quad) + ) + (gp-1 s5-0 s4-0 s2-0 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-2 2) + (let ((v1-58 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-1 sp-launch-particles-var) + (s4-1 *sp-particle-system-2d*) + (s3-1 (-> *part-id-table* 800)) + (s1-1 *launch-matrix*) + ) + (set! (-> s1-1 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-58)) quad) + ) + (s5-1 s4-1 s3-1 s1-1 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((2) + (target-danger-set! (-> self control danger-mode) 'eco-red) + (update-transforms (-> self control)) + (let ((a1-13 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-13 options) (overlaps-others-options)) + (set! (-> a1-13 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-13 tlist) *touching-list*) + (find-overlapping-shapes (-> self control) a1-13) + ) + (target-danger-set! (-> self control danger-mode) #f) + (update-transforms (-> self control)) + (change-sound! (-> self sound) (static-sound-name "red-eco-jak")) + (let ((s1-2 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-3 sp-launch-particles-var) + (s5-2 *sp-particle-system-2d*) + (s4-2 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 802 + 803 + ) + ) + ) + (s2-2 *launch-matrix*) + ) + (set! (-> s2-2 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-2)) quad) + ) + (gp-3 s5-2 s4-2 s2-2 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-4 2) + (let ((v1-91 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-3 sp-launch-particles-var) + (s4-3 *sp-particle-system-2d*) + (s3-3 (-> *part-id-table* 804)) + (s1-3 *launch-matrix*) + ) + (set! (-> s1-3 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-91)) quad) + ) + (s5-3 s4-3 s3-3 s1-3 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ((3) + (change-sound! (-> self sound) (static-sound-name "blue-eco-jak")) + (let ((v1-104 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (cond + ((and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (set! (-> *part-id-table* 788 init-specs 4 initial-valuef) 0.0) + (set! (-> *part-id-table* 788 init-specs 4 random-rangef) 65536.0) + ) + (else + (set! (-> *part-id-table* 788 init-specs 4 initial-valuef) 40960.0) + (set! (-> *part-id-table* 788 init-specs 4 random-rangef) 16384.0) + ) + ) + (launch-particles + (-> *part-id-table* 788) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-104)) + ) + ) + (let ((gp-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (launch-particles + (-> *part-id-table* (if (rand-vu-percent? 0.5) + 784 + 785 + ) + ) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) + ) + (if (rand-vu-percent? 0.5) + (launch-particles + (-> *part-id-table* 786) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data gp-6)) + ) + ) + ) + (let ((v1-128 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-7 sp-launch-particles-var) + (s5-7 *sp-particle-system-2d*) + (s4-7 (-> *part-id-table* 789)) + (s2-7 *launch-matrix*) + ) + (set! (-> s2-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-128)) quad) + ) + (gp-7 s5-7 s4-7 s2-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (cpad-set-buzz! (-> *cpad-list* cpads 0) 0 1 (seconds 0.1)) + ) + ((5) + (change-sound! (-> self sound) (static-sound-name "green-eco-jak")) + (let ((s1-6 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (gp-8 sp-launch-particles-var) + (s5-8 *sp-particle-system-2d*) + (s4-8 (-> *part-id-table* (if (rand-vu-percent? 0.5) + 806 + 807 + ) + ) + ) + (s2-8 *launch-matrix*) + ) + (set! (-> s2-8 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data s1-6)) quad) + ) + (gp-8 s5-8 s4-8 s2-8 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + (dotimes (gp-9 2) + (let ((v1-152 (rand-vu-int-range 3 (+ (-> self node-list length) -1))) + (s5-9 sp-launch-particles-var) + (s4-9 *sp-particle-system-2d*) + (s3-9 (-> *part-id-table* 808)) + (s1-7 *launch-matrix*) + ) + (set! (-> s1-7 trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-152)) quad) + ) + (s5-9 s4-9 s3-9 s1-7 (the-as sparticle-launch-state #f) (the-as sparticle-launch-control #f) 1.0) + ) + ) + ) + ) + (update-trans! (-> self sound) (-> self control trans)) + (update! (-> self sound)) + ) + 0 + (none) + ) + +;; definition for function target-color-effect-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-color-effect-process target () + (when (and (-> self color-effect) (time-elapsed? (-> self color-effect-start-time) (-> self color-effect-duration))) + (set! (-> self color-effect) #f) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set! (-> self draw color-emissive quad) (the-as uint128 0)) + ) + (case (-> self color-effect) + (('shock) + (let ((f0-4 (rand-vu-float-range 0.5 2.0))) + (set-vector! (-> self draw color-mult) f0-4 f0-4 (+ 0.5 f0-4) 1.0) + ) + ) + (('eco-pill-dark) + (let ((f30-0 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-0) (lerp 1.0 0.0 f30-0) (lerp 1.0 1.0 f30-0) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-0) (lerp 0.0 0.0 f30-0) (lerp 0.0 0.3 f30-0) 1.0) + ) + ) + (('eco-pill-light) + (let ((f30-1 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 5.0 f30-1) (lerp 1.0 5.0 f30-1) (lerp 1.0 5.0 f30-1) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 2.0 f30-1) (lerp 0.0 2.0 f30-1) (lerp 0.0 2.0 f30-1) 1.0) + ) + ) + (('ammo-yellow) + (let ((f30-2 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-2) (lerp 1.0 1.0 f30-2) (lerp 1.0 0.0 f30-2) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.3 f30-2) (lerp 0.0 0.0 f30-2) 1.0) + ) + ) + (('ammo-red) + (let ((f30-3 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-3) (lerp 1.0 0.6 f30-3) (lerp 1.0 0.6 f30-3) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.3 f30-3) (lerp 0.0 0.0 f30-3) (lerp 0.0 0.0 f30-3) 1.0) + ) + ) + (('ammo-blue) + (let ((f30-4 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.6 f30-4) (lerp 1.0 0.8 f30-4) (lerp 1.0 1.0 f30-4) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-4) (lerp 0.0 0.1 f30-4) (lerp 0.0 0.3 f30-4) 1.0) + ) + ) + (('ammo-dark) + (let ((f30-5 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 1.0 f30-5) (lerp 1.0 0.7 f30-5) (lerp 1.0 0.8 f30-5) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.2 f30-5) (lerp 0.0 0.0 f30-5) (lerp 0.0 0.1 f30-5) 1.0) + ) + ) + (('health 'eco-green) + (let ((f30-6 (lerp-scale + 1.0 + 0.0 + (the float (- (current-time) (-> self color-effect-start-time))) + (* 0.25 (the float (-> self color-effect-duration))) + (the float (-> self color-effect-duration)) + ) + ) + ) + (set-vector! (-> self draw color-mult) (lerp 1.0 0.5 f30-6) (lerp 1.0 1.0 f30-6) (lerp 1.0 0.5 f30-6) 1.0) + (set-vector! (-> self draw color-emissive) (lerp 0.0 0.0 f30-6) (lerp 0.0 0.5 f30-6) (lerp 0.0 0.0 f30-6) 1.0) + ) + ) + ) + 0 + (none) + ) + +;; definition for function target-update-segs +(defun target-update-segs ((arg0 process-drawable)) + (let ((f30-0 (-> *FACT-bank* health-max-default))) + (let ((s5-0 (-> *game-info* features))) + (when (!= (-> arg0 type) target) + (if (-> *setting-control* user-current beard) + (setup-masks (-> arg0 draw) 4 0) + (setup-masks (-> arg0 draw) 0 4) + ) + (setup-masks (-> arg0 draw) 32 64) + ) + (cond + ((logtest? (game-feature armor0) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 2 0) + ) + (else + (setup-masks (-> arg0 draw) 0 2) + ) + ) + (cond + ((logtest? (game-feature armor1) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 16 0) + ) + (else + (setup-masks (-> arg0 draw) 0 16) + ) + ) + (cond + ((logtest? (game-feature armor2) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 128 0) + ) + (else + (setup-masks (-> arg0 draw) 0 128) + ) + ) + (cond + ((logtest? (game-feature armor3) s5-0) + (set! f30-0 (+ 2.0 f30-0)) + (setup-masks (-> arg0 draw) 512 256) + ) + (else + (setup-masks (-> arg0 draw) 256 512) + ) + ) + ) + (if (not (-> *setting-control* user-current armor)) + (setup-masks (-> arg0 draw) 256 658) + ) + f30-0 + ) + ) + +;; definition for function target-draw-process +;; WARN: Return type mismatch int vs none. +(defbehavior target-draw-process target () + (let ((gp-0 (the-as uint (-> self game features)))) + (if (not (-> *setting-control* user-current armor)) + (set! gp-0 (logand (the-as uint #xff0fffffffffffff) (the-as game-feature gp-0))) + ) + (when (or (!= (-> self game old-features) gp-0) (not (time-elapsed? (-> self init-time) (seconds 0.5)))) + (let ((f30-0 (-> self fact health-max)) + (f0-0 (target-update-segs self)) + ) + (if (!= f30-0 f0-0) + (pickup-collectable! (-> self fact) (pickup-type health-max) (- f0-0 f30-0) (the-as handle #f)) + ) + ) + (set! (-> self game old-features) (the-as game-feature gp-0)) + ) + ) + (+! (-> self scarf-interp) (* 0.2 (- (-> self scarf-interp-targ) (-> self scarf-interp)))) + (seek! (-> self scarf-interp) (-> self scarf-interp-targ) (seconds-per-frame)) + (+! (-> self goggles-interp) (* 0.2 (- (-> self goggles-interp-targ) (-> self goggles-interp)))) + (seek! (-> self goggles-interp) (-> self goggles-interp-targ) (seconds-per-frame)) + (let ((f30-1 (-> self scarf-interp)) + (f28-0 (-> self goggles-interp)) + (f26-0 (-> self darkjak-interp)) + (f24-0 (-> self lightjak-interp)) + ) + (when (or (!= (-> self scarf-interp-old) f30-1) + (!= (-> self goggles-interp-old) f28-0) + (!= (-> self darkjak-interp-old) f26-0) + (or (!= (-> self lightjak-interp-old) f24-0) (not (time-elapsed? (-> self teleport-time) (seconds 0.6)))) + ) + (if (>= (-> self scarf-interp) 1.0) + (setup-masks (-> self draw) 64 32) + (setup-masks (-> self draw) 32 64) + ) + (cond + ((and (= f30-1 0.0) + (= f28-0 0.0) + (= f26-0 0.0) + (and (= f24-0 0.0) (not (time-elapsed? (-> self teleport-time) (seconds 0.5)))) + ) + (set! (-> self skel override 0) 0.00001) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 1.0) + (set! (-> self skel override 52) 1.0) + ) + ((and (= f30-1 0.0) (= f28-0 0.0) (= f26-0 0.0) (= f24-0 0.0)) + (set! (-> self skel override 0) 0.0) + (set! (-> self skel override 41) 0.0) + (set! (-> self scarf-interp-old) f30-1) + (set! (-> self goggles-interp-old) f28-0) + (set! (-> self darkjak-interp-old) f26-0) + (set! (-> self lightjak-interp-old) f24-0) + ) + (else + (set! (-> self skel override 0) 1.0) + (set! (-> self skel override 8) f30-1) + (set! (-> self skel override 5) f28-0) + (set! (-> self skel override 2) f26-0) + (set! (-> self skel override 6) f26-0) + (set! (-> self skel override 7) f26-0) + (set! (-> self skel override 4) f26-0) + (cond + ((!= f26-0 0.0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 2.0) + (set! (-> self skel override 52) 2.0) + ) + ((!= f24-0 0.0) + (set! (-> self skel override 41) 1.0) + (set! (-> self skel override 46) 0.0) + (set! (-> self skel override 52) 0.0) + ) + (else + (set! (-> self skel override 41) 0.0) + ) + ) + (set! (-> self scarf-interp-old) f30-1) + (set! (-> self goggles-interp-old) f28-0) + (set! (-> self darkjak-interp-old) f26-0) + (set! (-> self lightjak-interp-old) f24-0) + ) + ) + ) + ) + (when (!= (-> self cloth) (-> *setting-control* user-current cloth)) + (process-drawable-show-all-cloth self (-> *setting-control* user-current cloth)) + (set! (-> self cloth) (-> *setting-control* user-current cloth)) + ) + 0 + (none) + ) + +;; definition for function target-powerup-process +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-process target () + (target-draw-process) + (let ((gp-0 (-> self ext-anim-control))) + (when (!= (-> self ext-anim) (-> self pending-ext-anim)) + (when (not (or (= (-> gp-0 status) 'initialize) (= (-> self ext-anim) (target-anim unknown)))) + (when (joint-control-cleanup (-> self skel) (-> gp-0 heap) (the-as art-joint-anim jakb-stance-loop-ja)) + (target-gun-end-mode 'fast-exit) + (set! (-> self skel float-channels) (the-as uint 0)) + (reset (-> self skel top-anim)) + ) + (send-event (ppointer->process (-> self sidekick)) 'cleanup) + (unload-from-heap *anim-manager* (-> gp-0 heap)) + (unlink-shaders-in-heap *texture-page-dir* (-> gp-0 heap)) + ) + (case (-> self pending-ext-anim) + (((target-anim default) (target-anim board) (target-anim dark) (target-anim light)) + (set-pending-file gp-0 "jak-external" (the-as int (-> self pending-ext-anim)) (process->handle self) 0.0) + ) + (else + (set-pending-file gp-0 (the-as string #f) 0 (process->handle self) 0.0) + ) + ) + ) + (if (= (-> gp-0 status) 'active) + (set! (-> self ext-anim) (the-as target-anim (-> gp-0 load-file-part))) + (set! (-> self ext-anim) (target-anim unknown)) + ) + ) + (let ((f30-0 (-> self control collision-spheres 0 prim-core world-sphere w))) + (if (focus-test? self board) + (+! (-> self control collision-spheres 0 prim-core world-sphere w) 4096.0) + ) + (water-control-method-10 (-> self water)) + (set! (-> self control collision-spheres 0 prim-core world-sphere w) f30-0) + ) + (if (and (logtest? (-> self water flags) (water-flag under-water)) + (not (logtest? (-> self water flags) (water-flag swim-ground))) + ) + (set-time! (-> self control unknown-time-frame26)) + (set-time! (-> self control unknown-time-frame27)) + ) + (cond + ((and (= (-> self control ground-pat material) (pat-material ice)) + (and (>= (-> self control ctrl-xz-vel) 204.8) + (not (time-elapsed? (-> self control last-time-on-surface) (seconds 0.05))) + ) + ) + (let ((gp-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg RbigToe)))) + (if (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 159) gp-1) + ) + ) + (let ((gp-2 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg LbigToe)))) + (if (and (< (fabs (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) gp-2 (-> self control trans)) + ) + ) + 819.2 + ) + (rand-vu-percent? 0.5) + ) + (launch-particles :system *sp-particle-system-3d* (-> *part-id-table* 159) gp-2) + ) + ) + (let ((f0-10 (lerp-scale 0.8 1.0 (-> self control ctrl-xz-vel) 0.0 81920.0))) + (let ((v1-100 (ja-group))) + (if (not (and v1-100 (= v1-100 jakb-ice-stance-ja))) + (set! f0-10 (* 0.8 f0-10)) + ) + ) + (seek! (-> self control unknown-float45) f0-10 (seconds-per-frame)) + ) + (let ((f30-1 (-> self control unknown-float45)) + (f0-14 (lerp-scale -0.3 0.3 (-> self control ctrl-xz-vel) 0.0 81920.0)) + ) + (sound-play-by-name + (static-sound-name "ice-loop") + (-> self control unknown-sound-id04) + (the int (* 1024.0 f30-1)) + (the int (* 1524.0 f0-14)) + 0 + (sound-group) + (-> self control trans) + ) + ) + ) + ((< 0.0 (-> self control unknown-float45)) + (set! (-> self control unknown-float45) 0.0) + (let ((v1-121 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-121 command) (sound-command set-param)) + (set! (-> v1-121 id) (-> self control unknown-sound-id04)) + (set! (-> v1-121 params volume) -4) + (set! (-> v1-121 auto-time) 48) + (set! (-> v1-121 auto-from) 2) + (set! (-> v1-121 params mask) (the-as uint 17)) + (-> v1-121 id) + ) + ) + ) + (target-darkjak-process) + (target-lightjak-process) + (target-invisible-process) + (when (nonzero? (-> self fact trick-point-duration)) + (when (>= (- (-> *display* game-clock frame-counter) (-> self fact trick-point-start-time)) + (-> self fact trick-point-duration) + ) + (format #t "------------> ~,,f total points~%" (-> self fact trick-point)) + (send-event (handle->process (-> self notify)) 'notify 'trick-judge (-> self fact trick-point)) + (reset! (-> self fact) 'trick-judge) + ) + ) + (cond + ((logtest? (-> self game features) (game-feature feature0)) + (cond + ((< (current-time) (-> self fact stop-time-timeout)) + (set-setting! 'bg-a 'abs 0.3 0) + (set-setting! 'bg-r 'abs 1.0 0) + (update-rates! (-> *display* entity-clock) 0.0) + (if (zero? (mod (-> *display* base-clock integral-frame-counter) 60)) + (sound-play "stopwatch") + ) + ) + ((nonzero? (-> self fact stop-time-timeout)) + (remove-setting! 'bg-a) + (remove-setting! 'bg-r) + (update-rates! (-> *display* entity-clock) 1.0) + (set! (-> self fact stop-time-timeout) 0) + 0 + ) + ((cpad-pressed? (-> self control cpad number) r1) + (set! (-> self fact stop-time-timeout) (+ (current-time) (seconds 5))) + ) + ) + ) + ((logtest? (-> self game features) (game-feature feature2)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 1.0) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 60.0 (* 120.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 2.0 (* 120.0 (seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 2.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 2.0 (* 120.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 120.0 (seconds-per-frame))) + ) + ) + ) + ) + ((logtest? (-> self game features) (game-feature feature4)) + (when *time-of-day-fast* + (set! *time-of-day-fast* #f) + (send-event (ppointer->process *time-of-day*) 'change 'ratio 1.0) + ) + (cond + ((cpad-hold? (-> self control cpad number) r1) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 0.3 (* 30.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 0.5 (* 30.0 (seconds-per-frame))) + ) + ) + ((or (!= (-> *display* entity-clock clock-ratio) 1.0) (!= (-> *display* target-clock clock-ratio) 1.0)) + (update-rates! + (-> *display* entity-clock) + (seek (-> *display* entity-clock clock-ratio) 1.0 (* 30.0 (seconds-per-frame))) + ) + (update-rates! (-> *display* bg-clock) (-> *display* entity-clock clock-ratio)) + (update-rates! + (-> *display* target-clock) + (seek (-> *display* target-clock clock-ratio) 1.0 (* 30.0 (seconds-per-frame))) + ) + ) + ) + ) + ) + (target-eco-process) + (target-color-effect-process) + (if (logtest? (-> self target-effect) 7) + (logior! (-> self draw global-effect) (draw-control-global-effect no-textures)) + (logclear! (-> self draw global-effect) (draw-control-global-effect no-textures)) + ) + (if (logtest? (-> self target-effect) 56) + (logior! (-> self draw global-effect) (draw-control-global-effect rim-lights)) + (logclear! (-> self draw global-effect) (draw-control-global-effect rim-lights)) + ) + (logclear! (-> self focus-status) (focus-status super)) + (if (or (focus-test? self dead hit) + (or (logtest? (target-flags tf2 tinvuln1 tf5 tinvuln2 invisible) (-> self target-flags)) + (-> *setting-control* user-current ignore-target) + ) + ) + (logior! (-> self focus-status) (focus-status ignore)) + (logclear! (-> self focus-status) (focus-status ignore)) + ) + (cond + ((or (and (logtest? (-> self control mod-surface flags) (surface-flag air)) + (not (logtest? (-> self control status) (collide-status on-surface))) + ) + (and (focus-test? self board) (not (time-elapsed? (-> self board last-jump-time) (seconds 0.1)))) + ) + (logior! (-> self focus-status) (focus-status in-air)) + (if (logtest? (surface-flag super) (-> self control current-surface flags)) + (logior! (-> self focus-status) (focus-status super)) + ) + ) + (else + (logclear! (-> self focus-status) (focus-status in-air)) + ) + ) + (if (using-gun? self) + (logior! (-> self focus-status) (focus-status gun)) + (logclear! (-> self focus-status) (focus-status gun)) + ) + (if (or (logtest? (water-flag touch-water) (-> self water flags)) + (logtest? (-> self control status) (collide-status on-water)) + ) + (logior! (-> self focus-status) (focus-status touch-water)) + (logclear! (-> self focus-status) (focus-status touch-water)) + ) + (if (logtest? (-> self control status) (collide-status on-water)) + (logior! (-> self focus-status) (focus-status on-water)) + (logclear! (-> self focus-status) (focus-status on-water)) + ) + (if (and (logtest? (-> self water flags) (water-flag under-water)) + (not (logtest? (-> self water flags) (water-flag swim-ground))) + ) + (logior! (-> self focus-status) (focus-status under-water)) + (logclear! (-> self focus-status) (focus-status under-water)) + ) + (if (not (time-elapsed? (-> self gun fire-time) (seconds 0.1))) + (logior! (-> self focus-status) (focus-status shooting)) + (logclear! (-> self focus-status) (focus-status shooting)) + ) + 0 + (none) + ) + +;; definition for function target-powerup-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-powerup-effect target ((arg0 symbol)) + (case arg0 + (('eco-blue) + (let ((v1-4 (rand-vu-int-range 3 (+ (-> self node-list length) -1)))) + (eco-blue-glow (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data v1-4))) + ) + ) + ) + 0 + (none) + ) + +;; definition for function process-contact-action +;; WARN: Return type mismatch int vs none. +(defbehavior process-contact-action target ((arg0 process)) + (when (logtest? (-> *game-info* features) (game-feature feature0)) + (cond + (arg0 + (+! (-> self clock ref-count) -1) + (+! (-> arg0 clock ref-count) 1) + (set! (-> self clock) (-> arg0 clock)) + ) + (else + (+! (-> self clock ref-count) -1) + (+! (-> *display* base-clock ref-count) 1) + (set! (-> self clock) (-> *display* base-clock)) + ) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/proc-focusable-spawner_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/proc-focusable-spawner_REF.gc new file mode 100644 index 00000000000..3bd780338c4 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/proc-focusable-spawner_REF.gc @@ -0,0 +1,219 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type proc-focusable-spawn-record +(deftype proc-focusable-spawn-record (structure) + "A record of a [[process-focusable]] that was created by a spawner." + ((proc handle) + (index int16) + (dead-time time-frame) + ) + ) + +;; definition for method 3 of type proc-focusable-spawn-record +(defmethod inspect ((this proc-focusable-spawn-record)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'proc-focusable-spawn-record) + (format #t "~1Tproc: ~D~%" (-> this proc)) + (format #t "~1Tindex: ~D~%" (-> this index)) + (format #t "~1Tdead-time: ~D~%" (-> this dead-time)) + (label cfg-4) + this + ) + +;; definition of type proc-focusable-spawn-record-array +(deftype proc-focusable-spawn-record-array (inline-array-class) + ((data proc-focusable-spawn-record :inline :dynamic) + ) + ) + +;; definition for method 3 of type proc-focusable-spawn-record-array +(defmethod inspect ((this proc-focusable-spawn-record-array)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tlength: ~D~%" (-> this length)) + (format #t "~1Tallocated-length: ~D~%" (-> this allocated-length)) + (format #t "~1Tdata[0] @ #x~X~%" (-> this data)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(set! (-> proc-focusable-spawn-record-array heap-base) (the-as uint 32)) + +;; definition of type proc-focusable-spawner +(deftype proc-focusable-spawner (basic) + "A [[process-focusable]] spawner. Keeps track of spawned processes and cleans up inactive ones." + ((records proc-focusable-spawn-record-array) + (unused-list (array int8)) + ) + (:methods + (alloc-records! (_type_ int symbol) none) + (get-last-unused-handle! (_type_) handle) + (get-last-unused-val! (_type_) int) + (mark-unused! (_type_ handle) int) + (init-records! (_type_) none) + (add-unused! (_type_ int) none) + (check-inactive (_type_) symbol) + (reset-and-kill-all! (_type_) none) + ) + ) + +;; definition for method 3 of type proc-focusable-spawner +(defmethod inspect ((this proc-focusable-spawner)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Trecords: ~A~%" (-> this records)) + (format #t "~1Tunused-list: ~A~%" (-> this unused-list)) + (label cfg-4) + this + ) + +;; definition for method 9 of type proc-focusable-spawner +(defmethod alloc-records! ((this proc-focusable-spawner) (count int) (allocation symbol)) + "Allocate records and unused list." + (set! (-> this records) + ((method-of-type proc-focusable-spawn-record-array new) allocation proc-focusable-spawn-record-array count) + ) + (set! (-> this unused-list) (the-as (array int8) ((method-of-type array new) allocation array int8 count))) + (init-records! this) + (none) + ) + +;; definition for method 7 of type proc-focusable-spawner +(defmethod relocate ((this proc-focusable-spawner) (offset int)) + (if (nonzero? (-> this records)) + (&+! (-> this records) offset) + ) + (if (nonzero? (-> this unused-list)) + (&+! (-> this unused-list) offset) + ) + (call-parent-method this offset) + ) + +;; definition for method 13 of type proc-focusable-spawner +;; WARN: Return type mismatch int vs none. +(defmethod init-records! ((this proc-focusable-spawner)) + "Initialize the records list." + (dotimes (v1-0 (-> this records allocated-length)) + (set! (-> this unused-list v1-0) v1-0) + (set! (-> this records data v1-0 proc) (the-as handle #f)) + (set! (-> this records data v1-0 index) v1-0) + (set! (-> this records data v1-0 dead-time) 0) + ) + (set! (-> this unused-list length) (-> this unused-list allocated-length)) + (none) + ) + +;; definition for method 11 of type proc-focusable-spawner +(defmethod get-last-unused-val! ((this proc-focusable-spawner)) + "Get the last value in the unused list and decrement size." + (cond + ((<= (-> this unused-list length) 0) + -1 + ) + (else + (let ((v0-0 (-> this unused-list (+ (-> this unused-list length) -1)))) + (+! (-> this unused-list length) -1) + v0-0 + ) + ) + ) + ) + +;; definition for method 10 of type proc-focusable-spawner +(defmethod get-last-unused-handle! ((this proc-focusable-spawner)) + "Get the handle for the last element in the unused list and decrement the unused list size." + (local-vars (v1-6 int)) + (cond + ((<= (-> this unused-list length) 0) + (the-as handle #f) + ) + ((begin (set! v1-6 (-> this unused-list (+ (-> this unused-list length) -1))) #t) + (+! (-> this unused-list length) -1) + (-> this records data v1-6 proc) + ) + (else + (the-as handle #f) + ) + ) + ) + +;; definition for method 14 of type proc-focusable-spawner +;; WARN: Return type mismatch int vs none. +(defmethod add-unused! ((this proc-focusable-spawner) (arg0 int)) + "Add the given value to the unused list." + (set! (-> this records data arg0 dead-time) (+ (current-time) (seconds 1))) + (set! (-> this unused-list (-> this unused-list length)) arg0) + (+! (-> this unused-list length) 1) + (none) + ) + +;; definition for method 12 of type proc-focusable-spawner +(defmethod mark-unused! ((this proc-focusable-spawner) (arg0 handle)) + "Add this handle to the unused list." + (dotimes (v1-0 (-> this records length)) + (when (= (-> this records data v1-0 proc) arg0) + (add-unused! this v1-0) + (return 0) + ) + ) + (the-as int #f) + ) + +;; definition for method 15 of type proc-focusable-spawner +(defmethod check-inactive ((this proc-focusable-spawner)) + "Check for inactive processes and add them to the unused list." + (local-vars (v1-10 symbol)) + (dotimes (i (-> this records length)) + (let* ((proc (handle->process (-> this records data i proc))) + (pfoc (if (type? proc process-focusable) + proc + ) + ) + ) + (when (or (not pfoc) (focus-test? (the-as process-focusable pfoc) inactive)) + (dotimes (ii (-> this unused-list length)) + (when (= (-> this unused-list ii) i) + (set! v1-10 #t) + (goto cfg-19) + ) + ) + (set! v1-10 #f) + (label cfg-19) + (if (not v1-10) + (add-unused! this i) + ) + ) + ) + ) + #f + ) + +;; definition for method 16 of type proc-focusable-spawner +;; WARN: Return type mismatch symbol vs none. +(defmethod reset-and-kill-all! ((this proc-focusable-spawner)) + "Reset the records list and deactivate all remaining active processes." + (dotimes (s5-0 (-> this records length)) + (let ((a0-3 (handle->process (-> this records data s5-0 proc)))) + (when a0-3 + (deactivate a0-3) + (set! (-> this records data s5-0 proc) (the-as handle #f)) + ) + ) + ) + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/projectile-h_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/projectile-h_REF.gc index 63fa34ed7cd..925809a4c82 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/projectile-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/projectile-h_REF.gc @@ -35,7 +35,7 @@ (sound-id sound-id) (stop-speed meters) (invinc-time time-frame) - (desired-target uint64) + (desired-target handle) (desired-target-pos vector :inline) ) (:state-methods @@ -52,11 +52,11 @@ (play-impact-sound (_type_ projectile-options) none) (projectile-method-29 (_type_) none) (setup-collision! (_type_) none) - (projectile-method-31 (_type_) none) + (init-proj-settings! (_type_) none) (projectile-method-32 (_type_) none) (go-impact! (_type_) none) (projectile-method-34 (_type_) none) - (event-handler! (_type_ process int symbol event-message-block) object) + (proj-event-handler (_type_ process int symbol event-message-block) object) (handle-proj-hit! (_type_ process event-message-block) object) (deal-damage! (_type_ process event-message-block) symbol) (made-impact? (_type_) symbol) @@ -115,7 +115,7 @@ ((pos vector :inline) (vel vector :inline) (target-pos vector :inline) - (target-handle uint64) + (target-handle handle) (ent entity) (charge float) (attack-id uint32) diff --git a/test/decompiler/reference/jak3/engine/common-obs/projectile_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/projectile_REF.gc index 2bf48c28ae4..dec404f461f 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/projectile_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/projectile_REF.gc @@ -21,7 +21,7 @@ ) ;; definition for method 35 of type projectile -(defmethod event-handler! ((this projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) +(defmethod proj-event-handler ((this projectile) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (case arg2 (('tracked) (let ((v0-0 (the-as object (process->handle (the-as process (-> arg3 param 0)))))) @@ -41,7 +41,7 @@ ;; definition for function projectile-event-handler ;; WARN: Return type mismatch object vs projectile. (defbehavior projectile-event-handler projectile ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (the-as projectile (event-handler! self arg0 arg1 arg2 arg3)) + (the-as projectile (proj-event-handler self arg0 arg1 arg2 arg3)) ) ;; definition for method 37 of type projectile @@ -401,7 +401,7 @@ ;; definition for method 31 of type projectile ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this projectile)) +(defmethod init-proj-settings! ((this projectile)) 0 (none) ) @@ -538,7 +538,7 @@ ) (set! (-> self target-pos quad) (-> self base-target-pos quad)) (set! (-> self event-hook) projectile-event-handler) - (projectile-method-31 self) + (init-proj-settings! self) (update-transforms (-> self root)) (projectile-method-24 self) (play-impact-sound self (projectile-options)) @@ -727,7 +727,7 @@ ;; definition for method 31 of type projectile-bounce ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this projectile-bounce)) +(defmethod init-proj-settings! ((this projectile-bounce)) (set! (-> this max-speed) 450560.0) (set! (-> this timeout) (seconds 1.6)) (set! (-> this update-velocity) projectile-bounce-update-velocity) diff --git a/test/decompiler/reference/jak3/engine/common-obs/ragdoll-test_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/ragdoll-test_REF.gc new file mode 100644 index 00000000000..db55c1e6042 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/ragdoll-test_REF.gc @@ -0,0 +1,368 @@ +;;-*-Lisp-*- +(in-package goal) + +;; this file is debug only +(declare-file (debug)) + +;; failed to figure out what this is: +(defskelgroup skel-ragdoll-test wlander-male wlander-male-lod0-jg wlander-male-ragdoll-ja + ((wlander-male-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 4) + ) + +;; definition for symbol *ragdoll-test-ragdoll-setup*, type ragdoll-setup +(define *ragdoll-test-ragdoll-setup* (new 'static 'ragdoll-setup + :scale (new 'static 'vector :x 1.0 :y 1.0 :z 1.0) + :bg-collide-with (collide-spec backgnd player-list) + :joint-setup (new 'static 'boxed-array :type ragdoll-joint-setup + (new 'static 'ragdoll-joint-setup :joint-index 3 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 4 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 5 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 6 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 7 :parent-joint 4) + (new 'static 'ragdoll-joint-setup :joint-index 8 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 9 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 10 :parent-joint 4) + (new 'static 'ragdoll-joint-setup :joint-index 11 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 12 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 13 :parent-joint 3) + (new 'static 'ragdoll-joint-setup :joint-index 14 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 15 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 16 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 17 :parent-joint 13) + (new 'static 'ragdoll-joint-setup :joint-index 18 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 19 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 20 :parent-joint 2) + (new 'static 'ragdoll-joint-setup :joint-index 21 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 22 :parent-joint 12) + (new 'static 'ragdoll-joint-setup :joint-index 23 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 24 :parent-joint 12) + (new 'static 'ragdoll-joint-setup :joint-index 25 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 26 :parent-joint -1) + (new 'static 'ragdoll-joint-setup :joint-index 27 :parent-joint 16) + (new 'static 'ragdoll-joint-setup :joint-index 28 :parent-joint 19) + ) + ) + ) + +;; definition of type ragdoll-test +(deftype ragdoll-test (process-focusable) + ((ragdoll-proc handle) + ) + (:state-methods + reform + tweak + freefall-reform + freefall + idle + ) + ) + +;; definition for method 3 of type ragdoll-test +(defmethod inspect ((this ragdoll-test)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 this) + ) + (format #t "~2Tragdoll-proc: ~D~%" (-> this ragdoll-proc)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defstate reform (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (cond + ((!= *external-cam-mode* 'locked) + ) + (*target* + (set! *external-cam-mode* #f) + ) + (else + (set! *external-cam-mode* 'pad-0) + ) + ) + ) + :trans (behavior () + (ja :num! (loop!)) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (if (nonzero? *ragdoll-edit-info*) + (ragdoll-proc-method-18 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + ) + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + (let ((v1-14 (-> (the-as ragdoll-proc gp-0) ragdoll))) + (if (or (zero? v1-14) (= (-> v1-14 flex-blend) 0.0)) + (go-virtual idle) + ) + ) + ) + ) + (format *stdcon* "~%press r2 to advance single-step~%") + ) + :code sleep-code + :post transform-post + ) + +;; failed to figure out what this is: +(defstate tweak (ragdoll-test) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (let ((v1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-1 from) (process->ppointer proc)) + (set! (-> v1-1 num-params) argc) + (set! (-> v1-1 message) message) + (set! (-> v1-1 param 0) (-> block param 0)) + (set! (-> v1-1 param 1) (-> block param 1)) + (set! (-> v1-1 param 2) (-> block param 2)) + (set! (-> v1-1 param 3) (-> block param 3)) + (set! (-> v1-1 param 4) (-> block param 4)) + (set! (-> v1-1 param 5) (-> block param 5)) + (send-event-function (handle->process (-> self ragdoll-proc)) v1-1) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (ragdoll-proc-method-15 (the-as ragdoll-proc a0-1) #f (the-as vector #f) #t) + ) + ) + (vector-reset! (-> self root transv)) + ) + :exit (behavior () + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.25)) + ) + ) + (if (= *external-cam-mode* 'locked) + (set! *external-cam-mode* 'pad-0) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) 1) (cpad-pressed? 0 r3)) + (go-virtual reform) + ) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (when (nonzero? *ragdoll-edit-info*) + (ragdoll-proc-method-18 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + (if (-> (the-as ragdoll-proc gp-0) ragdoll) + (logclear! (-> (the-as ragdoll-proc gp-0) ragdoll ragdoll-flags) (ragdoll-flag rf2)) + ) + ) + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) *ragdoll-edit-info*) + ) + ) + ) + :code sleep-code + :post transform-post + ) + +;; failed to figure out what this is: +(defstate freefall-reform (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (ja :num! (loop!)) + (let ((gp-0 (handle->process (-> self ragdoll-proc)))) + (when gp-0 + (ragdoll-proc-method-17 (the-as ragdoll-proc gp-0) (the-as ragdoll-edit-info 0)) + (let ((v1-9 (-> (the-as ragdoll-proc gp-0) ragdoll))) + (if (or (zero? v1-9) (= (-> v1-9 flex-blend) 0.0)) + (go-virtual idle) + ) + ) + ) + ) + ) + :code sleep-code + :post transform-post + ) + +;; failed to figure out what this is: +(defstate freefall (ragdoll-test) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (let ((v1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-1 from) (process->ppointer proc)) + (set! (-> v1-1 num-params) argc) + (set! (-> v1-1 message) message) + (set! (-> v1-1 param 0) (-> block param 0)) + (set! (-> v1-1 param 1) (-> block param 1)) + (set! (-> v1-1 param 2) (-> block param 2)) + (set! (-> v1-1 param 3) (-> block param 3)) + (set! (-> v1-1 param 4) (-> block param 4)) + (set! (-> v1-1 param 5) (-> block param 5)) + (send-event-function (handle->process (-> self ragdoll-proc)) v1-1) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (ragdoll-proc-method-15 (the-as ragdoll-proc a0-1) #f (the-as vector #f) #t) + ) + ) + (vector-reset! (-> self root transv)) + ) + :exit (behavior () + (let ((a0-1 (handle->process (-> self ragdoll-proc)))) + (if a0-1 + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.25)) + ) + ) + ) + :trans (behavior () + (if (and (time-elapsed? (-> self state-time) 1) (cpad-pressed? 0 triangle)) + (go-virtual freefall-reform) + ) + (let ((a0-7 (handle->process (-> self ragdoll-proc)))) + (if a0-7 + (ragdoll-proc-method-17 (the-as ragdoll-proc a0-7) (the-as ragdoll-edit-info 0)) + ) + ) + (format *stdcon* "press triangle to edit ragdoll~%") + ) + :code sleep-code + :post transform-post + ) + +;; failed to figure out what this is: +(defstate idle (ragdoll-test) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + ) + :trans (behavior () + (cond + ((not (time-elapsed? (-> self state-time) 1)) + ) + (else + (format *stdcon* "up: reinit ragdoll~%") + (format *stdcon* "l2: reset position~%") + (format *stdcon* "rpush: edit ragdoll~%") + (format *stdcon* "triangle: run ragdoll~%") + (if (= (-> self node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) + (format *stdcon* "x: stop mirroring~%") + (format *stdcon* "x: mirror~%") + ) + (when (cpad-pressed? 0 up) + (let ((v1-13 (handle->process (-> self ragdoll-proc)))) + (when v1-13 + (if (nonzero? (-> (the-as ragdoll-proc v1-13) ragdoll)) + (ragdoll-setup! (-> (the-as ragdoll-proc v1-13) ragdoll) self *ragdoll-test-ragdoll-setup*) + ) + ) + ) + ) + (when (cpad-pressed? 0 l2) + (cond + ((-> self entity) + (set! (-> self root trans quad) (-> self entity trans quad)) + ) + (else + (vector-reset! (-> self root trans)) + (set! (-> self root trans y) -163840.0) + ) + ) + (quaternion-identity! (-> self root quat)) + ) + (if (cpad-pressed? 0 r3) + (go-virtual tweak) + ) + (if (cpad-pressed? 0 triangle) + (go-virtual freefall) + ) + (when (cpad-pressed? 0 x) + (cond + ((= (-> self node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) + (let ((v1-54 (-> self node-list data 2))) + (set! (-> v1-54 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint!)) + (set! (-> v1-54 param1) #f) + (set! (-> v1-54 param2) #f) + ) + ) + (else + (let ((v1-56 (-> self node-list data 2))) + (set! (-> v1-56 param0) (the-as (function cspace transformq none) cspace<-parented-matrix-joint-flip-z!)) + (set! (-> v1-56 param1) #f) + (set! (-> v1-56 param2) #f) + ) + ) + ) + ) + (set! (-> (quaternion->matrix (new 'stack-no-clear 'matrix) (-> self root quat)) trans quad) + (-> self root trans quad) + ) + ) + ) + (ja :num! (loop!)) + ) + :code sleep-code + :post transform-post + ) + +;; definition for function ragdoll-test-init-by-other +;; INFO: Used lq/sq +(defbehavior ragdoll-test-init-by-other ragdoll-test ((arg0 ragdoll-setup) (arg1 entity-actor)) + (process-entity-set! self arg1) + (let ((s5-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-6 prim-core collide-with) (collide-spec jak bot hit-by-others-list player-list)) + (set! (-> v1-6 prim-core action) (collide-action solid)) + (set! (-> v1-6 transform-index) 3) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-6) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-9 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s5-0 event-self) 'touched) + (set! (-> self root) s5-0) + ) + (set! (-> self root trans quad) (-> arg0 orient-tform quad)) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-ragdoll-test" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (logior! (-> self mask) (process-mask enemy)) + (set! (-> self ragdoll-proc) + (ppointer->handle + (process-spawn ragdoll-proc *ragdoll-test-ragdoll-setup* :name "ragdoll-proc" :to self :stack-size #x5000) + ) + ) + (go-virtual idle) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/shield-sphere_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/shield-sphere_REF.gc new file mode 100644 index 00000000000..aac69845ace --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/shield-sphere_REF.gc @@ -0,0 +1,817 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type shield-sphere-heat +(deftype shield-sphere-heat (structure) + ((current-heat-value float) + (damage-scalar float) + (last-heat-time time-frame) + (distort-handle handle) + ) + ) + +;; definition for method 3 of type shield-sphere-heat +(defmethod inspect ((this shield-sphere-heat)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'shield-sphere-heat) + (format #t "~1Tcurrent-heat-value: ~f~%" (-> this current-heat-value)) + (format #t "~1Tdamage-scalar: ~f~%" (-> this damage-scalar)) + (format #t "~1Tlast-heat-time: ~D~%" (-> this last-heat-time)) + (format #t "~1Tdistort-handle: ~D~%" (-> this distort-handle)) + (label cfg-4) + this + ) + +;; definition of type shield-sphere-toggle +(deftype shield-sphere-toggle (structure) + ((enable-time time-frame) + (disable-time time-frame) + ) + ) + +;; definition for method 3 of type shield-sphere-toggle +(defmethod inspect ((this shield-sphere-toggle)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'shield-sphere-toggle) + (format #t "~1Tenable-time: ~D~%" (-> this enable-time)) + (format #t "~1Tdisable-time: ~D~%" (-> this disable-time)) + (label cfg-4) + this + ) + +;; definition of type shield-sphere +(deftype shield-sphere (process-focusable) + ((owner handle) + (sphere-size float) + (offset-vec vector :inline) + (enabled? symbol) + (shield-type shield-type) + (track-joint int32) + (heat-info shield-sphere-heat :inline) + (toggle-info shield-sphere-toggle :inline :overlay-at (-> heat-info current-heat-value)) + (last-attack-time time-frame) + (last-attack-id uint32) + (persistent-attack-id uint32) + ) + (:state-methods + shield-enabled + shield-disabled + explode + die + ) + (:methods + (shield-sphere-method-32 (_type_) quaternion) + (shield-enabled-trans (_type_) none) + (toggle-shield (_type_ symbol) none) + (shield-post (_type_) object) + (init-and-go! (_type_) object) + (init-collision! (_type_) none) + (shield-event-handler (_type_ process int symbol event-message-block) object) + (get-attack-damage (_type_ process-focusable event-message-block) int) + (shield-touch-handler (_type_ process-focusable event-message-block) object) + (shield-attack-handler (_type_ process-focusable event-message-block) symbol) + (send-shield-attack (_type_ process-focusable touching-shapes-entry int) object) + ) + ) + +;; definition for method 3 of type shield-sphere +(defmethod inspect ((this shield-sphere)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-focusable inspect))) + (t9-0 this) + ) + (format #t "~2Towner: ~D~%" (-> this owner)) + (format #t "~2Tsphere-size: ~f~%" (-> this sphere-size)) + (format #t "~2Toffset-vec: #~%" (-> this offset-vec)) + (format #t "~2Tenabled?: ~A~%" (-> this enabled?)) + (format #t "~2Tshield-type: ~D~%" (-> this shield-type)) + (format #t "~2Ttrack-joint: ~D~%" (-> this track-joint)) + (format #t "~2Theat-info: #~%" (-> this heat-info)) + (format #t "~2Ttoggle-info: #~%" (-> this heat-info)) + (format #t "~2Tlast-attack-time: ~D~%" (-> this last-attack-time)) + (format #t "~2Tlast-attack-id: ~D~%" (-> this last-attack-id)) + (format #t "~2Tpersistent-attack-id: ~D~%" (-> this persistent-attack-id)) + (label cfg-4) + this + ) + +;; definition of type shield-sphere-spawn-params +(deftype shield-sphere-spawn-params (structure) + ((offset-vec vector :inline) + (owner handle) + (sphere-size float) + (shield-type shield-type) + (track-joint int32) + (enable-time time-frame) + (disable-time time-frame) + (shield-strength int8) + (pad int16) + ) + ) + +;; definition for method 3 of type shield-sphere-spawn-params +(defmethod inspect ((this shield-sphere-spawn-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'shield-sphere-spawn-params) + (format #t "~1Toffset-vec: #~%" (-> this offset-vec)) + (format #t "~1Towner: ~D~%" (-> this owner)) + (format #t "~1Tsphere-size: ~f~%" (-> this sphere-size)) + (format #t "~1Tshield-type: ~D~%" (-> this shield-type)) + (format #t "~1Ttrack-joint: ~D~%" (-> this track-joint)) + (format #t "~1Tenable-time: ~D~%" (-> this enable-time)) + (format #t "~1Tdisable-time: ~D~%" (-> this disable-time)) + (format #t "~1Tshield-strength: ~D~%" (-> this shield-strength)) + (format #t "~1Tpad: ~D~%" (-> this pad)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +(defskelgroup skel-shield-sphere-distort shield-sphere-distort shield-sphere-distort-lod0-jg shield-sphere-distort-idle-ja + ((shield-sphere-distort-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + ) + +;; definition of type shield-sphere-distort +(deftype shield-sphere-distort (process-drawable) + ((owner handle) + (sphere-size float) + ) + (:state-methods + inactive + distort + die + ) + ) + +;; definition for method 3 of type shield-sphere-distort +(defmethod inspect ((this shield-sphere-distort)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Towner: ~D~%" (-> this owner)) + (format #t "~2Tsphere-size: ~f~%" (-> this sphere-size)) + (label cfg-4) + this + ) + +;; definition of type shield-sphere-distort-spawn-params +(deftype shield-sphere-distort-spawn-params (structure) + ((owner handle) + (sphere-size float) + ) + ) + +;; definition for method 3 of type shield-sphere-distort-spawn-params +(defmethod inspect ((this shield-sphere-distort-spawn-params)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'shield-sphere-distort-spawn-params) + (format #t "~1Towner: ~D~%" (-> this owner)) + (format #t "~1Tsphere-size: ~f~%" (-> this sphere-size)) + (label cfg-4) + this + ) + +;; definition for function shield-sphere-distort-init-by-other +(defbehavior shield-sphere-distort-init-by-other shield-sphere-distort ((arg0 shield-sphere-distort-spawn-params)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self root) (new 'process 'trsqv)) + (initialize-skeleton + self + (the-as + skeleton-group + (art-group-get-by-name *level* "skel-shield-sphere-distort" (the-as (pointer level) #f)) + ) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> arg0 sphere-size) (-> arg0 sphere-size) (-> arg0 sphere-size) 1.0) + (go-virtual inactive) + ) + +;; failed to figure out what this is: +(defskelgroup skel-shield-sphere-explode shield-sphere-explode shield-sphere-explode-lod0-jg shield-sphere-explode-idle-ja + ((shield-sphere-explode-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 8) + ) + +;; definition for symbol *shield-sphere-exploder-params*, type joint-exploder-static-params +(define *shield-sphere-exploder-params* + (new 'static 'joint-exploder-static-params + :joints (new 'static 'boxed-array :type joint-exploder-static-joint-params + (new 'static 'joint-exploder-static-joint-params :joint-index 1 :parent-joint-index -1) + (new 'static 'joint-exploder-static-joint-params :joint-index 2 :parent-joint-index -1) + (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) + ) + :collide-spec (collide-spec backgnd) + ) + ) + +;; definition for method 36 of type shield-sphere +(defmethod init-and-go! ((this shield-sphere)) + (case (-> this shield-type) + (((shield-type shield-type-0)) + (set! (-> this heat-info current-heat-value) 0.0) + (set-time! (-> this heat-info last-heat-time)) + ) + (((shield-type shield-type-1)) + ) + ) + (let* ((v1-5 *game-info*) + (a0-4 (+ (-> v1-5 attack-id) 1)) + ) + (set! (-> v1-5 attack-id) a0-4) + (set! (-> this last-attack-id) a0-4) + ) + (let* ((v1-6 *game-info*) + (a0-6 (+ (-> v1-6 attack-id) 1)) + ) + (set! (-> v1-6 attack-id) a0-6) + (set! (-> this persistent-attack-id) a0-6) + ) + (set-vector! (-> this draw color-mult) 0.4 0.4 0.4 0.4) + (shield-enabled-trans this) + (go (method-of-object this shield-enabled)) + ) + +;; definition for method 37 of type shield-sphere +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this shield-sphere)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate mech-punch dark-punch dark-smack)) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec obstacle impenetrable-obj shield)) + (set! (-> v1-7 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-7 prim-core action) (collide-action solid deadly no-standon)) + (set-vector! (-> v1-7 local-sphere) 0.0 0.0 0.0 (* 4096.0 (-> this sphere-size))) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-7) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-10 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-10 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-10 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 33 of type shield-sphere +;; WARN: Return type mismatch object vs none. +(defmethod shield-enabled-trans ((this shield-sphere)) + (if (= (-> this shield-type) (shield-type shield-type-0)) + (seek! (-> this heat-info current-heat-value) 0.0 (* 0.2 (seconds-per-frame))) + ) + (let* ((s4-0 (handle->process (-> this owner))) + (s5-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (cond + (s5-0 + (if (!= (-> this track-joint) -1) + (vector<-cspace! + (-> this root trans) + (-> (the-as process-focusable s5-0) node-list data (-> this track-joint)) + ) + (vector+! (-> this root trans) (get-trans (the-as process-focusable s5-0) 0) (-> this offset-vec)) + ) + (shield-sphere-method-32 this) + (send-event s5-0 'go-invulnerable) + ) + (else + (go (method-of-object this die)) + ) + ) + ) + (none) + ) + +;; definition for method 34 of type shield-sphere +;; WARN: Return type mismatch int vs none. +(defmethod toggle-shield ((this shield-sphere) (arg0 symbol)) + (cond + (arg0 + (let ((v1-1 (-> this root root-prim))) + (set! (-> v1-1 prim-core collide-as) (-> this root backup-collide-as)) + (set! (-> v1-1 prim-core collide-with) (-> this root backup-collide-with)) + ) + ) + (else + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + ) + ) + (let* ((s4-0 (handle->process (-> this owner))) + (a0-9 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (cond + (arg0 + (logior! (-> this draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> this draw status) (draw-control-status no-draw)) + (send-event a0-9 'go-vulnerable) + ) + ) + ) + (set! (-> this enabled?) arg0) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate shield-enabled (shield-sphere) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #t) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (shield-enabled-trans self) + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self toggle-info enable-time)) + ) + (go-virtual shield-disabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +;; failed to figure out what this is: +(defstate shield-disabled (shield-sphere) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (shield-event-handler self proc argc message block) + ) + :enter (behavior () + (toggle-shield self #f) + (set-time! (-> self state-time)) + ) + :trans (behavior () + (if (and (= (-> self shield-type) (shield-type shield-type-1)) + (time-elapsed? (-> self state-time) (-> self heat-info last-heat-time)) + ) + (go-virtual shield-enabled) + ) + ) + :code sleep-code + :post (behavior () + (shield-post self) + ) + ) + +;; failed to figure out what this is: +(defstate explode (shield-sphere) + :virtual #t + :enter (behavior () + (set-time! (-> self state-time)) + (toggle-shield self #f) + (let ((a0-2 (handle->process (-> self heat-info distort-handle)))) + (if a0-2 + (send-event a0-2 'die) + ) + ) + (let ((gp-0 (new 'stack 'joint-exploder-tuning (the-as uint 0)))) + (set! (-> gp-0 rot-speed) 20.0) + (process-spawn + joint-exploder + (art-group-get-by-name *level* "skel-shield-sphere-explode" (the-as (pointer level) #f)) + 2 + gp-0 + *shield-sphere-exploder-params* + :name "joint-exploder" + :to self + :unk 0 + ) + ) + ) + :code (behavior () + (while (-> self child) + (suspend) + ) + (go-virtual die) + ) + :post (behavior () + (shield-post self) + ) + ) + +;; failed to figure out what this is: +(defstate die (shield-sphere) + :virtual #t + :enter (behavior () + '() + ) + :code (behavior () + '() + ) + ) + +;; definition for method 35 of type shield-sphere +;; WARN: Return type mismatch int vs object. +(defmethod shield-post ((this shield-sphere)) + (cond + ((not (-> this enabled?)) + (logior! (-> this draw status) (draw-control-status no-draw)) + (return (the-as object 0)) + ) + (else + (logclear! (-> this draw status) (draw-control-status no-draw)) + ) + ) + (let ((f0-0 (calc-fade-from-fog (-> this root trans)))) + (case (-> this shield-type) + (((shield-type shield-type-0)) + (+ 0.4 (* 0.6 (-> this heat-info current-heat-value))) + (let ((a1-0 (new 'stack-no-clear 'vector))) + (set-vector! a1-0 0.4 0.4 0.4 0.4) + (vector-lerp! (-> this draw color-mult) a1-0 *zero-vector* (-> this heat-info current-heat-value)) + ) + (set-vector! + (-> this draw color-emissive) + (-> this heat-info current-heat-value) + 0.0 + 0.0 + (-> this heat-info current-heat-value) + ) + ) + (((shield-type shield-type-1)) + (set-vector! (-> this draw color-mult) 0.4 0.4 0.4 (* 0.4 f0-0)) + (set-vector! (-> this draw color-emissive) 0.0 0.0 0.0 0.0) + ) + ) + ) + (transform-post) + ) + +;; failed to figure out what this is: +(defskelgroup skel-shield-sphere shield-sphere shield-sphere-lod0-jg shield-sphere-idle-ja + ((shield-sphere-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 1.5) + ) + +;; definition for function shield-sphere-init-by-other +;; INFO: Used lq/sq +(defbehavior shield-sphere-init-by-other shield-sphere ((arg0 shield-sphere-spawn-params)) + (stack-size-set! (-> self main-thread) 128) + (logclear! (-> self mask) (process-mask enemy)) + (set! (-> self sphere-size) (-> arg0 sphere-size)) + (set! (-> self owner) (-> arg0 owner)) + (set! (-> self track-joint) (-> arg0 track-joint)) + (set! (-> self offset-vec quad) (-> arg0 offset-vec quad)) + (init-collision! self) + (initialize-skeleton + self + (the-as skeleton-group (art-group-get-by-name *level* "skel-shield-sphere" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (set-vector! (-> self root scale) (-> self sphere-size) (-> self sphere-size) (-> self sphere-size) 1.0) + (set! (-> self shield-type) (-> arg0 shield-type)) + (case (-> self shield-type) + (((shield-type shield-type-0)) + (set! (-> self heat-info damage-scalar) (/ 1.0 (the float (-> arg0 shield-strength)))) + (let ((gp-1 (new 'stack-no-clear 'shield-sphere-distort-spawn-params))) + (set! (-> gp-1 owner) (process->handle self)) + (set! (-> gp-1 sphere-size) (-> self sphere-size)) + (let ((s5-1 (the-as process #f))) + (let* ((s4-1 (get-process *default-dead-pool* shield-sphere-distort #x4000 1)) + (v1-22 (when s4-1 + (let ((t9-5 (method-of-type process activate))) + (t9-5 s4-1 self "process" (the-as pointer #x70004000)) + ) + (run-now-in-process s4-1 shield-sphere-distort-init-by-other gp-1) + (-> s4-1 ppointer) + ) + ) + ) + (if v1-22 + (set! s5-1 (-> v1-22 0)) + ) + ) + (set! (-> self heat-info distort-handle) (process->handle s5-1)) + ) + ) + ) + (((shield-type shield-type-1)) + (set! (-> self toggle-info enable-time) (-> arg0 enable-time)) + (set! (-> self heat-info last-heat-time) (-> arg0 disable-time)) + ) + ) + (ja-no-eval :group! (ja-group) :num! (loop!) :frame-num 0.0) + (ja-post) + (logior! (-> self draw status) (draw-control-status disable-fog)) + (set! (-> self event-hook) (-> (method-of-type shield-sphere shield-enabled) event)) + (init-and-go! self) + ) + +;; definition for method 32 of type shield-sphere +(defmethod shield-sphere-method-32 ((this shield-sphere)) + (forward-up-nopitch->quaternion + (-> this root quat) + (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (camera-pos) (-> this root trans)) 1.0) + *y-vector* + ) + ) + +;; definition for method 27 of type shield-sphere +(defmethod get-inv-mass ((this shield-sphere)) + 2.0 + ) + +;; definition for method 38 of type shield-sphere +(defmethod shield-event-handler ((this shield-sphere) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('shield-detach) + (go (method-of-object this die)) + #t + ) + (('active) + #t + ) + (('heat-ratio) + (-> this heat-info current-heat-value) + ) + (('notice) + (case (-> arg3 param 0) + (('die) + (go (method-of-object this die)) + #t + ) + (else + #f + ) + ) + ) + (('enabled) + (go (method-of-object this shield-enabled)) + ) + (('disabled) + (go (method-of-object this shield-disabled)) + ) + (('touch) + (shield-touch-handler this (the-as process-focusable arg0) arg3) + ) + (('attack) + (shield-attack-handler this (the-as process-focusable arg0) arg3) + ) + (('impact-impulse) + (let ((v1-12 (the-as object (-> arg3 param 0)))) + (when (< 40960.0 (* (-> (the-as rigid-body-impact v1-12) impulse) (get-inv-mass this))) + (logior! (-> this root penetrated-by) (penetrate vehicle)) + (go (method-of-object this explode)) + #t + ) + ) + ) + ) + ) + +;; definition for method 39 of type shield-sphere +;; WARN: Return type mismatch number vs int. +(defmethod get-attack-damage ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let ((v1-0 (the-as object (-> arg1 param 1)))) + (the-as int (cond + ((logtest? (attack-mask damage) (-> (the-as attack-info v1-0) mask)) + (the int (-> (the-as attack-info v1-0) damage)) + ) + (else + (let ((a0-4 (get-penetrate-using-from-attack-event arg0 arg1))) + (if (and (logtest? a0-4 (penetrate board)) (logtest? a0-4 (penetrate spin))) + 10000 + (penetrate-using->damage a0-4) + ) + ) + ) + ) + ) + ) + ) + +;; definition for method 40 of type shield-sphere +(defmethod shield-touch-handler ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let* ((s5-0 (-> arg1 param 0)) + (s2-0 arg0) + (s3-0 (if (type? s2-0 process-focusable) + s2-0 + ) + ) + ) + (when (and s5-0 s3-0) + (cond + ((and (and s3-0 (not (logtest? (-> s3-0 focus-status) (focus-status disable dead ignore grabbed)))) + ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s5-0) + (-> this root) + (collide-action deadly) + (collide-action) + ) + ) + (let ((a3-1 (-> this persistent-attack-id))) + (send-shield-attack this arg0 (the-as touching-shapes-entry s5-0) (the-as int a3-1)) + ) + ) + ((and ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry s5-0) + (-> this root) + (collide-action no-standon) + (collide-action) + ) + (not (logtest? (-> this root penetrated-by) (-> s3-0 root penetrate-using))) + ) + (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s5-0) 0.0 10240.0 24576.0) + ) + ) + ) + ) + ) + +;; definition for method 41 of type shield-sphere +(defmethod shield-attack-handler ((this shield-sphere) (arg0 process-focusable) (arg1 event-message-block)) + (let ((s5-0 (-> arg1 param 0)) + (v1-0 (the-as object (-> arg1 param 1))) + ) + (cond + ((and (and (-> this next-state) (= (-> this next-state name) 'shield-enabled)) + (and (= (-> this shield-type) (shield-type shield-type-0)) + (or (!= (-> (the-as attack-info v1-0) id) (-> this last-attack-id)) + (time-elapsed? (-> this last-attack-time) (seconds 1)) + ) + ) + ) + (set! (-> this last-attack-id) (-> (the-as attack-info v1-0) id)) + (set-time! (-> this last-attack-time)) + (let* ((v1-5 (get-attack-damage this arg0 arg1)) + (f30-0 (* (-> this heat-info damage-scalar) (the float v1-5))) + ) + (when (> v1-5 0) + (if (< (+ f30-0 (-> this heat-info current-heat-value)) 1.0) + (set! f30-0 (fmin f30-0 (* 0.0027777778 (the float (- (current-time) (-> this heat-info last-heat-time)))))) + ) + (set-time! (-> this heat-info last-heat-time)) + (let ((a0-14 (handle->process (-> this heat-info distort-handle)))) + (if a0-14 + (send-event a0-14 'distort) + ) + ) + (sound-play "dpbiped-shld-df") + (+! (-> this heat-info current-heat-value) f30-0) + (if (< 1.0 (-> this heat-info current-heat-value)) + (go (method-of-object this explode)) + ) + ) + ) + (if (not (send-shield-attack this arg0 (the-as touching-shapes-entry s5-0) (the-as int (-> this persistent-attack-id))) + ) + (send-shoves (-> this root) arg0 (the-as touching-shapes-entry s5-0) 0.0 12288.0 32768.0) + ) + #t + ) + (else + #f + ) + ) + ) + ) + +;; definition for method 42 of type shield-sphere +(defmethod send-shield-attack ((this shield-sphere) (arg0 process-focusable) (arg1 touching-shapes-entry) (arg2 int)) + (let ((t0-0 0)) + (send-event + arg0 + 'attack + arg1 + (static-attack-info :mask (vehicle-impulse-factor) ((id (the-as uint arg2)) + (damage (the float t0-0)) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 4)) + (shove-up (meters 3)) + (mode 'generic) + ) + ) + ) + ) + ) + +;; failed to figure out what this is: +(defstate die (shield-sphere-distort) + :virtual #t + :code (behavior () + '() + ) + ) + +;; failed to figure out what this is: +(defstate distort (shield-sphere-distort) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('die) + (go-virtual die) + ) + (('distort) + (let ((f0-0 (ja-frame-num 0))) + (if (< 5.0 f0-0) + (go-virtual distort) + ) + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + :trans (behavior () + (let ((v1-1 (handle->process (-> self owner)))) + (when v1-1 + (set! (-> self root trans quad) (-> (the-as process-drawable v1-1) root trans quad)) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable v1-1) root quat)) + ) + ) + ) + :code (behavior () + (ja-channel-push! 1 0) + (ja-no-eval :group! shield-sphere-distort-idle-ja :num! (seek!) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (go-virtual inactive) + ) + :post (behavior () + (ja-post) + ) + ) + +;; failed to figure out what this is: +(defstate inactive (shield-sphere-distort) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('distort) + (go-virtual distort) + ) + (('die) + (go-virtual die) + ) + ) + ) + :enter (behavior () + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + :code sleep-code + ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/vent_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/vent_REF.gc index cc4c0b1b0e7..53668e36bf7 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/vent_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/vent_REF.gc @@ -235,98 +235,35 @@ (cond ((logtest? (-> self collect-effect flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> v1-9 root-prim prim-core world-sphere quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-3 (method-of-type part-tracker-subsampler activate))) - (t9-3 (the-as part-tracker-subsampler s5-2) gp-0 "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-4 run-function-in-process) - (a0-13 s5-2) - (a1-10 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> self collect-effect)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-4) a0-13 a1-10 *part-tracker-subsampler-params-default*) - ) - (-> s5-2 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to gp-0 + :group (-> self collect-effect) + :callback part-tracker-track-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> v1-9 root-prim prim-core world-sphere quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker s5-3) gp-0 "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-18 s5-3) - (a1-13 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self collect-effect)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-track-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-7) a0-18 a1-13 *part-tracker-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to gp-0 :group (-> self collect-effect) :callback part-tracker-track-target) ) ) (cond ((logtest? (-> self collect-effect2 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root root-prim prim-core world-sphere quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-9 (method-of-type part-tracker-subsampler activate))) - (t9-9 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-10 run-function-in-process) - (a0-25 gp-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> self collect-effect2)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) part-tracker-move-to-target) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-10) a0-25 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> self collect-effect2) + :callback part-tracker-move-to-target ) ) (else (set! (-> *launch-matrix* trans quad) (-> self root root-prim prim-core world-sphere quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-12 (method-of-type part-tracker activate))) - (t9-12 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-32 gp-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> self collect-effect2)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) part-tracker-move-to-target) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-13) a0-32 a1-19 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (part-tracker-spawn + part-tracker + :to self + :group (-> self collect-effect2) + :callback part-tracker-move-to-target ) ) ) diff --git a/test/decompiler/reference/jak3/engine/common-obs/warp-gate_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/warp-gate_REF.gc new file mode 100644 index 00000000000..553b0407afa --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/warp-gate_REF.gc @@ -0,0 +1,2035 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defpartgroup group-warpgate + :id 202 + :duration (seconds 0.267) + :flags (sp0 sp6) + :bounds (static-bspherem 0 0 0 8) + :rotate ((degrees 90) (degrees 0) (degrees 0)) + :parts ((sp-item 825 :flags (is-3d sp3 sp7)) (sp-item 826 :flags (sp3)) (sp-item 827 :flags (sp7))) + ) + +;; failed to figure out what this is: +(defpart 825 + :init-specs ((:texture (middot level-default-sprite)) + (:num 1.0) + (:scale-x (meters 4.75)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 196.0) + (:fade-a -3.1875) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-2)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 826 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:scale-x (meters 14)) + (:rot-x (degrees 11.25)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 48.0) + (:fade-a -0.8) + (:timer (seconds 0.267)) + (:flags (glow)) + (:userdata 4096.0) + ) + ) + +;; failed to figure out what this is: +(defpart 827 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 16.0) + (:x (meters 0) (meters 2)) + (:scale-x (meters 0.1) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 255.0) + (:b 255.0) + (:a 255.0) + (:scalevel-x (meters -0.0025)) + (:scalevel-y :copy scalevel-x) + (:timer (seconds 0.267)) + (:flags (sp-cpuinfo-flag-0 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-airtrain-dust-plume :id 203 :bounds (static-bspherem 0 0 0 15) :parts ((sp-item 828))) + +;; failed to figure out what this is: +(defpart 828 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 1.0) + (:x (meters 0) (meters 10)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 128.0) + (:g 106.0 16.0) + (:b 64.0 32.0) + (:a 16.0 32.0) + (:vel-x (meters 0.033333335) (meters 0.033333335)) + (:scalevel-x (meters 0.033333335) (meters 0.006666667)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.04 -0.08) + (:accel-y (meters 0.00033333333)) + (:friction 0.95 0.03) + (:timer (seconds 4.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-airtrain-dust-hover :id 204 :bounds (static-bspherem 0 0 0 15) :parts ((sp-item 829))) + +;; failed to figure out what this is: +(defpart 829 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0) + (:x (meters 0) (meters 5)) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 128.0) + (:g 106.0 16.0) + (:b 64.0 32.0) + (:a 16.0 16.0) + (:vel-x (meters 0.033333335) (meters 0.033333335)) + (:scalevel-x (meters 0.016666668) (meters 0.006666667)) + (:rotvel-z (degrees -0.3) (degrees 0.6)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.04 -0.08) + (:accel-y (meters 0.00033333333)) + (:friction 0.95 0.03) + (:timer (seconds 4.335)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-airtrain-thruster + :id 205 + :linger-duration (seconds 2) + :flags (sp4 sp6) + :bounds (static-bspherem 0 0 0 12) + :rotate ((degrees 180) (degrees 0) (degrees 0)) + :parts ((sp-item 830 :flags (sp6 sp7)) + (sp-item 831 :flags (sp6 sp7)) + (sp-item 832 :flags (sp7)) + (sp-item 833 :flags (sp7)) + (sp-item 834 :flags (sp7)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-airtrain-thruster-off + :id 206 + :linger-duration (seconds 2) + :flags (sp4 sp6) + :bounds (static-bspherem 0 0 0 12) + :rotate ((degrees 180) (degrees 0) (degrees 0)) + :parts ((sp-item 834 :fade-after (meters 120) :falloff-to (meters 90) :flags (sp7)) + (sp-item 835 :fade-after (meters 120) :falloff-to (meters 90) :flags (sp7)) + (sp-item 836 :flags (sp6 sp7)) + ) + ) + +;; failed to figure out what this is: +(defpart 830 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 1) (meters 0.4)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 64.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 831 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 4.8) (meters 0.6)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 64.0 128.0) + (:b 0.0) + (:a 16.0 2.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 832 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 2.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 196.0) + (:g 128.0 64.0) + (:b :copy g) + (:a 16.0 16.0) + (:vel-x (meters -0.006666667) (meters 0.013333334)) + (:vel-y (meters -0.05) (meters -0.1)) + (:vel-z (meters -0.006666667) (meters 0.013333334)) + (:scalevel-x (meters 0.053333335) (meters 0.053333335)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.21333334 -0.42666668) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94 0.04) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 835 + :init-specs ((:texture (bigpuff level-default-sprite)) + (:num 1.0 2.0) + (:scale-x (meters 1) (meters 1)) + (:rot-z (degrees 0) (degrees 3600)) + (:scale-y (meters 1) (meters 1)) + (:r 196.0) + (:g 128.0 64.0) + (:b :copy g) + (:a 10.0 4.0) + (:vel-x (meters -0.006666667) (meters 0.013333334)) + (:vel-y (meters -0.05) (meters -0.1)) + (:vel-z (meters -0.006666667) (meters 0.013333334)) + (:scalevel-x (meters 0.053333335) (meters 0.053333335)) + (:rotvel-z (degrees -1.2) (degrees 2.4)) + (:scalevel-y :copy scalevel-x) + (:fade-r 0.0) + (:fade-g 0.0) + (:fade-b 0.0) + (:fade-a -0.21333334 -0.42666668) + (:accel-y (meters 0.00016666666) (meters 0.0005)) + (:friction 0.94 0.04) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 836 + :init-specs ((:texture (glow level-default-sprite)) + (:num 1.0) + (:y (meters 0.1)) + (:scale-x (meters 1.4) (meters 0.1)) + (:rot-x (degrees 2.25)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 48.0 32.0) + (:b 0.0) + (:a 48.0 8.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 glow)) + (:userdata 409.6) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 833 + :init-specs ((:texture (hotdot level-default-sprite)) + (:num 0.0 1.0) + (:x (meters 0) (meters 0.5)) + (:scale-x (meters 0.2) (meters 0.1)) + (:scale-y :copy scale-x) + (:r 192.0 64.0) + (:g 128.0) + (:b 0.0) + (:a 128.0) + (:omega (degrees 0.0675) (degrees 0.0225)) + (:vel-x (meters -0.013333334) (meters 0.026666667)) + (:vel-y (meters -0.1) (meters -0.06666667)) + (:vel-z (meters -0.013333334) (meters 0.026666667)) + (:fade-g -1.0) + (:fade-a -2.56) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.96 0.02) + (:timer (seconds 0.085) (seconds 0.08)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3 sp-cpuinfo-flag-13 sp-cpuinfo-flag-14)) + (:func 'sparticle-motion-blur) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(defpart 834 + :init-specs ((:num 0.4) + (:rot-x 8) + (:r 1638.4) + (:g 1331.2) + (:b 1433.6) + (:vel-y (meters -0.05) (meters -0.016666668)) + (:fade-r 32.768) + (:fade-g 28.671999) + (:fade-b 26.623999) + (:accel-x (meters 0) (meters 0.0016666667)) + (:friction 0.94) + (:timer (seconds 0.335)) + (:flags (distort)) + (:next-time (seconds 0.167)) + (:next-launcher 837) + (:rotate-y (degrees 0) (degrees 360)) + ) + ) + +;; failed to figure out what this is: +(defpart 837 + :init-specs ((:fade-r 0.0) (:fade-g 0.0) (:fade-b -4.096)) + ) + +;; failed to figure out what this is: +(defpartgroup group-warp-hellcat-thruster + :id 207 + :duration (seconds 3) + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 32) + :parts ((sp-item 838 :flags (is-3d sp7)) + (sp-item 839 :flags (is-3d sp7)) + (sp-item 840 :flags (sp7)) + (sp-item 841 :flags (is-3d sp7)) + (sp-item 842 :flags (is-3d sp7)) + (sp-item 843 :flags (sp7)) + ) + ) + +;; failed to figure out what this is: +(defpart 838 + :init-specs ((:texture (mech-flame lprecurc-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 839 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:rot-z (degrees 90)) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 840 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:x (meters 1.45)) + (:y (meters 1.1)) + (:z (meters -4.75)) + (:scale-x (meters 1.75)) + (:rot-x (degrees 0.5625)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 16.0 4.0) + (:rotvel-z (degrees 0.3)) + (:timer (seconds 0.017)) + (:flags (glow)) + (:userdata 2048.0) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 841 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 842 + :init-specs ((:texture (gun-yellow-muzzleflash level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -5.15)) + (:scale-x (meters 0.6)) + (:rot-x 4) + (:rot-z (degrees 90)) + (:scale-y (meters 2)) + (:r 128.0 128.0) + (:g 32.0 96.0) + (:b :copy g) + (:a 128.0 64.0) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 843 + :init-specs ((:texture (glow-soft level-default-sprite)) + (:num 1.0) + (:x (meters -1.45)) + (:y (meters 1.1)) + (:z (meters -4.75)) + (:scale-x (meters 1.75)) + (:rot-x (degrees 0.5625)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 0.0 64.0) + (:b 0.0) + (:a 16.0 4.0) + (:rotvel-z (degrees 0.3)) + (:timer (seconds 0.017)) + (:flags (glow)) + (:userdata 2048.0) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defskelgroup skel-warp-gate warp-gate warp-gate-lod0-jg warp-gate-idle-ja + ((warp-gate-lod0-mg (meters 999999))) + :bounds (static-spherem 0 3 0 4) + :shadow-joint-index 3 + ) + +;; definition of type warp-gate +(deftype warp-gate (process-drawable) + ((root collide-shape :override) + (level-name symbol) + (on-notice pair) + (on-activate pair) + (on-close pair) + (wait-for pair) + (continue continue-point) + (distance meters) + (anim-speed float) + (test-time time-frame) + (center vector :inline) + ) + (:state-methods + idle + (use continue-point) + hidden + ) + (:methods + (init-skel-and-collide! (_type_) none) + (init-defaults! (_type_) none) + (eval-on-notice (_type_) continue-point) + ) + ) + +;; definition for method 3 of type warp-gate +(defmethod inspect ((this warp-gate)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Tlevel-name: ~A~%" (-> this level-name)) + (format #t "~2Ton-notice: ~A~%" (-> this on-notice)) + (format #t "~2Ton-activate: ~A~%" (-> this on-activate)) + (format #t "~2Ton-close: ~A~%" (-> this on-close)) + (format #t "~2Twait-for: ~A~%" (-> this wait-for)) + (format #t "~2Tcontinue: ~A~%" (-> this continue)) + (format #t "~2Tdistance: (meters ~m)~%" (-> this distance)) + (format #t "~2Tanim-speed: ~f~%" (-> this anim-speed)) + (format #t "~2Ttest-time: ~D~%" (-> this test-time)) + (format #t "~2Tcenter: ~`vector`P~%" (-> this center)) + (label cfg-4) + this + ) + +;; definition for method 25 of type warp-gate +(defmethod eval-on-notice ((this warp-gate)) + (let ((s5-0 (script-eval (-> this on-notice)))) + (cond + ((= s5-0 'hide) + (logior! (-> this draw status) (draw-control-status no-draw)) + (set! (-> this continue) #f) + ) + (s5-0 + (logclear! (-> this draw status) (draw-control-status no-draw)) + (set! (-> this continue) (get-continue-by-name *game-info* (the-as string (car s5-0)))) + (set! (-> this on-activate) (the-as pair (car (cdr s5-0)))) + (set! (-> this wait-for) (the-as pair (car (cdr (cdr s5-0))))) + (set! (-> this on-close) (the-as pair (car (cdr (cdr (cdr s5-0)))))) + ) + (else + (set! (-> this continue) #f) + ) + ) + ) + (-> this continue) + ) + +;; failed to figure out what this is: +(defstate hidden (warp-gate) + :virtual #t + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate idle (warp-gate) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('hide) + (go-virtual hidden) + ) + (('effect) + (script-eval '(part-tracker "group-warpgate" entity self joint "outerOut")) + ) + ) + ) + :code (behavior () + (remove-setting! 'allow-progress) + (set-time! (-> self state-time)) + (update-transforms (-> self root)) + (until #f + (eval-on-notice self) + (when (and (and *target* + (and (>= (-> self distance) (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (-> self continue) + (-> *setting-control* user-current airlock) + (begin + (persist-with-delay *setting-control* 'lightjak (seconds 0.1) 'lightjak #f 0.0 0) + (persist-with-delay *setting-control* 'darkjak (seconds 0.1) 'darkjak #f 0.0 0) + (persist-with-delay *setting-control* 'board (seconds 0.1) 'board #f 0.0 0) + (not (logtest? (focus-status in-head edge-grab pole flut tube light board pilot mech dark indax) + (-> *target* focus-status) + ) + ) + ) + (not (-> *setting-control* user-current hint)) + (zero? (-> *target* ext-anim)) + ) + (talker-surpress!) + (when (and (can-display-query? self "warp-gate" -99.0) + (cond + ((and (-> *target* next-state) (let ((v1-37 (-> *target* next-state name))) + (or (= v1-37 'target-warp-in) (= v1-37 'target-warp-out)) + ) + ) + (set-time! (-> self state-time)) + #f + ) + (else + #t + ) + ) + (time-elapsed? (-> self state-time) (seconds 0.1)) + ) + (if (and (cpad-pressed? 0 triangle) (process-grab? *target* #f)) + (go-virtual use (-> self continue)) + ) + (script-eval (-> self on-close)) + (let ((gp-0 + (new 'stack 'font-context *font-default-matrix* 32 320 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-58 gp-0)) + (set! (-> v1-58 width) (the float 340)) + ) + (let ((v1-59 gp-0)) + (set! (-> v1-59 height) (the float 80)) + ) + (let ((v1-60 gp-0) + (a0-25 (-> *setting-control* user-default language)) + ) + (set! (-> v1-60 scale) (if (or (= a0-25 (language-enum korean)) (= a0-25 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> gp-0 flags) (font-flags shadow kerning large)) + (print-game-text + (lookup-text! *common-text* (text-id text-0083) #f) + gp-0 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + ) + ) + (cond + ((-> self continue) + (seek! (-> self anim-speed) 1.0 (* 2.0 (seconds-per-frame))) + (setup-masks (-> self draw) 2 0) + ) + (else + (setup-masks (-> self draw) 0 2) + (seek! (-> self anim-speed) 0.0 (* 2.0 (seconds-per-frame))) + ) + ) + (update! (-> self sound)) + (ja-post) + (suspend) + (ja :num! (loop! (-> self anim-speed))) + ) + #f + ) + ) + +;; failed to figure out what this is: +(defstate use (warp-gate) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('effect) + (script-eval '(part-tracker "group-warpgate" entity self joint "outerOut")) + ) + ) + ) + :exit (behavior () + (remove-setting! 'mode-name) + (remove-setting! 'interp-time) + ) + :trans (behavior () + (send-event *camera* 'joystick 0.0 0.0) + ) + :code (behavior ((arg0 continue-point)) + (local-vars (v1-38 symbol)) + (kill-current-talker '() '() 'exit) + (set-setting! 'mode-name 'cam-fixed 0.0 0) + (set-setting! 'interp-time 'abs 0.0 0) + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not arg0) + (process-release? *target*) + (go-virtual idle) + ) + (set-setting! 'allow-progress #f 0.0 0) + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) #t) + (apply-settings *setting-control*) + (let ((s5-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> s5-0 from) (process->ppointer self)) + (set! (-> s5-0 num-params) 4) + (set! (-> s5-0 message) 'change-state) + (set! (-> s5-0 param 0) (the-as uint target-warp-out)) + (let ((v1-22 (new 'static 'vector))) + (set! (-> v1-22 quad) (-> self center quad)) + (set! (-> s5-0 param 1) (the-as uint v1-22)) + ) + (set! (-> s5-0 param 2) (the-as uint (target-pos 0))) + (set! (-> s5-0 param 3) (the-as uint (process->handle self))) + (send-event-function *target* s5-0) + ) + (script-eval (-> self on-activate)) + (while (begin + (set! v1-38 + (when (-> self wait-for) + (let* ((s5-1 (-> self wait-for)) + (a1-8 (car s5-1)) + ) + (while (not (null? s5-1)) + (when (not (member (status-of-level-and-borrows *level* (the-as symbol a1-8) #f) '(loaded active))) + (set! v1-38 #t) + (goto cfg-21) + ) + (set! s5-1 (cdr s5-1)) + (set! a1-8 (car s5-1)) + ) + ) + #f + ) + ) + (label cfg-21) + (or v1-38 (not (time-elapsed? (-> self state-time) (seconds 2)))) + ) + (update! (-> self sound)) + (suspend) + (ja :num! (loop!)) + (ja-post) + ) + (if (not (logtest? (-> arg0 flags) (continue-flags no-blackout))) + (set-blackout-frames (seconds 0.05)) + ) + (start 'play arg0) + (let ((gp-1 (current-time))) + (until (time-elapsed? gp-1 (seconds 1)) + (suspend) + ) + ) + (while (and *target* (and (>= 81920.0 (vector-vector-distance (-> self root trans) (-> *target* control trans))) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (suspend) + (ja :num! (loop!)) + (ja-post) + ) + (logior! (-> self mask) (process-mask actor-pause)) + (go-virtual idle) + ) + ) + +;; definition for method 23 of type warp-gate +;; WARN: Return type mismatch draw-control vs none. +(defmethod init-skel-and-collide! ((this warp-gate)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((v1-2 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-2 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-2 prim-core action) (collide-action solid)) + (set! (-> v1-2 transform-index) 3) + (set-vector! (-> v1-2 local-sphere) 0.0 12288.0 0.0 16384.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-2) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-5 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-5 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-5 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-warp-gate" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (none) + ) + +;; definition for method 24 of type warp-gate +;; INFO: Used lq/sq +;; WARN: Return type mismatch float vs none. +(defmethod init-defaults! ((this warp-gate)) + (set! (-> this level-name) (-> this level name)) + (set! (-> this on-notice) (res-lump-struct (-> this entity) 'on-notice pair)) + (set! (-> this on-activate) #f) + (set! (-> this wait-for) #f) + (set! (-> this continue) #f) + (set! (-> this on-close) #f) + (set! (-> this part) (create-launch-control (-> *part-group-id-table* 202) this)) + (set! (-> this center quad) (-> this root trans quad)) + (+! (-> this center y) 13516.8) + (set! (-> this sound) + (new 'process 'ambient-sound (static-sound-spec "warpgate" :group 1 :fo-max 30) (-> this root trans) 0.0) + ) + (set! (-> this distance) (res-lump-float (-> this entity) 'distance :default 20480.0)) + (none) + ) + +;; definition for function warp-gate-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior warp-gate-init warp-gate ((arg0 entity-actor) (arg1 vector)) + (stack-size-set! (-> self main-thread) 512) + (init-skel-and-collide! self) + (if arg0 + (process-drawable-from-entity! self arg0) + ) + (if arg1 + (set! (-> self root trans quad) (-> arg1 quad)) + ) + (logior! (-> self mask) (process-mask actor-pause)) + (init-defaults! self) + (go-virtual idle) + (none) + ) + +;; definition for method 11 of type warp-gate +;; WARN: Return type mismatch none vs object. +(defmethod init-from-entity! ((this warp-gate) (arg0 entity-actor)) + (warp-gate-init arg0 (the-as vector #f)) + ) + +;; definition for symbol *warp-jump-mods*, type surface +(define *warp-jump-mods* (new 'static 'surface + :name 'jump + :turnv 273066.66 + :turnvf 30.0 + :turnvv 1820444.5 + :turnvvf 30.0 + :tiltv 65536.0 + :tiltvf 150.0 + :tiltvv 262144.0 + :tiltvvf 15.0 + :transv-max 65536.0 + :target-speed 65536.0 + :slip-factor 1.0 + :slide-factor 1.0 + :slope-up-factor 1.0 + :slope-down-factor 1.0 + :slope-slip-angle 1.0 + :impact-fric 1.0 + :bend-factor 1.0 + :bend-speed 1.0 + :alignv 1.0 + :slope-up-traction 1.0 + :align-speed 1.0 + :mode 'air + :flags (surface-flag turn-to-vel turn-when-centered gun-off) + ) + ) + +;; failed to figure out what this is: +(defstate target-warp-out (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('death-end) + (let ((v0-0 (the-as object (logior (-> self draw status) (draw-control-status no-draw))))) + (set! (-> self draw status) (the-as draw-control-status v0-0)) + v0-0 + ) + ) + (('warp-gate) + (if (not (-> self control unknown-spool-anim00)) + 'busy + ) + ) + (else + (target-generic-event-handler proc argc message block) + ) + ) + ) + :enter (behavior ((arg0 vector) (arg1 vector) (arg2 handle)) + (set-time! (-> self state-time)) + (logclear! (-> self control status) (collide-status on-surface on-ground touch-surface)) + (set! (-> self control mod-surface) *warp-jump-mods*) + (set! (-> self control unknown-vector37 quad) (-> arg0 quad)) + (set! (-> self control unknown-vector38 quad) (-> arg1 quad)) + (+! (-> self control unknown-vector37 y) -4096.0) + (set! (-> self control unknown-word04) (the-as uint #f)) + (set! (-> self control unknown-handle02) arg2) + (vector-reset! (-> self control transv)) + (logior! (-> self target-flags) (target-flags tf6)) + (set! (-> self alt-cam-pos quad) (-> arg1 quad)) + (forward-up-nopitch->quaternion + (-> self control dir-targ) + (vector-! (new 'stack-no-clear 'vector) arg1 (-> self control trans)) + (vector-y-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + ) + ) + :exit (behavior () + (logclear! (-> self target-flags) (target-flags tf6)) + ) + :code (behavior ((arg0 vector) (arg1 vector) (arg2 handle)) + (ja-channel-push! 1 (seconds 0.2)) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 16.0 0)) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 16.0 0))) + ) + (vector-! (-> self control transv) (-> self control unknown-vector37) (-> self control trans)) + (vector-xz-normalize! (-> self control transv) 32768.0) + (let ((v1-18 (new-stack-vector0))) + (let ((f0-6 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-18 (-> self control transv) (vector-float*! v1-18 (-> self control dynam gravity-normal) f0-6)) + ) + (let* ((f0-7 (vector-length v1-18)) + (f1-1 f0-7) + (f2-4 + (- (sqrtf + (* 2.0 + (-> self control dynam gravity-length) + (vector-dot + (-> self control dynam gravity-normal) + (vector-! (new 'stack-no-clear 'vector) (-> self control unknown-vector37) (-> self control trans)) + ) + ) + ) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-4) + (vector-float*! v1-18 v1-18 (/ f0-7 f1-1)) + ) + ) + ) + (let ((v1-20 (-> self control root-prim))) + (set! (-> v1-20 prim-core collide-as) (collide-spec)) + (set! (-> v1-20 prim-core collide-with) (collide-spec)) + ) + 0 + (set-time! (-> self state-time)) + (set! (-> self trans-hook) + (lambda :behavior target + () + (let ((v1-0 (new-stack-vector0)) + (f0-1 (vector-dot (-> self control dynam gravity-normal) (-> self control transv))) + ) + 0.0 + (vector-! v1-0 (-> self control transv) (vector-float*! v1-0 (-> self control dynam gravity-normal) f0-1)) + (let* ((f1-2 (vector-length v1-0)) + (f2-0 f1-2) + ) + (if (< f0-1 0.0) + (set! f0-1 8192.0) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f0-1) + (vector-float*! v1-0 v1-0 (/ f1-2 f2-0)) + ) + ) + ) + (let ((gp-1 (vector-! (new-stack-vector0) (-> self control unknown-vector37) (-> self control trans)))) + (set! (-> gp-1 y) 0.0) + (send-event *target* 'sidekick #f) + (when (and (or (< (vector-dot gp-1 (-> self control transv)) 0.0) (-> self control unknown-spool-anim00)) + (time-elapsed? (-> self state-time) (seconds 0.05)) + ) + (vector-seek! (-> self draw color-mult) (new 'static 'vector) (* 2.0 (seconds-per-frame))) + (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-spool-anim00)) + (sound-play "warpgate-tele") + (send-event (handle->process (-> self control unknown-handle02)) 'effect) + (send-event self 'draw #f) + (let ((v0-1 #t)) + (set! (-> self control unknown-word04) (the-as uint v0-1)) + v0-1 + ) + ) + ) + ) + ) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 40.0 0)) :frame-num (ja-aframe 16.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 40.0 0))) + ) + (sleep-code) + ) + :post target-no-stick-post + ) + +;; failed to figure out what this is: +(defstate target-warp-in (target) + :event target-generic-event-handler + :enter (behavior ((arg0 vector) (arg1 vector) (arg2 object)) + (set! (-> self control did-move-to-pole-or-max-jump-height) (the-as float arg2)) + ((-> target-warp-out enter) arg0 arg1 (the-as handle arg2)) + ) + :exit (-> target-warp-out exit) + :trans (behavior () + (set! (-> self control transv x) + (* 2.4 (- (-> self control unknown-vector38 x) (-> self control unknown-vector37 x))) + ) + (set! (-> self control transv z) + (* 2.4 (- (-> self control unknown-vector38 z) (-> self control unknown-vector37 z))) + ) + (if (logtest? (-> self control status) (collide-status on-surface)) + (go target-hit-ground #f) + ) + ) + :code (behavior ((arg0 vector) (arg1 vector) (arg2 object)) + (let ((a0-1 (-> self control did-move-to-pole-or-max-jump-height))) + (when a0-1 + (let ((s5-0 (res-lump-struct (the-as res-lump a0-1) 'camera-name string))) + (when s5-0 + (logclear! (-> self target-flags) (target-flags tf6)) + (process-spawn-function + process + (lambda :behavior process + ((arg0 string)) + (local-vars (a1-2 event-message-block)) + (add-setting! 'entity-name arg0 0.0 0) + (until (send-event-function *camera* a1-2) + (suspend) + (set! a1-2 (new 'stack-no-clear 'event-message-block)) + (let ((v1-2 (process->ppointer self))) + (set! (-> a1-2 from) v1-2) + ) + (set! (-> a1-2 num-params) 0) + (set! (-> a1-2 message) 'intro-done?) + ) + #f + ) + s5-0 + :to self + ) + ) + ) + ) + ) + (let ((v1-12 (-> self control root-prim))) + (set! (-> self control backup-collide-as) (-> v1-12 prim-core collide-as)) + (set! (-> self control backup-collide-with) (-> v1-12 prim-core collide-with)) + ) + (let ((v1-15 (-> self control root-prim))) + (set! (-> v1-15 prim-core collide-as) (collide-spec)) + (set! (-> v1-15 prim-core collide-with) (collide-spec)) + ) + 0 + (ja-channel-set! 0) + (vector-reset! (-> self control transv)) + (move-to-point! (-> self control) (-> self control unknown-vector37)) + (let ((s5-1 (current-time))) + (while (or (not (time-elapsed? s5-1 (seconds 1))) + (< 81920.0 (vector-vector-distance (camera-pos) (-> self control trans))) + ) + (suspend) + ) + ) + (set-heading-vec! (-> self control) (-> self control transv)) + (rot->dir-targ! (-> self control)) + (set-time! (-> self state-time)) + (set! (-> self post-hook) target-no-stick-post) + (ja-channel-set! 1) + (send-event + (if arg2 + (-> (the-as process arg2) child 3) + ) + 'effect + ) + (send-event self 'draw #t) + (sound-play "warpgate-tele") + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 42.0 0)) :frame-num (ja-aframe 40.0 0)) + (until (ja-done? 0) + (let ((v1-58 (new-stack-vector0))) + (let ((f0-5 (vector-dot (-> self control dynam gravity-normal) (-> self control transv)))) + 0.0 + (vector-! v1-58 (-> self control transv) (vector-float*! v1-58 (-> self control dynam gravity-normal) f0-5)) + ) + (let* ((f0-6 (vector-length v1-58)) + (f1-1 f0-6) + (f2-3 + (- (sqrtf (* 4096.0 (-> self control dynam gravity-length))) + (* 0.008333334 (- (-> self control dynam gravity-length))) + ) + ) + ) + (vector+! + (-> self control transv) + (vector-float*! (-> self control transv) (-> self control dynam gravity-normal) f2-3) + (vector-float*! v1-58 v1-58 (/ f0-6 f1-1)) + ) + ) + ) + (suspend) + (ja :num! (seek! (ja-aframe 42.0 0))) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek! (ja-aframe 50.0 0)) :frame-num (ja-aframe 42.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 50.0 0))) + ) + (let ((v1-79 (-> self control root-prim))) + (set! (-> v1-79 prim-core collide-as) (-> self control backup-collide-as)) + (set! (-> v1-79 prim-core collide-with) (-> self control backup-collide-with)) + ) + (ja-no-eval :group! jakb-duck-high-jump-ja :num! (seek!) :frame-num (ja-aframe 50.0 0)) + (until (ja-done? 0) + (suspend) + (ja :num! (seek!)) + ) + (target-falling-anim -1 (seconds 0.33)) + ) + :post target-no-move-post + ) + +;; failed to figure out what this is: +(defskelgroup skel-air-train air-train air-train-lod0-jg air-train-idle-ja + ((air-train-lod0-mg (meters 999999))) + :bounds (static-spherem 0 2 -2 12.5) + :shadow-joint-index 3 + ) + +;; definition of type air-train +(deftype air-train (warp-gate) + ((part-exhaust-left sparticle-launch-control) + (part-exhaust-right sparticle-launch-control) + (part-dust sparticle-launch-control) + (dust-y float) + (hover-sound sound-id) + (base-pos vector :inline) + ) + ) + +;; definition for method 3 of type air-train +(defmethod inspect ((this air-train)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type warp-gate inspect))) + (t9-0 this) + ) + (format #t "~2Tpart-exhaust-left: ~A~%" (-> this part-exhaust-left)) + (format #t "~2Tpart-exhaust-right: ~A~%" (-> this part-exhaust-right)) + (format #t "~2Tpart-dust: ~A~%" (-> this part-dust)) + (format #t "~2Tdust-y: ~f~%" (-> this dust-y)) + (format #t "~2Thover-sound: ~D~%" (-> this hover-sound)) + (format #t "~2Tbase-pos: #~%" (-> this base-pos)) + (label cfg-4) + this + ) + +;; definition for method 7 of type air-train +;; WARN: Return type mismatch warp-gate vs air-train. +(defmethod relocate ((this air-train) (offset int)) + (if (nonzero? (-> this part-exhaust-left)) + (&+! (-> this part-exhaust-left) offset) + ) + (if (nonzero? (-> this part-exhaust-right)) + (&+! (-> this part-exhaust-right) offset) + ) + (if (nonzero? (-> this part-dust)) + (&+! (-> this part-dust) offset) + ) + (the-as air-train ((method-of-type warp-gate relocate) this offset)) + ) + +;; definition for method 10 of type air-train +(defmethod deactivate ((this air-train)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (sound-stop (-> this hover-sound)) + (if (nonzero? (-> this part-exhaust-left)) + (kill-particles (-> this part-exhaust-left)) + ) + (if (nonzero? (-> this part-exhaust-right)) + (kill-particles (-> this part-exhaust-right)) + ) + (if (nonzero? (-> this part-dust)) + (kill-particles (-> this part-dust)) + ) + ((method-of-type warp-gate deactivate) this) + (none) + ) + +;; definition for method 23 of type air-train +;; WARN: Return type mismatch draw-control vs none. +(defmethod init-skel-and-collide! ((this air-train)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum usually-hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (set! (-> s5-0 penetrated-by) (penetrate)) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 2) 0))) + (set! (-> s5-0 total-prims) (the-as uint 3)) + (set! (-> s4-0 prim-core collide-as) (collide-spec obstacle)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 69632.0) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-13 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 0) (the-as uint 0)))) + (set! (-> v1-13 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-13 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-13 prim-core action) (collide-action solid)) + (set! (-> v1-13 transform-index) 6) + (set-vector! (-> v1-13 local-sphere) 0.0 10240.0 0.0 24576.0) + ) + (let ((v1-15 (new 'process 'collide-shape-prim-mesh s5-0 (the-as uint 1) (the-as uint 0)))) + (set! (-> v1-15 prim-core collide-as) (collide-spec obstacle)) + (set! (-> v1-15 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> v1-15 prim-core action) (collide-action solid)) + (set! (-> v1-15 transform-index) 3) + (set-vector! (-> v1-15 local-sphere) 0.0 0.0 0.0 53248.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-18 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-18 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-18 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + (initialize-skeleton + this + (the-as skeleton-group (art-group-get-by-name *level* "skel-air-train" (the-as (pointer level) #f))) + (the-as pair 0) + ) + (none) + ) + +;; definition for method 24 of type air-train +;; INFO: Used lq/sq +;; WARN: Return type mismatch sound-id vs none. +(defmethod init-defaults! ((this air-train)) + (let ((t9-0 (method-of-type warp-gate init-defaults!))) + (t9-0 this) + ) + (set! (-> this base-pos quad) (-> this root trans quad)) + (let ((v1-2 (-> this level-name))) + (set! (-> this dust-y) (cond + ((= v1-2 'nest) + -1105.92 + ) + ((= v1-2 'caspad) + 114647.04 + ) + (else + (the-as float #x7f800000) + ) + ) + ) + ) + (set! (-> this part-exhaust-left) (create-launch-control (-> *part-group-id-table* 206) this)) + (set! (-> this part-exhaust-right) (create-launch-control (-> *part-group-id-table* 206) this)) + (set! (-> this part-dust) (create-launch-control (-> *part-group-id-table* 204) this)) + (set! (-> this root pause-adjust-distance) 368640.0) + (set! (-> this hover-sound) (sound-play "air-train")) + (none) + ) + +;; failed to figure out what this is: +(defstate idle (air-train) + :virtual #t + :post (behavior () + (let ((t9-0 (-> (method-of-type warp-gate idle) post))) + (if t9-0 + ((the-as (function none) t9-0)) + ) + ) + (set! (-> self root trans y) (+ (-> self base-pos y) + (* 696.32 (cos (* 66.19798 (the float (mod (current-time) 990))))) + (* 450.56 (cos (* 42.25403 (the float (mod (current-time) 1551))))) + ) + ) + (sparticle-launch-control-method-18 (-> self part-exhaust-left) (joint-node air-train-lod0-jg thruster_l)) + (sparticle-launch-control-method-18 (-> self part-exhaust-right) (joint-node air-train-lod0-jg thruster_r)) + (let ((f0-9 (-> self dust-y))) + (when (!= f0-9 (the-as float #x7f800000)) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) f0-9) + (spawn (-> self part-dust) a1-2) + ) + ) + ) + (sound-play "air-train" :id (-> self hover-sound) :position (-> self root trans)) + ) + ) + +;; failed to figure out what this is: +(defstate use (air-train) + :virtual #t + :code (behavior ((arg0 continue-point)) + (kill-current-talker '() '() 'exit) + (set-time! (-> self state-time)) + (logclear! (-> self mask) (process-mask actor-pause)) + (when (not arg0) + (process-release? *target*) + (go-virtual idle) + ) + (set-setting! 'allow-progress #f 0.0 0) + (set! (-> *setting-control* user-default border-mode) #t) + (set! (-> *level* play?) #t) + (apply-settings *setting-control*) + (sound-stop (-> self hover-sound)) + (set! (-> self hover-sound) (new 'static 'sound-id)) + (script-eval (-> self on-activate)) + (sleep-code) + ) + ) + +;; failed to figure out what this is: +(load-scene (new 'static 'scene + :name "desert-air-train-in" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "air-train-5" + :art-group "scenecamera" + :anim "desert-air-train-in" + :parts 4 + :command-list '((0 + (kill "air-train-5") + (fadein (frame-time-30 10)) + (apply ,(lambda () (kill-by-type v-marauder *active-pool*))) + ) + (260 + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 260 475) + ) + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 260 475) + ) + ) + (270 (part-tracker + "group-warp-fma-dust-takeoff" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 270 475) + ) + ) + (350 + (part-tracker + "group-warp-thruster-trail" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 350 475) + subsample-num + (new 'static 'bfloat :data 5.0) + ) + (part-tracker + "group-warp-thruster-trail" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 350 475) + subsample-num + (new 'static 'bfloat :data 5.0) + ) + ) + (475 (fadeout (frame-time-30 5))) + ) + :cut-list '(285) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'warpcast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min 290)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'warpcast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min 290)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'warpcast + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'desertb + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "desert-warp" + :end-point "ctyport-warp" + :borrow '() + :sfx-volume 0.75 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running #f + :on-complete #f + ) + ) + +;; failed to figure out what this is: +(load-scene (new 'static 'scene + :name "desert-air-train-out" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "air-train-5" + :art-group "scenecamera" + :anim "desert-air-train-out" + :parts 3 + :command-list '((0 (kill "air-train-5") (fadein (frame-time-30 10))) + (1 + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_l" + track + #t + duration + (frame-range 1 200) + ) + (part-tracker + "group-warp-fma-drop-thrusters" + entity + "air-train" + joint + "thruster_r" + track + #t + duration + (frame-range 1 200) + ) + ) + (65 (part-tracker + "group-warp-fma-dust-takeoff" + entity + "particleman" + joint + "particleA" + track + #t + duration + (frame-range 65 172) + ) + ) + (290 (fadeout (frame-time-30 5))) + ) + :cut-list '(180) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'warpcast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((180 max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'warpcast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((180 max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "particleman" + :level 'warpcast + :art-group "skel-particleman" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'desertb + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "desert-warp" + :end-point "desert-warp" + :borrow '() + :sfx-volume 0.75 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running #f + :on-complete #f + ) + ) + +;; failed to figure out what this is: +(load-scene (new 'static 'scene + :name "city-air-train-out" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "scene-stage-87" + :art-group "scenecamera" + :anim "city-air-train-out" + :parts 2 + :command-list '((0 (kill "air-train-1") (fadein (frame-time-30 10))) (235 (fadeout (frame-time-30 5)))) + :cut-list '(98 188) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'citycast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '(((min max) set-flags local-space)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'citycast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'ctyport + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "ctyport-air-train" + :end-point "ctyport-warp" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running '(begin + (sound-play-loop "port-amb-mov") + (sound-play-loop "port-water-mov") + (sound-play-loop "port-gulls-mov") + ) + :on-complete #f + ) + ) + +;; failed to figure out what this is: +(load-scene (new 'static 'scene + :name "city-air-train-in-desert" + :extra #f + :info #f + :scene-flags (scene-flags scf1 scf2 scf3 scf4) + :mask-to-clear (process-mask movie enemy platform projectile) + :entity "scene-stage-87" + :art-group "scenecamera" + :anim "city-air-train-in-desert" + :parts 3 + :command-list '((0 (kill "air-train-1") (fadein (frame-time-30 10))) (275 (fadeout (frame-time-30 5)))) + :cut-list '(51 102 226) + :wait-ground-time (seconds 1) + :actor (new 'static 'boxed-array :type scene-actor + (new 'static 'scene-actor + :name "scenecamera" + :level #f + :art-group "skel-scenecamera" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :camera 4 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "jakc-highres" + :level 'citycast + :art-group "skel-jakc-highres" + :prefix "" + :draw-frames '((min 226)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '(((min max) set-flags local-space)) + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + :no-draw-seg #x80 + ) + (new 'static 'scene-actor + :name "sidekick-highres" + :level 'citycast + :art-group "skel-sidekick-highres" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '() + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + (new 'static 'scene-actor + :name "air-train" + :level 'ctyport + :art-group "skel-air-train" + :prefix "" + :draw-frames '((min max)) + :scissor-frames '((min max)) + :shadow-frames '((min max)) + :cloth-reset-frames '() + :cloth-commands '() + :flags #x1 + :shadow-flags -1 + :shadow-volume-joint #f + ) + ) + :load-point "ctyport-warp" + :end-point "desert-warp" + :borrow '() + :sfx-volume -1.0 + :ambient-volume -1.0 + :music-volume -1.0 + :music-delay 1500.0 + :on-running '(begin + (sound-play-loop "port-amb-mov") + (sound-play-loop "port-water-mov") + (sound-play-loop "port-gulls-mov") + ) + :on-complete #f + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-warp-fma-dust-takeoff + :id 208 + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 64) + :parts ((sp-item 844 :flags (sp7))) + ) + +;; failed to figure out what this is: +(defpart 844 + :init-specs ((:texture (dirtpuff01 level-default-sprite)) + (:birth-func 'birth-func-curve) + (:num 5.0) + (:x (meters 0) (meters 3)) + (:scale-x (meters 0.5)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 128.0) + (:g 100.0) + (:b 60.0) + (:a 0.0) + (:vel-x (meters 0.033333335) (meters 0.06666667)) + (:accel-y (meters 0) (meters 0.00016666666)) + (:timer (seconds 3)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13 launch-along-z)) + (:userdata 0.0) + (:func 'live-func-curve) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0) (degrees 3600)) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *range-warp-dust-color* (new 'static 'curve-color-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'inline-array vector 4 + (new 'static 'vector :x 140.0 :y 120.0 :z 80.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + (new 'static 'vector :x 100.0 :y 80.0 :z 40.0 :w 128.0) + ) + :one-over-x-deltas (new 'static 'vector :x 1.0 :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *range-warp-dust-alpha* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 32.0 :y 40.0 :z 41.0 :w 42.0) + :one-over-x-deltas (new 'static 'vector :x 8.0 :y 1.0 :z 1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *range-warp-dust-scale-x* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 3.0 :y 3.3 :z 4.3 :w 5.3) + :one-over-x-deltas (new 'static 'vector :x 0.29999995 :y 1.0000002 :z 1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *range-warp-dust-scale-y* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -1.0 :z -2.0 :w -3.0) + :ys (new 'static 'vector :x 3.0 :y 3.3 :z 4.3 :w 5.3) + :one-over-x-deltas (new 'static 'vector :x 0.29999995 :y 1.0000002 :z 1.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *curve-warp-dust-alpha* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.1 :z -0.5 :w -1.0) + :ys (new 'static 'vector :y 1.0 :z 1.0) + :one-over-x-deltas (new 'static 'vector :x 10.0 :z -2.0 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *curve-warp-dust-scale-x* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.4 :w -1.0) + :ys (new 'static 'vector :y 5.0 :z 6.0 :w 6.5) + :one-over-x-deltas (new 'static 'vector :x 16.666666 :y 10.000001 :z 0.8333333 :w 1.0) + ) + ) + ) + +;; failed to figure out what this is: +(if #t + (set! *curve-warp-dust-scale-y* (new 'static 'curve2d-fast + :xs (new 'static 'vector :y -0.3 :z -0.4 :w -1.0) + :ys (new 'static 'vector :y 5.0 :z 6.0 :w 6.5) + :one-over-x-deltas (new 'static 'vector :x 16.666666 :y 10.000001 :z 0.8333333 :w 1.0) + ) + ) + ) + +;; definition for symbol *part-warp-fma-dust-takeoff-curve-settings*, type particle-curve-settings +(define *part-warp-fma-dust-takeoff-curve-settings* (new 'static 'particle-curve-settings + :lifetime-base (seconds 5) + :lifetime-offset (seconds 2) + :flags (particle-curve-flags pcf0) + ) + ) + +;; failed to figure out what this is: +(set! (-> *part-id-table* 844 init-specs 15 initial-valuef) + (the-as float *part-warp-fma-dust-takeoff-curve-settings*) + ) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* color-start) *range-warp-dust-color*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* alpha-start) *range-warp-dust-alpha*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-x-start) *range-warp-dust-scale-x*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-y-start) *range-warp-dust-scale-y*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* r-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* g-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* b-scalar) #f) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* a-scalar) *curve-warp-dust-alpha*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-x-scalar) *curve-warp-dust-scale-x*) + +;; failed to figure out what this is: +(set! (-> *part-warp-fma-dust-takeoff-curve-settings* scale-y-scalar) *curve-warp-dust-scale-y*) + +;; failed to figure out what this is: +(defpartgroup group-warp-fma-drop-thrusters + :id 209 + :flags (sp0 sp4) + :bounds (static-bspherem 0 0 0 640) + :parts ((sp-item 845 :flags (sp7)) + (sp-item 846 :flags (sp7) :period (seconds 0.017) :length (seconds 0.017)) + (sp-item 847 :flags (sp7) :period (seconds 0.017) :length (seconds 0.017)) + ) + ) + +;; failed to figure out what this is: +(defpart 845 + :init-specs ((:num 1.0) + (:x (meters -2) (meters 4)) + (:y (meters -2) (meters 4)) + (:z (meters -2) (meters 4)) + (:rot-x 5) + (:r 20480.0) + (:g 10240.0) + (:b 8192.0 4096.0) + (:timer (seconds 0.5)) + (:flags (distort launch-along-z)) + ) + ) + +;; failed to figure out what this is: +(defpart 846 + :init-specs ((:texture (colorflash level-default-sprite)) + (:num 4.0) + (:scale-x (meters 2) (meters 2)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 200.0) + (:b 128.0) + (:a 40.0 10.0) + (:vel-y (meters 0.1)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpart 847 + :init-specs ((:texture (glow level-default-sprite)) + (:num 3.0) + (:scale-x (meters 6) (meters 1)) + (:scale-y :copy scale-x) + (:r 255.0) + (:g 100.0 28.0) + (:b 0.0) + (:a 8.0 8.0) + (:vel-y (meters 0.1)) + (:timer (seconds 0.017)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-3)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-warp-thruster-trail + :id 210 + :flags (sp0 sp4 sp13) + :bounds (static-bspherem 0 0 0 640) + :parts ((sp-item 848 :flags (sp7))) + ) + +;; failed to figure out what this is: +(defpart 848 + :init-specs ((:texture (big-cloud level-default-sprite)) + (:num 1.0) + (:scale-x (meters 3)) + (:rot-z (degrees 0) (degrees 360)) + (:scale-y :copy scale-x) + (:r 80.0 100.0) + (:g :copy r) + (:b :copy r) + (:a 20.0 10.0) + (:vel-y (meters 0.1)) + (:scalevel-x (meters 0.016666668) (meters 0.016666668)) + (:scalevel-y :copy scalevel-x) + (:fade-a -0.05 -0.05) + (:friction 0.9) + (:timer (seconds 2)) + (:flags (sp-cpuinfo-flag-2 sp-cpuinfo-flag-13)) + (:conerot-z (degrees 0)) + (:rotate-y (degrees 0)) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc new file mode 100644 index 00000000000..1fee5bcef8a --- /dev/null +++ b/test/decompiler/reference/jak3/engine/common-obs/water-anim_REF.gc @@ -0,0 +1,486 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type water-anim +(deftype water-anim (process-drawable) + ((water-height meters) + (wade-height meters) + (swim-height meters) + (bottom-height meters) + (attack-event symbol) + (attack-id uint32) + (flow flow-control) + (target handle) + (flags water-flag) + (look wanim-look) + (play-ambient-sound? symbol) + (visible symbol) + ) + (:state-methods + unknown + idle + ) + (:methods + (move-to-point! (_type_ vector) int) + (get-ripple-height (_type_ vector) float) + (init-water! (_type_) object) + (alloc-root! (_type_) none) + (water-anim-init! (_type_) none) + (stub (_type_) none) + (set-offset-and-look! (_type_) none) + ) + ) + +;; definition for method 3 of type water-anim +(defmethod inspect ((this water-anim)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 this) + ) + (format #t "~2Twater-height: (meters ~m)~%" (-> this water-height)) + (format #t "~2Twade-height: (meters ~m)~%" (-> this wade-height)) + (format #t "~2Tswim-height: (meters ~m)~%" (-> this swim-height)) + (format #t "~2Tbottom-height: (meters ~m)~%" (-> this bottom-height)) + (format #t "~2Tattack-event: ~A~%" (-> this attack-event)) + (format #t "~2Tattack-id: ~D~%" (-> this attack-id)) + (format #t "~2Tflow: ~A~%" (-> this flow)) + (format #t "~2Ttarget: ~D~%" (-> this target)) + (format #t "~2Tflags: #x~X~%" (-> this flags)) + (format #t "~2Tlook: ~D~%" (-> this look)) + (format #t "~2Tplay-ambient-sound?: ~A~%" (-> this play-ambient-sound?)) + (format #t "~2Tvisible: ~A~%" (-> this visible)) + (label cfg-4) + this + ) + +;; definition for method 7 of type water-anim +(defmethod relocate ((this water-anim) (offset int)) + (if (nonzero? (-> this flow)) + (&+! (-> this flow) offset) + ) + (call-parent-method this offset) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-nst-lake water-anim-nst water-anim-nst-lake-lod0-jg -1 + ((water-anim-nst-lake-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 300) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-forb-foresta water-anim-forb 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fora-forestb water-anim-fora 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fora-forestc water-anim-fora 2 -1 + ((3 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fora-forestd water-anim-fora 4 -1 + ((5 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fora-foreste water-anim-fora 6 -1 + ((7 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-fora-forestf water-anim-fora 8 -1 + ((9 (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-waspala-thronesec water-anim-waspala water-anim-waspala-thronesec-lod0-jg -1 + ((water-anim-waspala-thronesec-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-waspala-windowwall water-anim-waspala water-anim-waspala-windowwall-lod0-jg -1 + ((water-anim-waspala-windowwall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-waspala-frontthrone water-anim-waspala water-anim-waspala-frontthrone-lod0-jg -1 + ((water-anim-waspala-frontthrone-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; failed to figure out what this is: +(defskelgroup skel-water-anim-waspala-frontwindowwall water-anim-waspala water-anim-waspala-frontwindowwall-lod0-jg -1 + ((water-anim-waspala-frontwindowwall-lod0-mg (meters 999999))) + :bounds (static-spherem 0 0 0 500) + ) + +;; definition of type water-anim-look +(deftype water-anim-look (structure) + ((skel-group string) + (anim int32) + (ambient-sound-spec sound-spec) + ) + ) + +;; definition for method 3 of type water-anim-look +(defmethod inspect ((this water-anim-look)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'water-anim-look) + (format #t "~1Tskel-group: ~A~%" (-> this skel-group)) + (format #t "~1Tanim: ~D~%" (-> this anim)) + (format #t "~1Tambient-sound-spec: ~A~%" (-> this ambient-sound-spec)) + (label cfg-4) + this + ) + +;; definition for symbol *water-anim-look*, type (array water-anim-look) +(define *water-anim-look* + (new 'static 'boxed-array :type water-anim-look + (new 'static 'water-anim-look :skel-group "water-anim-nst-lake" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-forb-foresta" :anim 2 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestb" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestc" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestd" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-foreste" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-fora-forestf" :anim 10 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-thronesec" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-windowwall" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-frontthrone" :anim 8 :ambient-sound-spec #f) + (new 'static 'water-anim-look :skel-group "water-anim-waspala-frontwindowwall" :anim 8 :ambient-sound-spec #f) + ) + ) + +;; definition for function water-anim-event-handler +;; INFO: Used lq/sq +(defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (local-vars (v0-1 object)) + (case arg2 + (('move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('move-to-y) + (let ((a1-2 (new 'stack-no-clear 'vector))) + (set! (-> a1-2 quad) (-> self root trans quad)) + (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) + (move-to-point! self a1-2) + ) + (set! v0-1 (logclear (-> self mask) (process-mask sleep-code))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('water) + (let* ((s5-0 (the-as object (-> arg3 param 0))) + (s4-0 (-> arg3 param 1)) + (gp-0 (if (type? s4-0 process-focusable) + s4-0 + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flag deadly)) + (logtest? (water-flag touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) + ) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (focus-test? (the-as process-focusable gp-0) board)) + (send-event + (the-as process-tree gp-0) + 'attack-invinc + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode v1-15)) + ) + ) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (focus-test? (the-as process-focusable gp-0) board)) + (send-event + (the-as process-tree gp-0) + 'attack + #f + (static-attack-info + :mask (vehicle-impulse-factor) + ((id (-> self attack-id)) (damage 2.0) (vehicle-damage-factor 1.0) (vehicle-impulse-factor 1.0) (mode v1-15)) + ) + ) + ) + (send-event self 'notify 'attack) + ) + ) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flag flow)) + (logtest? (water-flag touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + (push-process a0-40 (the-as process-focusable gp-0)) + ) + ) + ) + ) + ) + (('visible) + (cond + ((-> arg3 param 0) + (set! (-> self visible) #t) + ) + (else + (set! (-> self visible) #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) + ) + ) + +;; failed to figure out what this is: +(defstate idle (water-anim) + :virtual #t + :event water-anim-event-handler + :trans (behavior () + (let ((a0-0 (-> self flow))) + (if (and (nonzero? a0-0) *display-vol-marks*) + (draw-path a0-0) + ) + ) + (cond + ((not (-> self visible)) + ) + ((< (-> (math-camera-pos) y) (+ -8192.0 (-> self root trans y))) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + ) + (if (and (-> self visible) (and (-> self play-ambient-sound?) (nonzero? (-> self sound)))) + (update! (-> self sound)) + ) + ) + :code (behavior () + (until #f + (ja-post) + (logior! (-> self mask) (process-mask sleep-code)) + (suspend) + ) + #f + ) + ) + +;; definition for method 22 of type water-anim +;; INFO: Used lq/sq +(defmethod move-to-point! ((this water-anim) (arg0 vector)) + (set! (-> this root trans quad) (-> arg0 quad)) + (set! (-> this water-height) (-> this root trans y)) + (if (nonzero? (-> this sound)) + (update-trans! (-> this sound) (-> this root trans)) + ) + ) + +;; definition for method 23 of type water-anim +(defmethod get-ripple-height ((this water-anim) (arg0 vector)) + (ripple-find-height this 0 arg0) + ) + +;; definition for method 27 of type water-anim +;; WARN: Return type mismatch symbol vs none. +(defmethod stub ((this water-anim)) + (none) + ) + +;; definition for method 28 of type water-anim +;; INFO: Used lq/sq +;; WARN: Return type mismatch quaternion vs none. +(defmethod set-offset-and-look! ((this water-anim)) + (local-vars (sv-16 res-tag)) + (set! (-> this play-ambient-sound?) #t) + (set! (-> this visible) #t) + (set! (-> this look) + (res-lump-value (-> this entity) 'look wanim-look :default (the-as uint128 -1) :time -1000000000.0) + ) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-4 (res-lump-data (-> this entity) 'trans-offset vector :tag-ptr (& sv-16)))) + (when v1-4 + (+! (-> this root trans x) (-> v1-4 x)) + (+! (-> this root trans y) (-> v1-4 y)) + (+! (-> this root trans z) (-> v1-4 z)) + ) + ) + (let ((f0-6 (res-lump-float (-> this entity) 'rotoffset))) + (if (!= f0-6 0.0) + (quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-6) + ) + ) + (none) + ) + +;; definition for method 24 of type water-anim +;; WARN: Return type mismatch none vs object. +(defmethod init-water! ((this water-anim)) + (let ((s5-0 (-> this look))) + (if (or (< (the-as int s5-0) 0) (>= (the-as int s5-0) (-> *water-anim-look* length))) + (go process-drawable-art-error "skel group") + ) + (let ((s5-1 (-> *water-anim-look* s5-0))) + (initialize-skeleton-by-name this (-> s5-1 skel-group)) + (ja-channel-set! 1) + (let ((s4-0 (-> this skel root-channel 0))) + (joint-control-channel-group-eval! + s4-0 + (the-as art-joint-anim (-> this draw art-group data (-> s5-1 anim))) + num-func-identity + ) + (set! (-> s4-0 frame-num) 0.0) + ) + (let ((a2-1 (-> s5-1 ambient-sound-spec))) + (when a2-1 + (let ((a3-0 (new 'stack-no-clear 'vector))) + (vector+! a3-0 (-> this root trans) (-> this draw bounds)) + (set! (-> this sound) (new 'process 'ambient-sound a2-1 a3-0 0.0)) + ) + ) + ) + ) + ) + (ja-post) + ) + +;; definition for method 25 of type water-anim +;; WARN: Return type mismatch trsqv vs none. +(defmethod alloc-root! ((this water-anim)) + (set! (-> this root) (new 'process 'trsqv)) + (none) + ) + +;; definition for method 26 of type water-anim +;; INFO: Used lq/sq +;; WARN: Return type mismatch water-flag vs none. +(defmethod water-anim-init! ((this water-anim)) + (local-vars (sv-16 res-tag)) + (set! (-> this attack-event) (the-as symbol ((method-of-type res-lump get-property-struct) + (-> this entity) + 'attack-event + 'interp + -1000000000.0 + (the-as structure 'drown) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (process-drawable-from-entity! this (-> this entity)) + (logclear! (-> this mask) (process-mask actor-pause)) + (set! (-> this vol) (new 'process 'vol-control this)) + (logior! (-> this vol flags) (vol-flags display? vol-flags-1)) + (set! (-> this bottom-height) 32768.0) + (let* ((v1-8 *game-info*) + (a0-7 (+ (-> v1-8 attack-id) 1)) + ) + (set! (-> v1-8 attack-id) a0-7) + (set! (-> this attack-id) a0-7) + ) + (set! (-> this target) (the-as handle #f)) + (set! sv-16 (new 'static 'res-tag)) + (let ((v1-10 (the-as (pointer float) ((method-of-type res-lump get-property-data) + (-> this entity) + 'water-height + 'exact + -1000000000.0 + (the-as pointer #f) + (& sv-16) + *res-static-buf* + ) + ) + ) + ) + (when v1-10 + (set! (-> this water-height) (-> v1-10 0)) + (set! (-> this wade-height) (-> v1-10 1)) + (set! (-> this swim-height) (-> v1-10 2)) + (if (>= (-> sv-16 elt-count) (the-as uint 4)) + (set! (-> this flags) (the-as water-flag (the int (-> v1-10 3)))) + ) + (if (>= (-> sv-16 elt-count) (the-as uint 5)) + (set! (-> this bottom-height) (-> v1-10 4)) + ) + ) + ) + (logior! (-> this flags) (water-flag part-water)) + (if (logtest? (-> this flags) (water-flag flow)) + (set! (-> this flow) (new 'process 'flow-control this (the-as res-lump #f))) + ) + (cond + ((zero? (-> this flags)) + (if (< 0.0 (-> this wade-height)) + (logior! (-> this flags) (water-flag can-wade)) + ) + (if (< 0.0 (-> this swim-height)) + (logior! (-> this flags) (water-flag can-swim)) + ) + ) + (else + ) + ) + (none) + ) + +;; definition for function water-anim-init-by-other +(defbehavior water-anim-init-by-other water-anim ((arg0 entity-actor)) + (process-entity-set! self arg0) + (stub self) + (alloc-root! self) + (water-anim-init! self) + (set-offset-and-look! self) + (init-water! self) + (go-virtual idle) + ) + +;; definition for method 11 of type water-anim +(defmethod init-from-entity! ((this water-anim) (arg0 entity-actor)) + (stub this) + (alloc-root! this) + (water-anim-init! this) + (set-offset-and-look! this) + (init-water! this) + (go (method-of-object this idle)) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc index c8398ea1add..3e39793214f 100644 --- a/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc +++ b/test/decompiler/reference/jak3/engine/common-obs/water_REF.gc @@ -764,66 +764,28 @@ (sp-group-flag sp13) ) (set! (-> *launch-matrix* trans quad) (-> arg1 quad)) - (let ((s4-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 - (the-as part-tracker-subsampler s4-0) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-2 run-function-in-process) - (a0-5 s4-0) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (if (zero? arg2) - (-> *part-group-id-table* 193) - (-> *part-group-id-table* 192) - ) - ) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) - (the-as (function part-tracker vector) part-water-splash-callback) - ) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint arg0)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-5 a1-3 *part-tracker-subsampler-params-default*) + (part-tracker-spawn + part-tracker-subsampler + :to *entity-pool* + :group (if (zero? arg2) + (-> *part-group-id-table* 193) + (-> *part-group-id-table* 192) ) - (-> s4-0 ppointer) - ) + :callback (the-as (function part-tracker vector) part-water-splash-callback) + :userdata (the-as uint arg0) ) ) (else (set! (-> *launch-matrix* trans quad) (-> arg1 quad)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker s4-1) *entity-pool* "part-tracker" (the-as pointer #x70004000)) + (part-tracker-spawn + part-tracker + :to *entity-pool* + :group (if (zero? arg2) + (-> *part-group-id-table* 193) + (-> *part-group-id-table* 192) ) - (let ((t9-5 run-function-in-process) - (a0-10 s4-1) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (if (zero? arg2) - (-> *part-group-id-table* 193) - (-> *part-group-id-table* 192) - ) - ) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) - (the-as (function part-tracker vector) part-water-splash-callback) - ) - (set! (-> *part-tracker-params-default* userdata) (the-as uint arg0)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-10 a1-6 *part-tracker-params-default*) - ) - (-> s4-1 ppointer) - ) + :callback (the-as (function part-tracker vector) part-water-splash-callback) + :userdata (the-as uint arg0) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/game/effect-control-h_REF.gc b/test/decompiler/reference/jak3/engine/game/effect-control-h_REF.gc index 26283b96c6f..07cd30f230c 100644 --- a/test/decompiler/reference/jak3/engine/game/effect-control-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/effect-control-h_REF.gc @@ -17,10 +17,10 @@ (new (symbol type process-drawable) _type_) (effect-control-method-9 (_type_) none) (do-effect (_type_ symbol float int) none) - (effect-control-method-11 () none) + (do-effect-for-surface (_type_ symbol float int basic pat-surface) none) (play-effect-sound (_type_ symbol float int basic sound-name) int) (set-channel-offset! (_type_ int) none) - (effect-control-method-14 () none) + (play-effects-from-res-lump (_type_ float float float) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc b/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc new file mode 100644 index 00000000000..4b630ceeae0 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/game/effect-control_REF.gc @@ -0,0 +1,1100 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *footstep-surface*, type object +(define *footstep-surface* (the-as object 7168)) + +;; definition for symbol *debug-effect-control*, type symbol +(define *debug-effect-control* #f) + +;; definition for function sound-name-with-material +(defun sound-name-with-material ((arg0 string) (arg1 pat-surface) (arg2 string)) + (format + (clear *temp-string*) + "~S~S~S" + arg0 + (-> (new 'static 'boxed-array :type string + "-unk" + "-ice" + "-qsd" + "-wtr" + "-tar" + "-san" + "-wod" + "-grs" + "-pmt" + "-snw" + "-dsn" + "-unk" + "-lav" + "-cwd" + "-grv" + "-drt" + "-mtl" + "-str" + "-pmt" + "-swm" + "-unk" + "-mtl" + "-neu" + "-stn" + "-cmt" + "-car" + "-gmt" + "-smt" + "-hwd" + "-sqi" + "-mhm" + "-for" + "-mhs" + "-dma" + ) + (-> arg1 material) + ) + arg2 + ) + (string->sound-name *temp-string*) + ) + +;; definition for function effect-param->sound-spec +(defun effect-param->sound-spec ((arg0 sound-spec) (arg1 (pointer float)) (arg2 int) (arg3 process-focusable)) + (while (> arg2 0) + (case (the int (-> arg1 0)) + ((3) + (logior! (-> arg0 mask) (sound-mask volume)) + (set! (-> arg0 volume) (the int (* 1024.0 (-> arg1 1)))) + ) + ((4) + (logior! (-> arg0 mask) (sound-mask volume)) + (+! (-> arg0 volume) (the int (* 1024.0 (* (-> arg1 1) (rand-vu))))) + ) + ((5) + (logior! (-> arg0 mask) (sound-mask pitch)) + (set! (-> arg0 pitch-mod) (the int (* 1524.0 (-> arg1 1)))) + ) + ((6) + (logior! (-> arg0 mask) (sound-mask pitch)) + (+! (-> arg0 pitch-mod) (the int (* 1524.0 (* (-> arg1 1) (rand-vu))))) + ) + ((9) + (logior! (-> arg0 mask) (sound-mask bend)) + (set! (-> arg0 bend) (the int (* 327.66998 (-> arg1 1)))) + ) + ((10) + (logior! (-> arg0 mask) (sound-mask bend)) + (+! (-> arg0 bend) (the int (* 327.66998 (* (-> arg1 1) (rand-vu))))) + ) + ((11) + (logior! (-> arg0 mask) (sound-mask fo-min)) + (set! (-> arg0 fo-min) (the int (-> arg1 1))) + ) + ((12) + (logior! (-> arg0 mask) (sound-mask fo-max)) + (set! (-> arg0 fo-max) (the int (-> arg1 1))) + ) + ((13) + (logior! (-> arg0 mask) (sound-mask fo-curve)) + (set! (-> arg0 fo-curve) (the int (-> arg1 1))) + ) + ((19) + (set! (-> arg0 priority) (the int (-> arg1 1))) + ) + ((25) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (shr (shl (the-as int *footstep-surface*) 48) 58))) + (let* ((s2-3 arg3) + (v1-33 (if (type? s2-3 process-focusable) + s2-3 + ) + ) + ) + (when v1-33 + (cond + ((focus-test? v1-33 in-air) + (set! (-> arg0 reg 0) (the-as uint 126)) + ) + ((focus-test? v1-33 touch-water) + (set! (-> arg0 reg 0) (the-as uint 127)) + ) + (else + (let* ((s2-4 (-> v1-33 root)) + (v1-34 (if (type? s2-4 collide-shape-moving) + s2-4 + ) + ) + ) + (if v1-34 + (set! (-> arg0 reg 0) (the-as uint (-> (the-as collide-shape-moving v1-34) ground-pat material))) + ) + ) + ) + ) + ) + ) + ) + ((21) + (logior! (-> arg0 mask) (sound-mask reg0)) + (set! (-> arg0 reg 0) (the-as uint (the int (-> arg1 1)))) + ) + ((22) + (logior! (-> arg0 mask) (sound-mask reg1)) + (set! (-> arg0 reg 1) (the-as uint (the int (-> arg1 1)))) + ) + ((23) + (logior! (-> arg0 mask) (sound-mask reg2)) + (set! (-> arg0 reg 2) (the-as uint (the int (-> arg1 1)))) + ) + ) + (+! arg2 -2) + (set! arg1 (&-> arg1 2)) + ) + arg0 + ) + +;; definition for method 9 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod effect-control-method-9 ((this effect-control)) + (let* ((a0-1 (-> this process skel)) + (v1-3 (if (< (the-as uint (-> this channel-offset)) (-> a0-1 active-channels)) + (-> a0-1 root-channel (-> this channel-offset)) + (the-as joint-control-channel #f) + ) + ) + ) + (cond + ((and v1-3 (-> v1-3 frame-group)) + (let* ((s5-0 (-> v1-3 frame-group)) + (f30-0 (+ (* (-> v1-3 frame-num) (-> s5-0 artist-step)) (-> s5-0 artist-base))) + ) + (let ((a0-3 (-> a0-1 root-channel 0 num-func))) + (cond + ((!= s5-0 (-> this last-frame-group)) + (set! (-> this res) (-> s5-0 extra)) + (let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo))) + (set! (-> this name) (if (>= (the-as int v1-6) 0) + (&-> (-> s5-0 extra tag) v1-6) + (the-as (pointer res-tag) #f) + ) + ) + ) + (if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) + (set! (-> this name) (&-> (-> this name) 1)) + ) + (play-effects-from-res-lump this f30-0 f30-0 f30-0) + ) + ((or (not (-> this name)) (= f30-0 (-> this last-frame-num))) + ) + (else + (let ((f28-0 (-> this last-frame-num)) + (f26-0 f30-0) + ) + (cond + ((= a0-3 num-func-seek!) + (let ((f0-6 (+ (* (-> v1-3 param 0) (-> s5-0 artist-step)) (-> s5-0 artist-base)))) + (cond + ((< f26-0 f28-0) + (if (>= f28-0 f0-6) + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + (else + (if (>= f0-6 f28-0) + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + ) + ) + ) + ) + ) + ((or (= a0-3 num-func-loop!) (= a0-3 num-func-loop-speedless!) (= a0-3 num-func-loop-set!)) + (cond + ((>= (-> v1-3 param 0) 0.0) + (cond + ((< f26-0 f28-0) + (play-effects-from-res-lump this f28-0 9999999.0 f30-0) + (play-effects-from-res-lump this -100000000.0 f26-0 9999999.0) + ) + (else + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + ) + ) + ) + ((< f28-0 f26-0) + (play-effects-from-res-lump this f26-0 9999999.0 f30-0) + (play-effects-from-res-lump this -100000000.0 f28-0 9999999.0) + ) + (else + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + ) + ((= a0-3 num-func-+!) + (if (>= (-> v1-3 param 0) 0.0) + (play-effects-from-res-lump this f28-0 f26-0 f30-0) + (play-effects-from-res-lump this f26-0 f28-0 f30-0) + ) + ) + ((= a0-3 num-func-identity) + (play-effects-from-res-lump this f30-0 f30-0 f30-0) + ) + ) + ) + ) + ) + ) + (set! (-> this last-frame-group) s5-0) + (set! (-> this last-frame-num) f30-0) + ) + ) + (else + (set! (-> this last-frame-group) #f) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 14 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod play-effects-from-res-lump ((this effect-control) (arg0 float) (arg1 float) (arg2 float)) + (let ((s2-0 (-> this name))) + (while (= (-> s2-0 0 name) 'effect-name) + (let ((f0-0 (-> s2-0 0 key-frame))) + (when (or (and (< f0-0 arg1) (< arg0 f0-0)) (= f0-0 arg2)) + (let* ((a0-1 this) + (t9-0 (method-of-object a0-1 do-effect)) + (v1-7 (-> this res)) + (a1-1 (-> s2-0 0)) + ) + (t9-0 + a0-1 + (the-as symbol (-> (the-as (pointer int32) (&+ (-> v1-7 data-base) (-> a1-1 data-offset))))) + f0-0 + -1 + ) + ) + ) + ) + (set! s2-0 (&-> s2-0 1)) + ) + ) + 0 + (none) + ) + +;; definition for method 10 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 10 effect-control) has a return type of none, but the expression builder found a return statement. +(defmethod do-effect ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int)) + (local-vars (sv-288 res-lump)) + (let* ((v1-2 (rtype-of arg0)) + (s3-0 (the-as string (cond + ((= v1-2 symbol) + (symbol->string arg0) + ) + ((= v1-2 string) + arg0 + ) + (else + #f + ) + ) + ) + ) + ) + (cond + ((logtest? (-> this flags) (effect-control-flag ecf2)) + (return #f) + ) + ((string= s3-0 "script") + (let ((gp-1 (get-property-struct + (-> this res) + 'effect-script + 'exact + arg1 + (the-as structure #f) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (script-eval (the-as pair gp-1)) + ) + (return #f) + ) + ) + (set! arg2 (cond + ((< arg2 0) + (let ((v0-7 (get-property-value + (-> this res) + 'effect-joint + 'exact + arg1 + (the-as uint128 0) + (the-as (pointer res-tag) #f) + *res-static-buf* + ) + ) + ) + (if (zero? v0-7) + 0 + (the-as int (+ v0-7 1)) + ) + ) + ) + (else + (empty) + arg2 + ) + ) + ) + (when (logtest? (-> this flags) (effect-control-flag ecf0)) + (if (send-event (-> this process) 'effect-control s3-0 arg1 arg2) + (return 0) + ) + ) + (cond + ((and (= (-> s3-0 data 0) 101) + (= (-> s3-0 data 1) 102) + (= (-> s3-0 data 2) 102) + (= (-> s3-0 data 3) 101) + (= (-> s3-0 data 4) 99) + (= (-> s3-0 data 5) 116) + (= (-> s3-0 data 6) 45) + ) + (let* ((s2-0 (-> this process root)) + (v1-38 (if (type? s2-0 collide-shape-moving) + s2-0 + ) + ) + (t1-2 (if v1-38 + (-> (the-as collide-shape-moving v1-38) ground-pat) + *footstep-surface* + ) + ) + ) + (do-effect-for-surface this (the-as symbol s3-0) arg1 arg2 (-> this res) (the-as pat-surface t1-2)) + ) + ) + ((and (= (-> s3-0 data 0) 103) + (= (-> s3-0 data 1) 114) + (= (-> s3-0 data 2) 111) + (= (-> s3-0 data 3) 117) + (= (-> s3-0 data 4) 112) + (= (-> s3-0 data 5) 45) + ) + (let ((s2-1 (lookup-part-group-by-name s3-0))) + (when (and (nonzero? s2-1) s2-1 (= (-> s2-1 type) sparticle-launch-group)) + (if *debug-effect-control* + (format + #t + "(~5D) effect group ~A ~A frame ~F joint ~D~%" + (current-time) + (-> this process name) + s3-0 + arg1 + arg2 + ) + ) + (cond + ((logtest? (-> s2-1 flags) (sp-group-flag sp13)) + (set! (-> *launch-matrix* trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (part-tracker-spawn part-tracker-subsampler :to (-> this process) :group s2-1) + ) + (else + (set! (-> *launch-matrix* trans quad) + (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad) + ) + (part-tracker-spawn part-tracker :to (-> this process) :group s2-1) + ) + ) + ) + ) + ) + ((and (= (-> s3-0 data 0) 101) + (= (-> s3-0 data 1) 118) + (= (-> s3-0 data 2) 101) + (= (-> s3-0 data 3) 110) + (= (-> s3-0 data 4) 116) + (= (-> s3-0 data 5) 45) + ) + (send-event (-> this process) (string->symbol s3-0) arg1 arg2) + ) + ((string= s3-0 "camera-shake") + (activate! *camera-smush-control* 819.2 15 75 1.0 0.9 (-> *display* camera-clock)) + ) + ((and (= (-> s3-0 data 0) 100) + (= (-> s3-0 data 1) 101) + (= (-> s3-0 data 2) 97) + (= (-> s3-0 data 3) 116) + (= (-> s3-0 data 4) 104) + (= (-> s3-0 data 5) 45) + ) + (let ((s3-1 (-> (string->symbol s3-0) value))) + (when (and (logtest? (-> this flags) (effect-control-flag ecf1)) + (zero? (-> this process draw death-timer)) + (= (-> (the-as death-info s3-1) type) death-info) + ) + (let ((v1-131 (-> this process draw))) + (let ((a1-25 (-> (the-as death-info s3-1) vertex-skip)) + (a0-59 + (max + 2 + (the-as int (/ (-> (the-as death-info s3-1) timer) (the-as uint (the int (-> *display* time-factor))))) + ) + ) + ) + (when (= (-> *setting-control* user-current video-mode) 'pal) + (if (< (the-as uint 1) a1-25) + (set! a1-25 (/ (the-as uint (* (the-as uint 50) a1-25)) (the-as uint 60))) + ) + ) + (let ((a2-29 (-> *display* frames (-> *display* last-screen) run-time))) + (cond + ((< 9000 (the-as int a2-29)) + (set! a1-25 (* a1-25 4)) + ) + ((< 7000 (the-as int a2-29)) + (set! a1-25 (* a1-25 2)) + ) + ) + ) + (set! (-> v1-131 death-vertex-skip) a1-25) + (set! (-> v1-131 death-effect) (-> (the-as death-info s3-1) effect)) + (set! (-> v1-131 death-timer) (the-as uint (+ a0-59 1))) + ) + (set! (-> v1-131 death-timer-org) (-> v1-131 death-timer)) + (set! (-> v1-131 death-draw-overlap) (-> (the-as death-info s3-1) overlap)) + ) + (when (-> (the-as death-info s3-1) sound) + (let* ((s2-3 this) + (s1-0 (method-of-object s2-3 play-effect-sound)) + (s0-0 (-> (the-as death-info s3-1) sound)) + ) + (set! sv-288 (-> this res)) + (let ((t1-5 (string->sound-name (the-as string (-> (the-as death-info s3-1) sound))))) + (s1-0 s2-3 s0-0 arg1 arg2 sv-288 t1-5) + ) + ) + ) + (send-event (-> this process) 'death-start (the-as death-info s3-1)) + ) + ) + ) + (else + (play-effect-sound this (the-as symbol s3-0) arg1 arg2 (-> this res) (string->sound-name s3-0)) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 11 of type effect-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod do-effect-for-surface ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface)) + (local-vars + (sv-64 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-80 sparticle-system) + (sv-96 vector) + (sv-112 matrix) + (sv-128 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-144 sparticle-system) + (sv-160 vector) + (sv-176 matrix) + (sv-192 symbol) + (sv-208 + (function sparticle-system sparticle-launcher matrix sparticle-launch-state sparticle-launch-control float none) + ) + (sv-224 sparticle-system) + (sv-240 vector) + (sv-256 matrix) + ) + (let ((s1-0 (the-as sound-name #f))) + (-> *display* frames (-> *display* last-screen) run-time) + (set! sv-192 arg0) + (cond + ((string= (the-as string sv-192) "effect-walk-step-left") + (set! s1-0 (sound-name-with-material "walk" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-run-step-left") + (set! s1-0 (sound-name-with-material "run" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-mech-step-left") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "1")) + ) + ((string= (the-as string sv-192) "effect-walk-step-right") + (set! s1-0 (sound-name-with-material "walk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-run-step-right") + (set! s1-0 (sound-name-with-material "run" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-mech-step-right") + (set! s1-0 (sound-name-with-material "mwlk" arg4 "2")) + ) + ((string= (the-as string sv-192) "effect-roll") + (set! s1-0 (sound-name-with-material "roll" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-slide") + (set! s1-0 (sound-name-with-material "slide" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land") + (set! s1-0 (sound-name-with-material "land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-land") + (set! s1-0 (sound-name-with-material "zoom-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-zoom-hit") + (set! s1-0 (sound-name-with-material "zoom-hit" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-flut-land") + (set! s1-0 (sound-name-with-material "flut-land" arg4 "")) + ) + ((string= (the-as string sv-192) "effect-land-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-land-poof-unk" + "group-land-poof-ice" + "group-land-poof-qsd" + "group-land-poof-wtr" + "group-land-poof-tar" + "group-land-poof-san" + "group-land-poof-wod" + "group-land-poof-grs" + "group-land-poof-pmt" + "group-land-poof-snw" + "group-land-poof-dsn" + "group-land-poof-unk" + "group-land-poof-lav" + "group-land-poof-cwd" + "group-land-poof-grv" + "group-land-poof-drt" + "group-land-poof-mtl" + "group-land-poof-str" + "group-land-poof-pmt" + "group-land-poof-swm" + "group-land-poof-unk" + "group-land-poof-mtl" + "group-land-poof-neu" + "group-land-poof-stn" + "group-land-poof-cmt" + "group-land-poof-car" + "group-land-poof-gmt" + "group-land-poof-smt" + "group-land-poof-hwd" + "group-land-poof-sqi" + "group-land-poof-mhm" + "group-land-poof-for" + "group-land-poof-mhs" + "group-land-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-run-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-run-poof-unk" + "group-run-poof-ice" + "group-run-poof-qsd" + "group-run-poof-wtr" + "group-run-poof-tar" + "group-run-poof-san" + "group-run-poof-wod" + "group-run-poof-grs" + "group-run-poof-pmt" + "group-run-poof-snw" + "group-run-poof-dsn" + "group-run-poof-unk" + "group-run-poof-lav" + "group-run-poof-cwd" + "group-run-poof-grv" + "group-run-poof-drt" + "group-run-poof-mtl" + "group-run-poof-str" + "group-run-poof-pmt" + "group-run-poof-swm" + "group-run-poof-unk" + "group-run-poof-mtl" + "group-run-poof-neu" + "group-run-poof-stn" + "group-run-poof-cmt" + "group-run-poof-car" + "group-run-poof-gmt" + "group-run-poof-smt" + "group-run-poof-hwd" + "group-run-poof-sqi" + "group-run-poof-mhm" + "group-run-poof-for" + "group-run-poof-mhs" + "group-run-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-footprint") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-just-footprint-unk" + "group-just-footprint-ice" + "group-just-footprint-qsd" + "group-just-footprint-wtr" + "group-just-footprint-tar" + "group-just-footprint-san" + "group-just-footprint-wod" + "group-just-footprint-grs" + "group-just-footprint-pmt" + "group-just-footprint-snw" + "group-just-footprint-dsn" + "group-just-footprint-unk" + "group-just-footprint-lav" + "group-just-footprint-cwd" + "group-just-footprint-grv" + "group-just-footprint-drt" + "group-just-footprint-mtl" + "group-just-footprint-str" + "group-just-footprint-pmt" + "group-just-footprint-swm" + "group-just-footprint-unk" + "group-just-footprint-mtl" + "group-just-footprint-neu" + "group-just-footprint-stn" + "group-just-footprint-cmt" + "group-just-footprint-car" + "group-just-footprint-gmt" + "group-just-footprint-smt" + "group-just-footprint-hwd" + "group-just-footprint-sqi" + "group-just-footprint-mhm" + "group-just-footprint-for" + "group-just-footprint-mhs" + "group-just-footprint-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-just-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-just-poof-unk" + "group-just-poof-ice" + "group-just-poof-qsd" + "group-just-poof-wtr" + "group-just-poof-tar" + "group-just-poof-san" + "group-just-poof-wod" + "group-just-poof-grs" + "group-just-poof-pmt" + "group-just-poof-snw" + "group-just-poof-dsn" + "group-just-poof-unk" + "group-just-poof-lav" + "group-just-poof-cwd" + "group-just-poof-grv" + "group-just-poof-drt" + "group-just-poof-mtl" + "group-just-poof-str" + "group-just-poof-pmt" + "group-just-poof-swm" + "group-just-poof-unk" + "group-just-poof-mtl" + "group-just-poof-neu" + "group-just-poof-stn" + "group-just-poof-cmt" + "group-just-poof-car" + "group-just-poof-gmt" + "group-just-poof-smt" + "group-just-poof-hwd" + "group-just-poof-sqi" + "group-just-poof-mhm" + "group-just-poof-for" + "group-just-poof-mhs" + "group-just-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-slide-poof") + (do-effect + this + (the-as symbol (-> (new 'static 'boxed-array :type string + "group-slide-poof-unk" + "group-slide-poof-ice" + "group-slide-poof-qsd" + "group-slide-poof-wtr" + "group-slide-poof-tar" + "group-slide-poof-san" + "group-slide-poof-wod" + "group-slide-poof-grs" + "group-slide-poof-pmt" + "group-slide-poof-snw" + "group-slide-poof-dsn" + "group-slide-poof-unk" + "group-slide-poof-lav" + "group-slide-poof-cwd" + "group-slide-poof-grv" + "group-slide-poof-drt" + "group-slide-poof-mtl" + "group-slide-poof-str" + "group-slide-poof-pmt" + "group-slide-poof-swm" + "group-slide-poof-unk" + "group-slide-poof-mtl" + "group-slide-poof-neu" + "group-slide-poof-stn" + "group-slide-poof-cmt" + "group-slide-poof-car" + "group-slide-poof-gmt" + "group-slide-poof-smt" + "group-slide-poof-hwd" + "group-slide-poof-sqi" + "group-slide-poof-mhm" + "group-slide-poof-for" + "group-slide-poof-mhs" + "group-slide-poof-dma" + ) + (-> arg4 material) + ) + ) + arg1 + -1 + ) + ) + ((string= (the-as string sv-192) "effect-droppings") + (let ((s0-1 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x8e + #x2a9 + #x2aa + #x2ab + #x2ac + #x75 + #x8b + #x77 + #x2ad + #x79 + #x2ae + #x8e + #x2af + #x8d + #x2b0 + #x76 + #x2b1 + #x2b2 + #x2ad + #x2b3 + #x8e + #x2b1 + #x2b4 + #x8c + #x2b5 + #x2b6 + #x2b7 + #x2b8 + #x2b9 + #x2ba + #x2bb + #x78 + #x2bc + #x2bd + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-1) + (set! sv-64 sp-launch-particles-var) + (set! sv-80 *sp-particle-system-2d*) + (set! sv-112 *launch-matrix*) + (set! sv-96 (-> sv-112 trans)) + (let ((v1-80 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-96 quad) v1-80) + ) + (let ((a3-6 #f) + (t0-1 #f) + (t1-1 1.0) + ) + (sv-64 sv-80 s0-1 sv-112 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1) + ) + ) + ) + ) + ((string= (the-as string sv-192) "effect-jump-droppings") + (let ((s0-2 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2be + #x2bf + #x2c0 + #x2c1 + #x2c2 + #x86 + #x2c3 + #x89 + #x2c4 + #x88 + #x2c5 + #x2be + #x2c6 + #x2c7 + #x2c8 + #x87 + #x2c9 + #x2ca + #x2c4 + #x2cb + #x2be + #x2c9 + #x2cc + #x2cd + #x2ce + #x2cf + #x2d0 + #x2d1 + #x2d2 + #x2d3 + #x2d4 + #x8a + #x2d5 + #x2d6 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-2) + (set! sv-128 sp-launch-particles-var) + (set! sv-144 *sp-particle-system-2d*) + (set! sv-176 *launch-matrix*) + (set! sv-160 (-> sv-176 trans)) + (let ((v1-97 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-160 quad) v1-97) + ) + (let ((a3-7 #f) + (t0-2 #f) + (t1-2 1.0) + ) + (sv-128 sv-144 s0-2 sv-176 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2) + ) + ) + ) + ) + ((let ((t9-40 string=) + (a1-45 "effect-board-poof") + ) + (t9-40 (the-as string sv-192) a1-45) + ) + (let ((s0-3 (-> *part-id-table* (-> (new 'static 'boxed-array :type uint32 + #x2d7 + #x2d8 + #x2d9 + #x2da + #x2db + #x2dc + #x2dd + #x2de + #x2df + #x2e0 + #x2e1 + #x2d7 + #x2e2 + #x2e3 + #x2e4 + #x2e5 + #x2e6 + #x2e7 + #x2df + #x2e8 + #x2d7 + #x2e6 + #x2e9 + #x2a2 + #x2ea + #x2eb + #x2ec + #x2ed + #x2ee + #x2ef + #x2f0 + #x2f1 + #x2f2 + #x2f3 + ) + (-> arg4 material) + ) + ) + ) + ) + (when (nonzero? s0-3) + (set! sv-208 sp-launch-particles-var) + (set! sv-224 *sp-particle-system-2d*) + (set! sv-256 *launch-matrix*) + (set! sv-240 (-> sv-256 trans)) + (let ((v1-114 (-> (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) quad))) + (set! (-> sv-240 quad) v1-114) + ) + (let ((a3-8 #f) + (t0-3 #f) + (t1-3 1.0) + ) + (sv-208 sv-224 s0-3 sv-256 (the-as sparticle-launch-state a3-8) (the-as sparticle-launch-control t0-3) t1-3) + ) + ) + ) + ) + ) + (if s1-0 + (play-effect-sound this arg0 arg1 arg2 arg3 s1-0) + ) + ) + 0 + (none) + ) + +;; definition for method 12 of type effect-control +;; INFO: Used lq/sq +(defmethod play-effect-sound ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name)) + (local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float))) + (set! sv-144 arg3) + (let ((s0-0 arg4) + (gp-0 (the-as object (new 'stack 'sound-spec))) + (s5-0 (if (< arg2 0) + (the-as vector #f) + (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)) + ) + ) + ) + (set! (-> (the-as sound-spec gp-0) sound-name) s0-0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask volume)) + (set! (-> (the-as sound-spec gp-0) pitch-mod) 0) + (set! (-> (the-as sound-spec gp-0) volume) 1024) + (set! sv-112 (new 'static 'res-tag)) + (let* ((t9-2 (method-of-type res-lump get-property-data)) + (a1-5 'effect-param) + (a2-1 'exact) + (a3-1 arg1) + (t0-1 #f) + (t1-1 (the-as (pointer res-tag) (& sv-112))) + (t2-0 *res-static-buf*) + (a1-6 (t9-2 (the-as res-lump sv-144) a1-5 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)) + ) + (when a1-6 + (effect-param->sound-spec + (the-as sound-spec gp-0) + (the-as (pointer float) a1-6) + (the-as int (-> sv-112 elt-count)) + (the-as process-focusable (-> this process)) + ) + (if (logtest? (-> (the-as sound-spec gp-0) mask) (sound-mask unk)) + (return 0) + ) + ) + ) + (let ((f0-0 (-> *setting-control* user-current under-water-pitch-mod))) + (when (!= f0-0 0.0) + (logior! (-> (the-as sound-spec gp-0) mask) (sound-mask pitch)) + (let ((f0-1 (* 2.0 f0-0))) + (set! (-> (the-as sound-spec gp-0) pitch-mod) + (- (-> (the-as sound-spec gp-0) pitch-mod) (the int (* 1524.0 f0-1))) + ) + ) + ) + ) + (if (or (and (nonzero? (-> (the-as sound-spec gp-0) fo-max)) + (let ((f30-0 (* 4096.0 (the float (-> (the-as sound-spec gp-0) fo-max))))) + (set! sv-160 vector-vector-distance) + (let ((a0-8 (ear-trans 0)) + (a1-7 s5-0) + ) + (< f30-0 (sv-160 a0-8 a1-7)) + ) + ) + ) + (= (-> (the-as (pointer int8) gp-0) 9) 126) + ) + (return 0) + ) + (when *debug-effect-control* + (set! sv-128 s0-0) + (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))) + (format + #t + "(~5D) effect sound ~A ~S (~S) frame ~F joint ~D " + (current-time) + (-> this process name) + arg0 + *temp-string* + arg1 + arg2 + ) + (format + #t + "volume: ~f pitch-mod: ~f~%" + (* 0.09765625 (the float (-> (the-as sound-spec gp-0) volume))) + (* 0.000656168 (the float (-> (the-as sound-spec gp-0) pitch-mod))) + ) + ) + (sound-play-by-spec (the-as sound-spec gp-0) (new-sound-id) s5-0) + ) + 0 + ) + +;; definition for function target-land-effect +;; WARN: Return type mismatch int vs none. +(defbehavior target-land-effect target () + (cond + ((focus-test? self flut) + (do-effect (-> self skel effect) (the-as symbol "effect-land-poof") -1.0 -1) + (do-effect (-> self skel effect) (the-as symbol "effect-flut-land") -1.0 -1) + ) + ((focus-test? self pilot) + (sound-play-by-name + (sound-name-with-material "zoom-land" (-> self control ground-pat) "") + (new-sound-id) + (the int (* 1024.0 (* 0.000016276043 (-> self control ground-impact-vel)))) + 0 + 0 + (sound-group) + #t + ) + ) + ((logtest? (water-flag touch-water) (-> self water flags)) + (do-effect (-> self skel effect) (the-as symbol "effect-land-water") -1.0 -1) + ) + (else + (do-effect (-> self skel effect) (the-as symbol "effect-land-poof") -1.0 -1) + (do-effect (-> self skel effect) (the-as symbol "effect-land") -1.0 -1) + ) + ) + 0 + (none) + ) diff --git a/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc b/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc index 69e567b4b08..7fbf32c7571 100644 --- a/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/game/fact-h_REF.gc @@ -679,7 +679,7 @@ (trig-mask uint8 2) ) (:methods - (new (symbol type process (pointer float) pickup-type float) _type_) + (new (symbol type process (pointer float)) _type_) (clear-mask-bits (_type_ int) none) ) ) @@ -1086,13 +1086,7 @@ ;; definition for method 0 of type fact-info-enemy ;; INFO: Used lq/sq -(defmethod new fact-info-enemy ((allocation symbol) - (type-to-make type) - (arg0 process) - (arg1 (pointer float)) - (arg2 pickup-type) - (arg3 float) - ) +(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (arg0 process) (arg1 (pointer float))) (local-vars (sv-16 res-tag) (sv-32 res-tag)) (let ((gp-0 (the-as diff --git a/test/decompiler/reference/jak3/engine/game/idle-control_REF.gc b/test/decompiler/reference/jak3/engine/game/idle-control_REF.gc new file mode 100644 index 00000000000..f2288b5b599 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/game/idle-control_REF.gc @@ -0,0 +1,168 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type idle-control-frame +(deftype idle-control-frame (structure) + ((command idle-control-cmd) + (anim uint32) + (param0 int32) + (param1 int32) + (param2 pair) + ) + ) + +;; definition for method 3 of type idle-control-frame +(defmethod inspect ((this idle-control-frame)) + (when (not this) + (set! this this) + (goto cfg-11) + ) + (format #t "[~8x] ~A~%" this 'idle-control-frame) + (let ((t9-1 format) + (a0-2 #t) + (a1-1 "~1Tcommand: #x~X : ~S~%") + (a2-1 (-> this command)) + (v1-2 (-> this command)) + ) + (t9-1 a0-2 a1-1 a2-1 (cond + ((= v1-2 (idle-control-cmd play)) + "play" + ) + ((= v1-2 (idle-control-cmd push)) + "push" + ) + ((= v1-2 (idle-control-cmd reset)) + "restart" + ) + (else + "*unknown*" + ) + ) + ) + ) + (format #t "~1Tanim: ~D~%" (-> this anim)) + (format #t "~1Tparam0: ~D~%" (-> this param0)) + (format #t "~1Tparam1: ~D~%" (-> this param1)) + (format #t "~1Tparam2: ~A~%" (-> this param2)) + (label cfg-11) + this + ) + +;; definition of type idle-control +(deftype idle-control (structure) + ((anim (inline-array idle-control-frame)) + (anim-speed float) + (current-index int32) + (counter int32) + (target int32) + ) + (:methods + (init! (_type_ (inline-array idle-control-frame)) none) + (play-idle-frames! (_type_ process-drawable) none :behavior process-drawable) + ) + ) + +;; definition for method 3 of type idle-control +(defmethod inspect ((this idle-control)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'idle-control) + (format #t "~1Tanim: #x~X~%" (-> this anim)) + (format #t "~1Tanim-speed: ~f~%" (-> this anim-speed)) + (format #t "~1Tcurrent-index: ~D~%" (-> this current-index)) + (format #t "~1Tcounter: ~D~%" (-> this counter)) + (format #t "~1Ttarget: ~D~%" (-> this target)) + (label cfg-4) + this + ) + +;; definition for method 9 of type idle-control +;; WARN: Return type mismatch idle-control vs none. +(defmethod init! ((this idle-control) (arg0 (inline-array idle-control-frame))) + "Initialize this [[idle-control]]." + (set! (-> this anim) arg0) + (set! (-> this anim-speed) 0.0) + (set! (-> this current-index) 0) + (set! (-> this counter) 0) + (set! (-> this target) 0) + (none) + ) + +;; definition for method 10 of type idle-control +;; WARN: Return type mismatch int vs none. +;; WARN: Function (method 10 idle-control) has a return type of none, but the expression builder found a return statement. +(defmethod play-idle-frames! ((this idle-control) (arg0 process-drawable)) + "Set the process pointer to the given [[process-drawable]] and run the idle frames for it." + (when (nonzero? (-> this anim)) + (let ((s5-0 self)) + (set! self arg0) + (loop + (let ((s4-0 (-> this anim (-> this current-index)))) + (case (-> s4-0 command) + (((idle-control-cmd play)) + (if (< (-> s4-0 anim) 0) + (return #f) + ) + (when (zero? (-> this target)) + (set! (-> this target) (rand-vu-int-range (-> s4-0 param0) (-> s4-0 param1))) + (set! (-> this anim-speed) + (rand-vu-float-range + (command-get-float (-> s4-0 param2 car) 0.0) + (command-get-float (-> (the-as pair (-> s4-0 param2 cdr)) car) 0.0) + ) + ) + (ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) :num! min) + (return #f) + ) + (ja :group! (-> (the-as process-drawable self) draw art-group data (-> s4-0 anim)) + :num! (seek! max (-> this anim-speed)) + ) + (cond + ((ja-done? 0) + (+! (-> this counter) 1) + (cond + ((>= (-> this counter) (-> this target)) + (+! (-> this current-index) 1) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + (else + (ja :num-func num-func-identity :frame-num 0.0) + (return #f) + ) + ) + ) + (else + (return #f) + ) + ) + ) + (((idle-control-cmd push)) + (ja-channel-push! 1 (the-as time-frame (-> s4-0 param0))) + (+! (-> this current-index) 1) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + (((idle-control-cmd reset)) + (set! (-> this current-index) 0) + (set! (-> this counter) 0) + (set! (-> this target) 0) + 0 + ) + ) + ) + ) + (set! self s5-0) + ) + ) + 0 + (none) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc index bfb1a3e634c..e084c68690f 100644 --- a/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/geometry/path-h_REF.gc @@ -26,7 +26,7 @@ These path-controls are typically allocated on a process heap." (path-control-method-15 () none) (displacement-between-points-at-percent-normalized! (_type_ vector float) vector) (get-num-segments (_type_) float) - (path-control-method-18 () none) + (total-distance (_type_) float) (get-num-verts (_type_) int) (segement-duration->path-duration (_type_ float) float) (path-duration->segment-duration (_type_ float) float) diff --git a/test/decompiler/reference/jak3/engine/gfx/foreground/shadow-cpu-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/foreground/shadow-cpu-h_REF.gc index 4862b7caa8f..a9f0cfeb6a2 100644 --- a/test/decompiler/reference/jak3/engine/gfx/foreground/shadow-cpu-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/foreground/shadow-cpu-h_REF.gc @@ -44,7 +44,7 @@ ((settings shadow-settings :inline) ) (:methods - (new (symbol type float float float vector float float) _type_) + (new (symbol type float float float vector shadow-flags float) _type_) (enable-draw (shadow-control) int) (disable-draw (shadow-control) int) (set-top-plane-offset (shadow-control float) int) @@ -480,14 +480,14 @@ (arg1 float) (arg2 float) (arg3 vector) - (arg4 float) + (arg4 shadow-flags) (arg5 float) ) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) (if arg3 (set! (-> v0-0 settings center quad) (-> arg3 quad)) ) - (set! (-> v0-0 settings flags) (the-as shadow-flags arg4)) + (set! (-> v0-0 settings flags) arg4) (set-vector! (-> v0-0 settings shadow-dir) 0.0 -1.0 0.0 arg2) (set-vector! (-> v0-0 settings bot-plane) 0.0 1.0 0.0 (- arg0)) (set-vector! (-> v0-0 settings top-plane) 0.0 1.0 0.0 (- arg1)) @@ -508,7 +508,3 @@ ;; definition for symbol *shadow-dma-buf*, type dma-buffer (define *shadow-dma-buf* (new 'global 'dma-buffer 512)) - - - - diff --git a/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc b/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc index e87de788035..959c3b2c857 100644 --- a/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/gfx/mood/time-of-day-h_REF.gc @@ -76,8 +76,8 @@ and the code in mood.gc, which set the actual fade values for time-of-day." (moon-count int32) (moon sparticle-launch-control) (day-star-count int32) - (day-star basic) - (day-star-enable basic) + (day-star sparticle-launch-control) + (day-star-enable symbol) (start-timer int32) ) ) @@ -251,7 +251,3 @@ blend between them." ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/level/level-h_REF.gc b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc index 5c3c7d47160..759daf17ddd 100644 --- a/test/decompiler/reference/jak3/engine/level/level-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/level/level-h_REF.gc @@ -454,7 +454,7 @@ (debug-print-region-splitbox (_type_ vector object) none) (get-art-group-by-name (_type_ string) art-group) (level-method-22 () none) - (level-method-23 () none) + (lookup-text (_type_ text-id symbol) string) (level-method-24 () none) (birth (_type_) _type_) (level-status-update! (_type_ symbol) _type_) diff --git a/test/decompiler/reference/jak3/engine/math/matrix-compose_REF.gc b/test/decompiler/reference/jak3/engine/math/matrix-compose_REF.gc index 1d5ae3aeb3b..e87e1ccbe34 100644 --- a/test/decompiler/reference/jak3/engine/math/matrix-compose_REF.gc +++ b/test/decompiler/reference/jak3/engine/math/matrix-compose_REF.gc @@ -59,7 +59,7 @@ ;; definition for function matrix-u-f-compose ;; INFO: Used lq/sq -(defun matrix-u-f-compose ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 vector)) +(defun matrix-u-f-compose ((arg0 matrix) (arg1 vector) (arg2 vector)) (set! (-> arg0 uvec quad) (-> arg1 quad)) (vector-cross! (-> arg0 rvec) arg1 arg2) (vector-normalize! (-> arg0 rvec) 1.0) @@ -112,7 +112,7 @@ (defun matrix-u-compose ((arg0 matrix) (arg1 vector) (arg2 vector) (arg3 vector)) (set! (-> arg0 uvec quad) (-> arg1 quad)) (let ((a2-1 (vector-get-unique! (new 'stack-no-clear 'vector) arg1))) - (matrix-u-f-compose arg0 arg1 a2-1 arg3) + (matrix-u-f-compose arg0 arg1 a2-1) ) arg0 ) @@ -126,7 +126,3 @@ ) arg0 ) - - - - diff --git a/test/decompiler/reference/jak3/engine/nav/nav-control-h_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-control-h_REF.gc index f647b66b17f..d370f241308 100644 --- a/test/decompiler/reference/jak3/engine/nav/nav-control-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/nav/nav-control-h_REF.gc @@ -142,13 +142,13 @@ (nav-state-method-31 () none) (nav-state-method-32 () none) (nav-state-method-33 () none) - (nav-state-method-34 () none) + (navigate-v1! (_type_) none) (nav-state-method-35 () none) (nav-state-method-36 () none) (nav-state-method-37 () none) (nav-state-method-38 () none) (nav-state-method-39 () none) - (nav-state-method-40 () none) + (do-navigation-to-destination (_type_ vector) none) (nav-state-method-41 () none) (nav-state-method-42 () none) (nav-state-method-43 () none) @@ -281,7 +281,7 @@ (nav-control-method-9 () none) (nav-control-method-10 () none) (find-poly-containing-point-1 (_type_ vector) nav-poly) - (nav-control-method-12 () none) + (cloest-point-on-mesh (_type_ vector vector nav-poly) nav-poly) (nav-control-method-13 () none) (nav-control-method-14 () none) (nav-control-method-15 () none) diff --git a/test/decompiler/reference/jak3/engine/nav/nav-enemy-h_REF.gc b/test/decompiler/reference/jak3/engine/nav/nav-enemy-h_REF.gc new file mode 100644 index 00000000000..069278a2217 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/nav/nav-enemy-h_REF.gc @@ -0,0 +1,254 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type nav-enemy-info +(deftype nav-enemy-info (enemy-info) + ((callback-info nav-callback-info) + (use-momentum symbol) + (use-frustration symbol) + (use-stop-chase symbol) + (use-circling symbol) + (use-pacing symbol) + (walk-anim int32) + (turn-anim int32) + (run-anim int32) + (taunt-anim int32) + (run-travel-speed meters) + (run-acceleration meters) + (run-turning-acceleration meters) + (walk-travel-speed meters) + (walk-acceleration meters) + (walk-turning-acceleration meters) + (maximum-rotation-rate degrees) + (notice-nav-radius meters) + (frustration-distance meters) + (frustration-time time-frame) + (blocked-time time-frame) + (circle-dist-lo float) + (circle-dist-hi float) + (nav-mesh nav-mesh) + ) + (:methods + (copy! (_type_ nav-enemy-info) none) + ) + ) + +;; definition for method 3 of type nav-enemy-info +;; INFO: Used lq/sq +(defmethod inspect ((this nav-enemy-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tfact-defaults: ~A~%" (-> this fact-defaults)) + (format #t "~1Tuse-die-falling: ~A~%" (-> this use-die-falling)) + (format #t "~1Tuse-victory: ~A~%" (-> this use-victory)) + (format #t "~1Tuse-jump-blocked: ~A~%" (-> this use-jump-blocked)) + (format #t "~1Tdebug-draw-neck: ~A~%" (-> this debug-draw-neck)) + (format #t "~1Tjump-debug-draw: ~A~%" (-> this jump-debug-draw)) + (format #t "~1Tmove-to-ground: ~A~%" (-> this move-to-ground)) + (format #t "~1Thover-if-no-ground: ~A~%" (-> this hover-if-no-ground)) + (format #t "~1Tidle-anim-script: #x~X~%" (-> this idle-anim-script)) + (format #t "~1Tidle-anim: ~D~%" (-> this idle-anim)) + (format #t "~1Tnotice-anim: ~D~%" (-> this notice-anim)) + (format #t "~1Thostile-anim: ~D~%" (-> this hostile-anim)) + (format #t "~1Thit-anim: ~D~%" (-> this hit-anim)) + (format #t "~1Tknocked-anim: ~D~%" (-> this knocked-anim)) + (format #t "~1Tknocked-land-anim: ~D~%" (-> this knocked-land-anim)) + (format #t "~1Tdie-anim: ~D~%" (-> this die-anim)) + (format #t "~1Tdie-falling-anim: ~D~%" (-> this die-falling-anim)) + (format #t "~1Tvictory-anim: ~D~%" (-> this victory-anim)) + (format #t "~1Tjump-wind-up-anim: ~D~%" (-> this jump-wind-up-anim)) + (format #t "~1Tjump-in-air-anim: ~D~%" (-> this jump-in-air-anim)) + (format #t "~1Tjump-land-anim: ~D~%" (-> this jump-land-anim)) + (format #t "~1Tneck-joint: ~D~%" (-> this neck-joint)) + (format #t "~1Tlook-at-joint: ~D~%" (-> this look-at-joint)) + (format #t "~1Tbullseye-joint: ~D~%" (-> this bullseye-joint)) + (format #t "~1Tsound-hit: ~D~%" (-> this sound-hit)) + (format #t "~1Tsound-die: ~D~%" (-> this sound-die)) + (format #t "~1Tnotice-distance: (meters ~m)~%" (-> this notice-distance)) + (format #t "~1Tnotice-distance-delta: (meters ~m)~%" (-> this notice-distance-delta)) + (format #t "~1Tproximity-notice-distance: (meters ~m)~%" (-> this proximity-notice-distance)) + (format #t "~1Tdefault-hit-points: ~f~%" (-> this default-hit-points)) + (format #t "~1Tgnd-collide-with: ~D~%" (-> this gnd-collide-with)) + (format #t "~1Toverlaps-others-collide-with-filter: ~D~%" (-> this overlaps-others-collide-with-filter)) + (format #t "~1Tpenetrate-flinch: ~D~%" (-> this penetrate-flinch)) + (format #t "~1Tpenetrate-knocked: ~D~%" (-> this penetrate-knocked)) + (format #t "~1Tmovement-gravity: (meters ~m)~%" (-> this movement-gravity)) + (format #t "~1Tfriction: ~f~%" (-> this friction)) + (format #t "~1Tslip-factor: ~f~%" (-> this slip-factor)) + (format #t "~1Tattack-shove-back: (meters ~m)~%" (-> this attack-shove-back)) + (format #t "~1Tattack-shove-up: (meters ~m)~%" (-> this attack-shove-up)) + (format #t "~1Tattack-mode: ~A~%" (-> this attack-mode)) + (format #t "~1Tattack-damage: ~D~%" (-> this attack-damage)) + (format #t "~1Trecover-gnd-collide-with: ~D~%" (-> this recover-gnd-collide-with)) + (format #t "~1Tknocked-can-land-timeout: ~D~%" (-> this knocked-can-land-timeout)) + (format #t "~1Tknocked-recover-timeout: ~D~%" (-> this knocked-recover-timeout)) + (format #t "~1Tragdoll-blend-out-time: ~D~%" (-> this ragdoll-blend-out-time)) + (format #t "~1Tragdoll-rotate-velocity-mult: ~f~%" (-> this ragdoll-rotate-velocity-mult)) + (format #t "~1Tjump-height-min: (meters ~m)~%" (-> this jump-height-min)) + (format #t "~1Tjump-height-factor: ~f~%" (-> this jump-height-factor)) + (format #t "~1Tknocked-seek-ry-clamp: ~f~%" (-> this knocked-seek-ry-clamp)) + (format #t "~1Tknocked-soft-vxz-lo: ~f~%" (-> this knocked-soft-vxz-lo)) + (format #t "~1Tknocked-soft-vxz-hi: ~f~%" (-> this knocked-soft-vxz-hi)) + (format #t "~1Tknocked-soft-vy-lo: ~f~%" (-> this knocked-soft-vy-lo)) + (format #t "~1Tknocked-soft-vy-hi: ~f~%" (-> this knocked-soft-vy-hi)) + (format #t "~1Tknocked-medium-vxz-lo: ~f~%" (-> this knocked-medium-vxz-lo)) + (format #t "~1Tknocked-medium-vxz-hi: ~f~%" (-> this knocked-medium-vxz-hi)) + (format #t "~1Tknocked-medium-vy-lo: ~f~%" (-> this knocked-medium-vy-lo)) + (format #t "~1Tknocked-medium-vy-hi: ~f~%" (-> this knocked-medium-vy-hi)) + (format #t "~1Tknocked-hard-vxz-lo: ~f~%" (-> this knocked-hard-vxz-lo)) + (format #t "~1Tknocked-hard-vxz-hi: ~f~%" (-> this knocked-hard-vxz-hi)) + (format #t "~1Tknocked-hard-vy-lo: ~f~%" (-> this knocked-hard-vy-lo)) + (format #t "~1Tknocked-hard-vy-hi: ~f~%" (-> this knocked-hard-vy-hi)) + (format #t "~1Tknocked-huge-vxz-lo: ~f~%" (-> this knocked-huge-vxz-lo)) + (format #t "~1Tknocked-huge-vxz-hi: ~f~%" (-> this knocked-huge-vxz-hi)) + (format #t "~1Tknocked-huge-vy-lo: ~f~%" (-> this knocked-huge-vy-lo)) + (format #t "~1Tknocked-huge-vy-hi: ~f~%" (-> this knocked-huge-vy-hi)) + (format #t "~1Tknocked-yellow-vxz-lo: ~f~%" (-> this knocked-yellow-vxz-lo)) + (format #t "~1Tknocked-yellow-vxz-hi: ~f~%" (-> this knocked-yellow-vxz-hi)) + (format #t "~1Tknocked-yellow-vy-lo: ~f~%" (-> this knocked-yellow-vy-lo)) + (format #t "~1Tknocked-yellow-vy-hi: ~f~%" (-> this knocked-yellow-vy-hi)) + (format #t "~1Tknocked-red-vxz-lo: ~f~%" (-> this knocked-red-vxz-lo)) + (format #t "~1Tknocked-red-vxz-hi: ~f~%" (-> this knocked-red-vxz-hi)) + (format #t "~1Tknocked-red-vy-lo: ~f~%" (-> this knocked-red-vy-lo)) + (format #t "~1Tknocked-red-vy-hi: ~f~%" (-> this knocked-red-vy-hi)) + (format #t "~1Tknocked-blue-vxz-lo: ~f~%" (-> this knocked-blue-vxz-lo)) + (format #t "~1Tknocked-blue-vxz-hi: ~f~%" (-> this knocked-blue-vxz-hi)) + (format #t "~1Tknocked-blue-vy-lo: ~f~%" (-> this knocked-blue-vy-lo)) + (format #t "~1Tknocked-blue-vy-hi: ~f~%" (-> this knocked-blue-vy-hi)) + (format #t "~1Tragdoll-info: #~%" (-> this ragdoll-info)) + (format #t "~1Tshadow-size: (meters ~m)~%" (-> this shadow-size)) + (format #t "~1Tshadow-max-y: (meters ~m)~%" (-> this shadow-max-y)) + (format #t "~1Tshadow-min-y: (meters ~m)~%" (-> this shadow-min-y)) + (format #t "~1Tshadow-locus-dist: (meters ~m)~%" (-> this shadow-locus-dist)) + (format #t "~1Tgem-joint: ~D~%" (-> this gem-joint)) + (format #t "~1Tgem-seg: ~D~%" (-> this gem-seg)) + (format #t "~1Tgem-no-seg: ~D~%" (-> this gem-no-seg)) + (format #t "~1Tgem-offset: #~%" (-> this gem-offset)) + (format #t "~1Tknocked-off: ~A~%" (-> this knocked-off)) + (format #t "~1Tcallback-info: #~%" (-> this callback-info)) + (format #t "~1Tuse-momentum: ~A~%" (-> this use-momentum)) + (format #t "~1Tuse-frustration: ~A~%" (-> this use-frustration)) + (format #t "~1Tuse-stop-chase: ~A~%" (-> this use-stop-chase)) + (format #t "~1Tuse-circling: ~A~%" (-> this use-circling)) + (format #t "~1Tuse-pacing: ~A~%" (-> this use-pacing)) + (format #t "~1Twalk-anim: ~D~%" (-> this walk-anim)) + (format #t "~1Tturn-anim: ~D~%" (-> this turn-anim)) + (format #t "~1Trun-anim: ~D~%" (-> this run-anim)) + (format #t "~1Ttaunt-anim: ~D~%" (-> this taunt-anim)) + (format #t "~1Trun-travel-speed: (meters ~m)~%" (-> this run-travel-speed)) + (format #t "~1Trun-acceleration: (meters ~m)~%" (-> this run-acceleration)) + (format #t "~1Trun-turning-acceleration: (meters ~m)~%" (-> this run-turning-acceleration)) + (format #t "~1Twalk-travel-speed: (meters ~m)~%" (-> this walk-travel-speed)) + (format #t "~1Twalk-acceleration: (meters ~m)~%" (-> this walk-acceleration)) + (format #t "~1Twalk-turning-acceleration: (meters ~m)~%" (-> this walk-turning-acceleration)) + (format #t "~1Tmaximum-rotation-rate: (deg ~r)~%" (-> this maximum-rotation-rate)) + (format #t "~1Tnotice-nav-radius: (meters ~m)~%" (-> this notice-nav-radius)) + (format #t "~1Tfrustration-distance: (meters ~m)~%" (-> this frustration-distance)) + (format #t "~1Tfrustration-time: ~D~%" (-> this frustration-time)) + (format #t "~1Tblocked-time: ~D~%" (-> this blocked-time)) + (format #t "~1Tcircle-dist-lo: ~f~%" (-> this circle-dist-lo)) + (format #t "~1Tcircle-dist-hi: ~f~%" (-> this circle-dist-hi)) + (format #t "~1Tnav-mesh: ~A~%" (-> this nav-mesh)) + (label cfg-4) + this + ) + +;; definition of type nav-enemy +(deftype nav-enemy (enemy) + ((enemy-info nav-enemy-info :override) + (frustration-point vector :inline) + (move-dest vector :inline) + (frustration-time time-frame) + (blocked-start-time time-frame) + (restore-nav-radius-time time-frame) + (nav-radius-backup float) + (circle-radial-dist float :overlay-at desired-angle) + ) + (:state-methods + taunt + pacing + circling + stop-chase + debug-control + ) + (:methods + (nav-enemy-method-160 (_type_) none) + (nav-enemy-method-161 (_type_) none) + (nav-enemy-method-162 (_type_) none) + (nav-enemy-method-163 (_type_) none) + (nav-enemy-method-164 (_type_) none) + (nav-enemy-method-165 (_type_) none) + (nav-enemy-method-166 (_type_) none) + (nav-enemy-method-167 (_type_) none) + (nav-enemy-method-168 (_type_) none) + (nav-enemy-method-169 (_type_) none) + (nav-enemy-method-170 (_type_) none) + (nav-enemy-method-171 (_type_) none) + (nav-enemy-method-172 (_type_) none) + (nav-enemy-method-173 (_type_) none) + (nav-enemy-method-174 (_type_) none) + (nav-enemy-method-175 (_type_) none) + (nav-enemy-method-176 (_type_) none) + (nav-enemy-method-177 (_type_) none) + (nav-enemy-method-178 (_type_) none) + (nav-enemy-method-179 (_type_) none) + (nav-enemy-method-180 (_type_) none) + (nav-enemy-method-181 (_type_) none) + (nav-enemy-method-182 (_type_) none) + (nav-enemy-method-183 (_type_) none) + (nav-enemy-method-184 (_type_) none) + (nav-enemy-method-185 (_type_) none) + (nav-enemy-method-186 (_type_) none) + (nav-enemy-method-187 (_type_) none) + (nav-enemy-method-188 (_type_) none) + (nav-enemy-method-189 (_type_) none) + ) + ) + +;; definition for method 3 of type nav-enemy +(defmethod inspect ((this nav-enemy)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type enemy inspect))) + (t9-0 this) + ) + (format #t "~2Tfrustration-point: ~`vector`P~%" (-> this frustration-point)) + (format #t "~2Tmove-dest: ~`vector`P~%" (-> this move-dest)) + (format #t "~2Tfrustration-time: ~D~%" (-> this frustration-time)) + (format #t "~2Tblocked-start-time: ~D~%" (-> this blocked-start-time)) + (format #t "~2Trestore-nav-radius-time: ~D~%" (-> this restore-nav-radius-time)) + (format #t "~2Tnav-radius-backup: ~f~%" (-> this nav-radius-backup)) + (format #t "~2Tcircle-radial-dist: ~f~%" (-> this desired-angle)) + (label cfg-4) + this + ) + +;; definition of type nav-enemy-debug-control-info +(deftype nav-enemy-debug-control-info (basic) + ((enable symbol) + (steering float) + (throttle float) + ) + ) + +;; definition for method 3 of type nav-enemy-debug-control-info +(defmethod inspect ((this nav-enemy-debug-control-info)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~1Tenable: ~A~%" (-> this enable)) + (format #t "~1Tsteering: ~f~%" (-> this steering)) + (format #t "~1Tthrottle: ~f~%" (-> this throttle)) + (label cfg-4) + this + ) + +;; failed to figure out what this is: +0 diff --git a/test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc b/test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc index b993c0c8b7c..56eb8855287 100644 --- a/test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc @@ -8,6 +8,7 @@ (constraint-length-sqd float) (particle0 uint16) (particle1 uint16) + (vec vector :inline :overlay-at constraint-length-half) ) ) @@ -651,7 +652,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc index 9faa1616ad3..14478350100 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll-edit_REF.gc @@ -256,7 +256,7 @@ ) (let ((s3-0 (new 'stack-no-clear 'inline-array 'matrix 60))) (dotimes (v1-0 60) - (let ((a0-2 (the-as matrix (-> s3-0 v1-0 rvec)))) + (let ((a0-2 (-> s3-0 v1-0))) (set! (-> a0-2 rvec quad) (the-as uint128 0)) (set! (-> a0-2 uvec quad) (the-as uint128 0)) (set! (-> a0-2 fvec quad) (the-as uint128 0)) @@ -266,7 +266,7 @@ (dotimes (s2-0 (the-as int (-> arg0 num-joints))) (let ((s0-0 (-> arg0 ragdoll-joints s2-0))) (set! sv-4352 (get-parent-joint arg0 (the-as (inline-array ragdoll-joint) s0-0))) - (set! sv-4368 (the-as matrix (-> s3-0 s2-0 rvec))) + (set! sv-4368 (-> s3-0 s2-0)) (let ((s1-0 (new 'stack-no-clear 'matrix))) (cond (sv-4352 @@ -276,15 +276,11 @@ (set! sv-4432 (new 'stack-no-clear 'vector)) (let* ((v1-11 s1-0) (a3-0 - (the-as - matrix - (-> s3-0 - (/ (the-as uint (&- (the-as pointer sv-4352) (the-as uint (the-as pointer (-> arg0 ragdoll-joints))))) - (the-as uint 192) - ) - rvec - ) - ) + (-> s3-0 + (/ (the-as uint (&- (the-as pointer sv-4352) (the-as uint (the-as pointer (-> arg0 ragdoll-joints))))) + (the-as uint 192) + ) + ) ) (a0-9 (-> a3-0 rvec quad)) (a1-5 (-> a3-0 uvec quad)) @@ -1240,7 +1236,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc index 19fc57077ac..e0bf7b9b131 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll-h_REF.gc @@ -150,7 +150,7 @@ (num-children int8) (old-param0 basic) (hit-sound sound-name) - (ground-pat uint32) + (ground-pat pat-surface) (user0 int32) (original-speed float) ) @@ -232,7 +232,7 @@ (ragdoll-method-17 (_type_ process-drawable) none) (ragdoll-method-18 (_type_) none) (ragdoll-method-19 (_type_ vector int object vector) none) - (ragdoll-method-20 (_type_ vector) none) + (reset-vec! (_type_ vector) none) (ragdoll-method-21 (_type_ vector vector float) vector) (get-max-angle-for-joint-idx (_type_ int) degrees) (ragdoll-method-23 (_type_ vector vector float symbol) none) @@ -290,9 +290,9 @@ ) (:methods (ragdoll-proc-method-15 (_type_ symbol vector symbol) none) - (ragdoll-proc-method-16 (_type_ int) none) - (ragdoll-proc-method-17 (_type_ matrix) none) - (ragdoll-proc-method-18 (_type_ ragdoll-edit-info process) none) + (disable-for-duration (_type_ time-frame) none) + (ragdoll-proc-method-17 (_type_ ragdoll-edit-info) none) + (ragdoll-proc-method-18 (_type_ ragdoll-edit-info) none) (ragdoll-proc-method-19 (_type_) none) ) ) diff --git a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc index c99123c4bde..8ba407c39be 100644 --- a/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/ragdoll_REF.gc @@ -75,7 +75,7 @@ ) (set! (-> s4-1 action-mask) (collide-action solid)) (mem-copy! (the-as pointer (-> s4-1 bbox)) (the-as pointer s5-1) 32) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* s4-1) (when (not (logtest? (-> this ragdoll-flags) (ragdoll-flag rf11))) (let ((s4-2 (new 'stack-no-clear 'inline-array 'water-sphere 2))) (dotimes (s3-1 2) @@ -192,7 +192,7 @@ ;; definition for method 20 of type ragdoll ;; WARN: Return type mismatch int vs none. -(defmethod ragdoll-method-20 ((this ragdoll) (arg0 vector)) +(defmethod reset-vec! ((this ragdoll) (arg0 vector)) (vector-reset! arg0) 0 (none) @@ -308,7 +308,7 @@ ) (let ((s4-1 (-> this ragdoll-joints arg1))) (when (and (logtest? (-> this ragdoll-flags) (ragdoll-flag rf0)) (!= (-> s4-1 coll-rad) 0.0)) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! arg0 arg0 (-> this mirror)) (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) ) @@ -370,7 +370,7 @@ (ragdoll-method-23 this (-> s4-1 position) *zero-vector* 1.0 #f) ) ) - (set! (-> s4-1 ground-pat) (the-as uint (-> s2-1 best-other-tri pat))) + (set! (-> s4-1 ground-pat) (-> s2-1 best-other-tri pat)) (let ((f0-7 (fmin 1.0 f30-0))) (vector+float*! arg0 arg0 s3-2 f0-7) (vector-float*! s3-2 s3-2 (- 1.0 f0-7)) @@ -414,13 +414,13 @@ (set! (-> s3-3 reg 0) (the-as uint 0)) (if (logtest? (-> s4-1 ragdoll-joint-flags) (ragdoll-joint-flag rjf2)) (set! (-> s3-3 reg 0) (the-as uint 127)) - (set! (-> s3-3 reg 0) (shr (shl (-> s4-1 ground-pat) 48) 58)) + (set! (-> s3-3 reg 0) (the-as uint (-> s4-1 ground-pat material))) ) (sound-play-by-spec s3-3 (new-sound-id) (-> s4-1 position)) ) ) ) - (when (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (when (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! arg0 arg0 (-> this mirror)) (vector-matrix*! (-> s4-1 position) (-> s4-1 position) (-> this mirror)) ) @@ -459,7 +459,7 @@ (s3-0 (new 'stack-no-clear 'vector)) ) (set! (-> s3-0 quad) (-> s4-0 0 position quad)) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! s3-0 s3-0 (-> this mirror)) ) (vector-! s2-0 s3-0 s2-0) @@ -628,7 +628,7 @@ ) (set! (-> s2-1 trans quad) (-> s1-1 position quad)) (set! (-> s2-1 trans w) 1.0) - (if (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> s3-1 ragdoll-flags) (ragdoll-flag mirror)) (matrix*! s2-1 s2-1 (-> s3-1 mirror)) ) (cond @@ -792,7 +792,7 @@ (defmethod ragdoll-method-9 ((this ragdoll) (arg0 matrix) (arg1 process-drawable)) (cond ((= (-> arg1 node-list data 2 param0) cspace<-parented-matrix-joint-flip-z!) - (logior! (-> this ragdoll-flags) (ragdoll-flag rf8)) + (logior! (-> this ragdoll-flags) (ragdoll-flag mirror)) (let ((s4-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg1 node-list data 2))) (a1-5 (vector-normalize-copy! (new 'stack-no-clear 'vector) @@ -805,7 +805,7 @@ ) ) (else - (logclear! (-> this ragdoll-flags) (ragdoll-flag rf8)) + (logclear! (-> this ragdoll-flags) (ragdoll-flag mirror)) (matrix-identity! arg0) ) ) @@ -834,7 +834,7 @@ (let ((s3-1 (-> this ragdoll-joints s4-1))) (new 'stack-no-clear 'vector) (vector<-cspace! (-> s3-1 position) (-> arg0 node-list data (-> s3-1 joint-index))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! (-> s3-1 position) (-> s3-1 position) (-> this mirror)) ) ) @@ -889,7 +889,7 @@ ((logtest? (-> this ragdoll-flags) (ragdoll-flag rf5)) (logclear! (-> this ragdoll-flags) (ragdoll-flag rf5)) (set! sv-144 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data (-> s1-0 joint-index)))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! sv-144 sv-144 (-> this mirror)) ) (vector-! (-> s1-0 velocity) sv-144 (-> s1-0 position)) @@ -898,7 +898,7 @@ ) (else (vector<-cspace! (-> s1-0 position) (-> arg0 node-list data (-> s1-0 joint-index))) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! (-> s1-0 position) (-> s1-0 position) (-> this mirror)) ) (cond @@ -925,7 +925,7 @@ (set! (-> s0-0 quad) (-> arg0 root trans quad)) ) ) - (if (logtest? (-> this ragdoll-flags) (ragdoll-flag rf8)) + (if (logtest? (-> this ragdoll-flags) (ragdoll-flag mirror)) (vector-matrix*! s0-0 s0-0 (-> this mirror)) ) (set! (-> s1-0 joint-length) (vector-vector-distance (-> s1-0 position) s0-0)) @@ -1236,7 +1236,7 @@ (= (-> this ragdoll-joints (+ s1-1 1) parent-joint) -1) ) (set! sv-336 (new 'stack-no-clear 'vector)) - (ragdoll-method-20 this sv-336) + (reset-vec! this sv-336) (let ((v1-104 sv-560)) (let ((a0-45 sv-560)) (.mov.vf vf6 vf0 :mask #b1000) @@ -1593,9 +1593,9 @@ ;; definition for method 16 of type ragdoll-proc ;; WARN: Return type mismatch int vs none. -(defmethod ragdoll-proc-method-16 ((this ragdoll-proc) (arg0 int)) +(defmethod disable-for-duration ((this ragdoll-proc) (arg0 time-frame)) (if (nonzero? (-> this ragdoll)) - (turn-off-for-duration! (-> this ragdoll) (the-as time-frame arg0)) + (turn-off-for-duration! (-> this ragdoll) arg0) ) 0 (none) @@ -1603,13 +1603,9 @@ ;; definition for method 17 of type ragdoll-proc ;; WARN: Return type mismatch int vs none. -(defmethod ragdoll-proc-method-17 ((this ragdoll-proc) (arg0 matrix)) +(defmethod ragdoll-proc-method-17 ((this ragdoll-proc) (arg0 ragdoll-edit-info)) (if (nonzero? (-> this ragdoll)) - (ragdoll-method-15 - (-> this ragdoll) - (the-as process-drawable (ppointer->process (-> this parent))) - (the-as ragdoll-edit-info arg0) - ) + (ragdoll-method-15 (-> this ragdoll) (the-as process-drawable (ppointer->process (-> this parent))) arg0) ) 0 (none) @@ -1617,7 +1613,7 @@ ;; definition for method 18 of type ragdoll-proc ;; WARN: Return type mismatch int vs none. -(defmethod ragdoll-proc-method-18 ((this ragdoll-proc) (arg0 ragdoll-edit-info) (arg1 process)) +(defmethod ragdoll-proc-method-18 ((this ragdoll-proc) (arg0 ragdoll-edit-info)) (if (and (nonzero? (-> this ragdoll)) (-> this ragdoll) (nonzero? arg0) arg0) (ragdoll-edit-info-method-17 arg0 @@ -1766,7 +1762,3 @@ ) (go-virtual idle) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/physics/rigid-body-h_REF.gc b/test/decompiler/reference/jak3/engine/physics/rigid-body-h_REF.gc index 2131e5586cb..3cf0bbdc2bb 100644 --- a/test/decompiler/reference/jak3/engine/physics/rigid-body-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/physics/rigid-body-h_REF.gc @@ -16,7 +16,7 @@ (inertial-tensor-box meters 3) ) (:methods - (rigid-body-info-method-9 () none) + (rigid-body-info-method-9 (_type_) none) ) ) @@ -128,7 +128,7 @@ (velocity vector :inline) (impulse float) (pat pat-surface) - (process basic) + (process process) (prim-id uint32) ) ) @@ -155,9 +155,9 @@ (deftype rigid-body-control (basic) ((flags rigid-body-flag) (info rigid-body-info) - (force-callback basic) + (force-callback (function rigid-body-object float none)) (process process) - (blocked-by basic) + (blocked-by process-focusable) (time-remaining float) (step-count int16) (linear-damping float) @@ -177,32 +177,32 @@ (inv-i-world matrix :inline) ) (:methods - (new (symbol type) _type_) - (rigid-body-control-method-9 () none) - (rigid-body-control-method-10 () none) - (rigid-body-control-method-11 () none) - (rigid-body-control-method-12 () none) - (rigid-body-control-method-13 () none) - (rigid-body-control-method-14 () none) - (rigid-body-control-method-15 () none) - (rigid-body-control-method-16 () none) - (rigid-body-control-method-17 () none) - (rigid-body-control-method-18 () none) - (rigid-body-control-method-19 () none) - (rigid-body-control-method-20 () none) - (rigid-body-control-method-21 () none) - (rigid-body-control-method-22 () none) - (rigid-body-control-method-23 () none) - (rigid-body-control-method-24 () none) - (rigid-body-control-method-25 () none) - (rigid-body-control-method-26 () none) - (rigid-body-control-method-27 () none) - (rigid-body-control-method-28 () none) - (rigid-body-control-method-29 () none) - (rigid-body-control-method-30 () none) - (rigid-body-control-method-31 () none) - (rigid-body-control-method-32 () none) - (rigid-body-control-method-33 () none) + (new (symbol type process) _type_) + (rigid-body-control-method-9 (_type_ collide-shape-moving float) none) + (rigid-body-control-method-10 (_type_ rigid-body-object float float) object) + (update-rbody-transform! (_type_ collide-shape-moving) none) + (rigid-body-control-method-12 (_type_ float) none) + (init-velocities! (_type_) none) + (rigid-body-control-method-14 (_type_ float) none) + (rigid-body-control-method-15 (_type_) none) + (reset-force-and-torque! (_type_) none) + (reset-momentum! (_type_) none) + (apply-impact! (_type_ vector vector) none) + (rigid-body-control-method-19 (_type_ vector vector) none) + (add-force! (_type_ vector) none) + (rigid-body-control-method-21 (_type_ vector vector float) none) + (rigid-body-control-method-22 (_type_ vector vector) none) + (rigid-body-control-method-23 (_type_ vector vector) none) + (rigid-body-control-method-24 (_type_ vector vector) none) + (rigid-body-control-method-25 (_type_ vector) none) + (rigid-body-control-method-26 (_type_) none) + (init! (_type_ rigid-body-info vector quaternion (function rigid-body-object float)) none) + (rigid-body-control-method-28 (_type_ vector quaternion) none) + (debug-print-info (_type_ object) none) + (debug-print-force-torque (_type_ object) none) + (debug-print-pos-rot (_type_ object) none) + (debug-print-momentum (_type_ object) none) + (debug-print-velocity (_type_ object) none) ) ) @@ -271,35 +271,37 @@ (player-force-position vector :inline) (player-force vector :inline) ) + (:state-methods + idle + active + ) (:methods - (rigid-body-object-method-28 () none) - (rigid-body-object-method-29 () none) - (rigid-body-object-method-30 () none) - (rigid-body-object-method-31 () none) - (rigid-body-object-method-32 () none) - (rigid-body-object-method-33 () none) - (rigid-body-object-method-34 () none) - (rigid-body-object-method-35 () none) - (rigid-body-object-method-36 () none) - (rigid-body-object-method-37 () none) - (rigid-body-object-method-38 () none) - (rigid-body-object-method-39 () none) - (rigid-body-object-method-40 () none) - (rigid-body-object-method-41 () none) - (rigid-body-object-method-42 () none) - (rigid-body-object-method-43 () none) - (rigid-body-object-method-44 () none) - (rigid-body-object-method-45 () none) - (rigid-body-object-method-46 () none) - (rigid-body-object-method-47 () none) - (rigid-body-object-method-48 () none) - (rigid-body-object-method-49 () none) - (rigid-body-object-method-50 () none) - (rigid-body-object-method-51 () none) - (rigid-body-object-method-52 () none) - (rigid-body-object-method-53 () none) - (rigid-body-object-method-54 () none) - (rigid-body-object-method-55 () none) + (rigid-body-object-method-30 (_type_) none) + (apply-gravity! (_type_ float) none) + (rigid-body-object-method-32 (_type_) none) + (alloc-rbody-control! (_type_ rigid-body-object-constants) none) + (init-collision! (_type_) none) + (init-rbody-control! (_type_) none) + (go-idle (_type_) object) + (rigid-body-object-method-37 (_type_) none) + (rigid-body-object-method-38 (_type_) none) + (rbody-post (_type_) none) + (apply-momentum! (_type_) none) + (disable-physics! (_type_) none) + (rigid-body-object-method-42 (_type_) none) + (rigid-body-object-method-43 (_type_) none) + (impulse-handler (_type_) none) + (go-active (_type_) object) + (rigid-body-object-method-46 (_type_) none) + (impulse-force<-penetrate (_type_ rigid-body-impact attack-info penetrate) none) + (rigid-body-object-method-48 (_type_) none) + (rbody-event-handler (_type_ process int symbol event-message-block) object) + (attack-handler (_type_ process-drawable attack-info touching-shapes-entry penetrate) symbol) + (touch-handler (_type_ process-focusable touching-shapes-entry) symbol) + (init-rbody-impact-from-tshape! (_type_ rigid-body-impact touching-shapes-entry) none) + (rigid-body-object-method-53 (_type_ float) none) + (rigid-body-object-method-54 (_type_) none) + (clear-impulse-force-flag! (_type_) none) ) ) @@ -357,18 +359,18 @@ ;; definition of type rigid-body-queue (deftype rigid-body-queue (structure) ((count int8) - (manager uint64) + (manager handle) (array handle 128) ) (:methods - (rigid-body-queue-method-9 () none) - (rigid-body-queue-method-10 () none) - (rigid-body-queue-method-11 () none) - (rigid-body-queue-method-12 () none) - (rigid-body-queue-method-13 () none) - (rigid-body-queue-method-14 () none) - (rigid-body-queue-method-15 () none) - (rigid-body-queue-method-16 () none) + (init-queue! (_type_ process) none) + (rigid-body-queue-method-10 (_type_) none) + (rigid-body-queue-method-11 (_type_ process int) none) + (rigid-body-queue-method-12 (_type_ int int) none) + (rigid-body-queue-method-13 (_type_ int process) none) + (rigid-body-queue-method-14 (_type_ int) none) + (rigid-body-queue-method-15 (_type_ process) none) + (rigid-body-queue-method-16 (_type_) none) ) ) @@ -388,7 +390,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/physics/rigid-body-queue_REF.gc b/test/decompiler/reference/jak3/engine/physics/rigid-body-queue_REF.gc new file mode 100644 index 00000000000..dc47bdc4e82 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/physics/rigid-body-queue_REF.gc @@ -0,0 +1,344 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for symbol *rigid-body-queue-manager*, type rigid-body-queue-manager +(define *rigid-body-queue-manager* (the-as rigid-body-queue-manager #f)) + +;; definition for method 9 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod init-queue! ((this rigid-body-queue) (arg0 process)) + (set! (-> this count) 0) + (set! (-> this manager) (process->handle arg0)) + (dotimes (v1-3 128) + (set! (-> this array v1-3) (the-as handle #f)) + ) + 0 + (none) + ) + +;; definition for method 16 of type rigid-body-queue +;; WARN: Return type mismatch symbol vs none. +(defmethod rigid-body-queue-method-16 ((this rigid-body-queue)) + (let ((gp-0 0)) + (dotimes (v1-0 (-> this count)) + (let ((a1-2 (-> this array v1-0)) + (a2-0 (+ v1-0 1)) + ) + (while (< a2-0 (-> this count)) + (if (= a1-2 (-> this array a2-0)) + (+! gp-0 1) + ) + (+! a2-0 1) + ) + ) + ) + (if (> gp-0 0) + (format 0 "rigid-body-queue::validate: duplicate count ~d~%" gp-0) + ) + (zero? gp-0) + ) + (none) + ) + +;; definition for method 10 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-10 ((this rigid-body-queue)) + (with-pp + (let ((f0-0 (seconds-per-frame))) + (countdown (v1-1 (-> this count)) + (let ((a0-4 (handle->process (-> this array v1-1)))) + (cond + (a0-4 + (let ((a0-6 (-> (the-as process-focusable a0-4) rbody))) + (set! (-> a0-6 time-remaining) f0-0) + (set! (-> a0-6 blocked-by) #f) + (set! (-> a0-6 step-count) 0) + (logclear! (-> a0-6 flags) (rigid-body-flag blocker)) + ) + ) + (else + ) + ) + ) + ) + ) + (let ((s5-0 0)) + (let ((s4-0 (-> *kernel-context* prevent-from-run))) + (b! #t cfg-37 :delay (nop!)) + (label cfg-11) + (let ((s3-0 (handle->process (-> this array s5-0)))) + (when s3-0 + (let ((s2-0 (-> (the-as process-focusable s3-0) rbody))) + (when (and (logtest? (-> s2-0 flags) (rigid-body-flag enable-physics)) + (not (logtest? s4-0 (-> s3-0 mask))) + (and (< 0.001 (-> s2-0 time-remaining)) (< (-> s2-0 step-count) 4)) + ) + (let ((s1-0 pp)) + (set! pp s3-0) + (rigid-body-object-method-54 (the-as rigid-body-object s3-0)) + (set! pp s1-0) + ) + (+! (-> s2-0 step-count) 1) + (let ((a2-2 (-> s2-0 blocked-by))) + (when a2-2 + (when #t + (logior! (-> a2-2 rbody flags) (rigid-body-flag blocker)) + (rigid-body-queue-method-13 this s5-0 a2-2) + (let ((v1-34 (process->handle s3-0))) + (b! (!= (-> this array s5-0) v1-34) cfg-11 :delay (nop!)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (+! s5-0 1) + (label cfg-37) + (b! (< s5-0 (-> this count)) cfg-11) + ) + (let ((s5-1 (-> *kernel-context* prevent-from-run))) + (dotimes (s4-1 (-> this count)) + (let ((a0-20 (handle->process (-> this array s4-1)))) + (when (and a0-20 + (logtest? (-> (the-as process-focusable a0-20) rbody flags) (rigid-body-flag enable-physics)) + (not (logtest? s5-1 (-> a0-20 mask))) + ) + (let ((s3-1 pp)) + (set! pp a0-20) + (clear-impulse-force-flag! (the-as rigid-body-object a0-20)) + (set! pp s3-1) + ) + ) + ) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 11 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-11 ((this rigid-body-queue) (arg0 process) (arg1 int)) + (let ((v1-0 -1)) + (let ((a2-1 0)) + (b! #t cfg-9 :delay (nop!)) + (label cfg-1) + (b! (handle->process (-> this array a2-1)) cfg-8 :delay (empty-form)) + (set! v1-0 a2-1) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a2-1 1) + (label cfg-9) + (b! (< a2-1 (-> this count)) cfg-1) + ) + (label cfg-11) + (cond + ((!= v1-0 -1) + (set! (-> this array v1-0) (process->handle arg0)) + ) + (else + (when (< (-> this count) 128) + (set! (-> this array (-> this count)) (process->handle arg0)) + (+! (-> this count) 1) + ) + ) + ) + ) + 0 + 0 + (none) + ) + +;; definition for method 12 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-12 ((this rigid-body-queue) (arg0 int) (arg1 int)) + (when (< arg0 arg1) + (let ((v1-1 arg1) + (a3-0 (+ arg1 -1)) + (a2-3 (-> this array arg1)) + ) + (while (>= a3-0 arg0) + (set! (-> this array v1-1) (-> this array a3-0)) + (+! a3-0 -1) + (+! v1-1 -1) + ) + (set! (-> this array arg0) a2-3) + ) + ) + 0 + (none) + ) + +;; definition for method 13 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-13 ((this rigid-body-queue) (arg0 int) (arg1 process)) + (let ((v1-2 (process->handle arg1)) + (a2-4 (+ arg0 1)) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-6) + (b! (!= (-> this array a2-4) v1-2) cfg-8 :delay (empty-form)) + (rigid-body-queue-method-12 this arg0 a2-4) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a2-4 1) + (label cfg-9) + (b! (< a2-4 (-> this count)) cfg-6) + ) + (label cfg-11) + 0 + 0 + (none) + ) + +;; definition for method 14 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-14 ((this rigid-body-queue) (arg0 int)) + (let ((v1-0 arg0) + (a1-1 (+ arg0 1)) + ) + (while (< a1-1 (-> this count)) + (set! (-> this array v1-0) (-> this array a1-1)) + (+! a1-1 1) + (+! v1-0 1) + ) + ) + (+! (-> this count) -1) + 0 + (none) + ) + +;; definition for method 15 of type rigid-body-queue +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-queue-method-15 ((this rigid-body-queue) (arg0 process)) + (let ((v1-2 (process->handle arg0)) + (a1-4 0) + ) + (b! #t cfg-9 :delay (nop!)) + (label cfg-6) + (b! (!= (-> this array a1-4) v1-2) cfg-8 :delay (empty-form)) + (rigid-body-queue-method-14 this a1-4) + (b! #t cfg-11 :delay (nop!)) + (label cfg-8) + (+! a1-4 1) + (label cfg-9) + (b! (< a1-4 (-> this count)) cfg-6) + ) + (label cfg-11) + 0 + 0 + (none) + ) + +;; definition of type rigid-body-queue-manager +(deftype rigid-body-queue-manager (process) + ((queue rigid-body-queue) + ) + (:state-methods + idle + ) + ) + +;; definition for method 3 of type rigid-body-queue-manager +(defmethod inspect ((this rigid-body-queue-manager)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process inspect))) + (t9-0 this) + ) + (format #t "~2Tqueue: #~%" (-> this queue)) + (label cfg-4) + this + ) + +;; definition for method 10 of type rigid-body-queue-manager +(defmethod deactivate ((this rigid-body-queue-manager)) + "Make a process dead, clean it up, remove it from the active pool, and return to dead pool." + (set! *rigid-body-queue-manager* #f) + ((method-of-type process deactivate) this) + (none) + ) + +;; definition for method 7 of type rigid-body-queue-manager +;; WARN: Return type mismatch process vs rigid-body-queue-manager. +(defmethod relocate ((this rigid-body-queue-manager) (offset int)) + (set! *rigid-body-queue-manager* this) + (if *rigid-body-queue-manager* + (set! *rigid-body-queue-manager* (&+ *rigid-body-queue-manager* offset)) + ) + (the-as rigid-body-queue-manager ((method-of-type process relocate) this offset)) + ) + +;; failed to figure out what this is: +(defstate idle (rigid-body-queue-manager) + :virtual #t + :exit (behavior () + (set! (-> self queue count) 0) + 0 + ) + :code sleep-code + :post (behavior () + (local-vars (a0-3 int) (a0-5 int)) + (let* ((v1-1 (-> *perf-stats* data 17)) + (a0-0 (-> v1-1 ctrl)) + ) + (+! (-> v1-1 count) 1) + (b! (zero? a0-0) cfg-2 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mtpc pcr0 0) + (.mtpc pcr1 0) + (.sync.l) + (.sync.p) + (.mtc0 Perf a0-0) + ) + (.sync.l) + (.sync.p) + (label cfg-2) + 0 + (rigid-body-queue-method-10 (-> self queue)) + (let ((v1-6 (-> *perf-stats* data 17))) + (b! (zero? (-> v1-6 ctrl)) cfg-4 :delay (nop!)) + (.mtc0 Perf 0) + (.sync.l) + (.sync.p) + (.mfpc a0-3 pcr0) + (+! (-> v1-6 accum0) a0-3) + (.mfpc a0-5 pcr1) + (+! (-> v1-6 accum1) a0-5) + ) + (label cfg-4) + 0 + ) + ) + +;; definition for function rigid-body-queue-manager-init-by-other +(defbehavior rigid-body-queue-manager-init-by-other rigid-body-queue-manager ((arg0 rigid-body-queue)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self queue) arg0) + (init-queue! (-> self queue) self) + (go-virtual idle) + ) + +;; definition for function rigid-body-queue-manager-spawn +(defun rigid-body-queue-manager-spawn ((arg0 rigid-body-queue) (arg1 process-tree)) + (let ((gp-0 (the-as process #f))) + (let ((v1-1 (process-spawn rigid-body-queue-manager arg0 :name "rigid-body-queue-manager" :to arg1))) + (if v1-1 + (set! gp-0 (-> v1-1 0)) + ) + ) + gp-0 + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc new file mode 100644 index 00000000000..7cfe8dcd30a --- /dev/null +++ b/test/decompiler/reference/jak3/engine/physics/rigid-body_REF.gc @@ -0,0 +1,1580 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition of type rigid-body-work +(deftype rigid-body-work (structure) + ((max-ang-momentum float) + (max-ang-velocity float) + ) + ) + +;; definition for method 3 of type rigid-body-work +(defmethod inspect ((this rigid-body-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'rigid-body-work) + (format #t "~1Tmax-ang-momentum: ~f~%" (-> this max-ang-momentum)) + (format #t "~1Tmax-ang-velocity: ~f~%" (-> this max-ang-velocity)) + (label cfg-4) + this + ) + +;; definition for symbol *rigid-body-work*, type rigid-body-work +(define *rigid-body-work* (new 'static 'rigid-body-work)) + +;; definition for method 0 of type rigid-body-control +(defmethod new rigid-body-control ((allocation symbol) (type-to-make type) (arg0 process)) + (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) + (set! (-> v0-0 process) arg0) + v0-0 + ) + ) + +;; definition for method 7 of type rigid-body-control +(defmethod relocate ((this rigid-body-control) (offset int)) + (&+! (-> this process) offset) + this + ) + +;; definition for method 9 of type rigid-body-info +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-info-method-9 ((this rigid-body-info)) + (let ((f24-0 (-> this mass)) + (f28-0 (-> this inertial-tensor-box 0)) + (f30-0 (-> this inertial-tensor-box 1)) + (f26-0 (-> this inertial-tensor-box 2)) + ) + (let ((f0-0 f24-0)) + (set! (-> this inv-mass) (/ 1.0 f0-0)) + ) + (matrix-identity! (-> this inertial-tensor)) + (matrix-identity! (-> this inv-inertial-tensor)) + (let ((f0-4 (* 0.083333336 f24-0))) + (let* ((f1-1 f30-0) + (f1-3 (* f1-1 f1-1)) + (f2-0 f26-0) + ) + (set! (-> this inertial-tensor rvec x) (* f0-4 (+ f1-3 (* f2-0 f2-0)))) + ) + (let ((f1-6 f28-0)) + (set! (-> this inertial-tensor uvec y) (* f0-4 (+ (* f1-6 f1-6) (* f26-0 f26-0)))) + ) + (set! (-> this inertial-tensor fvec z) (* f0-4 (+ (* f28-0 f28-0) (* f30-0 f30-0)))) + ) + ) + (let ((f0-6 (-> this inertial-tensor rvec x))) + (set! (-> this inv-inertial-tensor rvec x) (/ 1.0 f0-6)) + ) + (let ((f0-9 (-> this inertial-tensor uvec y))) + (set! (-> this inv-inertial-tensor uvec y) (/ 1.0 f0-9)) + ) + (let ((f0-12 (-> this inertial-tensor fvec z))) + (set! (-> this inv-inertial-tensor fvec z) (/ 1.0 f0-12)) + ) + 0 + (none) + ) + +;; definition for method 16 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod reset-force-and-torque! ((this rigid-body-control)) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + (none) + ) + +;; definition for method 17 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod reset-momentum! ((this rigid-body-control)) + (set! (-> this lin-momentum quad) (the-as uint128 0)) + (set! (-> this ang-momentum quad) (the-as uint128 0)) + 0 + (none) + ) + +;; definition for method 26 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-26 ((this rigid-body-control)) + (when #t + (quaternion->matrix (-> this matrix) (the-as quaternion (-> this rot))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (vector-rotate*! s5-0 (-> this info cm-offset-joint) (-> this matrix)) + (vector-! (-> this matrix trans) (-> this position) s5-0) + ) + ) + 0 + (none) + ) + +;; definition for method 28 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-28 ((this rigid-body-control) (arg0 vector) (arg1 quaternion)) + (let ((s3-0 (new 'stack-no-clear 'rigid-body-impact))) + (quaternion->matrix (the-as matrix (-> s3-0 normal)) arg1) + (vector-rotate*! (-> s3-0 point) (-> this info cm-offset-joint) (the-as matrix (-> s3-0 normal))) + (vector+! (-> this position) arg0 (-> s3-0 point)) + ) + (quaternion-copy! (the-as quaternion (-> this rot)) arg1) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) + ) + +;; definition for method 27 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init! ((this rigid-body-control) + (arg0 rigid-body-info) + (arg1 vector) + (arg2 quaternion) + (arg3 (function rigid-body-object float)) + ) + (set! (-> this info) arg0) + (set! (-> this force-callback) (the-as (function rigid-body-object float none) arg3)) + (rigid-body-info-method-9 (-> this info)) + (let ((v1-2 this)) + (set! (-> v1-2 force quad) (the-as uint128 0)) + (set! (-> v1-2 torque quad) (the-as uint128 0)) + ) + 0 + (reset-momentum! this) + (rigid-body-control-method-28 this arg1 arg2) + (init-velocities! this) + (set! (-> this linear-damping) (-> arg0 linear-damping)) + (set! (-> this angular-damping) (-> arg0 angular-damping)) + (set! (-> this friction-factor) (-> arg0 friction-factor)) + (set! (-> this bounce-factor) (-> arg0 bounce-factor)) + 0 + (none) + ) + +;; definition for method 23 of type rigid-body-control +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-23 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this ang-velocity) (-> v1-0 0)) + (vector+! arg1 (-> v1-0 1) (-> this lin-velocity)) + ) + (none) + ) + +;; definition for method 24 of type rigid-body-control +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-24 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (local-vars (t0-5 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> this torque) (-> v1-0 0)) + (let ((a1-2 (-> v1-0 1)) + (a3-3 (-> v1-0 1)) + (f0-0 1.0) + ) + (.lvf vf1 (&-> (-> v1-0 0) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov t0-5 vf1) + (vector-float*! a1-2 a3-3 (/ f0-0 t0-5)) + ) + (vector+! arg1 (-> v1-0 1) (-> this force)) + ) + (none) + ) + ) + +;; definition for function matrix-3x3-triple-transpose-product +;; INFO: Used lq/sq +(defun matrix-3x3-triple-transpose-product ((arg0 matrix) (arg1 matrix) (arg2 matrix)) + (let ((s5-0 (new 'stack-no-clear 'inline-array 'matrix 3))) + (let* ((v1-0 (-> s5-0 0)) + (a3-0 arg1) + (a0-1 (-> a3-0 rvec quad)) + (a1-1 (-> a3-0 uvec quad)) + (a2-1 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> v1-0 rvec quad) a0-1) + (set! (-> v1-0 uvec quad) a1-1) + (set! (-> v1-0 fvec quad) a2-1) + (set! (-> v1-0 trans quad) a3-1) + ) + (vector-reset! (-> s5-0 0 trans)) + (matrix-transpose! (-> s5-0 1) (-> s5-0 0)) + (matrix*! (-> s5-0 2) arg2 (-> s5-0 0)) + (matrix*! arg0 (-> s5-0 1) (-> s5-0 2)) + ) + arg0 + ) + +;; definition for method 12 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-12 ((this rigid-body-control) (arg0 float)) + (local-vars (v1-6 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((a2-0 (-> this lin-momentum))) + (let ((v1-0 (-> this lin-momentum))) + (let ((a0-1 (-> this force))) + (let ((a3-0 arg0)) + (.mov vf7 a3-0) + ) + (.lvf vf5 (&-> a0-1 quad)) + ) + (.lvf vf4 (&-> v1-0 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a2-0 quad) vf6) + ) + (let ((a2-1 (-> this ang-momentum))) + (let ((v1-1 (-> this ang-momentum))) + (let ((a0-2 (-> this torque))) + (let ((a1-1 arg0)) + (.mov vf7 a1-1) + ) + (.lvf vf5 (&-> a0-2 quad)) + ) + (.lvf vf4 (&-> v1-1 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a2-1 quad) vf6) + ) + (let* ((f0-3 (* 500000000.0 (-> this info mass))) + (f1-1 f0-3) + (f1-3 (* f1-1 f1-1)) + ) + (.lvf vf1 (&-> (-> this ang-momentum) quad)) + (.add.w.vf vf2 vf0 vf0 :mask #b1) + (.mul.vf vf1 vf1 vf1) + (.mul.x.vf acc vf2 vf1 :mask #b1) + (.add.mul.y.vf acc vf2 vf1 acc :mask #b1) + (.add.mul.z.vf vf1 vf2 vf1 acc :mask #b1) + (.mov v1-6 vf1) + (if (< f1-3 v1-6) + (vector-normalize! (-> this ang-momentum) f0-3) + ) + ) + (set! (-> this force quad) (the-as uint128 0)) + (set! (-> this torque quad) (the-as uint128 0)) + 0 + 0 + (none) + ) + ) + +;; definition for method 13 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod init-velocities! ((this rigid-body-control)) + (let ((v1-0 (-> this info))) + (vector-float*! (-> this lin-velocity) (-> this lin-momentum) (-> v1-0 inv-mass)) + (matrix-3x3-triple-transpose-product (-> this inv-i-world) (-> this matrix) (-> v1-0 inv-inertial-tensor)) + ) + (vector-rotate*! (-> this ang-velocity) (-> this ang-momentum) (-> this inv-i-world)) + 0 + (none) + ) + +;; definition for method 14 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-14 ((this rigid-body-control) (arg0 float)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + ) + (init-vf0-vector) + (let ((a1-1 (-> this position))) + (let ((v1-0 (-> this position))) + (let ((a0-1 (-> this lin-velocity))) + (let ((a2-0 arg0)) + (.mov vf7 a2-0) + ) + (.lvf vf5 (&-> a0-1 quad)) + ) + (.lvf vf4 (&-> v1-0 quad)) + ) + (.add.x.vf vf6 vf0 vf0 :mask #b1000) + (.mul.x.vf acc vf5 vf7 :mask #b111) + (.add.mul.w.vf vf6 vf4 vf0 acc :mask #b111) + (.svf (&-> a1-1 quad) vf6) + ) + (let ((s4-0 (new 'stack-no-clear 'quaternion))) + (set! (-> (the-as vector (&-> s4-0 x)) quad) (-> this ang-velocity quad)) + (set! (-> s4-0 w) 0.0) + (quaternion*! s4-0 s4-0 (the-as quaternion (-> this rot))) + (quaternion-float*! s4-0 s4-0 0.5) + (+! (-> this rot x) (* (-> s4-0 x) arg0)) + (+! (-> this rot y) (* (-> s4-0 y) arg0)) + (+! (-> this rot z) (* (-> s4-0 z) arg0)) + (+! (-> this rot w) (* (-> s4-0 w) arg0)) + ) + (quaternion-normalize! (the-as quaternion (-> this rot))) + (rigid-body-control-method-26 this) + 0 + (none) + ) + ) + +;; definition for function damping-time-adjust +(defun damping-time-adjust ((arg0 float) (arg1 float)) + (let ((f0-0 0.0) + (f1-0 1.0) + (f2-2 (* -1.0 (- 1.0 arg0) arg1)) + (f3-3 0.016666668) + ) + (fmax f0-0 (+ f1-0 (* f2-2 (/ 1.0 f3-3)))) + ) + ) + +;; definition for method 9 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-9 ((this rigid-body-control) (arg0 collide-shape-moving) (arg1 float)) + (rigid-body-control-method-12 this arg1) + (-> this info) + (let* ((v1-3 (-> this lin-momentum)) + (a0-2 (-> this lin-momentum)) + (f3-0 (-> this linear-damping)) + (f2-0 arg1) + (f0-0 0.0) + (f1-0 1.0) + (f2-1 (* -1.0 (- 1.0 f3-0) f2-0)) + (f3-3 0.016666668) + ) + (vector-float*! v1-3 a0-2 (fmax f0-0 (+ f1-0 (* f2-1 (/ 1.0 f3-3))))) + ) + (let* ((v1-5 (-> this ang-momentum)) + (a0-3 (-> this ang-momentum)) + (f3-6 (-> this angular-damping)) + (f2-3 arg1) + (f0-3 0.0) + (f1-2 1.0) + (f2-4 (* -1.0 (- 1.0 f3-6) f2-3)) + (f3-9 0.016666668) + ) + (vector-float*! v1-5 a0-3 (fmax f0-3 (+ f1-2 (* f2-4 (/ 1.0 f3-9))))) + ) + (init-velocities! this) + (if (logtest? (-> this flags) (rigid-body-flag enable-collision)) + (rbody-collision arg0 this arg1) + (rigid-body-control-method-14 this arg1) + ) + 0 + (none) + ) + +;; definition for method 67 of type collide-shape-moving +;; WARN: Return type mismatch int vs none. +(defmethod collide-with-all-collide-cache-prims ((this collide-shape-moving) (arg0 matrix) (arg1 collide-query)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + ) + (init-vf0-vector) + (let ((s4-0 *collide-cache*) + (s3-0 (-> this root-prim)) + (s2-0 1) + ) + (when (zero? (-> s3-0 prim-core prim-type)) + (let ((v1-2 s3-0)) + (set! s3-0 (-> (the-as collide-shape-prim-group v1-2) child 0)) + (set! s2-0 (the-as int (-> v1-2 specific 0))) + ) + ) + (b! #t cfg-13 :delay (nop!)) + (label cfg-3) + (+! s2-0 -1) + (let ((v1-4 -1)) + (b! (!= (-> s3-0 prim-core prim-type) v1-4) cfg-12 :delay (nop!)) + ) + (.lvf vf5 (&-> s3-0 local-sphere quad)) + (.lvf vf1 (&-> arg0 rvec quad)) + (.lvf vf2 (&-> arg0 uvec quad)) + (.lvf vf3 (&-> arg0 fvec quad)) + (.lvf vf4 (&-> arg0 trans quad)) + (.lvf vf6 (&-> s3-0 prim-core world-sphere quad)) + (.mul.x.vf acc vf1 vf5) + (.add.mul.y.vf acc vf2 vf5 acc) + (.add.mul.z.vf acc vf3 vf5 acc) + (.add.mul.w.vf vf7 vf4 vf0 acc :mask #b111) + (.sub.vf vf8 vf7 vf6 :mask #b111) + (.svf (&-> arg1 move-dist quad) vf8) + (let ((s1-0 (the-as collide-cache-prim (-> s4-0 prims)))) + (countdown (s0-0 (-> s4-0 num-prims)) + (when (logtest? (-> s3-0 prim-core collide-with) (-> s1-0 prim-core collide-as)) + (if (>= (-> s1-0 prim-core prim-type) 0) + ((method-of-object s3-0 collide-shape-prim-method-15)) + (collide-with-collide-cache-prim-sphere s3-0 arg1 s1-0) + ) + ) + (&+! s1-0 48) + ) + ) + (label cfg-12) + (&+! s3-0 80) + (label cfg-13) + (b! (nonzero? s2-0) cfg-3 :delay (nop!)) + ) + 0 + (none) + ) + ) + +;; definition for function transform-rigid-body-prims +(defun transform-rigid-body-prims ((arg0 collide-shape-prim) (arg1 matrix)) + (rlet ((acc :class vf) + (vf0 :class vf) + (vf1 :class vf) + (vf2 :class vf) + (vf3 :class vf) + (vf4 :class vf) + (vf5 :class vf) + ) + (init-vf0-vector) + (let ((v1-0 arg0) + (a0-1 1) + ) + (when (zero? (-> v1-0 prim-core prim-type)) + (let ((a0-2 (the-as collide-shape-prim-group v1-0))) + (set! v1-0 (-> a0-2 child 0)) + (set! a0-1 (the-as int (-> a0-2 num-children))) + ) + ) + (while (nonzero? a0-1) + (+! a0-1 -1) + (.lvf vf5 (&-> v1-0 local-sphere quad)) + (.lvf vf1 (&-> arg1 rvec quad)) + (.lvf vf2 (&-> arg1 uvec quad)) + (.lvf vf3 (&-> arg1 fvec quad)) + (.lvf vf4 (&-> arg1 trans quad)) + (.mul.x.vf acc vf1 vf5) + (.add.mul.y.vf acc vf2 vf5 acc) + (.add.mul.z.vf acc vf3 vf5 acc) + (.add.mul.w.vf vf5 vf4 vf0 acc :mask #b111) + (.svf (&-> v1-0 prim-core world-sphere quad) vf5) + (&+! v1-0 80) + ) + ) + #f + ) + ) + +;; definition of type rigid-body-move-work +(deftype rigid-body-move-work (structure) + ((cquery collide-query :inline) + (best-dist float :overlay-at (-> cquery best-u)) + (mat matrix :inline) + (impact-info rigid-body-impact :inline) + (impact-info2 rigid-body-impact :inline) + (orig-position vector :inline) + (orig-rotation quaternion :inline) + (force vector :inline) + (vel vector :inline) + (p-body vector :inline) + (tmp vector :inline) + (tangent-dir vector :inline) + (proc2 process-focusable) + (rbody2 rigid-body-control) + (vel-dot-norm float) + (denom float) + (denom2 float) + (time-step float) + (time-step-scale float) + (step-count int8) + ) + ) + +;; definition for method 3 of type rigid-body-move-work +(defmethod inspect ((this rigid-body-move-work)) + (when (not this) + (set! this this) + (goto cfg-4) + ) + (format #t "[~8x] ~A~%" this 'rigid-body-move-work) + (format #t "~1Tcquery: #~%" (-> this cquery)) + (format #t "~1Tmat: #~%" (-> this mat)) + (format #t "~1Timpact-info: #~%" (-> this impact-info)) + (format #t "~1Timpact-info2: #~%" (-> this impact-info2)) + (format #t "~1Torig-position: #~%" (-> this orig-position)) + (format #t "~1Torig-rotation: #~%" (-> this orig-rotation)) + (format #t "~1Tforce: #~%" (-> this force)) + (format #t "~1Tvel: #~%" (-> this vel)) + (format #t "~1Tp-body: #~%" (-> this p-body)) + (format #t "~1Ttmp: #~%" (-> this tmp)) + (format #t "~1Ttangent-dir: #~%" (-> this tangent-dir)) + (format #t "~1Tproc2: ~A~%" (-> this proc2)) + (format #t "~1Trbody2: ~A~%" (-> this rbody2)) + (format #t "~1Tvel-dot-norm: ~f~%" (-> this vel-dot-norm)) + (format #t "~1Tdenom: ~f~%" (-> this denom)) + (format #t "~1Tdenom2: ~f~%" (-> this denom2)) + (format #t "~1Ttime-step: ~f~%" (-> this time-step)) + (format #t "~1Ttime-step-scale: ~f~%" (-> this time-step-scale)) + (format #t "~1Tstep-count: ~D~%" (-> this step-count)) + (label cfg-4) + this + ) + +;; definition for method 63 of type collide-shape-moving +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod rbody-collision ((this collide-shape-moving) (arg0 rigid-body-control) (arg1 float)) + (rlet ((acc :class vf) + (Q :class vf) + (vf0 :class vf) + (vf6 :class vf) + (vf7 :class vf) + (vf8 :class vf) + (vf9 :class vf) + ) + (init-vf0-vector) + (let ((s5-0 (new 'stack-no-clear 'rigid-body-move-work))) + (set! (-> s5-0 time-step) arg1) + (set! (-> s5-0 time-step-scale) 1.0) + (set! (-> s5-0 step-count) 0) + (until (not (and (< 0.05 (-> s5-0 time-step-scale)) (< (-> s5-0 step-count) (the-as int (-> this max-iteration-count)))) + ) + (set! (-> s5-0 best-dist) -100000000.0) + (set! (-> s5-0 cquery best-my-prim) #f) + (set! (-> s5-0 cquery best-other-prim) #f) + (set! (-> s5-0 orig-position quad) (-> arg0 position quad)) + (quaternion-copy! (-> s5-0 orig-rotation) (the-as quaternion (-> arg0 rot))) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (mem-copy! (the-as pointer (-> s5-0 mat)) (the-as pointer (-> arg0 matrix)) 64) + (set! (-> arg0 position quad) (-> s5-0 orig-position quad)) + (quaternion-copy! (the-as quaternion (-> arg0 rot)) (-> s5-0 orig-rotation)) + (rigid-body-control-method-26 arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (collide-with-all-collide-cache-prims this (-> s5-0 mat) (-> s5-0 cquery)) + (let ((f30-0 (-> s5-0 best-dist))) + (b! (>= f30-0 0.0) cfg-3 :delay #f) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (set! (-> s5-0 time-step-scale) 0.0) + (b! #t cfg-55 :delay (nop!)) + (label cfg-3) + *touching-list* + ((method-of-type touching-list touching-list-method-11)) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step) f30-0)) + ) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (let* ((a2-3 (-> s5-0 mat)) + (a3-0 (-> arg0 matrix)) + (v1-21 (-> a3-0 rvec quad)) + (a0-19 (-> a3-0 uvec quad)) + (a1-12 (-> a3-0 fvec quad)) + (a3-1 (-> a3-0 trans quad)) + ) + (set! (-> a2-3 rvec quad) v1-21) + (set! (-> a2-3 uvec quad) a0-19) + (set! (-> a2-3 fvec quad) a1-12) + (set! (-> a2-3 trans quad) a3-1) + ) + (set! (-> s5-0 rbody2) #f) + (set! (-> s5-0 proc2) #f) + (when (-> s5-0 cquery best-other-prim) + (set! (-> s5-0 proc2) (the-as process-focusable (-> s5-0 cquery best-other-prim cshape process))) + (let ((v1-28 (-> s5-0 proc2 rbody))) + (when (nonzero? v1-28) + (set! (-> s5-0 rbody2) v1-28) + (cond + ((logtest? (-> v1-28 flags) (rigid-body-flag active)) + (if (not (logtest? (-> v1-28 flags) (rigid-body-flag enable-physics))) + (send-event (-> s5-0 proc2) 'enable-physics) + ) + ) + (else + (set! (-> s5-0 rbody2) #f) + ) + ) + ) + ) + ) + (let ((v1-33 (-> s5-0 cquery best-my-prim))) + (.lvf vf7 (&-> (-> s5-0 cquery) best-other-tri intersect quad)) + (.lvf vf6 (&-> v1-33 prim-core world-sphere quad)) + (.sub.vf vf8 vf6 vf7) + (.mul.vf vf9 vf8 vf8 :mask #b111) + (.mul.x.vf acc vf0 vf9 :mask #b1000) + (.add.mul.y.vf acc vf0 vf9 acc :mask #b1000) + (.add.mul.z.vf vf9 vf0 vf9 acc :mask #b1000) + (.isqrt.vf Q vf0 vf9 :fsf #b11 :ftf #b11) + (.mov.vf vf8 vf0 :mask #b1000) + (.mov.vf vf7 vf0 :mask #b1000) + (.wait.vf) + (.mul.vf vf8 vf8 Q :mask #b111) + (.nop.vf) + (.nop.vf) + (.nop.vf) + (.svf (&-> s5-0 impact-info normal quad) vf8) + (.svf (&-> s5-0 impact-info point quad) vf7) + (set! (-> s5-0 impact-info prim-id) (-> v1-33 prim-id)) + ) + (set! (-> s5-0 impact-info pat) (-> s5-0 cquery best-other-tri pat)) + (rigid-body-control-method-23 arg0 (the-as vector (-> s5-0 impact-info)) (-> s5-0 impact-info velocity)) + (when (-> s5-0 rbody2) + (init-velocities! (-> s5-0 rbody2)) + (rigid-body-control-method-23 (-> s5-0 rbody2) (the-as vector (-> s5-0 impact-info)) (-> s5-0 vel)) + (vector-! (-> s5-0 impact-info velocity) (-> s5-0 impact-info velocity) (-> s5-0 vel)) + ) + (set! (-> s5-0 impact-info impulse) 0.0) + (set! (-> s5-0 vel-dot-norm) + (+ -409.6 (vector-dot (-> s5-0 impact-info velocity) (-> s5-0 impact-info normal))) + ) + (set! (-> s5-0 denom) 0.0) + (set! (-> s5-0 denom2) 0.0) + (b! (>= (-> s5-0 vel-dot-norm) 0.0) cfg-50) + (vector-! (-> s5-0 p-body) (the-as vector (-> s5-0 impact-info)) (-> arg0 position)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 p-body) (-> s5-0 impact-info normal)) + (vector-rotate*! (-> s5-0 tmp) (-> s5-0 tmp) (-> arg0 inv-i-world)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 p-body)) + (set! (-> s5-0 denom) (+ (-> arg0 info inv-mass) (vector-dot (-> s5-0 impact-info normal) (-> s5-0 tmp)))) + (let ((f30-1 (-> arg0 bounce-factor))) + (cond + ((-> s5-0 proc2) + (set! f30-1 + (cond + ((-> s5-0 rbody2) + (vector-! (-> s5-0 p-body) (the-as vector (-> s5-0 impact-info)) (-> s5-0 rbody2 position)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 p-body) (-> s5-0 impact-info normal)) + (vector-rotate*! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 rbody2 inv-i-world)) + (vector-cross! (-> s5-0 tmp) (-> s5-0 tmp) (-> s5-0 p-body)) + (set! (-> s5-0 denom2) + (+ (-> s5-0 rbody2 info inv-mass) (vector-dot (-> s5-0 impact-info normal) (-> s5-0 tmp))) + ) + (fmax + (fmax f30-1 (-> s5-0 rbody2 bounce-factor)) + (* (-> arg0 info bounce-mult-factor) (-> s5-0 rbody2 info bounce-mult-factor)) + ) + ) + (else + (let* ((s3-0 (-> s5-0 proc2)) + (a0-46 (if (type? s3-0 process-focusable) + s3-0 + ) + ) + ) + (if a0-46 + (set! (-> s5-0 denom2) (get-inv-mass a0-46)) + ) + ) + f30-1 + ) + ) + ) + ) + (else + ) + ) + (set! (-> s5-0 impact-info impulse) + (* (+ 1.0 f30-1) (- (-> s5-0 vel-dot-norm)) (/ 1.0 (+ (-> s5-0 denom) (-> s5-0 denom2)))) + ) + ) + (set! (-> s5-0 impact-info process) (-> s5-0 proc2)) + (when (-> s5-0 proc2) + (set! (-> s5-0 impact-info2 point quad) (-> s5-0 impact-info point quad)) + (vector-float*! (-> s5-0 impact-info2 normal) (-> s5-0 impact-info normal) -1.0) + (vector-float*! (-> s5-0 impact-info2 velocity) (-> s5-0 impact-info velocity) -1.0) + (set! (-> s5-0 impact-info2 impulse) (-> s5-0 impact-info impulse)) + (set! (-> s5-0 impact-info2 pat) (-> s5-0 impact-info pat)) + (set! (-> s5-0 impact-info2 prim-id) (-> s5-0 cquery best-other-prim prim-id)) + (set! (-> s5-0 impact-info2 process) (-> arg0 process)) + (send-event (-> s5-0 proc2) 'impact-impulse :from (-> arg0 process) (-> s5-0 impact-info2)) + (if (or (-> s5-0 rbody2) (let ((a0-53 (-> s5-0 proc2 root))) + (logtest? (-> a0-53 penetrated-by) (penetrate vehicle)) + ) + ) + 0 + (set! (-> s5-0 impact-info impulse) + (* (-> s5-0 impact-info impulse) (/ (+ (-> s5-0 denom) (-> s5-0 denom2)) (-> s5-0 denom))) + ) + ) + ) + (send-event (-> arg0 process) 'impact-impulse :from (-> arg0 process) (-> s5-0 impact-info)) + (vector-float*! (-> s5-0 force) (-> s5-0 impact-info normal) (-> s5-0 impact-info impulse)) + (let ((f30-2 (-> arg0 info mass))) + (if (-> s5-0 rbody2) + (set! f30-2 (fmin f30-2 (-> s5-0 rbody2 info mass))) + ) + (vector+float*! + (-> s5-0 tangent-dir) + (-> s5-0 impact-info velocity) + (-> s5-0 impact-info normal) + (- (-> s5-0 vel-dot-norm)) + ) + (vector-normalize! (-> s5-0 tangent-dir) 1.0) + (let ((f0-39 (* -1.0 (fmin + (* (vector-dot (-> s5-0 tangent-dir) (-> s5-0 impact-info velocity)) f30-2) + (* (-> arg0 friction-factor) (-> s5-0 impact-info impulse)) + ) + ) + ) + ) + (vector+float*! (-> s5-0 force) (-> s5-0 force) (-> s5-0 tangent-dir) f0-39) + ) + ) + (apply-impact! arg0 (the-as vector (-> s5-0 impact-info)) (-> s5-0 force)) + (when (-> s5-0 rbody2) + (vector-float*! (-> s5-0 force) (-> s5-0 force) -1.0) + (apply-impact! (-> s5-0 rbody2) (the-as vector (-> s5-0 impact-info)) (-> s5-0 force)) + ) + (rigid-body-control-method-12 arg0 1.0) + (init-velocities! arg0) + (let ((f30-3 (-> s5-0 best-dist))) + (when (< f30-3 0.0001) + (vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 impact-info normal) 40.96) + (rigid-body-control-method-26 arg0) + ) + (set! (-> s5-0 time-step-scale) (- (-> s5-0 time-step-scale) (* f30-3 (-> s5-0 time-step-scale)))) + ) + (when (-> s5-0 rbody2) + (rigid-body-control-method-12 (-> s5-0 rbody2) 1.0) + (init-velocities! (-> s5-0 rbody2)) + 0 + ) + (+! (-> s5-0 step-count) 1) + ) + (b! #t cfg-53 :delay (nop!)) + (label cfg-50) + (when (-> s5-0 rbody2) + (set! (-> arg0 blocked-by) (the-as process-focusable (-> s5-0 cquery best-other-prim cshape process))) + 0 + ) + (vector+float*! (-> arg0 position) (-> arg0 position) (-> s5-0 impact-info normal) 40.96) + (rigid-body-control-method-26 arg0) + 0 + (label cfg-53) + (when (< 0.0 (-> s5-0 time-step-scale)) + (rigid-body-control-method-14 arg0 (* (-> s5-0 time-step-scale) (-> s5-0 time-step))) + (init-velocities! arg0) + (transform-rigid-body-prims (-> this root-prim) (-> arg0 matrix)) + (set! (-> s5-0 time-step-scale) 0.0) + ) + (label cfg-55) + (let ((f0-53 (* (- 1.0 (-> s5-0 time-step-scale)) (-> s5-0 time-step)))) + (set! (-> arg0 time-remaining) (- (-> arg0 time-remaining) f0-53)) + ) + ) + 0 + (none) + ) + ) + +;; definition for method 18 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod apply-impact! ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (vector+! (-> this force) (-> this force) arg1) + (let ((v1-1 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-1 0) arg0 (-> this position)) + (vector-cross! (-> v1-1 1) (-> v1-1 0) arg1) + (vector+! (-> this torque) (-> this torque) (-> v1-1 1)) + ) + 0 + (none) + ) + +;; definition for method 22 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-22 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((v1-0 (new 'stack-no-clear 'inline-array 'vector 2))) + (vector-! (-> v1-0 0) arg0 (-> this position)) + (vector-cross! (-> v1-0 1) (-> v1-0 0) arg1) + (vector+! (-> this torque) (-> this torque) (-> v1-0 1)) + ) + 0 + (none) + ) + +;; definition for method 21 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-21 ((this rigid-body-control) (arg0 vector) (arg1 vector) (arg2 float)) + (vector+! (-> this force) (-> this force) arg1) + (let* ((t0-2 (vector-! (new 'stack-no-clear 'vector) arg0 (-> this position))) + (v1-3 (vector-cross! (new 'stack-no-clear 'vector) t0-2 arg1)) + ) + (let ((f0-0 (vector-length t0-2))) + (if (< arg2 f0-0) + (vector-float*! v1-3 v1-3 (/ arg2 f0-0)) + ) + ) + (vector+! (-> this torque) (-> this torque) v1-3) + ) + 0 + (none) + ) + +;; definition for method 19 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-control-method-19 ((this rigid-body-control) (arg0 vector) (arg1 vector)) + (let ((s5-0 (new 'stack-no-clear 'vector)) + (s4-0 (new 'stack-no-clear 'vector)) + ) + (vector-rotate*! s4-0 arg1 (-> this matrix)) + (vector-rotate*! s5-0 arg0 (-> this matrix)) + (vector+! s5-0 s5-0 (-> this position)) + (apply-impact! this s5-0 s4-0) + ) + 0 + (none) + ) + +;; definition for method 20 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod add-force! ((this rigid-body-control) (arg0 vector)) + (vector+! (-> this force) (-> this force) arg0) + 0 + (none) + ) + +;; definition for method 25 of type rigid-body-control +;; WARN: Return type mismatch vector vs none. +(defmethod rigid-body-control-method-25 ((this rigid-body-control) (arg0 vector)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector-rotate*! gp-0 (-> this info cm-offset-joint) (-> this matrix)) + (vector-! arg0 (-> this position) gp-0) + ) + (none) + ) + +;; definition for method 30 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod debug-print-force-torque ((this rigid-body-control) (arg0 object)) + (format arg0 " force ~M ~M ~M" (-> this force x) (-> this force y) (-> this force z)) + (format arg0 " torque ~M ~M ~M~%" (-> this torque x) (-> this torque y) (-> this torque z)) + 0 + (none) + ) + +;; definition for method 32 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod debug-print-momentum ((this rigid-body-control) (arg0 object)) + (format arg0 " lin-mom ~M ~M ~M" (-> this lin-momentum x) (-> this lin-momentum y) (-> this lin-momentum z)) + (format + arg0 + " ang-mom ~M ~M ~M~%" + (-> this ang-momentum x) + (-> this ang-momentum y) + (-> this ang-momentum z) + ) + 0 + (none) + ) + +;; definition for method 33 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod debug-print-velocity ((this rigid-body-control) (arg0 object)) + (format arg0 " lin-vel ~M ~M ~M" (-> this lin-velocity x) (-> this lin-velocity y) (-> this lin-velocity z)) + (format + arg0 + " ang-vel ~f ~f ~f~%" + (-> this ang-velocity x) + (-> this ang-velocity y) + (-> this ang-velocity z) + ) + 0 + (none) + ) + +;; definition for method 31 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod debug-print-pos-rot ((this rigid-body-control) (arg0 object)) + (format arg0 " position ~M ~M ~M" (-> this position x) (-> this position y) (-> this position z)) + (format arg0 " rotation ~f ~f ~f ~f~%" (-> this rot x) (-> this rot y) (-> this rot z) (-> this rot w)) + 0 + (none) + ) + +;; definition for method 29 of type rigid-body-control +;; WARN: Return type mismatch int vs none. +(defmethod debug-print-info ((this rigid-body-control) (arg0 object)) + (debug-print-force-torque this arg0) + (debug-print-pos-rot this arg0) + (debug-print-momentum this arg0) + (debug-print-velocity this arg0) + 0 + (none) + ) + +;; definition for method 10 of type rigid-body-control +;; WARN: Return type mismatch int vs object. +(defmethod rigid-body-control-method-10 ((this rigid-body-control) (arg0 rigid-body-object) (arg1 float) (arg2 float)) + (let* ((s4-1 (max 1 (min 4 (+ (the int (* 0.9999 (/ arg1 arg2))) 1)))) + (f30-0 (/ arg1 (the float s4-1))) + (s3-0 (-> this force-callback)) + ) + (while (nonzero? s4-1) + (+! s4-1 -1) + (s3-0 arg0 f30-0) + (rigid-body-control-method-9 this (the-as collide-shape-moving (-> arg0 root)) f30-0) + ) + ) + 0 + ) + +;; definition for method 11 of type rigid-body-control +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update-rbody-transform! ((this rigid-body-control) (arg0 collide-shape-moving)) + (quaternion-copy! (-> arg0 quat) (the-as quaternion (-> this rot))) + (rigid-body-control-method-25 this (-> arg0 trans)) + (set! (-> arg0 transv quad) (-> this lin-velocity quad)) + 0 + (none) + ) + +;; definition for method 27 of type rigid-body-object +(defmethod get-inv-mass ((this rigid-body-object)) + (-> this info info inv-mass) + ) + +;; definition for method 37 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-37 ((this rigid-body-object)) + (let ((a0-1 (-> this info name))) + (when (nonzero? a0-1) + (set! (-> this info) (the-as rigid-body-object-constants (-> a0-1 value))) + (set! (-> this rbody info) (-> this info info)) + ) + ) + (rigid-body-info-method-9 (-> this info info)) + (set! (-> this rbody force-callback) (method-of-object this apply-gravity!)) + 0 + (none) + ) + +;; definition for method 53 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-53 ((this rigid-body-object) (arg0 float)) + (when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + (when (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force)) + (vector-float*! (-> this player-force) (-> this player-force) (/ 1.0 arg0)) + ) + (apply-impact! (-> this rbody) (-> this player-force-position) (-> this player-force)) + ) + 0 + (none) + ) + +;; definition for method 31 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod apply-gravity! ((this rigid-body-object) (arg0 float)) + (let ((a1-1 (new 'stack-no-clear 'vector))) + (vector-reset! a1-1) + (set! (-> a1-1 y) (* -1.0 (-> this info extra gravity) (-> this rbody info mass))) + (add-force! (-> this rbody) a1-1) + ) + 0 + (none) + ) + +;; definition for method 32 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-32 ((this rigid-body-object)) + (rigid-body-control-method-10 (-> this rbody) this (seconds-per-frame) (-> this max-time-step)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + 0 + (none) + ) + +;; definition for method 54 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-54 ((this rigid-body-object)) + (rigid-body-control-method-10 (-> this rbody) this (-> this rbody time-remaining) (-> this max-time-step)) + 0 + (none) + ) + +;; definition for method 55 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod clear-impulse-force-flag! ((this rigid-body-object)) + (logclear! (-> this flags) (rigid-body-object-flag player-impulse-force player-contact-force)) + 0 + (none) + ) + +;; definition for method 36 of type rigid-body-object +;; WARN: Return type mismatch int vs object. +(defmethod go-idle ((this rigid-body-object)) + (go (method-of-object this idle)) + 0 + ) + +;; definition for method 33 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod alloc-rbody-control! ((this rigid-body-object) (arg0 rigid-body-object-constants)) + (set! (-> this info) arg0) + (set! (-> this rbody) (new 'process 'rigid-body-control this)) + (update-transforms (-> this root)) + (init! + (-> this rbody) + (-> this info info) + (-> this root trans) + (-> this root quat) + (the-as (function rigid-body-object float) (method-of-object this apply-gravity!)) + ) + (rigid-body-object-method-37 this) + (set! (-> this max-time-step) (-> arg0 extra max-time-step)) + (set! (-> this root max-iteration-count) (the-as uint 4)) + (when (nonzero? (-> this skel)) + (let ((v1-16 (-> this skel root-channel 0))) + (set! (-> v1-16 num-func) num-func-identity) + (set! (-> v1-16 frame-num) 0.0) + ) + ) + 0 + (none) + ) + +;; definition for method 34 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this rigid-body-object)) + (let ((s5-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player)))) + (set! (-> s5-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s5-0 reaction) cshape-reaction-default) + (set! (-> s5-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((s4-0 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> s4-0 prim-core collide-as) (collide-spec pusher)) + (set! (-> s4-0 prim-core collide-with) (collide-spec jak player-list)) + (set! (-> s4-0 prim-core action) (collide-action solid)) + (set! (-> s4-0 transform-index) 3) + (set-vector! (-> s4-0 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) s4-0) + ) + ((method-of-object s5-0 collide-shape-method-54)) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-16 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-16 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-16 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for symbol *rigid-body-object-constants*, type rigid-body-object-constants +(define *rigid-body-object-constants* (new 'static 'rigid-body-object-constants + :info (new 'static 'rigid-body-info + :mass 2.0 + :inv-mass 0.5 + :linear-damping 1.0 + :angular-damping 1.0 + :bounce-factor 0.5 + :friction-factor 0.1 + :cm-offset-joint (new 'static 'vector :w 1.0) + :inertial-tensor-box (new 'static 'array meters 3 (meters 4) (meters 4) (meters 4)) + ) + :extra (new 'static 'rigid-body-object-extra-info + :max-time-step 0.033333335 + :gravity (meters 80) + :idle-distance (meters 50) + :attack-force-scale 1.0 + ) + :name '*rigid-body-object-constants* + ) + ) + +;; definition for method 35 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod init-rbody-control! ((this rigid-body-object)) + (alloc-rbody-control! this *rigid-body-object-constants*) + 0 + (none) + ) + +;; definition for method 11 of type rigid-body-object +;; WARN: Return type mismatch int vs object. +(defmethod init-from-entity! ((this rigid-body-object) (arg0 entity-actor)) + (init-collision! this) + (process-drawable-from-entity! this arg0) + (init-rbody-control! this) + (go-idle this) + 0 + ) + +;; definition for method 38 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-38 ((this rigid-body-object)) + 0 + (none) + ) + +;; definition for method 30 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-30 ((this rigid-body-object)) + (ja-post) + 0 + (none) + ) + +;; definition for method 39 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rbody-post ((this rigid-body-object)) + (rigid-body-object-method-32 this) + (rigid-body-object-method-38 this) + (update-rbody-transform! (-> this rbody) (the-as collide-shape-moving (-> this root))) + (rigid-body-object-method-30 this) + (update-transforms (-> this root)) + 0 + (none) + ) + +;; definition for method 42 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-42 ((this rigid-body-object)) + (logior! (-> this flags) (rigid-body-object-flag enable-collision)) + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> this root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> this root backup-collide-with)) + ) + 0 + (none) + ) + +;; definition for method 43 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-43 ((this rigid-body-object)) + (logclear! (-> this flags) (rigid-body-object-flag enable-collision)) + (let ((v1-3 (-> this root root-prim))) + (set! (-> v1-3 prim-core collide-as) (collide-spec)) + (set! (-> v1-3 prim-core collide-with) (collide-spec)) + ) + 0 + 0 + (none) + ) + +;; definition for method 40 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod apply-momentum! ((this rigid-body-object)) + (when (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (logior! (-> this rbody flags) (rigid-body-flag enable-physics)) + (rigid-body-control-method-28 (-> this rbody) (-> this root trans) (-> this root quat)) + (vector-float*! (-> this rbody lin-momentum) (-> this root transv) (-> this info info mass)) + (vector-reset! (-> this rbody ang-momentum)) + ) + 0 + (none) + ) + +;; definition for method 41 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod disable-physics! ((this rigid-body-object)) + (logclear! (-> this rbody flags) (rigid-body-flag enable-physics)) + 0 + (none) + ) + +;; definition for method 44 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod impulse-handler ((this rigid-body-object)) + (logior! (-> this flags) (rigid-body-object-flag disturbed)) + (set-time! (-> this disturbed-time)) + (if (not (logtest? (-> this rbody flags) (rigid-body-flag enable-physics))) + (apply-momentum! this) + ) + 0 + (none) + ) + +;; definition for method 45 of type rigid-body-object +;; WARN: Return type mismatch int vs object. +(defmethod go-active ((this rigid-body-object)) + (go (method-of-object this active)) + 0 + ) + +;; definition for method 46 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-46 ((this rigid-body-object)) + 0 + (none) + ) + +;; definition for method 48 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod rigid-body-object-method-48 ((this rigid-body-object)) + 0 + (none) + ) + +;; definition for method 52 of type rigid-body-object +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod init-rbody-impact-from-tshape! ((this rigid-body-object) (arg0 rigid-body-impact) (arg1 touching-shapes-entry)) + (set! (-> arg0 process) #f) + (set! (-> arg0 prim-id) (the-as uint 0)) + (vector-reset! (-> arg0 normal)) + (vector-reset! (-> arg0 velocity)) + (set! (-> arg0 point quad) (-> this root trans quad)) + (when arg1 + (let ((s3-0 (-> arg1 head))) + (when s3-0 + (get-intersect-point (-> arg0 point) s3-0 (-> this root) arg1) + (let ((s5-1 (get-touched-prim s3-0 (-> this root) arg1))) + (when s5-1 + (set! (-> arg0 prim-id) (-> s5-1 prim-id)) + (vector-! (-> arg0 normal) (-> arg0 point) (the-as vector (-> s5-1 prim-core))) + (vector-normalize! (-> arg0 normal) 1.0) + (vector+float*! + (-> arg0 point) + (the-as vector (-> s5-1 prim-core)) + (-> arg0 normal) + (-> s5-1 prim-core world-sphere w) + ) + ) + ) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 47 of type rigid-body-object +;; WARN: Return type mismatch int vs none. +(defmethod impulse-force<-penetrate ((this rigid-body-object) (arg0 rigid-body-impact) (arg1 attack-info) (arg2 penetrate)) + (local-vars (f1-1 float)) + 0.0 + (let ((f0-1 0.0)) + (cond + ((logtest? (penetrate jak-red-shockwave) arg2) + (set! f0-1 (* 81920.0 (-> arg1 control))) + (set! f1-1 (-> arg1 damage)) + ) + ((logtest? arg2 (penetrate punch)) + (set! f0-1 40960.0) + (set! f1-1 4.0) + ) + ((logtest? arg2 (penetrate flop spin)) + (set! f0-1 20480.0) + (set! f1-1 2.0) + ) + ((logtest? (attack-mask vehicle-damage-factor) (-> arg1 mask)) + (set! f1-1 (* (-> arg1 damage) (-> arg1 vehicle-damage-factor))) + (if (logtest? (attack-mask vehicle-impulse-factor) (-> arg1 mask)) + (set! f0-1 (* 49152.0 (-> arg1 vehicle-impulse-factor) (-> arg1 damage))) + ) + 0 + ) + (else + (set! f0-1 8192.0) + (set! f1-1 2.0) + ) + ) + (set! (-> arg0 impulse) (* f0-1 (-> this info extra attack-force-scale))) + ) + (rigid-body-object-method-46 this) + 0 + (none) + ) + +;; definition for method 50 of type rigid-body-object +;; INFO: Used lq/sq +(defmethod attack-handler ((this rigid-body-object) + (arg0 process-drawable) + (arg1 attack-info) + (arg2 touching-shapes-entry) + (arg3 penetrate) + ) + (when arg2 + (let ((s5-0 (new 'stack-no-clear 'rigid-body-impact))) + (init-rbody-impact-from-tshape! this s5-0 arg2) + (if (logtest? (attack-mask attacker-velocity) (-> arg1 mask)) + (set! (-> s5-0 velocity quad) (-> arg1 attacker-velocity quad)) + (vector-! (-> s5-0 velocity) (-> s5-0 point) (-> arg0 root trans)) + ) + (impulse-force<-penetrate this s5-0 arg1 arg3) + (impulse-handler this) + (let ((s4-1 (new 'stack-no-clear 'vector))) + (set! (-> s4-1 quad) (-> s5-0 velocity quad)) + (vector-normalize! s4-1 1.0) + (vector-float*! s4-1 s4-1 (-> s5-0 impulse)) + (apply-impact! (-> this rbody) (-> s5-0 point) s4-1) + (rigid-body-control-method-12 (-> this rbody) 1.0) + (init-velocities! (-> this rbody)) + (when #f + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*) + (add-debug-vector #t (bucket-id debug-no-zbuf1) (-> s5-0 point) s4-1 (meters 0.00024414062) *color-blue*) + ) + ) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + #t + ) + ) + +;; definition for method 51 of type rigid-body-object +;; INFO: Used lq/sq +(defmethod touch-handler ((this rigid-body-object) (arg0 process-focusable) (arg1 touching-shapes-entry)) + (b! + (or (not (logtest? (process-mask target crate enemy) (-> arg0 mask))) + (and (logtest? (-> arg0 mask) (process-mask target)) (focus-test? arg0 dangerous pilot)) + ) + cfg-17 + :delay (nop!) + ) + (let ((s5-0 (new 'stack-no-clear 'rigid-body-impact)) + (s4-0 (new 'stack-no-clear 'vector)) + (f30-0 (get-inv-mass arg0)) + ) + (init-rbody-impact-from-tshape! this s5-0 arg1) + (if (logtest? (-> this rbody flags) (rigid-body-flag enable-physics)) + (rigid-body-control-method-23 (-> this rbody) (-> s5-0 point) (-> s5-0 velocity)) + (set! (-> s5-0 velocity quad) (-> this root transv quad)) + ) + (let ((v1-17 (-> arg0 root))) + (set! (-> s4-0 quad) (-> v1-17 transv quad)) + (vector-! (-> s5-0 velocity) (-> v1-17 transv) (-> s5-0 velocity)) + ) + (let ((f0-1 (vector-dot (-> s5-0 velocity) (-> s5-0 normal)))) + (when (< f0-1 0.0) + (set! (-> s5-0 impulse) (/ f0-1 (+ f30-0 (-> this info info inv-mass)))) + (vector+float*! s4-0 s4-0 (-> s5-0 normal) (* -3.1 f30-0 (-> s5-0 impulse))) + (set! (-> s4-0 y) (fmax (* 49152.0 f30-0) (-> s4-0 y))) + (impulse-handler this) + (let ((a2-4 (new 'stack-no-clear 'vector))) + (vector-float*! a2-4 (-> s5-0 normal) (-> s5-0 impulse)) + (apply-impact! (-> this rbody) (-> s5-0 point) a2-4) + ) + (rigid-body-control-method-12 (-> this rbody) 1.0) + (init-velocities! (-> this rbody)) + (when #f + (add-debug-x #t (bucket-id debug-no-zbuf1) (-> s5-0 point) *color-blue*) + (add-debug-vector + #t + (bucket-id debug-no-zbuf1) + (-> s5-0 point) + (-> s5-0 normal) + (- (-> s5-0 impulse)) + *color-blue* + ) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + ) + ) + ) + (label cfg-17) + #t + ) + +;; definition for method 49 of type rigid-body-object +;; INFO: Used lq/sq +(defmethod rbody-event-handler ((this rigid-body-object) (arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (case arg2 + (('impact-impulse) + (-> arg3 param 0) + (if (!= this arg0) + (impulse-handler this) + ) + (rigid-body-object-method-48 this) + (if (and (-> this next-state) (= (-> this next-state name) 'idle)) + (go-active this) + ) + #t + ) + (('touched) + (if (= this *debug-actor*) + (format *stdcon* "rigid-body-object got touched~%") + ) + (when (zero? (-> (the-as process-focusable arg0) rbody)) + (let ((s3-0 (if (type? arg0 process-focusable) + arg0 + ) + ) + ) + (when s3-0 + (when (logtest? (-> s3-0 mask) (process-mask target)) + (logior! (-> this flags) (rigid-body-object-flag player-touching)) + (set-time! (-> this player-touch-time)) + (impulse-handler this) + ) + (if (not (logtest? (-> s3-0 mask) (process-mask target))) + (touch-handler this (the-as process-focusable s3-0) (the-as touching-shapes-entry (-> arg3 param 0))) + ) + ) + ) + ) + ) + (('attack) + (let ((s3-1 (the-as object (-> arg3 param 1))) + (t0-1 (get-penetrate-using-from-attack-event (the-as process-drawable arg0) arg3)) + ) + (when (!= (-> (the-as attack-info s3-1) id) (-> this incoming-attack-id)) + (set! (-> this incoming-attack-id) (-> (the-as attack-info s3-1) id)) + (attack-handler + this + (the-as process-drawable arg0) + (the-as attack-info s3-1) + (the-as touching-shapes-entry (-> arg3 param 0)) + t0-1 + ) + ) + ) + ) + (('edge-grabbed 'pilot-edge-grab) + (let ((s5-2 (the-as object (-> arg3 param 0)))) + (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) + (let ((a0-25 (if (type? arg0 process-focusable) + (the-as process-focusable arg0) + ) + ) + ) + (when a0-25 + (let ((f0-1 (/ 163840.0 (get-inv-mass a0-25)))) + (logior! (-> this flags) (rigid-body-object-flag player-touching player-edge-grabbing player-contact-force)) + (set! (-> this player-force-position quad) (-> (the-as attack-info s5-2) attacker-velocity quad)) + (vector-reset! (-> this player-force)) + (set! (-> this player-force y) (* -1.0 f0-1)) + ) + ) + ) + ) + ) + (not (logtest? (-> this focus-status) (focus-status dead inactive))) + ) + (('ridden) + (let ((v1-47 (the-as object (-> arg3 param 0)))) + (when (the-as uint v1-47) + (let* ((s5-3 (handle->process (-> (the-as focus v1-47) handle))) + (a0-34 (if (type? s5-3 process-focusable) + s5-3 + ) + ) + ) + (when (and a0-34 + (logtest? (-> a0-34 mask) (process-mask target)) + (not (logtest? (-> (the-as process-focusable a0-34) focus-status) (focus-status on-water under-water))) + ) + (when (not (logtest? (-> this flags) (rigid-body-object-flag player-impulse-force))) + (logior! (-> this flags) (rigid-body-object-flag player-touching player-standing-on player-contact-force)) + (set! (-> this player-force-position quad) (-> (the-as process-focusable a0-34) root trans quad)) + (vector-reset! (-> this player-force)) + (let ((f0-4 (/ 163840.0 (get-inv-mass (the-as process-focusable a0-34)))) + (f1-1 1.0) + ) + (set! (-> this player-force y) (* -1.0 f0-4 f1-1)) + ) + ) + ) + ) + ) + ) + ) + (('bonk) + (when #t + (let* ((s3-2 arg0) + (s4-1 (if (type? s3-2 process-focusable) + s3-2 + ) + ) + ) + (when s4-1 + (logior! (-> this flags) (rigid-body-object-flag player-touching player-impulse-force)) + (set-time! (-> this player-touch-time)) + (impulse-handler this) + (set! (-> this player-force-position quad) (-> (the-as process-focusable s4-1) root trans quad)) + (let ((f30-2 (* 0.00012207031 (the-as float (-> arg3 param 1)))) + (f0-9 (/ 163840.0 (get-inv-mass (the-as process-focusable s4-1)))) + ) + (vector-reset! (-> this player-force)) + (set! (-> this player-force y) (* -0.1 f0-9 f30-2)) + ) + ) + ) + ) + ) + (('enable-physics) + (impulse-handler this) + ) + ) + ) + +;; definition for function rigid-body-object-event-handler +(defbehavior rigid-body-object-event-handler rigid-body-object ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) + (rbody-event-handler self arg0 arg1 arg2 arg3) + ) + +;; failed to figure out what this is: +(defstate idle (rigid-body-object) + :virtual #t + :trans (behavior () + (if (and *target* (and (>= (-> self info extra idle-distance) + (vector-vector-distance (-> self root trans) (-> *target* control trans)) + ) + (not (logtest? (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (go-virtual active) + ) + ) + :code sleep-code + :post ja-post + ) + +;; failed to figure out what this is: +(defstate active (rigid-body-object) + :virtual #t + :event rigid-body-object-event-handler + :trans (behavior () + (if (or (not *target*) (or (< (+ 4096.0 (-> self info extra idle-distance)) + (vector-vector-distance (-> self root trans) (-> *target* control trans)) + ) + (focus-test? *target* teleporting) + ) + ) + (go-virtual idle) + ) + ) + :code sleep-code + :post (behavior () + (rbody-post self) + ) + ) diff --git a/test/decompiler/reference/jak3/engine/process-drawable/focus_REF.gc b/test/decompiler/reference/jak3/engine/process-drawable/focus_REF.gc index b1e130d3f70..9d5ec7bf29d 100644 --- a/test/decompiler/reference/jak3/engine/process-drawable/focus_REF.gc +++ b/test/decompiler/reference/jak3/engine/process-drawable/focus_REF.gc @@ -9,7 +9,7 @@ ) (:methods (clear-focused (_type_) none) - (collide-check? (_type_ process-focusable) object) + (collide-spec-match? (_type_ process-focusable) object) (reset-to-collide-spec (_type_ collide-spec) none) (try-update-focus (_type_ process-focusable) symbol) ) @@ -39,7 +39,7 @@ ) ;; definition for method 10 of type focus -(defmethod collide-check? ((this focus) (proc process-focusable)) +(defmethod collide-spec-match? ((this focus) (proc process-focusable)) "If the focused process is not dead, check that the [[collide-spec]] of the focus and the process match." (when (and proc (not (logtest? (-> proc focus-status) (focus-status disable dead)))) @@ -71,7 +71,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/process-drawable/process-taskable-h_REF.gc b/test/decompiler/reference/jak3/engine/process-drawable/process-taskable-h_REF.gc index 8c6776adfe2..eb445061701 100644 --- a/test/decompiler/reference/jak3/engine/process-drawable/process-taskable-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/process-drawable/process-taskable-h_REF.gc @@ -24,13 +24,13 @@ (play-game game-task-event) ) (:methods - (process-taskable-method-33 () none) - (process-taskable-method-34 () none) - (process-taskable-method-35 () none) - (process-taskable-method-36 () none) - (process-taskable-method-37 () none) - (process-taskable-method-38 () none) - (process-taskable-method-39 () none) + (init-collision! (_type_) none) + (init-defaults! (_type_) none) + (init-skeleton! (_type_) none) + (process-taskable-method-36 (_type_) symbol) + (get-art-element (_type_) art-element) + (process-taskable-method-38 (_type_) none) + (update-cloth-and-shadow (_type_) none) ) ) @@ -60,7 +60,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/process-drawable/process-taskable_REF.gc b/test/decompiler/reference/jak3/engine/process-drawable/process-taskable_REF.gc new file mode 100644 index 00000000000..34a21838a49 --- /dev/null +++ b/test/decompiler/reference/jak3/engine/process-drawable/process-taskable_REF.gc @@ -0,0 +1,542 @@ +;;-*-Lisp-*- +(in-package goal) + +;; definition for method 7 of type process-taskable +;; WARN: Return type mismatch process-focusable vs process-taskable. +(defmethod relocate ((this process-taskable) (offset int)) + (if (nonzero? (-> this task)) + (&+! (-> this task) offset) + ) + (the-as process-taskable ((method-of-type process-focusable relocate) this offset)) + ) + +;; definition for function process-taskable-anim-loop +;; WARN: Return type mismatch int vs none. +(defbehavior process-taskable-anim-loop process-taskable ((arg0 (function process-taskable object))) + (while (arg0 self) + (let ((s5-0 (get-art-element self))) + (when (!= (ja-group) s5-0) + (ja-channel-push! 1 0) + (set! (-> self skel root-channel 0 frame-group) (the-as art-joint-anim s5-0)) + ) + ) + (suspend) + (if (ja-group) + (ja :num! (loop!)) + ) + (process-taskable-method-38 self) + ) + 0 + (none) + ) + +;; definition for method 36 of type process-taskable +(defmethod process-taskable-method-36 ((this process-taskable)) + #t + ) + +;; definition for method 37 of type process-taskable +;; WARN: Return type mismatch art-joint-anim vs art-element. +(defmethod get-art-element ((this process-taskable)) + (the-as art-element (if (> (-> this skel active-channels) 0) + (-> this skel root-channel 0 frame-group) + ) + ) + ) + +;; definition for method 38 of type process-taskable +;; WARN: Return type mismatch int vs none. +(defmethod process-taskable-method-38 ((this process-taskable)) + 0 + (none) + ) + +;; definition for method 39 of type process-taskable +;; WARN: Return type mismatch object vs none. +(defmethod update-cloth-and-shadow ((this process-taskable)) + (if (logtest? (-> this draw status) (draw-control-status no-draw)) + (process-drawable-show-all-cloth this #f) + (process-drawable-show-all-cloth this #t) + ) + (let ((a0-3 (-> this draw shadow-ctrl))) + (cond + ((and (-> this draw shadow) + (and (zero? (-> this draw cur-lod)) (logtest? (-> this draw status) (draw-control-status on-screen))) + ) + (probe-line-for-shadow a0-3 (-> this draw origin) -4096.0 4096.0 32768.0) + ) + (else + (let ((v1-14 a0-3)) + (logior! (-> v1-14 settings flags) (shadow-flags disable-draw)) + ) + 0 + ) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate hide (process-taskable) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('say) + (let ((v0-0 (current-time))) + (set! (-> self want-to-say) v0-0) + v0-0 + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (logior! (-> self draw status) (draw-control-status no-draw-bounds)) + (let ((v1-6 (-> self root root-prim))) + (set! (-> v1-6 prim-core collide-as) (collide-spec)) + (set! (-> v1-6 prim-core collide-with) (collide-spec)) + ) + 0 + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw-bounds)) + (let ((v1-3 (-> self root root-prim))) + (set! (-> v1-3 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-3 prim-core collide-with) (-> self root backup-collide-with)) + ) + (process-drawable-show-all-cloth self #t) + ) + :trans (behavior () + (let ((v1-1 (get-current-task-event (-> self task)))) + (if (and (nonzero? (-> v1-1 action)) (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (logtest? (-> v1-1 flags) (game-task-flags gatflag-01)) + (not (time-elapsed? (-> self birth-time) (seconds 0.1))) + ) + ) + (go-virtual idle) + ) + ) + ) + :code sleep-code + ) + +;; failed to figure out what this is: +(defstate idle (process-taskable) + :virtual #t + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (case message + (('attack) + (cond + ((logtest? (-> self flags) (process-taskable-flags ptf4)) + (go-virtual die) + ) + ((logtest? (-> self flags) (process-taskable-flags ptf0)) + (send-event proc 'shove #f (static-attack-info :mask (vehicle-impulse-factor) ((id (new-attack-id)) + (damage 2.0) + (vehicle-damage-factor 1.0) + (vehicle-impulse-factor 1.0) + (shove-back (meters 3)) + (shove-up (meters 1)) + ) + ) + ) + ) + ) + ) + (('touch) + (send-shoves (-> self root) proc (the-as touching-shapes-entry (-> block param 0)) 0.7 6144.0 16384.0) + ) + (('say) + (let ((v0-0 (the-as object (current-time)))) + (set! (-> self want-to-say) (the-as time-frame v0-0)) + v0-0 + ) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + ) + :exit (behavior () + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + :trans (behavior () + (if (< (vector-vector-distance (-> self draw origin) (math-camera-pos)) (-> self draw origin w)) + (logclear! (-> self draw status) (draw-control-status force-vu1)) + (logior! (-> self draw status) (draw-control-status force-vu1)) + ) + (let ((gp-1 (get-current-task-event (-> self task)))) + (cond + ((= (-> gp-1 action) (game-task-action hide)) + (if (or (not (logtest? (-> self draw status) (draw-control-status on-screen))) + (logtest? (-> gp-1 flags) (game-task-flags gatflag-01)) + ) + (go-virtual hide) + ) + ) + ((or (not *target*) *scene-player*) + ) + ((not (logtest? (-> self flags) (process-taskable-flags ptf1))) + (if (>= (- (-> *display* game-clock frame-counter) (-> self last-talk)) (seconds 5)) + (logior! (-> self flags) (process-taskable-flags ptf1)) + ) + ) + ((and (-> gp-1 scene) + (begin + (when (not (or (= (-> gp-1 action) (game-task-action play)) + (-> *setting-control* user-current movie-name) + (name= (-> gp-1 scene) (-> *setting-control* user-current movie-name)) + ) + ) + (let ((v1-42 (scene-lookup (-> gp-1 scene)))) + (gui-control-method-12 + *gui-control* + self + (gui-channel art-load) + (gui-action queue) + (if v1-42 + (-> v1-42 anim) + (-> gp-1 scene) + ) + 0 + -99.0 + (new 'static 'sound-id) + ) + ) + ) + (and (not (logtest? (focus-status dead in-air in-head pole tube mech) (-> *target* focus-status))) + (and (or (and (< (-> (target-pos 0) y) (+ (-> self root root-prim prim-core world-sphere y) (-> self talk-height))) + (let ((s5-1 (get-trans self 2)) + (f30-0 (if (= (-> gp-1 distance) 0.0) + (-> self talk-distance) + (-> gp-1 distance) + ) + ) + ) + (< (vector-vector-distance (target-pos 0) s5-1) f30-0) + ) + ) + (not (time-elapsed? (-> self want-to-say) (seconds 4))) + ) + (or (not (load-in-progress? *level*)) (= (-> gp-1 action) (game-task-action say))) + (and (not (movie?)) + (or (not (logtest? (-> self flags) (process-taskable-flags ptf6))) (not (talker-displayed?))) + (none-reserved? *art-control*) + (not *progress-process*) + (not (-> *setting-control* user-current movie)) + ) + ) + ) + ) + ) + (when (and (or (= (-> gp-1 action) (game-task-action say)) + (= (-> gp-1 action) (game-task-action talk)) + (= (-> gp-1 action) (game-task-action trade)) + (= (-> gp-1 action) (game-task-action play)) + ) + (process-taskable-method-36 self) + ) + (when (or (= (-> gp-1 action) (game-task-action say)) (not (time-elapsed? (-> self want-to-say) (seconds 4)))) + (case (-> gp-1 action) + (((game-task-action play)) + (go-virtual play-game gp-1) + ) + (else + (go-virtual active gp-1) + ) + ) + ) + (kill-current-talker '() '(daxter voicebox ambient) 'exit) + (talker-surpress!) + (when (can-display-query? self "process-taskable" -99.0) + (let ((s5-2 + (new 'stack 'font-context *font-default-matrix* 32 280 0.0 (font-color default) (font-flags shadow kerning)) + ) + ) + (let ((v1-96 s5-2)) + (set! (-> v1-96 width) (the float 340)) + ) + (let ((v1-97 s5-2)) + (set! (-> v1-97 height) (the float 80)) + ) + (let ((v1-98 s5-2) + (a0-39 (-> *setting-control* user-default language)) + ) + (set! (-> v1-98 scale) (if (or (= a0-39 (language-enum korean)) (= a0-39 (language-enum russian))) + 0.9 + 0.7 + ) + ) + ) + (set! (-> s5-2 flags) (font-flags shadow kerning middle-vert large)) + (print-game-text + (lookup-text! *common-text* (-> self talk-message) #f) + s5-2 + #f + 44 + (bucket-id hud-draw-hud-alpha) + ) + ) + (when (cpad-pressed? 0 triangle) + (logclear! (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons triangle)) + (logclear! (-> *cpad-list* cpads 0 button0-rel 0) (pad-buttons triangle)) + (case (-> gp-1 action) + (((game-task-action play)) + (go-virtual play-game gp-1) + ) + (else + (go-virtual active gp-1) + ) + ) + ) + ) + ) + ) + ) + ) + (update-cloth-and-shadow self) + ) + :code (behavior () + (process-taskable-anim-loop (the-as (function process-taskable object) true-func)) + ) + :post (behavior () + (if (and (logtest? (-> self flags) (process-taskable-flags ptf3)) (movie?)) + (logior! (-> self draw status) (draw-control-status no-draw)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + ) + (when (logtest? (-> self flags) (process-taskable-flags ptf2)) + (if *target* + (look-at! (-> *target* neck) (get-trans self 2) 'nothing-special self) + ) + ) + (transform-post) + ) + ) + +;; failed to figure out what this is: +(defstate active (process-taskable) + :virtual #t + :event (-> (method-of-type process-taskable hide) event) + :enter (behavior ((arg0 game-task-event)) + (set! (-> self want-to-say) 0) + (process-entity-status! self (entity-perm-status no-kill) #t) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :exit (behavior () + (set! (-> self last-talk) (-> *display* game-clock frame-counter)) + (if (not (time-elapsed? (-> self want-to-say) (seconds 4))) + (logior! (-> self flags) (process-taskable-flags ptf1)) + (logclear! (-> self flags) (process-taskable-flags ptf1)) + ) + (process-entity-status! self (entity-perm-status no-kill) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-15 (-> self root root-prim))) + (set! (-> v1-15 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-15 prim-core collide-with) (-> self root backup-collide-with)) + ) + ) + :code (behavior ((arg0 game-task-event)) + (when (-> arg0 scene) + (let ((gp-1 (ppointer->handle + (process-spawn scene-player :init scene-player-init (-> arg0 scene) #t #f :name "scene-player") + ) + ) + ) + (while (and (handle->process (the-as handle gp-1)) (not (movie?))) + (suspend) + ) + (process-drawable-show-all-cloth self #f) + (logior! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-15 (-> self root root-prim))) + (set! (-> v1-15 prim-core collide-as) (collide-spec)) + (set! (-> v1-15 prim-core collide-with) (collide-spec)) + ) + 0 + (while (handle->process (the-as handle gp-1)) + (suspend) + ) + ) + ) + (go-virtual hide) + ) + ) + +;; failed to figure out what this is: +(defstate die (process-taskable) + :virtual #t + :enter (behavior () + (set! (-> self want-to-say) 0) + (process-entity-status! self (entity-perm-status no-kill) #t) + (logclear! (-> self mask) (process-mask actor-pause)) + ) + :exit (behavior () + (process-entity-status! self (entity-perm-status no-kill) #f) + (logior! (-> self mask) (process-mask actor-pause)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (let ((v1-5 (-> self root root-prim))) + (set! (-> v1-5 prim-core collide-as) (-> self root backup-collide-as)) + (set! (-> v1-5 prim-core collide-with) (-> self root backup-collide-with)) + ) + ) + :code (behavior () + (if (-> self skel effect) + (do-effect (-> self skel effect) (the-as symbol "death-default") 0.0 -1) + ) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 1)) + (suspend) + ) + ) + (if (logtest? (-> self flags) (process-taskable-flags ptf5)) + (restart-mission) + ) + (cleanup-for-death self) + ) + :post (-> (method-of-type process-taskable idle) post) + ) + +;; failed to figure out what this is: +(defstate play-game (process-taskable) + :virtual #t + :enter (-> (method-of-type process-taskable active) enter) + :exit (-> (method-of-type process-taskable active) exit) + :code (behavior ((arg0 game-task-event)) + (let ((gp-0 (current-time))) + (until (time-elapsed? gp-0 (seconds 0.5)) + (suspend) + ) + ) + (go-virtual hide) + ) + :post (-> (method-of-type process-taskable idle) post) + ) + +;; definition for method 33 of type process-taskable +;; WARN: Return type mismatch int vs none. +(defmethod init-collision! ((this process-taskable)) + (let ((s5-0 (new 'process 'collide-shape this (collide-list-enum usually-hit-by-player)))) + (let ((s4-0 (new 'process 'collide-shape-prim-group s5-0 (the-as uint 3) 0))) + (set! (-> s5-0 total-prims) (the-as uint 4)) + (set! (-> s4-0 prim-core collide-as) (collide-spec civilian)) + (set! (-> s4-0 prim-core action) (collide-action solid no-standon)) + (set! (-> s4-0 transform-index) 0) + (set-vector! (-> s4-0 local-sphere) 0.0 -1024.0 0.0 7372.8) + (set! (-> s5-0 root-prim) s4-0) + ) + (let ((v1-7 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-7 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-7 prim-core action) (collide-action solid)) + (set! (-> v1-7 transform-index) 0) + (set-vector! (-> v1-7 local-sphere) 0.0 -4096.0 0.0 4096.0) + ) + (let ((v1-9 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-9 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-9 prim-core action) (collide-action solid)) + (set! (-> v1-9 transform-index) 0) + (set-vector! (-> v1-9 local-sphere) 0.0 -1024.0 0.0 4096.0) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-11 prim-core collide-as) (collide-spec civilian)) + (set! (-> v1-11 prim-core action) (collide-action solid no-standon)) + (set! (-> v1-11 transform-index) 0) + (set-vector! (-> v1-11 local-sphere) 0.0 2048.0 0.0 4096.0) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-14 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> this root) s5-0) + ) + 0 + (none) + ) + +;; definition for method 34 of type process-taskable +;; WARN: Return type mismatch int vs none. +(defmethod init-defaults! ((this process-taskable)) + (logior! (-> this skel status) (joint-control-status eye-anim)) + (set! (-> this talk-message) (text-id press-triangle-to-talk)) + (set! (-> this flags) (process-taskable-flags ptf0 ptf1 ptf2 ptf3 ptf5)) + (set! (-> this neck-joint-index) -1) + (set! (-> this talk-distance) (res-lump-float (-> this entity) 'distance :default 32768.0)) + (set! (-> this talk-height) (res-lump-float (-> this entity) 'height :default 8192.0)) + (set! (-> this slave) (the-as handle #f)) + (set! (-> this draw shadow-ctrl) (new + 'process + 'shadow-control + 0.0 + 0.0 + 614400.0 + (the-as vector #f) + (shadow-flags shdf02 shdf03 shdf04 disable-draw) + 245760.0 + ) + ) + (let ((s5-0 0)) + (let ((v1-12 (the-as joint (get-art-by-name-method (-> this draw jgeo) "main" (the-as type #f))))) + (if v1-12 + (set! s5-0 (+ (-> v1-12 number) 1)) + ) + ) + (let ((v1-16 (-> this root root-prim))) + (set! (-> v1-16 transform-index) s5-0) + (dotimes (a0-7 (the-as int (-> v1-16 specific 0))) + (set! (-> (the-as collide-shape-prim-group v1-16) child a0-7 transform-index) s5-0) + ) + ) + ) + 0 + (none) + ) + +;; definition for method 35 of type process-taskable +;; WARN: Return type mismatch int vs none. +(defmethod init-skeleton! ((this process-taskable)) + 0 + (none) + ) + +;; definition for method 11 of type process-taskable +(defmethod init-from-entity! ((this process-taskable) (entity entity-actor)) + (stack-size-set! (-> this main-thread) 512) + (init-collision! this) + (process-drawable-from-entity! this entity) + (set! (-> this task) + (new 'process 'game-task-control (res-lump-value entity 'task-actor game-task-actor :time -1000000000.0)) + ) + (init-skeleton! this) + (init-defaults! this) + (logior! (-> this skel status) (joint-control-status blend-shape eye-anim)) + (when (logtest? #x1000000 (res-lump-value entity 'options uint128 :time -1000000000.0)) + (let* ((s5-1 *level*) + (s4-2 (method-of-object s5-1 art-group-get-by-name)) + ) + (format (clear *temp-string*) "skel-~S" (-> this draw art-group name)) + (let ((s4-3 (s4-2 s5-1 *temp-string* (the-as (pointer level) #f)))) + (when s4-3 + (let ((s5-2 (process-spawn + manipy + :init manipy-init + (-> this root trans) + (-> this entity) + s4-3 + #f + 0 + :name "manipy" + :to this + :stack-size #x20000 + ) + ) + ) + (send-event (ppointer->process s5-2) 'anim-mode 'mirror) + (send-event (ppointer->process s5-2) 'mirror #t) + ) + ) + ) + ) + ) + (set! (-> this event-hook) (-> (method-of-object this idle) event)) + (go (method-of-object this hide)) + ) diff --git a/test/decompiler/reference/jak3/engine/scene/scene-h_REF.gc b/test/decompiler/reference/jak3/engine/scene/scene-h_REF.gc index 966b087d22c..c4bddaad488 100644 --- a/test/decompiler/reference/jak3/engine/scene/scene-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/scene/scene-h_REF.gc @@ -9,24 +9,24 @@ (prefix string) (draw-frames pair) (scissor-frames pair) - (shadow-frames basic) - (cloth-reset-frames basic) - (cloth-commands basic) + (shadow-frames pair) + (cloth-reset-frames pair) + (cloth-commands pair) (camera int16) (light-index uint8) (shadow-mask uint8) (shadow-values uint32) (flags uint32) - (command-list basic) + (command-list pair) (shadow-flags int32) (shadow-volume-joint basic) (draw-seg uint64) (no-draw-seg uint64) (last-frame float) - (process uint64) + (process handle) ) (:methods - (scene-actor-method-9 () none) + (setup-manipy-for-scene! (_type_ scene-player) (pointer process)) ) ) @@ -76,20 +76,20 @@ (wait-air-time time-frame) (wait-ground-time time-frame) (actor (array scene-actor)) - (load-point continue-point) - (end-point continue-point) + (load-point basic) + (end-point basic) (borrow pair) (sfx-volume float) (ambient-volume float) (music-volume float) (music-delay float) (scene-task uint16) - (on-running basic) - (on-complete basic) + (on-running pair) + (on-complete pair) ) (:methods - (scene-method-16 () none) - (scene-method-17 () none) + (init-spool-by-scene! (_type_ spool-anim) spool-anim) + (load-scene (_type_) scene) ) ) @@ -159,17 +159,19 @@ (last-frame float) (end-point basic) (blackout-end basic) - (new-trans-hook basic) - (cur-trans-hook basic) + (new-trans-hook (function none)) + (cur-trans-hook (function none)) (user-data uint64) ) + (:state-methods + (wait symbol) + release + play-anim + ) (:methods - (scene-player-method-20 () none) - (scene-player-method-21 () none) - (scene-player-method-22 () none) - (scene-player-method-23 () none) - (scene-player-method-24 () none) - (scene-player-method-25 () none) + (scene-player-method-23 (_type_ string symbol) none) + (scene-player-method-24 (_type_ scene symbol) scene) + (scene-player-method-25 (_type_ float float) none) ) ) @@ -223,7 +225,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc index 1bf8071bd02..1a5d50870bb 100644 --- a/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/board/board-states_REF.gc @@ -434,50 +434,11 @@ (cond ((logtest? (-> *part-group-id-table* 189 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> gp-2 quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-11 (method-of-type part-tracker-subsampler activate))) - (t9-11 (the-as part-tracker-subsampler s5-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-15 s5-1) - (a1-9 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 189)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-12) a0-15 a1-9 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 189)) ) (else (set! (-> *launch-matrix* trans quad) (-> gp-2 quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-14 (method-of-type part-tracker activate))) - (t9-14 (the-as part-tracker s5-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-15 run-function-in-process) - (a0-20 s5-2) - (a1-12 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 189)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-15) a0-20 a1-12 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 189)) ) ) (let ((s5-3 (process-spawn @@ -897,53 +858,20 @@ ) (sound-play "board-launch") (when (!= (-> self board charge-progress) 0.0) - (cond - ((logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker-subsampler activate))) - (t9-8 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-35 gp-2) - (a1-7 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) (-> self node-list data 0 bone transform)) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-9) a0-35 a1-7 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-38 gp-3) - (a1-10 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) (-> self node-list data 0 bone transform)) - ((the-as (function object object object none) t9-12) a0-38 a1-10 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) ) ) - ) ) (set-time! (-> self board halfpipe-jump-time)) (set! (-> self board charge-progress) 0.0) @@ -1042,53 +970,20 @@ (when (and (cpad-hold? (-> self control cpad number) l1) (!= (-> self board charge-progress) 0.0)) (+! f30-0 (* (-> self board charge-progress) (-> *TARGET_BOARD-bank* charge-jump-height))) (sound-play "board-launch") - (cond - ((logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) - (let ((s3-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s3-3 - (let ((t9-7 (method-of-type part-tracker-subsampler activate))) - (t9-7 (the-as part-tracker-subsampler s3-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-14 s3-3) - (a1-8 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) (-> self node-list data 0 bone transform)) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-8) a0-14 a1-8 *part-tracker-subsampler-params-default*) - ) - (-> s3-3 ppointer) - ) - ) - ) - (else - (let ((s3-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s3-4 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker s3-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-17 s3-4) - (a1-11 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 191)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) (-> self node-list data 0 bone transform)) - ((the-as (function object object object none) t9-11) a0-17 a1-11 *part-tracker-params-default*) - ) - (-> s3-4 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 191 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 191) + :mat-joint (-> self node-list data 0 bone transform) ) ) - ) ) (set! (-> self board charge-progress) 0.0) (sound-stop (-> self board charge-sound-id)) @@ -1103,50 +998,11 @@ (cond ((logtest? (-> *part-group-id-table* 190 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> s3-5 quad)) - (let ((s2-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s2-2 - (let ((t9-14 (method-of-type part-tracker-subsampler activate))) - (t9-14 (the-as part-tracker-subsampler s2-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-15 run-function-in-process) - (a0-28 s2-2) - (a1-14 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 190)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-15) a0-28 a1-14 *part-tracker-subsampler-params-default*) - ) - (-> s2-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 190)) ) (else (set! (-> *launch-matrix* trans quad) (-> s3-5 quad)) - (let ((s2-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s2-3 - (let ((t9-17 (method-of-type part-tracker activate))) - (t9-17 (the-as part-tracker s2-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-33 s2-3) - (a1-17 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 190)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-18) a0-33 a1-17 *part-tracker-params-default*) - ) - (-> s2-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 190)) ) ) (let* ((s1-1 (get-process *default-dead-pool* manipy #x20000 1)) @@ -3011,7 +2867,7 @@ (logclear! (-> gp-2 options) (projectile-options po14 po15 po16)) (set! (-> gp-2 notify-handle) (the-as handle #f)) (set! (-> gp-2 owner-handle) (the-as handle #f)) - (set! (-> gp-2 target-handle) (the-as uint #f)) + (set! (-> gp-2 target-handle) (the-as handle #f)) (set! (-> gp-2 target-pos quad) (the-as uint128 0)) (set! (-> gp-2 ignore-handle) (process->handle self)) (let* ((v1-27 *game-info*) @@ -3533,7 +3389,7 @@ (set! (-> v1-8 invinc-time) (-> *TARGET-bank* hit-invulnerable-timeout)) (set! (-> v1-8 speed) 1.0) (set! (-> v1-8 damage) (-> *FACT-bank* health-default-inc)) - (set! (-> v1-8 knock) (knocked-type knocked-type-0)) + (set! (-> v1-8 knock) (knocked-type none)) ) (case arg0 (('shove) @@ -3631,7 +3487,7 @@ ) ) (when (not (and (= (-> self game mode) 'play) (>= 0.0 (-> self fact health)))) - (when (= (-> gp-0 knock) (knocked-type knocked-type-8)) + (when (= (-> gp-0 knock) (knocked-type knocked-off)) (set-quaternion! (-> self control) (-> self control dir-targ)) (set-forward-vel (* -3.0 (-> gp-0 shove-back))) (go target-board-get-off (the-as handle #f) 'hit) @@ -3689,7 +3545,3 @@ (target-board-joint-points) ) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc b/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc index 02c83392621..0dd505d50a3 100644 --- a/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/board/target-board_REF.gc @@ -699,53 +699,16 @@ ) (case (-> self control danger-mode) (('board-spin) - (cond - ((logtest? (-> *part-group-id-table* 184 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-12 (method-of-type part-tracker-subsampler activate))) - (t9-12 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-53 gp-2) - (a1-12 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 184)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-13) a0-53 a1-12 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-15 (method-of-type part-tracker activate))) - (t9-15 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-16 run-function-in-process) - (a0-56 gp-3) - (a1-15 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 184)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-16) a0-56 a1-15 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 184 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 184) + :target self + :mat-joint 37 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 184) :target self :mat-joint 37) ) - ) ) ) (target-timed-invulnerable (seconds 0.5) self 2) @@ -1620,50 +1583,11 @@ (cond ((logtest? (-> *part-group-id-table* 23 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-9 (method-of-type part-tracker-subsampler activate))) - (t9-9 (the-as part-tracker-subsampler gp-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-10 run-function-in-process) - (a0-31 gp-3) - (a1-8 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 23)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-10) a0-31 a1-8 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 23)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-12 (method-of-type part-tracker activate))) - (t9-12 (the-as part-tracker gp-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-37 gp-4) - (a1-11 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 23)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-13) a0-37 a1-11 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 23)) ) ) ) @@ -2328,100 +2252,30 @@ (focus-test? self board) (< 0.0 (-> self fact eco-green)) ) - (cond - ((logtest? (-> *part-group-id-table* 187 flags) (sp-group-flag sp13)) - (let ((s5-7 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-7 - (let ((t9-52 (method-of-type part-tracker-subsampler activate))) - (t9-52 (the-as part-tracker-subsampler s5-7) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-53 run-function-in-process) - (a0-113 s5-7) - (a1-46 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 187)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-53) a0-113 a1-46 *part-tracker-subsampler-params-default*) - ) - (-> s5-7 ppointer) - ) - ) - ) - (else - (let ((s5-8 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-8 - (let ((t9-55 (method-of-type part-tracker activate))) - (t9-55 (the-as part-tracker s5-8) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-56 run-function-in-process) - (a0-116 s5-8) - (a1-49 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 187)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-56) a0-116 a1-49 *part-tracker-params-default*) - ) - (-> s5-8 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 187 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 187) + :target self + :mat-joint 37 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 187) :target self :mat-joint 37) ) - ) (target-board-green-eco-attack #t) (target-board-green-eco-use 5.0) ) ((logtest? (-> *part-group-id-table* 188 flags) (sp-group-flag sp13)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-9 - (let ((t9-60 (method-of-type part-tracker-subsampler activate))) - (t9-60 (the-as part-tracker-subsampler s5-9) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-61 run-function-in-process) - (a0-121 s5-9) - (a1-52 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 188)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 37) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-61) a0-121 a1-52 *part-tracker-subsampler-params-default*) - ) - (-> s5-9 ppointer) - ) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 188) + :target self + :mat-joint 37 ) ) (else - (let ((s5-10 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-10 - (let ((t9-63 (method-of-type part-tracker activate))) - (t9-63 (the-as part-tracker s5-10) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-64 run-function-in-process) - (a0-124 s5-10) - (a1-55 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 188)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 37) - ((the-as (function object object object none) t9-64) a0-124 a1-55 *part-tracker-params-default*) - ) - (-> s5-10 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 188) :target self :mat-joint 37) ) ) (target-timed-invulnerable (-> *TARGET_BOARD-bank* zap-duration) self 2) @@ -3373,7 +3227,3 @@ 0 (none) ) - - - - diff --git a/test/decompiler/reference/jak3/engine/target/gun/gun-util_REF.gc b/test/decompiler/reference/jak3/engine/target/gun/gun-util_REF.gc index a7d0dd7e1c5..651c2dfcd4e 100644 --- a/test/decompiler/reference/jak3/engine/target/gun/gun-util_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/gun/gun-util_REF.gc @@ -21,7 +21,7 @@ ;; definition for method 31 of type gun-eject ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this gun-eject)) +(defmethod init-proj-settings! ((this gun-eject)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-gun" (the-as (pointer level) #f))) @@ -31,7 +31,7 @@ (let ((v1-5 (-> this skel root-channel 0))) (set! (-> v1-5 frame-group) (-> this parent 0 skel channel 0 frame-group)) ) - (let ((t9-3 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-3 (method-of-type projectile-bounce init-proj-settings!))) (t9-3 this) ) (quaternion-copy! (-> this root quat) (-> this parent 0 root quat)) @@ -62,13 +62,13 @@ ;; definition for method 31 of type gun-mag-yellow ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this gun-mag-yellow)) +(defmethod init-proj-settings! ((this gun-mag-yellow)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-yellow" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -97,13 +97,13 @@ ;; definition for method 31 of type gun-mag-red ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this gun-mag-red)) +(defmethod init-proj-settings! ((this gun-mag-red)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-red" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -132,13 +132,13 @@ ;; definition for method 31 of type gun-mag-blue ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this gun-mag-blue)) +(defmethod init-proj-settings! ((this gun-mag-blue)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-blue" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -167,13 +167,13 @@ ;; definition for method 31 of type gun-mag-dark ;; WARN: Return type mismatch int vs none. -(defmethod projectile-method-31 ((this gun-mag-dark)) +(defmethod init-proj-settings! ((this gun-mag-dark)) (initialize-skeleton this (the-as skeleton-group (art-group-get-by-name *level* "skel-ammo-dark" (the-as (pointer level) #f))) (the-as pair 0) ) - (let ((t9-2 (method-of-type projectile-bounce projectile-method-31))) + (let ((t9-2 (method-of-type projectile-bounce init-proj-settings!))) (t9-2 this) ) (set! (-> this timeout) (seconds 4)) @@ -444,7 +444,7 @@ ) (set! (-> s5-2 notify-handle) (the-as handle #f)) (set! (-> s5-2 owner-handle) (the-as handle #f)) - (set! (-> s5-2 target-handle) (the-as uint #f)) + (set! (-> s5-2 target-handle) (the-as handle #f)) (set! (-> s5-2 target-pos quad) (the-as uint128 0)) (set! (-> s5-2 ignore-handle) (process->handle self)) (let* ((v1-133 *game-info*) @@ -985,7 +985,7 @@ ) (set! (-> gp-0 notify-handle) (the-as handle #f)) (set! (-> gp-0 owner-handle) (the-as handle #f)) - (set! (-> gp-0 target-handle) (the-as uint #f)) + (set! (-> gp-0 target-handle) (the-as handle #f)) (set! (-> gp-0 target-pos quad) (the-as uint128 0)) (set! (-> gp-0 ignore-handle) (process->handle self)) (let* ((v1-16 *game-info*) @@ -1210,7 +1210,7 @@ ;; definition for function adjust-player-ammo ;; WARN: Return type mismatch object vs float. -(defun adjust-player-ammo ((arg0 int) (arg1 pickup-type)) +(defun adjust-player-ammo ((arg0 float) (arg1 pickup-type)) (if (and *target* (and (focus-test? *target* light) (nonzero? (-> *target* lightjak))) (not (logtest? (-> *target* lightjak stage) (lightjak-stage ls1))) @@ -1225,7 +1225,7 @@ (let* ((f0-2 (* 0.0033333334 (the float arg0) arg1)) (f30-0 (fmin (fmax 0.0 f0-2) arg3)) ) - (adjust-player-ammo (the-as int (- f30-0)) arg2) + (adjust-player-ammo (- f30-0) arg2) f30-0 ) ) @@ -1236,7 +1236,7 @@ (let* ((f0-0 (get-remaining-player-ammo arg0)) (f0-1 (- f0-0 (the float (the int f0-0)))) ) - (adjust-player-ammo (the-as int (- f0-1)) arg0) + (adjust-player-ammo (- f0-1) arg0) ) (none) ) diff --git a/test/decompiler/reference/jak3/engine/target/lightjak-wings_REF.gc b/test/decompiler/reference/jak3/engine/target/lightjak-wings_REF.gc index 6e127e1544d..d27bd36144d 100644 --- a/test/decompiler/reference/jak3/engine/target/lightjak-wings_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/lightjak-wings_REF.gc @@ -537,7 +537,7 @@ :exit (behavior () (let ((a0-1 (handle->process (-> self ragdoll-proc)))) (if a0-1 - (ragdoll-proc-method-16 (the-as ragdoll-proc a0-1) 60) + (disable-for-duration (the-as ragdoll-proc a0-1) (seconds 0.2)) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc index 05a33c98f18..4c68072eb71 100644 --- a/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/logic-target_REF.gc @@ -877,7 +877,7 @@ (set! (-> gp-0 ignore-process0) self) (set! (-> gp-0 ignore-process1) #f) (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* gp-0) (dotimes (s5-0 3) (set! (-> gp-0 start-pos quad) (-> self control collision-spheres s5-0 prim-core world-sphere quad)) (vector-float*! (-> gp-0 move-dist) (-> self control wall-contact-normal) -8192.0) @@ -1575,7 +1575,7 @@ (set! (-> gp-0 ignore-process0) self) (set! (-> gp-0 ignore-process1) #f) (set! (-> gp-0 ignore-pat) (-> self control pat-ignore-mask)) - ((method-of-object *collide-cache* collide-cache-method-12)) + (fill-using-bounding-box *collide-cache* gp-0) (dotimes (s5-0 2) (let ((a1-4 (not (or (logtest? (target-flags lleg-no-ik rleg-no-ik) (-> self target-flags)) (and (logtest? (-> self control mod-surface flags) (surface-flag air)) diff --git a/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc b/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc index e108f93dff6..17b23247ba1 100644 --- a/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-anim_REF.gc @@ -1284,10 +1284,7 @@ ) ) ) - (let ((v1-257 (-> self skel root-channel 6))) - (set! (-> v1-257 frame-interp 1) f26-0) - (set! (-> v1-257 frame-interp 0) f26-0) - ) + (ja :chan 6 :frame-interp0 f26-0 :frame-interp1 f26-0) (let* ((f1-14 (* (current-cycle-distance (-> self skel)) (-> self control scale x))) (f0-70 (/ (-> self control ctrl-xz-vel) (* 60.0 (/ f1-14 (-> *TARGET-bank* run-cycle-length))))) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-death_REF.gc b/test/decompiler/reference/jak3/engine/target/target-death_REF.gc index d26d4d053f0..019a10af8e2 100644 --- a/test/decompiler/reference/jak3/engine/target/target-death_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-death_REF.gc @@ -70,7 +70,7 @@ (when a2-0 (set! (-> s5-1 quad) (-> a2-0 extra trans quad)) (+! (-> s5-1 y) 9011.2) - (go target-warp-in s5-1 (-> arg0 trans)) + (go target-warp-in s5-1 (-> arg0 trans) a2-0) ) ) ) @@ -974,27 +974,7 @@ quad ) ) - (let ((s5-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler s5-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-9 s5-0) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-9 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> s5-0 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 10)) ) (else (set! (-> *launch-matrix* trans quad) @@ -1006,26 +986,7 @@ quad ) ) - (let ((s5-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker s5-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-18 s5-1) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-18 a1-5 *part-tracker-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 10)) ) ) (let ((v1-32 (-> arg0 mode))) @@ -1546,55 +1507,11 @@ (cond ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-18 (method-of-type part-tracker-subsampler activate))) - (t9-18 - (the-as part-tracker-subsampler gp-3) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-19 run-function-in-process) - (a0-66 gp-3) - (a1-13 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-19) a0-66 a1-13 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-21 (method-of-type part-tracker activate))) - (t9-21 (the-as part-tracker gp-4) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-22 run-function-in-process) - (a0-72 gp-4) - (a1-16 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-22) a0-72 a1-16 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) ) ) ) @@ -1611,55 +1528,11 @@ (cond ((logtest? (-> *part-group-id-table* 64 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-6 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-6 - (let ((t9-28 (method-of-type part-tracker-subsampler activate))) - (t9-28 - (the-as part-tracker-subsampler gp-6) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-29 run-function-in-process) - (a0-89 gp-6) - (a1-23 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-29) a0-89 a1-23 *part-tracker-subsampler-params-default*) - ) - (-> gp-6 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 64)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((gp-7 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-7 - (let ((t9-31 (method-of-type part-tracker activate))) - (t9-31 (the-as part-tracker gp-7) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-95 gp-7) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 64)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-32) a0-95 a1-26 *part-tracker-params-default*) - ) - (-> gp-7 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 64)) ) ) ) @@ -1721,53 +1594,17 @@ ) ) ) - (cond - ((logtest? (-> gp-9 flags) (sp-group-flag sp13)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-5 - (let ((t9-44 (method-of-type part-tracker-subsampler activate))) - (t9-44 (the-as part-tracker-subsampler s5-5) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-45 run-function-in-process) - (a0-133 s5-5) - (a1-49 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) gp-9) - (set! (-> *part-tracker-subsampler-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-45) a0-133 a1-49 *part-tracker-subsampler-params-default*) - ) - (-> s5-5 ppointer) - ) - ) - ) - (else - (let ((s5-6 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-6 - (let ((t9-47 (method-of-type part-tracker activate))) - (t9-47 (the-as part-tracker s5-6) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-48 run-function-in-process) - (a0-136 s5-6) - (a1-52 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) gp-9) - (set! (-> *part-tracker-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-48) a0-136 a1-52 *part-tracker-params-default*) - ) - (-> s5-6 ppointer) - ) + (if (logtest? (-> gp-9 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group gp-9 + :duration (seconds 1) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group gp-9 :duration (seconds 1) :target self :mat-joint 6) ) - ) ) (let ((gp-10 (-> self post-hook))) (set! (-> self control mod-surface) *turn-around-mods*) @@ -2488,55 +2325,11 @@ (cond ((logtest? (-> *part-group-id-table* 62 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-3 - (let ((t9-15 (method-of-type part-tracker-subsampler activate))) - (t9-15 - (the-as part-tracker-subsampler s5-3) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-16 run-function-in-process) - (a0-66 s5-3) - (a1-29 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 62)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-16) a0-66 a1-29 *part-tracker-subsampler-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 62)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-4 - (let ((t9-18 (method-of-type part-tracker activate))) - (t9-18 (the-as part-tracker s5-4) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-19 run-function-in-process) - (a0-72 s5-4) - (a1-32 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 62)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-19) a0-72 a1-32 *part-tracker-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 62)) ) ) (let ((v1-110 (-> self control root-prim))) @@ -2573,55 +2366,11 @@ (cond ((logtest? (-> *part-group-id-table* 65 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-8 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-8 - (let ((t9-27 (method-of-type part-tracker-subsampler activate))) - (t9-27 - (the-as part-tracker-subsampler s5-8) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-28 run-function-in-process) - (a0-92 s5-8) - (a1-41 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 65)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-28) a0-92 a1-41 *part-tracker-subsampler-params-default*) - ) - (-> s5-8 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 65)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-9 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-9 - (let ((t9-30 (method-of-type part-tracker activate))) - (t9-30 (the-as part-tracker s5-9) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-31 run-function-in-process) - (a0-98 s5-9) - (a1-44 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 65)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-31) a0-98 a1-44 *part-tracker-params-default*) - ) - (-> s5-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 65)) ) ) (set-vector! (-> self control transv) 0.0 65502.96 0.0 1.0) @@ -2806,55 +2555,11 @@ (cond ((logtest? (-> *part-group-id-table* 66 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-12 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-12 - (let ((t9-45 (method-of-type part-tracker-subsampler activate))) - (t9-45 - (the-as part-tracker-subsampler s5-12) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-46 run-function-in-process) - (a0-130 s5-12) - (a1-56 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 66)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-46) a0-130 a1-56 *part-tracker-subsampler-params-default*) - ) - (-> s5-12 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 66)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-13 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-13 - (let ((t9-48 (method-of-type part-tracker activate))) - (t9-48 (the-as part-tracker s5-13) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-49 run-function-in-process) - (a0-136 s5-13) - (a1-59 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 66)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-49) a0-136 a1-59 *part-tracker-params-default*) - ) - (-> s5-13 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 66)) ) ) (target-death-anim (the-as spool-anim #f)) @@ -2873,55 +2578,11 @@ (cond ((logtest? (-> gp-1 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-3 (method-of-type part-tracker-subsampler activate))) - (t9-3 - (the-as part-tracker-subsampler s5-1) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-4 run-function-in-process) - (a0-9 s5-1) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) gp-1) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-4) a0-9 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group gp-1) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-6 (method-of-type part-tracker activate))) - (t9-6 (the-as part-tracker s5-2) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-7 run-function-in-process) - (a0-15 s5-2) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) gp-1) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-7) a0-15 a1-6 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group gp-1) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-h_REF.gc b/test/decompiler/reference/jak3/engine/target/target-h_REF.gc index 827ad1982a5..22c6f65189d 100644 --- a/test/decompiler/reference/jak3/engine/target/target-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-h_REF.gc @@ -288,8 +288,8 @@ target-wade-stance target-wade-walk target-walk - (target-warp-in vector vector) - target-warp-out + (target-warp-in vector vector object) + (target-warp-out vector vector handle) target-yellow-jump-blast tobot-stance ) diff --git a/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc index 64d528200be..28b56b3c4cb 100644 --- a/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-handler_REF.gc @@ -151,27 +151,7 @@ quad ) ) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-7 (method-of-type part-tracker-subsampler activate))) - (t9-7 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-39 gp-1) - (a1-14 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-8) a0-39 a1-14 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 10)) ) (else (set! (-> *launch-matrix* trans quad) @@ -183,26 +163,7 @@ quad ) ) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-10 (method-of-type part-tracker activate))) - (t9-10 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-48 gp-2) - (a1-17 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 10)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-11) a0-48 a1-17 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 10)) ) ) (target-timed-invulnerable @@ -219,53 +180,24 @@ (sound-play "oof") ) (else - (cond - ((logtest? (-> *part-group-id-table* 67 flags) (sp-group-flag sp13)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-4 - (let ((t9-17 (method-of-type part-tracker-subsampler activate))) - (t9-17 (the-as part-tracker-subsampler gp-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-18 run-function-in-process) - (a0-55 gp-4) - (a1-23 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 67)) - (set! (-> *part-tracker-subsampler-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-18) a0-55 a1-23 *part-tracker-subsampler-params-default*) - ) - (-> gp-4 ppointer) - ) - ) - ) - (else - (let ((gp-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-5 - (let ((t9-20 (method-of-type part-tracker activate))) - (t9-20 (the-as part-tracker gp-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-21 run-function-in-process) - (a0-58 gp-5) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 67)) - (set! (-> *part-tracker-params-default* duration) (seconds 1)) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-21) a0-58 a1-26 *part-tracker-params-default*) - ) - (-> gp-5 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 67 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 67) + :duration (seconds 1) + :target self + :mat-joint 6 + ) + (part-tracker-spawn + part-tracker + :to self + :group (-> *part-group-id-table* 67) + :duration (seconds 1) + :target self + :mat-joint 6 ) ) - ) (process-spawn-function process (lambda :behavior target @@ -574,50 +506,11 @@ (cond ((logtest? (-> *part-group-id-table* 11 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-1 - (let ((t9-13 (method-of-type part-tracker-subsampler activate))) - (t9-13 (the-as part-tracker-subsampler s5-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-14 run-function-in-process) - (a0-46 s5-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 11)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-14) a0-46 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s5-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 11)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-2 - (let ((t9-16 (method-of-type part-tracker activate))) - (t9-16 (the-as part-tracker s5-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-17 run-function-in-process) - (a0-51 s5-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 11)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-17) a0-51 a1-19 *part-tracker-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 11)) ) ) ) @@ -654,50 +547,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-23 (method-of-type part-tracker-subsampler activate))) - (t9-23 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-24 run-function-in-process) - (a0-71 gp-1) - (a1-26 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-24) a0-71 a1-26 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-76 gp-2) - (a1-29 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-76 a1-29 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) @@ -727,50 +581,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-31 (method-of-type part-tracker-subsampler activate))) - (t9-31 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-32 run-function-in-process) - (a0-91 s5-4) - (a1-36 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-32) a0-91 a1-36 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-34 (method-of-type part-tracker activate))) - (t9-34 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-35 run-function-in-process) - (a0-96 s5-5) - (a1-39 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-35) a0-96 a1-39 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) @@ -823,50 +638,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-3 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-3 - (let ((t9-43 (method-of-type part-tracker-subsampler activate))) - (t9-43 (the-as part-tracker-subsampler gp-3) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-44 run-function-in-process) - (a0-116 gp-3) - (a1-47 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-44) a0-116 a1-47 *part-tracker-subsampler-params-default*) - ) - (-> gp-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> sv-128 quad)) - (let ((gp-4 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-4 - (let ((t9-46 (method-of-type part-tracker activate))) - (t9-46 (the-as part-tracker gp-4) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-47 run-function-in-process) - (a0-121 gp-4) - (a1-50 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-47) a0-121 a1-50 *part-tracker-params-default*) - ) - (-> gp-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) ) diff --git a/test/decompiler/reference/jak3/engine/target/target-invisible_REF.gc b/test/decompiler/reference/jak3/engine/target/target-invisible_REF.gc index 1e98acf04ac..bb0b1c1d461 100644 --- a/test/decompiler/reference/jak3/engine/target/target-invisible_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-invisible_REF.gc @@ -492,50 +492,11 @@ (cond ((logtest? (-> *part-group-id-table* 182 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-5 gp-1) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 182)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-5 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 182)) ) (else (set! (-> *launch-matrix* trans quad) (-> self root trans quad)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-11 gp-2) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 182)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-5) a0-11 a1-5 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 182)) ) ) (if *target* diff --git a/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc b/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc new file mode 100644 index 00000000000..880b7e2cb4f --- /dev/null +++ b/test/decompiler/reference/jak3/engine/target/target-launch_REF.gc @@ -0,0 +1,151 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defstate target-launch-dir (target) + :event (behavior ((proc process) (argc int) (message symbol) (block event-message-block)) + (cond + ((and (= message 'query) (= (-> block param 0) 'mode)) + 'target-launch-dir + ) + ((= message 'launch-dir) + #f + ) + (else + (target-standard-event-handler proc argc message block) + ) + ) + ) + :enter (behavior () + (set-time! (-> self state-time)) + (set! (-> self control did-move-to-pole-or-max-jump-height) 0.0) + (sound-play "jak-launch") + (set! (-> self control unknown-vector37 y) + (- (-> self control unknown-vector37 y) (* 0.5 (the-as float (-> self control unknown-word04)))) + ) + (set! (-> self control unknown-vector39 quad) (-> self control trans quad)) + ) + :exit (behavior () + (target-state-hook-exit) + ) + :trans (behavior () + (cond + ((not (time-elapsed? (-> self state-time) (-> self control sliding-start-time))) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (set! (-> s5-0 quad) (-> self control unknown-vector37 quad)) + (let ((gp-0 (new 'stack-no-clear 'quaternion))) + (set! (-> gp-0 quad) (-> self control unknown-vector37 quad)) + (set! (-> gp-0 y) 0.0) + (vector-normalize! (the-as vector gp-0) 1.0) + (let ((f30-0 (vector-normalize-ret-len! s5-0 1.0))) + 0.0 + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control quat)) + (vector-z-quaternion! (new 'stack-no-clear 'vector) (-> self control dir-targ)) + (quaternion-rotate-y-to-vector! (-> self control dir-targ) (-> self control dir-targ) gp-0 18204.445) + (set-quaternion! (-> self control) (-> self control dir-targ)) + (let* ((f0-4 + (/ (the float (- (current-time) (-> self state-time))) (the float (-> self control sliding-start-time))) + ) + (f0-5 (- 1.0 f0-4)) + ) + (let ((f1-5 (* 1.4 f0-5 (/ f30-0 (* 0.0033333334 (the float (-> self control sliding-start-time))))))) + (* 0.0033333334 f1-5 (the float (- (current-time) (-> self clock old-frame-counter)))) + ) + (let ((f0-6 (- 1.0 f0-5))) + (vector+float*! + (-> self control trans) + (-> self control unknown-vector39) + (-> self control unknown-vector37) + f0-6 + ) + (+! (-> self control trans y) (* 0.5 f0-6 f0-6 (the-as float (-> self control unknown-word04)))) + (set! (-> self control transv quad) (the-as uint128 0)) + (set! (-> self control transv quad) (-> self control unknown-vector37 quad)) + (+! (-> self control transv y) (* f0-6 (the-as float (-> self control unknown-word04)))) + ) + ) + ) + ) + ) + (+! (-> self control did-move-to-pole-or-max-jump-height) + (* (the float (-> self control sliding-start-time)) (seconds-per-frame)) + ) + ) + (else + (let ((v1-53 (logclear (-> self control status) (collide-status on-surface))) + (a0-19 (-> self control)) + ) + (set! (-> a0-19 status) v1-53) + (go target-falling (the-as symbol a0-19)) + ) + ) + ) + ) + :code (behavior () + (send-event self 'end-mode 'gun) + (ja-channel-push! 1 (seconds 0.15)) + (set-forward-vel 0.0) + (cond + ((and (focus-test? self dark) (nonzero? (-> self darkjak))) + (ja-no-eval :group! (-> self draw art-group data 474) :num! (seek! (ja-aframe 15.0 0) 3.0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 15.0 0) 3.0)) + ) + ) + ((= (-> self ext-anim) (target-anim default)) + (ja-no-eval :group! jakb-duck-stance-ja :num! (seek! (ja-aframe 15.0 0) 3.0) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! (ja-aframe 15.0 0) 3.0)) + ) + ) + ) + (ja-channel-push! 1 (seconds 0.2)) + (if (and (focus-test? self dark) (nonzero? (-> self darkjak))) + (ja :group! (-> self draw art-group data 444) :num! min) + (ja :group! jakb-jump-ja :num! min) + ) + (until #f + (ja-no-eval :group! jakb-launch-jump-loop-ja :num! (seek! max 0.5) :frame-num 0.0) + (until (ja-done? 0) + (suspend) + (ja :num! (seek! max 0.5)) + ) + ) + #f + (until (time-elapsed? (-> self state-time) (-> self control sliding-start-time)) + (ja :num! (identity + (* 20.0 + (/ (the float (- (current-time) (-> self state-time))) (the float (-> self control sliding-start-time))) + ) + ) + ) + (suspend) + ) + (until #f + (suspend) + ) + #f + ) + :post (behavior () + (target-no-move-post) + (when (time-elapsed? (-> self state-time) (seconds 0.1)) + (let ((a2-0 (new 'stack-no-clear 'collide-query))) + (let ((v1-3 (-> self control))) + (set! (-> a2-0 collide-with) (-> v1-3 backup-collide-with)) + (set! (-> a2-0 ignore-process0) self) + (set! (-> a2-0 ignore-process1) #f) + (set! (-> a2-0 ignore-pat) (-> v1-3 pat-ignore-mask)) + ) + (set! (-> a2-0 action-mask) (collide-action solid)) + (fill-cache-for-shape (-> self control) (+ 4096.0 (vector-length (-> self control transv))) a2-0) + ) + (target-method-28 *target* *collide-cache* *collide-edge-spec*) + ) + ) + ) + + + + diff --git a/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc b/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc index e96fc45a460..e3b015499ef 100644 --- a/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-lightjak_REF.gc @@ -1237,53 +1237,16 @@ ) ) ) - (cond - ((logtest? (-> *part-group-id-table* 176 flags) (sp-group-flag sp13)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-10 (method-of-type part-tracker-subsampler activate))) - (t9-10 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-11 run-function-in-process) - (a0-23 gp-1) - (a1-15 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 176)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-11) a0-23 a1-15 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) - ) - (else - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-13 (method-of-type part-tracker activate))) - (t9-13 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-14 run-function-in-process) - (a0-26 gp-2) - (a1-18 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 176)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-14) a0-26 a1-18 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 176 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 176) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 176) :target self :mat-joint 6) ) - ) ) (logand! (-> self target-effect) -3) (logand! (-> self target-effect) -17) @@ -1705,53 +1668,16 @@ (set! (-> self control dynam gravity-length) 0.0) (set! (-> self control transv quad) (the-as uint128 0)) (let ((s5-2 - (cond - ((logtest? (-> *part-group-id-table* 174 flags) (sp-group-flag sp13)) - (let ((s4-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s4-1 - (let ((t9-24 (method-of-type part-tracker-subsampler activate))) - (t9-24 (the-as part-tracker-subsampler s4-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-25 run-function-in-process) - (a0-42 s4-1) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 174)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-25) a0-42 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s4-1 ppointer) - ) - ) - ) - (else - (let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s4-2 - (let ((t9-27 (method-of-type part-tracker activate))) - (t9-27 (the-as part-tracker s4-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-28 run-function-in-process) - (a0-45 s4-2) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 174)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-28) a0-45 a1-19 *part-tracker-params-default*) - ) - (-> s4-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 174 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 174) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 174) :target self :mat-joint 6) ) - ) ) ) (while (!= (-> self ext-anim) (target-anim light)) @@ -1820,53 +1746,16 @@ (the-as (function gui-connection symbol) #f) (the-as process #f) ) - (cond - ((logtest? (-> *part-group-id-table* 175 flags) (sp-group-flag sp13)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-41 (method-of-type part-tracker-subsampler activate))) - (t9-41 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-42 run-function-in-process) - (a0-94 s5-4) - (a1-32 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 175)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 6) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-42) a0-94 a1-32 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) - ) - (else - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-44 (method-of-type part-tracker activate))) - (t9-44 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-45 run-function-in-process) - (a0-97 s5-5) - (a1-35 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 175)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 6) - ((the-as (function object object object none) t9-45) a0-97 a1-35 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 175 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 175) + :target self + :mat-joint 6 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 175) :target self :mat-joint 6) ) - ) (cond ((logtest? arg0 (lightjak-stage regen)) (go target-lightjak-regen (the-as int (-> self control lightjak-sound-id))) @@ -2881,100 +2770,26 @@ (send-event (handle->process (-> self notify)) 'notify 'attack 27) (set! (-> self neck flex-blend) 0.0) (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (cond - ((logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-0 - (let ((t9-2 (method-of-type part-tracker-subsampler activate))) - (t9-2 (the-as part-tracker-subsampler gp-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-3 run-function-in-process) - (a0-10 gp-0) - (a1-3 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 19) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-3) a0-10 a1-3 *part-tracker-subsampler-params-default*) - ) - (-> gp-0 ppointer) - ) - ) - ) - (else - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-1 - (let ((t9-5 (method-of-type part-tracker activate))) - (t9-5 (the-as part-tracker gp-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-6 run-function-in-process) - (a0-13 gp-1) - (a1-6 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 19) - ((the-as (function object object object none) t9-6) a0-13 a1-6 *part-tracker-params-default*) - ) - (-> gp-1 ppointer) - ) - ) + (if (logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 180) + :target self + :mat-joint 19 + ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 180) :target self :mat-joint 19) + ) + (if (logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 180) + :target self + :mat-joint 28 + ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 180) :target self :mat-joint 28) ) - ) - (cond - ((logtest? (-> *part-group-id-table* 180 flags) (sp-group-flag sp13)) - (let ((gp-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker-subsampler activate))) - (t9-8 (the-as part-tracker-subsampler gp-2) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-16 gp-2) - (a1-9 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 28) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-9) a0-16 a1-9 *part-tracker-subsampler-params-default*) - ) - (-> gp-2 ppointer) - ) - ) - ) - (else - (let ((gp-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-3 - (let ((t9-11 (method-of-type part-tracker activate))) - (t9-11 (the-as part-tracker gp-3) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-12 run-function-in-process) - (a0-19 gp-3) - (a1-12 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 180)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 28) - ((the-as (function object object object none) t9-12) a0-19 a1-12 *part-tracker-params-default*) - ) - (-> gp-3 ppointer) - ) - ) - ) - ) (set! (-> self control mod-surface) *roll-flip-mods*) (let ((f30-0 0.0)) (if (time-elapsed? (-> self fact lightjak-start-time) (seconds 2)) @@ -2992,52 +2807,13 @@ (set! (-> *launch-matrix* trans quad) (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)) quad) ) - (let ((gp-7 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-7 - (let ((t9-22 (method-of-type part-tracker-subsampler activate))) - (t9-22 (the-as part-tracker-subsampler gp-7) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-33 gp-7) - (a1-22 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 181)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-23) a0-33 a1-22 *part-tracker-subsampler-params-default*) - ) - (-> gp-7 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 181)) ) (else (set! (-> *launch-matrix* trans quad) (-> (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node jakb-lod0-jg sk_lhand)) quad) ) - (let ((gp-9 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-9 - (let ((t9-26 (method-of-type part-tracker activate))) - (t9-26 (the-as part-tracker gp-9) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-27 run-function-in-process) - (a0-37 gp-9) - (a1-26 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 181)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-27) a0-37 a1-26 *part-tracker-params-default*) - ) - (-> gp-9 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 181)) ) ) (cpad-set-buzz! (-> *cpad-list* cpads 0) 1 255 (seconds 0.5)) @@ -3268,55 +3044,11 @@ (cond ((logtest? (-> *part-group-id-table* 177 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-2 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-2 - (let ((t9-19 (method-of-type part-tracker-subsampler activate))) - (t9-19 - (the-as part-tracker-subsampler s5-2) - *entity-pool* - "part-tracker-subsampler" - (the-as pointer #x70004000) - ) - ) - (let ((t9-20 run-function-in-process) - (a0-46 s5-2) - (a1-12 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 177)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-20) a0-46 a1-12 *part-tracker-subsampler-params-default*) - ) - (-> s5-2 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to *entity-pool* :group (-> *part-group-id-table* 177)) ) (else (set! (-> *launch-matrix* trans quad) (-> self control trans quad)) - (let ((s5-3 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-3 - (let ((t9-22 (method-of-type part-tracker activate))) - (t9-22 (the-as part-tracker s5-3) *entity-pool* "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-23 run-function-in-process) - (a0-52 s5-3) - (a1-15 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 177)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-23) a0-52 a1-15 *part-tracker-params-default*) - ) - (-> s5-3 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to *entity-pool* :group (-> *part-group-id-table* 177)) ) ) ) @@ -3392,53 +3124,16 @@ ) ) :code (behavior () - (cond - ((logtest? (-> *part-group-id-table* 178 flags) (sp-group-flag sp13)) - (let ((gp-0 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-0 - (let ((t9-1 (method-of-type part-tracker-subsampler activate))) - (t9-1 (the-as part-tracker-subsampler gp-0) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-2 run-function-in-process) - (a0-2 gp-0) - (a1-2 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 178)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 3) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-2) a0-2 a1-2 *part-tracker-subsampler-params-default*) - ) - (-> gp-0 ppointer) - ) - ) - ) - (else - (let ((gp-1 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-1 - (let ((t9-4 (method-of-type part-tracker activate))) - (t9-4 (the-as part-tracker gp-1) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-5 run-function-in-process) - (a0-5 gp-1) - (a1-5 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 178)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 3) - ((the-as (function object object object none) t9-5) a0-5 a1-5 *part-tracker-params-default*) - ) - (-> gp-1 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 178 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 178) + :target self + :mat-joint 3 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 178) :target self :mat-joint 3) ) - ) (let ((v1-30 (ja-group))) (when (not (and v1-30 (= v1-30 jakb-shield-start-ja))) (ja-channel-push! 1 (seconds 0.1)) @@ -3560,53 +3255,16 @@ ) (sound-play "shield-hit") (ja-channel-push! 1 (seconds 0.05)) - (cond - ((logtest? (-> *part-group-id-table* 179 flags) (sp-group-flag sp13)) - (let ((gp-1 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when gp-1 - (let ((t9-5 (method-of-type part-tracker-subsampler activate))) - (t9-5 (the-as part-tracker-subsampler gp-1) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-6 run-function-in-process) - (a0-8 gp-1) - (a1-5 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 179)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) self) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) 3) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-6) a0-8 a1-5 *part-tracker-subsampler-params-default*) - ) - (-> gp-1 ppointer) - ) - ) - ) - (else - (let ((gp-2 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when gp-2 - (let ((t9-8 (method-of-type part-tracker activate))) - (t9-8 (the-as part-tracker gp-2) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-9 run-function-in-process) - (a0-11 gp-2) - (a1-8 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 179)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) self) - (set! (-> *part-tracker-params-default* mat-joint) 3) - ((the-as (function object object object none) t9-9) a0-11 a1-8 *part-tracker-params-default*) - ) - (-> gp-2 ppointer) - ) + (if (logtest? (-> *part-group-id-table* 179 flags) (sp-group-flag sp13)) + (part-tracker-spawn + part-tracker-subsampler + :to self + :group (-> *part-group-id-table* 179) + :target self + :mat-joint 3 ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 179) :target self :mat-joint 3) ) - ) (ja-no-eval :group! jakb-shield-hit-ja :num! (seek!) :frame-num 0.0) (until (ja-done? 0) (suspend) diff --git a/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc b/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc index 02a9a57177d..e819716cbbb 100644 --- a/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target-swim_REF.gc @@ -266,10 +266,7 @@ (set! f30-1 (seek f30-1 (lerp-scale 1.0 0.0 (-> self control ctrl-xz-vel) 16384.0 32768.0) (* 4.0 (seconds-per-frame))) ) - (let ((v1-107 (-> self skel root-channel 1))) - (set! (-> v1-107 frame-interp 1) f24-1) - (set! (-> v1-107 frame-interp 0) f24-1) - ) + (ja :chan 1 :frame-interp0 f24-1 :frame-interp1 f24-1) (ja :num! (loop! (/ (-> self control ctrl-xz-vel) (* 60.0 diff --git a/test/decompiler/reference/jak3/engine/target/target_REF.gc b/test/decompiler/reference/jak3/engine/target/target_REF.gc index 15e4b35c52b..03217fe8ade 100644 --- a/test/decompiler/reference/jak3/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak3/engine/target/target_REF.gc @@ -2848,50 +2848,11 @@ (cond ((logtest? (-> *part-group-id-table* 12 flags) (sp-group-flag sp13)) (set! (-> *launch-matrix* trans quad) (-> s5-3 best-other-tri intersect quad)) - (let ((s5-4 (get-process *default-dead-pool* part-tracker-subsampler #x4000 0))) - (when s5-4 - (let ((t9-36 (method-of-type part-tracker-subsampler activate))) - (t9-36 (the-as part-tracker-subsampler s5-4) self "part-tracker-subsampler" (the-as pointer #x70004000)) - ) - (let ((t9-37 run-function-in-process) - (a0-72 s5-4) - (a1-16 part-tracker-subsampler-init) - ) - (set! (-> *part-tracker-subsampler-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-subsampler-params-default* duration) 0) - (set! (-> *part-tracker-subsampler-params-default* callback) #f) - (set! (-> *part-tracker-subsampler-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-subsampler-params-default* target) #f) - (set! (-> *part-tracker-subsampler-params-default* mat-joint) *launch-matrix*) - (set! (-> *part-tracker-subsampler-params-default* subsample-num) 1.0) - ((the-as (function object object object none) t9-37) a0-72 a1-16 *part-tracker-subsampler-params-default*) - ) - (-> s5-4 ppointer) - ) - ) + (part-tracker-spawn part-tracker-subsampler :to self :group (-> *part-group-id-table* 12)) ) (else (set! (-> *launch-matrix* trans quad) (-> s5-3 best-other-tri intersect quad)) - (let ((s5-5 (get-process *default-dead-pool* part-tracker #x4000 0))) - (when s5-5 - (let ((t9-39 (method-of-type part-tracker activate))) - (t9-39 (the-as part-tracker s5-5) self "part-tracker" (the-as pointer #x70004000)) - ) - (let ((t9-40 run-function-in-process) - (a0-77 s5-5) - (a1-19 part-tracker-init) - ) - (set! (-> *part-tracker-params-default* group) (-> *part-group-id-table* 12)) - (set! (-> *part-tracker-params-default* duration) 0) - (set! (-> *part-tracker-params-default* callback) #f) - (set! (-> *part-tracker-params-default* userdata) (the-as uint #f)) - (set! (-> *part-tracker-params-default* target) #f) - (set! (-> *part-tracker-params-default* mat-joint) *launch-matrix*) - ((the-as (function object object object none) t9-40) a0-77 a1-19 *part-tracker-params-default*) - ) - (-> s5-5 ppointer) - ) - ) + (part-tracker-spawn part-tracker :to self :group (-> *part-group-id-table* 12)) ) ) (let ((name (if (using-gun? self) diff --git a/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc b/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc index 75ff1d53a6e..6f017de002b 100644 --- a/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc +++ b/test/decompiler/reference/jak3/engine/ui/text-h_REF.gc @@ -6,6 +6,7 @@ ((id text-id) (text string) ) + :pack-me ) ;; definition for method 3 of type game-text @@ -26,7 +27,7 @@ ((length int32) (language-id int32) (group-name string) - (data game-text :dynamic) + (data game-text :inline :dynamic) ) (:methods (lookup-text! (_type_ text-id symbol) string) @@ -59,7 +60,3 @@ ;; failed to figure out what this is: 0 - - - - diff --git a/test/decompiler/reference/jak3/engine/ui/text_REF.gc b/test/decompiler/reference/jak3/engine/ui/text_REF.gc new file mode 100644 index 00000000000..64b1d16c07c --- /dev/null +++ b/test/decompiler/reference/jak3/engine/ui/text_REF.gc @@ -0,0 +1,622 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(kmemopen global "text-buffers") + +;; definition for symbol *expand-buf-number*, type int +(define *expand-buf-number* 0) + +;; definition for symbol *game-text-word*, type string +(define *game-text-word* (new 'global 'string 256 (the-as string #f))) + +;; definition for symbol *game-text-line*, type string +(define *game-text-line* (new 'global 'string 1024 (the-as string #f))) + +;; definition for symbol *expanded-text-line0*, type string +(define *expanded-text-line0* (new 'global 'string 1024 (the-as string #f))) + +;; definition for symbol *expanded-text-line1*, type string +(define *expanded-text-line1* (new 'global 'string 1024 (the-as string #f))) + +;; definition for symbol *level-text-file-load-flag*, type symbol +(define *level-text-file-load-flag* #t) + +;; failed to figure out what this is: +(when (zero? (-> *common-text-heap* base)) + (let ((gp-0 *common-text-heap*)) + (set! (-> gp-0 base) (kmalloc global #x12000 (kmalloc-flags) "heap")) + (set! (-> gp-0 current) (-> gp-0 base)) + (set! (-> gp-0 top-base) (&+ (-> gp-0 base) #x12000)) + (set! (-> gp-0 top) (-> gp-0 top-base)) + ) + ) + +;; failed to figure out what this is: +(kmemclose) + +;; definition for method 7 of type game-text-info +(defmethod relocate ((this game-text-info) (offset int)) + (let ((v1-1 (-> *level* loading-level))) + (when v1-1 + (set! (-> v1-1 loaded-text-info (-> v1-1 loaded-text-info-count)) this) + (+! (-> v1-1 loaded-text-info-count) 1) + ) + ) + this + ) + +;; definition for method 4 of type game-text-info +(defmethod length ((this game-text-info)) + (-> this length) + ) + +;; definition for method 5 of type game-text-info +;; WARN: Return type mismatch uint vs int. +(defmethod asize-of ((this game-text-info)) + (the-as int (+ (-> this type size) (* (-> this length) 8))) + ) + +;; definition for method 3 of type game-text-info +(defmethod inspect ((this game-text-info)) + (format #t "[~8x] ~A~%" this (-> this type)) + (format #t "~Tlength: ~D~%" (-> this length)) + (format #t "~Tlanguage-id: ~D~%" (-> this language-id)) + (format #t "~Tgroup-name: ~A~%" (-> this group-name)) + (format #t "~Tdata[~D]: @ #x~X~%" (-> this length) (-> this data)) + (dotimes (s5-0 (-> this length)) + (format #t "~T [~D] #x~X ~A~%" s5-0 (-> this data s5-0 id) (-> this data s5-0 text)) + ) + this + ) + +;; definition for method 8 of type game-text-info +(defmethod mem-usage ((this game-text-info) (usage memory-usage-block) (flags int)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "string") + (+! (-> usage data 84 count) 1) + (let ((v1-6 (asize-of this))) + (+! (-> usage data 84 used) v1-6) + (+! (-> usage data 84 total) (logand -16 (+ v1-6 15))) + ) + (dotimes (s4-0 (-> this length)) + (set! (-> usage length) (max 85 (-> usage length))) + (set! (-> usage data 84 name) "string") + (+! (-> usage data 84 count) 1) + (let ((v1-18 (asize-of (-> this data s4-0 text)))) + (+! (-> usage data 84 used) v1-18) + (+! (-> usage data 84 total) (logand -16 (+ v1-18 15))) + ) + ) + this + ) + +;; definition for function convert-korean-text +(defun convert-korean-text ((arg0 string)) + (local-vars (v1-21 int)) + (let ((gp-0 (-> arg0 data))) + *expanded-text-line0* + (let ((s4-0 0)) + 0 + (let ((s1-0 0) + (s5-0 (length arg0)) + ) + (set! *expand-buf-number* (logxor *expand-buf-number* 1)) + (let ((s3-0 (if (zero? *expand-buf-number*) + *expanded-text-line0* + *expanded-text-line1* + ) + ) + ) + (let ((s2-0 (+ (-> s3-0 allocated-length) -1))) + (clear s3-0) + (while (< s4-0 s5-0) + (cond + ((= (-> gp-0 s4-0) 3) + (+! s4-0 1) + (while (and (< s4-0 s5-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) + (set! (-> s3-0 data s1-0) (-> gp-0 s4-0)) + (+! s4-0 1) + (+! s1-0 1) + ) + ) + (else + (let ((v1-17 (+ s4-0 1))) + (-> gp-0 v1-17) + (set! s4-0 (+ v1-17 1)) + ) + (set! (-> s3-0 data s1-0) (the-as uint 126)) + (let ((v1-19 (+ s1-0 1))) + (set! (-> s3-0 data v1-19) (the-as uint 89)) + (let ((v1-20 (+ v1-19 1))) + (while (and (< s4-0 s5-0) (< v1-20 s2-0) (!= (-> gp-0 s4-0) 3) (!= (-> gp-0 s4-0) 4)) + (cond + ((= (-> gp-0 s4-0) 5) + (set! (-> s3-0 data v1-20) (the-as uint 1)) + (+! s4-0 1) + (set! v1-21 (+ v1-20 1)) + ) + (else + (set! (-> s3-0 data v1-20) (the-as uint 3)) + (set! v1-21 (+ v1-20 1)) + ) + ) + (set! (-> s3-0 data v1-21) (-> gp-0 s4-0)) + (+! s4-0 1) + (let ((v1-22 (+ v1-21 1))) + (set! (-> s3-0 data v1-22) (the-as uint 126)) + (let ((v1-23 (+ v1-22 1))) + (set! (-> s3-0 data v1-23) (the-as uint 90)) + (set! v1-20 (+ v1-23 1)) + ) + ) + ) + (set! (-> s3-0 data v1-20) (the-as uint 126)) + (let ((v1-24 (+ v1-20 1))) + (set! (-> s3-0 data v1-24) (the-as uint 43)) + (let ((v1-25 (+ v1-24 1))) + (set! (-> s3-0 data v1-25) (the-as uint 50)) + (let ((v1-26 (+ v1-25 1))) + (set! (-> s3-0 data v1-26) (the-as uint 54)) + (let ((v1-27 (+ v1-26 1))) + (set! (-> s3-0 data v1-27) (the-as uint 72)) + (set! s1-0 (+ v1-27 1)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + (set! (-> s3-0 data s1-0) (the-as uint 0)) + s3-0 + ) + ) + ) + ) + ) + +;; definition for method 9 of type game-text-info +(defmethod lookup-text! ((this game-text-info) (arg0 text-id) (arg1 symbol)) + (cond + ((= this #f) + (cond + (arg1 + (the-as string #f) + ) + (else + (format (clear *temp-string*) "NO GAME TEXT") + *temp-string* + ) + ) + ) + (else + (let* ((a1-2 0) + (a3-0 (+ (-> this length) 1)) + (v1-2 (/ (+ a1-2 a3-0) 2)) + ) + (let ((t0-0 -1)) + (while (and (!= (-> this data v1-2 id) arg0) (!= v1-2 t0-0)) + (if (< (the-as uint arg0) (the-as uint (-> this data v1-2 id))) + (set! a3-0 v1-2) + (set! a1-2 v1-2) + ) + (set! t0-0 v1-2) + (set! v1-2 (/ (+ a1-2 a3-0) 2)) + ) + ) + (cond + ((!= (-> this data v1-2 id) arg0) + (cond + (arg1 + (the-as string #f) + ) + (else + (format (clear *temp-string*) "UNKNOWN ID ~X" arg0) + *temp-string* + ) + ) + ) + ((= (-> this language-id) 7) + (convert-korean-text (-> this data v1-2 text)) + ) + (else + (-> this data v1-2 text) + ) + ) + ) + ) + ) + ) + +;; definition for method 23 of type level +(defmethod lookup-text ((this level) (arg0 text-id) (arg1 symbol)) + (let ((v1-0 *common-text*)) + (dotimes (a3-0 (-> this loaded-text-info-count)) + (if (= (-> this loaded-text-info a3-0 language-id) (-> *setting-control* user-current language)) + (set! v1-0 (-> this loaded-text-info a3-0)) + ) + ) + (lookup-text! v1-0 arg0 arg1) + ) + ) + +;; definition for symbol text-is-loading, type symbol +(define text-is-loading #f) + +;; definition for function load-game-text-info +;; WARN: Found some very strange gotos. Check result carefully, this is not well tested. +(defun load-game-text-info ((arg0 string) (arg1 (pointer object)) (arg2 kheap)) + (local-vars (v0-4 int) (sv-16 object) (sv-20 int) (sv-24 int) (sv-32 int)) + (set! sv-16 (-> arg1 0)) + (set! sv-20 (the-as int (-> *setting-control* user-current language))) + (set! sv-24 0) + (set! sv-32 (&- (-> arg2 top) (the-as uint (-> arg2 base)))) + (if (and (= (scf-get-territory) 1) (= sv-20 (language-enum english)) (not (demo?))) + (set! sv-20 11) + ) + (when (and (or (= sv-16 #f) + (!= (-> (the-as game-text-info sv-16) language-id) sv-20) + (not (string= (-> (the-as game-text-info sv-16) group-name) arg0)) + ) + (not (load-in-progress? *level*)) + ) + (let ((v1-19 arg2)) + (set! (-> v1-19 current) (-> v1-19 base)) + ) + (b! #t cfg-21 :delay (nop!)) + (label cfg-20) + (set! v0-4 0) + (b! #t cfg-34 :delay (nop!)) + (label cfg-21) + (let ((s3-0 str-load)) + (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) + (b! + (not (s3-0 + *temp-string* + -1 + (logand -64 (&+ (-> arg2 current) 63)) + (&- (-> arg2 top) (the-as uint (-> arg2 current))) + ) + ) + cfg-20 + :delay (nop!) + ) + ) + (label cfg-23) + (let ((v1-23 (str-load-status (the-as (pointer int32) (& sv-24))))) + (cond + ((= v1-23 'error) + (format 0 "Error loading text~%") + (return 0) + ) + ((>= sv-24 (+ sv-32 -300)) + (format 0 "Game text heap overrun!~%") + (return 0) + ) + ((= v1-23 'busy) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (nop!) + (goto cfg-23) + ) + ) + ) + (let ((s2-1 (logand -64 (&+ (-> arg2 current) 63)))) + (flush-cache 0) + (let ((s3-1 link)) + (format (clear *temp-string*) "~D~S.TXT" sv-20 arg0) + (set! (-> arg1 0) (s3-1 s2-1 (-> *temp-string* data) sv-24 arg2 0)) + ) + ) + (if (<= (the-as int (-> arg1 0)) 0) + (set! (-> arg1 0) (the-as object #f)) + ) + ) + (set! v0-4 0) + (label cfg-34) + v0-4 + ) + +;; definition for function load-level-text-files +;; WARN: Return type mismatch int vs none. +(defun load-level-text-files ((arg0 int)) + (if (or *level-text-file-load-flag* (>= arg0 0)) + (load-game-text-info "common" (&-> '*common-text* value) *common-text-heap*) + ) + 0 + (none) + ) + +;; definition for function draw-debug-text-box +;; WARN: Return type mismatch int vs none. +(defun draw-debug-text-box ((arg0 font-context)) + (when *cheat-mode* + (let ((s5-0 (new 'static 'vector4w)) + (gp-0 + (new 'static 'inline-array vector4w 4 + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + (new 'static 'vector4w) + ) + ) + ) + (set-vector! (-> gp-0 0) (the int (+ -256.0 (-> arg0 origin x))) (the int (+ -208.0 (-> arg0 origin y))) 0 1) + (set-vector! + (-> gp-0 1) + (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! + (-> gp-0 2) + (the int (+ -256.0 (-> arg0 width) (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! + (-> gp-0 3) + (the int (+ -256.0 (-> arg0 origin x))) + (the int (+ -208.0 (-> arg0 height) (-> arg0 origin y))) + 0 + 1 + ) + (set-vector! s5-0 128 128 128 128) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 0) (-> gp-0 1) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 1) (-> gp-0 2) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 2) (-> gp-0 3) s5-0) + (add-debug-line2d #t (bucket-id debug-no-zbuf1) (-> gp-0 3) (-> gp-0 0) s5-0) + ) + ) + 0 + (none) + ) + +;; definition for function print-game-text-scaled +;; WARN: Return type mismatch int vs none. +(defun print-game-text-scaled ((arg0 string) (arg1 float) (arg2 font-context) (arg3 bucket-id)) + (let ((f26-0 (-> arg2 width)) + (f30-0 (-> arg2 height)) + (f24-0 (-> arg2 origin x)) + (f22-0 (-> arg2 origin y)) + (f28-0 (-> arg2 scale)) + ) + (let ((f0-1 (* (-> arg2 width) arg1)) + (f1-2 (* (-> arg2 height) arg1)) + ) + (if (logtest? (-> arg2 flags) (font-flags middle)) + (+! (-> arg2 origin x) (* 0.5 (- f26-0 f0-1))) + ) + (if (logtest? (-> arg2 flags) (font-flags middle-vert)) + (+! (-> arg2 origin y) (* 0.5 (- f30-0 f1-2))) + ) + (let ((v1-10 arg2)) + (set! (-> v1-10 scale) (* f28-0 arg1)) + ) + (set! (-> arg2 width) f0-1) + (set! (-> arg2 height) f1-2) + ) + (print-game-text arg0 arg2 #f 44 (bucket-id hud-draw-hud-alpha)) + (set! (-> arg2 origin x) f24-0) + (set! (-> arg2 origin y) f22-0) + (set! (-> arg2 width) f26-0) + (set! (-> arg2 height) f30-0) + (set! (-> arg2 scale) f28-0) + ) + 0 + (none) + ) + +;; definition for function print-game-text +(defun print-game-text ((arg0 string) (arg1 font-context) (arg2 symbol) (arg3 int) (arg4 bucket-id)) + (local-vars + (sv-16 float) + (sv-20 float) + (sv-24 font-flags) + (sv-28 font-color) + (sv-32 (pointer uint8)) + (sv-36 float) + (sv-40 float) + (sv-44 float) + (sv-48 float) + (sv-52 float) + (sv-56 float) + (sv-64 int) + (sv-72 uint) + (sv-80 int) + (sv-88 int) + (sv-96 int) + (sv-104 uint) + (sv-108 symbol) + (sv-112 int) + (sv-120 int) + ) + (cond + ((< 0.1 (-> arg1 scale)) + (set! sv-16 (-> arg1 origin x)) + (set! sv-20 (-> arg1 origin y)) + (set! sv-24 (-> arg1 flags)) + (set! sv-28 (-> arg1 color)) + (set-context! *font-work* arg1) + (set! (-> arg1 max-x) sv-16) + (when (logtest? (-> arg1 flags) (font-flags middle-vert)) + (logclear! (-> arg1 flags) (font-flags middle-vert)) + (+! (-> arg1 origin y) + (the float + (the int (* 0.5 (- (-> arg1 height) (print-game-text arg0 arg1 #t 44 (bucket-id hud-draw-hud-alpha))))) + ) + ) + ) + (set! sv-32 (-> arg0 data)) + (set! sv-36 (-> arg1 origin x)) + (set! sv-40 (-> arg1 origin x)) + (set! sv-44 (+ (-> arg1 origin x) (-> arg1 width))) + (set! sv-48 (+ (-> arg1 origin y) (-> arg1 height))) + (set! sv-52 (-> (get-string-length " " arg1) length)) + (set! sv-56 (* (if (logtest? (-> arg1 flags) (font-flags large)) + (the float arg3) + 28.0 + ) + (-> arg1 scale) + ) + ) + (set! sv-64 0) + (if (logtest? (-> arg1 flags) (font-flags middle)) + (+! (-> arg1 origin x) (* 0.5 (-> arg1 width))) + ) + (set! sv-72 (-> sv-32 0)) + (set! sv-80 0) + (set! sv-88 0) + (set! sv-96 0) + (set! sv-104 (-> sv-32 1)) + (set! sv-108 (the-as symbol #f)) + (set! sv-112 0) + (set! sv-120 0) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (while (and (not (and (zero? sv-72) (zero? sv-80) (zero? sv-88))) (>= sv-48 (-> arg1 origin y))) + (set! sv-120 0) + (set! sv-32 (&-> sv-32 1)) + (set! sv-104 (-> sv-32 0)) + (set! sv-32 (&-> sv-32 -1)) + (cond + ((and (> sv-72 0) (< sv-72 (the-as uint 4))) + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + (set! (-> *game-text-word* data sv-80) sv-104) + (set! sv-80 (+ sv-80 1)) + (set! sv-32 (&-> sv-32 1)) + ) + ((or (= sv-72 32) (= sv-72 47) (and (= sv-72 45) (!= (-> sv-32 -1) 126))) + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + (set! sv-108 #t) + ) + ((zero? sv-72) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (set! sv-112 (+ sv-112 1)) + ) + ((and (= sv-72 92) (= sv-104 92)) + (set! sv-32 (&-> sv-32 1)) + (if (nonzero? sv-80) + (set! sv-108 #t) + ) + (set! sv-112 (+ sv-112 1)) + ) + ((and (= sv-72 95) (= sv-104 95)) + (set! sv-32 (&-> sv-32 1)) + (set! (-> *game-text-word* data sv-80) (the-as uint 32)) + (set! sv-80 (+ sv-80 1)) + ) + (else + (set! (-> *game-text-word* data sv-80) sv-72) + (set! sv-80 (+ sv-80 1)) + ) + ) + (when sv-108 + (set! (-> *game-text-word* data sv-80) (the-as uint 0)) + (let ((f30-1 sv-36)) + (set! sv-120 (the int (-> (get-string-length *game-text-word* arg1) length))) + (let ((f0-27 (+ f30-1 (the float sv-120)))) + (if (= (-> *game-text-word* data (+ sv-80 -1)) 32) + (set! f0-27 (- f0-27 sv-52)) + ) + (cond + ((< sv-44 f0-27) + (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (set! sv-112 (+ sv-112 1)) + ) + (else + (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) + (set! sv-88 (+ sv-88 sv-80)) + (set! sv-80 0) + (set! sv-36 (+ sv-36 (the float sv-120))) + (set! (-> arg1 max-x) (fmax (-> arg1 max-x) sv-36)) + (set! sv-108 (the-as symbol #f)) + ) + ) + ) + ) + ) + (while (> sv-112 0) + (let ((f30-2 (+ (-> arg1 origin y) sv-56))) + (when (and (>= sv-96 (the-as int (-> arg1 start-line))) #t) + (when (= (-> *game-text-line* data (+ sv-88 -1)) 32) + (set! (-> *game-text-line* data (+ sv-88 -1)) (the-as uint 0)) + 0 + ) + (if (nonzero? (-> *game-text-line* data 0)) + (set! sv-64 (+ sv-64 1)) + ) + (when (not arg2) + (with-dma-buffer-add-bucket ((s2-1 (-> *display* frames (-> *display* on-screen) global-buf)) + arg4 + ) + (draw-string *game-text-line* s2-1 arg1) + ) + ) + (set! (-> arg1 origin y) f30-2) + ) + ) + (set! sv-96 (+ sv-96 1)) + (set! (-> *game-text-line* data 0) (the-as uint 0)) + (set! sv-88 0) + (set! sv-112 (+ sv-112 -1)) + (set! sv-36 sv-40) + (when sv-108 + (copy-charp<-charp (&-> *game-text-line* data sv-88) (-> *game-text-word* data)) + (set! sv-88 (+ sv-88 sv-80)) + (set! sv-80 0) + (set! sv-108 (the-as symbol #f)) + (set! sv-36 (+ sv-36 (the float sv-120))) + ) + ) + (when (nonzero? sv-72) + (set! sv-32 (&-> sv-32 1)) + (set! sv-72 (-> sv-32 0)) + ) + ) + (set! (-> arg1 origin x) sv-16) + (set! (-> arg1 origin y) sv-20) + (set! (-> arg1 flags) sv-24) + (set! (-> arg1 color) sv-28) + (if (> sv-64 0) + (* sv-56 (the float sv-64)) + 0.0 + ) + ) + (else + 0.0 + ) + ) + ) + +;; definition for function disable-level-text-file-loading +;; WARN: Return type mismatch int vs none. +(defun disable-level-text-file-loading () + (set! *level-text-file-load-flag* #f) + 0 + (none) + ) + +;; definition for function enable-level-text-file-loading +;; WARN: Return type mismatch int vs none. +(defun enable-level-text-file-loading () + (set! *level-text-file-load-flag* #t) + 0 + (none) + ) + + + + diff --git a/test/offline/config/jak3/config.jsonc b/test/offline/config/jak3/config.jsonc index 9fa81d9b629..1ac9022a472 100644 --- a/test/offline/config/jak3/config.jsonc +++ b/test/offline/config/jak3/config.jsonc @@ -11,7 +11,8 @@ "subdivide", "shadow-cpu-h", "foreground", - "tie-methods" + "tie-methods", + "scene-actor" // top level lambda that defines a type ], "skip_compile_functions": [ @@ -131,7 +132,11 @@ "dma-add-process-drawable", "vis-cull", "vis-cull-debug", - "foreground-engine-execute" + "foreground-engine-execute", + // idle-control + "(method 10 idle-control)", // changes pp + // aligner + "(method 9 align-control)" ], "skip_compile_states": {}