From f39b993f79deff109385ed1b2c775853e76b64c6 Mon Sep 17 00:00:00 2001 From: water111 <48171810+water111@users.noreply.github.com> Date: Sat, 12 Nov 2022 17:56:07 -0500 Subject: [PATCH] [decommp] `generic-obs` (#2013) --- decompiler/Function/Function.h | 7 + decompiler/IR2/FormExpressionAnalysis.cpp | 20 +- decompiler/IR2/GenericElementMatcher.cpp | 17 + decompiler/IR2/GenericElementMatcher.h | 2 + decompiler/analysis/insert_lets.cpp | 20 +- decompiler/analysis/variable_naming.cpp | 67 +- decompiler/config/jak2/all-types.gc | 172 +- .../jak2/anonymous_function_types.jsonc | 3 + decompiler/config/jak2/label_types.jsonc | 3 +- decompiler/config/jak2/stack_structures.jsonc | 6 +- decompiler/config/jak2/type_casts.jsonc | 98 + goal_src/jak2/engine/ai/traffic-h.gc | 32 +- goal_src/jak2/engine/anim/fma-sphere.gc | 6 +- goal_src/jak2/engine/camera/cam-combiner.gc | 308 +- goal_src/jak2/engine/camera/cam-debug.gc | 22 +- goal_src/jak2/engine/camera/cam-master.gc | 60 +- goal_src/jak2/engine/camera/cam-states-dbg.gc | 44 +- goal_src/jak2/engine/camera/cam-states.gc | 223 +- goal_src/jak2/engine/camera/camera-h.gc | 114 +- goal_src/jak2/engine/camera/camera.gc | 14 +- goal_src/jak2/engine/common_objs/base-plat.gc | 44 +- .../jak2/engine/common_objs/basebutton.gc | 118 +- .../jak2/engine/common_objs/blocking-plane.gc | 86 +- goal_src/jak2/engine/common_objs/crates.gc | 70 +- .../jak2/engine/common_objs/generic-obs-h.gc | 150 +- .../jak2/engine/common_objs/generic-obs.gc | 2824 +++++++++++++- goal_src/jak2/engine/common_objs/voicebox.gc | 5 +- .../jak2/engine/common_objs/water-anim.gc | 188 +- goal_src/jak2/engine/common_objs/water.gc | 46 +- goal_src/jak2/engine/data/art-h.gc | 2 +- goal_src/jak2/engine/debug/editable-player.gc | 447 +-- goal_src/jak2/engine/game/settings-h.gc | 10 + .../jak2/engine/gfx/foreground/foreground.gc | 2 + .../engine/gfx/foreground/shadow-cpu-h.gc | 13 +- goal_src/jak2/engine/gfx/lightning-h.gc | 1 + goal_src/jak2/engine/gfx/mood/time-of-day.gc | 147 +- .../sprite/particles/sparticle-launcher-h.gc | 1 + .../process-drawable/process-drawable.gc | 17 +- .../process-drawable/process-taskable.gc | 44 +- .../engine/process-drawable/simple-focus.gc | 24 +- goal_src/jak2/engine/scene/scene.gc | 116 +- .../jak2/engine/target/board/board-states.gc | 46 +- goal_src/jak2/engine/target/logic-target.gc | 44 +- goal_src/jak2/engine/target/sidekick.gc | 31 +- goal_src/jak2/engine/target/target-h.gc | 2 +- goal_src/jak2/engine/target/target.gc | 26 +- goal_src/jak2/engine/ui/progress/progress.gc | 462 +-- goal_src/jak2/levels/common/airlock.gc | 102 +- goal_src/jak2/levels/common/battle.gc | 116 +- .../levels/common/cty-guard-turret-button.gc | 16 +- goal_src/jak2/levels/common/elec-gate.gc | 4 +- goal_src/jak2/levels/common/enemy/bouncer.gc | 157 +- .../common/enemy/guards/guard-conversation.gc | 26 +- .../jak2/levels/common/guard-projectile.gc | 46 +- goal_src/jak2/levels/common/scene-actor.gc | 153 +- .../jak1/engine/ambient/ambient_REF.gc | 66 +- .../jak1/engine/camera/cam-combiner_REF.gc | 276 +- .../jak1/engine/camera/camera_REF.gc | 80 +- .../jak1/engine/camera/pov-camera_REF.gc | 30 +- .../jak1/engine/game/collectables_REF.gc | 96 +- .../reference/jak1/engine/game/crates_REF.gc | 50 +- .../jak1/engine/game/game-save_REF.gc | 20 +- .../jak1/engine/game/generic-obs_REF.gc | 202 +- .../engine/game/task/process-taskable_REF.gc | 136 +- .../jak1/engine/gfx/water/water_REF.gc | 12 +- .../reference/jak1/engine/load/loader_REF.gc | 24 +- .../jak1/engine/target/target-handler_REF.gc | 496 ++- .../jak1/engine/ui/progress/progress_REF.gc | 288 +- .../jak1/levels/beach/pelican_REF.gc | 134 +- .../jak1/levels/citadel/citadel-obs_REF.gc | 14 +- .../jak1/levels/citadel/citadel-sages_REF.gc | 52 +- .../jak1/levels/citadel/citb-drop-plat_REF.gc | 24 +- .../jak1/levels/citadel/citb-plat_REF.gc | 20 +- .../jak1/levels/common/baseplat_REF.gc | 44 +- .../jak1/levels/common/water-anim_REF.gc | 28 +- .../jak1/levels/darkcave/darkcave-obs_REF.gc | 32 +- .../jak1/levels/finalboss/final-door_REF.gc | 34 +- .../jak1/levels/finalboss/light-eco_REF.gc | 48 +- .../levels/finalboss/robotboss-misc_REF.gc | 100 +- .../jak1/levels/finalboss/robotboss_REF.gc | 50 +- .../levels/firecanyon/firecanyon-obs_REF.gc | 26 +- .../jak1/levels/flut_common/flutflut_REF.gc | 32 +- .../jak1/levels/jungle/darkvine_REF.gc | 46 +- .../jak1/levels/jungle/fisher_REF.gc | 44 +- .../jak1/levels/jungle/jungle-obs_REF.gc | 82 +- .../jak1/levels/jungleb/jungleb-obs_REF.gc | 22 +- .../jak1/levels/jungleb/plat-flip_REF.gc | 22 +- .../levels/lavatube/lavatube-energy_REF.gc | 80 +- .../jak1/levels/maincave/gnawer_REF.gc | 64 +- .../jak1/levels/maincave/maincave-obs_REF.gc | 76 +- .../levels/maincave/mother-spider-egg_REF.gc | 32 +- .../jak1/levels/misty/bonelurker_REF.gc | 24 +- .../jak1/levels/misty/misty-conveyor_REF.gc | 42 +- .../jak1/levels/misty/mistycannon_REF.gc | 30 +- .../jak1/levels/ogre/flying-lurker_REF.gc | 182 +- .../jak1/levels/ogre/ogre-obs_REF.gc | 70 +- .../jak1/levels/ogre/ogreboss_REF.gc | 64 +- .../jak1/levels/racer_common/racer_REF.gc | 46 +- .../jak1/levels/robocave/spider-egg_REF.gc | 46 +- .../rolling/rolling-lightning-mole_REF.gc | 18 +- .../levels/rolling/rolling-race-ring_REF.gc | 60 +- .../jak1/levels/snow/ice-cube_REF.gc | 168 +- .../jak1/levels/snow/snow-ball_REF.gc | 24 +- .../jak1/levels/snow/snow-flutflut-obs_REF.gc | 134 +- .../jak1/levels/snow/snow-obs_REF.gc | 50 +- .../reference/jak1/levels/sunken/bully_REF.gc | 194 +- .../jak1/levels/sunken/helix-water_REF.gc | 20 +- .../jak1/levels/sunken/orbit-plat_REF.gc | 118 +- .../jak1/levels/sunken/puffer_REF.gc | 96 +- .../jak1/levels/sunken/square-platform_REF.gc | 68 +- .../jak1/levels/sunken/wall-plat_REF.gc | 42 +- .../jak1/levels/sunken/wedge-plats_REF.gc | 66 +- .../reference/jak1/levels/swamp/billy_REF.gc | 32 +- .../jak1/levels/swamp/swamp-obs_REF.gc | 36 +- .../jak1/levels/title/title-obs_REF.gc | 64 +- .../jak1/levels/training/training-obs_REF.gc | 156 +- .../levels/village1/fishermans-boat_REF.gc | 70 +- .../jak1/levels/village1/yakow_REF.gc | 70 +- .../jak1/levels/village2/swamp-blimp_REF.gc | 14 +- .../jak1/levels/village2/village2-obs_REF.gc | 28 +- .../jak1/levels/village3/minecart_REF.gc | 26 +- .../jak1/levels/village3/village3-obs_REF.gc | 20 +- .../reference/jak2/engine/ai/traffic-h_REF.gc | 16 +- .../jak2/engine/anim/fma-sphere_REF.gc | 8 +- .../jak2/engine/camera/cam-combiner_REF.gc | 296 +- .../jak2/engine/camera/cam-debug_REF.gc | 103 +- .../jak2/engine/camera/cam-master_REF.gc | 60 +- .../jak2/engine/camera/cam-states-dbg_REF.gc | 8 +- .../jak2/engine/camera/cam-states_REF.gc | 223 +- .../jak2/engine/camera/camera-h_REF.gc | 146 +- .../jak2/engine/camera/camera_REF.gc | 14 +- .../jak2/engine/common_objs/base-plat_REF.gc | 44 +- .../jak2/engine/common_objs/basebutton_REF.gc | 118 +- .../engine/common_objs/blocking-plane_REF.gc | 82 +- .../jak2/engine/common_objs/crates_REF.gc | 70 +- .../engine/common_objs/generic-obs-h_REF.gc | 88 +- .../engine/common_objs/generic-obs_REF.gc | 3317 +++++++++++++++++ .../jak2/engine/common_objs/voicebox_REF.gc | 5 +- .../jak2/engine/common_objs/water-anim_REF.gc | 176 +- .../jak2/engine/common_objs/water_REF.gc | 46 +- .../reference/jak2/engine/data/art-h_REF.gc | 2 +- .../jak2/engine/debug/editable-player_REF.gc | 447 +-- .../jak2/engine/game/game-save_REF.gc | 59 +- .../jak2/engine/game/task/task-control_REF.gc | 26 +- .../jak2/engine/gfx/mood/time-of-day_REF.gc | 144 +- .../process-drawable/process-drawable_REF.gc | 18 +- .../process-drawable/process-taskable_REF.gc | 42 +- .../process-drawable/simple-focus_REF.gc | 18 +- .../reference/jak2/engine/scene/scene_REF.gc | 116 +- .../engine/target/board/board-states_REF.gc | 46 +- .../engine/target/gun/gun-red-shot_REF.gc | 33 +- .../jak2/engine/target/logic-target_REF.gc | 43 +- .../jak2/engine/target/sidekick_REF.gc | 31 +- .../jak2/engine/target/target-darkjak_REF.gc | 128 +- .../jak2/engine/target/target_REF.gc | 26 +- .../jak2/engine/ui/progress/progress_REF.gc | 462 +-- .../jak2/levels/common/airlock_REF.gc | 88 +- .../jak2/levels/common/battle_REF.gc | 116 +- .../common/cty-guard-turret-button_REF.gc | 16 +- .../jak2/levels/common/elec-gate_REF.gc | 4 +- .../jak2/levels/common/enemy/bouncer_REF.gc | 157 +- .../enemy/guards/guard-conversation_REF.gc | 26 +- .../levels/common/guard-projectile_REF.gc | 42 +- .../jak2/levels/common/scene-actor_REF.gc | 99 +- test/offline/config/jak2/config.jsonc | 4 +- 165 files changed, 12536 insertions(+), 6261 deletions(-) create mode 100644 test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc diff --git a/decompiler/Function/Function.h b/decompiler/Function/Function.h index 846a32ee9e..158246c3b7 100644 --- a/decompiler/Function/Function.h +++ b/decompiler/Function/Function.h @@ -67,6 +67,13 @@ struct FunctionName { bool empty() const { return kind == FunctionKind::UNIDENTIFIED; } + bool is_handler() const { + return kind == FunctionKind::NV_STATE || kind == FunctionKind::V_STATE; + } + bool is_handler(StateHandler shk) const { return is_handler() && handler_kind == shk; } + + bool is_event_handler() const { return is_handler(StateHandler::EVENT); } + void set_as_top_level(const std::string& object_file_name) { kind = FunctionKind::TOP_LEVEL_INIT; object_name = object_file_name; diff --git a/decompiler/IR2/FormExpressionAnalysis.cpp b/decompiler/IR2/FormExpressionAnalysis.cpp index c82c885b71..d106f59d9b 100644 --- a/decompiler/IR2/FormExpressionAnalysis.cpp +++ b/decompiler/IR2/FormExpressionAnalysis.cpp @@ -1982,15 +1982,22 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env, return; } + // (-> (the-as process-drawable (-> v1-32 0)) pid) + // (-> v1-61 0 pid) + auto just_deref_matcher = Matcher::match_or( + {Matcher::deref(Matcher::any_reg(0), false, + {DerefTokenMatcher::integer(0), DerefTokenMatcher::string("pid")}), + Matcher::deref({Matcher::cast_to_any(4, Matcher::deref(Matcher::any_reg(0), false, + {DerefTokenMatcher::integer(0)}))}, + false, {DerefTokenMatcher::string("pid")})}); + // jak 1: // (logior (shl (-> v1-61 0 pid) 32) (.asm.sllv.r0 v1-61)) // jak 2: // (logior (if v1-61 (shl (-> v1-61 0 pid) 32) 0) (.asm.sllv.r0 v1-61)) - auto pid_deref_matcher = Matcher::op_fixed( - FixedOperatorKind::SHL, - {Matcher::deref(Matcher::any_reg(0), false, - {DerefTokenMatcher::integer(0), DerefTokenMatcher::string("pid")}), - Matcher::integer(32)}); + auto pid_deref_matcher = + Matcher::op_fixed(FixedOperatorKind::SHL, {just_deref_matcher, Matcher::integer(32)}); + auto make_handle_matcher = Matcher::op_fixed( FixedOperatorKind::LOGIOR, {env.version == GameVersion::Jak1 @@ -2002,6 +2009,7 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env, Matcher::op_fixed(FixedOperatorKind::ASM_SLLV_R0, {Matcher::any_reg(1)})}); auto handle_mr = match(make_handle_matcher, element); + if (handle_mr.matched) { auto var_a = handle_mr.maps.regs.at(0).value(); auto var_b = handle_mr.maps.regs.at(1).value(); @@ -2009,7 +2017,7 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env, if (var_name == env.get_variable_name(var_b) && (env.version == GameVersion::Jak1 || var_name == env.get_variable_name(handle_mr.maps.regs.at(2).value())) && - env.dts->ts.tc(TypeSpec("pointer", {TypeSpec("process")}), + env.dts->ts.tc(TypeSpec("pointer", {TypeSpec("process-tree")}), env.get_variable_type(var_a, true))) { auto* menv = const_cast(&env); menv->disable_use(var_a); diff --git a/decompiler/IR2/GenericElementMatcher.cpp b/decompiler/IR2/GenericElementMatcher.cpp index 7ee43c656b..807fa62e4c 100644 --- a/decompiler/IR2/GenericElementMatcher.cpp +++ b/decompiler/IR2/GenericElementMatcher.cpp @@ -73,6 +73,14 @@ Matcher Matcher::cast(const std::string& type, Matcher value) { return m; } +Matcher Matcher::cast_to_any(int type_out, Matcher value) { + Matcher m; + m.m_kind = Kind::CAST_TO_ANY; + m.m_string_out_id = type_out; + m.m_sub_matchers = {value}; + return m; +} + Matcher Matcher::any(int match_id) { Matcher m; m.m_kind = Kind::ANY; @@ -335,6 +343,15 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out) const { return false; } break; + case Kind::CAST_TO_ANY: { + auto as_cast = dynamic_cast(input->try_as_single_active_element()); + if (as_cast) { + maps_out->strings[m_string_out_id] = as_cast->type().print(); + return m_sub_matchers.at(0).do_match(as_cast->source(), maps_out); + } + return false; + } break; + case Kind::INT: { auto as_simple_atom = dynamic_cast(input->try_as_single_active_element()); if (as_simple_atom) { diff --git a/decompiler/IR2/GenericElementMatcher.h b/decompiler/IR2/GenericElementMatcher.h index 3f3df55456..683b1745dd 100644 --- a/decompiler/IR2/GenericElementMatcher.h +++ b/decompiler/IR2/GenericElementMatcher.h @@ -47,6 +47,7 @@ class Matcher { static Matcher set_var(const Matcher& src, int dst_match_id); // var-form static Matcher match_or(const std::vector& args); static Matcher cast(const std::string& type, Matcher value); + static Matcher cast_to_any(int type_out, Matcher value); static Matcher any(int match_id = -1); static Matcher integer(std::optional value); static Matcher any_integer(int match_id = -1); @@ -74,6 +75,7 @@ class Matcher { GENERIC_OP_WITH_REST, OR, CAST, + CAST_TO_ANY, ANY, INT, ANY_INT, diff --git a/decompiler/analysis/insert_lets.cpp b/decompiler/analysis/insert_lets.cpp index f4aa468ddd..6b73e80f32 100644 --- a/decompiler/analysis/insert_lets.cpp +++ b/decompiler/analysis/insert_lets.cpp @@ -907,6 +907,15 @@ FormElement* rewrite_as_case_no_else(LetElement* in, const Env& env, FormPool& p } auto* cond = in->body()->try_as_element(); + std::optional cast_type; + if (!cond) { + auto* casted = in->body()->try_as_element(); + if (casted) { + cast_type = casted->type(); + cond = casted->source()->try_as_element(); + } + } + if (!cond) { return nullptr; } @@ -972,8 +981,12 @@ FormElement* rewrite_as_case_no_else(LetElement* in, const Env& env, FormPool& p return nullptr; } - return pool.alloc_element(in->entries().at(0).src, entries, nullptr); - return nullptr; + auto* case_elt = pool.alloc_element(in->entries().at(0).src, entries, nullptr); + if (cast_type) { + return pool.alloc_element(*cast_type, pool.alloc_single_form(nullptr, case_elt)); + } else { + return case_elt; + } } FormElement* rewrite_as_case_with_else(LetElement* in, const Env& env, FormPool& pool) { @@ -1496,7 +1509,8 @@ FormElement* rewrite_proc_new(LetElement* in, const Env& env, FormPool& pool) { args.push_back(as_func->elts().at(1)); } else { auto init_func = as_func->elts().at(1)->to_form(env); - if (init_func.is_symbol("manipy-init") && proc_type == "manipy") { + if (init_func.is_symbol("manipy-init") && proc_type == "manipy" && + env.version == GameVersion::Jak1) { head = "manipy-spawn"; } else { args.push_back(pool.form(proc_type)); diff --git a/decompiler/analysis/variable_naming.cpp b/decompiler/analysis/variable_naming.cpp index 725b5d2e14..bc0463ced2 100644 --- a/decompiler/analysis/variable_naming.cpp +++ b/decompiler/analysis/variable_naming.cpp @@ -652,18 +652,37 @@ void SSA::remap(int) { } namespace { + +TP_Type lca_for_var_types(const TP_Type& existing, + const TP_Type& add, + const DecompilerTypeSystem& dts, + bool event_handler_hack) { + bool changed; + auto normal = dts.tp_lca(existing, add, &changed); + if (!event_handler_hack || normal.typespec().base_type() != "none") { + return normal; + } + if (existing.typespec().base_type() == "none") { + return add; + } else if (add.typespec().base_type() == "none") { + return existing; + } else { + return normal; + } +} + void update_var_info(VariableNames::VarInfo* info, Register reg, const TypeState& ts, int var_id, - const DecompilerTypeSystem& dts) { + const DecompilerTypeSystem& dts, + bool event_handler_hack) { auto& type = ts.get(reg); if (info->initialized) { ASSERT(info->reg_id.id == var_id); ASSERT(info->reg_id.reg == reg); - bool changed; - info->type = dts.tp_lca(info->type, type, &changed); + info->type = lca_for_var_types(info->type, type, dts, event_handler_hack); } else { info->reg_id.id = var_id; @@ -676,10 +695,11 @@ void update_var_info(VariableNames::VarInfo* info, bool merge_infos(VariableNames::VarInfo* info1, VariableNames::VarInfo* info2, - const DecompilerTypeSystem& dts) { + const DecompilerTypeSystem& dts, + bool event_handler_hack) { if (info1->initialized && info2->initialized) { - bool changed; - auto new_type = dts.tp_lca(info1->type, info2->type, &changed); + auto new_type = lca_for_var_types(info1->type, info2->type, dts, event_handler_hack); + info1->type = new_type; info2->type = new_type; return true; @@ -690,12 +710,13 @@ bool merge_infos(VariableNames::VarInfo* info1, void merge_infos( std::unordered_map, Register::hash>& info1, std::unordered_map, Register::hash>& info2, - const DecompilerTypeSystem& dts) { + const DecompilerTypeSystem& dts, + bool event_handler_hack) { for (auto& [reg, infos] : info1) { auto other = info2.find(reg); if (other != info2.end()) { for (size_t i = 0; i < std::min(other->second.size(), infos.size()); i++) { - merge_infos(&infos.at(i), &other->second.at(i), dts); + merge_infos(&infos.at(i), &other->second.at(i), dts, event_handler_hack); } } } @@ -704,8 +725,13 @@ void merge_infos( /*! * Create variable info for each variable. + * Note: the "event_handler_hack" is supposed to help with the use of "none" typed variables + * that are actually used. It's a hack because we don't really have enough information to know if + * the none variables */ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) { + bool event_handler_hack = + function.ir2.env.version > GameVersion::Jak1 && function.guessed_name.is_event_handler(); for (int block_id = 0; block_id < int(blocks.size()); block_id++) { const auto& block = blocks.at(block_id); const TypeState* init_types = &function.ir2.env.get_types_at_block_entry(block_id); @@ -720,13 +746,13 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) { if (instr.dst.has_value()) { auto var_id = map.var_id(*instr.dst); auto* info = &program_write_vars[instr.dst->reg()].at(var_id); - update_var_info(info, instr.dst->reg(), *end_types, var_id, dts); + update_var_info(info, instr.dst->reg(), *end_types, var_id, dts, event_handler_hack); } for (auto& src : instr.src) { auto var_id = map.var_id(src); auto* info = &program_read_vars[src.reg()].at(var_id); - update_var_info(info, src.reg(), *init_types, var_id, dts); + update_var_info(info, src.reg(), *init_types, var_id, dts, event_handler_hack); } init_types = end_types; @@ -747,26 +773,7 @@ void SSA::make_vars(const Function& function, const DecompilerTypeSystem& dts) { } } - // if (function.type.last_arg() != TypeSpec("none")) { - // auto return_var = function.ir2.atomic_ops->end_op().return_var(); - // auto return_reg = return_var.reg(); - // const auto& last_block = blocks.at(blocks.size() - 1); - // const auto& last_ins = last_block.ins.at(last_block.ins.size() - 1); - // ASSERT(last_ins.src.size() == 1); - // auto return_idx = map.var_id(last_ins.src.at(0)); - // - // if (!program_read_vars[return_reg].empty()) { - // program_read_vars[return_reg].at(return_idx).type = - // TP_Type::make_from_ts(function.type.last_arg()); - // } - // - // if (!program_write_vars[return_reg].empty()) { - // program_write_vars[return_reg].at(return_idx).type = - // TP_Type::make_from_ts(function.type.last_arg()); - // } - // } - - merge_infos(program_write_vars, program_read_vars, dts); + merge_infos(program_write_vars, program_read_vars, dts, event_handler_hack); // copy types from input argument coloring moves: for (auto& instr : blocks.at(0).ins) { diff --git a/decompiler/config/jak2/all-types.gc b/decompiler/config/jak2/all-types.gc index 473daef122..2e4a0fa81c 100644 --- a/decompiler/config/jak2/all-types.gc +++ b/decompiler/config/jak2/all-types.gc @@ -26,6 +26,7 @@ (define-extern stack-frame type) (define-extern global kheap) (define-extern kheap type) +(define-extern pointer type) (define-extern #t symbol) @@ -7766,6 +7767,11 @@ (VERTICAL_FOLLOW_MATCHES_CAMERA) (HAVE_BUTT_HANDLE)) +(defenum cam-slave-options-u32 + :type uint32 + :bitfield #t + :copy-entries cam-slave-options) + (defenum cam-master-options :type uint64 :bitfield #t @@ -7779,6 +7785,11 @@ (IMMEDIATE_STRING_MIN_MAX) ;; 80 ) +(defenum cam-master-options-u32 + :type uint32 + :bitfield #t + :copy-entries cam-master-options) + (deftype cam-setting-data (structure) ((fov degrees) (pov-handle handle :offset 16) @@ -8756,6 +8767,22 @@ ;; traffic-h ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defenum traffic-danger-flags + :type uint8 + :bitfield #t + (tdf0 0) + ) + +(defenum traffic-danger-type + :type uint8 + (tdt0 0) + (tdt1 1) + (tdt2 2) + (tdt3 3) + (tdt4 4) + (tdt5 5) + ) + (deftype traffic-danger-info (structure) ((sphere sphere :inline :offset-assert 0) (velocity vector :inline :offset-assert 16) @@ -8763,8 +8790,8 @@ (notify-radius float :offset-assert 40) (danger-level float :offset-assert 44) (decay-rate float :offset-assert 48) - (flags uint8 :offset-assert 52) - (danger-type uint8 :offset-assert 53) + (flags traffic-danger-flags :offset-assert 52) + (danger-type traffic-danger-type :offset-assert 53) ) :method-count-assert 9 :size-assert #x36 @@ -11248,7 +11275,7 @@ (get-skeleton-origin (_type_) vector 9) (lod-set! (_type_ int) none 10) (lods-assign! (_type_ lod-set) none 11) - (setup-masks (_type_ uint int) none 12) + (setup-masks (_type_ int int) none 12) (setup-cspace-and-add (_type_ art-joint-geo symbol) none 13) (do-joint-math (_type_ cspace-array joint-control) none 14) ) @@ -12216,7 +12243,7 @@ :size-assert #x60 :flag-assert #xf00000060 (:methods - (new (symbol type float float float float float) _type_ 0) + (new (symbol type float float float shadow-flags float) _type_ 0) (clear-offset-bit (shadow-control) int 9) (set-offset-bit (shadow-control) int 10) (set-top-plane-offset (shadow-control float) int 11) @@ -16369,10 +16396,12 @@ (defenum manipy-options :bitfield #t :type uint32 + (mo-0 0) ) (deftype manipy (process-drawable) - ((new-trans-hook (function none) :offset-assert 200) + ((root-override collide-shape :offset 128 :score 1) + (new-trans-hook (function none) :offset-assert 200) (cur-trans-hook (function none) :offset-assert 204) (cur-event-hook (function none) :offset-assert 208) (new-joint-anim art-joint-anim :offset-assert 212) @@ -16396,7 +16425,7 @@ ) :flag-assert #x1501000174 (:methods - (manipy-method-20 () none 20) + (idle () _type_ :state 20) ) ) @@ -16413,8 +16442,8 @@ :size-assert #xb0 :flag-assert #x10003000b0 (:methods - (part-spawner-method-14 () none 14) - (part-spawner-method-15 () none 15) + (active () _type_ :state 14) + (is-in-view? (_type_) symbol 15) ) ) @@ -16440,22 +16469,22 @@ :flag-assert #x1000f00168 ;; field userdata uses ~A with a 64-bit load (:methods - (part-tracker-method-14 () none 14) - (part-tracker-method-15 () none 15) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) ) ) (deftype lightning-tracker (process) ((ppointer-override (pointer lightning-tracker) :offset 28 :score 100) (root trsqv :offset-assert 128) - (lightning lightning-spec :offset-assert 132) + (lightning lightning-control :offset-assert 132) (callback (function lightning-tracker none) :offset-assert 136) (duration uint64 :offset-assert 144) (start-time time-frame :offset-assert 152) (offset0 vector :inline :offset-assert 160) (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) + (target0 handle :offset-assert 192) + (target1 handle :offset-assert 200) (target-joint0 int32 :offset-assert 208) (target-joint1 int32 :offset-assert 212) (sound uint32 :offset-assert 216) @@ -16469,14 +16498,15 @@ :flag-assert #x1100b00130 ;; field userdata uses ~A with a 64-bit load (:methods - (lightning-tracker-method-14 () none 14) - (lightning-tracker-method-15 () none 15) - (lightning-tracker-method-16 () none 16) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) + (update (_type_) none 16) ) ) (deftype touch-tracker (process-drawable) - ((duration time-frame :offset-assert 200) + ((root-override collide-shape :offset 128 :score 1) + (duration time-frame :offset-assert 200) (target handle :offset-assert 208) (event symbol :offset-assert 216) ;; guessed by decompiler (run-function (function object) :offset-assert 220) ;; guessed by decompiler @@ -16487,12 +16517,13 @@ :size-assert #xe8 :flag-assert #x15007000e8 (:methods - (touch-tracker-method-20 () none 20) + (active () _type_ :state 20) ) ) (deftype swingpole (process-drawable) - ((edge-length meters :offset-assert 200) + ((root-override collide-shape :offset 128 :score 1) + (edge-length meters :offset-assert 200) (path-pos float :offset-assert 204) (joint-track int32 :offset-assert 208) (speed meters :offset-assert 212) @@ -16503,9 +16534,9 @@ :size-assert #x11c :flag-assert #x1700a0011c (:methods - (swingpole-method-20 () none 20) - (swingpole-method-21 () none 21) - (swingpole-method-22 () none 22) + (idle () _type_ :state 20) + (active (handle) _type_ :state 21) + (move-along-path (_type_) none 22) ) ) @@ -16547,7 +16578,8 @@ ) (deftype explosion (process-drawable) - ((start-time time-frame :offset-assert 200) + ((root-override collide-shape :offset 128 :score 1) + (start-time time-frame :offset-assert 200) (duration uint32 :offset-assert 208) (linger-duration uint32 :offset-assert 212) (attack-id uint32 :offset-assert 216) @@ -16556,9 +16588,9 @@ :size-assert #xdc :flag-assert #x17006000dc (:methods - (explosion-method-20 () none 20) - (explosion-method-21 () none 21) - (explosion-method-22 () none 22) + (explode () _type_ :state 20) + (setup-explosion-collision (_type_) none 21) + (explosion-method-22 (_type_) none 22) ) ) @@ -16566,7 +16598,7 @@ ((spawn-point vector :inline :offset-assert 0) (spawn-quat quaternion :inline :offset-assert 16) (radius float :offset-assert 32) - (group basic :offset-assert 36) + (group sparticle-launch-group :offset-assert 36) (collide-with collide-spec :offset-assert 40) (penetrate-using penetrate :offset-assert 48) ) @@ -16582,7 +16614,7 @@ :flag-assert #xf00000080 ;; Failed to read fields. (:methods - (process-hidden-method-14 () none 14) ;; (die () _type_ :state 14) + (die () _type_ :state 14) ) ) @@ -20016,6 +20048,7 @@ (unk-5 5) (unk-6 6) (unk-7 7) + (unk-8 8) ) ;; ---sparticle-launcher-h:sp-group-flag @@ -20519,7 +20552,7 @@ (fov0 float :offset-assert 148) (fov1 float :offset-assert 152) (fov-index cam-index :inline :offset-assert 160) - (tracking cam-rotation-tracker :inline :offset-assert 208) + (tracking cam-rotation-tracker :inline :offset-assert 208 :score 1) (view-off-param float :offset-assert 472) (view-off vector :inline :offset-assert 480) (joystick-saved-view-off vector :inline :offset-assert 496) @@ -20533,7 +20566,7 @@ (circular-follow vector :inline :offset-assert 2256) (max-angle-offset float :offset-assert 2272) (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) ;; TODO - this is likely a cam-slave-options but the size is wrong? + (options cam-slave-options-u32 :offset-assert 2280) (cam-entity entity :offset-assert 2284) ;; guessed by decompiler (butt-timer uint64 :offset-assert 2288) (butt-seek basic :offset-assert 2296) @@ -20597,7 +20630,7 @@ cam-remote)) (deftype camera-master (process) - ((master-options uint32 :offset-assert 128) + ((master-options cam-master-options-u32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) ;; guessed by decompiler (decel (pointer camera-slave) :offset-assert 140) ;; a total guess that is probably wrong! @@ -23836,7 +23869,7 @@ ;; foreground ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; (define-extern foreground-vu0-block object) +(define-extern foreground-vu0-block vu-function) ;; (define-extern *bucket-map* object) ;; (define-extern vu1-bucket-map function) ;; (define-extern generic-bucket-state-init function) @@ -23847,7 +23880,7 @@ (define-extern vu-lights<-light-group! (function vu-lights light-group none)) ;; (define-extern foreground-add-mtx-calc function) (define-extern foreground-wrapup (function none)) -;; (define-extern *default-shadow-settings* object) ;; shadow-settings +(define-extern *default-shadow-settings* shadow-settings) ;; (define-extern foreground-shadow function) ;; (define-extern foreground-generic-merc-death function) ;; (define-extern foreground-generic-merc-add-fragments function) @@ -26764,9 +26797,9 @@ (define-extern cam-curve-setup (function vector none :behavior camera-slave)) (define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector)) (define-extern mat-remove-z-rot (function matrix vector matrix)) -(define-extern slave-matrix-blend-2 (function matrix float vector matrix matrix)) +(define-extern slave-matrix-blend-2 (function matrix cam-slave-options-u32 vector matrix matrix)) (define-extern vector-into-frustum-nosmooth! (function matrix vector float vector)) -(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none)) +(define-extern slave-set-rotation! (function cam-rotation-tracker vector cam-slave-options-u32 float symbol none)) (define-extern v-slrp2! (function vector vector vector float vector float vector)) (define-extern v-slrp3! (function vector vector vector vector float vector)) @@ -27414,7 +27447,7 @@ (define-extern vector<-cspace! (function vector cspace vector)) (define-extern vector<-matrix! (function vector matrix vector)) (define-extern vector<-cspace+vector! (function vector cspace vector vector)) -(define-extern cspace-children (function process-drawable int pair)) ;; +(define-extern cspace-children (function process-drawable int pair)) ;; (define-extern cspace-inspect-tree (function process-drawable cspace int int object process-drawable)) (define-extern execute-math-engine (function int)) (define-extern draw-joint-axes (function process-drawable none)) @@ -27543,7 +27576,6 @@ ;; generic-obs ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -#| (deftype target-start (process-hidden) () :method-count-assert 15 @@ -27553,11 +27585,9 @@ (:methods ) ) -|# (declare-type camera-start basic) (define-extern camera-start type) -#| (deftype camera-start (process-hidden) () :method-count-assert 15 @@ -27567,13 +27597,11 @@ (:methods ) ) -|# -#| (deftype med-res-level (process-drawable) - ((level-name basic :offset-assert 196) - (part-mode basic :offset-assert 200) - (index int32 :offset-assert 204) + ((level-name basic :offset-assert 200) + (part-mode basic :offset-assert 204) + (index int32 :offset-assert 208) ) :method-count-assert 21 :size-assert #xd4 @@ -27582,16 +27610,15 @@ (idle () _type_ :state 20) ) ) -|# -#| (deftype launcher (process-drawable) - ((spring-height meters :offset-assert 196) - (camera state :offset-assert 200) ;; guessed by decompiler - (active-distance float :offset-assert 204) - (seek-time time-frame :offset-assert 212) ;; time-frame - (dest vector :inline :offset-assert 220) - (sound-id sound-id :offset-assert 236) ;; guessed by decompiler + ((root-override collide-shape :offset 128 :score 1) + (spring-height meters :offset-assert 200) + (camera state :offset-assert 204) ;; guessed by decompiler + (active-distance float :offset-assert 208) + (seek-time time-frame :offset-assert 216) ;; time-frame + (dest vector :inline :offset-assert 224) + (sound-id sound-id :offset-assert 240) ;; guessed by decompiler ) :method-count-assert 23 :size-assert #xf4 @@ -27602,31 +27629,30 @@ (deactivated () _type_ :state 22) ) ) -|# -;; (define-extern entity-lookup-part-group function) +(define-extern entity-lookup-part-group (function entity-actor (pointer string) symbol none)) (define-extern clone-anim-once (function handle symbol string none :behavior process-drawable)) (define-extern clone-anim (function handle symbol string none :behavior process-drawable)) -;; (define-extern swingpole-init function) -;; (define-extern manipy-post function) -(define-extern manipy-init (function vector entity-actor skeleton-group vector none :behavior manipy)) ;; (function vector entity-actor skeleton-group vector none :behavior manipy) -(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) -;; (define-extern part-tracker-track-root function) ;; (function sparticle-system sparticle-cpuinfo vector none) -;; (define-extern part-tracker-move-to-target function) ;; (function part-tracker vector) -;; (define-extern part-tracker-track-target function) ;; (function part-tracker vector) -(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none)) +(define-extern swingpole-init (function int object :behavior swingpole)) +(define-extern manipy-post (function none :behavior manipy)) +(define-extern manipy-init (function vector entity-actor skeleton-group vector object none :behavior manipy)) ;; (function vector entity-actor skeleton-group vector none :behavior manipy) +(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process matrix none :behavior part-tracker)) +(define-extern part-tracker-track-root (function sparticle-system sparticle-cpuinfo vector none)) +(define-extern part-tracker-move-to-target (function part-tracker vector)) +(define-extern part-tracker-track-target (function part-tracker vector)) +(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker)) (define-extern process-grab? (function process symbol symbol :behavior process)) (define-extern process-release? (function process symbol :behavior process)) -;; (define-extern camera-look-at function) ;; (function pair uint process :behavior camera-tracker) +(define-extern camera-look-at (function pair uint process)) (define-extern ja-anim-done? (function process symbol)) ;; -;; (define-extern camera-pov-from function) ;; (function pair uint process :behavior camera-tracker) -;; (define-extern cam-launcher-joystick function) ;; (function vector :behavior camera-slave) -;; (define-extern cam-launcher-shortfall state) ;; (state camera-slave) -;; (define-extern cam-launcher-long-joystick function) ;; (function vector :behavior camera-slave) -;; (define-extern cam-launcher-longfall state) ;; (state camera-slave) -;; (define-extern launcher-init-by-other function) ;; (function vector float int float none :behavior launcher) +(define-extern camera-pov-from (function pair uint process)) +(define-extern cam-launcher-joystick (function vector :behavior camera-slave)) +(define-extern cam-launcher-shortfall (state camera-slave)) +(define-extern cam-launcher-long-joystick(function vector :behavior camera-slave)) +(define-extern cam-launcher-longfall (state camera-slave)) +(define-extern launcher-init-by-other (function vector float int float none :behavior launcher)) (define-extern touch-tracker-init (function vector float time-frame none :behavior touch-tracker)) -;; (define-extern explosion-init-by-other function) +(define-extern explosion-init-by-other (function explosion-init-params object :behavior explosion)) (define-extern explosion-spawn (function process-drawable type explosion-init-params none)) (define-extern process-drawable-random-point! (function process-drawable vector vector)) (define-extern process-drawable-pair-random-point! (function process-drawable process-drawable vector float vector)) @@ -28298,12 +28324,12 @@ ;; target-part ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -(define-extern birth-func-copy-target-y-rot (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; +(define-extern birth-func-copy-target-y-rot (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (define-extern birth-func-ground-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) (define-extern birth-func-target-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) (define-extern birth-func-vector-orient (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (function int sparticle-cpuinfo sparticle-launchinfo none) (define-extern birth-func-set-alpha-from-userdata (function int sparticle-cpuinfo sparticle-launchinfo float)) -(define-extern part-tracker-track-target-joint (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; +(define-extern part-tracker-track-target-joint (function int sparticle-cpuinfo sparticle-launchinfo none)) ;; (define-extern process-drawable-burn-effect (function time-frame rgbaf :behavior target)) ;; (define-extern lightning-probe-callback (function lightning-tracker none)) (define-extern process-drawable-shock-effect (function process-drawable lightning-spec (function lightning-tracker none) sparticle-launcher int int float object)) ;; guess @@ -28326,7 +28352,7 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define-extern poly-find-nearest-edge "TODO- Not 100% sure here, but unused" (function nav-poly (inline-array vector) vector vector nav-poly)) -(define-extern target-collision-low-coverage (function control-info collide-query vector (pointer uint32) (pointer int64) (pointer symbol) none)) ;; +(define-extern target-collision-low-coverage (function control-info collide-query vector (pointer uint32) (pointer int64) (pointer symbol) none)) ;; (define-extern target-collision-reaction (function control-info collide-query vector vector collide-status :behavior target)) ;; (function control-info collide-shape-intersect vector vector collide-status) (define-extern target-collision-no-reaction (function control-info collide-query vector vector none)) ;; (function control-info collide-shape-intersect vector vector none) (define-extern *collide-edge-board-spec* collide-edge-spec) diff --git a/decompiler/config/jak2/anonymous_function_types.jsonc b/decompiler/config/jak2/anonymous_function_types.jsonc index 5a850e96ac..4f26c4f853 100644 --- a/decompiler/config/jak2/anonymous_function_types.jsonc +++ b/decompiler/config/jak2/anonymous_function_types.jsonc @@ -463,5 +463,8 @@ [13, "(function none :behavior target)"], [14, "(function none :behavior target)"], [15, "(function none :behavior target)"] + ], + "generic-obs": [ + [9, "(function symbol :behavior touch-tracker)"] ] } diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc index b2f506e399..f7faf5a194 100644 --- a/decompiler/config/jak2/label_types.jsonc +++ b/decompiler/config/jak2/label_types.jsonc @@ -519,5 +519,6 @@ ], "gun-part": [["L192", "(pointer rgba)", 36]], "target-part": [["L452", "uint64", true]], - "target-anim": [["L423", "uint64", true]] + "target-anim": [["L423", "uint64", true]], + "generic-obs": [["L536", "attack-info"], ["L534", "attack-info"]] } diff --git a/decompiler/config/jak2/stack_structures.jsonc b/decompiler/config/jak2/stack_structures.jsonc index b87c6de3df..e8c495a121 100644 --- a/decompiler/config/jak2/stack_structures.jsonc +++ b/decompiler/config/jak2/stack_structures.jsonc @@ -1189,5 +1189,9 @@ "check-shell-level1": [[16, "vector"]], "check-shell-level2": [[16, "vector"]], "birth-func-target-orient": [[48, "vector"]], - "birth-func-vector-orient": [[32, "vector"]] + "birth-func-vector-orient": [[32, "vector"]], + "(enter cam-launcher-longfall)": [[16, "vector"]], + "explosion-init-by-other": [ + [16, "traffic-danger-info"] + ] } diff --git a/decompiler/config/jak2/type_casts.jsonc b/decompiler/config/jak2/type_casts.jsonc index 4c509ec31d..7666abab3d 100644 --- a/decompiler/config/jak2/type_casts.jsonc +++ b/decompiler/config/jak2/type_casts.jsonc @@ -4808,5 +4808,103 @@ "target-edge-grab-anim": [ [54, "v1", "art-joint-anim"], [111, "v1", "art-joint-anim"] + ], + "entity-lookup-part-group": [ + ["_stack_", 16, "res-tag"], + [29, "s3", "basic"] + ], + "(method 22 swingpole)": [ + [53, "v1", "process-drawable"] + ], + "(code active swingpole)": [ + [34, "a0", "process-focusable"] + ], + "swingpole-init": [ + [56, "a0", "swingpole"] + ], + "(event idle manipy)": [ + [61, "v1", "joint"], + [233, "v1", "process-drawable"], + [360, "v1", "vector"], + [368, "v1", "vector"], + [402, "t9", "(function manipy object)"], + [475, "a0", "process-drawable"], + [498, "v1", "process-drawable"], + [507, "a0", "process-drawable"], + [535, "v1", "vector"], + [408, "v1", "float"], + [462, "v1", "float"], + [686, "a0", "float"] + ], + "(trans idle manipy)": [ + [57, "v1", "process-drawable"], + [[64, 73], "a0", "collide-shape"] + ], + "(code idle manipy)": [ + [61, "a1", "process-drawable"], + [82, "gp", "process-drawable"], + [88, "gp", "process-drawable"], + [131, "a0", "process-drawable"], + [193, "a0", "process-drawable"], + [164, "a0", "process"], + [[159, 190], "gp", "handle"] + ], + "manipy-init": [ + [[142, 146], "a0", "collide-shape"], + [214, "v1", "joint"] + ], + "(code active part-tracker)": [ + [[29, 43], "v1", "process-drawable"], + [[103, 117], "v1", "process-drawable"] + ], + "(method 16 lightning-tracker)": [ + [[141, 158], "a0", "process-focusable"], + [174, "a0", "process-drawable"], + [[53, 70], "a0", "process-focusable"], + [82, "a0", "process-focusable"] + ], + "(code active lightning-tracker)": [ + [[71, 81], "v1", "process-drawable"] + ], + "(exit active lightning-tracker)": [ + [4, "v0", "sound-rpc-set-param"] + ], + "ja-anim-done?": [ + [30, "gp", "process-drawable"] + ], + "camera-pov-from": [ + [[4, 41], "gp", "target"], + [21, "v1", "joint"], + [32, "v1", "joint"] + ], + "(event active part-spawner)": [ + [25, "v1", "vector"] + ], + "(exit active launcher)": [ + [2, "v0", "sound-rpc-set-param"] + ], + "(method 11 launcher)": [ + [128, "v0", "vector"] + ], + "launcher-init-by-other": [ + [136, "v0", "vector"] + ], + "(event active touch-tracker)": [ + [71, "a0", "process"], + [98, "t9", "(function touch-tracker object)"] + ], + "(code active touch-tracker)": [ + [22, "a0", "process-drawable"], + [32, "a0", "collide-shape"] + ], + "(event explode explosion)": [ + [13, "v1", "process-drawable"], + [18, "a0", "collide-shape"] + ], + "process-drawable-random-point!": [ + [[29, 34], "s4", "collide-shape"] + ], + "(method 11 part-spawner)": [ + [112, "a3", "vector"] ] } diff --git a/goal_src/jak2/engine/ai/traffic-h.gc b/goal_src/jak2/engine/ai/traffic-h.gc index 1e85951d4d..03a8256107 100644 --- a/goal_src/jak2/engine/ai/traffic-h.gc +++ b/goal_src/jak2/engine/ai/traffic-h.gc @@ -7,6 +7,22 @@ ;; todo: some types, method names. +(defenum traffic-danger-flags + :type uint8 + :bitfield #t + (tdf0 0) + ) + +(defenum traffic-danger-type + :type uint8 + (tdt0 0) + (tdt1 1) + (tdt2 2) + (tdt3 3) + (tdt4 4) + (tdt5 5) + ) + ;; NOTE - for default-menu (define-extern traffic-start (function none)) (define-extern traffic-kill (function none)) @@ -22,14 +38,14 @@ (define *race-vehicle-entity* (the-as object #f)) (deftype traffic-danger-info (structure) - ((sphere sphere :inline :offset-assert 0) - (velocity vector :inline :offset-assert 16) - (handle uint64 :offset-assert 32) - (notify-radius float :offset-assert 40) - (danger-level float :offset-assert 44) - (decay-rate float :offset-assert 48) - (flags uint8 :offset-assert 52) - (danger-type uint8 :offset-assert 53) + ((sphere sphere :inline :offset-assert 0) + (velocity vector :inline :offset-assert 16) + (handle uint64 :offset-assert 32) + (notify-radius float :offset-assert 40) + (danger-level float :offset-assert 44) + (decay-rate float :offset-assert 48) + (flags traffic-danger-flags :offset-assert 52) + (danger-type traffic-danger-type :offset-assert 53) ) :method-count-assert 9 :size-assert #x36 diff --git a/goal_src/jak2/engine/anim/fma-sphere.gc b/goal_src/jak2/engine/anim/fma-sphere.gc index be87910664..131c19711c 100644 --- a/goal_src/jak2/engine/anim/fma-sphere.gc +++ b/goal_src/jak2/engine/anim/fma-sphere.gc @@ -5,8 +5,6 @@ ;; name in dgo: fma-sphere ;; dgos: ENGINE, GAME -;; og:ignore-form:(defbehavior fma-sphere-init-by-other - ;; +++fma-sphere-mode (defenum fma-sphere-mode :type uint32 @@ -191,8 +189,8 @@ (set! (-> self danger notify-radius) (+ 40960.0 (-> self sphere r))) (set! (-> self danger danger-level) 1.0) (set! (-> self danger decay-rate) 0.0) - (set! (-> self danger flags) (the-as uint 1)) - (set! (-> self danger danger-type) (the-as uint 4)) + (set! (-> self danger flags) (traffic-danger-flags tdf0)) + (set! (-> self danger danger-type) (traffic-danger-type tdt4)) ) ) (else diff --git a/goal_src/jak2/engine/camera/cam-combiner.gc b/goal_src/jak2/engine/camera/cam-combiner.gc index 88b9457a0f..91ac48e54f 100644 --- a/goal_src/jak2/engine/camera/cam-combiner.gc +++ b/goal_src/jak2/engine/camera/cam-combiner.gc @@ -17,13 +17,25 @@ (cond ((= (-> self tracking-status) 3) (cam-calc-follow! (-> self tracking) s1-0 #t) - (slave-set-rotation! (-> self tracking) s1-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (slave-set-rotation! + (-> self tracking) + s1-0 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #t + ) (set! sv-144 (-> self tracking)) (set! s1-0 (-> self trans)) ) ((= (-> self tracking-status) 2) (cam-calc-follow! (-> self tracking) s0-0 #t) - (slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (slave-set-rotation! + (-> self tracking) + s0-0 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #t + ) (set! gp-0 (-> self tracking)) (set! s0-0 (-> self trans)) ) @@ -89,9 +101,9 @@ ) (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) (cond - ((logtest? (-> *camera* master-options) 2) - (set! (-> *camera* master-options) (logand -7 (-> *camera* master-options))) - (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) 1)) + ((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) + (logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER)) + (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) (vector-! (-> s2-0 vector 1) s0-0 s1-0) (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) @@ -106,11 +118,11 @@ ) ) ((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0)) - (logxor! (-> *camera* master-options) 4) + (logxor! (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER)) ) ) (set! (-> self flip-control-axis quad) (-> s4-0 quad)) - (when (logtest? (-> *camera* master-options) 4) + (when (logtest? (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER)) (set! f30-0 (- 65536.0 f30-0)) (vector-negate! s4-0 s4-0) ) @@ -126,147 +138,147 @@ ) (defstate cam-combiner-active (camera-combiner) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (local-vars (v0-0 none)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'fast-rot) - (set! v0-0 (the-as none #t)) - (set! (-> self fast-rot) (the-as basic v0-0)) - v0-0 - ) - ((= v1-0 'set-interpolation) - (let ((f0-1 (the float (-> arg3 param 0)))) - (cond - ((>= 0.0 f0-1) - (let ((f0-2 1.0)) - (set! (-> self interp-val) f0-2) - f0-2 - ) - ) - (else - (set! (-> self interp-val) 0.0) - (let ((f0-3 (/ 5.0 f0-1))) - (set! (-> self interp-step) f0-3) - f0-3 - ) - ) - ) - ) - ) - ((= v1-0 'teleport) - (when (nonzero? (-> self tracking-status)) - (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) - ) - ) - ((= v1-0 'stop-tracking) - (set! (-> self tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-0 'start-tracking) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-0 object)) + (the-as + object + (case event-type + (('fast-rot) + (set! v0-0 #t) + (set! (-> self fast-rot) (the-as basic v0-0)) + v0-0 + ) + (('set-interpolation) + (let ((f0-1 (the float (-> event param 0)))) (cond - ((< arg1 1) - (let ((t9-3 format) - (a0-14 0) - (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") - ) - (let ((v1-8 (-> arg3 param 0))) - (rtype-of v1-8) - ) - (t9-3 a0-14 a1-4) - ) - ) - ((not (type? (-> arg3 param 0) camera-slave)) - (let ((t9-5 format) - (a0-16 0) - (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") - (v1-11 (-> arg3 param 0)) - ) - (t9-5 a0-16 a1-6 (rtype-of v1-11)) - ) - ) - ((zero? (-> self tracking-status)) - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-1 (the-as camera-slave (-> arg3 param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-1 options))) - (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) - (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) - (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) - (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) - (let ((gp-2 (-> gp-1 trans))) - (cam-calc-follow! (-> self tracking) gp-2 #f) - (slave-set-rotation! (-> self tracking) gp-2 (the-as float (-> self tracking-options)) (-> self fov) #f) - ) - ) - ) - ) - ) - ((= v1-0 'copy-tracking) - (cond - ((< arg1 1) - (let ((t9-11 format) - (a0-23 0) - (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") - ) - (let ((v1-23 (-> arg3 param 0))) - (rtype-of v1-23) - ) - (t9-11 a0-23 a1-12) - ) - ) - ((not (type? (-> arg3 param 0) camera-slave)) - (let ((t9-13 format) - (a0-25 0) - (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") - (v1-25 (-> arg3 param 0)) - ) - (t9-13 a0-25 a1-14 (rtype-of v1-25)) - ) - ) - ((nonzero? (-> self tracking-status)) - #f + ((>= 0.0 f0-1) + (set! (-> self interp-val) 1.0) ) (else - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-3 (the-as camera-slave (-> arg3 param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-3 options))) - (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) - (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) - (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) - (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) - (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) - (let* ((a2-23 (-> self tracking)) - (a3-7 (-> gp-3 tracking)) - (v1-37 (-> a3-7 inv-mat vector 0 quad)) - (a0-32 (-> a3-7 inv-mat vector 1 quad)) - (a1-17 (-> a3-7 inv-mat vector 2 quad)) - (a3-8 (-> a3-7 inv-mat trans quad)) - ) - (set! (-> a2-23 inv-mat vector 0 quad) v1-37) - (set! (-> a2-23 inv-mat vector 1 quad) a0-32) - (set! (-> a2-23 inv-mat vector 2 quad) a1-17) - (set! (-> a2-23 inv-mat trans quad) a3-8) - ) - (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) - (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) - (set! v0-0 (the-as none (-> self tracking looking-interesting))) - (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) - ) - v0-0 + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) (/ 5.0 f0-1)) ) ) ) - ) + ) + (('teleport) + (when (nonzero? (-> self tracking-status)) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (the-as object (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ) + (('stop-tracking) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (('start-tracking) + (cond + ((< arg1 1) + (let ((t9-3 format) + (a0-14 0) + (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") + ) + (let ((v1-8 (-> event param 0))) + (rtype-of v1-8) + ) + (t9-3 a0-14 a1-4) + ) + ) + ((not (type? (-> event param 0) camera-slave)) + (let ((t9-5 format) + (a0-16 0) + (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-11 (-> event param 0)) + ) + (t9-5 a0-16 a1-6 (rtype-of v1-11)) + ) + ) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as camera-slave (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-1 options))) + (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) + (let ((gp-2 (-> gp-1 trans))) + (cam-calc-follow! (-> self tracking) gp-2 #f) + (the-as object (slave-set-rotation! + (-> self tracking) + gp-2 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ) + ) + ) + ) + (('copy-tracking) + (cond + ((< arg1 1) + (let ((t9-11 format) + (a0-23 0) + (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") + ) + (let ((v1-23 (-> event param 0))) + (rtype-of v1-23) + ) + (t9-11 a0-23 a1-12) + ) + ) + ((not (type? (-> event param 0) camera-slave)) + (let ((t9-13 format) + (a0-25 0) + (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> event param 0)) + ) + (t9-13 a0-25 a1-14 (rtype-of v1-25)) + ) + ) + ((nonzero? (-> self tracking-status)) + #f + ) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-23 (-> self tracking)) + (a3-7 (-> gp-3 tracking)) + (v1-37 (-> a3-7 inv-mat vector 0 quad)) + (a0-32 (-> a3-7 inv-mat vector 1 quad)) + (a1-17 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> a2-23 inv-mat vector 0 quad) v1-37) + (set! (-> a2-23 inv-mat vector 1 quad) a0-32) + (set! (-> a2-23 inv-mat vector 2 quad) a1-17) + (set! (-> a2-23 inv-mat trans quad) a3-8) + ) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) + (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) + (set! v0-0 (-> self tracking looking-interesting)) + (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) + ) + v0-0 + ) + ) + ) ) ) ) @@ -294,7 +306,9 @@ ) 0 ) - (when (and (zero? (logand (-> *camera* master-options) 1)) (!= (-> self tracking-status) 0)) + (when (and (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (!= (-> self tracking-status) 0) + ) (set! (-> self tracking-status) (the-as uint 0)) 0 ) @@ -318,7 +332,7 @@ (slave-set-rotation! (-> self tracking) (-> self trans) - (the-as float (-> self tracking-options)) + (the-as cam-slave-options-u32 (-> self tracking-options)) (-> self fov) (not (-> self fast-rot)) ) @@ -371,7 +385,7 @@ (slave-set-rotation! (-> self tracking) (-> self trans) - (the-as float (-> self tracking-options)) + (the-as cam-slave-options-u32 (-> self tracking-options)) (-> self fov) (not (-> self fast-rot)) ) @@ -475,7 +489,3 @@ 0 (none) ) - - - - diff --git a/goal_src/jak2/engine/camera/cam-debug.gc b/goal_src/jak2/engine/camera/cam-debug.gc index b053d3f4c6..ad9ca7c847 100644 --- a/goal_src/jak2/engine/camera/cam-debug.gc +++ b/goal_src/jak2/engine/camera/cam-debug.gc @@ -172,10 +172,12 @@ ) ) +;; WARN: Failed store: (s.w! (+ a0-2 8) 0) at op 78 +;; WARN: Failed store: (s.w! (+ a0-2 12) 0) at op 79 (defun cam-line-dma () - (let* ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) - (a2-0 (-> v1-5 base)) - ) + (with-dma-buffer-add-bucket ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) + (bucket-id debug-no-zbuf1) + ) (let ((a0-1 (the-as object (-> v1-5 base)))) (let* ((a1-0 v1-5) (a3-0 (the-as object (-> a1-0 base))) @@ -232,20 +234,6 @@ ) ) ) - (let ((a3-16 (-> v1-5 base))) - (let ((a0-2 (the-as object (-> v1-5 base)))) - (set! (-> (the-as dma-packet a0-2) dma) (new 'static 'dma-tag :id (dma-tag-id next))) - (set! (-> (the-as dma-packet a0-2) vif0) (new 'static 'vif-tag)) - (set! (-> (the-as dma-packet a0-2) vif1) (new 'static 'vif-tag)) - (set! (-> v1-5 base) (&+ (the-as pointer a0-2) 16)) - ) - (dma-bucket-insert-tag - (-> *display* frames (-> *display* on-screen) bucket-group) - (bucket-id debug-no-zbuf1) - a2-0 - (the-as (pointer dma-tag) a3-16) - ) - ) ) ) diff --git a/goal_src/jak2/engine/camera/cam-master.gc b/goal_src/jak2/engine/camera/cam-master.gc index 9ef9415244..078a74a514 100644 --- a/goal_src/jak2/engine/camera/cam-master.gc +++ b/goal_src/jak2/engine/camera/cam-master.gc @@ -89,12 +89,12 @@ (cond ((and *target* (not gp-0)) (try-update-focus (-> self focus) *target*) - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (reset-target-tracking) ) - ((and (logtest? (-> self master-options) 1) (not gp-0)) - (let ((v0-1 (the-as object (logand -2 (-> self master-options))))) - (set! (-> self master-options) (the-as uint v0-1)) + ((and (logtest? (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (not gp-0)) + (let ((v0-1 (the-as object (logclear (-> self master-options) (cam-master-options-u32 HAVE_TARGET))))) + (set! (-> self master-options) (the-as cam-master-options-u32 v0-1)) v0-1 ) ) @@ -102,7 +102,7 @@ #f ) (gp-0 - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (cond ((>= (- (-> self clock frame-counter) (process-focusable-method-25 (the-as target gp-0))) (-> *CAMERA-bank* attack-timeout) @@ -137,14 +137,14 @@ ((< (-> self ease-t) 1.0) (new 'stack-no-clear 'vector) (cond - ((logtest? (-> self master-options) 8) + ((logtest? (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) (vector-lerp! (-> self tpos-curr) (-> self ease-from) (-> self ease-to) (parameter-ease-sin-clamp (-> self ease-t)) ) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) (else (vector-lerp! @@ -312,7 +312,7 @@ (defun setup-slave-for-hopefull ((arg0 camera-slave)) (when (= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) (cam-calc-follow! (-> arg0 tracking) (-> arg0 trans) #f) - (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (the-as float (-> arg0 options)) (-> arg0 fov) #f) + (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (-> arg0 options) (-> arg0 fov) #f) ) (none) ) @@ -326,8 +326,8 @@ #t ) (else - (< (vector-dot (the-as vector (&-> arg0 stack 112)) (-> *camera-combiner* inv-camera-rot vector 2)) - (vector-dot (the-as vector (&-> arg1 stack 112)) (-> *camera-combiner* inv-camera-rot vector 2)) + (< (vector-dot (-> arg0 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) + (vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) ) ) ) @@ -584,7 +584,7 @@ (defstate cam-master-active (camera-master) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none) (v1-125 uint)) + (local-vars (v0-0 object) (v1-125 uint)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((v1-0 event-type)) @@ -656,7 +656,7 @@ (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-2 (new 'static 'vector :y -1.0)) ) (send-event self 'teleport) - (cam-master-activate-slave #f) + (the-as object (cam-master-activate-slave #f)) ) ((= v1-0 'teleport-to-vector-start-string) (when (> arg1 0) @@ -673,7 +673,7 @@ (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-3 (new 'static 'vector :y -1.0)) ) (send-event self 'teleport) - (cam-master-activate-slave #f) + (the-as object (cam-master-activate-slave #f)) ) ) ((= v1-0 'change-target) @@ -681,11 +681,11 @@ (cond ((not a1-15) (clear-focused (-> self focus)) - (set! (-> self master-options) (logand -2 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) ) (else (try-update-focus (-> self focus) (the-as process-focusable a1-15)) - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (reset-target-tracking) ) ) @@ -716,7 +716,7 @@ ) (when (and s5-1 (!= s5-1 gp-4)) (set! (-> self slave) (the-as (pointer camera-slave) s5-1)) - (logior! (-> self master-options) 2) + (logior! (-> self master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) (set! (-> *camera-combiner* tracking tilt-adjust target) (-> self slave 0 tracking tilt-adjust target)) (cond ((or (zero? s4-0) (not gp-4)) @@ -807,7 +807,7 @@ ) ) (if gp-4 - (deactivate (-> gp-4 0)) + (the-as object (deactivate (-> gp-4 0))) ) ) ) @@ -816,24 +816,24 @@ (cond ((< arg1 1) (set! (-> self ease-t) 0.0) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) ((< arg1 2) (if (< (the-as float (-> event param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> event param 0))) ) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) (else (if (< (the-as float (-> event param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> event param 0))) ) (set! (-> self ease-to quad) (-> (the-as vector (-> event param 1)) quad)) - (logior! (-> self master-options) 8) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) ) (set! (-> self ease-step) 0.033333335) - (set! v0-0 (the-as none (-> self ease-from))) + (set! v0-0 (-> self ease-from)) (set! (-> (the-as vector v0-0) quad) (-> self tpos-curr-adj quad)) v0-0 ) @@ -853,11 +853,11 @@ ((= v1-0 'toggle-slave-option) (logxor! (-> self slave-options) (-> event param 0)) (if (-> self slave) - (logxor! (-> self slave 0 options) (-> event param 0)) + (logxor! (-> self slave 0 options) (the-as uint (-> event param 0))) ) (when (-> self decel) - (set! v0-0 (the-as none (logxor (-> self decel 0 options) (-> event param 0)))) - (set! (-> self decel 0 options) (the-as uint v0-0)) + (set! v0-0 (logxor (-> self decel 0 options) (the-as uint (-> event param 0)))) + (set! (-> self decel 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) @@ -866,15 +866,15 @@ ) ((= v1-0 'set-slave-option) (when (-> self slave) - (set! v0-0 (the-as none (logior (-> self slave 0 options) (-> event param 0)))) - (set! (-> self slave 0 options) (the-as uint v0-0)) + (set! v0-0 (logior (-> self slave 0 options) (-> event param 0))) + (set! (-> self slave 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) ((= v1-0 'clear-slave-option) (when (-> self slave) - (set! v0-0 (the-as none (logclear (-> self slave 0 options) (-> event param 0)))) - (set! (-> self slave 0 options) (the-as uint v0-0)) + (set! v0-0 (logclear (-> self slave 0 options) (-> event param 0))) + (set! (-> self slave 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) @@ -884,7 +884,7 @@ (vector-reset! (-> self slave 0 tracking follow-off)) ) (set! (-> *camera-combiner* tracking no-follow) (the-as basic #t)) - (set! v0-0 (the-as none (-> *camera-combiner* tracking follow-off))) + (set! v0-0 (-> *camera-combiner* tracking follow-off)) (.svf (&-> (the-as vector v0-0) quad) vf0) v0-0 ) @@ -1046,7 +1046,7 @@ (defbehavior cam-master-init camera-master () (stack-size-set! (-> self main-thread) 512) (logclear! (-> self mask) (process-mask menu)) - (set! (-> self master-options) (the-as uint 0)) + (set! (-> self master-options) (cam-master-options-u32)) (set! (-> self settings) (-> *setting-control* cam-current)) (set! (-> self slave) (the-as (pointer camera-slave) #f)) (set! (-> self decel) (the-as (pointer camera-slave) #f)) diff --git a/goal_src/jak2/engine/camera/cam-states-dbg.gc b/goal_src/jak2/engine/camera/cam-states-dbg.gc index efff37449d..70d75991e8 100644 --- a/goal_src/jak2/engine/camera/cam-states-dbg.gc +++ b/goal_src/jak2/engine/camera/cam-states-dbg.gc @@ -20,11 +20,11 @@ (define *CAM_POINT_WATCH-bank* (new 'static 'cam-point-watch-bank :speed 1600.0 :rot-speed (degrees 0.6))) (defstate cam-point-watch (camera-slave) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler arg0 arg1 arg2 arg3) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -42,7 +42,7 @@ (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) ) - (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((f28-0 (analog-input (the-as int (-> *cpad-list* cpads 0 leftx)) 128.0 48.0 110.0 -1.0)) (f30-0 (analog-input (the-as int (-> *cpad-list* cpads 0 lefty)) 128.0 48.0 110.0 -1.0)) (f26-0 (analog-input (the-as int (-> *cpad-list* cpads 0 rightx)) 128.0 48.0 110.0 -1.0)) @@ -66,7 +66,7 @@ (let ((s4-0 (new-stack-vector0))) (let ((s3-0 (new-stack-matrix0))) (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) - (vector-matrix*! s4-0 (the-as vector (&-> self stack 112)) s3-0) + (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) (vector-matrix*! s4-0 s4-0 s3-0) ) @@ -126,18 +126,12 @@ (+! (-> arg1 y) f26-0) (+! (-> arg1 z) f22-0) (+! (-> arg0 x) f24-0) - (let ((f0-13 (+ (-> arg0 y) f0-12))) - (set! (-> arg0 y) f0-13) - f0-13 - ) + (set! (-> arg0 y) (+ (-> arg0 y) f0-12)) ) ) (else (+! (-> arg0 y) (* (- (-> v1-0 x)) (-> *CAM_FREE-bank* rot-speed))) - (let ((f0-17 (+ (-> arg0 x) (* (-> v1-0 y) (-> *CAM_FREE-bank* rot-speed))))) - (set! (-> arg0 x) f0-17) - f0-17 - ) + (set! (-> arg0 x) (+ (-> arg0 x) (* (-> v1-0 y) (-> *CAM_FREE-bank* rot-speed)))) ) ) ) @@ -145,17 +139,11 @@ ) ((logtest? (-> *mouse* button0-abs 0) 2) (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (let ((f0-21 (+ (-> arg1 z) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) - (set! (-> arg1 z) f0-21) - f0-21 - ) + (set! (-> arg1 z) (+ (-> arg1 z) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))) ) ((logtest? (-> *mouse* button0-abs 0) 4) (+! (-> arg1 x) (* (-> v1-0 x) (-> *CAM_FREE-bank* speed))) - (let ((f0-25 (+ (-> arg1 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed))))) - (set! (-> arg1 y) f0-25) - f0-25 - ) + (set! (-> arg1 y) (+ (-> arg1 y) (* (-> v1-0 y) (-> *CAM_FREE-bank* speed)))) ) ) ) @@ -356,7 +344,7 @@ ) ) ) - (when (zero? (logand (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) (let ((f28-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 leftx)) 128.0 48.0 110.0 -1.0)) (f30-14 (analog-input (the-as int (-> *cpad-list* cpads arg3 lefty)) 128.0 48.0 110.0 -1.0)) (f26-0 (analog-input (the-as int (-> *cpad-list* cpads arg3 rightx)) 128.0 48.0 110.0 -1.0)) @@ -448,11 +436,11 @@ ) (defstate cam-free-floating (camera-slave) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler arg0 arg1 arg2 arg3) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -468,7 +456,7 @@ :code (behavior () (until #f (let ((a2-0 (-> *camera* local-down))) - (if (logtest? (-> self options) 8) + (if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT)) (set! a2-0 (the-as vector #f)) ) (cam-free-floating-move @@ -484,7 +472,3 @@ (none) ) ) - - - - diff --git a/goal_src/jak2/engine/camera/cam-states.gc b/goal_src/jak2/engine/camera/cam-states.gc index 044f5e0e38..de9bc1b42c 100644 --- a/goal_src/jak2/engine/camera/cam-states.gc +++ b/goal_src/jak2/engine/camera/cam-states.gc @@ -14,7 +14,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -42,7 +42,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -80,7 +80,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -118,7 +118,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -183,7 +183,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -259,8 +259,8 @@ ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) (set! (-> self trans quad) (-> s2-0 quad)) (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) - (set! (-> (the-as vector (&-> self stack 96)) quad) (-> s0-0 vector 1 quad)) - (vector-negate! (the-as vector (&-> self stack 112)) (-> s0-0 vector 2)) + (set! (-> (the-as vector (-> self tracking inv-mat vector 1)) quad) (-> s0-0 vector 1 quad)) + (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) (vector-reset! (-> self tracking inv-mat trans)) @@ -300,7 +300,9 @@ (none) ) :trans (behavior () - (if (or (not (handle->process (-> *camera* settings pov-handle))) (zero? (logand (-> *camera* master-options) 1))) + (if (or (not (handle->process (-> *camera* settings pov-handle))) + (zero? (logand (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + ) (cam-slave-go cam-free-floating) ) (none) @@ -375,7 +377,7 @@ (cam-standoff-calc-trans) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as vector (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -385,7 +387,7 @@ (when (not (-> self enter-has-run)) (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) 0 @@ -400,7 +402,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -438,7 +440,7 @@ (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x4000) + (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) @@ -484,7 +486,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -506,7 +508,7 @@ ) :exit (behavior () (if (and *target* - (logtest? (-> *camera* master-options) 1) + (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)) (logtest? (-> *target* focus-status) (focus-status in-head)) ) (send-event *target* 'end-mode) @@ -514,7 +516,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (go cam-free-floating) ) (none) @@ -576,16 +578,16 @@ ) (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) - (when (not (logtest? (-> self options) 8)) - (if (< (vector-dot (the-as vector (&-> self stack 96)) (-> *camera* local-down)) 0.0) + (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) + (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) (forward-down->inv-matrix (the-as matrix (-> self tracking)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) ) (forward-down->inv-matrix (the-as matrix (-> self tracking)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) (vector-negate! (new-stack-vector0) (-> *camera* local-down)) ) ) @@ -593,34 +595,34 @@ (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) ) - (when (not (logtest? (-> self options) 8)) - (let ((f30-1 (vector-dot (-> *camera* local-down) (the-as vector (&-> self stack 112))))) + (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) + (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) (vector--float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) f30-1 ) - (vector-normalize! (the-as vector (&-> self stack 112)) (cos (-> *CAM_EYE-bank* max-degrees))) + (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_EYE-bank* max-degrees))) (if (< f30-1 0.0) (vector--float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) (sin (-> *CAM_EYE-bank* max-degrees)) ) (vector+float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) (sin (-> *CAM_EYE-bank* max-degrees)) ) ) (vector-cross! - (the-as vector (&-> self stack 96)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) (the-as vector (-> self tracking)) ) (set! (-> self tracking inv-mat vector 1 w) 0.0) @@ -655,7 +657,7 @@ (let ((gp-0 (new-stack-vector0))) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x4000) + (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) @@ -702,7 +704,7 @@ ) (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) 0 @@ -720,7 +722,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -745,7 +747,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -799,7 +801,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -931,7 +933,7 @@ ) (vector-matrix*! arg0 arg1 s4-0) ) - ((and (logtest? (-> self options) 2) + ((and (logtest? (-> self options) (cam-slave-options-u32 SAME_SIDE)) (or (and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad)))) (and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0)) ) @@ -949,7 +951,7 @@ ) (else (set! (-> arg0 quad) (-> arg1 quad)) - (if (logtest? (-> self options) 2048) + (if (logtest? (-> self options) (cam-slave-options-u32 SHRINK_MAX_ANGLE)) (set! (-> self max-angle-curr) f28-0) ) ) @@ -961,17 +963,17 @@ (defbehavior cam-circular-position camera-slave ((arg0 symbol)) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) - (if (logtest? (-> self options) 130) + (if (logtest? (-> self options) (cam-slave-options-u32 SAME_SIDE DRAG)) (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow)) ) (vector-! s5-0 (-> self trans) (-> self pivot-pt)) - (when (not (logtest? (-> self options) 4)) + (when (not (logtest? (-> self options) (cam-slave-options-u32 MOVE_SPHERICAL))) (vector-flatten! gp-0 gp-0 (-> *camera* local-down)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) ) (cond - ((logtest? (-> self options) 128) + ((logtest? (-> self options) (cam-slave-options-u32 DRAG)) (let ((f30-0 (- (vector-length gp-0) (-> self pivot-rad)))) (when (< 0.0001 (-> *camera-combiner* tracking point-of-interest-blend value)) (let ((s5-1 (new 'stack-no-clear 'vector)) @@ -1024,7 +1026,7 @@ (let ((a2-1 (new-stack-vector0))) (vector-! a2-1 (-> *camera* tpos-curr-adj) (-> self pivot-pt)) (vector-! (-> self circular-follow) (-> self circular-follow) (-> self pivot-pt)) - (if (logtest? (-> self options) 4) + (if (logtest? (-> self options) (cam-slave-options-u32 MOVE_SPHERICAL)) (v-slrp3! (-> self circular-follow) (-> self circular-follow) @@ -1059,14 +1061,14 @@ (let ((v1-0 event-type)) (the-as object (cond ((= v1-0 'teleport) - #f + (the-as vector #f) ) ((= v1-0 'outro-done) (set! (-> self trans quad) (-> *camera-combiner* trans quad)) (cam-circular-position #f) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as vector (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -1141,7 +1143,7 @@ ) ) ) - ((logtest? (-> self options) 128) + ((logtest? (-> self options) (cam-slave-options-u32 DRAG)) (vector-! (-> self pivot-pt) (-> *camera* tpos-curr-adj) (-> self trans)) (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) @@ -1160,7 +1162,7 @@ ) (cam-circular-position #f) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) @@ -1175,7 +1177,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -1205,7 +1207,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -1282,7 +1284,7 @@ #f ) -;; WARN: Return type mismatch uint vs cam-slave-options. +;; WARN: Return type mismatch cam-slave-options-u32 vs cam-slave-options. (defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) (set! (-> self min-z-override) (vector-length (-> self view-flat))) @@ -1290,7 +1292,7 @@ (set! (-> self string-trans quad) (-> self desired-pos quad)) (tracking-spline-method-10 (-> self position-spline) (-> self desired-pos)) (vector-reset! (-> self velocity)) - (let ((v0-2 (logand -4097 (-> self options)))) + (let ((v0-2 (logclear (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)))) (set! (-> self options) v0-2) (the-as cam-slave-options v0-2) ) @@ -1925,7 +1927,7 @@ (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self good-point quad) (-> *camera* target-spline point (-> *camera* target-spline used-point) position quad) ) @@ -2006,7 +2008,7 @@ (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self good-point quad) (-> *camera* target-spline point s2-2 position quad)) (set! (-> self los-last-pos quad) (-> self good-point quad)) (when *debug-segment* @@ -2105,7 +2107,7 @@ (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) ) ) ) @@ -2127,7 +2129,7 @@ (cam-los-setup-lateral arg2 s4-1 arg1) ) (cond - ((not (logtest? (-> self options) 1024)) + ((not (logtest? (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED))) ) ((= (-> self string-vel-dir) 5) ) @@ -2174,7 +2176,7 @@ (defbehavior cam-string-follow camera-slave () (let ((f30-0 (vector-length (-> self view-flat)))) (cond - ((logtest? (-> self options) #x8000) + ((logtest? (-> self options) (cam-slave-options-u32 STICKY_ANGLE)) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) @@ -2306,7 +2308,7 @@ ) (defbehavior cam-string-joystick camera-slave () - (set! (-> self options) (logand -257 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (when (-> self string-relative) (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) @@ -2344,7 +2346,7 @@ ) (f30-1 (-> self view-off-param)) ) - (if (logtest? #x10000 (-> self options)) + (if (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) (set! f28-0 0.0) ) (if (-> self have-phony-joystick) @@ -2355,7 +2357,7 @@ ) (set! f28-0 0.05) ) - (when (logtest? #x40000 (-> self options)) + (when (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (if (and (or (< (-> *cpad-list* cpads 0 rightx) (the-as uint 64)) (< (the-as uint 192) (-> *cpad-list* cpads 0 rightx)) ) @@ -2367,7 +2369,7 @@ ) ) (if (!= f28-0 0.0) - (logior! (-> self options) 256) + (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) ) (let ((f26-0 (fmin 1.0 f0-22))) (let ((f0-23 f26-0)) @@ -2409,7 +2411,7 @@ (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) ) ) - ((and (logtest? #x40000 (-> self options)) (< 0.0 f28-0)) + ((and (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (< 0.0 f28-0)) (set! (-> self string-min-val y) (fmax (-> *camera* settings gun-min-height) (- (-> self string-min-val y) (* 24576.0 f28-0))) ) @@ -2420,7 +2422,7 @@ ) ) ) - ((and (logtest? #x40000 (-> self options)) (< f28-0 0.0)) + ((and (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (< f28-0 0.0)) (set! (-> self string-max-val y) (fmin (-> *camera* settings gun-max-height) (- (-> self string-max-val y) (* 24576.0 f28-0))) ) @@ -2431,7 +2433,7 @@ ) ) ) - ((logtest? #x40000 (-> self options)) + ((logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (set! (-> self string-max-val y) (fmax (+ 8192.0 (-> *camera* settings gun-min-height)) @@ -2468,7 +2470,7 @@ ) ) (cond - ((logtest? #x40000 (-> self options)) + ((logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) ) ((= f28-0 0.0) (set! (-> self view-off z) (-> self string-max-val z)) @@ -2489,10 +2491,12 @@ 128.0 32.0 110.0 - (* 182.04445 (-> self clock seconds-per-frame) (if (logtest? #x40000 (-> self options)) - 120.0 - 120.0 - ) + (* 182.04445 + (-> self clock seconds-per-frame) + (if (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) + 120.0 + 120.0 + ) ) ) ) @@ -2500,7 +2504,7 @@ (gp-3 (new-stack-vector0)) (s5-3 (new-stack-vector0)) ) - (if (logtest? #x10000 (-> self options)) + (if (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) (set! f30-2 0.0) ) (if (-> *setting-control* user-default unknowng-symbol-00) @@ -2509,7 +2513,7 @@ (if (-> self have-phony-joystick) (set! f30-2 (* 21845.334 (-> self phony-joystick-x) (-> self clock seconds-per-frame))) ) - (when (logtest? #x20000 (-> self options)) + (when (logtest? (cam-slave-options-u32 ALLOW_SHIFT_BUTTONS) (-> self options)) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? (-> *CAMERA-bank* joypad) r1) (+! f30-2 (+ (* 10922.667 (-> self clock seconds-per-frame)) @@ -2560,27 +2564,28 @@ ) (cond ((!= f30-2 0.0) - (logior! (-> self options) 256) + (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (matrix-axis-angle! s4-0 (-> *camera* local-down) f30-2) (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) (set! (-> self butt-timer) (the-as uint 0)) (set! (-> self butt-seek) #f) - (when (logtest? #x800000 (-> self options)) + (when (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) ) - ((or (logtest? (-> self options) 1) (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) - (if (type? s3-0 process-drawable) - s3-0 - ) - ) + ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) + (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) + (if (type? s3-0 process-drawable) + s3-0 + ) + ) ) (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) (let ((v1-283 (handle->process (-> *camera* settings butt-handle)))) (cond (v1-283 - (set! (-> self options) (logior #x800000 (-> self options))) + (set! (-> self options) (logior (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options))) (let* ((s3-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> (the-as process-drawable v1-283) root quat))) (a2-18 (matrix-axis-angle! (new 'stack-no-clear 'matrix) @@ -2602,15 +2607,17 @@ ) ) (vector-normalize! s5-3 -1.0) - (when (and (logtest? #x800000 (-> self options)) (< (cos 910.2222) (vector-dot gp-3 s5-3))) + (when (and (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) + (< (cos 910.2222) (vector-dot gp-3 s5-3)) + ) (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) (matrix-from-two-vectors-max-angle! s4-0 gp-3 s5-3 546.13336) (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) ) (else - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) ) (when (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) @@ -2762,7 +2769,7 @@ ) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) (let ((s2-0 s5-1)) (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -2806,13 +2813,13 @@ ) (cond ((zero? gp-1) - (set! (-> self options) (logand -1025 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED)) (if *display-cam-los-debug* (format *stdcon* "not blocked~%") ) ) (else - (logior! (-> self options) 1024) + (logior! (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED)) (if *display-cam-los-debug* (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) ) @@ -2851,7 +2858,7 @@ (cam-debug-reset-coll-tri) ) (cam-string-follow) - (if (logtest? (-> self options) 512) + (if (logtest? (-> self options) (cam-slave-options-u32 LINE_OF_SIGHT)) (cam-string-line-of-sight) ) (if (not (paused?)) @@ -2867,18 +2874,18 @@ (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0) ) (set! (-> self desired-pos y) (fmin (-> self desired-pos y) (-> *camera* settings string-camera-ceiling))) - (if (logtest? (-> self options) 64) + (if (logtest? (-> self options) (cam-slave-options-u32 FIND_HIDDEN_TARGET)) (cam-string-find-hidden) ) (cond - ((logtest? (-> self options) 4096) + ((logtest? (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (when *debug-segment* (let ((a1-1 (new 'stack-no-clear 'vector))) (vector-! a1-1 (-> self good-point) (-> self string-trans)) (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self) ) ) - (set! (-> self options) (logand -4097 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self desired-pos quad) (-> self good-point quad)) (cam-string-move) (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) @@ -2911,14 +2918,14 @@ (tracking-spline-method-21 (-> self position-spline) (-> self trans) 4096.0 40960.0 0.1) ) ((and (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) - (logtest? (-> self options) 256) + (logtest? (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) ) (tracking-spline-method-21 (-> self position-spline) (-> self trans) 102.4 4096.0 0.1) ) ((logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) (tracking-spline-method-21 (-> self position-spline) (-> self trans) 40.96 4096.0 0.1) ) - ((logtest? (-> self options) 256) + ((logtest? (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (tracking-spline-method-21 (-> self position-spline) (-> self trans) @@ -2944,7 +2951,7 @@ ) (defbehavior set-string-params camera-slave () - (when (not (or (-> self string-val-locked) (logtest? #x40000 (-> self options)))) + (when (not (or (-> self string-val-locked) (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)))) (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) (let ((v0-0 (-> self string-max-val))) (set! (-> v0-0 quad) (-> *camera* string-max value quad)) @@ -2955,7 +2962,7 @@ (defstate cam-string (camera-slave) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none)) + (local-vars (v0-0 object)) (let ((v1-0 event-type)) (the-as object @@ -2963,7 +2970,7 @@ ((= v1-0 'get-behind) (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) (set! (-> self butt-seek) (the-as basic #t)) - (set! v0-0 (the-as none (-> self butt-vector))) + (set! v0-0 (-> self butt-vector)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) v0-0 ) @@ -2976,7 +2983,7 @@ ((= v1-0 'joystick) (set! (-> self phony-joystick-x) (the-as float (-> event param 0))) (set! (-> self phony-joystick-y) (the-as float (-> event param 1))) - (set! v0-0 (the-as none #t)) + (set! v0-0 #t) (set! (-> self have-phony-joystick) (the-as basic v0-0)) v0-0 ) @@ -3047,7 +3054,7 @@ ((-> event param 0) (set! (-> self string-val-locked) (the-as basic #t)) (set! (-> self string-relative) (the-as basic #t)) - (set! v0-0 (the-as none (-> self relative-position))) + (set! v0-0 (-> self relative-position)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) v0-0 ) @@ -3065,7 +3072,7 @@ (-> self los-state) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as object (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -3113,7 +3120,7 @@ (vector-length (-> self view-flat)) ) (else - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (-> self view-off z) ) @@ -3228,7 +3235,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -3298,7 +3305,7 @@ (vector-float*! s5-0 (-> self velocity) f30-0) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> gp-2 start-pos quad) (-> self trans quad)) (let ((s1-0 gp-2)) (set! (-> s1-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -3363,7 +3370,7 @@ ) ) ) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #t) (none) ) @@ -3383,7 +3390,7 @@ (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) ) (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) @@ -3392,12 +3399,12 @@ (vector-reset! (-> self velocity)) (set! (-> self blend-from-type) (the-as uint 2)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (when (not (paused?)) @@ -3441,7 +3448,7 @@ (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) ) - ((logtest? (-> self options) 1) + ((logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) (set-vector! s5-0 0.0 0.0 1.0 1.0) (vector-normalize-copy! s5-0 (-> self view-flat) 1.0) (set! (-> s3-0 quad) (-> (the-as vector (&-> *camera* stack 256)) quad)) @@ -3562,7 +3569,7 @@ (vector-float*! s5-3 (-> self velocity) f30-1) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> gp-3 start-pos quad) (-> self trans quad)) (let ((s3-2 gp-3)) (set! (-> s3-2 radius) 4096.0) @@ -3601,7 +3608,7 @@ ) ) (cam-calc-bike-follow! (-> self tracking) (-> self trans) #t) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #t) (none) ) @@ -3617,7 +3624,7 @@ (set! (-> self view-off x) 0.0) (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) @@ -3627,7 +3634,7 @@ (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) (none) ) @@ -3637,7 +3644,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) diff --git a/goal_src/jak2/engine/camera/camera-h.gc b/goal_src/jak2/engine/camera/camera-h.gc index 4e1e6485f5..013e4c009c 100644 --- a/goal_src/jak2/engine/camera/camera-h.gc +++ b/goal_src/jak2/engine/camera/camera-h.gc @@ -42,7 +42,7 @@ ;; NOTE - for camera (declare-type cam-rotation-tracker structure) (define-extern cam-calc-follow! (function cam-rotation-tracker vector symbol vector)) -(define-extern slave-set-rotation! (function cam-rotation-tracker vector float float symbol none)) +(define-extern slave-set-rotation! (function cam-rotation-tracker vector cam-slave-options-u32 float symbol none)) ;; NOTE - for cam-start (declare-type camera-master process) @@ -320,61 +320,61 @@ (deftype camera-slave (process) - ((trans vector :inline :offset-assert 128) - (fov float :offset-assert 144) - (fov0 float :offset-assert 148) - (fov1 float :offset-assert 152) - (fov-index cam-index :inline :offset-assert 160) - (tracking cam-rotation-tracker :inline :offset-assert 208) - (view-off-param float :offset-assert 472) - (view-off vector :inline :offset-assert 480) - (joystick-saved-view-off vector :inline :offset-assert 496) - (min-z-override float :offset-assert 512) - (view-flat vector :inline :offset-assert 528) - (string-vel-dir uint32 :offset-assert 544) - (string-trans vector :inline :offset-assert 560) - (position-spline tracking-spline :inline :offset-assert 576) - (pivot-pt vector :inline :offset-assert 2224) - (pivot-rad float :offset-assert 2240) - (circular-follow vector :inline :offset-assert 2256) - (max-angle-offset float :offset-assert 2272) - (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) - (cam-entity entity :offset-assert 2284) - (butt-timer uint64 :offset-assert 2288) - (butt-seek basic :offset-assert 2296) - (butt-vector vector :inline :offset-assert 2304) - (velocity vector :inline :offset-assert 2320) - (desired-pos vector :inline :offset-assert 2336) - (time-dist-too-far uint32 :offset-assert 2352) - (los-state slave-los-state :offset-assert 2356) - (good-point vector :inline :offset-assert 2368) - (los-tgt-spline-pt int32 :offset-assert 2384) - (los-tgt-spline-pt-incarnation int32 :offset-assert 2388) - (los-last-pos vector :inline :offset-assert 2400) - (intro-curve curve :inline :offset-assert 2416) - (intro-offset vector :inline :offset-assert 2448) - (intro-t float :offset-assert 2464) - (intro-t-step float :offset-assert 2468) - (outro-exit-value float :offset-assert 2472) - (spline-exists basic :offset-assert 2476) - (spline-curve curve :inline :offset-assert 2480) - (spline-offset vector :inline :offset-assert 2512) - (index cam-index :inline :offset-assert 2528) - (saved-pt vector :inline :offset-assert 2576) - (spline-tt float :offset-assert 2592) - (spline-follow-dist float :offset-assert 2596) - (enter-has-run symbol :offset-assert 2600) - (blend-from-type uint64 :offset-assert 2608) - (blend-to-type camera-blend-to-type :offset-assert 2616) - (have-phony-joystick basic :offset-assert 2624) - (phony-joystick-x float :offset-assert 2628) - (phony-joystick-y float :offset-assert 2632) - (string-min-val vector :inline :offset-assert 2640) - (string-max-val vector :inline :offset-assert 2656) - (string-val-locked basic :offset-assert 2672) - (relative-position vector :inline :offset-assert 2688) - (string-relative basic :offset-assert 2704) + ((trans vector :inline :offset-assert 128) + (fov float :offset-assert 144) + (fov0 float :offset-assert 148) + (fov1 float :offset-assert 152) + (fov-index cam-index :inline :offset-assert 160) + (tracking cam-rotation-tracker :inline :offset-assert 208) + (view-off-param float :offset-assert 472) + (view-off vector :inline :offset-assert 480) + (joystick-saved-view-off vector :inline :offset-assert 496) + (min-z-override float :offset-assert 512) + (view-flat vector :inline :offset-assert 528) + (string-vel-dir uint32 :offset-assert 544) + (string-trans vector :inline :offset-assert 560) + (position-spline tracking-spline :inline :offset-assert 576) + (pivot-pt vector :inline :offset-assert 2224) + (pivot-rad float :offset-assert 2240) + (circular-follow vector :inline :offset-assert 2256) + (max-angle-offset float :offset-assert 2272) + (max-angle-curr float :offset-assert 2276) + (options cam-slave-options-u32 :offset-assert 2280) + (cam-entity entity :offset-assert 2284) + (butt-timer uint64 :offset-assert 2288) + (butt-seek basic :offset-assert 2296) + (butt-vector vector :inline :offset-assert 2304) + (velocity vector :inline :offset-assert 2320) + (desired-pos vector :inline :offset-assert 2336) + (time-dist-too-far uint32 :offset-assert 2352) + (los-state slave-los-state :offset-assert 2356) + (good-point vector :inline :offset-assert 2368) + (los-tgt-spline-pt int32 :offset-assert 2384) + (los-tgt-spline-pt-incarnation int32 :offset-assert 2388) + (los-last-pos vector :inline :offset-assert 2400) + (intro-curve curve :inline :offset-assert 2416) + (intro-offset vector :inline :offset-assert 2448) + (intro-t float :offset-assert 2464) + (intro-t-step float :offset-assert 2468) + (outro-exit-value float :offset-assert 2472) + (spline-exists basic :offset-assert 2476) + (spline-curve curve :inline :offset-assert 2480) + (spline-offset vector :inline :offset-assert 2512) + (index cam-index :inline :offset-assert 2528) + (saved-pt vector :inline :offset-assert 2576) + (spline-tt float :offset-assert 2592) + (spline-follow-dist float :offset-assert 2596) + (enter-has-run symbol :offset-assert 2600) + (blend-from-type uint64 :offset-assert 2608) + (blend-to-type camera-blend-to-type :offset-assert 2616) + (have-phony-joystick basic :offset-assert 2624) + (phony-joystick-x float :offset-assert 2628) + (phony-joystick-y float :offset-assert 2632) + (string-min-val vector :inline :offset-assert 2640) + (string-max-val vector :inline :offset-assert 2656) + (string-val-locked basic :offset-assert 2672) + (relative-position vector :inline :offset-assert 2688) + (string-relative basic :offset-assert 2704) ) :heap-base #xa20 :method-count-assert 14 @@ -407,7 +407,7 @@ (deftype camera-master (process) - ((master-options uint32 :offset-assert 128) + ((master-options cam-master-options-u32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) (decel (pointer camera-slave) :offset-assert 140) diff --git a/goal_src/jak2/engine/camera/camera.gc b/goal_src/jak2/engine/camera/camera.gc index d2e60db56d..cfe4053f81 100644 --- a/goal_src/jak2/engine/camera/camera.gc +++ b/goal_src/jak2/engine/camera/camera.gc @@ -915,10 +915,10 @@ (defbehavior cam-slave-init-vars camera-slave () (cond (*camera* - (set! (-> self options) (-> *camera* slave-options)) + (set! (-> self options) (the-as cam-slave-options-u32 (-> *camera* slave-options))) ) (else - (set! (-> self options) (the-as uint 0)) + (set! (-> self options) (cam-slave-options-u32)) 0 ) ) @@ -1036,7 +1036,7 @@ (('teleport) (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) ) (none) @@ -1085,7 +1085,7 @@ ) ) ) - (if (logtest? #x200000 (-> self options)) + (if (logtest? (cam-slave-options-u32 EASE_SPLINE_IDX) (-> self options)) (set! f0-18 (parameter-ease-sin-clamp f0-18)) ) (curve-get-pos! s5-0 f0-18 (-> self spline-curve)) @@ -1345,7 +1345,7 @@ arg0 ) -(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) +(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 cam-slave-options-u32) (arg2 vector) (arg3 matrix)) (with-pp (let ((s1-0 (new-stack-vector0)) (s4-0 (new-stack-quaternion0)) @@ -1355,7 +1355,7 @@ ) 0.0 (let* ((f0-1 (cond - ((logtest? (the-as int arg1) 4) + ((logtest? arg1 (cam-slave-options-u32 MOVE_SPHERICAL)) (vector-length arg2) ) (else @@ -1536,7 +1536,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] -(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 float) (arg3 float) (arg4 symbol)) +(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 cam-slave-options-u32) (arg3 float) (arg4 symbol)) (local-vars (f0-9 float) (sv-208 vector) diff --git a/goal_src/jak2/engine/common_objs/base-plat.gc b/goal_src/jak2/engine/common_objs/base-plat.gc index 29f7d244b9..daa4a384b1 100644 --- a/goal_src/jak2/engine/common_objs/base-plat.gc +++ b/goal_src/jak2/engine/common_objs/base-plat.gc @@ -146,12 +146,12 @@ (defbehavior plat-event base-plat ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) "Handles platform related events. Presently all this does is: - if `event-type` is [['bonk]], then call [[base-plat:29]]" - (let ((evt-type event-type)) - (the-as object (if (= evt-type 'bonk) - (start-bouncing! self) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (start-bouncing! self) + ) + ) + ) ) (deftype eco-door (process-drawable) @@ -191,23 +191,23 @@ and play the respective sound @unused - likely a leftover from Jak 1" - (let ((evt-type event-type)) - (the-as object (when (= evt-type '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") - ) + (the-as object (case event-type + (('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") + ) ) - #t - ) - ) - ) + (else + (sound-play "door-unlock") + ) + ) + #t + ) + ) + ) ) eco-door-event-handler diff --git a/goal_src/jak2/engine/common_objs/basebutton.gc b/goal_src/jak2/engine/common_objs/basebutton.gc index 71eae9b7d1..7eeeca0205 100644 --- a/goal_src/jak2/engine/common_objs/basebutton.gc +++ b/goal_src/jak2/engine/common_objs/basebutton.gc @@ -82,37 +82,37 @@ (defstate up-idle (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'attack) - (let ((attack (the-as attack-info (-> event param 1)))) - (case (-> attack mode) - (('flop 'spin 'punch 'eco-yellow 'eco-red 'eco-blue 'eco-dark) - (when (or (not (or (= (-> attack mode) 'spin) (= (-> attack mode) 'punch))) - (logtest? (-> self button-status) (button-status button-status-3)) - ) - (send-event! self (-> self event-going-down)) - (go-virtual going-down) - ) - ) - ) - ) + (the-as + object + (case event-type + (('attack) + (let ((attack (the-as attack-info (-> event param 1)))) + (case (-> attack mode) + (('flop 'spin 'punch 'eco-yellow 'eco-red 'eco-blue 'eco-dark) + (when (or (not (or (= (-> attack mode) 'spin) (= (-> attack mode) 'punch))) + (logtest? (-> self button-status) (button-status button-status-3)) ) - ((= v1-0 'trigger) - (sound-play "silo-button") - (go-virtual going-down) - ) - ((= v1-0 'touch) - (when (logtest? (-> self button-status) (button-status button-status-4)) - (send-event! self (-> self event-going-down)) - (go-virtual going-down) - ) - ) - ((= v1-0 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) + (send-event! self (-> self event-going-down)) + (go-virtual going-down) + ) ) + ) + ) + ) + (('trigger) + (sound-play "silo-button") + (go-virtual going-down) + ) + (('touch) + (when (logtest? (-> self button-status) (button-status button-status-4)) + (send-event! self (-> self event-going-down)) + (go-virtual going-down) + ) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -140,16 +140,16 @@ (defstate going-down (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'untrigger) - (go-virtual going-up) - ) - ((= evt-type 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) - ) + (the-as + object + (case event-type + (('untrigger) + (go-virtual going-up) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -189,16 +189,16 @@ (defstate down-idle (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'untrigger) - (go-virtual going-up) - ) - ((= evt-type 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) - ) + (the-as + object + (case event-type + (('untrigger) + (go-virtual going-up) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -242,16 +242,16 @@ (defstate going-up (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ((= v1-0 'trigger) - (go-virtual going-down) - ) - ) - ) + (the-as + object + (case event-type + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + (('trigger) + (go-virtual going-down) + ) + ) ) ) :enter (behavior () diff --git a/goal_src/jak2/engine/common_objs/blocking-plane.gc b/goal_src/jak2/engine/common_objs/blocking-plane.gc index 55bfb0eb96..d5c353e052 100644 --- a/goal_src/jak2/engine/common_objs/blocking-plane.gc +++ b/goal_src/jak2/engine/common_objs/blocking-plane.gc @@ -21,8 +21,8 @@ ) -(defskelgroup skel-blocking-plane blocking-plane 0 2 - ((1 (meters 999999))) +(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 6 ) @@ -30,61 +30,59 @@ (defstate idle (blocking-plane) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'on) - (cond - ((nonzero? (-> self root-override)) - (let ((prim (-> self root-override root-prim))) - (set! (-> prim prim-core collide-as) (-> self root-override backup-collide-as)) - (let ((v0-0 (the-as int (-> self root-override backup-collide-with)))) - (set! (-> prim prim-core collide-with) (the-as collide-spec v0-0)) - v0-0 - ) + (the-as object (case event-type + (('on) + (cond + ((nonzero? (-> self root-override)) + (let ((prim (-> self root-override root-prim))) + (set! (-> prim prim-core collide-as) (-> self root-override backup-collide-as)) + (let ((v0-0 (the-as int (-> self root-override backup-collide-with)))) + (set! (-> prim prim-core collide-with) (the-as collide-spec v0-0)) + v0-0 ) ) - (else - (let ((proc-child-ptr-0 (-> self child))) - (while proc-child-ptr-0 - (let ((proc-child-0 (ppointer->process proc-child-ptr-0))) - (set! proc-child-ptr-0 (-> proc-child-ptr-0 0 brother)) - (if (type? proc-child-0 blocking-plane) - (send-event proc-child-0 'on) - ) - ) + ) + (else + (let ((proc-child-ptr-0 (-> self child))) + (while proc-child-ptr-0 + (let ((proc-child-0 (ppointer->process proc-child-ptr-0))) + (set! proc-child-ptr-0 (-> proc-child-ptr-0 0 brother)) + (if (type? proc-child-0 blocking-plane) + (send-event proc-child-0 'on) + ) ) ) - (the-as int #f) ) + (the-as int #f) ) ) - ((= evt-type 'off) - (cond - ((nonzero? (-> self root-override)) - (let ((v1-13 (-> self root-override root-prim))) - (set! (-> v1-13 prim-core collide-as) (collide-spec)) - (set! (-> v1-13 prim-core collide-with) (collide-spec)) - ) - 0 + ) + (('off) + (cond + ((nonzero? (-> self root-override)) + (let ((v1-13 (-> self root-override root-prim))) + (set! (-> v1-13 prim-core collide-as) (collide-spec)) + (set! (-> v1-13 prim-core collide-with) (collide-spec)) ) - (else - (let ((proc-child-ptr-1 (-> self child))) - (while proc-child-ptr-1 - (let ((proc-child-1 (ppointer->process proc-child-ptr-1))) - (set! proc-child-ptr-1 (-> proc-child-ptr-1 0 brother)) - (if (type? proc-child-1 blocking-plane) - (send-event proc-child-1 'off) - ) - ) + 0 + ) + (else + (let ((proc-child-ptr-1 (-> self child))) + (while proc-child-ptr-1 + (let ((proc-child-1 (ppointer->process proc-child-ptr-1))) + (set! proc-child-ptr-1 (-> proc-child-ptr-1 0 brother)) + (if (type? proc-child-1 blocking-plane) + (send-event proc-child-1 'off) + ) ) ) - (the-as int #f) ) + (the-as int #f) ) ) - ) - ) - ) + ) + ) + ) ) :code (the-as (function none :behavior blocking-plane) sleep-code) ) diff --git a/goal_src/jak2/engine/common_objs/crates.gc b/goal_src/jak2/engine/common_objs/crates.gc index ecb1b680a2..40f010684a 100644 --- a/goal_src/jak2/engine/common_objs/crates.gc +++ b/goal_src/jak2/engine/common_objs/crates.gc @@ -705,17 +705,15 @@ (defstate fall (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'carry-info) - (-> self carry) - ) - ((or (= v1-0 'carry?) (= v1-0 'pickup)) - (the-as carry-info #f) - ) - ) - ) - ) + (the-as object (case event-type + (('carry-info) + (-> self carry) + ) + (('carry? 'pickup) + (the-as carry-info #f) + ) + ) + ) ) :enter (behavior () (if (handle->process (-> self carry other)) @@ -1108,32 +1106,32 @@ (defstate special-contents-die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (case (-> event param 0) - (('pickup) - (let ((gp-0 (-> self entity extra perm))) - (logior! (-> gp-0 status) (entity-perm-status bit-5)) - (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) - (+! (-> self child-count) -1) - (when (<= (-> self child-count) 0) - (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) - (process-entity-status! self (entity-perm-status bit-4) #f) - ) - (process-entity-status! self (entity-perm-status dead) #t) - (process-entity-status! self (entity-perm-status subtask-complete) #t) - (set! (-> gp-0 user-int8 0) 2) - (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) - (set! (-> self mask) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('notify) + (case (-> event param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status bit-5)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) ) - ) - ) - ) + ) + ) + ) + ) ) :trans (-> (method-of-type crate die) trans) :code (behavior () diff --git a/goal_src/jak2/engine/common_objs/generic-obs-h.gc b/goal_src/jak2/engine/common_objs/generic-obs-h.gc index 4b72fe0f0b..02f5658f86 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs-h.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs-h.gc @@ -8,56 +8,47 @@ (defenum manipy-options :bitfield #t :type uint32 + (mo-0 0) ) - -(declare-type sparticle-launch-group basic) - -;; NOTE - for gun-blue-shot (declare-type part-tracker process) -(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) - -;; NOTE - for gun-red-shot (declare-type manipy process-drawable) -(define-extern manipy-init (function vector entity-actor skeleton-group vector none :behavior manipy)) -(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none)) - +(declare-type sparticle-launch-group basic) +(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process matrix none :behavior part-tracker)) +(define-extern manipy-init (function vector entity-actor skeleton-group vector object none :behavior manipy)) +(define-extern lightning-tracker-init (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker)) (define-extern birth-pickup-at-point (function vector pickup-type float symbol process-tree fact-info (pointer process) :behavior process)) - -;; NOTE - for process-drawable (define-extern process-grab? (function process symbol symbol :behavior process)) (define-extern process-release? (function process symbol :behavior process)) ;; DECOMP BEGINS (deftype manipy (process-drawable) - ((new-trans-hook (function none) :offset-assert 200) - (cur-trans-hook (function none) :offset-assert 204) - (cur-event-hook (function none) :offset-assert 208) - (new-joint-anim art-joint-anim :offset-assert 212) - (new-joint-anim-blend uint64 :offset-assert 216) - (anim-mode symbol :offset-assert 224) - (cur-grab-handle handle :offset-assert 232) - (cur-target-handle handle :offset-assert 240) - (old-grab-pos vector :inline :offset-assert 256) - (joint joint-mod 4 :offset-assert 272) - (new-post-hook (function none) :offset-assert 288) - (cur-post-hook (function none) :offset-assert 292) - (clone-copy-trans symbol :offset-assert 296) - (shadow-backup basic :offset-assert 300) - (draw? symbol :offset-assert 304) - (userdata uint64 :offset-assert 312) - (prefix basic :offset-assert 320) - (shadow-volume-joint int32 :offset-assert 324) - (speed float :offset-assert 328) - (user-uint64 uint64 4 :offset-assert 336) - (options manipy-options :offset-assert 368) + ((root-override collide-shape :offset 128 :score 1) + (new-trans-hook (function none) :offset-assert 200) + (cur-trans-hook (function none) :offset-assert 204) + (cur-event-hook (function none) :offset-assert 208) + (new-joint-anim art-joint-anim :offset-assert 212) + (new-joint-anim-blend uint64 :offset-assert 216) + (anim-mode symbol :offset-assert 224) + (cur-grab-handle handle :offset-assert 232) + (cur-target-handle handle :offset-assert 240) + (old-grab-pos vector :inline :offset-assert 256) + (joint joint-mod 4 :offset-assert 272) + (new-post-hook (function none) :offset-assert 288) + (cur-post-hook (function none) :offset-assert 292) + (clone-copy-trans symbol :offset-assert 296) + (shadow-backup basic :offset-assert 300) + (draw? symbol :offset-assert 304) + (userdata uint64 :offset-assert 312) + (prefix basic :offset-assert 320) + (shadow-volume-joint int32 :offset-assert 324) + (speed float :offset-assert 328) + (user-uint64 uint64 4 :offset-assert 336) + (options manipy-options :offset-assert 368) ) - :heap-base #x100 - :method-count-assert 21 - :size-assert #x174 - :flag-assert #x1501000174 + :flag-assert #x1501000174 (:methods - (manipy-method-20 () none 20) + (idle () _type_ :state 20) ) ) @@ -76,8 +67,8 @@ :size-assert #xb0 :flag-assert #x10003000b0 (:methods - (part-spawner-method-14 () none 14) - (part-spawner-method-15 () none 15) + (active () _type_ :state 14) + (is-in-view? (_type_) symbol 15) ) ) @@ -104,8 +95,8 @@ :size-assert #x168 :flag-assert #x1000f00168 (:methods - (part-tracker-method-14 () none 14) - (part-tracker-method-15 () none 15) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) ) ) @@ -113,14 +104,14 @@ (deftype lightning-tracker (process) ((ppointer-override (pointer lightning-tracker) :offset 28) (root trsqv :offset-assert 128) - (lightning lightning-spec :offset-assert 132) + (lightning lightning-control :offset-assert 132) (callback (function lightning-tracker none) :offset-assert 136) (duration uint64 :offset-assert 144) (start-time time-frame :offset-assert 152) (offset0 vector :inline :offset-assert 160) (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) + (target0 handle :offset-assert 192) + (target1 handle :offset-assert 200) (target-joint0 int32 :offset-assert 208) (target-joint1 int32 :offset-assert 212) (sound uint32 :offset-assert 216) @@ -134,47 +125,49 @@ :size-assert #x130 :flag-assert #x1100b00130 (:methods - (lightning-tracker-method-14 () none 14) - (lightning-tracker-method-15 () none 15) - (lightning-tracker-method-16 () none 16) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) + (update (_type_) none 16) ) ) (deftype touch-tracker (process-drawable) - ((duration time-frame :offset-assert 200) - (target handle :offset-assert 208) - (event symbol :offset-assert 216) - (run-function (function object) :offset-assert 220) - (callback (function touch-tracker none) :offset-assert 224) - (event-mode basic :offset-assert 228) + ((root-override collide-shape :offset 128) + (duration time-frame :offset-assert 200) + (target handle :offset-assert 208) + (event symbol :offset-assert 216) + (run-function (function object) :offset-assert 220) + (callback (function touch-tracker none) :offset-assert 224) + (event-mode basic :offset-assert 228) ) :heap-base #x70 :method-count-assert 21 :size-assert #xe8 :flag-assert #x15007000e8 (:methods - (touch-tracker-method-20 () none 20) + (active () _type_ :state 20) ) ) (deftype swingpole (process-drawable) - ((edge-length meters :offset-assert 200) - (path-pos float :offset-assert 204) - (joint-track int32 :offset-assert 208) - (speed meters :offset-assert 212) - (dir vector :inline :offset-assert 224) - (sync sync-eased :inline :offset-assert 240) + ((root-override collide-shape :offset 128) + (edge-length meters :offset-assert 200) + (path-pos float :offset-assert 204) + (joint-track int32 :offset-assert 208) + (speed meters :offset-assert 212) + (dir vector :inline :offset-assert 224) + (sync sync-eased :inline :offset-assert 240) ) :heap-base #xa0 :method-count-assert 23 :size-assert #x11c :flag-assert #x1700a0011c (:methods - (swingpole-method-20 () none 20) - (swingpole-method-21 () none 21) - (swingpole-method-22 () none 22) + (idle () _type_ :state 20) + (active (handle) _type_ :state 21) + (move-along-path (_type_) none 22) ) ) @@ -220,30 +213,31 @@ (deftype explosion (process-drawable) - ((start-time time-frame :offset-assert 200) - (duration uint32 :offset-assert 208) - (linger-duration uint32 :offset-assert 212) - (attack-id uint32 :offset-assert 216) + ((root-override collide-shape :offset 128) + (start-time time-frame :offset-assert 200) + (duration uint32 :offset-assert 208) + (linger-duration uint32 :offset-assert 212) + (attack-id uint32 :offset-assert 216) ) :heap-base #x60 :method-count-assert 23 :size-assert #xdc :flag-assert #x17006000dc (:methods - (explosion-method-20 () none 20) - (explosion-method-21 () none 21) - (explosion-method-22 () none 22) + (explode () _type_ :state 20) + (setup-explosion-collision (_type_) none 21) + (explosion-method-22 (_type_) none 22) ) ) (deftype explosion-init-params (structure) - ((spawn-point vector :inline :offset-assert 0) - (spawn-quat quaternion :inline :offset-assert 16) - (radius float :offset-assert 32) - (group basic :offset-assert 36) - (collide-with collide-spec :offset-assert 40) - (penetrate-using penetrate :offset-assert 48) + ((spawn-point vector :inline :offset-assert 0) + (spawn-quat quaternion :inline :offset-assert 16) + (radius float :offset-assert 32) + (group sparticle-launch-group :offset-assert 36) + (collide-with collide-spec :offset-assert 40) + (penetrate-using penetrate :offset-assert 48) ) :method-count-assert 9 :size-assert #x38 @@ -257,6 +251,6 @@ :size-assert #x80 :flag-assert #xf00000080 (:methods - (process-hidden-method-14 () none 14) + (die () _type_ :state 14) ) ) diff --git a/goal_src/jak2/engine/common_objs/generic-obs.gc b/goal_src/jak2/engine/common_objs/generic-obs.gc index 2de0b9e56a..45c69baf78 100644 --- a/goal_src/jak2/engine/common_objs/generic-obs.gc +++ b/goal_src/jak2/engine/common_objs/generic-obs.gc @@ -8,7 +8,6 @@ (define-extern ja-post (function none :behavior process-drawable)) (define-extern merc-blend-shape (function process-drawable object)) (define-extern merc-eye-anim (function process-drawable none)) -(define-extern process-grab? (function process symbol symbol :behavior process)) (define-extern process-release? (function process symbol :behavior process)) ;; NOTE - for guard-projectile @@ -16,6 +15,45 @@ ;; DECOMP BEGINS +(defskelgroup skel-spotlight spotlight 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :origin-joint-index 5 + ) + +;; WARN: Return type mismatch object vs none. +(defun entity-lookup-part-group ((arg0 entity-actor) (arg1 (pointer string)) (arg2 symbol)) + (local-vars (sv-16 res-tag)) + (let ((gp-0 (the-as object #f))) + (set! sv-16 (new 'static 'res-tag)) + (let ((s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16)))) + (if (not s4-0) + (go process-drawable-art-error (the-as string #f)) + ) + (let ((s3-0 (the-as object (-> (the-as (pointer uint32) s4-0))))) + (cond + ((part-group-pointer? (the-as pointer s3-0)) + (set! gp-0 (-> (the-as (pointer uint32) s4-0))) + ) + ((= (-> (the-as basic s3-0) type) string) + (if arg1 + (set! (-> arg1 0) (the-as string s3-0)) + ) + (set! gp-0 (lookup-part-group-pointer-by-name (the-as string s3-0))) + (if (the-as (pointer object) gp-0) + (set! (-> (the-as (pointer int32) s4-0)) (the-as int gp-0)) + ) + ) + (else + (go process-drawable-art-error (the-as string s3-0)) + ) + ) + ) + ) + ) + (none) + ) + (defbehavior clone-anim-once process-drawable ((arg0 handle) (arg1 symbol) (arg2 string)) (logclear! (-> self skel status) (joint-control-status valid-spooled-frame)) (let ((gp-0 (handle->process arg0))) @@ -98,3 +136,2787 @@ 0 (none) ) + +(defmethod move-along-path swingpole ((obj swingpole)) + (with-pp + (if (nonzero? (-> obj draw)) + (ja-post) + ) + (cond + ((nonzero? (-> obj path)) + (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (get-point-at-percent-along-path! (-> obj path) s5-0 (-> obj path-pos) 'interp) + (set! (-> obj speed) + (* (vector-vector-distance s5-0 (-> obj root-override trans)) (-> pp clock frames-per-second)) + ) + (move-to-point! (-> obj root-override) s5-0) + ) + ) + ((>= (-> obj joint-track) 0) + (let ((v1-15 (ppointer->process (-> obj parent))) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s4-0 (-> (the-as process-drawable v1-15) node-list data (-> obj joint-track)))) + (vector<-cspace! s5-1 s4-0) + (vector-normalize-copy! (-> obj dir) (the-as vector (-> s4-0 bone transform)) 1.0) + ) + (move-to-point! (-> obj root-override) s5-1) + ) + ) + ) + (when (nonzero? (-> obj sound)) + (set! (-> obj sound trans quad) (-> obj root-override trans quad)) + (let ((f30-0 (lerp-scale -0.1 -0.05 (-> obj speed) 8192.0 20480.0)) + (f0-6 (lerp-scale 0.7 1.0 (-> obj speed) 8192.0 20480.0)) + ) + (set! (-> obj sound pitch) (the int (* 1524.0 f30-0))) + (set! (-> obj sound volume) (the int (* 1024.0 f0-6))) + ) + (update! (-> obj sound)) + ) + 0 + (none) + ) + ) + +(defstate idle (swingpole) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('touch 'attack) + (if (send-event proc 'pole-grab (-> event param 0)) + (go-virtual active (process->handle proc)) + ) + #f + ) + ) + ) + ) + :code (behavior () + (if (nonzero? (-> self draw)) + (ja-post) + ) + (update-transforms (-> self root-override)) + (cond + ((or (nonzero? (-> self path)) (>= (-> self joint-track) 0)) + (until #f + (move-along-path self) + (suspend) + ) + #f + ) + (else + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + ) + (none) + ) + ) + +(defstate active (swingpole) + :virtual #t + :code (behavior ((arg0 handle)) + (move-along-path self) + (suspend) + (while (let* ((s5-0 (handle->process arg0)) + (a0-7 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (and a0-7 (logtest? (-> (the-as process-focusable a0-7) focus-status) (focus-status pole))) + ) + (move-along-path self) + (suspend) + ) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (move-along-path self) + (suspend) + ) + ) + (go-virtual idle) + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! swingpole ((obj swingpole) (arg0 entity-actor)) + "Copy defaults from the entity." + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((v1-5 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-5 prim-core collide-as) (collide-spec collectable)) + (set! (-> v1-5 prim-core collide-with) (collide-spec jak player-list tobot)) + (set-vector! (-> v1-5 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-5) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-8 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-8 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-8 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) + ) + (set! (-> obj root-override trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root-override quat) (-> arg0 quat)) + (vector-identity! (-> obj root-override scale)) + (vector-y-quaternion! (-> obj dir) (-> obj root-override quat)) + (set! (-> obj joint-track) -1) + (let ((a1-8 (res-lump-struct (-> obj entity) 'art-name structure))) + (if a1-8 + (initialize-skeleton-by-name obj (the-as string a1-8)) + ) + ) + (set! (-> obj dir y) 0.0) + (vector-normalize! (-> obj dir) 1.0) + (set! (-> obj edge-length) 8192.0) + (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) + (let ((a0-19 (res-lump-value arg0 'options uint128 :time -1000000000.0)) + (v1-22 0) + ) + (if (not (logtest? (the-as int a0-19) 8)) + (set! v1-22 (logior v1-22 1)) + ) + (set! (-> s4-1 sync-type) (the-as basic 'sync-eased)) + (set! (-> s4-1 sync-flags) (the-as sync-flags v1-22)) + ) + (set! (-> s4-1 period) (the-as uint 0)) + (set! (-> s4-1 entity) arg0) + (set! (-> s4-1 percent) 0.0) + (set! (-> s4-1 ease-in) 0.2) + (set! (-> s4-1 ease-out) 0.2) + (set! (-> s4-1 pause-in) 0.0) + (set! (-> s4-1 pause-out) 0.0) + (initialize! (-> obj sync) s4-1) + ) + (when (nonzero? (-> obj sync period)) + (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + (set! (-> obj sound) (new 'process 'ambient-sound (-> obj entity) (-> obj root-override trans))) + (go (method-of-object obj idle)) + (none) + ) + +(defbehavior swingpole-init swingpole ((arg0 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec collectable)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list tobot)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-4) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-7 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-7 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-7 prim-core collide-with)) + ) + (set! (-> self root-override) s5-0) + ) + (set! (-> self root-override trans quad) (-> (the-as swingpole (-> self parent 0)) root-override trans quad)) + (quaternion-identity! (-> self root-override quat)) + (vector-identity! (-> self root-override scale)) + (set! (-> self joint-track) arg0) + (set-vector! (-> self dir) 0.0 0.0 1.0 1.0) + (set! (-> self edge-length) 8192.0) + (go-virtual idle) + ) + +(defstate die (process-hidden) + :virtual #t + :code (the-as (function none :behavior process-hidden) nothing) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! process-hidden ((obj process-hidden) (arg0 entity-actor)) + "Copy defaults from the entity." + (process-entity-status! obj (entity-perm-status dead) #t) + (go (method-of-object obj die)) + (none) + ) + +(deftype target-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + + +(deftype camera-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + + +(defbehavior manipy-post manipy () + ((-> self cur-post-hook)) + (when (and (>= (-> self shadow-volume-joint) 0) (-> self draw shadow-ctrl)) + (let ((a2-0 (-> self node-list data (-> self shadow-volume-joint))) + (a3-0 (-> self draw shadow-ctrl)) + ) + (format *stdcon* "shadow-volume for ~A ~A~%" a2-0 a3-0) + ) + ) + 0 + (none) + ) + +(defstate idle (manipy) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (s4-0 object)) + (let ((v1-0 event-type)) + (the-as + object + (cond + ((= v1-0 'attackable) + (cond + ((-> event param 0) + (set! s4-0 (logior (process-mask collectable) (-> self mask))) + (set! (-> self mask) (the-as process-mask s4-0)) + ) + (else + (set! s4-0 (logclear (-> self mask) (process-mask collectable))) + (set! (-> self mask) (the-as process-mask s4-0)) + ) + ) + s4-0 + ) + ((= v1-0 'blend-shape) + (when (nonzero? (-> self skel)) + (cond + ((-> event param 0) + (set! s4-0 (logior (-> self skel status) (joint-control-status blend-shape eye-anim))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + (else + (set! s4-0 (logclear (-> self skel status) (joint-control-status blend-shape eye-anim))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + ) + s4-0 + ) + ) + ((= v1-0 'shadow) + (when (nonzero? (-> self draw)) + (cond + ((-> event param 0) + (set! s4-0 (-> self shadow-backup)) + (set! (-> self draw shadow) (the-as shadow-geo s4-0)) + s4-0 + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ((= v1-0 'shadow-volume) + (let ((v1-17 (get-art-by-name-method (-> self draw jgeo) (the-as string (-> event param 0)) (the-as type #f)))) + (if v1-17 + (set! (-> self shadow-volume-joint) (+ (-> (the-as joint v1-17) number) 1)) + ) + ) + (when (and (-> self draw shadow-ctrl) (< 1 arg1) (>= (the-as int (-> event param 1)) 0)) + (let ((v0-1 (command-get-int (-> event param 1) 0))) + (set! (-> self draw shadow-ctrl settings flags) (the-as shadow-flags v0-1)) + v0-1 + ) + ) + ) + ((= v1-0 'shadow-type) + (if (and (-> self draw shadow-ctrl) (> arg1 0)) + (set! (-> self draw shadow-ctrl settings shadow-type) (command-get-int (-> event param 0) 0)) + ) + ) + ((= v1-0 'shadow-dir) + (when (and (-> self draw shadow-ctrl) (> arg1 0)) + (set! s4-0 (-> self draw shadow-ctrl settings shadow-dir)) + (set! (-> (the-as vector s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as vector s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as vector s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as vector s4-0) w) (if (< 3 arg1) + (command-get-float (-> event param 3) 0.0) + 409600.0 + ) + ) + s4-0 + ) + ) + ((= v1-0 'shadow-top-plane) + (when (and (-> self draw shadow-ctrl) (>= arg1 4)) + (set! s4-0 (-> self draw shadow-ctrl settings top-plane)) + (set! (-> (the-as plane s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as plane s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as plane s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as plane s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'shadow-bot-plane) + (when (and (-> self draw shadow-ctrl) (>= arg1 4)) + (set! s4-0 (-> self draw shadow-ctrl settings bot-plane)) + (set! (-> (the-as plane s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as plane s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as plane s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as plane s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'no-fog) + (set! s4-0 (logior (-> self draw status) (draw-control-status disable-fog))) + (set! (-> self draw status) (the-as draw-control-status s4-0)) + s4-0 + ) + ((= v1-0 'setup-spotlight-shadow) + (when (-> self draw shadow-ctrl) + (let ((v1-53 (command-get-process "spotlight" *target*))) + (when v1-53 + (let ((s5-1 (-> (the-as process-drawable v1-53) node-list data 3))) + (vector<-cspace! (new 'stack-no-clear 'vector) s5-1) + (let ((s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-1 bone transform vector 2) -1.0)) + (s4-1 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self draw shadow-joint-index))) + ) + ) + 1638400.0 + (let ((s3-0 (new 'stack-no-clear 'collide-query)) + (f28-0 122880.0) + ) + (set! (-> s3-0 start-pos quad) (-> s4-1 quad)) + (vector-normalize-copy! (-> s3-0 move-dist) s5-2 f28-0) + (let ((v1-64 s3-0)) + (set! (-> v1-64 radius) 1638.4) + (set! (-> v1-64 collide-with) (collide-spec obstacle hit-by-others-list)) + (set! (-> v1-64 ignore-process0) self) + (set! (-> v1-64 ignore-process1) #f) + (set! (-> v1-64 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-64 action-mask) (collide-action solid)) + ) + (let* ((f0-13 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (f28-1 (if (< 0.0 f0-13) + (* f0-13 f28-0) + 122880.0 + ) + ) + (s2-0 (method-of-object (-> self draw shadow-ctrl) shadow-control-method-14)) + ) + (- f28-1 (command-get-float (-> event param 0) 0.0)) + (+ f28-1 (command-get-float (-> event param 1) 0.0)) + (the-as object (s2-0)) + ) + ) + ) + ) + ) + ) + ) + ) + ((= v1-0 'color-mult) + (when (>= arg1 4) + (set! s4-0 (-> self draw color-mult)) + (set! (-> (the-as rgbaf s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as rgbaf s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as rgbaf s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as rgbaf s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'color-mult-vector) + (set! s4-0 (-> self draw color-mult)) + (set! (-> (the-as rgbaf s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ((= v1-0 'color-emissive-vector) + (set! s4-0 (-> self draw color-emissive)) + (set! (-> (the-as rgbaf s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ((= v1-0 'segment) + (let ((a1-44 (/ (the-as int (-> event param 0)) 8)) + (a2-5 (/ (the-as int (-> event param 1)) 8)) + ) + (the-as object (setup-masks (-> self draw) a1-44 (the-as int a2-5))) + ) + ) + ((= v1-0 'trans-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self new-trans-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'post-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self new-post-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'user-data) + (set! s4-0 (-> event param 0)) + (set! (-> self userdata) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'eval) + ((the-as (function manipy object) (-> event param 0)) self) + ) + ((= v1-0 'speed) + (set! (-> self speed) (the-as float (-> event param 0))) + ) + ((= v1-0 'event-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self cur-event-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'art-joint-anim) + (set! (-> self new-joint-anim) + (get-art-by-name (-> self draw art-group) (the-as string (-> event param 0)) art-joint-anim) + ) + (set! s4-0 (-> event param 1)) + (set! (-> self new-joint-anim-blend) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'anim-mode) + (when (nonzero? (-> self skel)) + (set! (-> self anim-mode) (the-as symbol (-> event param 0))) + (if (= (-> self anim-mode) 'clone-anim) + (ja-post) + ) + (-> self anim-mode) + ) + ) + ((or (= v1-0 'origin-joint-index) (= v1-0 'center-joint)) + (set! (-> self draw origin-joint-index) (-> event param 0)) + (set! s4-0 (-> event param 0)) + (set! (-> self draw shadow-joint-index) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'max-vis-dist) + (set! (-> self draw lod-set lod (-> self draw lod-set max-lod) dist) (the-as float (-> event param 0))) + ) + ((= v1-0 'grab) + (set! (-> self cur-grab-handle) (process->handle (the-as process (-> event param 0)))) + (let ((v1-98 (handle->process (-> self cur-grab-handle)))) + (when v1-98 + (set! s4-0 (-> self old-grab-pos)) + (set! (-> (the-as vector s4-0) quad) (-> (the-as process-drawable v1-98) root trans quad)) + s4-0 + ) + ) + ) + ((= v1-0 'target) + (set! s4-0 (process->handle (the-as process (-> event param 0)))) + (set! (-> self cur-target-handle) (the-as handle s4-0)) + s4-0 + ) + ((= v1-0 'trans) + (cond + ((type? (-> self root) collide-shape) + (the-as object (move-to-point! (-> self root-override) (the-as vector (-> event param 0)))) + ) + (else + (set! s4-0 (-> self root trans)) + (set! (-> (the-as vector s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ) + ) + ((= v1-0 'rot) + (let ((s5-3 (new 'stack-no-clear 'matrix))) + (matrix-rotate-y! s5-3 (the-as float (-> event param 0))) + (matrix->quaternion (-> self root quat) s5-3) + ) + ) + ((= v1-0 'rot-quat) + (quaternion-copy! (-> self root quat) (the-as quaternion (-> event param 0))) + ) + ((= v1-0 'clone-copy-trans) + (set! s4-0 (-> event param 0)) + (set! (-> self clone-copy-trans) (the-as symbol s4-0)) + s4-0 + ) + ((= v1-0 'release) + (set! (-> self cur-grab-handle) (the-as handle #f)) + #f + ) + ((= v1-0 'draw) + (set! (-> self draw?) (the-as symbol (-> event param 0))) + (cond + ((-> event param 0) + (let ((v1-114 (logtest? (-> self draw status) (draw-control-status no-draw)))) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (when v1-114 + (cond + ((nonzero? (-> self skel)) + (let ((gp-1 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! s4-0 (the-as object (ja-post))) + (set! (-> self skel status) gp-1) + ) + s4-0 + ) + (else + (the-as object (ja-post)) + ) + ) + ) + ) + ) + (else + (set! s4-0 (logior (-> self draw status) (draw-control-status no-draw))) + (set! (-> self draw status) (the-as draw-control-status s4-0)) + s4-0 + ) + ) + ) + ((= v1-0 'sync) + (when (nonzero? (-> self skel)) + (cond + ((-> event param 0) + (set! s4-0 (logior (-> self skel status) (joint-control-status sync-math))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + (else + (set! s4-0 (logclear (-> self skel status) (joint-control-status sync-math))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + ) + s4-0 + ) + ) + ((= v1-0 'query) + (case (-> event param 0) + (('grab) + (handle->process (-> self cur-grab-handle)) + ) + (('done) + (case (-> self anim-mode) + (('play1 'play) + (>= (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -2))) + ) + ) + ) + ) + ) + ((= v1-0 'set-frame-num) + (let ((v1-147 (-> self skel root-channel 0))) + (set! (-> v1-147 num-func) num-func-identity) + (set! (-> v1-147 frame-num) (the-as float (-> event param 0))) + ) + ) + ((= v1-0 'prefix) + (set! s4-0 (-> event param 0)) + (set! (-> self prefix) (the-as basic s4-0)) + s4-0 + ) + ((= v1-0 'light-index) + (let ((v0-40 (command-get-int (-> event param 0) 0))) + (set! (-> self draw light-index) (the-as uint v0-40)) + v0-40 + ) + ) + ((= v1-0 'eye-slot) + (set! (-> self draw mgeo header eye-ctrl eye-slot) (command-get-int (-> event param 0) 0)) + ) + ((= v1-0 'shadow-mask) + (let ((v0-42 (command-get-int (-> event param 0) 0))) + (set! (-> self draw shadow-mask) (the-as uint v0-42)) + v0-42 + ) + ) + ((= v1-0 'shadow-values) + (let ((v0-43 (command-get-int (-> event param 0) 0))) + (set! (-> self draw shadow-values) (the-as uint v0-43)) + v0-43 + ) + ) + ((= v1-0 'mirror) + (cond + ((-> event param 0) + (set! s4-0 (-> self node-list data 2)) + (set! (-> (the-as cspace s4-0) param0) (the-as (function cspace matrix none) cspace<-parented-matrix-mirror!)) + (set! (-> (the-as cspace s4-0) param1) (the-as basic (-> *math-camera* mirror-trans))) + (set! (-> (the-as cspace s4-0) param2) (the-as basic (-> *math-camera* mirror-normal))) + ) + (else + (set! s4-0 (-> self node-list data 2)) + (set! (-> (the-as cspace s4-0) param0) #f) + ) + ) + s4-0 + ) + ((= v1-0 'draw-mirror) + (send-event (ppointer->process (-> self child)) 'draw (-> event param 0)) + ) + ((= v1-0 'user) + (set! s4-0 (-> event param 1)) + (set! (-> self user-uint64 (/ (the-as int (-> event param 0)) 8)) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'die) + (the-as object (deactivate self)) + ) + ((= v1-0 'do-effect) + (when (and (nonzero? (-> self skel)) (-> self skel effect)) + (let ((t9-46 (method-of-object (-> self skel effect) effect-control-method-10))) + (-> event param 0) + (-> event param 1) + -1 + (the-as object (t9-46)) + ) + ) + ) + (else + (if (-> self cur-event-hook) + (the-as object ((-> self cur-event-hook))) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (if (!= (-> self cur-trans-hook) (-> self new-trans-hook)) + (set! (-> self cur-trans-hook) (-> self new-trans-hook)) + ) + (if (!= (-> self cur-post-hook) (-> self new-post-hook)) + (set! (-> self cur-post-hook) (-> self new-post-hook)) + ) + (when (and (-> self new-joint-anim) + (nonzero? (-> self skel)) + (and (!= (ja-group) (-> self new-joint-anim)) (!= (-> self anim-mode) 'clone-anim)) + ) + (ja-channel-push! 1 (the-as time-frame (-> self new-joint-anim-blend))) + (ja :group! (-> self new-joint-anim) :num! min) + ) + (let ((v1-20 (handle->process (-> self cur-grab-handle)))) + (when v1-20 + (let ((gp-1 (-> (the-as process-drawable v1-20) root trans))) + (if (type? (-> self root) collide-shape) + (move-by-vector! + (the-as collide-shape (-> self root)) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + (vector+! + (-> self root trans) + (-> self root trans) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + ) + (set! (-> self old-grab-pos quad) (-> gp-1 quad)) + ) + ) + ) + ((-> self cur-trans-hook)) + (none) + ) + :code (behavior () + (logclear! (-> self mask) (process-mask heap-shrunk)) + (until #f + (case (-> self anim-mode) + (('loop) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (loop!)) + ) + (('play) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (seek!)) + ) + (('copy-parent) + (let ((v1-17 (-> self skel root-channel 0))) + (set! (-> v1-17 num-func) num-func-identity) + (let ((a0-10 (-> self parent))) + (set! (-> v1-17 frame-num) (-> (the-as process-drawable (if a0-10 + (the-as process-drawable (-> a0-10 0 self)) + ) + ) + skel + root-channel + 0 + frame-num + ) + ) + ) + ) + (ja-post) + (manipy-post) + (suspend) + 0 + ) + (('clone-parent) + (let ((gp-0 (ppointer->process (-> self parent)))) + (set! (-> self post-hook) #f) + (joint-control-copy! (-> self skel) (-> (the-as process-drawable gp-0) skel)) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> (the-as process-drawable gp-0) draw art-group) + '() + 0 + "" + ) + ) + (update-anim-data (-> self skel)) + (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) + (manipy-post) + (suspend) + 0 + ) + (('clone-anim) + (clone-anim-once + (if (handle->process (-> self cur-target-handle)) + (the-as handle (-> self cur-target-handle)) + (ppointer->handle (-> self parent)) + ) + (-> self clone-copy-trans) + (the-as string (-> self prefix)) + ) + (manipy-post) + (suspend) + 0 + ) + (('mirror) + (let ((gp-1 (if (handle->process (-> self cur-target-handle)) + (-> self cur-target-handle) + (ppointer->handle (-> self parent)) + ) + ) + ) + (clone-anim-once gp-1 (-> self clone-copy-trans) (the-as string (-> self prefix))) + (logior! (-> self draw global-effect) (draw-control-global-effect disable-envmap)) + (set! (-> self draw light-index) (the-as uint 5)) + (if (logtest? (-> (the-as process-drawable (handle->process gp-1)) draw status) + (draw-control-status no-draw no-draw-temp no-draw-bounds) + ) + (logior! (-> self draw status) (draw-control-status no-draw-temp)) + ) + ) + (manipy-post) + (suspend) + 0 + ) + (('still) + (ja-post) + (manipy-post) + (suspend) + 0 + ) + (('play1) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (seek! max (-> self speed))) + (if (ja-done? 0) + (deactivate self) + ) + ) + ) + ) + #f + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior manipy-init manipy ((arg0 vector) (arg1 entity-actor) (arg2 skeleton-group) (arg3 vector) (arg4 object)) + (stack-size-set! (-> self main-thread) 128) + (logior! (-> self mask) (process-mask heap-shrunk)) + (process-entity-set! self arg1) + (cond + ((= arg3 'collide-shape-moving) + (let ((s3-1 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s3-1 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s3-1 reaction) cshape-reaction-default) + (set! (-> s3-1 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-sphere s3-1 (the-as uint 0)))) + (set-vector! (-> v1-11 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s3-1 total-prims) (the-as uint 1)) + (set! (-> s3-1 root-prim) v1-11) + ) + (set! (-> s3-1 nav-radius) (* 0.75 (-> s3-1 root-prim local-sphere w))) + (let ((v1-14 (-> s3-1 root-prim))) + (set! (-> s3-1 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s3-1 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> self root) s3-1) + ) + ) + (arg3 + (let ((s3-2 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-18 (new 'process 'collide-shape-prim-sphere s3-2 (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-as) (collide-spec collectable notice-blue-eco-powerup)) + (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-18 local-sphere) (-> arg3 x) (-> arg3 y) (-> arg3 z) (-> arg3 w)) + (set! (-> s3-2 total-prims) (the-as uint 1)) + (set! (-> s3-2 root-prim) v1-18) + ) + (set! (-> s3-2 nav-radius) (* 0.75 (-> s3-2 root-prim local-sphere w))) + (let ((v1-21 (-> s3-2 root-prim))) + (set! (-> s3-2 backup-collide-as) (-> v1-21 prim-core collide-as)) + (set! (-> s3-2 backup-collide-with) (-> v1-21 prim-core collide-with)) + ) + (set! (-> self root) s3-2) + ) + ) + (else + (set! (-> self root) (new 'process 'trsqv)) + ) + ) + (set! (-> self root trans quad) (-> arg0 quad)) + (initialize-skeleton self arg2 (the-as pair 0)) + (if (type? (-> self root) collide-shape) + (update-transforms (the-as collide-shape (-> self root))) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self shadow-volume-joint) -1) + (set! (-> self options) (the-as manipy-options arg4)) + (when (-> self draw shadow) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control 0.0 0.0 614400.0 (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0) + ) + (quad-copy! (the-as pointer (-> self draw shadow-ctrl settings)) (the-as pointer *default-shadow-settings*) 5) + ) + (set! (-> self new-trans-hook) nothing) + (set! (-> self cur-trans-hook) nothing) + (set! (-> self new-post-hook) nothing) + (set! (-> self cur-post-hook) nothing) + (set! (-> self cur-event-hook) #f) + (set! (-> self cur-grab-handle) (the-as handle #f)) + (set! (-> self cur-target-handle) (the-as handle #f)) + (set! (-> self clone-copy-trans) #t) + (set! (-> self draw?) #t) + (set! (-> self prefix) "") + (set! (-> self speed) 1.0) + (when (logtest? (-> self options) (manipy-options mo-0)) + (let ((v1-56 (get-art-by-name-method (-> self draw jgeo) "neckA" (the-as type #f)))) + (when v1-56 + (set! (-> self joint 0) + (new 'process 'joint-mod (joint-mod-mode flex-blend) self (+ (-> (the-as joint v1-56) number) 1)) + ) + (set! (-> self joint 0 parented-scale?) #t) + ) + ) + ) + (cond + ((nonzero? (-> self skel)) + (set! (-> self new-joint-anim) (ja-group)) + (set! (-> self anim-mode) 'loop) + ) + (else + (set! (-> self anim-mode) 'still) + ) + ) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (go-virtual idle) + (none) + ) + +(defmethod deactivate part-tracker ((obj part-tracker)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod notify-parent-of-death part-tracker ((obj part-tracker)) + (with-pp + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) (process->ppointer pp)) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> obj parent))) + ) + (s5-0 + (if (type? s4-0 process) + s4-0 + ) + gp-0 + ) + ) + ) + (none) + ) + ) + +(defstate active (part-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('die) + (the-as symbol (deactivate self)) + ) + ) + ) + ) + :code (behavior () + (set! (-> self start-time) (-> self clock frame-counter)) + (while (or (zero? (-> self duration)) + (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (let* ((gp-0 (handle->process (-> self target))) + (v1-8 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (cond + ((and v1-8 + (nonzero? (-> (the-as process-drawable v1-8) root)) + (nonzero? (-> (the-as process-drawable v1-8) node-list)) + ) + (spawn-with-cspace (-> self part) (-> (the-as process-drawable v1-8) node-list data (-> self target-joint))) + (set! (-> self root trans quad) (-> self part origin trans quad)) + ) + (else + (let ((a0-12 (-> self root trans))) + (set! (-> self mat trans quad) (-> a0-12 quad)) + ) + (spawn-with-matrix (-> self part) (-> self mat)) + ) + ) + ) + (suspend) + ) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (the-as time-frame (-> self linger-duration))) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (let* ((s5-0 (handle->process (-> self target))) + (v1-30 (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (if (and v1-30 + (nonzero? (-> (the-as process-drawable v1-30) root)) + (nonzero? (-> (the-as process-drawable v1-30) node-list)) + ) + (vector<-cspace! + (-> self root trans) + (-> (the-as process-drawable v1-30) node-list data (-> self target-joint)) + ) + ) + ) + (suspend) + ) + ) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (notify-parent-of-death self) + (suspend) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior part-tracker-init part-tracker ((arg0 sparticle-launch-group) + (arg1 time-frame) + (arg2 (function part-tracker none)) + (arg3 (pointer process-drawable)) + (arg4 process) + (arg5 matrix) + ) + (stack-size-set! (-> self main-thread) 128) + (if (= pointer process-tree) + (set! (-> self clock) (-> *display* part-clock)) + ) + (set! (-> self target) (process->handle arg4)) + (cond + (arg4 + (set! (-> self target-joint) (the-as int arg5)) + ) + ((logtest? (-> arg0 flags) (sp-group-flag unk-5)) + (let* ((s1-1 (-> self mat)) + (a2-1 (math-camera-matrix)) + (v1-11 (-> a2-1 vector 0 quad)) + (a0-7 (-> a2-1 vector 1 quad)) + (a1-2 (-> a2-1 vector 2 quad)) + (a2-2 (-> a2-1 trans quad)) + ) + (set! (-> s1-1 vector 0 quad) v1-11) + (set! (-> s1-1 vector 1 quad) a0-7) + (set! (-> s1-1 vector 2 quad) a1-2) + (set! (-> s1-1 trans quad) a2-2) + ) + (set! (-> self mat trans quad) (-> arg5 trans quad)) + (set! (-> self offset quad) (-> self mat trans quad)) + ) + (else + (let* ((v1-14 (-> self mat)) + (a3-1 arg5) + (a0-12 (-> a3-1 vector 0 quad)) + (a1-3 (-> a3-1 vector 1 quad)) + (a2-3 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 trans quad)) + ) + (set! (-> v1-14 vector 0 quad) a0-12) + (set! (-> v1-14 vector 1 quad) a1-3) + (set! (-> v1-14 vector 2 quad) a2-3) + (set! (-> v1-14 trans quad) a3-2) + ) + (set! (-> self offset quad) (-> self mat trans quad)) + ) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> self mat trans quad)) + (if (zero? arg0) + (go process-drawable-art-error "null group") + ) + (set! (-> self callback) (the-as (function part-tracker vector) arg2)) + (set! (-> self linger-callback) #f) + (set! (-> self userdata) (the-as uint arg3)) + (set! arg1 (cond + ((> arg1 0) + (empty) + arg1 + ) + ((= arg1 -1) + 0 + ) + (else + (the-as time-frame (-> arg0 duration)) + ) + ) + ) + (set! (-> self duration) (the-as uint arg1)) + (set! (-> self linger-duration) (-> arg0 linger-duration)) + (set! (-> self part) (create-launch-control arg0 self)) + (go-virtual active) + (none) + ) + +(defun part-tracker-track-root ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-3 (-> arg1 key proc root trans))) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +(defun part-tracker-move-to-target ((arg0 part-tracker)) + (with-pp + (let* ((a0-1 *target*) + (a2-0 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (* 0.006666667 (the float (- (-> pp clock frame-counter) (-> arg0 start-time)))) + ) + ) + ) + ) + +(defun part-tracker-track-target ((arg0 part-tracker)) + (set! (-> arg0 linger-callback) (-> arg0 callback)) + (let* ((a0-1 *target*) + (v1-2 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + (v0-1 (-> arg0 root trans)) + ) + (set! (-> v0-1 quad) (-> v1-2 quad)) + v0-1 + ) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod notify-parent-of-death lightning-tracker ((obj lightning-tracker)) + (with-pp + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) (process->ppointer pp)) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> obj parent))) + ) + (s5-0 + (if (type? s4-0 process) + s4-0 + ) + gp-0 + ) + ) + ) + (none) + ) + ) + +(defmethod update lightning-tracker ((obj lightning-tracker)) + (if (-> obj callback) + ((-> obj callback) obj) + ) + (let ((a0-6 (cond + ((>= (-> obj target-joint0) 0) + (let ((s5-0 (handle->process (-> obj target0)))) + (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (else + (the-as process #f) + ) + ) + ) + ) + (cond + ((< (-> obj target-joint0) 0) + (when (and (!= (-> obj lightning spec rand-func) 3) (!= (-> obj lightning spec rand-func) 2)) + (let ((v1-17 (-> obj lightning)) + (a0-9 (-> obj offset0)) + ) + (set! (-> v1-17 state meet data 0 quad) (-> a0-9 quad)) + ) + ) + ) + ((or (not a0-6) (zero? (-> (the-as process-focusable a0-6) root-override))) + (deactivate obj) + ) + ((= (-> obj target-joint0) 256) + (let ((s5-1 (-> obj lightning)) + (a0-12 (get-trans (the-as process-focusable a0-6) 3)) + ) + (set! (-> s5-1 state meet data 0 quad) (-> a0-12 quad)) + ) + ) + (else + (let ((s5-2 (-> obj lightning)) + (a0-16 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-focusable a0-6) node-list data (-> obj target-joint0)) + ) + ) + ) + (set! (-> s5-2 state meet data 0 quad) (-> a0-16 quad)) + ) + ) + ) + ) + (let ((a0-22 (cond + ((>= (-> obj target-joint1) 0) + (let ((s5-3 (handle->process (-> obj target1)))) + (if (type? s5-3 process-drawable) + s5-3 + ) + ) + ) + (else + (the-as process #f) + ) + ) + ) + ) + (cond + ((< (-> obj target-joint1) 0) + (when (and (!= (-> obj lightning spec rand-func) 3) (!= (-> obj lightning spec rand-func) 2)) + (let ((a0-26 (-> obj lightning)) + (v1-44 (-> obj offset1)) + ) + (set! (-> a0-26 state meet data (+ (-> a0-26 state points-to-draw) -1) quad) (-> v1-44 quad)) + ) + ) + ) + ((or (not a0-22) (zero? (-> (the-as process-focusable a0-22) root-override))) + (deactivate obj) + ) + ((= (-> obj target-joint1) 256) + (let ((gp-1 (-> obj lightning)) + (v1-51 (get-trans (the-as process-focusable a0-22) 3)) + ) + (set! (-> gp-1 state meet data (+ (-> gp-1 state points-to-draw) -1) quad) (-> v1-51 quad)) + ) + ) + (else + (let ((s5-4 (-> obj lightning)) + (v1-54 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable a0-22) node-list data (-> obj target-joint1)) + ) + ) + ) + (set! (-> s5-4 state meet data (+ (-> s5-4 state points-to-draw) -1) quad) (-> v1-54 quad)) + ) + ) + ) + ) + 0 + (none) + ) + +(defstate active (lightning-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('die) + (the-as symbol (deactivate self)) + ) + ) + ) + ) + :exit (behavior () + (when (nonzero? (-> self sound)) + (let ((v1-1 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-1 command) (sound-command set-param)) + (set! (-> v1-1 id) (the-as sound-id (-> self sound))) + (set! (-> v1-1 params volume) -4) + (set! (-> v1-1 auto-time) 240) + (set! (-> v1-1 auto-from) 2) + (set! (-> v1-1 params mask) (the-as uint 17)) + (-> v1-1 id) + ) + ) + (none) + ) + :code (behavior () + (set! (-> self sound) (the-as uint 0)) + (when (!= (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) 0.0) + (let ((gp-0 (-> self clock frame-counter)) + (s5-0 (the int (rand-vu-float-range + (-> self lightning spec delay) + (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) + ) + ) + ) + ) + (while (< (- (-> self clock frame-counter) gp-0) s5-0) + (suspend) + ) + ) + ) + (let ((gp-1 (-> self lightning spec sound))) + (when gp-1 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> self offset1 quad)) + (when (and (>= (-> self target-joint1) 0) (< (-> self target-joint1) 256)) + (let* ((s4-0 (handle->process (-> self target1))) + (v1-28 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (if (and v1-28 (nonzero? (-> (the-as process-drawable v1-28) root))) + (set! (-> s5-1 quad) (-> (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable v1-28) node-list data (-> self target-joint1)) + ) + quad + ) + ) + ) + ) + ) + (set! (-> self sound) (the-as uint (sound-play-by-spec (the-as sound-spec gp-1) (new-sound-id) s5-1))) + ) + ) + ) + (let ((v1-33 (-> self lightning)) + (a0-10 1) + ) + (let ((a1-10 (!= a0-10 (-> v1-33 state mode)))) + (case a0-10 + ((3) + (if a1-10 + (set! (-> v1-33 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-33 state start-color) (-> v1-33 spec start-color)) + (set! (-> v1-33 state end-color) (-> v1-33 spec end-color)) + ) + ) + ) + (set! (-> v1-33 state mode) (the-as lightning-mode a0-10)) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (or (zero? (-> self duration)) + (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + ) + (update self) + (suspend) + ) + (let ((f30-0 (-> self lightning spec fade-time))) + (when (< 0.0 f30-0) + (let ((v1-47 (-> self lightning)) + (a0-14 3) + ) + (let ((a1-20 (!= a0-14 (-> v1-47 state mode)))) + (case a0-14 + ((3) + (if a1-20 + (set! (-> v1-47 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-47 state start-color) (-> v1-47 spec start-color)) + (set! (-> v1-47 state end-color) (-> v1-47 spec end-color)) + ) + ) + ) + (set! (-> v1-47 state mode) (the-as lightning-mode a0-14)) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the int f30-0)) + (suspend) + ) + ) + ) + (let ((v1-54 (-> self lightning)) + (a0-17 0) + ) + (let ((a1-30 (!= a0-17 (-> v1-54 state mode)))) + (case a0-17 + ((3) + (if a1-30 + (set! (-> v1-54 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-54 state start-color) (-> v1-54 spec start-color)) + (set! (-> v1-54 state end-color) (-> v1-54 spec end-color)) + ) + ) + ) + (set! (-> v1-54 state mode) (the-as lightning-mode a0-17)) + ) + (notify-parent-of-death self) + (suspend) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior lightning-tracker-init lightning-tracker ((arg0 lightning-spec) (arg1 time-frame) (arg2 symbol) (arg3 process-drawable) (arg4 vector) (arg5 vector)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self target0) (process->handle arg3)) + (let ((s1-1 (ppointer->process (-> self parent)))) + (set! (-> self target1) (process->handle (the-as process (if (type? s1-1 process-drawable) + s1-1 + ) + ) + ) + ) + ) + (cond + ((>= 256 (the-as int arg4)) + (set! (-> self target-joint0) (the-as int arg4)) + (vector-identity! (-> self offset0)) + ) + (else + (set! (-> self target-joint0) -1) + (set! (-> self offset0 quad) (-> arg4 quad)) + ) + ) + (cond + ((>= 256 (the-as int arg5)) + (set! (-> self target-joint1) (the-as int arg5)) + (vector-identity! (-> self offset1)) + ) + (else + (set! (-> self target-joint1) -1) + (set! (-> self offset1 quad) (-> arg5 quad)) + ) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self callback) (the-as (function lightning-tracker none) arg2)) + (set! arg1 + (cond + ((> arg1 0) + (empty) + arg1 + ) + ((= arg1 -1) + 0 + ) + (else + (the-as + time-frame + (the int (rand-vu-float-range (-> arg0 duration) (+ (-> arg0 duration) (-> arg0 duration-rand)))) + ) + ) + ) + ) + (set! (-> self duration) (the-as uint arg1)) + (set! (-> self lightning) (new 'process 'lightning-control arg0 self 0.0)) + (let ((v1-21 (-> self lightning)) + (a0-17 0) + ) + (let ((a1-7 (!= a0-17 (-> v1-21 state mode)))) + (case a0-17 + ((3) + (if a1-7 + (set! (-> v1-21 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-21 state start-color) (-> v1-21 spec start-color)) + (set! (-> v1-21 state end-color) (-> v1-21 spec end-color)) + ) + ) + ) + (set! (-> v1-21 state mode) (the-as lightning-mode a0-17)) + ) + (go-virtual active) + (none) + ) + +;; WARN: Return type mismatch object vs symbol. +(defbehavior process-grab? process ((arg0 process) (arg1 symbol)) + (let ((a0-1 (command-get-process arg0 *target*))) + (the-as symbol (if a0-1 + (send-event a0-1 'change-mode 'grab (cond + ((= arg1 #t) + #f + ) + ((= arg1 'dead) + 'dead + ) + (else + #t + ) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defbehavior process-release? process ((arg0 process)) + (let* ((gp-0 (command-get-process arg0 *target*)) + (a0-2 (if (type? gp-0 process-focusable) + (the-as process-focusable gp-0) + ) + ) + ) + (the-as symbol (if (and a0-2 (logtest? (-> a0-2 focus-status) (focus-status grabbed))) + (send-event a0-2 'end-mode) + #t + ) + ) + ) + ) + +(defun camera-look-at ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (if gp-0 + (send-event *camera* 'change-target gp-0 arg1) + ) + gp-0 + ) + ) + +;; WARN: Return type mismatch object vs symbol. +(defun ja-anim-done? ((arg0 process)) + (with-pp + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as + symbol + (when gp-0 + (cond + ((type? gp-0 manipy) + (send-event gp-0 'query 'done) + ) + ((type? gp-0 process-drawable) + (when (not (logtest? (-> (the-as process-drawable gp-0) skel status) (joint-control-status spooling-not-last-block)) + ) + (let ((s5-0 pp)) + (set! pp gp-0) + (let ((v0-1 (the-as object (ja-done? 0)))) + (set! pp s5-0) + v0-1 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; WARN: Return type mismatch target vs process. +(defun camera-pov-from ((arg0 pair) (arg1 uint)) + (let ((gp-0 (the-as target (command-get-process arg0 *target*)))) + (when gp-0 + (when (= arg1 -10) + (set! arg1 (the-as uint 0)) + (when (> (-> gp-0 skel active-channels) 0) + (let ((v1-7 (get-art-by-name-method (-> gp-0 draw jgeo) "camera" (the-as type #f)))) + (if v1-7 + (set! arg1 (the-as uint (+ (-> (the-as joint v1-7) number) 1))) + ) + ) + ) + ) + (let ((v1-9 (process->ppointer gp-0))) + (set-setting! 'pov-handle (the-as joint v1-9) (the float arg1) (-> (the-as (pointer process) v1-9) 0 pid)) + ) + ) + (the-as process gp-0) + ) + ) + +(deftype med-res-level (process-drawable) + ((level-name basic :offset-assert 200) + (part-mode basic :offset-assert 204) + (index int32 :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 21 + :size-assert #xd4 + :flag-assert #x15006000d4 + (:methods + (idle () _type_ :state 20) + ) + ) + + +(defstate idle (med-res-level) + :virtual #t + :code (behavior () + (until #f + (let ((v1-1 (level-get *level* (the-as symbol (-> self level-name))))) + (cond + ((and v1-1 (= (-> v1-1 display?) 'special)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (if (nonzero? (-> self skel)) + (ja :num! (loop!)) + ) + ) + ((and v1-1 (= (-> v1-1 status) 'active)) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + (if (nonzero? (-> self skel)) + (ja :num! (loop!)) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior med-res-level) ja-post) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! med-res-level ((obj med-res-level) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (res-lump-struct arg0 'art-name structure)) + (s3-0 (res-lump-struct (-> obj entity) 'level structure)) + (v1-5 (res-lump-value (-> obj entity) 'index uint128 :time -1000000000.0)) + ) + (when s3-0 + (set! (-> obj level-name) (the-as basic s3-0)) + (set! (-> obj index) (the-as int v1-5)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton-by-name obj (the-as string s4-0)) + (logior! (-> obj draw status) (draw-control-status no-closest-distance)) + (if (nonzero? (-> obj draw)) + (go (method-of-object obj idle)) + ) + ) + ) + (none) + ) + +(defmethod deactivate part-spawner ((obj part-spawner)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + (if (nonzero? (-> obj sound)) + (stop! (-> obj sound)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +(defmethod is-in-view? part-spawner ((obj part-spawner)) + (sphere<-vector+r! (-> obj world-sphere) (-> obj root trans) (-> obj radius)) + (sphere-in-view-frustum? (-> obj world-sphere)) + ) + +(defstate active (part-spawner) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('stop) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self enable) #f) + #t + ) + (('start) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (set! (-> self enable) #t) + #t + ) + (('trans) + (let ((v0-1 (the-as object (-> (the-as vector (-> event param 0)) quad)))) + (set! (-> self root trans quad) (the-as uint128 v0-1)) + v0-1 + ) + ) + ) + ) + :code (behavior () + (until #f + (when (-> self enable) + (spawn (-> self part) (-> self root trans)) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +(defmethod init-from-entity! part-spawner ((obj part-spawner) (arg0 entity-actor)) + (local-vars (sv-16 string)) + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (set! (-> obj clock) (-> *display* part-clock)) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj root trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root quat) (-> arg0 quat)) + (vector-identity! (-> obj root scale)) + (set! (-> obj radius) 12288.0) + (set! (-> obj enable) + (not (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete)))) + ) + (set! (-> obj sound) (new 'process 'ambient-sound (-> obj entity) (-> obj root trans))) + (set! sv-16 "#f") + (set! (-> obj mode) + (the-as (pointer sparticle-launch-group) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + ) + (when (-> obj mode) + (let ((a0-15 (-> obj mode 0))) + (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) + (cond + ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) + (countdown (v1-27 (-> a0-15 length)) + (let* ((a1-8 (-> a0-15 launcher v1-27)) + (a3-2 (-> *part-id-table* (-> a1-8 launcher))) + ) + (when (nonzero? a3-2) + (let ((a2-7 (-> obj level part-engine))) + (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) + (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) + (set! (-> t0-7 next1) (the-as connectable a3-2)) + (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) + (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> obj root trans quad)) + (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + ) + (+! (-> a2-7 length) 1) + ) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status dead) #t) + (deactivate obj) + ) + (else + (set! (-> obj part) (create-launch-control a0-15 obj)) + (go (method-of-object obj active)) + ) + ) + ) + ) + ) + (go process-drawable-art-error sv-16) + (none) + ) + +(deftype launcher (process-drawable) + ((root-override collide-shape :offset 128) + (spring-height meters :offset-assert 200) + (camera state :offset-assert 204) + (active-distance float :offset-assert 208) + (seek-time time-frame :offset-assert 216) + (dest vector :inline :offset-assert 224) + (sound-id sound-id :offset-assert 240) + ) + :heap-base #x80 + :method-count-assert 23 + :size-assert #xf4 + :flag-assert #x17008000f4 + (:methods + (idle () _type_ :state 20) + (active () _type_ :state 21) + (deactivated () _type_ :state 22) + ) + ) + + +(defpartgroup group-beach-launcher + :id 6 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 78 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 79 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 80 :fade-after (meters 50) :falloff-to (meters 80)) + (sp-item 81 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +(defpart 77 + :init-specs ((sp-flt spt-num 1.5) + (sp-flt spt-x (meters 1.5)) + (sp-flt spt-y (meters -0.5)) + (sp-int spt-rot-x 5) + (sp-flt spt-r 4096.0) + (sp-flt spt-g 2867.2) + (sp-flt spt-b 3276.8) + (sp-flt spt-vel-y (meters 0.026666667)) + (sp-int spt-timer 270) + (sp-cpuinfo-flags distort) + (sp-int spt-next-time 180) + (sp-launcher-by-id spt-next-launcher 82) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 82 + :init-specs ((sp-flt spt-fade-b -4.551111)) + ) + +(defpart 78 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 1.8) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 79 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.8) (meters 1) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 80 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2f :page #xc)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.4) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-r 10.0 6.0 1.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-rnd-flt spt-b 10.0 6.0 1.0) + (sp-flt spt-a 80.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int-plain-rnd spt-timer 180 119 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 81 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 83 + :init-specs ((sp-flt spt-fade-a -0.18)) + ) + +(defpartgroup group-jungle-launcher + :id 7 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 84 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 85 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 86 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +(defpart 84 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 1.4) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 85 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.4) (meters 0.9) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpart 86 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defpartgroup group-swamp-launcher + :id 8 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 78 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 79 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 87 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +(defpart 87 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 16.0 1.0) + (sp-rnd-flt spt-g 16.0 16.0 1.0) + (sp-rnd-flt spt-b 5.0 2.5 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +(defbehavior cam-launcher-joystick camera-slave () + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((s5-0 (new-stack-matrix0)) + (gp-0 (vector-reset! (new 'stack-no-clear 'vector))) + ) + (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + (f0-1 (* -546.13336 f0-0)) + (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) f0-3) + ) + (vector-! gp-0 (-> self trans) (-> *camera* tpos-curr)) + (vector-matrix*! gp-0 gp-0 s5-0) + (vector+! (-> self trans) gp-0 (-> *camera* tpos-curr)) + ) + ) + ) + +(defstate cam-launcher-shortfall (camera-slave) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (if (= v1-0 'teleport) + #f + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector-flatten! gp-0 (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-normalize! gp-0 1.0) + (set! (-> self pivot-pt quad) (-> gp-0 quad)) + (vector+float*! gp-0 gp-0 (-> *camera* local-down) 1000.0) + (vector-normalize-copy! (-> self tracking inv-mat vector 2) gp-0 1.0) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :trans (behavior () + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (send-event *camera* 'teleport) + (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (send-event *camera* 'change-state cam-string (seconds 0.5)) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +(defbehavior cam-launcher-long-joystick camera-slave () + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((gp-0 (new-stack-matrix0))) + (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + (f0-1 (* -546.13336 f0-0)) + (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-3) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + (vector-normalize! (-> self view-flat) 4096.0) + ) + ) + +(defstate cam-launcher-longfall (camera-slave) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (if (= v1-0 'teleport) + #f + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (new 'stack-no-clear 'vector) + (vector-negate! (-> self view-flat) (-> self tracking inv-mat vector 2)) + (vector-normalize! (-> self view-flat) 4096.0) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) + ) + (none) + ) + :trans (behavior () + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (cam-slave-go cam-free-floating) + ) + (cam-launcher-long-joystick) + (none) + ) + :code (behavior () + (let ((gp-0 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + 0.0 + (send-event *camera* 'teleport) + (let* ((f0-4 (vector-dot (-> self velocity) (-> *camera* local-down))) + (f30-0 (* 0.975 f0-4)) + ) + (vector--float*! s4-0 (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector-! s4-0 s4-0 (-> self trans)) + (let ((f28-0 (vector-dot s4-0 (-> *camera* local-down)))) + (vector--float*! s5-0 s4-0 (-> *camera* local-down) f28-0) + (cond + ((< f28-0 f30-0) + (set! f30-0 f28-0) + ) + ((< 20480.0 f28-0) + (let ((f28-1 (+ -20480.0 f28-0))) + (let ((f0-8 (lerp f30-0 f28-1 0.005))) + (if (< f30-0 f0-8) + (set! f30-0 f0-8) + ) + ) + (if (< (* 0.09 f28-1) f30-0) + (set! f30-0 (* 0.09 f28-1)) + ) + ) + ) + ) + ) + (vector+float*! (-> self velocity) s5-0 (-> *camera* local-down) f30-0) + ) + ) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + (set! (-> self trans x) (-> *camera* tpos-curr x)) + (set! (-> self trans z) (-> *camera* tpos-curr z)) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (send-event *camera* 'change-state cam-string (seconds 0.5)) + ) + ) + (vector-reset! (-> self tracking follow-off)) + (vector+! (-> self tracking follow-pt) (-> *camera* tpos-curr-adj) (-> self tracking follow-off)) + (vector--float*! + (-> self tracking follow-pt) + (-> self tracking follow-pt) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) + (suspend) + ) + ) + #f + (none) + ) + ) + +(defstate idle (launcher) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('instant-death) + (go-virtual deactivated) + ) + (('trans) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) + (the-as object (update-transforms (-> self root-override))) + ) + ) + ) + ) + :trans (behavior () + (when (and *target* (and (>= (-> self active-distance) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (cond + ((send-event *target* 'query 'powerup (pickup-type eco-blue)) + (go-virtual active) + ) + (else + (let ((gp-0 'target-launch)) + (if (= (send-event *target* 'query 'mode) gp-0) + (send-event *target* 'end-mode) + ) + ) + ) + ) + (if (and (and *target* + (and (>= 32768.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + ) + (talker-spawn-func (-> *talker-speech* 322) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (none) + ) + :code (the-as (function none :behavior launcher) sleep-code) + ) + +(defstate active (launcher) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (when (or (= event-type 'touch) (= event-type 'attack)) + (set! (-> self state-time) (-> self clock frame-counter)) + (send-event proc 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) + ) + (the-as object (cond + ((= event-type 'instant-death) + (go-virtual deactivated) + ) + ((= event-type 'trans) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) + (the-as object (update-transforms (-> self root-override))) + ) + ) + ) + ) + :exit (behavior () + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 120) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (none) + ) + :trans (behavior () + (if (or (or (not *target*) (or (< (-> self active-distance) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (logtest? (focus-status teleporting) (-> *target* focus-status)) + ) + ) + (not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + ) + (go-virtual idle) + ) + (spawn (-> self part) (-> self root-override trans)) + (sound-play "launch-idle" :id (-> self sound-id)) + (if (and (and *target* (and (>= (+ 2867.2 (-> self root-override root-prim prim-core world-sphere w)) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ) + (send-event *target* 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) + ) + (none) + ) + :code (behavior () + (sound-play "launch-start") + (sleep-code) + (none) + ) + ) + +(defstate deactivated (launcher) + :virtual #t + :code (the-as (function none :behavior launcher) sleep-code) + ) + +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! launcher ((obj launcher) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-4) + ) + (set! (-> s4-0 nav-radius) 13926.4) + (let ((v1-6 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (update-transforms (-> obj root-override)) + (set! (-> obj active-distance) 409600.0) + (set! (-> obj spring-height) (res-lump-float arg0 'spring-height :default 163840.0)) + (let ((s4-1 (res-lump-value arg0 'mode uint128 :time -1000000000.0))) + (let ((v1-14 (-> obj level name))) + (set! (-> obj part) (create-launch-control + (cond + ((= v1-14 'beach) + (-> *part-group-id-table* 6) + ) + ((= v1-14 'swamp) + (-> *part-group-id-table* 8) + ) + (else + (-> *part-group-id-table* 7) + ) + ) + obj + ) + ) + ) + (let ((v1-20 (logand (the-as int s4-1) 255))) + (cond + ((= (the-as uint v1-20) 1) + (set! (-> obj camera) cam-launcher-longfall) + ) + ((= (the-as uint v1-20) 2) + (set! (-> obj camera) #f) + ) + (else + (set! (-> obj camera) cam-launcher-shortfall) + ) + ) + ) + ) + (let ((v1-25 (res-lump-struct arg0 'alt-vector vector))) + (when v1-25 + (set-vector! (-> obj dest) (-> v1-25 x) (-> v1-25 y) (-> v1-25 z) 1.0) + (set! (-> obj seek-time) (the-as time-frame (the int (* 300.0 (-> v1-25 w))))) + ) + ) + (set! (-> obj sound-id) (new-sound-id)) + (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) + (go (method-of-object obj idle)) + (none) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior launcher-init-by-other launcher ((arg0 vector) (arg1 float) (arg2 int) (arg3 float)) + (stack-size-set! (-> self main-thread) 128) + (let ((s2-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-4) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-7 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-7 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-7 prim-core collide-with)) + ) + (set! (-> self root-override) s2-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0) + (set-vector! (-> self root-override quat) 0.0 0.0 0.0 1.0) + (update-transforms (-> self root-override)) + (set! (-> self spring-height) arg1) + (set! (-> self active-distance) arg3) + (let ((v1-18 (-> self level name))) + (set! (-> self part) (create-launch-control + (cond + ((= v1-18 'beach) + (-> *part-group-id-table* 6) + ) + ((= v1-18 'swamp) + (-> *part-group-id-table* 8) + ) + (else + (-> *part-group-id-table* 7) + ) + ) + self + ) + ) + ) + (case (logand arg2 255) + ((1) + (set! (-> self camera) cam-launcher-longfall) + ) + ((2) + (set! (-> self camera) #f) + ) + (else + (set! (-> self camera) cam-launcher-shortfall) + ) + ) + (let ((v1-29 (res-lump-struct (-> self entity) 'alt-vector vector))) + (when v1-29 + (set-vector! (-> self dest) (-> v1-29 x) (-> v1-29 y) (-> v1-29 z) 1.0) + (set! (-> self seek-time) (the-as time-frame (the int (* 300.0 (-> v1-29 w))))) + ) + ) + (set! (-> self sound-id) (new-sound-id)) + (go-virtual idle) + (none) + ) + +(defstate active (touch-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-0 object)) + (case event-type + (('touched) + (let ((v1-1 (ppointer->process (-> self parent)))) + (when (!= v1-1 proc) + (cond + ((= (-> self event) 'attack) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer v1-1)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) (-> self event)) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 mode) (the-as symbol (-> self event-mode))) + (let* ((a2-3 *game-info*) + (a3-2 (+ (-> a2-3 attack-id) 1)) + ) + (set! (-> a2-3 attack-id) a3-2) + (set! (-> v1-5 id) a3-2) + ) + (set! (-> a1-1 param 1) (the-as uint v1-5)) + ) + (send-event-function proc a1-1) + ) + ) + ((-> self event) + (send-event proc (-> self event) :from v1-1) + ) + (else + (let ((t0-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> t0-5 from) (process->ppointer proc)) + (set! (-> t0-5 num-params) arg1) + (set! (-> t0-5 message) event-type) + (set! (-> t0-5 param 0) (-> event param 0)) + (set! (-> t0-5 param 1) (-> event param 1)) + (set! (-> t0-5 param 2) (-> event param 2)) + (set! (-> t0-5 param 3) (-> event param 3)) + (set! (-> t0-5 param 4) (-> event param 4)) + (set! (-> t0-5 param 5) (-> event param 5)) + (send-event-function v1-1 t0-5) + ) + ) + ) + ) + ) + ) + (('target) + (set! v0-0 (process->handle (the-as process (-> event param 0)))) + (set! (-> self target) (the-as handle v0-0)) + v0-0 + ) + (('event) + (set! (-> self event) (the-as symbol (-> event param 0))) + (set! v0-0 (-> event param 1)) + (set! (-> self event-mode) (the-as basic v0-0)) + v0-0 + ) + (('exit) + (set! v0-0 (-> event param 0)) + (set! (-> self run-function) (the-as (function object) v0-0)) + v0-0 + ) + (('eval) + ((the-as (function touch-tracker object) (-> event param 0)) self) + ) + (('function) + (set! v0-0 (-> event param 0)) + (set! (-> self callback) (the-as (function touch-tracker none) v0-0)) + v0-0 + ) + ) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (while ((-> self run-function)) + (let* ((gp-0 (handle->process (-> self target))) + (a0-4 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when a0-4 + (let* ((gp-1 (-> (the-as process-drawable a0-4) root)) + (a0-6 (if (type? gp-1 collide-shape) + gp-1 + ) + ) + ) + (if a0-6 + (set! (-> self root-override trans quad) + (-> (the-as collide-shape a0-6) root-prim prim-core world-sphere quad) + ) + ) + ) + ) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (update-transforms (-> self root-override)) + (let ((a1-3 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-3 options) (overlaps-others-options oo1)) + (set! (-> a1-3 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-3 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-3) + ) + (suspend) + ) + (let ((v1-21 (-> self root-override root-prim))) + (set! (-> v1-21 prim-core collide-as) (collide-spec)) + (set! (-> v1-21 prim-core collide-with) (collide-spec)) + ) + 0 + (suspend) + 0 + (none) + ) + ) + +;; WARN: Return type mismatch object vs none. +(defbehavior touch-tracker-init touch-tracker ((arg0 vector) (arg1 float) (arg2 time-frame)) + (let ((s4-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec jak enemy)) + (set! (-> v1-6 prim-core collide-with) (collide-spec + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-player-list + hit-by-others-list + collectable + pusher + ) + ) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 arg1) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-6) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-9 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> self root-override) s4-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set! (-> self duration) arg2) + (set! (-> self target) (the-as handle #f)) + (set! (-> self event) #f) + (set! (-> self callback) #f) + (set! (-> self run-function) (lambda :behavior touch-tracker + () + (< (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) + ) + ) + (set! (-> self event-hook) (-> (method-of-object self active) event)) + (go-virtual active) + (none) + ) + +(defmethod setup-explosion-collision explosion ((obj explosion)) + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 penetrate-using) (penetrate explode)) + (let ((v1-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-3 prim-core action) (collide-action solid)) + (set-vector! (-> v1-3 local-sphere) 0.0 0.0 0.0 0.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-3) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-6 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override event-self) 'touched) + 0 + (none) + ) + +(defmethod explosion-method-22 explosion ((obj explosion)) + 0 + (none) + ) + +(defbehavior explosion-init-by-other explosion ((arg0 explosion-init-params)) + (logclear! (-> self mask) (process-mask actor-pause movie)) + (setup-explosion-collision self) + (set! (-> self root-override trans quad) (-> arg0 spawn-point quad)) + (quaternion-copy! (-> self root-override quat) (-> arg0 spawn-quat)) + (set! (-> self root-override penetrate-using) (-> arg0 penetrate-using)) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 local-sphere w) (-> arg0 radius)) + (set! (-> v1-9 prim-core world-sphere w) (-> arg0 radius)) + (set! (-> v1-9 prim-core collide-with) (-> arg0 collide-with)) + ) + (let* ((v1-10 *game-info*) + (a0-9 (+ (-> v1-10 attack-id) 1)) + ) + (set! (-> v1-10 attack-id) a0-9) + (set! (-> self attack-id) a0-9) + ) + (let ((a0-10 (-> arg0 group))) + (when a0-10 + (set! (-> self duration) (-> a0-10 duration)) + (set! (-> self linger-duration) (-> a0-10 linger-duration)) + (set! (-> self part) (create-launch-control a0-10 self)) + ) + ) + (let ((v1-16 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> v1-16 sphere quad) (-> self root-override trans quad)) + (vector-reset! (-> v1-16 velocity)) + (set! (-> v1-16 sphere r) (* 2.0 (-> arg0 radius))) + (set! (-> v1-16 notify-radius) 204800.0) + (set! (-> v1-16 danger-level) 1.0) + (set! (-> v1-16 decay-rate) 0.0) + (set! (-> v1-16 flags) (traffic-danger-flags tdf0)) + (set! (-> v1-16 danger-type) (traffic-danger-type tdt5)) + (send-event *traffic-manager* 'add-danger-sphere v1-16) + ) + (explosion-method-22 self) + (go-virtual explode) + ) + +;; WARN: Return type mismatch (pointer process) vs none. +(defun explosion-spawn ((arg0 process-drawable) (arg1 type) (arg2 explosion-init-params)) + (let ((s4-0 (get-process *default-dead-pool* arg1 #x4000))) + (when s4-0 + (let ((t9-1 (method-of-type process activate))) + (t9-1 s4-0 arg0 (symbol->string (-> arg1 symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 explosion-init-by-other arg2) + (-> s4-0 ppointer) + ) + ) + (none) + ) + +(defstate explode (explosion) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (when v1-1 + (let ((a0-3 (-> (the-as process-drawable v1-1) root)) + (a1-2 (new 'stack-no-clear 'collide-query)) + ) + (let ((v1-4 (-> self root-override root-prim prim-core)) + (a0-5 (-> (the-as collide-shape a0-3) root-prim prim-core)) + ) + 0.0 + (set! (-> a1-2 start-pos quad) (-> v1-4 world-sphere quad)) + (vector-! (-> a1-2 move-dist) (the-as vector a0-5) (the-as vector v1-4)) + ) + (let ((v1-5 a1-2)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-2) 0.0) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (-> event param 0)) + (let ((v1-12 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-12 id) (-> self attack-id)) + (set! (-> v1-12 mode) 'explode) + (set! (-> a1-3 param 1) (the-as uint v1-12)) + ) + (send-event-function proc a1-3) + ) + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (set! (-> self start-time) (-> self clock frame-counter)) + (update-transforms (-> self root-override)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-0) + ) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (let ((a1-1 (-> self root-override trans))) + (spawn (-> self part) a1-1) + ) + (suspend) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self linger-duration))) + (suspend) + ) + (none) + ) + ) + +(defun process-drawable-random-point! ((arg0 process-drawable) (arg1 vector)) + (let ((v1-1 (-> arg0 node-list length)) + (s4-0 (-> arg0 root)) + ) + (cond + ((>= v1-1 7) + (let ((v1-2 (rand-vu-int-range 3 (+ v1-1 -1)))) + (vector<-cspace! arg1 (-> arg0 node-list data v1-2)) + ) + ) + ((and (nonzero? s4-0) (type? s4-0 collide-shape)) + (vector+! + arg1 + (the-as vector (-> (the-as collide-shape s4-0) root-prim prim-core)) + (rand-vu-sphere-point! arg1 (-> (the-as collide-shape s4-0) root-prim prim-core world-sphere w)) + ) + ) + (else + (vector+! arg1 (-> arg0 root trans) (rand-vu-sphere-point! arg1 (-> arg0 draw bounds w))) + ) + ) + ) + arg1 + ) + +(defun process-drawable-pair-random-point! ((arg0 process-drawable) (arg1 process-drawable) (arg2 vector) (arg3 float)) + (let ((s4-0 (new-stack-vector0)) + (s3-0 (new-stack-vector0)) + ) + (process-drawable-random-point! arg0 s4-0) + (process-drawable-random-point! arg1 s3-0) + (vector-lerp! arg2 s4-0 s3-0 arg3) + ) + ) diff --git a/goal_src/jak2/engine/common_objs/voicebox.gc b/goal_src/jak2/engine/common_objs/voicebox.gc index 83540ae8e0..b1394fb52b 100644 --- a/goal_src/jak2/engine/common_objs/voicebox.gc +++ b/goal_src/jak2/engine/common_objs/voicebox.gc @@ -347,7 +347,10 @@ :event (-> cam-string event) :enter (-> cam-string enter) :trans (behavior () - (if (or (not *camera*) (not (logtest? (-> *camera* master-options) 1)) (not (-> self child))) + (if (or (not *camera*) + (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (not (-> self child)) + ) (deactivate self) ) (none) diff --git a/goal_src/jak2/engine/common_objs/water-anim.gc b/goal_src/jak2/engine/common_objs/water-anim.gc index 976aa0fa14..87f2f59354 100644 --- a/goal_src/jak2/engine/common_objs/water-anim.gc +++ b/goal_src/jak2/engine/common_objs/water-anim.gc @@ -93,18 +93,18 @@ :bounds (static-spherem -20 0 0 110) ) -(defskelgroup skel-water-anim-under-pool water-anim-under 0 -1 - ((1 (meters 999999))) +(defskelgroup skel-water-anim-under-pool water-anim-under water-anim-under-pool-lod0-jg -1 + ((water-anim-under-pool-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 51) ) -(defskelgroup skel-water-anim-under-drainout water-anim-under 2 -1 - ((3 (meters 999999))) +(defskelgroup skel-water-anim-under-drainout water-anim-under water-anim-under-drainout-lod0-jg -1 + ((water-anim-under-drainout-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 20) ) -(defskelgroup skel-water-anim-under-fillup water-anim-under 4 -1 - ((5 (meters 999999))) +(defskelgroup skel-water-anim-under-fillup water-anim-under water-anim-under-fillup-lod0-jg -1 + ((water-anim-under-fillup-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 23) ) @@ -309,109 +309,107 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210] (defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (local-vars (v0-1 none)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'move-to) - (move-to-point! self (the-as vector (-> arg3 param 0))) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) - (set! (-> self mask) (the-as process-mask v0-1)) - v0-1 + (the-as + object + (case arg2 + (('move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('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) ) - ((= v1-0 'move-to-y) - (let ((a1-2 (new 'stack-no-clear 'vector))) - (set! (-> a1-2 quad) (-> self root trans quad)) - (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) - (move-to-point! self a1-2) - ) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) - (set! (-> self mask) (the-as process-mask v0-1)) - v0-1 - ) - ((= v1-0 'water) - (let* ((s5-0 (the-as object (-> arg3 param 0))) - (s4-0 (the-as object (-> arg3 param 1))) - (gp-0 (if (type? (the-as process s4-0) process-focusable) - (the-as uint s4-0) - ) - ) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('water) + (let* ((s5-0 (the-as object (-> arg3 param 0))) + (s4-0 (the-as object (-> arg3 param 1))) + (gp-0 (if (type? (the-as process s4-0) process-focusable) + (the-as uint s4-0) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags deadly)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) ) - (when (and (logtest? (-> self flags) (water-flags deadly)) - (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) - (the-as uint gp-0) - ) - (let ((v1-15 (-> self attack-event))) - (case v1-15 - ((#f) - ) - (('heat) - (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) - ) - (('drown-death 'lava 'dark-eco-pool) - (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer self)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'attack-invinc) - (set! (-> a1-10 param 0) (the-as uint #f)) - (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> a2-4 id) (-> self attack-id)) - (set! (-> a2-4 mode) v1-15) - (set! (-> a1-10 param 1) (the-as uint a2-4)) - ) - (send-event-function (the-as process-focusable gp-0) a1-10) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-4 id) (-> self attack-id)) + (set! (-> a2-4 mode) v1-15) + (set! (-> a1-10 param 1) (the-as uint a2-4)) ) + (send-event-function (the-as process-focusable gp-0) a1-10) ) - (send-event self 'notify 'attack) - ) - ) - (else - (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) - (let ((a1-13 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-13 from) (process->ppointer self)) - (set! (-> a1-13 num-params) 2) - (set! (-> a1-13 message) 'attack) - (set! (-> a1-13 param 0) (the-as uint #f)) - (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> a2-6 id) (-> self attack-id)) - (set! (-> a2-6 mode) v1-15) - (set! (-> a1-13 param 1) (the-as uint a2-6)) - ) - (send-event-function (the-as process-tree gp-0) a1-13) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer self)) + (set! (-> a1-13 num-params) 2) + (set! (-> a1-13 message) 'attack) + (set! (-> a1-13 param 0) (the-as uint #f)) + (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-6 id) (-> self attack-id)) + (set! (-> a2-6 mode) v1-15) + (set! (-> a1-13 param 1) (the-as uint a2-6)) ) + (send-event-function (the-as process-tree gp-0) a1-13) ) - (send-event self 'notify 'attack) - ) - ) + ) + (send-event self 'notify 'attack) + ) ) ) ) - (when (and (logtest? (-> self flags) (water-flags flow)) - (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) - ) - (let ((a0-40 (-> self flow))) - (if (nonzero? a0-40) - (push-process a0-40 (the-as process-focusable gp-0)) - ) - ) + ) + (when (and (logtest? (-> self flags) (water-flags flow)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + (push-process a0-40 (the-as process-focusable gp-0)) + ) ) ) ) - ((= v1-0 'visible) - (cond - ((-> arg3 param 0) - (set! (-> self visible) #t) - ) - (else - (set! (-> self visible) #f) - (logior! (-> self draw status) (draw-control-status no-draw)) - ) + ) + (('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 ) - ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) ) ) ) diff --git a/goal_src/jak2/engine/common_objs/water.gc b/goal_src/jak2/engine/common_objs/water.gc index 432072ada8..a553915841 100644 --- a/goal_src/jak2/engine/common_objs/water.gc +++ b/goal_src/jak2/engine/common_objs/water.gc @@ -701,7 +701,7 @@ (defmethod water-control-method-10 water-control ((obj water-control)) (local-vars - (sv-272 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-272 (function vector entity-actor skeleton-group vector object none :behavior manipy)) (sv-288 vector) (sv-304 entity-actor) ) @@ -818,9 +818,17 @@ (set! sv-304 (-> obj process entity)) (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) (t1-0 #f) + (t2-0 0) ) - 0 - ((the-as (function object object object object object object none) s2-1) s0-0 sv-272 sv-288 sv-304 t0-0 t1-0) + ((the-as (function object object object object object object object none) s2-1) + s0-0 + sv-272 + sv-288 + sv-304 + t0-0 + t1-0 + t2-0 + ) ) ) (-> s1-0 ppointer) @@ -1439,26 +1447,18 @@ ) (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) (set! (-> obj distort-time) (-> pp clock frame-counter)) - (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) - (s3-1 - (when s2-0 - (let ((t9-2 (method-of-type manipy activate))) - (t9-2 (the-as manipy s2-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s1-0 s2-0) - (s0-0 manipy-init) - (s5-1 (-> obj process entity)) - (t0-1 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s3-2) s1-0 s0-0 s4-1 s5-1 t0-1 t1-1) - ) - (-> s2-0 ppointer) - ) - ) - ) + (let ((s3-1 (process-spawn + manipy + :init manipy-init + s4-1 + (-> obj process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> obj process) + ) + ) + ) (when s3-1 (send-event (ppointer->process s3-1) 'anim-mode 'play1) (send-event (ppointer->process s3-1) 'anim "idle") diff --git a/goal_src/jak2/engine/data/art-h.gc b/goal_src/jak2/engine/data/art-h.gc index ac749b3119..2c1b568b0f 100644 --- a/goal_src/jak2/engine/data/art-h.gc +++ b/goal_src/jak2/engine/data/art-h.gc @@ -391,7 +391,7 @@ (get-skeleton-origin (_type_) vector 9) (lod-set! (_type_ int) none 10) (lods-assign! (_type_ lod-set) none 11) - (setup-masks (_type_ uint int) none 12) + (setup-masks (_type_ int int) none 12) (setup-cspace-and-add (_type_ art-joint-geo symbol) none 13) (do-joint-math (_type_ cspace-array joint-control) none 14) ) diff --git a/goal_src/jak2/engine/debug/editable-player.gc b/goal_src/jak2/engine/debug/editable-player.gc index a695bcd306..bce9ff1357 100644 --- a/goal_src/jak2/engine/debug/editable-player.gc +++ b/goal_src/jak2/engine/debug/editable-player.gc @@ -1508,272 +1508,273 @@ (defstate idle (editable-player) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'execute) - (let ((a2-1 (-> event param 0))) - (case a2-1 - ((28 27 35 29 31 32) - (editable-array-method-13 - (-> self current) - (the-as uint 15) - (the-as basic a2-1) - "click on the point to insert at (up target, down camera)" + (local-vars (v0-0 object)) + (the-as + object + (case event-type + (('execute) + (let ((a2-1 (-> event param 0))) + (case a2-1 + ((28 27 35 29 31 32) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 15) + (the-as basic a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ) + ((51 1 47 36 55 56) + (if (not (-> self left-handed)) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press x to confirm, square to cancel" + ) + ) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press down to confirm, left to cancel" + ) + ) ) - ) - ((51 1 47 36 55 56) - (if (not (-> self left-handed)) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press x to confirm, square to cancel" - ) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press down to confirm, left to cancel" - ) - ) - ) - (else - (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) - ) + ) + (else + (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) ) ) ) - ((= v1-0 'exit) - (deactivate self) - ) - ((= v1-0 'menu) - (set! v0-0 (the-as none (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0))))) - (set! (-> self close-menu-time) (the-as time-frame v0-0)) - v0-0 - ) - ((or (= v1-0 'on-enter) (= v1-0 'on-exit) (= v1-0 'on-inside)) - (let ((s4-0 (-> self current region))) - (when s4-0 - (let ((gp-1 (-> event param 0))) - (set! (-> *syntax-context* got-error?) #f) - (eval! *syntax-context* (the-as pair gp-1)) - (when (not (-> *syntax-context* got-error?)) - (set! (-> s4-0 changed) #t) - (cond - ((= event-type 'on-enter) - (set! (-> s4-0 on-enter) (the-as string gp-1)) - ) - ((= event-type 'on-inside) - (set! (-> s4-0 on-inside) (the-as string gp-1)) - ) - ((= event-type 'on-exit) - (set! (-> s4-0 on-exit) (the-as string gp-1)) - ) - ) + ) + (('exit) + (the-as object (deactivate self)) + ) + (('menu) + (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0)))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + (('on-enter 'on-exit 'on-inside) + (let ((s4-0 (-> self current region))) + (when s4-0 + (let ((gp-1 (-> event param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as pair gp-1)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-0 changed) #t) + (cond + ((= event-type 'on-enter) + (set! (-> s4-0 on-enter) (the-as string gp-1)) + ) + ((= event-type 'on-inside) + (set! (-> s4-0 on-inside) (the-as string gp-1)) + ) + ((= event-type 'on-exit) + (set! (-> s4-0 on-exit) (the-as string gp-1)) + ) ) ) - (set! v0-0 (the-as none (editable-region-method-12 s4-0))) - (set! (-> s4-0 filter) (the-as editable-filter v0-0)) - v0-0 + ) + (set! v0-0 (editable-region-method-12 s4-0)) + (set! (-> s4-0 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + (('select) + (let ((gp-2 (-> event param 0))) + (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) + (let* ((s5-1 (-> self current length)) + (s4-1 0) + (a0-36 (-> self current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) + (logtest? (-> a0-36 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-36 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) + (set! (-> self current region) (-> a0-36 region)) + (select-editable! a0-36 #t) + ) + ) + (+! s4-1 1) + (set! a0-36 (-> self current data s4-1)) ) ) ) - ((= v1-0 'select) - (let ((gp-2 (-> event param 0))) - (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) - (let* ((s5-1 (-> self current length)) - (s4-1 0) - (a0-36 (-> self current data s4-1)) - ) - (while (< s4-1 s5-1) - (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) - (logtest? (-> a0-36 region filter) (-> self current filter 1)) - ) - (logtest? (-> a0-36 flags) (editable-flag selected)) - ) + #f + ) + (('name) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (s3-0 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-60 (if (type? s3-0 editable) + s3-0 + ) ) - (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) - (set! (-> self current region) (-> a0-36 region)) - (select-editable! a0-36 #t) + ) + (when v1-60 + (set! (-> v1-60 name) (the-as string (-> event param 0))) + (logior! (-> v1-60 flags) (editable-flag changed)) + (let ((v1-61 (-> v1-60 region))) + (if v1-61 + (set! (-> v1-61 changed) #t) + ) ) ) - (+! s4-1 1) - (set! a0-36 (-> self current data s4-1)) ) ) + (+! s4-2 1) + (set! s3-0 (-> self current data s4-2)) ) - #f ) - ((= v1-0 'name) - (let* ((s5-2 (-> self current length)) - (s4-2 0) - (s3-0 (-> self current data s4-2)) - ) - (while (< s4-2 s5-2) - (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) - (let ((v1-60 (if (type? s3-0 editable) - s3-0 - ) - ) + #f + ) + (('level) + (let ((gp-3 (lookup-level-info (the-as symbol (-> event param 0))))) + (when (-> gp-3 dbname) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-73 (if (type? s3-1 editable) + s3-1 + ) + ) + ) + (when (and v1-73 (-> v1-73 region)) + (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) + (set! (-> v1-73 region changed) #t) ) - (when v1-60 - (set! (-> v1-60 name) (the-as string (-> event param 0))) - (logior! (-> v1-60 flags) (editable-flag changed)) - (let ((v1-61 (-> v1-60 region))) - (if v1-61 - (set! (-> v1-61 changed) #t) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + ) + ) + (('get-level) + (-> self current level) + ) + (('direction) + (let* ((f30-0 (the-as float (-> event param 0))) + (f28-0 (the-as float (-> event param 1))) + (f26-0 (the-as float (-> event param 2))) + (f24-0 (if (and (zero? (-> event param 0)) (zero? (-> event param 1)) (zero? (-> event param 2))) + 0.0 + 1.0 ) ) - ) - ) - ) - (+! s4-2 1) - (set! s3-0 (-> self current data s4-2)) - ) - ) - #f - ) - ((= v1-0 'level) - (let ((gp-3 (lookup-level-info (the-as symbol (-> event param 0))))) - (when (-> gp-3 dbname) - (let* ((s5-3 (-> self current length)) - (s4-3 0) - (s3-1 (-> self current data s4-3)) - ) - (while (< s4-3 s5-3) - (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) - (let ((v1-73 (if (type? s3-1 editable) - s3-1 - ) - ) + (gp-4 (-> self current length)) + (s5-4 0) + (s4-4 (-> self current data s5-4)) + ) + (while (< s5-4 gp-4) + (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) + (let ((s3-2 (if (type? s4-4 editable-light) + (the-as editable-light s4-4) + ) ) - (when (and v1-73 (-> v1-73 region)) - (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) - (set! (-> v1-73 region changed) #t) - ) - ) ) - (+! s4-3 1) - (set! s3-1 (-> self current data s4-3)) + (when s3-2 + (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> s3-2 direction) 1.0) + (logior! (-> s3-2 flags) (editable-flag changed)) + (let ((a0-73 (-> s3-2 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) ) ) - #f ) + (+! s5-4 1) + (set! s4-4 (-> self current data s5-4)) ) ) - ((= v1-0 'get-level) - (-> self current level) - ) - ((= v1-0 'direction) - (let* ((f30-0 (the-as float (-> event param 0))) - (f28-0 (the-as float (-> event param 1))) - (f26-0 (the-as float (-> event param 2))) - (f24-0 (if (and (zero? (-> event param 0)) (zero? (-> event param 1)) (zero? (-> event param 2))) - 0.0 - 1.0 - ) - ) - (gp-4 (-> self current length)) - (s5-4 0) - (s4-4 (-> self current data s5-4)) - ) - (while (< s5-4 gp-4) - (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) - (let ((s3-2 (if (type? s4-4 editable-light) - (the-as editable-light s4-4) + #f + ) + (('color) + (let* ((f30-1 (the-as float (-> event param 0))) + (f28-1 (the-as float (-> event param 1))) + (f26-1 (the-as float (-> event param 2))) + (f24-1 (the-as float (-> event param 3))) + (gp-5 (-> self current length)) + (s5-5 0) + (s4-5 (-> self current data s5-5)) + ) + (while (< s5-5 gp-5) + (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) + (let ((v1-114 (if (type? s4-5 editable-light) + (the-as editable-light s4-5) ) ) - ) - (when s3-2 - (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) - (vector-normalize! (-> s3-2 direction) 1.0) - (logior! (-> s3-2 flags) (editable-flag changed)) - (let ((a0-73 (-> s3-2 region))) - (if a0-73 - (set! (-> a0-73 changed) #t) - ) - ) + ) + (when v1-114 + (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) + (logior! (-> v1-114 flags) (editable-flag changed)) + (let ((v1-115 (-> v1-114 region))) + (if v1-115 + (set! (-> v1-115 changed) #t) + ) ) ) ) - (+! s5-4 1) - (set! s4-4 (-> self current data s5-4)) ) + (+! s5-5 1) + (set! s4-5 (-> self current data s5-5)) ) - #f ) - ((= v1-0 'color) - (let* ((f30-1 (the-as float (-> event param 0))) - (f28-1 (the-as float (-> event param 1))) - (f26-1 (the-as float (-> event param 2))) - (f24-1 (the-as float (-> event param 3))) - (gp-5 (-> self current length)) - (s5-5 0) - (s4-5 (-> self current data s5-5)) - ) - (while (< s5-5 gp-5) - (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) - (let ((v1-114 (if (type? s4-5 editable-light) - (the-as editable-light s4-5) - ) - ) - ) - (when v1-114 - (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) - (logior! (-> v1-114 flags) (editable-flag changed)) - (let ((v1-115 (-> v1-114 region))) - (if v1-115 - (set! (-> v1-115 changed) #t) - ) - ) - ) - ) - ) - (+! s5-5 1) - (set! s4-5 (-> self current data s5-5)) + #f + ) + (('param) + (let ((s5-6 (-> event param 0)) + (f30-2 (the-as float (-> event param 1))) ) - ) - #f - ) - ((= v1-0 'param) - (let ((s5-6 (-> event param 0)) - (f30-2 (the-as float (-> event param 1))) - ) - (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) - (let* ((gp-6 (-> self current length)) - (s4-6 0) - (s3-3 (-> self current data s4-6)) - ) - (while (< s4-6 gp-6) - (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) - (let ((v1-129 (if (type? s3-3 editable-light) - s3-3 - ) - ) - ) - (when v1-129 - (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) - (logior! (-> v1-129 flags) (editable-flag changed)) - (let ((v1-130 (-> v1-129 region))) - (if v1-130 - (set! (-> v1-130 changed) #t) - ) - ) + (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) + (let* ((gp-6 (-> self current length)) + (s4-6 0) + (s3-3 (-> self current data s4-6)) + ) + (while (< s4-6 gp-6) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-129 (if (type? s3-3 editable-light) + s3-3 + ) + ) + ) + (when v1-129 + (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) + (logior! (-> v1-129 flags) (editable-flag changed)) + (let ((v1-130 (-> v1-129 region))) + (if v1-130 + (set! (-> v1-130 changed) #t) + ) ) ) ) - (+! s4-6 1) - (set! s3-3 (-> self current data s4-6)) ) + (+! s4-6 1) + (set! s3-3 (-> self current data s4-6)) ) - #f ) + #f ) ) - ) + ) ) ) ) diff --git a/goal_src/jak2/engine/game/settings-h.gc b/goal_src/jak2/engine/game/settings-h.gc index baa551e500..ad2e18edf2 100644 --- a/goal_src/jak2/engine/game/settings-h.gc +++ b/goal_src/jak2/engine/game/settings-h.gc @@ -47,6 +47,16 @@ (IMMEDIATE_STRING_MIN_MAX) ;; 80 ) +(defenum cam-slave-options-u32 + :type uint32 + :bitfield #t + :copy-entries cam-slave-options) + +(defenum cam-master-options-u32 + :type uint32 + :bitfield #t + :copy-entries cam-master-options) + (declare-type setting-control basic) (define-extern *setting-control* setting-control) diff --git a/goal_src/jak2/engine/gfx/foreground/foreground.gc b/goal_src/jak2/engine/gfx/foreground/foreground.gc index ba417a7a25..993a818b81 100644 --- a/goal_src/jak2/engine/gfx/foreground/foreground.gc +++ b/goal_src/jak2/engine/gfx/foreground/foreground.gc @@ -7,3 +7,5 @@ ;; DECOMP BEGINS +;; this is wrong, just a placeholder +(define *default-shadow-settings* (new 'static 'shadow-settings)) \ No newline at end of file diff --git a/goal_src/jak2/engine/gfx/foreground/shadow-cpu-h.gc b/goal_src/jak2/engine/gfx/foreground/shadow-cpu-h.gc index 12e8fe3218..687c6c05cb 100644 --- a/goal_src/jak2/engine/gfx/foreground/shadow-cpu-h.gc +++ b/goal_src/jak2/engine/gfx/foreground/shadow-cpu-h.gc @@ -44,7 +44,7 @@ :size-assert #x60 :flag-assert #xf00000060 (:methods - (new (symbol type float float float float float) _type_ 0) + (new (symbol type float float float shadow-flags float) _type_ 0) (clear-offset-bit (shadow-control) int 9) (set-offset-bit (shadow-control) int 10) (set-top-plane-offset (shadow-control float) int 11) @@ -242,9 +242,16 @@ ) -(defmethod new shadow-control ((allocation symbol) (type-to-make type) (arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float)) +(defmethod new shadow-control ((allocation symbol) + (type-to-make type) + (arg0 float) + (arg1 float) + (arg2 float) + (arg3 shadow-flags) + (arg4 float) + ) (let ((v0-0 (object-new allocation type-to-make (the-as int (-> type-to-make size))))) - (set! (-> v0-0 settings flags) (the-as shadow-flags arg3)) + (set! (-> v0-0 settings flags) arg3) (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/jak2/engine/gfx/lightning-h.gc b/goal_src/jak2/engine/gfx/lightning-h.gc index 82bc3a6ac8..417f571d49 100644 --- a/goal_src/jak2/engine/gfx/lightning-h.gc +++ b/goal_src/jak2/engine/gfx/lightning-h.gc @@ -32,6 +32,7 @@ ;; ---lightning-mode (declare-type lightning-spec basic) +(declare-type lightning-tracker process) (define-extern *lightning-spec-id-table* (array lightning-spec)) ;; DECOMP BEGINS diff --git a/goal_src/jak2/engine/gfx/mood/time-of-day.gc b/goal_src/jak2/engine/gfx/mood/time-of-day.gc index f0137f9431..be1804e4ea 100644 --- a/goal_src/jak2/engine/gfx/mood/time-of-day.gc +++ b/goal_src/jak2/engine/gfx/mood/time-of-day.gc @@ -150,87 +150,84 @@ ) ) -;; failed to figure out what this is: (defstate time-of-day-tick (time-of-day-proc) - :event (behavior ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'change) - (case (-> arg3 param 0) - (('ratio) - (let ((a0-5 (-> *display* bg-clock)) - (f0-0 (the-as float (-> arg3 param 1))) - ) - (set! (-> self time-ratio) f0-0) - (set! (-> self dest-time-ratio) f0-0) - (update-rates! a0-5 f0-0) - ) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as + object + (case event-type + (('change) + (case (-> event param 0) + (('ratio) + (let ((a0-5 (-> *display* bg-clock)) + (f0-0 (the-as float (-> event param 1))) + ) + (set! (-> self time-ratio) f0-0) + (set! (-> self dest-time-ratio) f0-0) + (update-rates! a0-5 f0-0) ) - (('hour) - (update-counters) - (let ((v1-7 (-> *display* bg-clock frame-counter)) - (a0-7 #x69780) - (a1-5 (/ (the int (* 1080000.0 (the float (-> arg3 param 1)))) 60)) - ) - (set! (-> *display* bg-clock frame-counter) (+ (- v1-7 (the-as time-frame (mod v1-7 a0-7))) a0-7 a1-5)) - ) - (update-counters) - (-> self hours) - (kill-and-free-particles (-> self sun)) - (spawn (-> self sun) (math-camera-pos)) - (set! (-> self sun-count) 1) - (kill-and-free-particles (-> self green-sun)) - (spawn (-> self green-sun) (math-camera-pos)) - (set! (-> self green-sun-count) 1) - (kill-and-free-particles (-> self moon)) - (spawn (-> self moon) (math-camera-pos)) - (let ((v0-0 (the-as number 1))) - (set! (-> self moon-count) (the-as int v0-0)) - v0-0 - ) + ) + (('hour) + (update-counters) + (let ((v1-7 (-> *display* bg-clock frame-counter)) + (a0-7 #x69780) + (a1-5 (/ (the int (* 1080000.0 (the float (-> event param 1)))) 60)) + ) + (set! (-> *display* bg-clock frame-counter) (+ (- v1-7 (the-as time-frame (mod v1-7 a0-7))) a0-7 a1-5)) ) + (update-counters) + (-> self hours) + (kill-and-free-particles (-> self sun)) + (spawn (-> self sun) (math-camera-pos)) + (set! (-> self sun-count) 1) + (kill-and-free-particles (-> self green-sun)) + (spawn (-> self green-sun) (math-camera-pos)) + (set! (-> self green-sun-count) 1) + (kill-and-free-particles (-> self moon)) + (spawn (-> self moon) (math-camera-pos)) + (let ((v0-0 (the-as number 1))) + (set! (-> self moon-count) (the-as int v0-0)) + v0-0 + ) + ) + ) + ) + (('ratio) + (-> self time-ratio) + ) + (('day-length) + (if (= (-> self time-ratio) 0.0) + 0 + (/ 25920000.0 (-> self time-ratio)) ) - ) - ((= v1-0 'ratio) - (-> self time-ratio) - ) - ((= v1-0 'day-length) - (if (= (-> self time-ratio) 0.0) - 0 - (/ 25920000.0 (-> self time-ratio)) + ) + (('time-frame) + (-> self frames) + ) + (('time-of-day) + (-> self time-of-day) + ) + (('time-of-day-norm) + (* 0.041666668 (-> self time-of-day)) + ) + (('hour) + (-> self hours) + ) + (('minute) + (-> self minutes) + ) + (('second) + (-> self seconds) + ) + (('dest-clock-ratio-set) + (set! (-> self dest-time-ratio) (the-as float (-> event param 0))) + (let ((f0-12 (-> self time-ratio)) + (f1-5 (-> self dest-time-ratio)) + (f2-1 (/ 300.0 (the float (-> event param 1)))) ) + (set! (-> self dest-time-delta) (* (fabs (- f0-12 f1-5)) f2-1 (-> *display* real-clock seconds-per-frame))) ) - ((= v1-0 'time-frame) - (-> self frames) - ) - ((= v1-0 'time-of-day) - (-> self time-of-day) - ) - ((= v1-0 'time-of-day-norm) - (* 0.041666668 (-> self time-of-day)) - ) - ((= v1-0 'hour) - (-> self hours) - ) - ((= v1-0 'minute) - (-> self minutes) - ) - ((= v1-0 'second) - (-> self seconds) - ) - ((= v1-0 'dest-clock-ratio-set) - (set! (-> self dest-time-ratio) (the-as float (-> arg3 param 0))) - (let ((f0-12 (-> self time-ratio)) - (f1-5 (-> self dest-time-ratio)) - (f2-1 (/ 300.0 (the float (-> arg3 param 1)))) - ) - (set! (-> self dest-time-delta) (* (fabs (- f0-12 f1-5)) f2-1 (-> *display* real-clock seconds-per-frame))) - ) - (-> self dest-time-ratio) - ) - ) + (-> self dest-time-ratio) + ) ) ) ) diff --git a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc index ac03f714e2..49ba2eca07 100644 --- a/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc +++ b/goal_src/jak2/engine/gfx/sprite/particles/sparticle-launcher-h.gc @@ -133,6 +133,7 @@ (unk-5 5) (unk-6 6) (unk-7 7) + (unk-8 8) ) ;; ---sp-group-flag diff --git a/goal_src/jak2/engine/process-drawable/process-drawable.gc b/goal_src/jak2/engine/process-drawable/process-drawable.gc index a90f648cae..7adf3dd6c0 100644 --- a/goal_src/jak2/engine/process-drawable/process-drawable.gc +++ b/goal_src/jak2/engine/process-drawable/process-drawable.gc @@ -60,6 +60,19 @@ (init-vf0-vector) (.lvf vf2 (&-> (-> arg1 bone) transform trans quad)) (.div.vf Q vf0 vf2 :fsf #b11 :ftf #b11) + + ;; ADDED (also added in jak1) + ;; there's a bug in swamp-blimp where they vector<-cspace! + ;; on some default-initialized-to-zero bones + ;; we have to return 0s for this to avoid NaNs getting everywhere. + (let ((temp (new-stack-vector0))) + (.svf (&-> temp quad) vf2) + (when (= (-> temp w) 0.0) + (set-vector! arg0 0. 0. 0. 1.) + (return arg0) + ) + ) + (.wait.vf) (.mul.vf vf2 vf2 Q :mask #b111) (.nop.vf) @@ -198,7 +211,7 @@ (set! (-> obj mgeo) (-> obj lod-set lod v1-1 geo)) (set! (-> obj cur-lod) v1-1) (if (nonzero? (-> obj seg-mask)) - (setup-masks obj (the-as uint 0) 0) + (setup-masks obj 0 0) ) ) ) @@ -216,7 +229,7 @@ (none) ) -(defmethod setup-masks draw-control ((obj draw-control) (arg0 uint) (arg1 int)) +(defmethod setup-masks draw-control ((obj draw-control) (arg0 int) (arg1 int)) (local-vars (v1-4 int) (a2-1 (array uint64))) (let ((a1-2 (logior (logclear (-> obj seg-mask) arg0) arg1))) (set! (-> obj seg-mask) a1-2) diff --git a/goal_src/jak2/engine/process-drawable/process-taskable.gc b/goal_src/jak2/engine/process-drawable/process-taskable.gc index a00bd31d6e..ec5a837ca4 100644 --- a/goal_src/jak2/engine/process-drawable/process-taskable.gc +++ b/goal_src/jak2/engine/process-drawable/process-taskable.gc @@ -76,15 +76,15 @@ (defstate hide (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'say) - (let ((v0-0 (-> self clock frame-counter))) - (set! (-> self want-to-say) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('say) + (let ((v0-0 (-> self clock frame-counter))) + (set! (-> self want-to-say) v0-0) + v0-0 + ) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) @@ -430,7 +430,7 @@ (set! (-> obj talk-height) (res-lump-float (-> obj entity) 'height :default 8192.0)) (set! (-> obj slave) (the-as handle #f)) (set! (-> obj draw shadow-ctrl) - (new 'process 'shadow-control 0.0 0.0 614400.0 0.000000000000000000000000000000000000000000084 245760.0) + (new 'process 'shadow-control 0.0 0.0 614400.0 (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0) ) (let ((s5-0 0)) (let ((v1-15 (the-as joint (get-art-by-name-method (-> obj draw jgeo) "main" (the-as type #f))))) @@ -472,26 +472,8 @@ (format (clear *temp-string*) "skel-~S" (-> obj draw art-group name)) (let ((s4-3 (s4-2 s5-1 *temp-string* (the-as (pointer uint32) #f)))) (when s4-3 - (let* ((s3-2 (get-process *default-dead-pool* manipy #x4000)) - (s5-2 - (when s3-2 - (let ((t9-12 (method-of-type manipy activate))) - (t9-12 (the-as manipy s3-2) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-14 s3-2) - (a1-10 manipy-init) - (a2-9 (-> obj root-override trans)) - (a3-3 (-> obj entity)) - (t1-2 #f) - ) - 0 - ((the-as (function object object object object object object none) t9-13) a0-14 a1-10 a2-9 a3-3 s4-3 t1-2) - ) - (-> s3-2 ppointer) - ) - ) - ) + (let ((s5-2 (process-spawn manipy :init manipy-init (-> obj root-override trans) (-> obj entity) s4-3 #f 0 :to obj)) + ) (send-event (ppointer->process s5-2) 'anim-mode 'mirror) (send-event (ppointer->process s5-2) 'mirror #t) ) @@ -503,5 +485,3 @@ (go (method-of-object obj hide)) (none) ) - - diff --git a/goal_src/jak2/engine/process-drawable/simple-focus.gc b/goal_src/jak2/engine/process-drawable/simple-focus.gc index 3bc35286a5..92e7989ec5 100644 --- a/goal_src/jak2/engine/process-drawable/simple-focus.gc +++ b/goal_src/jak2/engine/process-drawable/simple-focus.gc @@ -21,8 +21,8 @@ (defmethod get-trans simple-focus ((obj simple-focus) (arg0 int)) - "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]]" - (-> obj root trans) + "@returns the `trans` [[vector]] from the process's `root` (typically either a [[trsqv]] or a [[collide-shape]])" + (-> obj root-override trans) ) (defmethod run-logic? simple-focus ((obj simple-focus)) @@ -35,15 +35,15 @@ (defstate idle (simple-focus) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'move-trans) - (let ((v0-0 (-> self root trans))) - (set! (-> v0-0 quad) (-> (the-as vector (-> event param 0)) quad)) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('move-trans) + (let ((v0-0 (-> self root-override trans))) + (set! (-> v0-0 quad) (-> (the-as vector (-> event param 0)) quad)) + v0-0 + ) + ) + ) + ) ) :code (the-as (function none :behavior simple-focus) sleep-code) ) @@ -52,7 +52,7 @@ (defbehavior simple-focus-init-by-other simple-focus () "Initializes the new [[simple-focus]]. `first-time?` will be set to [[#t]]" (let ((root (new 'process 'trsqv))) - (set! (-> self root) root) + (set! (-> self root-override) (the-as collide-shape root)) (vector-identity! (-> root scale)) (quaternion-identity! (-> root quat)) ) diff --git a/goal_src/jak2/engine/scene/scene.gc b/goal_src/jak2/engine/scene/scene.gc index de2712a07c..ae87df8371 100644 --- a/goal_src/jak2/engine/scene/scene.gc +++ b/goal_src/jak2/engine/scene/scene.gc @@ -92,27 +92,24 @@ ) ) (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) - (set! s4-0 - (when sv-96 - (let ((t9-7 (method-of-type manipy activate))) - (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-11 sv-96) - (a1-9 manipy-init) - (a2-3 (-> arg0 root trans)) - (a3-1 s1-1) - (t0-0 s2-0) - (t1-0 #f) - ) - (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) - 1 - 0 - ) - ((the-as (function object object object object object object none) t9-8) a0-11 a1-9 a2-3 a3-1 t0-0 t1-0) - ) - (-> sv-96 ppointer) - ) + (set! s4-0 (when sv-96 + (let ((t9-7 (method-of-type manipy activate))) + (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) + ) + (run-now-in-process + sv-96 + manipy-init + (-> arg0 root trans) + s1-1 + s2-0 + #f + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ) + (-> sv-96 ppointer) + ) ) (set! (-> arg0 level) s0-0) (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) @@ -172,23 +169,14 @@ ) (when (and s4-0 (logtest? (-> obj flags) 2)) (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) - (let ((s0-1 - (when sv-112 - (let ((t9-24 (method-of-type manipy activate))) - (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) - ) - (let ((t9-25 run-function-in-process) - (a0-51 sv-112) - (a1-26 manipy-init) - (a2-8 (-> arg0 root trans)) - (t1-1 #f) + (let ((s0-1 (when sv-112 + (let ((t9-24 (method-of-type manipy activate))) + (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) ) - 0 - ((the-as (function object object object object object object none) t9-25) a0-51 a1-26 a2-8 s1-1 s2-0 t1-1) + (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) + (-> sv-112 ppointer) + ) ) - (-> sv-112 ppointer) - ) - ) ) (send-event (ppointer->process s0-1) 'mirror #t) (send-event (ppointer->process s0-1) 'anim-mode 'mirror) @@ -346,42 +334,40 @@ ;; WARN: Return type mismatch basic vs scene. (defun scene-lookup ((arg0 basic)) "TODO - basic can be a string or a scene" - (let ((v1-0 (-> arg0 type))) - (the-as - scene - (cond - ((= v1-0 string) - (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) - (when (type? s5-0 scene) - (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) - (when (and s5-0 gp-0) - (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) - (when v1-5 - (dotimes (a0-6 6) - (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) - (goto cfg-15) - ) - ) - (format - 0 - "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" - (-> gp-0 name) - (-> v1-5 name) - ) - (return (the-as scene #f)) + (the-as + scene + (case (-> arg0 type) + ((string) + (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) + (when (type? s5-0 scene) + (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) + (when (and s5-0 gp-0) + (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) + (when v1-5 + (dotimes (a0-6 6) + (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) + (goto cfg-15) + ) ) + (format + 0 + "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" + (-> gp-0 name) + (-> v1-5 name) + ) + (return (the-as scene #f)) ) ) ) - (label cfg-15) - s5-0 ) + (label cfg-15) + s5-0 ) ) - ((= v1-0 scene) - arg0 - ) - ) + ) + ((scene) + arg0 + ) ) ) ) diff --git a/goal_src/jak2/engine/target/board/board-states.gc b/goal_src/jak2/engine/target/board/board-states.gc index 4751b828ed..b806d8e933 100644 --- a/goal_src/jak2/engine/target/board/board-states.gc +++ b/goal_src/jak2/engine/target/board/board-states.gc @@ -409,26 +409,18 @@ (-> s5-0 ppointer) ) ) - (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) - (s5-1 - (when s4-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-2 run-function-in-process) - (s3-0 s4-0) - (s2-0 manipy-init) - (s1-0 (-> self entity)) - (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) - ) - (-> s4-0 ppointer) - ) - ) - ) + (let ((s5-1 (process-spawn + manipy + :init manipy-init + gp-0 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when s5-1 (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s5-1) 'anim-mode 'play1) @@ -893,7 +885,7 @@ ) :enter (behavior ((arg0 meters) (arg1 meters) (arg2 symbol)) (local-vars - (sv-144 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-144 (function vector entity-actor skeleton-group vector object none :behavior manipy)) (sv-160 entity-actor) ) (if (= arg2 'hit) @@ -968,9 +960,17 @@ (set! sv-160 (-> self entity)) (let ((t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) (t1-1 #f) + (t2-1 0) ) - 0 - ((the-as (function object object object object object object none) s2-3) s0-1 sv-144 s3-2 sv-160 t0-2 t1-1) + ((the-as (function object object object object object object object none) s2-3) + s0-1 + sv-144 + s3-2 + sv-160 + t0-2 + t1-1 + t2-1 + ) ) ) (-> s1-1 ppointer) diff --git a/goal_src/jak2/engine/target/logic-target.gc b/goal_src/jak2/engine/target/logic-target.gc index e78496aee1..f8cb5f6248 100644 --- a/goal_src/jak2/engine/target/logic-target.gc +++ b/goal_src/jak2/engine/target/logic-target.gc @@ -8,7 +8,6 @@ (define-extern history-draw (function history-iterator none)) (define-extern target-sidekick-setup (function symbol none :behavior target)) (define-extern target-board-setup (function symbol none :behavior target)) -(define-extern manipy-init (function vector entity-actor skeleton-group vector none :behavior manipy)) (define-extern target-float (state target)) (define-extern target-timed-invulnerable-off (function target int none)) (define-extern target-gun-joint-pre (function none :behavior target)) @@ -1665,27 +1664,18 @@ (set! (-> self mirror) (the-as (pointer process-drawable) #f)) ) (else - (let* ((s5-0 (get-process *default-dead-pool* manipy #x4000)) - (gp-1 - (when s5-0 - (let ((t9-12 (method-of-type manipy activate))) - (t9-12 (the-as manipy s5-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-2 run-function-in-process) - (s4-0 s5-0) - (s3-0 manipy-init) - (s2-0 (-> self control trans)) - (s1-0 (-> self entity)) - (t0-0 (art-group-get-by-name *level* "skel-jchar" (the-as (pointer uint32) #f))) - (t1-0 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-2) s4-0 s3-0 s2-0 s1-0 t0-0 t1-0) - ) - (-> s5-0 ppointer) - ) - ) - ) + (let ((gp-1 (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-jchar" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (send-event (ppointer->process gp-1) 'anim-mode 'mirror) (send-event (ppointer->process gp-1) 'mirror #t) (set! (-> self mirror) (the-as (pointer process-drawable) gp-1)) @@ -1825,11 +1815,11 @@ (when (!= (-> self beard?) v1-248) (cond (v1-248 - (setup-masks (-> self draw) (the-as uint 2) 0) + (setup-masks (-> self draw) 2 0) (set! (-> self beard?) #t) ) (else - (setup-masks (-> self draw) (the-as uint 0) 2) + (setup-masks (-> self draw) 0 2) (set! (-> self beard?) #f) ) ) @@ -2252,14 +2242,14 @@ (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) gp-0 (the-as float (-> (the-as swingpole s2-0) edge-length)) ) ) (s3-1 (vector+float*! (new 'stack-no-clear 'vector) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) gp-0 (- (-> (the-as swingpole s2-0) edge-length)) ) @@ -2282,7 +2272,7 @@ (add-debug-vector #t (bucket-id debug-no-zbuf1) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) (-> (the-as swingpole s2-0) dir) (meters 3) (new 'static 'rgba :r #xff :b #xff :a #x80) diff --git a/goal_src/jak2/engine/target/sidekick.gc b/goal_src/jak2/engine/target/sidekick.gc index f98855725b..4c450935c3 100644 --- a/goal_src/jak2/engine/target/sidekick.gc +++ b/goal_src/jak2/engine/target/sidekick.gc @@ -464,25 +464,22 @@ ) (else (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) - (gp-4 - (when s5-3 - (let ((t9-22 (method-of-type manipy activate))) - (t9-22 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-5 run-function-in-process) - (s4-3 s5-3) - (s3-1 manipy-init) - (s2-0 (-> self root trans)) - (s1-0 (-> self entity)) - (t0-4 (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f))) - (t1-1 #f) + (gp-4 (when s5-3 + (let ((t9-22 (method-of-type manipy activate))) + (t9-22 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) ) - 0 - ((the-as (function object object object object object object none) gp-5) s4-3 s3-1 s2-0 s1-0 t0-4 t1-1) + (run-now-in-process + s5-3 + manipy-init + (-> self root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f)) + #f + 0 + ) + (the-as (pointer process-drawable) (-> s5-3 ppointer)) + ) ) - (the-as (pointer process-drawable) (-> s5-3 ppointer)) - ) - ) ) (send-event (ppointer->process gp-4) 'anim-mode 'mirror) (send-event (ppointer->process gp-4) 'mirror #t) diff --git a/goal_src/jak2/engine/target/target-h.gc b/goal_src/jak2/engine/target/target-h.gc index 39bd7c8b0d..a61b79a9a3 100644 --- a/goal_src/jak2/engine/target/target-h.gc +++ b/goal_src/jak2/engine/target/target-h.gc @@ -89,7 +89,7 @@ (define-extern smack-surface? (function symbol symbol :behavior target)) (define-extern target-height-above-ground (function float :behavior target)) (define-extern target-align-vel-z-adjust (function float float :behavior target)) -(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process collide-prim-core none :behavior part-tracker)) +(define-extern part-tracker-init (function sparticle-launch-group time-frame (function part-tracker none) (pointer process-drawable) process matrix none :behavior part-tracker)) (define-extern target-bonk-event-handler (function process int symbol event-message-block object :behavior target)) (define-extern target-attack-air-anim (function none :behavior target)) (define-extern *uppercut-mods* surface) diff --git a/goal_src/jak2/engine/target/target.gc b/goal_src/jak2/engine/target/target.gc index 82fce2405c..ab9242e95a 100644 --- a/goal_src/jak2/engine/target/target.gc +++ b/goal_src/jak2/engine/target/target.gc @@ -2849,21 +2849,21 @@ :tiltvvf 15.0 :mult-hook (lambda :behavior target ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) - (let ((v1-0 arg3)) - (the-as symbol (when (= v1-0 1) - (if (and (>= (-> self gun fire-pending) 2) (< (-> self gun fire-pending) 5)) - (logclear! (-> arg0 flags) (surface-flag gun-direct)) - ) - (case (-> self control ground-pat event) - (((pat-event slide)) - (set! (-> arg0 seek0) 0.05) - (set! (-> arg0 seek90) 0.05) - (set! (-> arg0 seek180) 0.05) + (the-as symbol (case arg3 + ((1) + (if (and (>= (-> self gun fire-pending) 2) (< (-> self gun fire-pending) 5)) + (logclear! (-> arg0 flags) (surface-flag gun-direct)) ) + (case (-> self control ground-pat event) + (((pat-event slide)) + (set! (-> arg0 seek0) 0.05) + (set! (-> arg0 seek90) 0.05) + (set! (-> arg0 seek180) 0.05) ) - ) - ) - ) + ) + ) + ) + ) ) :mode 'air :flags (surface-flag check-edge air attack spin gun-direct laser-hide) diff --git a/goal_src/jak2/engine/ui/progress/progress.gc b/goal_src/jak2/engine/ui/progress/progress.gc index cb94a8c9b1..cd0031ffaf 100644 --- a/goal_src/jak2/engine/ui/progress/progress.gc +++ b/goal_src/jak2/engine/ui/progress/progress.gc @@ -208,42 +208,51 @@ (set! (-> self draw color-mult z) 0.8) (logior! (-> self draw global-effect) (draw-control-global-effect title-light)) (logior! (-> self draw status) (draw-control-status hud)) - (setup-masks (-> self draw) (the-as uint 1) 0) - (setup-masks (-> self draw) (the-as uint 0) 2046) + (setup-masks (-> self draw) 1 0) + (setup-masks (-> self draw) 0 2046) (cond ((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk)) (setup-masks (-> self draw) - (-> *hud-ring-kiosk-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-kiosk-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) ((and (= *cheat-mode* #f) (demo?)) (setup-masks (-> self draw) - (-> *hud-ring-demo-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-demo-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) (else (setup-masks (-> self draw) - (-> *hud-ring-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-graphic-remap* length) + (the-as + int + (-> *hud-ring-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-graphic-remap* length) + ) ) - ) + ) 0 ) ) @@ -267,41 +276,50 @@ (-> (the-as progress (-> self parent-override 0)) node-list data (-> self joint-idx)) ) (when (-> (the-as progress (-> self parent-override 0)) main-menu) - (setup-masks (-> self draw) (the-as uint 0) 2046) + (setup-masks (-> self draw) 0 2046) (cond ((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk)) (setup-masks (-> self draw) - (-> *hud-ring-kiosk-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-kiosk-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) ((and (= *cheat-mode* #f) (demo?)) (setup-masks (-> self draw) - (-> *hud-ring-demo-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-demo-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) (else (setup-masks (-> self draw) - (-> *hud-ring-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-graphic-remap* length) + (the-as + int + (-> *hud-ring-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-graphic-remap* length) + ) ) - ) + ) 0 ) ) @@ -1441,206 +1459,206 @@ (defstate idle (progress) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (when (= v1-0 'notify) - (cond - ((= (-> event param 0) 'done) - (let ((t9-0 format) - (a0-3 #t) - (a1-1 "DONE NOTIFY: ~S ~S~%") - (v1-3 (the-as mc-status-code (-> event param 1))) - ) - (t9-0 - a0-3 - a1-1 - (cond - ((= v1-3 (mc-status-code bad-version)) - "bad-version" - ) - ((= v1-3 (mc-status-code no-save)) - "no-save" - ) - ((= v1-3 (mc-status-code no-last)) - "no-last" - ) - ((= v1-3 (mc-status-code no-space)) - "no-space" - ) - ((= v1-3 (mc-status-code internal-error)) - "internal-error" - ) - ((= v1-3 (mc-status-code no-memory)) - "no-memory" - ) - ((= v1-3 (mc-status-code bad-handle)) - "bad-handle" - ) - ((= v1-3 (mc-status-code busy)) - "busy" - ) - ((= v1-3 (mc-status-code write-error)) - "write-error" - ) - ((= v1-3 (mc-status-code read-error)) - "read-error" - ) - ((= v1-3 (mc-status-code no-card)) - "no-card" - ) - ((= v1-3 (mc-status-code no-format)) - "no-format" - ) - ((= v1-3 (mc-status-code ok)) - "ok" - ) - ((= v1-3 (mc-status-code no-process)) - "no-process" - ) - ((= v1-3 (mc-status-code no-auto-save)) - "no-auto-save" - ) - ((= v1-3 (mc-status-code no-file)) - "no-file" - ) - ((= v1-3 (mc-status-code format-failed)) - "format-failed" - ) - ((= v1-3 (mc-status-code new-game)) - "new-game" - ) - (else - "*unknown*" - ) - ) - (symbol->string (-> self current)) - ) - ) - (case (-> self current) - (('saving) + (the-as + object + (case event-type + (('notify) + (cond + ((= (-> event param 0) 'done) + (let ((t9-0 format) + (a0-3 #t) + (a1-1 "DONE NOTIFY: ~S ~S~%") + (v1-3 (the-as mc-status-code (-> event param 1))) + ) + (t9-0 + a0-3 + a1-1 (cond - ((= (-> self state-stack 0) 'title) - (let ((gp-1 (-> *setting-control* user-default auto-save))) - (sound-volume-off) - (let ((v0-0 (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode))))) - (set! (-> *setting-control* user-default auto-save) gp-1) - v0-0 - ) - ) + ((= v1-3 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-3 (mc-status-code no-save)) + "no-save" + ) + ((= v1-3 (mc-status-code no-last)) + "no-last" + ) + ((= v1-3 (mc-status-code no-space)) + "no-space" + ) + ((= v1-3 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-3 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-3 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-3 (mc-status-code busy)) + "busy" + ) + ((= v1-3 (mc-status-code write-error)) + "write-error" + ) + ((= v1-3 (mc-status-code read-error)) + "read-error" + ) + ((= v1-3 (mc-status-code no-card)) + "no-card" + ) + ((= v1-3 (mc-status-code no-format)) + "no-format" + ) + ((= v1-3 (mc-status-code ok)) + "ok" + ) + ((= v1-3 (mc-status-code no-process)) + "no-process" + ) + ((= v1-3 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-3 (mc-status-code no-file)) + "no-file" + ) + ((= v1-3 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-3 (mc-status-code new-game)) + "new-game" ) (else - (progress-method-30 self) + "*unknown*" ) ) + (symbol->string (-> self current)) ) - (('formatting) - (set-next-state self 'creating 0) - ) - (('creating) - (if (= (-> self state-stack 0) 'title) - (set-next-state self 'select-save-title 0) - (set-next-state self 'select-save 0) - ) - ) - ) - ) - ((= (-> event param 0) 'error) - (let ((t9-7 format) - (a0-18 #t) - (a1-5 "ERROR NOTIFY: ~S ~S ~S~%") - (v1-19 (the-as mc-status-code (-> event param 1))) - ) - (t9-7 - a0-18 - a1-5 - (cond - ((= v1-19 (mc-status-code bad-version)) - "bad-version" - ) - ((= v1-19 (mc-status-code no-save)) - "no-save" - ) - ((= v1-19 (mc-status-code no-last)) - "no-last" - ) - ((= v1-19 (mc-status-code no-space)) - "no-space" - ) - ((= v1-19 (mc-status-code internal-error)) - "internal-error" - ) - ((= v1-19 (mc-status-code no-memory)) - "no-memory" - ) - ((= v1-19 (mc-status-code bad-handle)) - "bad-handle" - ) - ((= v1-19 (mc-status-code busy)) - "busy" - ) - ((= v1-19 (mc-status-code write-error)) - "write-error" - ) - ((= v1-19 (mc-status-code read-error)) - "read-error" - ) - ((= v1-19 (mc-status-code no-card)) - "no-card" - ) - ((= v1-19 (mc-status-code no-format)) - "no-format" - ) - ((= v1-19 (mc-status-code ok)) - "ok" - ) - ((= v1-19 (mc-status-code no-process)) - "no-process" - ) - ((= v1-19 (mc-status-code no-auto-save)) - "no-auto-save" - ) - ((= v1-19 (mc-status-code no-file)) - "no-file" - ) - ((= v1-19 (mc-status-code format-failed)) - "format-failed" - ) - ((= v1-19 (mc-status-code new-game)) - "new-game" - ) - (else - "*unknown*" - ) - ) - (-> self current) - (-> self next) - ) - ) - (case (-> event param 1) - ((14) - (set-next-state self 'insufficient-space 0) - ) - (else - (case (-> self current) - (('formatting 'format-card) - (set-next-state self 'error-formatting 0) - ) - (('creating) - (set-next-state self 'error-creating 0) - ) - (('saving 'select-save 'select-save-title 'select-save-title-hero) - (set-next-state self 'error-saving 0) - ) - (('loading 'select-load) - (set-next-state self 'error-loading 0) + ) + (case (-> self current) + (('saving) + (cond + ((= (-> self state-stack 0) 'title) + (let ((gp-1 (-> *setting-control* user-default auto-save))) + (sound-volume-off) + (let ((v0-0 (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode))))) + (set! (-> *setting-control* user-default auto-save) gp-1) + v0-0 + ) ) + ) + (else + (progress-method-30 self) ) ) ) - ) + (('formatting) + (set-next-state self 'creating 0) + ) + (('creating) + (if (= (-> self state-stack 0) 'title) + (set-next-state self 'select-save-title 0) + (set-next-state self 'select-save 0) + ) + ) + ) ) - ) + ((= (-> event param 0) 'error) + (let ((t9-7 format) + (a0-18 #t) + (a1-5 "ERROR NOTIFY: ~S ~S ~S~%") + (v1-19 (the-as mc-status-code (-> event param 1))) + ) + (t9-7 + a0-18 + a1-5 + (cond + ((= v1-19 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-19 (mc-status-code no-save)) + "no-save" + ) + ((= v1-19 (mc-status-code no-last)) + "no-last" + ) + ((= v1-19 (mc-status-code no-space)) + "no-space" + ) + ((= v1-19 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-19 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-19 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-19 (mc-status-code busy)) + "busy" + ) + ((= v1-19 (mc-status-code write-error)) + "write-error" + ) + ((= v1-19 (mc-status-code read-error)) + "read-error" + ) + ((= v1-19 (mc-status-code no-card)) + "no-card" + ) + ((= v1-19 (mc-status-code no-format)) + "no-format" + ) + ((= v1-19 (mc-status-code ok)) + "ok" + ) + ((= v1-19 (mc-status-code no-process)) + "no-process" + ) + ((= v1-19 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-19 (mc-status-code no-file)) + "no-file" + ) + ((= v1-19 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-19 (mc-status-code new-game)) + "new-game" + ) + (else + "*unknown*" + ) + ) + (-> self current) + (-> self next) + ) + ) + (case (-> event param 1) + ((14) + (set-next-state self 'insufficient-space 0) + ) + (else + (case (-> self current) + (('formatting 'format-card) + (set-next-state self 'error-formatting 0) + ) + (('creating) + (set-next-state self 'error-creating 0) + ) + (('saving 'select-save 'select-save-title 'select-save-title-hero) + (set-next-state self 'error-saving 0) + ) + (('loading 'select-load) + (set-next-state self 'error-loading 0) + ) + ) + ) + ) + ) + ) + ) ) ) ) diff --git a/goal_src/jak2/levels/common/airlock.gc b/goal_src/jak2/levels/common/airlock.gc index 18e103388f..216e809e6e 100644 --- a/goal_src/jak2/levels/common/airlock.gc +++ b/goal_src/jak2/levels/common/airlock.gc @@ -361,69 +361,67 @@ :bounds (static-spherem 0 5 0 14) ) -(defskelgroup skel-com-airlock-inner com-airlock-inner 0 2 - ((1 (meters 999999))) +(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) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'close) - (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) - ) - ) - (if (and (>= arg1 2) (and (= (-> event 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)) - ) - ((= v1-0 'open) - (set! (-> self latch-open-time) (+ (-> self clock frame-counter) (if (>= arg1 1) + (the-as + object + (case event-type + (('close) + (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) (the-as int (-> event param 0)) 3000 ) ) - ) - (if (and (>= arg1 2) (and (= (-> event 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! (identity - (the float (+ (-> (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) frames num-frames) -1)) - ) + ) + (if (and (>= arg1 2) (and (= (-> event 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) (+ (-> self clock frame-counter) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) + ) + ) + (if (and (>= arg1 2) (and (= (-> event 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! (identity + (the float (+ (-> (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) frames num-frames) -1)) ) - ) - (and (-> self next-state) (= (-> self next-state name) 'close)) - ) - ((= v1-0 '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)) ) - ) - ((= v1-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)) - ) - ) - ((= v1-0 'sound) - (if (>= (check-crossing-distance self (target-pos 0) #f) 0.0) - (play-city-voice-sound self (the-as symbol (-> event param 0))) + (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)) ) - ((= v1-0 'distance) - (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) + (('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) + (the-as object (play-city-voice-sound self (the-as symbol (-> event param 0)))) + ) + ) + (('distance) + (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) ) ) ) @@ -1015,7 +1013,10 @@ (none) ) -(defskelgroup skel-hip-door-a hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) +(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) () @@ -1257,7 +1258,10 @@ (none) ) -(defskelgroup skel-under-door hip-door-a 0 2 ((1 (meters 999999))) :bounds (static-spherem 0 2 0 5)) +(defskelgroup skel-under-door 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 under-door (com-airlock) () diff --git a/goal_src/jak2/levels/common/battle.gc b/goal_src/jak2/levels/common/battle.gc index 229233873c..7ace926c46 100644 --- a/goal_src/jak2/levels/common/battle.gc +++ b/goal_src/jak2/levels/common/battle.gc @@ -742,72 +742,70 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 122] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 147] (defbehavior battle-event-handler battle ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'query) - (case (-> arg3 param 0) - (('beaten) - (and (-> self next-state) (= (-> self next-state name) 'beaten)) - ) - (('hostile) - (and (-> self next-state) (= (-> self next-state name) 'hostile)) - ) - (('idle) - (and (-> self next-state) (= (-> self next-state name) 'idle)) - ) - (('die-count) - (-> self die-count) - ) - (else - #f - ) + (the-as object (case arg2 + (('query) + (case (-> arg3 param 0) + (('beaten) + (and (-> self next-state) (= (-> self next-state name) 'beaten)) + ) + (('hostile) + (and (-> self next-state) (= (-> self next-state name) 'hostile)) + ) + (('idle) + (and (-> self next-state) (= (-> self next-state name) 'idle)) + ) + (('die-count) + (-> self die-count) + ) + (else + #f ) ) - ((= v1-0 'child-die) - (+! (-> self die-count) 1) - (let ((v1-14 (battle-method-30 self arg0))) - (when v1-14 - (set! (-> v1-14 creature) (the-as handle #f)) - #f - ) + ) + (('child-die) + (+! (-> self die-count) 1) + (let ((v1-14 (battle-method-30 self arg0))) + (when v1-14 + (set! (-> v1-14 creature) (the-as handle #f)) + #f ) ) - ((= v1-0 'child-hit) - (let ((a1-3 (battle-method-30 self arg0))) - (when a1-3 - (logior! (-> a1-3 flags) 1) - (battle-method-42 self a1-3 (the-as touch-tracker arg0)) - ) + ) + (('child-hit) + (let ((a1-3 (battle-method-30 self arg0))) + (when a1-3 + (logior! (-> a1-3 flags) 1) + (battle-method-42 self a1-3 (the-as touch-tracker arg0)) ) ) - ((= v1-0 'child-jumped) - (let ((a1-5 (battle-method-30 self arg0))) - (if a1-5 - (battle-method-44 self a1-5) - ) + ) + (('child-jumped) + (let ((a1-5 (battle-method-30 self arg0))) + (if a1-5 + (battle-method-44 self a1-5) + ) + ) + ) + (('trigger) + (if (and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual notice) ) - ) - ((= v1-0 'trigger) - (if (and (-> self next-state) (= (-> self next-state name) 'idle)) - (go-virtual notice) - ) - ) - ((= v1-0 'beaten) - (set! (-> self flags) (the-as uint (logior (the-as int (-> self flags)) 4))) - (if (and (-> self next-state) (= (-> self next-state name) 'idle)) - (go-virtual beaten) - ) - ) - ((= v1-0 'resume) - (set! (-> self flags) (the-as uint (logand -5 (-> self flags)))) - (process-entity-status! self (entity-perm-status subtask-complete) #f) - (if (and (-> self next-state) (= (-> self next-state name) 'beaten)) - (go-virtual hostile) - ) - ) - ) - ) - ) + ) + (('beaten) + (set! (-> self flags) (the-as uint (logior (the-as int (-> self flags)) 4))) + (if (and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual beaten) + ) + ) + (('resume) + (set! (-> self flags) (the-as uint (logand -5 (-> self flags)))) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (if (and (-> self next-state) (= (-> self next-state name) 'beaten)) + (go-virtual hostile) + ) + ) + ) + ) ) (defmethod battle-method-27 battle ((obj battle)) diff --git a/goal_src/jak2/levels/common/cty-guard-turret-button.gc b/goal_src/jak2/levels/common/cty-guard-turret-button.gc index 960c8b4f1e..d5f29be695 100644 --- a/goal_src/jak2/levels/common/cty-guard-turret-button.gc +++ b/goal_src/jak2/levels/common/cty-guard-turret-button.gc @@ -131,18 +131,18 @@ (defmethod idle-state-transition cty-guard-turret-button ((obj cty-guard-turret-button)) "If `button-status` has [[button-status:0]] set, transition to [[basebutton::27]] otherwise, [[basebutton::30]]" - (setup-masks (-> obj draw) (the-as uint 0) -1) + (setup-masks (-> obj draw) 0 -1) (cond ((logtest? (-> obj button-status) (button-status pressed)) (format #t "off~%") - (setup-masks (-> obj draw) (the-as uint 4) 0) - (setup-masks (-> obj draw) (the-as uint 1) 0) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 1 0) (go (method-of-object obj down-idle)) ) (else (format #t "on~%") - (setup-masks (-> obj draw) (the-as uint 4) 0) - (setup-masks (-> obj draw) (the-as uint 2) 0) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 2 0) (go (method-of-object obj pop-up)) ) ) @@ -153,9 +153,9 @@ :enter (behavior () (sound-play "gturret-button") (format #t "going-down off~%") - (setup-masks (-> self draw) (the-as uint 0) -1) - (setup-masks (-> self draw) (the-as uint 4) 0) - (setup-masks (-> self draw) (the-as uint 1) 0) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 4 0) + (setup-masks (-> self draw) 1 0) (press! self #t) (none) ) diff --git a/goal_src/jak2/levels/common/elec-gate.gc b/goal_src/jak2/levels/common/elec-gate.gc index 3729f9ad6b..fef8b46ed9 100644 --- a/goal_src/jak2/levels/common/elec-gate.gc +++ b/goal_src/jak2/levels/common/elec-gate.gc @@ -344,7 +344,9 @@ ) :trans (behavior () (local-vars - (sv-176 (function lightning-spec time-frame symbol process-drawable vector vector none)) + (sv-176 + (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) + ) (sv-192 lightning-spec) (sv-208 int) (sv-224 symbol) diff --git a/goal_src/jak2/levels/common/enemy/bouncer.gc b/goal_src/jak2/levels/common/enemy/bouncer.gc index ba91e659c2..fdb938dabf 100644 --- a/goal_src/jak2/levels/common/enemy/bouncer.gc +++ b/goal_src/jak2/levels/common/enemy/bouncer.gc @@ -33,92 +33,91 @@ (defstate idle (bouncer) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as - object - (cond - ((= evt-type 'bonk) - (when ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> event param 0)) - (the-as collide-shape (-> self root)) - (the-as uint 1) - ) - (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) - (sound-play "trampoline") - (go-virtual fire) - ) + (the-as + object + (case event-type + (('bonk) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) + (the-as collide-shape (-> self root)) + (the-as uint 1) + ) + (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + (sound-play "trampoline") + (go-virtual fire) ) ) - ((= evt-type 'touch) - (let ((gp-2 (-> event param 0))) - (cond - (((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (collide-action solid) - (collide-action) - ) - (when ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (the-as uint 1) - ) - (if (not (and (-> self next-state) (let ((v1-21 (-> self next-state name))) - (or (= v1-21 'smush) (= v1-21 'fire)) - ) - ) - ) - (go-virtual smush) - ) - ) - ) - (((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (the-as uint 4) - ) - (persist-with-delay - *setting-control* - (the-as symbol (process->ppointer self)) - (seconds 0.05) - 'double-jump - #f - 0.0 - 0 - ) - ) + ) + (('touch) + (let ((gp-2 (-> event param 0))) + (cond + (((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (collide-action solid) + (collide-action) ) - ) - ) - ((= evt-type 'attack) - (let ((v1-28 (the-as object (-> event param 1))) - (a0-17 (-> event param 0)) - (a2-7 0) - ) - (cond - ((= (-> (the-as attack-info v1-28) mode) 'flop) - (set! a2-7 1) - ) - ((= (-> (the-as attack-info v1-28) mode) 'board) - (set! a2-7 9) - ) - ) - (when (and (nonzero? a2-7) - (and ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry a0-17) - (the-as collide-shape (-> self root)) - (the-as uint a2-7) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (the-as uint 1) + ) + (if (not (and (-> self next-state) (let ((v1-21 (-> self next-state name))) + (or (= v1-21 'smush) (= v1-21 'fire)) + ) ) - (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) - ) - ) - (sound-play "trampoline") - (go-virtual fire) - #f + ) + (go-virtual smush) + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (the-as uint 4) ) + (the-as object (persist-with-delay + *setting-control* + (the-as symbol (process->ppointer self)) + (seconds 0.05) + 'double-jump + #f + 0.0 + 0 + ) + ) + ) ) ) - ) + ) + (('attack) + (let ((v1-28 (the-as object (-> event param 1))) + (a0-17 (-> event param 0)) + (a2-7 0) + ) + (cond + ((= (-> (the-as attack-info v1-28) mode) 'flop) + (set! a2-7 1) + ) + ((= (-> (the-as attack-info v1-28) mode) 'board) + (set! a2-7 9) + ) + ) + (when (and (nonzero? a2-7) + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry a0-17) + (the-as collide-shape (-> self root)) + (the-as uint a2-7) + ) + (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + ) + ) + (sound-play "trampoline") + (go-virtual fire) + #f + ) + ) + ) ) ) ) diff --git a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc index 1eaccf7184..6e46cbc879 100644 --- a/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc +++ b/goal_src/jak2/levels/common/enemy/guards/guard-conversation.gc @@ -256,21 +256,19 @@ (defstate active (guard-conversation) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'trigger) - (let ((v0-0 #t)) - (set! (-> self triggered?) v0-0) - v0-0 - ) + (the-as object (case event-type + (('trigger) + (let ((v0-0 #t)) + (set! (-> self triggered?) v0-0) + v0-0 ) - ((= v1-0 'untrigger) - (set! (-> self triggered?) #f) - #f - ) - ) - ) - ) + ) + (('untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) ) :trans (behavior () (let ((gp-0 #t)) diff --git a/goal_src/jak2/levels/common/guard-projectile.gc b/goal_src/jak2/levels/common/guard-projectile.gc index 3983915075..a97cb13da8 100644 --- a/goal_src/jak2/levels/common/guard-projectile.gc +++ b/goal_src/jak2/levels/common/guard-projectile.gc @@ -547,8 +547,8 @@ (set! (-> v1-5 notify-radius) 122880.0) (set! (-> v1-5 danger-level) 1.0) (set! (-> v1-5 decay-rate) 0.0) - (set! (-> v1-5 flags) (the-as uint 1)) - (set! (-> v1-5 danger-type) (the-as uint 0)) + (set! (-> v1-5 flags) (traffic-danger-flags tdf0)) + (set! (-> v1-5 danger-type) (traffic-danger-type tdt0)) (set! (-> v1-5 handle) (the-as uint #f)) (send-event *traffic-manager* 'add-danger-sphere v1-5) ) @@ -680,8 +680,8 @@ ) -(defskelgroup skel-vehicle-grenade eco-canister 0 2 - ((1 (meters 999999))) +(defskelgroup skel-vehicle-grenade eco-canister eco-canister-dark-lod0-jg eco-canister-dark-idle-ja + ((eco-canister-dark-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 0.3) :texture-level 6 ) @@ -792,25 +792,25 @@ (defstate impact (vehicle-grenade) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touched) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer self)) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) (-> event param 0)) - (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> v1-5 id) (-> self attack-id)) - (set! (-> v1-5 mode) 'explode) - (set! (-> a1-2 param 1) (the-as uint v1-5)) - ) - (if (send-event-function proc a1-2) - #t - ) - ) - ) - ) - ) + (the-as object (case event-type + (('touched) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> event param 0)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 id) (-> self attack-id)) + (set! (-> v1-5 mode) 'explode) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (if (send-event-function proc a1-2) + #t + ) + ) + ) + ) + ) ) :code (behavior () (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) diff --git a/goal_src/jak2/levels/common/scene-actor.gc b/goal_src/jak2/levels/common/scene-actor.gc index e41de78d47..804012a63e 100644 --- a/goal_src/jak2/levels/common/scene-actor.gc +++ b/goal_src/jak2/levels/common/scene-actor.gc @@ -10,14 +10,14 @@ ;; DECOMP BEGINS -(defskelgroup skel-scenecamera scenecamera 0 -1 - ((1 (meters 999999))) +(defskelgroup skel-scenecamera scenecamera scenecamera-lod0-jg -1 + ((scenecamera-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 4) :texture-level 6 ) -(defskelgroup skel-particleman particleman 0 -1 - ((1 (meters 999999))) +(defskelgroup skel-particleman particleman particleman-lod0-jg -1 + ((particleman-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 10) :origin-joint-index 3 ) @@ -31,8 +31,8 @@ :shadow-joint-index 3 ) -(defskelgroup skel-darkjak-highres darkjak-highres 0 -1 - ((1 (meters 999999))) +(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) :sort 1 @@ -57,10 +57,10 @@ :origin-joint-index 3 ) -(defskelgroup skel-samos-highres samos-highres 0 3 - ((1 (meters 999999))) +(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 3.2) - :shadow 2 + :shadow samos-highres-shadow-mg :origin-joint-index 3 ) @@ -127,10 +127,10 @@ :origin-joint-index 3 ) -(defskelgroup skel-onin-highres onin-highres 0 3 - ((1 (meters 200))) +(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 5) - :shadow 2 + :shadow onin-highres-shadow-mg :origin-joint-index 3 ) @@ -170,10 +170,10 @@ :origin-joint-index 3 ) -(defskelgroup skel-crimson-guard-hover crimson-guard-hover 0 -1 - ((1 (meters 20)) (2 (meters 999999))) +(defskelgroup skel-crimson-guard-hover crimson-guard-hover crimson-guard-hover-lod0-jg -1 + ((crimson-guard-hover-lod0-mg (meters 20)) (crimson-guard-hover-lod1-mg (meters 999999))) :bounds (static-spherem 0 0 0 7.5) - :shadow 3 + :shadow crimson-guard-hover-shadow-mg :origin-joint-index 3 ) @@ -234,17 +234,17 @@ :origin-joint-index 3 ) -(defskelgroup skel-tess-highres tess-highres 0 3 - ((1 (meters 999999))) +(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 2 + :shadow tess-highres-shadow-mg :origin-joint-index 3 ) -(defskelgroup skel-keira-highres keira-highres 0 3 - ((1 (meters 200))) +(defskelgroup skel-keira-highres keira-highres keira-highres-lod0-jg keira-highres-idle-ja + ((keira-highres-lod0-mg (meters 200))) :bounds (static-spherem 0 0 0 5) - :shadow 2 + :shadow keira-highres-shadow-mg :origin-joint-index 3 :shadow-joint-index 3 ) @@ -348,75 +348,48 @@ (the-as pair 0) ) (set! (-> obj draw light-index) (the-as uint 10)) - (let* ((s5-2 (get-process *default-dead-pool* manipy #x4000)) - (s4-1 - (when s5-2 - (let ((t9-5 (method-of-type manipy activate))) - (t9-5 (the-as manipy s5-2) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-2 run-function-in-process) - (s3-0 s5-2) - (s2-0 manipy-init) - (s1-0 (-> obj root trans)) - (s0-0 (-> obj entity)) - (t0-0 (art-group-get-by-name *level* "skel-metalkor-highres-lowtorso" (the-as (pointer uint32) #f))) - (t1-0 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-2) s3-0 s2-0 s1-0 s0-0 t0-0 t1-0) - ) - (-> s5-2 ppointer) - ) - ) - ) + (let ((s4-1 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-lowtorso" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-1) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-1) 'prefix "lowtorso-") ) - (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) - (s4-3 - (when s5-3 - (let ((t9-11 (method-of-type manipy activate))) - (t9-11 (the-as manipy s5-3) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-4 run-function-in-process) - (s3-1 s5-3) - (s2-1 manipy-init) - (s1-1 (-> obj root trans)) - (s0-1 (-> obj entity)) - (t0-1 (art-group-get-by-name *level* "skel-metalkor-highres-legs" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-4) s3-1 s2-1 s1-1 s0-1 t0-1 t1-1) - ) - (-> s5-3 ppointer) - ) - ) - ) + (let ((s4-3 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-legs" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-3) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-3) 'prefix "legs-") ) - (let* ((s5-4 (get-process *default-dead-pool* manipy #x4000)) - (s4-5 - (when s5-4 - (let ((t9-17 (method-of-type manipy activate))) - (t9-17 (the-as manipy s5-4) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-6 run-function-in-process) - (s3-2 s5-4) - (s2-2 manipy-init) - (s1-2 (-> obj root trans)) - (s0-2 (-> obj entity)) - (t0-2 (art-group-get-by-name *level* "skel-metalkor-highres-wings" (the-as (pointer uint32) #f))) - (t1-2 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-6) s3-2 s2-2 s1-2 s0-2 t0-2 t1-2) - ) - (-> s5-4 ppointer) - ) - ) - ) + (let ((s4-5 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-wings" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-5) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-5) 'prefix "wings-") ) @@ -1005,8 +978,8 @@ (-> obj draw art-group data 3) ) -(defskelgroup skel-prsn-torture prsn-torture 0 2 - ((1 (meters 999999))) +(defskelgroup skel-prsn-torture prsn-torture prsn-torture-lod0-jg prsn-torture-idle-ja + ((prsn-torture-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 20) :origin-joint-index 3 ) @@ -1041,14 +1014,14 @@ :origin-joint-index 3 ) -(defskelgroup skel-talk-box talk-box 0 2 - ((1 (meters 999999))) +(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) :origin-joint-index 3 ) -(defskelgroup skel-rift-ring rift-ring 0 -1 - ((1 (meters 999999))) +(defskelgroup skel-rift-ring rift-ring rift-ring-lod0-jg -1 + ((rift-ring-lod0-mg (meters 999999))) :bounds (static-spherem 0 0 0 60) :origin-joint-index 6 ) diff --git a/test/decompiler/reference/jak1/engine/ambient/ambient_REF.gc b/test/decompiler/reference/jak1/engine/ambient/ambient_REF.gc index dfd9cc6fc3..dba8a1ec1c 100644 --- a/test/decompiler/reference/jak1/engine/ambient/ambient_REF.gc +++ b/test/decompiler/reference/jak1/engine/ambient/ambient_REF.gc @@ -363,15 +363,15 @@ (apply-settings *setting-control*) (set! (-> self event-hook) (lambda :behavior level-hint ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (when (or (= v1-0 'die) (= v1-0 'exit)) - (if (= (ppointer->process *hint-semaphore*) self) - (set! *hint-semaphore* (the-as (pointer level-hint) #f)) - ) - (deactivate self) - ) - ) - ) + (the-as object (case arg2 + (('die 'exit) + (if (= (ppointer->process *hint-semaphore*) self) + (set! *hint-semaphore* (the-as (pointer level-hint) #f)) + ) + (deactivate self) + ) + ) + ) ) ) (go level-hint-ambient-sound arg0) @@ -409,17 +409,15 @@ ;; failed to figure out what this is: (defstate level-hint-normal (level-hint) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'exit) - (go level-hint-exit) - ) - ((= v1-0 'die) - (deactivate self) - ) - ) - ) - ) + (the-as object (case event-type + (('exit) + (go level-hint-exit) + ) + (('die) + (deactivate self) + ) + ) + ) ) :exit (behavior () (if (= (ppointer->process *hint-semaphore*) self) @@ -469,22 +467,20 @@ ;; failed to figure out what this is: (defstate level-hint-sidekick (level-hint) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'exit) - (when (nonzero? (-> self sound-id)) - (sound-stop (-> self sound-id)) - (set! (-> self sound-id) (new 'static 'sound-id)) - 0 - ) - (go level-hint-exit) + (the-as object (case event-type + (('exit) + (when (nonzero? (-> self sound-id)) + (sound-stop (-> self sound-id)) + (set! (-> self sound-id) (new 'static 'sound-id)) + 0 ) - ((= v1-0 'die) - (deactivate self) - ) - ) - ) - ) + (go level-hint-exit) + ) + (('die) + (deactivate self) + ) + ) + ) ) :exit (behavior () (if (nonzero? (-> self sound-id)) diff --git a/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc index 498de6bb8e..f2e2e24e18 100644 --- a/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/cam-combiner_REF.gc @@ -4,159 +4,157 @@ ;; failed to figure out what this is: (defstate cam-combiner-active (camera-combiner) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'point-of-interest) - (cond - ((-> event param 0) - (set! (-> self tracking use-point-of-interest) #t) - (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> event param 0)) quad)) - (set! (-> self tracking point-of-interest-blend target) 1.0) - ) - (else - (set! (-> self tracking use-point-of-interest) #f) - (set! (-> self tracking point-of-interest-blend target) 0.0) - ) + (the-as + object + (case event-type + (('point-of-interest) + (cond + ((-> event param 0) + (set! (-> self tracking use-point-of-interest) #t) + (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> event param 0)) quad)) + (set! (-> self tracking point-of-interest-blend target) 1.0) + ) + (else + (set! (-> self tracking use-point-of-interest) #f) + (set! (-> self tracking point-of-interest-blend target) 0.0) ) ) - ((= v1-0 'set-interpolation) - (set! (-> self interp-val) 0.0) - (set! (-> self interp-step) (/ 5.0 (the float (-> event param 0)))) - ) - ((= v1-0 'teleport) - (when (nonzero? (-> self tracking-status)) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) + ) + (('set-interpolation) + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) (/ 5.0 (the float (-> event param 0)))) + ) + (('teleport) + (when (nonzero? (-> self tracking-status)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as float (-> self tracking-options)) + (-> self fov) + #f ) ) - ((= v1-0 'stop-tracking) - (set! (-> self tracking-status) (the-as uint 0)) - 0 + ) + (('stop-tracking) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (('start-tracking) + (cond + ((< arg1 1) + (let ((t9-2 format) + (a0-15 0) + (a1-3 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") + ) + (let ((v1-7 (-> event param 0))) + (rtype-of v1-7) + ) + (t9-2 a0-15 a1-3) + ) + ) + ((let ((t9-3 type-type?) + (v1-8 (-> event param 0)) + ) + (not (t9-3 (rtype-of v1-8) camera-slave)) + ) + (let ((t9-4 format) + (a0-18 0) + (a1-5 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-10 (-> event param 0)) + ) + (t9-4 a0-18 a1-5 (rtype-of v1-10)) + ) + ) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as object (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options))) + (set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow)) + (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust)) + (copy-cam-float-seeker + (-> self tracking underwater-blend) + (-> (the-as camera-slave gp-1) tracking underwater-blend) + ) + (set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest)) + (set! (-> self tracking point-of-interest quad) + (-> (the-as camera-slave gp-1) tracking point-of-interest quad) + ) + (copy-cam-float-seeker + (-> self tracking point-of-interest-blend) + (-> (the-as camera-slave gp-1) tracking point-of-interest-blend) + ) + (let ((gp-2 (+ (the-as uint gp-1) 108))) + (cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f) + (slave-set-rotation! + (-> self tracking) + (the-as vector gp-2) + (the-as float (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ) ) - ((= v1-0 'start-tracking) - (cond - ((< arg1 1) - (let ((t9-2 format) - (a0-15 0) - (a1-3 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") - ) - (let ((v1-7 (-> event param 0))) - (rtype-of v1-7) + ) + (('copy-tracking) + (cond + ((< arg1 1) + (let ((t9-10 format) + (a0-27 0) + (a1-11 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") ) - (t9-2 a0-15 a1-3) + (let ((v1-23 (-> event param 0))) + (rtype-of v1-23) ) + (t9-10 a0-27 a1-11) ) - ((let ((t9-3 type-type?) - (v1-8 (-> event param 0)) - ) - (not (t9-3 (rtype-of v1-8) camera-slave)) - ) - (let ((t9-4 format) - (a0-18 0) - (a1-5 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") - (v1-10 (-> event param 0)) - ) - (t9-4 a0-18 a1-5 (rtype-of v1-10)) - ) - ) - ((zero? (-> self tracking-status)) - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-1 (the-as object (-> event param 0)))) - (set! (-> self tracking-options) (the-as int (-> (the-as camera-slave gp-1) options))) - (set! (-> self tracking no-follow) (-> (the-as camera-slave gp-1) tracking no-follow)) - (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> (the-as camera-slave gp-1) tracking tilt-adjust)) - (copy-cam-float-seeker - (-> self tracking underwater-blend) - (-> (the-as camera-slave gp-1) tracking underwater-blend) + ) + ((let ((t9-11 type-type?) + (v1-24 (-> event param 0)) ) - (set! (-> self tracking use-point-of-interest) (-> (the-as camera-slave gp-1) tracking use-point-of-interest)) - (set! (-> self tracking point-of-interest quad) - (-> (the-as camera-slave gp-1) tracking point-of-interest quad) + (not (t9-11 (rtype-of v1-24) camera-slave)) + ) + (let ((t9-12 format) + (a0-30 0) + (a1-13 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> event param 0)) + ) + (t9-12 a0-30 a1-13 (rtype-of v1-25)) + ) + ) + ((nonzero? (-> self tracking-status)) + #f + ) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-17 (-> self tracking)) + (a3-3 (-> gp-3 tracking)) + (v1-36 (-> a3-3 inv-mat vector 0 quad)) + (a0-37 (-> a3-3 inv-mat vector 1 quad)) + (a1-16 (-> a3-3 inv-mat vector 2 quad)) + (a3-4 (-> a3-3 inv-mat vector 3 quad)) ) - (copy-cam-float-seeker - (-> self tracking point-of-interest-blend) - (-> (the-as camera-slave gp-1) tracking point-of-interest-blend) - ) - (let ((gp-2 (+ (the-as uint gp-1) 108))) - (cam-calc-follow! (-> self tracking) (the-as vector gp-2) #f) - (slave-set-rotation! - (-> self tracking) - (the-as vector gp-2) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) - ) - ) - ) - ) - ) - ((= v1-0 'copy-tracking) - (cond - ((< arg1 1) - (let ((t9-10 format) - (a0-27 0) - (a1-11 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") - ) - (let ((v1-23 (-> event param 0))) - (rtype-of v1-23) - ) - (t9-10 a0-27 a1-11) - ) - ) - ((let ((t9-11 type-type?) - (v1-24 (-> event param 0)) - ) - (not (t9-11 (rtype-of v1-24) camera-slave)) - ) - (let ((t9-12 format) - (a0-30 0) - (a1-13 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") - (v1-25 (-> event param 0)) - ) - (t9-12 a0-30 a1-13 (rtype-of v1-25)) - ) - ) - ((nonzero? (-> self tracking-status)) - #f - ) - (else - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-3 (the-as camera-slave (-> event param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-3 options))) - (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) - (copy-cam-float-seeker (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) - (copy-cam-float-seeker (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) - (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) - (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) - (let* ((a2-17 (-> self tracking)) - (a3-3 (-> gp-3 tracking)) - (v1-36 (-> a3-3 inv-mat vector 0 quad)) - (a0-37 (-> a3-3 inv-mat vector 1 quad)) - (a1-16 (-> a3-3 inv-mat vector 2 quad)) - (a3-4 (-> a3-3 inv-mat vector 3 quad)) - ) - (set! (-> a2-17 inv-mat vector 0 quad) v1-36) - (set! (-> a2-17 inv-mat vector 1 quad) a0-37) - (set! (-> a2-17 inv-mat vector 2 quad) a1-16) - (set! (-> a2-17 inv-mat vector 3 quad) a3-4) - ) - (set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest)) - (set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad)) - (copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) + (set! (-> a2-17 inv-mat vector 0 quad) v1-36) + (set! (-> a2-17 inv-mat vector 1 quad) a0-37) + (set! (-> a2-17 inv-mat vector 2 quad) a1-16) + (set! (-> a2-17 inv-mat vector 3 quad) a3-4) ) + (set! (-> self tracking use-point-of-interest) (-> gp-3 tracking use-point-of-interest)) + (set! (-> self tracking point-of-interest quad) (-> gp-3 tracking point-of-interest quad)) + (copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) ) ) ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc b/test/decompiler/reference/jak1/engine/camera/camera_REF.gc index 9065cc5b66..fc8941ac41 100644 --- a/test/decompiler/reference/jak1/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/camera_REF.gc @@ -1083,54 +1083,52 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 45] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 50] (defbehavior cam-standard-event-handler camera-slave ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'go) - (let ((v1-1 (-> arg3 param 0)) - (t9-0 (the-as (function object) enter-state)) + (the-as + object + (case arg2 + (('go) + (let ((v1-1 (-> arg3 param 0)) + (t9-0 (the-as (function object) enter-state)) + ) + (set! (-> self next-state) (the-as state v1-1)) + (t9-0) + ) + ) + (('change-state 'change-state-no-go) + (let ((s5-0 (the-as object (-> arg3 param 0)))) + (cam-slave-init-vars) + (let ((t9-2 (the-as (function object) (-> (the-as state s5-0) enter)))) + (if t9-2 + (t9-2) ) - (set! (-> self next-state) (the-as state v1-1)) - (t9-0) ) - ) - ((or (= v1-0 'change-state) (= v1-0 'change-state-no-go)) - (let ((s5-0 (the-as object (-> arg3 param 0)))) - (cam-slave-init-vars) - (let ((t9-2 (the-as (function object) (-> (the-as state s5-0) enter)))) - (if t9-2 - (t9-2) - ) - ) - (set! (-> self enter-has-run) #t) - (set! (-> self event-hook) (-> (the-as state s5-0) event)) - (when (= arg2 'change-state) - (let ((t9-3 (the-as (function object) enter-state))) - (set! (-> self next-state) (the-as state s5-0)) - (t9-3) - ) + (set! (-> self enter-has-run) #t) + (set! (-> self event-hook) (-> (the-as state s5-0) event)) + (when (= arg2 'change-state) + (let ((t9-3 (the-as (function object) enter-state))) + (set! (-> self next-state) (the-as state s5-0)) + (t9-3) ) ) ) - ((= v1-0 'point-of-interest) - (cond - ((-> arg3 param 0) - (set! (-> self tracking use-point-of-interest) #t) - (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> arg3 param 0)) quad)) - (set! (-> self tracking point-of-interest-blend target) 1.0) - ) - (else - (set! (-> self tracking use-point-of-interest) #f) - (set! (-> self tracking point-of-interest-blend target) 0.0) - ) + ) + (('point-of-interest) + (cond + ((-> arg3 param 0) + (set! (-> self tracking use-point-of-interest) #t) + (set! (-> self tracking point-of-interest quad) (-> (the-as vector (-> arg3 param 0)) quad)) + (set! (-> self tracking point-of-interest-blend target) 1.0) + ) + (else + (set! (-> self tracking use-point-of-interest) #f) + (set! (-> self tracking point-of-interest-blend target) 0.0) ) ) - ((= v1-0 'teleport) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) - ) - ) + ) + (('teleport) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/camera/pov-camera_REF.gc b/test/decompiler/reference/jak1/engine/camera/pov-camera_REF.gc index bf5c3dc9d6..14f412283e 100644 --- a/test/decompiler/reference/jak1/engine/camera/pov-camera_REF.gc +++ b/test/decompiler/reference/jak1/engine/camera/pov-camera_REF.gc @@ -236,23 +236,21 @@ (set! (-> self event-hook) (lambda :behavior pov-camera ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'mask) - (let ((v0-0 (the-as number (-> arg3 param 0)))) - (set! (-> self mask-to-clear) (the-as process-mask v0-0)) - v0-0 - ) + (the-as object (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 ) - ((= v1-0 'music-movie-volume) - (set! (-> self music-volume-movie) (the-as float (-> arg3 param 0))) - ) - ((= v1-0 'sfx-movie-volume) - (set! (-> self sfx-volume-movie) (the-as float (-> arg3 param 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))) + ) + ) + ) ) ) (pre-startup-callback self) diff --git a/test/decompiler/reference/jak1/engine/game/collectables_REF.gc b/test/decompiler/reference/jak1/engine/game/collectables_REF.gc index 0d6888f9db..c660cd04a0 100644 --- a/test/decompiler/reference/jak1/engine/game/collectables_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/collectables_REF.gc @@ -733,41 +733,39 @@ (defstate pickup (eco-collectable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'set-movie-pos) - (let ((v1-3 (res-lump-struct (-> self entity) 'movie-pos vector :time (the-as float -1000000000.0)))) - (the-as symbol (when v1-3 - (set! (-> v1-3 quad) (-> (the-as vector (-> event param 0)) quad)) - (the-as symbol v1-3) - ) - ) - ) - ) - ((= v1-0 'actor-pause) - (the-as symbol (cond - ((-> event param 0) - (logior! (-> self mask) (process-mask actor-pause)) - (let ((v0-1 #t)) - (set! (-> self actor-pause) v0-1) - v0-1 - ) - ) - (else - (logclear! (-> self mask) (process-mask actor-pause)) - (set! (-> self actor-pause) #f) - #f - ) + (the-as + object + (case event-type + (('set-movie-pos) + (let ((v1-3 (res-lump-struct (-> self entity) 'movie-pos vector :time (the-as float -1000000000.0)))) + (the-as symbol (when v1-3 + (set! (-> v1-3 quad) (-> (the-as vector (-> event param 0)) quad)) + (the-as symbol v1-3) ) ) ) - ((= v1-0 'fade) - (process-entity-status! self (entity-perm-status dead) #t) - (the-as symbol (deactivate self)) - ) - ) + ) + (('actor-pause) + (the-as symbol (cond + ((-> event param 0) + (logior! (-> self mask) (process-mask actor-pause)) + (let ((v0-1 #t)) + (set! (-> self actor-pause) v0-1) + v0-1 + ) + ) + (else + (logclear! (-> self mask) (process-mask actor-pause)) + (set! (-> self actor-pause) #f) + #f + ) + ) + ) + ) + (('fade) + (process-entity-status! self (entity-perm-status dead) #t) + (the-as symbol (deactivate self)) + ) ) ) ) @@ -945,18 +943,16 @@ (defstate die (eco) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'fade) - (process-entity-status! self (entity-perm-status dead) #t) - (deactivate self) - ) - ((= v1-0 'die) - (go-virtual die) - ) - ) - ) - ) + (the-as object (case event-type + (('fade) + (process-entity-status! self (entity-perm-status dead) #t) + (deactivate self) + ) + (('die) + (go-virtual die) + ) + ) + ) ) :exit (behavior () (process-entity-status! self (entity-perm-status bit-3) #f) @@ -2339,12 +2335,12 @@ (defstate pickup (buzzer) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'notify) - (process-entity-status! self (entity-perm-status dead) #t) - ) - ) - ) + (the-as object (case event-type + (('notify) + (process-entity-status! self (entity-perm-status dead) #t) + ) + ) + ) ) :enter (behavior ((arg0 object) (arg1 handle)) (set! (-> self pickup-handle) arg1) diff --git a/test/decompiler/reference/jak1/engine/game/crates_REF.gc b/test/decompiler/reference/jak1/engine/game/crates_REF.gc index fcdfb56195..2290c6a611 100644 --- a/test/decompiler/reference/jak1/engine/game/crates_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/crates_REF.gc @@ -986,32 +986,32 @@ (defstate special-contents-die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (case (-> event param 0) - (('pickup) - (let ((gp-0 (-> self entity extra perm))) - (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) - (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) - (+! (-> self child-count) -1) - (when (<= (-> self child-count) 0) - (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) - (process-entity-status! self (entity-perm-status bit-4) #f) - ) - (process-entity-status! self (entity-perm-status dead) #t) - (process-entity-status! self (entity-perm-status complete) #t) - (set! (-> gp-0 user-int8 0) 2) - (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) - (set! (-> self mask) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('notify) + (case (-> event param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) ) - ) - ) - ) + ) + ) + ) + ) ) :trans (-> (method-of-type crate die) trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc index 5c14c479a3..71d009c1a8 100644 --- a/test/decompiler/reference/jak1/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/game-save_REF.gc @@ -1729,17 +1729,15 @@ auto-save-post (defstate error (auto-save) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'progress-allowed?) - #t - ) - ((= v1-0 'die) - (deactivate self) - ) - ) - ) - ) + (the-as object (case event-type + (('progress-allowed?) + #t + ) + (('die) + (deactivate self) + ) + ) + ) ) :code (behavior ((arg0 mc-status-code)) (if (-> self buffer) diff --git a/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc b/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc index db8574784c..e563895c40 100644 --- a/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/generic-obs_REF.gc @@ -1164,26 +1164,24 @@ (defstate camera-tracker-process (camera-tracker) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 uint)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'message) - (set! v0-0 (-> event param 0)) - (set! (-> self message) (the-as basic v0-0)) - v0-0 - ) - ((= v1-0 'mask) - (set! v0-0 (-> event param 0)) - (set! (-> self mask-to-clear) (the-as process-mask v0-0)) - v0-0 - ) - ((= v1-0 'border) - (set! v0-0 (-> event param 0)) - (set! (-> self border-value) (the-as basic v0-0)) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('message) + (set! v0-0 (-> event param 0)) + (set! (-> self message) (the-as basic v0-0)) + v0-0 + ) + (('mask) + (set! v0-0 (-> event param 0)) + (set! (-> self mask-to-clear) (the-as process-mask v0-0)) + v0-0 + ) + (('border) + (set! v0-0 (-> event param 0)) + (set! (-> self border-value) (the-as basic v0-0)) + v0-0 + ) + ) + ) ) :enter (behavior () (if (-> self entity) @@ -2242,100 +2240,98 @@ (defstate touch-tracker-idle (touch-tracker) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'touched) - (let ((v1-1 (ppointer->process (-> self parent)))) - (when (!= v1-1 proc) - (cond - ((= (-> self event) 'attack) - (cond - ((= (-> proc type) target) - (send-event - proc - (-> self event) - :from (the-as process v1-1) - #f - (static-attack-info ((mode (the-as symbol (-> self event-mode))))) - ) + (the-as object (case event-type + (('touched) + (let ((v1-1 (ppointer->process (-> self parent)))) + (when (!= v1-1 proc) + (cond + ((= (-> self event) 'attack) + (cond + ((= (-> proc type) target) + (send-event + proc + (-> self event) + :from (the-as process v1-1) + #f + (static-attack-info ((mode (the-as symbol (-> self event-mode))))) ) - ((= (-> v1-1 type) target) - (send-event - proc - (-> self event) - :from (the-as process v1-1) - #f - (-> self event-mode) - (-> *target* control unknown-dword50) - (-> *target* control unknown-dword51) - ) + ) + ((= (-> v1-1 type) target) + (send-event + proc + (-> self event) + :from (the-as process v1-1) + #f + (-> self event-mode) + (-> *target* control unknown-dword50) + (-> *target* control unknown-dword51) ) - (else - (let ((a1-5 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-5 from) (the-as process v1-1)) - (set! (-> a1-5 num-params) 4) - (set! (-> a1-5 message) (-> self event)) - (set! (-> a1-5 param 0) (the-as uint #f)) - (set! (-> a1-5 param 1) (the-as uint (-> self event-mode))) - (let ((v1-19 (+ *global-attack-id* 1))) - (set! *global-attack-id* v1-19) - (set! (-> a1-5 param 2) (the-as uint v1-19)) - ) - (set! (-> a1-5 param 3) (the-as uint 0)) - (send-event-function proc a1-5) + ) + (else + (let ((a1-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-5 from) (the-as process v1-1)) + (set! (-> a1-5 num-params) 4) + (set! (-> a1-5 message) (-> self event)) + (set! (-> a1-5 param 0) (the-as uint #f)) + (set! (-> a1-5 param 1) (the-as uint (-> self event-mode))) + (let ((v1-19 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-19) + (set! (-> a1-5 param 2) (the-as uint v1-19)) ) + (set! (-> a1-5 param 3) (the-as uint 0)) + (send-event-function proc a1-5) ) ) ) - ((-> self event) - (send-event proc (-> self event) :from (the-as process v1-1)) - ) - (else - (let ((t0-5 (new 'stack-no-clear 'event-message-block))) - (set! (-> t0-5 from) proc) - (set! (-> t0-5 num-params) arg1) - (set! (-> t0-5 message) event-type) - (set! (-> t0-5 param 0) (-> event param 0)) - (set! (-> t0-5 param 1) (-> event param 1)) - (set! (-> t0-5 param 2) (-> event param 2)) - (set! (-> t0-5 param 3) (-> event param 3)) - (set! (-> t0-5 param 4) (-> event param 4)) - (set! (-> t0-5 param 5) (-> event param 5)) - (set! (-> t0-5 param 6) (-> event param 6)) - (send-event-function v1-1 t0-5) - ) + ) + ((-> self event) + (send-event proc (-> self event) :from (the-as process v1-1)) + ) + (else + (let ((t0-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> t0-5 from) proc) + (set! (-> t0-5 num-params) arg1) + (set! (-> t0-5 message) event-type) + (set! (-> t0-5 param 0) (-> event param 0)) + (set! (-> t0-5 param 1) (-> event param 1)) + (set! (-> t0-5 param 2) (-> event param 2)) + (set! (-> t0-5 param 3) (-> event param 3)) + (set! (-> t0-5 param 4) (-> event param 4)) + (set! (-> t0-5 param 5) (-> event param 5)) + (set! (-> t0-5 param 6) (-> event param 6)) + (send-event-function v1-1 t0-5) ) ) ) ) ) - ((= v1-0 'target) - (set! v0-0 (the-as none (process->handle (the-as process (-> event param 0))))) - (set! (-> self target) (the-as handle v0-0)) - v0-0 - ) - ((= v1-0 'event) - (set! (-> self event) (the-as symbol (-> event param 0))) - (set! v0-0 (the-as none (-> event param 1))) - (set! (-> self event-mode) (the-as basic v0-0)) - v0-0 - ) - ((= v1-0 'exit) - (set! v0-0 (the-as none (-> event param 0))) - (set! (-> self run-function) (the-as (function object) v0-0)) - v0-0 - ) - ((= v1-0 'eval) - ((the-as (function touch-tracker none) (-> event param 0)) self) - ) - ((= v1-0 'function) - (set! v0-0 (the-as none (-> event param 0))) - (set! (-> self callback) (the-as (function touch-tracker none) v0-0)) - v0-0 - ) - ) - ) - ) + ) + (('target) + (set! v0-0 (the-as none (process->handle (the-as process (-> event param 0))))) + (set! (-> self target) (the-as handle v0-0)) + v0-0 + ) + (('event) + (set! (-> self event) (the-as symbol (-> event param 0))) + (set! v0-0 (the-as none (-> event param 1))) + (set! (-> self event-mode) (the-as basic v0-0)) + v0-0 + ) + (('exit) + (set! v0-0 (the-as none (-> event param 0))) + (set! (-> self run-function) (the-as (function object) v0-0)) + v0-0 + ) + (('eval) + ((the-as (function touch-tracker none) (-> event param 0)) self) + ) + (('function) + (set! v0-0 (the-as none (-> event param 0))) + (set! (-> self callback) (the-as (function touch-tracker none) v0-0)) + v0-0 + ) + ) + ) ) :code (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/engine/game/task/process-taskable_REF.gc b/test/decompiler/reference/jak1/engine/game/task/process-taskable_REF.gc index 4bbe06c477..5f5606b16b 100644 --- a/test/decompiler/reference/jak1/engine/game/task/process-taskable_REF.gc +++ b/test/decompiler/reference/jak1/engine/game/task/process-taskable_REF.gc @@ -794,43 +794,41 @@ (defstate be-clone (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as shadow-geo (cond - ((= v1-0 'shadow) - (the-as shadow-geo (cond - ((-> event param 0) - (let ((v0-0 (-> self shadow-backup))) - (set! (-> self draw shadow) v0-0) - v0-0 - ) + (the-as shadow-geo (case event-type + (('shadow) + (the-as shadow-geo (cond + ((-> event param 0) + (let ((v0-0 (-> self shadow-backup))) + (set! (-> self draw shadow) v0-0) + v0-0 ) - (else - (set! (-> self draw shadow) #f) - (the-as shadow-geo #f) - ) + ) + (else + (set! (-> self draw shadow) #f) + (the-as shadow-geo #f) ) - ) - ) - ((= v1-0 'shadow-min-max) - (let ((v1-5 (-> self draw shadow-ctrl))) - (let ((a0-5 v1-5)) - (set! (-> a0-5 settings bot-plane w) (- (the-as float (-> event param 0)))) - ) - 0 - (set! (-> v1-5 settings top-plane w) (- (the-as float (-> event param 1)))) + ) + ) + ) + (('shadow-min-max) + (let ((v1-5 (-> self draw shadow-ctrl))) + (let ((a0-5 v1-5)) + (set! (-> a0-5 settings bot-plane w) (- (the-as float (-> event param 0)))) ) - (the-as shadow-geo 0) + 0 + (set! (-> v1-5 settings top-plane w) (- (the-as float (-> event param 1)))) ) - ((= v1-0 'end-mode) - (the-as shadow-geo (if (should-display? self) - (the-as shadow-geo (go-virtual idle)) - (the-as shadow-geo (go-virtual hidden)) - ) - ) - ) - ) - ) - ) + (the-as shadow-geo 0) + ) + (('end-mode) + (the-as shadow-geo (if (should-display? self) + (the-as shadow-geo (go-virtual idle)) + (the-as shadow-geo (go-virtual hidden)) + ) + ) + ) + ) + ) ) :enter (behavior ((arg0 handle)) (logior! (-> self skel status) (janim-status blerc)) @@ -871,46 +869,44 @@ (defstate idle (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'attack) - (the-as - symbol - (if (-> self bounce-away) - (the-as - symbol - (send-event proc 'shove #f (static-attack-info ((shove-back (meters 3)) (shove-up (meters 1))))) - ) + (the-as + object + (case event-type + (('attack) + (the-as + symbol + (if (-> self bounce-away) + (the-as + symbol + (send-event proc 'shove #f (static-attack-info ((shove-back (meters 3)) (shove-up (meters 1))))) ) - ) + ) ) - ((= v1-0 'touch) - (the-as symbol (send-shove-back - (-> self root-override) - proc - (the-as touching-shapes-entry (-> event param 0)) - 0.7 - 6144.0 - 16384.0 - ) - ) + ) + (('touch) + (the-as symbol (send-shove-back + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 + ) + ) + ) + (('clone) + (the-as symbol (go-virtual be-clone (the-as handle (-> event param 0)))) + ) + (('play-anim) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v0-0 #t)) + (set! (-> self been-kicked) v0-0) + v0-0 ) - ((= v1-0 'clone) - (the-as symbol (go-virtual be-clone (the-as handle (-> event param 0)))) - ) - ((= v1-0 'play-anim) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v0-0 #t)) - (set! (-> self been-kicked) v0-0) - v0-0 - ) - ) - ((= v1-0 'hidden-other) - (the-as symbol (go-virtual hidden-other)) - ) - ) + ) + (('hidden-other) + (the-as symbol (go-virtual hidden-other)) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/gfx/water/water_REF.gc b/test/decompiler/reference/jak1/engine/gfx/water/water_REF.gc index 7a1b584ec3..a1a38ef4fa 100644 --- a/test/decompiler/reference/jak1/engine/gfx/water/water_REF.gc +++ b/test/decompiler/reference/jak1/engine/gfx/water/water_REF.gc @@ -1362,12 +1362,12 @@ (defstate water-vol-idle (water-vol) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'update) - (TODO-RENAME-26 self) - ) - ) - ) + (the-as object (case event-type + (('update) + (TODO-RENAME-26 self) + ) + ) + ) ) :exit (behavior () (dummy-27 self) diff --git a/test/decompiler/reference/jak1/engine/load/loader_REF.gc b/test/decompiler/reference/jak1/engine/load/loader_REF.gc index 1b4d76a0a8..7351e0930a 100644 --- a/test/decompiler/reference/jak1/engine/load/loader_REF.gc +++ b/test/decompiler/reference/jak1/engine/load/loader_REF.gc @@ -722,11 +722,7 @@ (set! (-> obj preload-stream name) arg0) (set! (-> obj preload-stream parts) arg1) (set! (-> obj preload-stream priority) arg3) - (let ((v1-8 (process->ppointer arg2))) - (set! (-> obj preload-stream owner) - (new 'static 'handle :process v1-8 :pid (-> (the-as process (-> v1-8 0)) pid)) - ) - ) + (set! (-> obj preload-stream owner) (process->handle arg2)) ) 0 ) @@ -771,26 +767,20 @@ (set! (-> obj rec 0 name) arg0) (set! (-> obj rec 0 parts) arg1) (set! (-> obj rec 0 priority) arg3) - (let ((v1-34 (process->ppointer arg2))) - (set! (-> obj rec 0 owner) (new 'static 'handle :process v1-34 :pid (-> (the-as process (-> v1-34 0)) pid))) - ) + (set! (-> obj rec 0 owner) (process->handle arg2)) ) ((< arg3 (-> obj rec 1 priority)) (mem-copy! (&-> (-> obj rec 2) type) (&-> (-> obj rec 1) type) 44) (set! (-> obj rec 1 name) arg0) (set! (-> obj rec 1 parts) arg1) (set! (-> obj rec 1 priority) arg3) - (let ((v1-40 (process->ppointer arg2))) - (set! (-> obj rec 1 owner) (new 'static 'handle :process v1-40 :pid (-> (the-as process (-> v1-40 0)) pid))) - ) + (set! (-> obj rec 1 owner) (process->handle arg2)) ) ((< arg3 (-> obj rec 2 priority)) (set! (-> obj rec 2 name) arg0) (set! (-> obj rec 2 parts) arg1) (set! (-> obj rec 2 priority) arg3) - (let ((v1-44 (process->ppointer arg2))) - (set! (-> obj rec 2 owner) (new 'static 'handle :process v1-44 :pid (-> (the-as process (-> v1-44 0)) pid))) - ) + (set! (-> obj rec 2 owner) (process->handle arg2)) ) ) 0 @@ -853,11 +843,7 @@ ) ) ) - (let ((v1-46 (process->ppointer self))) - (set! (-> *art-control* spool-lock) - (new 'static 'handle :process v1-46 :pid (-> (the-as process (-> v1-46 0)) pid)) - ) - ) + (set! (-> *art-control* spool-lock) (process->handle self)) (set! sv-48 (the-as int (-> *display* base-frame-counter))) (while (< spool-part (-> arg0 parts)) (spool-push *art-control* (-> arg0 name) spool-part self -20.0) diff --git a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc index e72e387462..26fa2dcd80 100644 --- a/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc +++ b/test/decompiler/reference/jak1/engine/target/target-handler_REF.gc @@ -30,275 +30,273 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 563] (defbehavior target-generic-event-handler target ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (local-vars (v0-0 none)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'get-pickup) - (when (not (logtest? (-> self state-flags) (state-flags dying))) - (let ((s4-0 (-> arg3 param 0)) - (f28-0 (the-as float (-> arg3 param 1))) - ) - (if (!= (pickup-collectable! - (-> self fact-info-target) - (the-as pickup-type s4-0) - (the-as float 0.0) - (the-as handle #f) - ) - (pickup-collectable! (-> self fact-info-target) (the-as pickup-type s4-0) f28-0 (process->handle arg0)) + (the-as + object + (case arg2 + (('get-pickup) + (when (not (logtest? (-> self state-flags) (state-flags dying))) + (let ((s4-0 (-> arg3 param 0)) + (f28-0 (the-as float (-> arg3 param 1))) + ) + (if (!= (pickup-collectable! + (-> self fact-info-target) + (the-as pickup-type s4-0) + (the-as float 0.0) + (the-as handle #f) ) - #t - 'full - ) - ) + (pickup-collectable! (-> self fact-info-target) (the-as pickup-type s4-0) f28-0 (process->handle arg0)) + ) + #t + 'full + ) ) ) - ((= v1-0 'reset-pickup) - (reset! (-> self fact-info-target) (the-as symbol (-> arg3 param 0))) + ) + (('reset-pickup) + (reset! (-> self fact-info-target) (the-as symbol (-> arg3 param 0))) + ) + (('reset-collide) + (cond + ((-> self control unknown-symbol00) + (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float90)) + ) + ((-> self control unknown-symbol30) + (target-danger-set! (-> self control unknown-symbol30) #f) + ) ) - ((= v1-0 'reset-collide) - (cond - ((-> self control unknown-symbol00) - (target-collide-set! (-> self control unknown-symbol00) (-> self control unknown-float90)) - ) - ((-> self control unknown-symbol30) - (target-danger-set! (-> self control unknown-symbol30) #f) - ) - ) - ) - ((= v1-0 'level-deactivate) - #f - ) - ((= v1-0 'level-enter) - (let ((v1-21 (level-get *level* (the-as symbol (-> arg3 param 0))))) - (when v1-21 - (let ((s5-1 (-> v1-21 info))) - (let ((v1-22 (-> s5-1 buzzer))) - (if (zero? v1-22) - (set! (-> self fact-info-target buzzer) 0.0) - (set! (-> self fact-info-target buzzer) (pickup-collectable! - (-> self fact-info-target) - (pickup-type buzzer) - (the float (logior -65536 v1-22)) - (the-as handle #f) - ) - ) - ) - ) - (if (and (zero? (-> *game-info* enter-level-time (-> s5-1 index))) - (>= (-> *level-task-data-remap* length) (-> s5-1 index)) - ) - (set! (-> *game-info* enter-level-time (-> *level-task-data-remap* (+ (-> s5-1 index) -1))) - (-> *display* base-frame-counter) + ) + (('level-deactivate) + #f + ) + (('level-enter) + (let ((v1-21 (level-get *level* (the-as symbol (-> arg3 param 0))))) + (when v1-21 + (let ((s5-1 (-> v1-21 info))) + (let ((v1-22 (-> s5-1 buzzer))) + (if (zero? v1-22) + (set! (-> self fact-info-target buzzer) 0.0) + (set! (-> self fact-info-target buzzer) (pickup-collectable! + (-> self fact-info-target) + (pickup-type buzzer) + (the float (logior -65536 v1-22)) + (the-as handle #f) + ) ) ) ) - (send-event (ppointer->process (-> *hud-parts* buzzers)) 'sync) - (format #t "GAMEPLAY: enter ~A~%" (-> arg3 param 0)) + (if (and (zero? (-> *game-info* enter-level-time (-> s5-1 index))) + (>= (-> *level-task-data-remap* length) (-> s5-1 index)) + ) + (set! (-> *game-info* enter-level-time (-> *level-task-data-remap* (+ (-> s5-1 index) -1))) + (-> *display* base-frame-counter) + ) + ) + ) + (send-event (ppointer->process (-> *hud-parts* buzzers)) 'sync) + (format #t "GAMEPLAY: enter ~A~%" (-> arg3 param 0)) + ) + ) + ) + (('get-attack-count) + (set! v0-0 (the-as none (+ (-> self control unknown-dword51) (-> arg3 param 0)))) + (set! (-> self control unknown-dword51) (the-as int v0-0)) + v0-0 + ) + (('continue) + (go target-continue (the-as continue-point (-> arg3 param 0))) + ) + (('query) + (case (-> arg3 param 0) + (('powerup) + (and (= (-> self fact-info-target eco-type) (-> arg3 param 1)) (< 0.0 (-> self fact-info-target eco-level))) + ) + (('pickup) + (pickup-collectable! + (-> self fact-info-target) + (the-as pickup-type (-> arg3 param 1)) + (the-as float 0.0) + (the-as handle #f) + ) + ) + (('ground-height) + (target-height-above-ground) + ) + ) + ) + (('trans) + (case (-> arg3 param 0) + (('save) + (set! (-> self alt-cam-pos quad) (-> self control trans quad)) + (set! (-> self state-flags) (logior (state-flags has-saved-position) (-> self state-flags))) + (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) + ) + (('restore) + (logclear! (-> self state-flags) (state-flags has-saved-position)) + (let ((gp-1 (-> arg3 param 1))) + (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) + (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) + ) + (rot->dir-targ! (-> self control)) + (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) + (set! v0-0 (the-as none (-> *display* base-frame-counter))) + (set! (-> self control unknown-dword11) (the-as time-frame v0-0)) + v0-0 + ) + (('reset) + (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags has-saved-position)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 + ) + ) + ) + (('effect) + (target-powerup-effect (the-as symbol (-> arg3 param 0))) + ) + (('do-effect) + (dummy-10 (-> self skel effect) (the-as symbol (-> arg3 param 0)) (the-as float (-> arg3 param 1)) -1) + (if (-> self sidekick) + (dummy-10 + (-> self sidekick 0 skel effect) + (the-as symbol (-> arg3 param 0)) + (the-as float (-> arg3 param 1)) + -1 ) ) - ) - ((= v1-0 'get-attack-count) - (set! v0-0 (the-as none (+ (-> self control unknown-dword51) (-> arg3 param 0)))) - (set! (-> self control unknown-dword51) (the-as int v0-0)) - v0-0 - ) - ((= v1-0 'continue) - (go target-continue (the-as continue-point (-> arg3 param 0))) - ) - ((= v1-0 'query) - (case (-> arg3 param 0) - (('powerup) - (and (= (-> self fact-info-target eco-type) (-> arg3 param 1)) (< 0.0 (-> self fact-info-target eco-level))) - ) - (('pickup) - (pickup-collectable! - (-> self fact-info-target) - (the-as pickup-type (-> arg3 param 1)) - (the-as float 0.0) - (the-as handle #f) - ) - ) - (('ground-height) - (target-height-above-ground) - ) + ) + (('neck) + (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) + (cond + ((-> arg3 param 1) + (set! (-> self state-flags) (logior (state-flags looking-at-enemy) (-> self state-flags))) + (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) + (look-at-enemy! (-> self neck) (-> self alt-neck-pos) 'force arg0) + ) + (else + (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags looking-at-enemy)))) + (set! (-> self state-flags) (the-as state-flags v0-0)) + v0-0 ) ) - ((= v1-0 'trans) - (case (-> arg3 param 0) - (('save) - (set! (-> self alt-cam-pos quad) (-> self control trans quad)) - (set! (-> self state-flags) (logior (state-flags has-saved-position) (-> self state-flags))) - (mem-copy! (the-as pointer (-> arg3 param 1)) (the-as pointer (-> self control trans)) 48) - ) - (('restore) - (logclear! (-> self state-flags) (state-flags has-saved-position)) - (let ((gp-1 (-> arg3 param 1))) - (move-to-point! (-> self control) (the-as vector (+ gp-1 0))) - (quaternion-copy! (-> self control quat) (the-as quaternion (+ gp-1 16))) - ) - (rot->dir-targ! (-> self control)) - (logior! (-> self control status) (cshape-moving-flags onsurf onground tsurf)) - (set! v0-0 (the-as none (-> *display* base-frame-counter))) - (set! (-> self control unknown-dword11) (the-as time-frame v0-0)) - v0-0 - ) - (('reset) - (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags has-saved-position)))) - (set! (-> self state-flags) (the-as state-flags v0-0)) - v0-0 - ) - ) - ) - ((= v1-0 'effect) - (target-powerup-effect (the-as symbol (-> arg3 param 0))) - ) - ((= v1-0 'do-effect) - (dummy-10 (-> self skel effect) (the-as symbol (-> arg3 param 0)) (the-as float (-> arg3 param 1)) -1) - (if (-> self sidekick) - (dummy-10 - (-> self sidekick 0 skel effect) - (the-as symbol (-> arg3 param 0)) - (the-as float (-> arg3 param 1)) - -1 - ) - ) - ) - ((= v1-0 'neck) - (set! (-> self neck flex-blend) (the-as float (-> arg3 param 0))) - (cond - ((-> arg3 param 1) - (set! (-> self state-flags) (logior (state-flags looking-at-enemy) (-> self state-flags))) - (set! (-> self alt-neck-pos quad) (-> (the-as vector (-> arg3 param 1)) quad)) - (look-at-enemy! (-> self neck) (-> self alt-neck-pos) 'force arg0) - ) - (else - (set! v0-0 (the-as none (logclear (-> self state-flags) (state-flags looking-at-enemy)))) - (set! (-> self state-flags) (the-as state-flags v0-0)) - v0-0 - ) - ) - ) - ((= v1-0 'sidekick) - (cond - ((and (-> arg3 param 0) (not (-> self sidekick))) - (let ((gp-2 (get-process *default-dead-pool* sidekick #x4000))) - (set! v0-0 (when gp-2 - (let ((t9-21 (method-of-type sidekick activate))) - (t9-21 (the-as sidekick gp-2) self 'sidekick (the-as pointer #x70004000)) - ) - (run-now-in-process gp-2 init-sidekick) - (-> gp-2 ppointer) + ) + (('sidekick) + (cond + ((and (-> arg3 param 0) (not (-> self sidekick))) + (let ((gp-2 (get-process *default-dead-pool* sidekick #x4000))) + (set! v0-0 (when gp-2 + (let ((t9-21 (method-of-type sidekick activate))) + (t9-21 (the-as sidekick gp-2) self 'sidekick (the-as pointer #x70004000)) ) - ) - ) - (set! (-> self sidekick) (the-as (pointer sidekick) v0-0)) - v0-0 + (run-now-in-process gp-2 init-sidekick) + (-> gp-2 ppointer) + ) + ) ) - ((and (not (-> arg3 param 0)) (-> self sidekick)) - (deactivate (-> self sidekick 0)) - (set! (-> self sidekick) (the-as (pointer sidekick) #f)) - #f + (set! (-> self sidekick) (the-as (pointer sidekick) v0-0)) + v0-0 + ) + ((and (not (-> arg3 param 0)) (-> self sidekick)) + (deactivate (-> self sidekick 0)) + (set! (-> self sidekick) (the-as (pointer sidekick) #f)) + #f + ) + ) + ) + (('blend-shape) + (if (-> arg3 param 0) + (logior! (-> self skel status) (janim-status blerc)) + (logclear! (-> self skel status) (janim-status blerc)) + ) + (let ((v1-105 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-105 from) arg0) + (set! (-> v1-105 num-params) arg1) + (set! (-> v1-105 message) arg2) + (set! (-> v1-105 param 0) (-> arg3 param 0)) + (set! (-> v1-105 param 1) (-> arg3 param 1)) + (set! (-> v1-105 param 2) (-> arg3 param 2)) + (set! (-> v1-105 param 3) (-> arg3 param 3)) + (set! (-> v1-105 param 4) (-> arg3 param 4)) + (set! (-> v1-105 param 5) (-> arg3 param 5)) + (set! (-> v1-105 param 6) (-> arg3 param 6)) + (send-event-function (ppointer->process (-> self sidekick)) v1-105) + ) + ) + (('shadow) + (cond + ((-> arg3 param 0) + (let ((v1-108 (-> self draw shadow-ctrl))) + (logclear! (-> v1-108 settings flags) (shadow-flags disable-draw)) ) - ) - ) - ((= v1-0 'blend-shape) - (if (-> arg3 param 0) - (logior! (-> self skel status) (janim-status blerc)) - (logclear! (-> self skel status) (janim-status blerc)) + 0 + ) + (else + (let ((v1-110 (-> self draw shadow-ctrl))) + (logior! (-> v1-110 settings flags) (shadow-flags disable-draw)) ) - (let ((v1-105 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-105 from) arg0) - (set! (-> v1-105 num-params) arg1) - (set! (-> v1-105 message) arg2) - (set! (-> v1-105 param 0) (-> arg3 param 0)) - (set! (-> v1-105 param 1) (-> arg3 param 1)) - (set! (-> v1-105 param 2) (-> arg3 param 2)) - (set! (-> v1-105 param 3) (-> arg3 param 3)) - (set! (-> v1-105 param 4) (-> arg3 param 4)) - (set! (-> v1-105 param 5) (-> arg3 param 5)) - (set! (-> v1-105 param 6) (-> arg3 param 6)) - (send-event-function (ppointer->process (-> self sidekick)) v1-105) + 0 ) ) - ((= v1-0 'shadow) - (cond - ((-> arg3 param 0) - (let ((v1-108 (-> self draw shadow-ctrl))) - (logclear! (-> v1-108 settings flags) (shadow-flags disable-draw)) - ) - 0 - ) - (else - (let ((v1-110 (-> self draw shadow-ctrl))) - (logior! (-> v1-110 settings flags) (shadow-flags disable-draw)) - ) - 0 + ) + (('rotate-y-angle) + (quaternion-rotate-y! + (-> self control unknown-quaternion00) + (-> self control unknown-quaternion00) + (the-as float (-> arg3 param 0)) + ) + (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) + (rot->dir-targ! (-> self control)) + ) + ) + (('touched) + (send-event arg0 'touch (-> arg3 param 0)) + ) + (('dry) + (set! (-> self water drip-wetness) 0.0) + ) + (('reset-height) + (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) + #f + ) + (('draw) + (if (-> arg3 param 0) + (logclear! (-> self draw status) (draw-status skip-bones)) + (logior! (-> self draw status) (draw-status skip-bones)) + ) + (let ((v1-132 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-132 from) arg0) + (set! (-> v1-132 num-params) arg1) + (set! (-> v1-132 message) arg2) + (set! (-> v1-132 param 0) (-> arg3 param 0)) + (set! (-> v1-132 param 1) (-> arg3 param 1)) + (set! (-> v1-132 param 2) (-> arg3 param 2)) + (set! (-> v1-132 param 3) (-> arg3 param 3)) + (set! (-> v1-132 param 4) (-> arg3 param 4)) + (set! (-> v1-132 param 5) (-> arg3 param 5)) + (set! (-> v1-132 param 6) (-> arg3 param 6)) + (send-event-function (ppointer->process (-> self manipy)) v1-132) + ) + ) + (('no-load-wait) + (set! v0-0 (the-as none (+ (-> *display* base-frame-counter) (the-as time-frame (-> arg3 param 0))))) + (set! (-> self no-load-wait) (the-as time-frame v0-0)) + v0-0 + ) + (('no-look-around) + (set! (-> self no-look-around-wait) + (+ (-> *display* base-frame-counter) (the-as time-frame (-> arg3 param 0))) ) + (if (= (-> self next-state name) 'target-look-around) + (send-event self 'end-mode) ) + ) + (('change-state) + (go + (the-as (state object object object object target) (-> arg3 param 0)) + (-> arg3 param 1) + (-> arg3 param 2) + (-> arg3 param 3) + (-> arg3 param 4) ) - ((= v1-0 'rotate-y-angle) - (quaternion-rotate-y! - (-> self control unknown-quaternion00) - (-> self control unknown-quaternion00) - (the-as float (-> arg3 param 0)) - ) - (if (= (-> *cpad-list* cpads (-> self control unknown-cpad-info00 number) stick0-speed) 0.0) - (rot->dir-targ! (-> self control)) - ) - ) - ((= v1-0 'touched) - (send-event arg0 'touch (-> arg3 param 0)) - ) - ((= v1-0 'dry) - (set! (-> self water drip-wetness) 0.0) - ) - ((= v1-0 'reset-height) - (set! (-> self control unknown-vector52 quad) (-> self control trans quad)) - #f - ) - ((= v1-0 'draw) - (if (-> arg3 param 0) - (logclear! (-> self draw status) (draw-status skip-bones)) - (logior! (-> self draw status) (draw-status skip-bones)) - ) - (let ((v1-132 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-132 from) arg0) - (set! (-> v1-132 num-params) arg1) - (set! (-> v1-132 message) arg2) - (set! (-> v1-132 param 0) (-> arg3 param 0)) - (set! (-> v1-132 param 1) (-> arg3 param 1)) - (set! (-> v1-132 param 2) (-> arg3 param 2)) - (set! (-> v1-132 param 3) (-> arg3 param 3)) - (set! (-> v1-132 param 4) (-> arg3 param 4)) - (set! (-> v1-132 param 5) (-> arg3 param 5)) - (set! (-> v1-132 param 6) (-> arg3 param 6)) - (send-event-function (ppointer->process (-> self manipy)) v1-132) - ) - ) - ((= v1-0 'no-load-wait) - (set! v0-0 (the-as none (+ (-> *display* base-frame-counter) (the-as time-frame (-> arg3 param 0))))) - (set! (-> self no-load-wait) (the-as time-frame v0-0)) - v0-0 - ) - ((= v1-0 'no-look-around) - (set! (-> self no-look-around-wait) - (+ (-> *display* base-frame-counter) (the-as time-frame (-> arg3 param 0))) - ) - (if (= (-> self next-state name) 'target-look-around) - (send-event self 'end-mode) - ) - ) - ((= v1-0 'change-state) - (go - (the-as (state object object object object target) (-> arg3 param 0)) - (-> arg3 param 1) - (-> arg3 param 2) - (-> arg3 param 3) - (-> arg3 param 4) - ) - ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc index bb83e52d5a..29f4c09c46 100644 --- a/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak1/engine/ui/progress/progress_REF.gc @@ -1941,162 +1941,160 @@ (defstate progress-normal (progress) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'go-away) - (go progress-going-out) - ) - ((= v1-0 'notify) - (cond - ((= (-> event param 0) 'done) - (case (-> self display-state) - (((progress-screen memcard-saving)) - (cond - ((= (-> self display-state-stack 0) (progress-screen title)) - (let ((gp-1 (-> *setting-control* default auto-save))) - (sound-volume-off) - (set! (-> *game-info* mode) 'play) - (initialize! *game-info* 'game (the-as game-save #f) "intro-start") - (set! (-> *setting-control* default auto-save) gp-1) - ) - (set-master-mode 'game) + (the-as object (case event-type + (('go-away) + (go progress-going-out) + ) + (('notify) + (cond + ((= (-> event param 0) 'done) + (case (-> self display-state) + (((progress-screen memcard-saving)) + (cond + ((= (-> self display-state-stack 0) (progress-screen title)) + (let ((gp-1 (-> *setting-control* default auto-save))) + (sound-volume-off) + (set! (-> *game-info* mode) 'play) + (initialize! *game-info* 'game (the-as game-save #f) "intro-start") + (set! (-> *setting-control* default auto-save) gp-1) ) - (else - (set! v0-0 (the-as none -1)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) + (set-master-mode 'game) + ) + (else + (set! v0-0 (the-as none -1)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 ) ) - (((progress-screen memcard-formatting)) - (set! (-> self force-transition) #t) - (set! v0-0 (the-as none 15)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - (((progress-screen memcard-creating)) - (cond - ((= (-> self display-state-stack 0) (progress-screen title)) - (set! v0-0 (the-as none 18)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - ) - (else - (set! v0-0 (the-as none 17)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - ) + ) + (((progress-screen memcard-formatting)) + (set! (-> self force-transition) #t) + (set! v0-0 (the-as none 15)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-creating)) + (cond + ((= (-> self display-state-stack 0) (progress-screen title)) + (set! v0-0 (the-as none 18)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + ) + (else + (set! v0-0 (the-as none 17)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) ) - v0-0 ) + v0-0 + ) + ) + ) + ((= (-> event param 0) 'error) + (let ((t9-4 format) + (a0-17 #t) + (a1-2 "ERROR NOTIFY: ~S ~D~%") + (v1-13 (-> event param 1)) + ) + (t9-4 + a0-17 + a1-2 + (cond + ((= v1-13 17) + "no-auto-save" + ) + ((= v1-13 16) + "no-process" + ) + ((= v1-13 15) + "bad-version" + ) + ((= v1-13 14) + "no-space" + ) + ((= v1-13 13) + "no-save" + ) + ((= v1-13 12) + "no-file" + ) + ((= v1-13 11) + "no-format" + ) + ((= v1-13 10) + "no-last" + ) + ((= v1-13 9) + "no-card" + ) + ((= v1-13 8) + "no-memory" + ) + ((= v1-13 7) + "new-game" + ) + ((= v1-13 6) + "read-error" + ) + ((= v1-13 5) + "write-error" + ) + ((= v1-13 4) + "internal-error" + ) + ((= v1-13 3) + "format-failed" + ) + ((= v1-13 2) + "bad-handle" + ) + ((= v1-13 1) + "ok" + ) + ((zero? v1-13) + "busy" + ) + (else + "*unknown*" + ) + ) + (-> self display-state) ) ) - ((= (-> event param 0) 'error) - (let ((t9-4 format) - (a0-17 #t) - (a1-2 "ERROR NOTIFY: ~S ~D~%") - (v1-13 (-> event param 1)) - ) - (t9-4 - a0-17 - a1-2 - (cond - ((= v1-13 17) - "no-auto-save" - ) - ((= v1-13 16) - "no-process" - ) - ((= v1-13 15) - "bad-version" - ) - ((= v1-13 14) - "no-space" - ) - ((= v1-13 13) - "no-save" - ) - ((= v1-13 12) - "no-file" - ) - ((= v1-13 11) - "no-format" - ) - ((= v1-13 10) - "no-last" - ) - ((= v1-13 9) - "no-card" - ) - ((= v1-13 8) - "no-memory" - ) - ((= v1-13 7) - "new-game" - ) - ((= v1-13 6) - "read-error" - ) - ((= v1-13 5) - "write-error" - ) - ((= v1-13 4) - "internal-error" - ) - ((= v1-13 3) - "format-failed" - ) - ((= v1-13 2) - "bad-handle" - ) - ((= v1-13 1) - "ok" - ) - ((zero? v1-13) - "busy" - ) - (else - "*unknown*" - ) - ) - (-> self display-state) - ) - ) - (case (-> event param 1) - ((14) - (set! v0-0 (the-as none 7)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - (else - (case (-> self display-state) - (((progress-screen memcard-formatting)) - (set! v0-0 (the-as none 24)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - (((progress-screen memcard-creating)) - (set! v0-0 (the-as none 25)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - (((progress-screen memcard-saving)) - (set! v0-0 (the-as none 21)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - (((progress-screen memcard-loading)) - (set! v0-0 (the-as none 20)) - (set! (-> self next-display-state) (the-as progress-screen v0-0)) - v0-0 - ) - ) + (case (-> event param 1) + ((14) + (set! v0-0 (the-as none 7)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (else + (case (-> self display-state) + (((progress-screen memcard-formatting)) + (set! v0-0 (the-as none 24)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-creating)) + (set! v0-0 (the-as none 25)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-saving)) + (set! v0-0 (the-as none 21)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) + (((progress-screen memcard-loading)) + (set! v0-0 (the-as none 20)) + (set! (-> self next-display-state) (the-as progress-screen v0-0)) + v0-0 + ) ) ) ) - ) + ) ) - ) - ) - ) + ) + ) + ) ) :code (behavior () (loop diff --git a/test/decompiler/reference/jak1/levels/beach/pelican_REF.gc b/test/decompiler/reference/jak1/levels/beach/pelican_REF.gc index 463bfab161..331a187895 100644 --- a/test/decompiler/reference/jak1/levels/beach/pelican_REF.gc +++ b/test/decompiler/reference/jak1/levels/beach/pelican_REF.gc @@ -232,26 +232,24 @@ ;; failed to figure out what this is: (defstate pelican-circle (pelican) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'dive) - (let ((v0-0 (the-as structure #t))) - (set! (-> self state-object) (the-as symbol v0-0)) - v0-0 - ) + (the-as + object + (case event-type + (('dive) + (let ((v0-0 (the-as structure #t))) + (set! (-> self state-object) (the-as symbol v0-0)) + v0-0 ) - ((= v1-0 'fuel-cell) - (handle->process (-> self fuel-cell)) + ) + (('fuel-cell) + (handle->process (-> self fuel-cell)) + ) + (('position) + (set! (-> self path-pos) (the-as float (-> event param 0))) + (let ((a1-3 (TODO-RENAME-12 (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos)))) + (set-heading-vec! (-> self root-override) a1-3) ) - ((= v1-0 'position) - (set! (-> self path-pos) (the-as float (-> event param 0))) - (let ((a1-3 (TODO-RENAME-12 (-> self path) (new 'stack-no-clear 'vector) (-> self path-pos)))) - (set-heading-vec! (-> self root-override) a1-3) - ) - ) - ) + ) ) ) ) @@ -371,17 +369,15 @@ ;; failed to figure out what this is: (defstate pelican-dive (pelican) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'got-cell?) - (-> self state-object) - ) - ((= v1-0 'fuel-cell) - (handle->process (-> self fuel-cell)) - ) - ) - ) - ) + (the-as object (case event-type + (('got-cell?) + (-> self state-object) + ) + (('fuel-cell) + (handle->process (-> self fuel-cell)) + ) + ) + ) ) :enter (behavior ((arg0 path-control) (arg1 curve-control) (arg2 time-frame)) (init! (-> self query) (the-as string #f) 40 150 25 #t (the-as string #f)) @@ -490,53 +486,51 @@ ;; failed to figure out what this is: (defstate pelican-wait-at-nest (pelican) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'attack) - (case (-> event param 1) - (('explode) - (let ((a0-2 (handle->process (-> self fuel-cell)))) - (if a0-2 - (send-event a0-2 'trans (-> self root-override trans)) - ) - ) - (go pelican-explode #f) - #f + (the-as + object + (case event-type + (('attack) + (case (-> event param 1) + (('explode) + (let ((a0-2 (handle->process (-> self fuel-cell)))) + (if a0-2 + (send-event a0-2 'trans (-> self root-override trans)) + ) ) - (else - (let* ((gp-0 proc) - (v1-13 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) - gp-0 - ) - ) - (f30-0 8192.0) - (gp-1 (-> self root-override)) - (s4-0 (-> (the-as process-drawable v1-13) root trans)) - ) - (if (< f30-0 - (fabs - (deg-diff (y-angle gp-1) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s4-0 (-> gp-1 trans)))) - ) + (go pelican-explode #f) + #f + ) + (else + (let* ((gp-0 proc) + (v1-13 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 + ) + ) + (f30-0 8192.0) + (gp-1 (-> self root-override)) + (s4-0 (-> (the-as process-drawable v1-13) root trans)) + ) + (if (< f30-0 + (fabs + (deg-diff (y-angle gp-1) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s4-0 (-> gp-1 trans)))) ) - (go pelican-spit) - ) - ) + ) + (go pelican-spit) + ) ) ) ) - ((= v1-0 'touch) - (send-shove-back - (-> self root-override) - proc - (the-as touching-shapes-entry (-> event param 0)) - 0.7 - 6144.0 - 16384.0 - ) + ) + (('touch) + (send-shove-back + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc index 4f38bb5e81..59692492f4 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-obs_REF.gc @@ -483,13 +483,13 @@ ;; failed to figure out what this is: (defstate citb-disc-idle (citb-disc) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (send-event proc 'no-look-around (seconds 0.25)) - #f - ) - ) - ) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 0.25)) + #f + ) + ) + ) ) :trans (the-as (function none :behavior citb-disc) rider-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/citadel/citadel-sages_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citadel-sages_REF.gc index 05f65fb8a2..4824f6459b 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citadel-sages_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citadel-sages_REF.gc @@ -107,34 +107,32 @@ (defstate citb-sagecage-idle (citb-sagecage) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-3 none)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'disable-bars) - (stop! (-> self sound)) - (sound-play "sagecage-off") - (set! (-> self bars-on) #f) - (citb-sagecage-update-collision) + (the-as object (case event-type + (('disable-bars) + (stop! (-> self sound)) + (sound-play "sagecage-off") + (set! (-> self bars-on) #f) + (citb-sagecage-update-collision) + ) + (('enable-bars) + (set! (-> self bars-on) #t) + (citb-sagecage-update-collision) + ) + (('start-cloning) + (set! v0-3 (the-as none #t)) + (set! (-> self cloning) (the-as symbol v0-3)) + v0-3 + ) + (('stop-cloning) + (set! (-> self cloning) #f) + (let ((v1-7 (-> self skel root-channel 0))) + (set! v0-3 (the-as none (-> self draw art-group data 3))) + (set! (-> v1-7 frame-group) (the-as art-joint-anim v0-3)) ) - ((= v1-0 'enable-bars) - (set! (-> self bars-on) #t) - (citb-sagecage-update-collision) - ) - ((= v1-0 'start-cloning) - (set! v0-3 (the-as none #t)) - (set! (-> self cloning) (the-as symbol v0-3)) - v0-3 - ) - ((= v1-0 'stop-cloning) - (set! (-> self cloning) #f) - (let ((v1-7 (-> self skel root-channel 0))) - (set! v0-3 (the-as none (-> self draw art-group data 3))) - (set! (-> v1-7 frame-group) (the-as art-joint-anim v0-3)) - ) - v0-3 - ) - ) - ) - ) + v0-3 + ) + ) + ) ) :trans (the-as (function none :behavior citb-sagecage) rider-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc index 08b21925e5..a73ab04c72 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-drop-plat_REF.gc @@ -546,20 +546,18 @@ ;; failed to figure out what this is: (defstate citb-drop-plat-active (citb-drop-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'player-stepped) - (when (>= (- (-> *display* base-frame-counter) (-> self drop-time)) (seconds 0.2)) - (set! (-> self drop-time) (-> *display* base-frame-counter)) - (citb-drop-plat-drop-children (the-as int (-> event param 0))) - ) + (the-as object (case event-type + (('player-stepped) + (when (>= (- (-> *display* base-frame-counter) (-> self drop-time)) (seconds 0.2)) + (set! (-> self drop-time) (-> *display* base-frame-counter)) + (citb-drop-plat-drop-children (the-as int (-> event param 0))) ) - ((= v1-0 'trigger) - (go citb-drop-plat-idle) - ) - ) - ) - ) + ) + (('trigger) + (go citb-drop-plat-idle) + ) + ) + ) ) :code (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc index 32723149ed..f05cb0a09e 100644 --- a/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/citadel/citb-plat_REF.gc @@ -344,16 +344,16 @@ (defstate citb-base-plat-idle (citb-stair-plat) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'trigger) - (logclear! (-> self mask) (process-mask actor-pause)) - (let ((v0-0 #t)) - (set! (-> self rise) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('trigger) + (logclear! (-> self mask) (process-mask actor-pause)) + (let ((v0-0 #t)) + (set! (-> self rise) v0-0) + v0-0 + ) + ) + ) + ) ) :trans (the-as (function none :behavior citb-stair-plat) #f) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/common/baseplat_REF.gc b/test/decompiler/reference/jak1/levels/common/baseplat_REF.gc index 83c18b0a63..046be8c459 100644 --- a/test/decompiler/reference/jak1/levels/common/baseplat_REF.gc +++ b/test/decompiler/reference/jak1/levels/common/baseplat_REF.gc @@ -123,12 +123,12 @@ ;; definition for function plat-event ;; INFO: Return type mismatch none vs object. (defbehavior plat-event baseplat ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (if (= v1-0 'bonk) - (dummy-22 self) - ) - ) - ) + (the-as object (case arg2 + (('bonk) + (dummy-22 self) + ) + ) + ) ) ;; definition of type eco-door @@ -184,23 +184,23 @@ ;; definition for function eco-door-event-handler ;; INFO: Return type mismatch symbol vs object. (defbehavior eco-door-event-handler eco-door ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (when (= v1-0 'trigger) - (set! (-> self locked) (not (-> self locked))) - (cond - ((-> self locked) - (if (= (-> self next-state name) 'door-closed) - (sound-play "door-lock") - ) - ) - (else - (sound-play "door-unlock") - ) + (the-as object (case arg2 + (('trigger) + (set! (-> self locked) (not (-> self locked))) + (cond + ((-> self locked) + (if (= (-> self next-state name) 'door-closed) + (sound-play "door-lock") + ) ) - #t - ) - ) - ) + (else + (sound-play "door-unlock") + ) + ) + #t + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/common/water-anim_REF.gc b/test/decompiler/reference/jak1/levels/common/water-anim_REF.gc index c8a16cab7d..707b7d8bca 100644 --- a/test/decompiler/reference/jak1/levels/common/water-anim_REF.gc +++ b/test/decompiler/reference/jak1/levels/common/water-anim_REF.gc @@ -554,20 +554,20 @@ (defstate water-vol-idle (water-anim) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'move-to) - (set! (-> self root trans quad) (-> (the-as vector (-> event param 0)) quad)) - (set! (-> self water-height) (-> self root trans y)) - (if (nonzero? (-> self sound)) - (update-trans! (-> self sound) (-> self root trans)) - ) - (let ((v0-0 (logclear (-> self mask) (process-mask sleep-code)))) - (set! (-> self mask) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('move-to) + (set! (-> self root trans quad) (-> (the-as vector (-> event param 0)) quad)) + (set! (-> self water-height) (-> self root trans y)) + (if (nonzero? (-> self sound)) + (update-trans! (-> self sound) (-> self root trans)) + ) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) + ) ) :trans (behavior () (let ((t9-0 (-> (method-of-type water-vol water-vol-idle) trans))) diff --git a/test/decompiler/reference/jak1/levels/darkcave/darkcave-obs_REF.gc b/test/decompiler/reference/jak1/levels/darkcave/darkcave-obs_REF.gc index 8059a3ca49..91df2acd61 100644 --- a/test/decompiler/reference/jak1/levels/darkcave/darkcave-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/darkcave/darkcave-obs_REF.gc @@ -146,23 +146,23 @@ ;; failed to figure out what this is: (defstate cavecrystal-active (cavecrystal) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'attack) - (let ((v1-1 (-> event param 2))) - (cond - ((!= v1-1 (-> self player-attack-id)) - (set! (-> self player-attack-id) v1-1) - (set! (-> self activated-time) (-> *display* game-frame-counter)) - #t - ) - (else - #f - ) + (the-as object (case event-type + (('attack) + (let ((v1-1 (-> event param 2))) + (cond + ((!= v1-1 (-> self player-attack-id)) + (set! (-> self player-attack-id) v1-1) + (set! (-> self activated-time) (-> *display* game-frame-counter)) + #t ) - ) - ) - ) - ) + (else + #f + ) + ) + ) + ) + ) + ) ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) diff --git a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc index 7f6f3e735d..e4d5f8017d 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/final-door_REF.gc @@ -108,23 +108,23 @@ (defstate open (final-door) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'brightness) - (let ((f0-0 (the-as float (-> event param 0))) - (f1-0 (the-as float (-> event param 1))) - ) - (set-vector! (-> self draw color-mult) f0-0 f0-0 f0-0 f0-0) - (let ((v0-0 (-> self draw color-emissive))) - (set! (-> v0-0 x) f1-0) - (set! (-> v0-0 y) f1-0) - (set! (-> v0-0 z) f1-0) - (set! (-> v0-0 w) f1-0) - v0-0 - ) - ) - ) - ) - ) + (the-as object (case event-type + (('brightness) + (let ((f0-0 (the-as float (-> event param 0))) + (f1-0 (the-as float (-> event param 1))) + ) + (set-vector! (-> self draw color-mult) f0-0 f0-0 f0-0 f0-0) + (let ((v0-0 (-> self draw color-emissive))) + (set! (-> v0-0 x) f1-0) + (set! (-> v0-0 y) f1-0) + (set! (-> v0-0 z) f1-0) + (set! (-> v0-0 w) f1-0) + v0-0 + ) + ) + ) + ) + ) ) :code (behavior ((arg0 symbol)) (case (-> self type) diff --git a/test/decompiler/reference/jak1/levels/finalboss/light-eco_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/light-eco_REF.gc index 6fa9346023..10e26fb755 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/light-eco_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/light-eco_REF.gc @@ -707,32 +707,30 @@ ;; definition for function light-eco-mother-default-event-handler ;; INFO: Return type mismatch object vs int. (defbehavior light-eco-mother-default-event-handler light-eco-mother ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as - int - (cond - ((= v1-0 'untrigger) - (the-as int (when (= (-> arg0 type) light-eco-child) - (let* ((a1-3 (-> arg3 param 0)) - (v0-0 (logxor (-> self angle-mask) (ash 1 a1-3))) - ) - (set! (-> self angle-mask) v0-0) - v0-0 - ) + (the-as + int + (case arg2 + (('untrigger) + (the-as int (when (= (-> arg0 type) light-eco-child) + (let* ((a1-3 (-> arg3 param 0)) + (v0-0 (logxor (-> self angle-mask) (ash 1 a1-3))) + ) + (set! (-> self angle-mask) v0-0) + v0-0 ) - ) - ) - ((= v1-0 'trigger) - (the-as int (when (not (-> self player-got-eco?)) - (set! (-> self player-got-eco?) #t) - (the-as int (send-event (ppointer->process (-> self parent)) 'white-eco-picked-up)) - ) - ) - ) - ((= v1-0 'beam-off) - (the-as int (go light-eco-mother-discipate)) - ) - ) + ) + ) + ) + (('trigger) + (the-as int (when (not (-> self player-got-eco?)) + (set! (-> self player-got-eco?) #t) + (the-as int (send-event (ppointer->process (-> self parent)) 'white-eco-picked-up)) + ) + ) + ) + (('beam-off) + (the-as int (go light-eco-mother-discipate)) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc index 5c8dad1925..28cf782fba 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss-misc_REF.gc @@ -181,59 +181,57 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 28] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 79] (defbehavior ecoclaw-handler ecoclaw ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'open) - (let ((gp-1 (-> arg3 param 0))) - (set! (-> self particles 0 kind) - (the-as basic (if (and (nonzero? gp-1) (type-type? (rtype-of gp-1) sparticle-launch-group)) - gp-1 - ) - ) - ) - ) - (set! (-> self particles 0 trans quad) (-> self root trans quad)) - (set! (-> self particles 0 trans y) (+ 12288.0 (-> self particles 0 trans y))) - ) - ((= v1-0 'beam-on) - (let ((s5-0 (-> arg3 param 0))) - (set! (-> self particles 1 kind) - (the-as basic (if (and (nonzero? s5-0) (type-type? (rtype-of s5-0) sparticle-launch-group)) - s5-0 - ) - ) - ) - ) - (set! (-> self particles 1 trans quad) (-> self root trans quad)) - (set! (-> self particles 1 trans y) (+ 24576.0 (-> self particles 1 trans y))) - (let ((s5-1 (-> arg3 param 1))) - (set! (-> self particles 2 kind) - (the-as basic (if (and (nonzero? s5-1) (type-type? (rtype-of s5-1) sparticle-launch-group)) - s5-1 - ) - ) - ) - ) - (set! (-> self particles 2 trans quad) (-> (the-as vector (-> arg3 param 2)) quad)) - (set! (-> self particles 2 trans y) (+ 81920.0 (-> self particles 2 trans y))) - ) - ((= v1-0 'beam-off) - (set! (-> self particles 1 kind) #f) - (set! (-> self particles 2 kind) #f) - (let ((a0-10 (handle->process (-> self particles 1 tracker)))) - (if a0-10 - (deactivate a0-10) + (the-as + object + (case arg2 + (('open) + (let ((gp-1 (-> arg3 param 0))) + (set! (-> self particles 0 kind) + (the-as basic (if (and (nonzero? gp-1) (type-type? (rtype-of gp-1) sparticle-launch-group)) + gp-1 + ) + ) ) - ) - (let ((a0-14 (handle->process (-> self particles 2 tracker)))) - (if a0-14 - (deactivate a0-14) - ) - ) ) - ) + (set! (-> self particles 0 trans quad) (-> self root trans quad)) + (set! (-> self particles 0 trans y) (+ 12288.0 (-> self particles 0 trans y))) + ) + (('beam-on) + (let ((s5-0 (-> arg3 param 0))) + (set! (-> self particles 1 kind) + (the-as basic (if (and (nonzero? s5-0) (type-type? (rtype-of s5-0) sparticle-launch-group)) + s5-0 + ) + ) + ) + ) + (set! (-> self particles 1 trans quad) (-> self root trans quad)) + (set! (-> self particles 1 trans y) (+ 24576.0 (-> self particles 1 trans y))) + (let ((s5-1 (-> arg3 param 1))) + (set! (-> self particles 2 kind) + (the-as basic (if (and (nonzero? s5-1) (type-type? (rtype-of s5-1) sparticle-launch-group)) + s5-1 + ) + ) + ) + ) + (set! (-> self particles 2 trans quad) (-> (the-as vector (-> arg3 param 2)) quad)) + (set! (-> self particles 2 trans y) (+ 81920.0 (-> self particles 2 trans y))) + ) + (('beam-off) + (set! (-> self particles 1 kind) #f) + (set! (-> self particles 2 kind) #f) + (let ((a0-10 (handle->process (-> self particles 1 tracker)))) + (if a0-10 + (deactivate a0-10) + ) + ) + (let ((a0-14 (handle->process (-> self particles 2 tracker)))) + (if a0-14 + (deactivate a0-14) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc index e9b3fe9461..49b6f19096 100644 --- a/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/finalboss/robotboss_REF.gc @@ -403,38 +403,36 @@ ;; definition for function robotboss-handler ;; INFO: Return type mismatch number vs object. (defbehavior robotboss-handler robotboss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'flash) - (set! (-> self palette-val) (* 0.0078125 (the-as float (-> arg3 param 0)))) - ) - ((= v1-0 'attack) - (when (>= arg1 2) - (case (-> arg3 param 1) - (('eco-yellow) - (let ((a0-5 (-> arg3 param 0))) - (when (and a0-5 ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry a0-5) - (-> self root-override) - (the-as uint (-> self vulnerable)) - ) - ) - (when (> (-> self hits-to-go) 0) - (set! (-> self took-hit) #t) - (let ((v0-0 (the-as number (+ (-> self hits-to-go) -1)))) - (set! (-> self hits-to-go) (the-as int v0-0)) - v0-0 - ) + (the-as object (case arg2 + (('flash) + (set! (-> self palette-val) (* 0.0078125 (the-as float (-> arg3 param 0)))) + ) + (('attack) + (when (>= arg1 2) + (case (-> arg3 param 1) + (('eco-yellow) + (let ((a0-5 (-> arg3 param 0))) + (when (and a0-5 ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry a0-5) + (-> self root-override) + (the-as uint (-> self vulnerable)) + ) + ) + (when (> (-> self hits-to-go) 0) + (set! (-> self took-hit) #t) + (let ((v0-0 (the-as number (+ (-> self hits-to-go) -1)))) + (set! (-> self hits-to-go) (the-as int v0-0)) + v0-0 ) ) ) ) - ) + ) ) ) - ) - ) - ) + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/firecanyon/firecanyon-obs_REF.gc b/test/decompiler/reference/jak1/levels/firecanyon/firecanyon-obs_REF.gc index 76bd9f6ecb..96f799affd 100644 --- a/test/decompiler/reference/jak1/levels/firecanyon/firecanyon-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/firecanyon/firecanyon-obs_REF.gc @@ -203,12 +203,12 @@ ;; failed to figure out what this is: (defstate spike-up (spike) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'go-spike-up) - #t - ) - ) - ) + (the-as object (case event-type + (('go-spike-up) + #t + ) + ) + ) ) :trans (behavior () (when (nonzero? (-> self num-alts)) @@ -255,13 +255,13 @@ ;; failed to figure out what this is: (defstate spike-down (spike) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'go-spike-up) - (go spike-up) - #t - ) - ) - ) + (the-as object (case event-type + (('go-spike-up) + (go spike-up) + #t + ) + ) + ) ) :trans (behavior () (when (nonzero? (-> self num-alts)) diff --git a/test/decompiler/reference/jak1/levels/flut_common/flutflut_REF.gc b/test/decompiler/reference/jak1/levels/flut_common/flutflut_REF.gc index a97742e079..6a95aad050 100644 --- a/test/decompiler/reference/jak1/levels/flut_common/flutflut_REF.gc +++ b/test/decompiler/reference/jak1/levels/flut_common/flutflut_REF.gc @@ -93,24 +93,22 @@ (defstate wait-for-start (flutflut) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'trans) - (vector+! (the-as vector (-> event param 0)) (-> self root-override trans) (-> self extra-trans)) + (the-as + object + (case event-type + (('trans) + (vector+! (the-as vector (-> event param 0)) (-> self root-override trans) (-> self extra-trans)) + ) + (('notify) + (let ((v0-1 (the-as structure #t))) + (set! (-> self auto-get-off) (the-as symbol v0-1)) + v0-1 ) - ((= v1-0 'notify) - (let ((v0-1 (the-as structure #t))) - (set! (-> self auto-get-off) (the-as symbol v0-1)) - v0-1 - ) - ) - ((or (= v1-0 'touch) (= v1-0 'attack)) - (set! (-> self touch-time) (-> *display* base-frame-counter)) - #f - ) - ) + ) + (('touch 'attack) + (set! (-> self touch-time) (-> *display* base-frame-counter)) + #f + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/jungle/darkvine_REF.gc b/test/decompiler/reference/jak1/levels/jungle/darkvine_REF.gc index 500926b6a0..00e845c97f 100644 --- a/test/decompiler/reference/jak1/levels/jungle/darkvine_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/darkvine_REF.gc @@ -142,35 +142,33 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 50] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 52] (defbehavior darkvine-event-handler darkvine ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'touch) - (do-push-aways! (-> self root-override)) - (when (-> self dangerous) - (if (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) - (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) - ) - ) + (the-as object (case arg2 + (('touch) + (do-push-aways! (-> self root-override)) + (when (-> self dangerous) + (if (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) + ) ) - ((= v1-0 'attack) - (let ((v1-10 (-> arg3 param 2))) - (cond - ((!= v1-10 (-> self player-attack-id)) - (set! (-> self player-attack-id) (the-as int v1-10)) - (when (-> self vulnerable) - (do-push-aways! (-> self root-override)) - (go darkvine-retreat) - ) + ) + (('attack) + (let ((v1-10 (-> arg3 param 2))) + (cond + ((!= v1-10 (-> self player-attack-id)) + (set! (-> self player-attack-id) (the-as int v1-10)) + (when (-> self vulnerable) + (do-push-aways! (-> self root-override)) + (go darkvine-retreat) ) - (else - 'push - ) + ) + (else + 'push ) ) ) - ) - ) - ) + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/jungle/fisher_REF.gc b/test/decompiler/reference/jak1/levels/jungle/fisher_REF.gc index 6c42b520ad..ee7531299a 100644 --- a/test/decompiler/reference/jak1/levels/jungle/fisher_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/fisher_REF.gc @@ -1824,29 +1824,27 @@ :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 rgbaf)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'emissive-on) - (set-vector! (-> self draw color-mult) 0.6 0.6 0.6 1.0) - (set! v0-0 (-> self draw color-emissive)) - (set! (-> v0-0 x) 0.6) - (set! (-> v0-0 y) 0.6) - (set! (-> v0-0 z) 0.6) - (set! (-> v0-0 w) 0.0) - v0-0 - ) - ((= v1-0 'emissive-off) - (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) - (set! v0-0 (-> self draw color-emissive)) - (set! (-> v0-0 x) 0.0) - (set! (-> v0-0 y) 0.0) - (set! (-> v0-0 z) 0.0) - (set! (-> v0-0 w) 0.0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('emissive-on) + (set-vector! (-> self draw color-mult) 0.6 0.6 0.6 1.0) + (set! v0-0 (-> self draw color-emissive)) + (set! (-> v0-0 x) 0.6) + (set! (-> v0-0 y) 0.6) + (set! (-> v0-0 z) 0.6) + (set! (-> v0-0 w) 0.0) + v0-0 + ) + (('emissive-off) + (set-vector! (-> self draw color-mult) 1.0 1.0 1.0 1.0) + (set! v0-0 (-> self draw color-emissive)) + (set! (-> v0-0 x) 0.0) + (set! (-> v0-0 y) 0.0) + (set! (-> v0-0 z) 0.0) + (set! (-> v0-0 w) 0.0) + v0-0 + ) + ) + ) ) :trans (behavior () (when (-> self training) diff --git a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc index 049d5484b7..ba562e0350 100644 --- a/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungle/jungle-obs_REF.gc @@ -211,13 +211,13 @@ ;; failed to figure out what this is: (defstate lurkerm-tall-sail-idle (lurkerm-tall-sail) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'stop) - (process-entity-status! self (entity-perm-status complete) #t) - (set! (-> self speed) 0.0) - ) - ) - ) + (the-as object (case event-type + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self speed) 0.0) + ) + ) + ) ) :trans (the-as (function none :behavior lurkerm-tall-sail) rider-trans) :code (behavior () @@ -317,13 +317,13 @@ ;; failed to figure out what this is: (defstate lurkerm-short-sail-idle (lurkerm-short-sail) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'stop) - (process-entity-status! self (entity-perm-status complete) #t) - (set! (-> self speed) 0.0) - ) - ) - ) + (the-as object (case event-type + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self speed) 0.0) + ) + ) + ) ) :trans (the-as (function none :behavior lurkerm-short-sail) rider-trans) :code (behavior () @@ -446,13 +446,13 @@ ;; failed to figure out what this is: (defstate lurkerm-piston-idle (lurkerm-piston) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'stop) - (process-entity-status! self (entity-perm-status complete) #t) - (set! (-> self speed) 0.0) - ) - ) - ) + (the-as object (case event-type + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self speed) 0.0) + ) + ) + ) ) :trans (the-as (function none :behavior lurkerm-piston) rider-trans) :code (behavior () @@ -573,13 +573,13 @@ ;; failed to figure out what this is: (defstate accordian-idle (accordian) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'stop) - (process-entity-status! self (entity-perm-status complete) #t) - (set! (-> self speed) 0.0) - ) - ) - ) + (the-as object (case event-type + (('stop) + (process-entity-status! self (entity-perm-status complete) #t) + (set! (-> self speed) 0.0) + ) + ) + ) ) :code (behavior () (ja-no-eval :num! (loop!) :frame-num 0.0) @@ -838,19 +838,19 @@ ;; failed to figure out what this is: (defstate precurbridge-active (precurbridge) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (when (= v1-0 'bonk) - (let* ((gp-0 (the-as object (-> event param 0))) - (a0-2 (-> (the-as touching-shapes-entry gp-0) head)) - (s5-0 (-> self root-override)) - ) - (get-touched-prim a0-2 s5-0 (the-as touching-shapes-entry gp-0)) - ((method-of-type touching-shapes-entry get-touched-shape) (the-as touching-shapes-entry gp-0) s5-0) - ) - (activate! (-> self smush) -1.0 150 600 1.0 1.0) - ) + (the-as + object + (case event-type + (('bonk) + (let* ((gp-0 (the-as object (-> event param 0))) + (a0-2 (-> (the-as touching-shapes-entry gp-0) head)) + (s5-0 (-> self root-override)) + ) + (get-touched-prim a0-2 s5-0 (the-as touching-shapes-entry gp-0)) + ((method-of-type touching-shapes-entry get-touched-shape) (the-as touching-shapes-entry gp-0) s5-0) + ) + (activate! (-> self smush) -1.0 150 600 1.0 1.0) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/jungleb/jungleb-obs_REF.gc b/test/decompiler/reference/jak1/levels/jungleb/jungleb-obs_REF.gc index c10b0f1bb0..bcd6a7e81a 100644 --- a/test/decompiler/reference/jak1/levels/jungleb/jungleb-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungleb/jungleb-obs_REF.gc @@ -199,18 +199,18 @@ ;; failed to figure out what this is: (defstate eggtop-idle (eggtop) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (case (-> event param 0) - (('pickup) - (if (type-type? (-> proc type) fuel-cell) - (save-reminder (get-task-control (-> self entity extra perm task)) 1 0) - ) - ) + (the-as object (case event-type + (('notify) + (case (-> event param 0) + (('pickup) + (if (type-type? (-> proc type) fuel-cell) + (save-reminder (get-task-control (-> self entity extra perm task)) 1 0) + ) ) - ) - ) - ) + ) + ) + ) + ) ) :exit (behavior () (sound-stop (-> self sound-id)) diff --git a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc index 1c1db95697..82daae994c 100644 --- a/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc +++ b/test/decompiler/reference/jak1/levels/jungleb/plat-flip_REF.gc @@ -51,18 +51,16 @@ ;; failed to figure out what this is: (defstate plat-flip-idle (plat-flip) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (activate! (-> self smush) -1.0 90 300 1.0 1.0) - ) - ((= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - (the-as smush-control #f) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (activate! (-> self smush) -1.0 90 300 1.0 1.0) + ) + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + (the-as smush-control #f) + ) + ) + ) ) :trans (the-as (function none :behavior plat-flip) rider-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/lavatube/lavatube-energy_REF.gc b/test/decompiler/reference/jak1/levels/lavatube/lavatube-energy_REF.gc index f73741f004..0b9ad00980 100644 --- a/test/decompiler/reference/jak1/levels/lavatube/lavatube-energy_REF.gc +++ b/test/decompiler/reference/jak1/levels/lavatube/lavatube-energy_REF.gc @@ -426,12 +426,12 @@ ;; definition for function energydoor-open-handler ;; INFO: Return type mismatch symbol vs object. (defbehavior energydoor-open-handler energydoor ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (if (= v1-0 'open?) - #t - ) - ) - ) + (the-as object (case arg2 + (('open?) + #t + ) + ) + ) ) ;; definition for function energydoor-closed-handler @@ -862,28 +862,28 @@ ;; failed to figure out what this is: (defstate energyball-idle (energyball) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'attack) - (when (and (>= arg1 2) (= (-> event param 1) 'eco-yellow)) - (increment-success-for-hint (game-text-id lavatube-balls)) - (sound-play "dcrate-break") - (process-spawn - part-tracker - :init part-tracker-init - (-> *part-group-id-table* 546) - 600 - #f - #f - #f - (-> self root-override trans) - :to *entity-pool* - ) - (cleanup-for-death self) - (deactivate self) - ) - ) - ) - ) + (the-as object (case event-type + (('attack) + (when (and (>= arg1 2) (= (-> event param 1) 'eco-yellow)) + (increment-success-for-hint (game-text-id lavatube-balls)) + (sound-play "dcrate-break") + (process-spawn + part-tracker + :init part-tracker-init + (-> *part-group-id-table* 546) + 600 + #f + #f + #f + (-> self root-override trans) + :to *entity-pool* + ) + (cleanup-for-death self) + (deactivate self) + ) + ) + ) + ) ) :trans (behavior () (rider-trans) @@ -1351,12 +1351,12 @@ ;; failed to figure out what this is: (defstate energyhub-stop (energyhub) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'flash) - (set! (-> self palette-val) 1.9921875) - ) - ) - ) + (the-as object (case event-type + (('flash) + (set! (-> self palette-val) 1.9921875) + ) + ) + ) ) :enter (behavior () (set! (-> self rotation-speed target) 0.0) @@ -1433,12 +1433,12 @@ ;; failed to figure out what this is: (defstate energyhub-idle (energyhub) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'flash) - (set! (-> self palette-val) 1.9921875) - ) - ) - ) + (the-as object (case event-type + (('flash) + (set! (-> self palette-val) 1.9921875) + ) + ) + ) ) :trans (behavior () (if (nonzero? (-> self sound)) diff --git a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc index a2265ee545..ac8cc77141 100644 --- a/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/gnawer_REF.gc @@ -1224,14 +1224,14 @@ ;; failed to figure out what this is: (defstate gnawer-dying-give-pickups (gnawer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (if (and (= (-> proc type) money) (= (-> event param 0) 'pickup)) - (dummy-30 self (the-as process-drawable proc)) - ) - ) - ) - ) + (the-as object (case event-type + (('notify) + (if (and (= (-> proc type) money) (= (-> event param 0) 'pickup)) + (dummy-30 self (the-as process-drawable proc)) + ) + ) + ) + ) ) :trans (behavior () (spool-push *art-control* "maincavecam-gnawer-fuel-cell" 0 self -1.0) @@ -1296,23 +1296,23 @@ ;; failed to figure out what this is: (defstate gnawer-give-fuel-cell (gnawer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (cond - ((and (= (-> proc type) maincavecam) (= (-> event param 0) 'die)) - (process-entity-status! self (entity-perm-status bit-3) #f) - (let ((v0-0 (the-as uint (logior (-> self mask) (process-mask actor-pause))))) - (set! (-> self mask) (the-as process-mask v0-0)) - v0-0 - ) - ) - ((and (= (-> proc type) money) (= (-> event param 0) 'pickup)) - (dummy-30 self (the-as process-drawable proc)) - ) + (the-as object (case event-type + (('notify) + (cond + ((and (= (-> proc type) maincavecam) (= (-> event param 0) 'die)) + (process-entity-status! self (entity-perm-status bit-3) #f) + (let ((v0-0 (the-as uint (logior (-> self mask) (process-mask actor-pause))))) + (set! (-> self mask) (the-as process-mask v0-0)) + v0-0 + ) ) - ) - ) - ) + ((and (= (-> proc type) money) (= (-> event param 0) 'pickup)) + (dummy-30 self (the-as process-drawable proc)) + ) + ) + ) + ) + ) ) :code (behavior () (when (not (task-complete? *game-info* (-> self entity extra perm task))) @@ -1365,14 +1365,14 @@ ;; failed to figure out what this is: (defstate gnawer-put-items-at-dest (gnawer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (if (and (= (-> proc type) money) (= (-> event param 0) 'pickup)) - (dummy-30 self (the-as process-drawable proc)) - ) - ) - ) - ) + (the-as object (case event-type + (('notify) + (if (and (= (-> proc type) money) (= (-> event param 0) 'pickup)) + (dummy-30 self (the-as process-drawable proc)) + ) + ) + ) + ) ) :code (behavior () (set! (-> self draw origin-joint-index) (the-as uint 0)) diff --git a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc index 3d2f91cd64..eb1a780b31 100644 --- a/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/maincave-obs_REF.gc @@ -162,21 +162,21 @@ ;; failed to figure out what this is: (defstate cavecrusher-idle (cavecrusher) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (or (= v1-0 'touch) (= v1-0 'attack)) - (when (= (-> proc type) target) - (if ((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry (-> event param 0)) - (-> *target* control) - (collide-action solid) - (collide-action) - ) - (target-attack-up *target* 'attack-or-shove 'deadlyup) + (the-as object (case event-type + (('touch 'attack) + (when (= (-> proc type) target) + (if ((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry (-> event param 0)) + (-> *target* control) + (collide-action solid) + (collide-action) ) - ) - ) - ) - ) + (target-attack-up *target* 'attack-or-shove 'deadlyup) + ) + ) + ) + ) + ) ) :code (behavior () (loop @@ -1066,12 +1066,12 @@ ;; failed to figure out what this is: (defstate caveelevator-cycle-active (caveelevator) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (activate! (-> self smush) -1.0 60 150 1.0 1.0) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (activate! (-> self smush) -1.0 60 150 1.0 1.0) + ) + ) + ) ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) @@ -1149,12 +1149,12 @@ ;; failed to figure out what this is: (defstate caveelevator-one-way-travel-to-end (caveelevator) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (activate! (-> self smush) -1.0 60 150 1.0 1.0) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (activate! (-> self smush) -1.0 60 150 1.0 1.0) + ) + ) + ) ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) @@ -1189,12 +1189,12 @@ ;; failed to figure out what this is: (defstate caveelevator-one-way-idle-end (caveelevator) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (activate! (-> self smush) -1.0 60 150 1.0 1.0) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (activate! (-> self smush) -1.0 60 150 1.0 1.0) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) @@ -1232,12 +1232,12 @@ ;; failed to figure out what this is: (defstate caveelevator-one-way-travel-to-start (caveelevator) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (activate! (-> self smush) -1.0 60 150 1.0 1.0) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (activate! (-> self smush) -1.0 60 150 1.0 1.0) + ) + ) + ) ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) diff --git a/test/decompiler/reference/jak1/levels/maincave/mother-spider-egg_REF.gc b/test/decompiler/reference/jak1/levels/maincave/mother-spider-egg_REF.gc index 154aba5395..d72f0c81c6 100644 --- a/test/decompiler/reference/jak1/levels/maincave/mother-spider-egg_REF.gc +++ b/test/decompiler/reference/jak1/levels/maincave/mother-spider-egg_REF.gc @@ -289,24 +289,22 @@ ;; failed to figure out what this is: (defstate mother-spider-egg-on-ground (mother-spider-egg) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'touch) - (send-shove-back - (-> self root-override) - proc - (the-as touching-shapes-entry (-> event param 0)) - 0.7 - 6144.0 - 16384.0 - ) + (the-as object (case event-type + (('touch) + (send-shove-back + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 ) - ((= v1-0 'attack) - (go mother-spider-egg-die) - ) - ) - ) - ) + ) + (('attack) + (go mother-spider-egg-die) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/levels/misty/bonelurker_REF.gc b/test/decompiler/reference/jak1/levels/misty/bonelurker_REF.gc index c7ec434d23..4b2827c66e 100644 --- a/test/decompiler/reference/jak1/levels/misty/bonelurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/bonelurker_REF.gc @@ -126,18 +126,18 @@ ;; definition for function bonelurker-stunned-event-handler ;; INFO: Return type mismatch symbol vs object. (defbehavior bonelurker-stunned-event-handler bonelurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (when (= v1-0 'attack) - (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) - (nav-enemy-set-hit-from-direction arg0) - (send-event arg0 'get-attack-count 1) - (logclear! (-> self mask) (process-mask actor-pause)) - (go-virtual nav-enemy-die) - 'die - ) - ) - ) - ) + (the-as object (case arg2 + (('attack) + (when (>= (- (-> *display* base-frame-counter) (-> self state-time)) (seconds 0.5)) + (nav-enemy-set-hit-from-direction arg0) + (send-event arg0 'get-attack-count 1) + (logclear! (-> self mask) (process-mask actor-pause)) + (go-virtual nav-enemy-die) + 'die + ) + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc index ad0d9af80a..cd14dde7d0 100644 --- a/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/misty-conveyor_REF.gc @@ -169,27 +169,27 @@ ;; definition for function keg-event-handler ;; INFO: Return type mismatch none vs object. (defbehavior keg-event-handler keg ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (when (or (= v1-0 'touch) (= v1-0 'attack)) - (when (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) - (sound-play "icrate-break") - (process-spawn - part-tracker - :init part-tracker-init - (-> *part-group-id-table* 71) - 20 - #f - #f - #f - (-> self root-override trans) - :to *entity-pool* - ) - (sound-stop (-> self sound-id)) - (deactivate self) - ) - ) - ) - ) + (the-as object (case arg2 + (('touch 'attack) + (when (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + (sound-play "icrate-break") + (process-spawn + part-tracker + :init part-tracker-init + (-> *part-group-id-table* 71) + 20 + #f + #f + #f + (-> self root-override trans) + :to *entity-pool* + ) + (sound-stop (-> self sound-id)) + (deactivate self) + ) + ) + ) + ) ) ;; definition for function keg-post diff --git a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc index 8dde56e3da..579ec85ae4 100644 --- a/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc +++ b/test/decompiler/reference/jak1/levels/misty/mistycannon_REF.gc @@ -1813,21 +1813,21 @@ ;; failed to figure out what this is: (defstate mistycannon-waiting-for-player-to-fuck-off (mistycannon) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (when ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> event param 0)) - (-> self root-override) - (the-as uint 1) - ) - (let ((v0-0 (-> *display* base-frame-counter))) - (set! (-> self state-time) v0-0) - v0-0 - ) - ) - ) - ) - ) + (the-as object (case event-type + (('touch) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) + (-> self root-override) + (the-as uint 1) + ) + (let ((v0-0 (-> *display* base-frame-counter))) + (set! (-> self state-time) v0-0) + v0-0 + ) + ) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/levels/ogre/flying-lurker_REF.gc b/test/decompiler/reference/jak1/levels/ogre/flying-lurker_REF.gc index a2597e5cd6..5d0c3a5a26 100644 --- a/test/decompiler/reference/jak1/levels/ogre/flying-lurker_REF.gc +++ b/test/decompiler/reference/jak1/levels/ogre/flying-lurker_REF.gc @@ -173,15 +173,15 @@ ;; failed to figure out what this is: (defstate plunger-lurker-flee (plunger-lurker) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'attack) - (let ((v0-0 #t)) - (set! (-> self got-hit) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('attack) + (let ((v0-0 #t)) + (set! (-> self got-hit) v0-0) + v0-0 + ) + ) + ) + ) ) :trans (behavior () (when (-> self got-hit) @@ -642,105 +642,103 @@ ;; failed to figure out what this is: (defstate flying-lurker-fly (flying-lurker) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'clone-and-kill-links) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) self) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'sleep) - (let ((t9-0 send-event-function) - (v1-3 (-> self link next)) - ) - (t9-0 - (if v1-3 - (-> v1-3 extra process) - ) - a1-1 + (the-as object (case event-type + (('clone-and-kill-links) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'sleep) + (let ((t9-0 send-event-function) + (v1-3 (-> self link next)) ) + (t9-0 + (if v1-3 + (-> v1-3 extra process) + ) + a1-1 ) ) - (go flying-lurker-clone (the-as handle (-> event param 0)) "") ) - ((= v1-0 'die) - (let ((v1-7 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-7 from) proc) - (set! (-> v1-7 num-params) arg1) - (set! (-> v1-7 message) event-type) - (set! (-> v1-7 param 0) (-> event param 0)) - (set! (-> v1-7 param 1) (-> event param 1)) - (set! (-> v1-7 param 2) (-> event param 2)) - (set! (-> v1-7 param 3) (-> event param 3)) - (set! (-> v1-7 param 4) (-> event param 4)) - (set! (-> v1-7 param 5) (-> event param 5)) - (set! (-> v1-7 param 6) (-> event param 6)) - (let ((t9-2 send-event-function) - (a1-3 (-> self link next)) - ) - (t9-2 - (if a1-3 - (-> a1-3 extra process) - ) - v1-7 + (go flying-lurker-clone (the-as handle (-> event param 0)) "") + ) + (('die) + (let ((v1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-7 from) proc) + (set! (-> v1-7 num-params) arg1) + (set! (-> v1-7 message) event-type) + (set! (-> v1-7 param 0) (-> event param 0)) + (set! (-> v1-7 param 1) (-> event param 1)) + (set! (-> v1-7 param 2) (-> event param 2)) + (set! (-> v1-7 param 3) (-> event param 3)) + (set! (-> v1-7 param 4) (-> event param 4)) + (set! (-> v1-7 param 5) (-> event param 5)) + (set! (-> v1-7 param 6) (-> event param 6)) + (let ((t9-2 send-event-function) + (a1-3 (-> self link next)) ) + (t9-2 + (if a1-3 + (-> a1-3 extra process) + ) + v1-7 ) ) - (cleanup-for-death self) - (deactivate self) ) - ((= v1-0 'sleep) - (let ((v1-12 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-12 from) proc) - (set! (-> v1-12 num-params) arg1) - (set! (-> v1-12 message) event-type) - (set! (-> v1-12 param 0) (-> event param 0)) - (set! (-> v1-12 param 1) (-> event param 1)) - (set! (-> v1-12 param 2) (-> event param 2)) - (set! (-> v1-12 param 3) (-> event param 3)) - (set! (-> v1-12 param 4) (-> event param 4)) - (set! (-> v1-12 param 5) (-> event param 5)) - (set! (-> v1-12 param 6) (-> event param 6)) - (let ((t9-5 send-event-function) - (a1-5 (-> self link next)) - ) - (t9-5 - (if a1-5 - (-> a1-5 extra process) - ) - v1-12 + (cleanup-for-death self) + (deactivate self) + ) + (('sleep) + (let ((v1-12 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-12 from) proc) + (set! (-> v1-12 num-params) arg1) + (set! (-> v1-12 message) event-type) + (set! (-> v1-12 param 0) (-> event param 0)) + (set! (-> v1-12 param 1) (-> event param 1)) + (set! (-> v1-12 param 2) (-> event param 2)) + (set! (-> v1-12 param 3) (-> event param 3)) + (set! (-> v1-12 param 4) (-> event param 4)) + (set! (-> v1-12 param 5) (-> event param 5)) + (set! (-> v1-12 param 6) (-> event param 6)) + (let ((t9-5 send-event-function) + (a1-5 (-> self link next)) ) + (t9-5 + (if a1-5 + (-> a1-5 extra process) + ) + v1-12 ) ) - (go flying-lurker-sleep) ) - ((= v1-0 'reset) - (let ((v1-15 (new 'stack-no-clear 'event-message-block))) - (set! (-> v1-15 from) proc) - (set! (-> v1-15 num-params) arg1) - (set! (-> v1-15 message) event-type) - (set! (-> v1-15 param 0) (-> event param 0)) - (set! (-> v1-15 param 1) (-> event param 1)) - (set! (-> v1-15 param 2) (-> event param 2)) - (set! (-> v1-15 param 3) (-> event param 3)) - (set! (-> v1-15 param 4) (-> event param 4)) - (set! (-> v1-15 param 5) (-> event param 5)) - (set! (-> v1-15 param 6) (-> event param 6)) - (let ((t9-7 send-event-function) - (a1-7 (-> self link next)) - ) - (t9-7 - (if a1-7 - (-> a1-7 extra process) - ) - v1-15 + (go flying-lurker-sleep) + ) + (('reset) + (let ((v1-15 (new 'stack-no-clear 'event-message-block))) + (set! (-> v1-15 from) proc) + (set! (-> v1-15 num-params) arg1) + (set! (-> v1-15 message) event-type) + (set! (-> v1-15 param 0) (-> event param 0)) + (set! (-> v1-15 param 1) (-> event param 1)) + (set! (-> v1-15 param 2) (-> event param 2)) + (set! (-> v1-15 param 3) (-> event param 3)) + (set! (-> v1-15 param 4) (-> event param 4)) + (set! (-> v1-15 param 5) (-> event param 5)) + (set! (-> v1-15 param 6) (-> event param 6)) + (let ((t9-7 send-event-function) + (a1-7 (-> self link next)) ) + (t9-7 + (if a1-7 + (-> a1-7 extra process) + ) + v1-15 ) ) - (deactivate self) ) - ) - ) - ) + (deactivate self) + ) + ) + ) ) :enter (behavior () (process-entity-status! self (entity-perm-status bit-3) #t) diff --git a/test/decompiler/reference/jak1/levels/ogre/ogre-obs_REF.gc b/test/decompiler/reference/jak1/levels/ogre/ogre-obs_REF.gc index b028c75d5c..2f56ca4502 100644 --- a/test/decompiler/reference/jak1/levels/ogre/ogre-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/ogre/ogre-obs_REF.gc @@ -509,17 +509,17 @@ (defstate rigid-body-platform-idle (ogre-plat) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'trigger) - (set! (-> self triggered) (the-as entity-actor #t)) - (set! (-> self delay) (the-as time-frame (-> event param 0))) - (let ((v0-0 (-> *display* base-frame-counter))) - (set! (-> self state-time) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('trigger) + (set! (-> self triggered) (the-as entity-actor #t)) + (set! (-> self delay) (the-as time-frame (-> event param 0))) + (let ((v0-0 (-> *display* base-frame-counter))) + (set! (-> self state-time) v0-0) + v0-0 + ) + ) + ) + ) ) :trans (behavior () (cond @@ -1116,30 +1116,30 @@ ;; failed to figure out what this is: (defstate ogre-bridge-break (ogre-bridge) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'effect) - (when (= (-> event param 0) 'splash) - (let ((gp-0 (new 'stack-no-clear 'vector))) - (let ((a1-1 (-> event param 2))) - (set! (-> gp-0 quad) (-> self node-list data a1-1 bone transform vector 3 quad)) - ) - (set! (-> gp-0 y) 118784.0) - (process-spawn - part-tracker - :init part-tracker-init - (-> *part-group-id-table* 466) - -1 - #f - #f - #f - gp-0 - :to *entity-pool* - ) - ) - ) - ) - ) - ) + (the-as object (case event-type + (('effect) + (when (= (-> event param 0) 'splash) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (let ((a1-1 (-> event param 2))) + (set! (-> gp-0 quad) (-> self node-list data a1-1 bone transform vector 3 quad)) + ) + (set! (-> gp-0 y) 118784.0) + (process-spawn + part-tracker + :init part-tracker-init + (-> *part-group-id-table* 466) + -1 + #f + #f + #f + gp-0 + :to *entity-pool* + ) + ) + ) + ) + ) + ) ) :code (behavior () (ja-no-eval :group! (-> self draw art-group data 4) :num! (seek!) :frame-num 0.0) diff --git a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc index 51cde1fc6b..dc420aa731 100644 --- a/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc +++ b/test/decompiler/reference/jak1/levels/ogre/ogreboss_REF.gc @@ -1752,41 +1752,41 @@ ;; definition for function ogreboss-attack-event-handler ;; INFO: Return type mismatch symbol vs object. (defbehavior ogreboss-attack-event-handler ogreboss ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (when (= v1-0 'attack) - (when (-> self vulnerable) - (if ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> arg3 param 0)) - (the-as collide-shape-moving (-> self root-override)) - (the-as uint 128) - ) - (ja :chan 1 :group! ogreboss-hit-crotch-ja :num! min :frame-interp 0.0) - (ja :chan 1 :group! ogreboss-hit-chest-ja :num! min :frame-interp 0.0) + (the-as object (case arg2 + (('attack) + (when (-> self vulnerable) + (if ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> arg3 param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 128) ) - (set! (-> self hit-time) (-> *display* base-frame-counter)) - (let ((v1-17 (rand-vu-int-range 0 2))) - (cond - ((zero? v1-17) - (sound-play "ogre-grunt1" :position (the-as symbol (-> self root-override trans))) - ) - ((= v1-17 1) - (sound-play "ogre-grunt2" :position (the-as symbol (-> self root-override trans))) - ) - (else - (sound-play "ogre-grunt3" :position (the-as symbol (-> self root-override trans))) - ) + (ja :chan 1 :group! ogreboss-hit-crotch-ja :num! min :frame-interp 0.0) + (ja :chan 1 :group! ogreboss-hit-chest-ja :num! min :frame-interp 0.0) + ) + (set! (-> self hit-time) (-> *display* base-frame-counter)) + (let ((v1-17 (rand-vu-int-range 0 2))) + (cond + ((zero? v1-17) + (sound-play "ogre-grunt1" :position (the-as symbol (-> self root-override trans))) ) - ) - (+! (-> self hit-count) 1) - (if (>= (-> self hit-count) (-> self max-hit-count)) - (go ogreboss-stage3-hit) + ((= v1-17 1) + (sound-play "ogre-grunt2" :position (the-as symbol (-> self root-override trans))) ) - (send-event (handle->process (-> self boulder)) 'speedup) - ) - #t - ) - ) - ) + (else + (sound-play "ogre-grunt3" :position (the-as symbol (-> self root-override trans))) + ) + ) + ) + (+! (-> self hit-count) 1) + (if (>= (-> self hit-count) (-> self max-hit-count)) + (go ogreboss-stage3-hit) + ) + (send-event (handle->process (-> self boulder)) 'speedup) + ) + #t + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/racer_common/racer_REF.gc b/test/decompiler/reference/jak1/levels/racer_common/racer_REF.gc index ac721a10a4..143309c6ab 100644 --- a/test/decompiler/reference/jak1/levels/racer_common/racer_REF.gc +++ b/test/decompiler/reference/jak1/levels/racer_common/racer_REF.gc @@ -101,32 +101,30 @@ :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-1 structure)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'trans) - (vector+! (the-as vector (-> event param 0)) (-> self root-override trans) (-> self extra-trans)) - ) - ((= v1-0 'notify) - (set! v0-1 #t) - (set! (-> self auto-get-off) (the-as symbol v0-1)) - v0-1 - ) - ((= v1-0 'shadow) - (cond - ((-> event param 0) - (set! v0-1 (-> self shadow-backup)) - (set! (-> self draw shadow) (the-as shadow-geo v0-1)) - v0-1 - ) - (else - (set! (-> self draw shadow) #f) - #f - ) + (the-as + object + (case event-type + (('trans) + (vector+! (the-as vector (-> event param 0)) (-> self root-override trans) (-> self extra-trans)) + ) + (('notify) + (set! v0-1 #t) + (set! (-> self auto-get-off) (the-as symbol v0-1)) + v0-1 + ) + (('shadow) + (cond + ((-> event param 0) + (set! v0-1 (-> self shadow-backup)) + (set! (-> self draw shadow) (the-as shadow-geo v0-1)) + v0-1 + ) + (else + (set! (-> self draw shadow) #f) + #f ) ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/robocave/spider-egg_REF.gc b/test/decompiler/reference/jak1/levels/robocave/spider-egg_REF.gc index 52fab27f4f..9406e3445e 100644 --- a/test/decompiler/reference/jak1/levels/robocave/spider-egg_REF.gc +++ b/test/decompiler/reference/jak1/levels/robocave/spider-egg_REF.gc @@ -52,31 +52,29 @@ (defstate spider-egg-idle (spider-egg) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'touch) - (send-shove-back - (-> self root-override) - proc - (the-as touching-shapes-entry (-> event param 0)) - 0.7 - 6144.0 - 16384.0 - ) + (the-as object (case event-type + (('touch) + (send-shove-back + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 ) - ((= v1-0 'can-spawn?) - (return (the-as object #t)) - v0-0 - ) - ((= v1-0 'notify-spawned) - (go spider-egg-hatch) - ) - ((= v1-0 'attack) - (go spider-egg-die) - ) - ) - ) - ) + ) + (('can-spawn?) + (return (the-as object #t)) + v0-0 + ) + (('notify-spawned) + (go spider-egg-hatch) + ) + (('attack) + (go spider-egg-die) + ) + ) + ) ) :enter (behavior ((arg0 symbol)) (set! (-> self state-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc index de95a4b493..7d331bcd9b 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-lightning-mole_REF.gc @@ -1300,15 +1300,15 @@ ;; failed to figure out what this is: (defstate peeper-wait (peeper) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'hide) - (let ((v0-0 (-> *display* base-frame-counter))) - (set! (-> self state-time) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('hide) + (let ((v0-0 (-> *display* base-frame-counter))) + (set! (-> self state-time) v0-0) + v0-0 + ) + ) + ) + ) ) :enter (behavior () (if (nonzero? (-> self sound)) diff --git a/test/decompiler/reference/jak1/levels/rolling/rolling-race-ring_REF.gc b/test/decompiler/reference/jak1/levels/rolling/rolling-race-ring_REF.gc index 74570d1323..ed4609ab55 100644 --- a/test/decompiler/reference/jak1/levels/rolling/rolling-race-ring_REF.gc +++ b/test/decompiler/reference/jak1/levels/rolling/rolling-race-ring_REF.gc @@ -611,19 +611,36 @@ (defstate race-ring-active (race-ring) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 symbol)) - (let ((v1-0 event-type)) - (the-as - object - (when (= v1-0 'notify) - (when (and (= (-> event param 0) 'die) (= proc (-> self part-track process 0))) - (cond - ((= (-> self entity extra perm task) (game-task rolling-ring-chase-2)) + (the-as + object + (case event-type + (('notify) + (when (and (= (-> event param 0) 'die) (= proc (-> self part-track process 0))) + (cond + ((= (-> self entity extra perm task) (game-task rolling-ring-chase-2)) + (set! (-> self part-track) (ppointer->handle (process-spawn + part-tracker + :init part-tracker-init + (-> *part-group-id-table* 460) + -1 + race-ring-blue-set-particle-rotation-callback + (-> self ppointer) + #f + (-> self root trans) + :to self + ) + ) + ) + (set! v0-0 #t) + (set! (-> self keep-part-track-alive) v0-0) + ) + (else (set! (-> self part-track) (ppointer->handle (process-spawn part-tracker :init part-tracker-init - (-> *part-group-id-table* 460) + (-> *part-group-id-table* 457) -1 - race-ring-blue-set-particle-rotation-callback + race-ring-set-particle-rotation-callback (-> self ppointer) #f (-> self root trans) @@ -634,27 +651,10 @@ (set! v0-0 #t) (set! (-> self keep-part-track-alive) v0-0) ) - (else - (set! (-> self part-track) (ppointer->handle (process-spawn - part-tracker - :init part-tracker-init - (-> *part-group-id-table* 457) - -1 - race-ring-set-particle-rotation-callback - (-> self ppointer) - #f - (-> self root trans) - :to self - ) - ) - ) - (set! v0-0 #t) - (set! (-> self keep-part-track-alive) v0-0) - ) - ) - v0-0 - ) - ) + ) + v0-0 + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/snow/ice-cube_REF.gc b/test/decompiler/reference/jak1/levels/snow/ice-cube_REF.gc index fbfb02cc1a..f0721714ee 100644 --- a/test/decompiler/reference/jak1/levels/snow/ice-cube_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/ice-cube_REF.gc @@ -407,110 +407,108 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 176] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 194] (defbehavior ice-cube-default-event-handler ice-cube ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'attack) - (cond - ((and (= (-> arg0 type) target) - (= (-> self cprims-type) 2) - (not (send-event *target* 'query 'powerup (pickup-type eco-red))) - ) - (when (and (cond - ((= (-> arg0 type) target) - (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) - ) - (else - (let ((a1-3 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-3 from) self) - (set! (-> a1-3 num-params) 4) - (set! (-> a1-3 message) 'attack) - (set! (-> a1-3 param 0) (-> arg3 param 0)) - (set! (-> a1-3 param 1) (the-as uint #f)) - (let ((v1-20 (+ *global-attack-id* 1))) - (set! *global-attack-id* v1-20) - (set! (-> a1-3 param 2) (the-as uint v1-20)) - ) - (set! (-> a1-3 param 3) (the-as uint 0)) - (send-event-function arg0 a1-3) + (the-as object (case arg2 + (('attack) + (cond + ((and (= (-> arg0 type) target) + (= (-> self cprims-type) 2) + (not (send-event *target* 'query 'powerup (pickup-type eco-red))) + ) + (when (and (cond + ((= (-> arg0 type) target) + (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + ) + (else + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) self) + (set! (-> a1-3 num-params) 4) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (-> arg3 param 0)) + (set! (-> a1-3 param 1) (the-as uint #f)) + (let ((v1-20 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-20) + (set! (-> a1-3 param 2) (the-as uint v1-20)) ) + (set! (-> a1-3 param 3) (the-as uint 0)) + (send-event-function arg0 a1-3) ) ) - (= (-> arg0 type) target) ) - (set-collide-offense (-> self collide-info) 2 (collide-offense no-offense)) - (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf8)) - (level-hint-spawn - (game-text-id snow-ice-cube-hint) - "sksp0350" - (the-as entity #f) - *entity-pool* - (game-task none) - ) + (= (-> arg0 type) target) + ) + (set-collide-offense (-> self collide-info) 2 (collide-offense no-offense)) + (logior! (-> self nav-enemy-flags) (nav-enemy-flags navenmf8)) + (level-hint-spawn + (game-text-id snow-ice-cube-hint) + "sksp0350" + (the-as entity #f) + *entity-pool* + (game-task none) ) ) - (else - (nav-enemy-set-hit-from-direction arg0) - (go ice-cube-shatter) - ) + ) + (else + (nav-enemy-set-hit-from-direction arg0) + (go ice-cube-shatter) ) ) - ((= v1-0 'touch) - (when (and (cond - ((= (-> arg0 type) target) - (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) - ) - (else - (let ((a1-7 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-7 from) self) - (set! (-> a1-7 num-params) 4) - (set! (-> a1-7 message) 'attack) - (set! (-> a1-7 param 0) (-> arg3 param 0)) - (set! (-> a1-7 param 1) (the-as uint #f)) - (let ((v1-38 (+ *global-attack-id* 1))) - (set! *global-attack-id* v1-38) - (set! (-> a1-7 param 2) (the-as uint v1-38)) - ) - (set! (-> a1-7 param 3) (the-as uint 0)) - (send-event-function arg0 a1-7) + ) + (('touch) + (when (and (cond + ((= (-> arg0 type) target) + (send-event arg0 'attack (-> arg3 param 0) (new 'static 'attack-info)) + ) + (else + (let ((a1-7 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-7 from) self) + (set! (-> a1-7 num-params) 4) + (set! (-> a1-7 message) 'attack) + (set! (-> a1-7 param 0) (-> arg3 param 0)) + (set! (-> a1-7 param 1) (the-as uint #f)) + (let ((v1-38 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-38) + (set! (-> a1-7 param 2) (the-as uint v1-38)) ) + (set! (-> a1-7 param 3) (the-as uint 0)) + (send-event-function arg0 a1-7) ) ) - (= (-> arg0 type) target) ) - (set-collide-offense (-> self collide-info) 2 (collide-offense no-offense)) - (let ((v0-3 (the-as none (logior (-> self nav-enemy-flags) (nav-enemy-flags navenmf8))))) - (set! (-> self nav-enemy-flags) (the-as nav-enemy-flags v0-3)) - v0-3 - ) + (= (-> arg0 type) target) + ) + (set-collide-offense (-> self collide-info) 2 (collide-offense no-offense)) + (let ((v0-3 (the-as none (logior (-> self nav-enemy-flags) (nav-enemy-flags navenmf8))))) + (set! (-> self nav-enemy-flags) (the-as nav-enemy-flags v0-3)) + v0-3 ) ) - ((= v1-0 'touched) - (when (!= (-> arg0 type) target) - (cond - ((= (-> arg0 type) target) - (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode #f)))) - ) - (else - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) self) - (set! (-> a1-10 num-params) 4) - (set! (-> a1-10 message) 'attack) - (set! (-> a1-10 param 0) (-> arg3 param 0)) - (set! (-> a1-10 param 1) (the-as uint #f)) - (let ((v1-54 (+ *global-attack-id* 1))) - (set! *global-attack-id* v1-54) - (set! (-> a1-10 param 2) (the-as uint v1-54)) - ) - (set! (-> a1-10 param 3) (the-as uint 0)) - (send-event-function arg0 a1-10) + ) + (('touched) + (when (!= (-> arg0 type) target) + (cond + ((= (-> arg0 type) target) + (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode #f)))) + ) + (else + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) self) + (set! (-> a1-10 num-params) 4) + (set! (-> a1-10 message) 'attack) + (set! (-> a1-10 param 0) (-> arg3 param 0)) + (set! (-> a1-10 param 1) (the-as uint #f)) + (let ((v1-54 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-54) + (set! (-> a1-10 param 2) (the-as uint v1-54)) ) + (set! (-> a1-10 param 3) (the-as uint 0)) + (send-event-function arg0 a1-10) ) ) ) ) - ) - ) - ) + ) + ) + ) ) ;; definition for method 47 of type ice-cube diff --git a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc index 4fea94510c..0c1a347cc4 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-ball_REF.gc @@ -439,18 +439,18 @@ ;; failed to figure out what this is: (defstate snow-ball-roller-idle (snow-ball-roller) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (or (= v1-0 'touch) (= v1-0 'attack)) - (when (= (-> proc type) target) - (do-push-aways! (-> self root-override)) - (when (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.5)) - (set! (-> self hit-player-time) (-> *display* base-frame-counter)) - (dummy-22 self *target*) - ) - ) - ) - ) - ) + (the-as object (case event-type + (('touch 'attack) + (when (= (-> proc type) target) + (do-push-aways! (-> self root-override)) + (when (>= (- (-> *display* base-frame-counter) (-> self hit-player-time)) (seconds 0.5)) + (set! (-> self hit-player-time) (-> *display* base-frame-counter)) + (dummy-22 self *target*) + ) + ) + ) + ) + ) ) :enter (behavior () (set! (-> self last-bounce-time) (-> *display* base-frame-counter)) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc index b4198d4255..fd6de95ac7 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-flutflut-obs_REF.gc @@ -609,12 +609,12 @@ ;; failed to figure out what this is: (defstate flutflut-plat-appear (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) @@ -686,17 +686,15 @@ (defstate plat-idle (flutflut-plat) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ((= v1-0 'untrigger) - (go flutflut-plat-hide) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + (('untrigger) + (go flutflut-plat-hide) + ) + ) + ) ) :enter (behavior () (let ((t9-0 (-> (method-of-type plat plat-idle) enter))) @@ -733,17 +731,15 @@ (defstate plat-path-active (flutflut-plat) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ((= v1-0 'untrigger) - (go flutflut-plat-hide) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + (('untrigger) + (go flutflut-plat-hide) + ) + ) + ) ) :enter (behavior ((arg0 plat)) (let ((t9-0 (-> (method-of-type plat plat-path-active) enter))) @@ -772,12 +768,12 @@ ;; failed to figure out what this is: (defstate flutflut-plat-hide (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) @@ -831,24 +827,22 @@ ;; failed to figure out what this is: (defstate elevator-idle-at-cave (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'bounce) - (if (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) - (dummy-22 self) - ) - ) - ((= v1-0 'ridden) - (if (or (not *target*) (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-14)))) - (go elevator-travel-to-fort) - ) - ) - ) + (the-as + object + (case event-type + (('bonk) + (dummy-22 self) + ) + (('bounce) + (if (not (and (-> self entity) (logtest? (-> self entity extra perm status) (entity-perm-status complete)))) + (dummy-22 self) + ) + ) + (('ridden) + (if (or (not *target*) (zero? (logand (-> *target* control root-prim prim-core action) (collide-action ca-14)))) + (go elevator-travel-to-fort) + ) + ) ) ) ) @@ -869,12 +863,12 @@ ;; failed to figure out what this is: (defstate elevator-travel-to-fort (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + ) + ) ) :trans (behavior () (when (= (-> self path-pos) 1.0) @@ -894,12 +888,12 @@ ;; failed to figure out what this is: (defstate elevator-idle-at-fort (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + ) + ) ) :enter (behavior () (set! (-> self path-pos) 1.0) @@ -928,12 +922,12 @@ ;; failed to figure out what this is: (defstate elevator-travel-to-cave (flutflut-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + ) + ) ) :trans (behavior () (when (= (-> self path-pos) 0.0) diff --git a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc index 01fd9e4f09..50a07632eb 100644 --- a/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/snow/snow-obs_REF.gc @@ -319,18 +319,18 @@ ;; failed to figure out what this is: (defstate snow-eggtop-idle-up (snow-eggtop) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (case (-> event param 0) - (('pickup) - (if (type-type? (-> proc type) fuel-cell) - (save-reminder (get-task-control (-> self entity extra perm task)) 1 4) - ) - ) + (the-as object (case event-type + (('notify) + (case (-> event param 0) + (('pickup) + (if (type-type? (-> proc type) fuel-cell) + (save-reminder (get-task-control (-> self entity extra perm task)) 1 4) + ) ) - ) - ) - ) + ) + ) + ) + ) ) :trans (behavior () (if (and (not (-> self child)) (task-complete? *game-info* (-> self entity extra perm task))) @@ -573,13 +573,13 @@ ;; failed to figure out what this is: (defstate snowpusher-idle (snowpusher) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :code (behavior () (let ((gp-0 #f)) @@ -710,13 +710,13 @@ ;; failed to figure out what this is: (defstate snow-spatula-idle (snow-spatula) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'bonk) - (dummy-22 self) - (sound-play "snow-spat-short" :vol 75 :pitch 0.75) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + (sound-play "snow-spat-short" :vol 75 :pitch 0.75) + ) + ) + ) ) :trans (the-as (function none :behavior snow-spatula) plat-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/sunken/bully_REF.gc b/test/decompiler/reference/jak1/levels/sunken/bully_REF.gc index 5482637b64..560f0f7ed6 100644 --- a/test/decompiler/reference/jak1/levels/sunken/bully_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/bully_REF.gc @@ -291,52 +291,74 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 248] (defbehavior bully-default-event-handler bully ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (local-vars (v0-0 none)) - (let ((v1-0 arg2)) - (the-as - object - (when (or (= v1-0 'touch) (= v1-0 'touched) (= v1-0 'attack)) - (cond - ((= (-> arg0 type) bully) - (let ((v1-3 (new 'stack-no-clear 'vector))) - (vector-! v1-3 (-> self root-override trans) (-> (the-as process-drawable arg0) root trans)) - (set! (-> self travel-ry) (atan (-> v1-3 x) (-> v1-3 z))) + (the-as + object + (case arg2 + (('touch 'touched 'attack) + (cond + ((= (-> arg0 type) bully) + (let ((v1-3 (new 'stack-no-clear 'vector))) + (vector-! v1-3 (-> self root-override trans) (-> (the-as process-drawable arg0) root trans)) + (set! (-> self travel-ry) (atan (-> v1-3 x) (-> v1-3 z))) + ) + (set! (-> self bounced?) #t) + (set! v0-0 (the-as none 100)) + (set! (-> self bounce-volume) (the-as int v0-0)) + v0-0 + ) + ((= (-> arg0 type) target) + (cond + ((= (-> arg3 param 1) 'flop) + (go bully-die) + (return (the-as object #t)) + v0-0 ) - (set! (-> self bounced?) #t) - (set! v0-0 (the-as none 100)) - (set! (-> self bounce-volume) (the-as int v0-0)) - v0-0 - ) - ((= (-> arg0 type) target) - (cond - ((= (-> arg3 param 1) 'flop) - (go bully-die) - (return (the-as object #t)) - v0-0 - ) - ((or (= arg2 'touch) (= arg2 'attack)) - (cond - ((>= (- (-> (target-pos 0) y) (-> self root-override trans y)) 6144.0) - (let* ((f0-6 (fmax 0.6 (* 0.000023935356 (-> self travel-speed)))) - (f28-0 (* 8192.0 f0-6)) - (f30-0 (* 8192.0 f0-6)) - (s4-0 (new 'stack-no-clear 'vector)) - ) - (vector-! s4-0 (target-pos 0) (-> self root-override trans)) - (let ((f26-0 (atan (-> s4-0 x) (-> s4-0 z)))) - (when (< 0.0 (-> self travel-speed)) - (let ((f0-11 (deg- f26-0 (-> self travel-ry)))) - (if (< (fabs f0-11) 8192.0) - (set! f26-0 (if (>= f0-11 0.0) - (+ 8192.0 f26-0) - (+ -8192.0 f26-0) - ) - ) - ) - ) + ((or (= arg2 'touch) (= arg2 'attack)) + (cond + ((>= (- (-> (target-pos 0) y) (-> self root-override trans y)) 6144.0) + (let* ((f0-6 (fmax 0.6 (* 0.000023935356 (-> self travel-speed)))) + (f28-0 (* 8192.0 f0-6)) + (f30-0 (* 8192.0 f0-6)) + (s4-0 (new 'stack-no-clear 'vector)) ) - (set-vector! s4-0 (* (sin f26-0) f28-0) 0.0 (* (cos f26-0) f28-0) 1.0) - ) - (when (send-event arg0 'shove (-> arg3 param 0) (static-attack-info ((shove-up f30-0) (vector s4-0)))) + (vector-! s4-0 (target-pos 0) (-> self root-override trans)) + (let ((f26-0 (atan (-> s4-0 x) (-> s4-0 z)))) + (when (< 0.0 (-> self travel-speed)) + (let ((f0-11 (deg- f26-0 (-> self travel-ry)))) + (if (< (fabs f0-11) 8192.0) + (set! f26-0 (if (>= f0-11 0.0) + (+ 8192.0 f26-0) + (+ -8192.0 f26-0) + ) + ) + ) + ) + ) + (set-vector! s4-0 (* (sin f26-0) f28-0) 0.0 (* (cos f26-0) f28-0) 1.0) + ) + (when (send-event arg0 'shove (-> arg3 param 0) (static-attack-info ((shove-up f30-0) (vector s4-0)))) + (level-hint-spawn + (game-text-id sunken-bully-dive-hint) + "sksp0131" + (the-as entity #f) + *entity-pool* + (game-task none) + ) + (set! (-> self bounced?) #t) + (set! v0-0 (the-as none 100)) + (set! (-> self bounce-volume) (the-as int v0-0)) + v0-0 + ) + ) + ) + (else + (let ((f0-21 (fmax 0.6 (* 0.000023935356 (-> self travel-speed))))) + (when (send-event + arg0 + 'attack + (-> arg3 param 0) + (static-attack-info ((shove-up (* 12288.0 f0-21)) (shove-back (* 16384.0 f0-21)))) + ) (level-hint-spawn (game-text-id sunken-bully-dive-hint) "sksp0131" @@ -344,66 +366,44 @@ *entity-pool* (game-task none) ) + (set! (-> self hit-player?) #t) (set! (-> self bounced?) #t) - (set! v0-0 (the-as none 100)) - (set! (-> self bounce-volume) (the-as int v0-0)) - v0-0 + (set! (-> self bounce-volume) 100) + (set! (-> self hit-player-time) (-> *display* base-frame-counter)) + (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) ) ) ) - (else - (let ((f0-21 (fmax 0.6 (* 0.000023935356 (-> self travel-speed))))) - (when (send-event - arg0 - 'attack - (-> arg3 param 0) - (static-attack-info ((shove-up (* 12288.0 f0-21)) (shove-back (* 16384.0 f0-21)))) - ) - (level-hint-spawn - (game-text-id sunken-bully-dive-hint) - "sksp0131" - (the-as entity #f) - *entity-pool* - (game-task none) - ) - (set! (-> self hit-player?) #t) - (set! (-> self bounced?) #t) - (set! (-> self bounce-volume) 100) - (set! (-> self hit-player-time) (-> *display* base-frame-counter)) - (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) - ) - ) - ) - ) - ) + ) ) - ) - (else - (when (= arg2 'touched) - (cond - ((= (-> arg0 type) target) - (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'explode)))) - ) - (else - (let ((a1-14 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-14 from) self) - (set! (-> a1-14 num-params) 4) - (set! (-> a1-14 message) 'attack) - (set! (-> a1-14 param 0) (-> arg3 param 0)) - (set! (-> a1-14 param 1) (the-as uint 'explode)) - (let ((v1-48 (+ *global-attack-id* 1))) - (set! *global-attack-id* v1-48) - (set! (-> a1-14 param 2) (the-as uint v1-48)) - ) - (set! (-> a1-14 param 3) (the-as uint 0)) - (send-event-function arg0 a1-14) - ) - ) - ) - ) ) ) - ) + (else + (when (= arg2 'touched) + (cond + ((= (-> arg0 type) target) + (send-event arg0 'attack (-> arg3 param 0) (static-attack-info ((mode 'explode)))) + ) + (else + (let ((a1-14 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-14 from) self) + (set! (-> a1-14 num-params) 4) + (set! (-> a1-14 message) 'attack) + (set! (-> a1-14 param 0) (-> arg3 param 0)) + (set! (-> a1-14 param 1) (the-as uint 'explode)) + (let ((v1-48 (+ *global-attack-id* 1))) + (set! *global-attack-id* v1-48) + (set! (-> a1-14 param 2) (the-as uint v1-48)) + ) + (set! (-> a1-14 param 3) (the-as uint 0)) + (send-event-function arg0 a1-14) + ) + ) + ) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/sunken/helix-water_REF.gc b/test/decompiler/reference/jak1/levels/sunken/helix-water_REF.gc index 9de33811aa..1c61af32d3 100644 --- a/test/decompiler/reference/jak1/levels/sunken/helix-water_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/helix-water_REF.gc @@ -660,17 +660,15 @@ ;; failed to figure out what this is: (defstate helix-water-idle (helix-water) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'trigger) - (go helix-water-activated) - ) - ((= v1-0 'music) - (set-setting! 'music 'danger 0.0 0) - ) - ) - ) - ) + (the-as object (case event-type + (('trigger) + (go helix-water-activated) + ) + (('music) + (set-setting! 'music 'danger 0.0 0) + ) + ) + ) ) :code (behavior () (set! (-> self root trans y) (-> self start-y)) diff --git a/test/decompiler/reference/jak1/levels/sunken/orbit-plat_REF.gc b/test/decompiler/reference/jak1/levels/sunken/orbit-plat_REF.gc index 9f918415e0..2acf78f034 100644 --- a/test/decompiler/reference/jak1/levels/sunken/orbit-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/orbit-plat_REF.gc @@ -305,40 +305,38 @@ ;; failed to figure out what this is: (defstate orbit-plat-idle (orbit-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'go) - (go orbit-plat-rotating) - ) - ((= v1-0 'query-reset) - (if (not (-> self is-reset?)) - (go orbit-plat-reset) - ) - (let ((a1-1 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-1 from) self) - (set! (-> a1-1 num-params) 0) - (set! (-> a1-1 message) 'reset) - (let ((t9-3 send-event-function) - (v1-8 (-> self other)) - ) - (t9-3 - (if v1-8 - (-> v1-8 extra process) - ) - a1-1 + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('go) + (go orbit-plat-rotating) + ) + (('query-reset) + (if (not (-> self is-reset?)) + (go orbit-plat-reset) + ) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) self) + (set! (-> a1-1 num-params) 0) + (set! (-> a1-1 message) 'reset) + (let ((t9-3 send-event-function) + (v1-8 (-> self other)) ) + (t9-3 + (if v1-8 + (-> v1-8 extra process) + ) + a1-1 ) ) ) - ((= v1-0 'reset) - (go orbit-plat-reset) - ) - ) - ) - ) + ) + (('reset) + (go orbit-plat-reset) + ) + ) + ) ) :trans (the-as (function none :behavior orbit-plat) plat-trans) :code (behavior () @@ -421,17 +419,15 @@ ;; failed to figure out what this is: (defstate orbit-plat-still (orbit-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'go) - (go orbit-plat-rotating) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('go) + (go orbit-plat-rotating) + ) + ) + ) ) :trans (the-as (function none :behavior orbit-plat) plat-trans) :code (behavior () @@ -545,17 +541,15 @@ ;; failed to figure out what this is: (defstate orbit-plat-rotating (orbit-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'stop) - (go orbit-plat-still) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('stop) + (go orbit-plat-still) + ) + ) + ) ) :trans (the-as (function none :behavior orbit-plat) plat-trans) :code (behavior () @@ -759,17 +753,15 @@ ;; failed to figure out what this is: (defstate orbit-plat-reset (orbit-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'go) - (go orbit-plat-rotating) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('go) + (go orbit-plat-rotating) + ) + ) + ) ) :trans (the-as (function none :behavior orbit-plat) plat-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc index ca174da5e2..1b41600d49 100644 --- a/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/puffer_REF.gc @@ -116,44 +116,44 @@ ;; INFO: Return type mismatch none vs object. ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 56] (defbehavior puffer-default-event-handler puffer ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as - object - (when (or (= v1-0 'touch) (= v1-0 'attack)) - (when (and (= arg2 'attack) (!= (-> self cprims-type) 2)) - (let* ((gp-0 arg0) - (v1-7 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) - gp-0 - ) - ) - ) - (when v1-7 - (let ((f0-4 (atan - (- (-> (the-as process-drawable v1-7) root trans x) (-> self root-override trans x)) - (- (-> (the-as process-drawable v1-7) root trans z) (-> self root-override trans z)) - ) + (the-as + object + (case arg2 + (('touch 'attack) + (when (and (= arg2 'attack) (!= (-> self cprims-type) 2)) + (let* ((gp-0 arg0) + (v1-7 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) process-drawable)) + gp-0 ) - ) - (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 f0-4) + ) ) - ) - ) - (go puffer-die) - (return (the-as object #t)) - ) - (when (= (-> arg0 type) target) - (when (send-event - arg0 - 'attack - (-> arg3 param 0) - (static-attack-info ((shove-up (meters 1.5)) (shove-back (meters 2.5)))) - ) - (set! (-> self hit-player?) #t) - (set! (-> self hit-player-time) (-> *display* base-frame-counter)) - (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) - ) - ) - ) + (when v1-7 + (let ((f0-4 (atan + (- (-> (the-as process-drawable v1-7) root trans x) (-> self root-override trans x)) + (- (-> (the-as process-drawable v1-7) root trans z) (-> self root-override trans z)) + ) + ) + ) + (quaternion-axis-angle! (-> self root-override quat) 0.0 1.0 0.0 f0-4) + ) + ) + ) + (go puffer-die) + (return (the-as object #t)) + ) + (when (= (-> arg0 type) target) + (when (send-event + arg0 + 'attack + (-> arg3 param 0) + (static-attack-info ((shove-up (meters 1.5)) (shove-back (meters 2.5)))) + ) + (set! (-> self hit-player?) #t) + (set! (-> self hit-player-time) (-> *display* base-frame-counter)) + (set-collide-offense (-> self root-override) 2 (collide-offense no-offense)) + ) + ) + ) ) ) ) @@ -711,20 +711,18 @@ ;; failed to figure out what this is: (defstate puffer-die (puffer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - uint - (cond - ((= v1-0 'death-start) - (the-as uint (drop-pickup (-> self fact-info-override) #t *entity-pool* (-> self fact-info-override) 0)) + (the-as + uint + (case event-type + (('death-start) + (the-as uint (drop-pickup (-> self fact-info-override) #t *entity-pool* (-> self fact-info-override) 0)) + ) + (('death-end) + (let ((v0-0 (the-as uint (logior (-> self draw status) (draw-status hidden))))) + (set! (-> self draw status) (the-as draw-status v0-0)) + v0-0 ) - ((= v1-0 'death-end) - (let ((v0-0 (the-as uint (logior (-> self draw status) (draw-status hidden))))) - (set! (-> self draw status) (the-as draw-status v0-0)) - v0-0 - ) - ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc index 13d165257f..854d42c3a1 100644 --- a/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/square-platform_REF.gc @@ -333,17 +333,15 @@ ;; failed to figure out what this is: (defstate square-platform-rising (square-platform) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ((= v1-0 'untrigger) - (go square-platform-lowering) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + (('untrigger) + (go square-platform-lowering) + ) + ) + ) ) :enter (behavior () (set! (-> self start-splash-time) 0) @@ -377,17 +375,15 @@ ;; failed to figure out what this is: (defstate square-platform-raised (square-platform) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ((= v1-0 'untrigger) - (go square-platform-lowering) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + (('untrigger) + (go square-platform-lowering) + ) + ) + ) ) :trans (the-as (function none :behavior square-platform) plat-trans) :code (behavior () @@ -404,21 +400,19 @@ ;; failed to figure out what this is: (defstate square-platform-lowering (square-platform) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((or (= v1-0 'bonk) (= v1-0 'bounce)) - (dummy-22 self) - ) - ((= v1-0 'trigger) - (go square-platform-rising) - ) - ((= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) - ) + (the-as object (case event-type + (('bonk 'bounce) + (dummy-22 self) + ) + (('trigger) + (go square-platform-rising) + ) + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :enter (behavior () (set! (-> self start-splash-time) 0) diff --git a/test/decompiler/reference/jak1/levels/sunken/wall-plat_REF.gc b/test/decompiler/reference/jak1/levels/sunken/wall-plat_REF.gc index b1bca9e0a1..a11b1b71a7 100644 --- a/test/decompiler/reference/jak1/levels/sunken/wall-plat_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/wall-plat_REF.gc @@ -69,13 +69,13 @@ ;; failed to figure out what this is: (defstate wall-plat-extending (wall-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :enter (behavior () (sound-play "wall-plat") @@ -125,13 +125,13 @@ ;; failed to figure out what this is: (defstate wall-plat-retracting (wall-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :enter (behavior () (sound-play "wall-plat") @@ -159,13 +159,13 @@ ;; failed to figure out what this is: (defstate wall-plat-sync-idle (wall-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) + (the-as object (case event-type + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :enter (behavior () (logclear! (-> self mask) (process-mask actor-pause)) diff --git a/test/decompiler/reference/jak1/levels/sunken/wedge-plats_REF.gc b/test/decompiler/reference/jak1/levels/sunken/wedge-plats_REF.gc index a308da4316..2e5b3815ef 100644 --- a/test/decompiler/reference/jak1/levels/sunken/wedge-plats_REF.gc +++ b/test/decompiler/reference/jak1/levels/sunken/wedge-plats_REF.gc @@ -141,12 +141,12 @@ ;; failed to figure out what this is: (defstate wedge-plat-idle (wedge-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + ) + ) ) :trans (the-as (function none :behavior wedge-plat) plat-trans) :code (behavior () @@ -165,18 +165,16 @@ ;; failed to figure out what this is: (defstate wedge-plat-tip (wedge-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - #f - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + #f + ) + ) + ) ) :trans (the-as (function none :behavior wedge-plat) plat-trans) :code (behavior () @@ -321,12 +319,12 @@ ;; failed to figure out what this is: (defstate wedge-plat-outer-idle (wedge-plat-outer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'bonk) - (dummy-22 self) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + ) + ) ) :trans (the-as (function none :behavior wedge-plat-outer) plat-trans) :code (behavior () @@ -345,17 +343,15 @@ ;; failed to figure out what this is: (defstate wedge-plat-outer-tip (wedge-plat-outer) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'bonk) - (dummy-22 self) - ) - ((= v1-0 'touch) - (send-event proc 'no-look-around (seconds 1.5)) - ) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (dummy-22 self) + ) + (('touch) + (send-event proc 'no-look-around (seconds 1.5)) + ) + ) + ) ) :trans (the-as (function none :behavior wedge-plat-outer) plat-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/swamp/billy_REF.gc b/test/decompiler/reference/jak1/levels/swamp/billy_REF.gc index 478330eeb7..f7c72c19dc 100644 --- a/test/decompiler/reference/jak1/levels/swamp/billy_REF.gc +++ b/test/decompiler/reference/jak1/levels/swamp/billy_REF.gc @@ -538,22 +538,22 @@ ;; failed to figure out what this is: (defstate billy-done (billy) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'billy-rat-needs-destination) - (let* ((gp-0 proc) - (v1-2 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) billy-rat)) - gp-0 - ) - ) - ) - (when v1-2 - (set! (-> (the-as billy-rat v1-2) dest-type) (the-as uint 1)) - (get-random-point (-> self path-waypts) (-> (the-as billy-rat v1-2) destination)) - ) - ) - ) - ) - ) + (the-as object (case event-type + (('billy-rat-needs-destination) + (let* ((gp-0 proc) + (v1-2 (if (and (nonzero? gp-0) (type-type? (-> gp-0 type) billy-rat)) + gp-0 + ) + ) + ) + (when v1-2 + (set! (-> (the-as billy-rat v1-2) dest-type) (the-as uint 1)) + (get-random-point (-> self path-waypts) (-> (the-as billy-rat v1-2) destination)) + ) + ) + ) + ) + ) ) :enter (behavior () (init! diff --git a/test/decompiler/reference/jak1/levels/swamp/swamp-obs_REF.gc b/test/decompiler/reference/jak1/levels/swamp/swamp-obs_REF.gc index 7b0384f376..10a379e6b7 100644 --- a/test/decompiler/reference/jak1/levels/swamp/swamp-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/swamp/swamp-obs_REF.gc @@ -290,15 +290,15 @@ ;; failed to figure out what this is: (defstate swamp-spike-gate-up (swampgate) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'trigger) - (let ((v0-0 #t)) - (set! (-> self open-gate) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('trigger) + (let ((v0-0 #t)) + (set! (-> self open-gate) v0-0) + v0-0 + ) + ) + ) + ) ) :code (behavior () (set! (-> self state-time) (-> *display* base-frame-counter)) @@ -462,15 +462,15 @@ ;; failed to figure out what this is: (defstate balance-plat-idle (balance-plat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'grow) - (let ((v0-0 #t)) - (set! (-> self got-grow) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('grow) + (let ((v0-0 #t)) + (set! (-> self got-grow) v0-0) + v0-0 + ) + ) + ) + ) ) :trans (the-as (function none :behavior balance-plat) rider-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/title/title-obs_REF.gc b/test/decompiler/reference/jak1/levels/title/title-obs_REF.gc index 2624f431c9..45c6e544d0 100644 --- a/test/decompiler/reference/jak1/levels/title/title-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/title/title-obs_REF.gc @@ -152,29 +152,27 @@ :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) (local-vars (v0-0 uint)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'blend-shape) - (cond - ((-> event param 0) - (set! v0-0 (the-as uint (logior (-> self skel status) (janim-status blerc eye)))) - (set! (-> self skel status) (the-as janim-status v0-0)) - ) - (else - (set! v0-0 (the-as uint (logclear (-> self skel status) (janim-status blerc eye)))) - (set! (-> self skel status) (the-as janim-status v0-0)) - ) + (the-as object (case event-type + (('blend-shape) + (cond + ((-> event param 0) + (set! v0-0 (the-as uint (logior (-> self skel status) (janim-status blerc eye)))) + (set! (-> self skel status) (the-as janim-status v0-0)) + ) + (else + (set! v0-0 (the-as uint (logclear (-> self skel status) (janim-status blerc eye)))) + (set! (-> self skel status) (the-as janim-status v0-0)) ) - v0-0 ) - ((= v1-0 'origin-joint-index) - (set! v0-0 (-> event param 0)) - (set! (-> self draw origin-joint-index) v0-0) - v0-0 - ) - ) - ) - ) + v0-0 + ) + (('origin-joint-index) + (set! v0-0 (-> event param 0)) + (set! (-> self draw origin-joint-index) v0-0) + v0-0 + ) + ) + ) ) :code (behavior () (ja-post) @@ -225,12 +223,12 @@ (defstate startup (logo) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'update) - (remove-setting! 'process-mask) - ) - ) - ) + (the-as object (case event-type + (('update) + (remove-setting! 'process-mask) + ) + ) + ) ) :exit (behavior () (let ((a0-0 (-> self anim))) @@ -494,12 +492,12 @@ (defstate ndi (logo) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (if (= v1-0 'blackout) - (set-setting! 'bg-a 'abs 1.0 0) - ) - ) - ) + (the-as object (case event-type + (('blackout) + (set-setting! 'bg-a 'abs 1.0 0) + ) + ) + ) ) :enter (behavior () (set-setting! 'bg-a 'abs 0.0 0) diff --git a/test/decompiler/reference/jak1/levels/training/training-obs_REF.gc b/test/decompiler/reference/jak1/levels/training/training-obs_REF.gc index 92f0623d94..f1468107e0 100644 --- a/test/decompiler/reference/jak1/levels/training/training-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/training/training-obs_REF.gc @@ -711,97 +711,95 @@ (defstate idle (scarecrow-a) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'attack) - (let* ((s3-0 (-> event param 2)) - (s4-0 (get-task-control (game-task training-gimmie))) - (v1-2 (get-reminder s4-0 0)) - ) - (when (!= s3-0 (-> self incomming-attack-id)) - (set! (-> self incomming-attack-id) s3-0) - (cond - ((= (-> self type) scarecrow-b) - ) - ((and (= (-> event param 1) 'spin) (zero? v1-2)) - (save-reminder s4-0 1 0) - 1 - ) - ((and (= (-> event param 1) 'punch) (= v1-2 1)) - (save-reminder s4-0 2 0) - 2 - ) - ((zero? v1-2) - ) - ((= v1-2 1) - ) - ) - (let* ((s4-1 proc) - (v1-14 (if (and (nonzero? s4-1) (type-type? (-> s4-1 type) process-drawable)) - s4-1 - ) - ) - (f30-0 - (cond - (v1-14 - (let ((s4-2 (-> self root-override)) - (s2-0 (-> (the-as process-drawable v1-14) root trans)) - ) - (deg-diff (y-angle s4-2) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-2 trans)))) - ) - ) - (else - 0.0 + (the-as + object + (case event-type + (('attack) + (let* ((s3-0 (-> event param 2)) + (s4-0 (get-task-control (game-task training-gimmie))) + (v1-2 (get-reminder s4-0 0)) + ) + (when (!= s3-0 (-> self incomming-attack-id)) + (set! (-> self incomming-attack-id) s3-0) + (cond + ((= (-> self type) scarecrow-b) + ) + ((and (= (-> event param 1) 'spin) (zero? v1-2)) + (save-reminder s4-0 1 0) + 1 + ) + ((and (= (-> event param 1) 'punch) (= v1-2 1)) + (save-reminder s4-0 2 0) + 2 + ) + ((zero? v1-2) + ) + ((= v1-2 1) + ) + ) + (let* ((s4-1 proc) + (v1-14 (if (and (nonzero? s4-1) (type-type? (-> s4-1 type) process-drawable)) + s4-1 + ) + ) + (f30-0 + (cond + (v1-14 + (let ((s4-2 (-> self root-override)) + (s2-0 (-> (the-as process-drawable v1-14) root trans)) + ) + (deg-diff (y-angle s4-2) (vector-y-angle (vector-! (new 'stack-no-clear 'vector) s2-0 (-> s4-2 trans)))) ) ) + (else + 0.0 + ) ) - (a0-24 ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> event param 0)) - (the-as collide-shape-moving (-> self root-override)) - (the-as uint -1) - ) - ) ) - (go-virtual - hit - f30-0 - (if a0-24 - (get-middle-of-bsphere-overlap a0-24 (-> self intersection)) - (target-pos 0) - ) - (the-as - symbol - (and ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> event param 0)) - (the-as collide-shape-moving (-> self root-override)) - (the-as uint 2) + (a0-24 ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint -1) + ) ) - (or (= (-> self type) scarecrow-a) - (and (= (-> proc type) target) - (logtest? (-> (the-as target proc) control unknown-surface00 flags) (surface-flags jump)) - (zero? (logand (-> (the-as target proc) control status) (cshape-moving-flags onsurf))) - ) - ) - ) + ) + (go-virtual + hit + f30-0 + (if a0-24 + (get-middle-of-bsphere-overlap a0-24 (-> self intersection)) + (target-pos 0) ) + (the-as + symbol + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) + (the-as collide-shape-moving (-> self root-override)) + (the-as uint 2) + ) + (or (= (-> self type) scarecrow-a) + (and (= (-> proc type) target) + (logtest? (-> (the-as target proc) control unknown-surface00 flags) (surface-flags jump)) + (zero? (logand (-> (the-as target proc) control status) (cshape-moving-flags onsurf))) + ) + ) + ) ) ) ) ) ) - ((= v1-0 'touch) - (send-shove-back - (-> self root-override) - proc - (the-as touching-shapes-entry (-> event param 0)) - 0.7 - 6144.0 - 16384.0 - ) + ) + (('touch) + (send-shove-back + (-> self root-override) + proc + (the-as touching-shapes-entry (-> event param 0)) + 0.7 + 6144.0 + 16384.0 ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc index d23f4daba1..5d49368e1e 100644 --- a/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/fishermans-boat_REF.gc @@ -1660,47 +1660,45 @@ ;; failed to figure out what this is: (defstate fishermans-boat-ride-to-village1 (fishermans-boat) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'evilbro) - (when (= (level-status *level* 'intro) 'active) - (let ((gp-1 (entity-by-name "evilbro-2"))) - (when gp-1 - (set! (-> self evilbro) - (ppointer->handle (manipy-spawn (-> self root-overlay trans) gp-1 *fb-evilbro-sg* #f :to self)) - ) - (send-event (handle->process (-> self evilbro)) 'anim-mode 'clone-anim) - (send-event (handle->process (-> self evilbro)) 'blend-shape #t) - (send-event (handle->process (-> self evilbro)) 'center-joint 3) - ) + (the-as + object + (case event-type + (('evilbro) + (when (= (level-status *level* 'intro) 'active) + (let ((gp-1 (entity-by-name "evilbro-2"))) + (when gp-1 + (set! (-> self evilbro) + (ppointer->handle (manipy-spawn (-> self root-overlay trans) gp-1 *fb-evilbro-sg* #f :to self)) + ) + (send-event (handle->process (-> self evilbro)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> self evilbro)) 'blend-shape #t) + (send-event (handle->process (-> self evilbro)) 'center-joint 3) ) - (let ((gp-2 (entity-by-name "evilsis-2"))) - (when gp-2 - (set! (-> self evilsis) - (ppointer->handle (manipy-spawn (-> self root-overlay trans) gp-2 *fb-evilsis-sg* #f :to self)) - ) - (send-event (handle->process (-> self evilsis)) 'anim-mode 'clone-anim) - (send-event (handle->process (-> self evilsis)) 'blend-shape #t) - (send-event (handle->process (-> self evilsis)) 'center-joint 3) - ) + ) + (let ((gp-2 (entity-by-name "evilsis-2"))) + (when gp-2 + (set! (-> self evilsis) + (ppointer->handle (manipy-spawn (-> self root-overlay trans) gp-2 *fb-evilsis-sg* #f :to self)) + ) + (send-event (handle->process (-> self evilsis)) 'anim-mode 'clone-anim) + (send-event (handle->process (-> self evilsis)) 'blend-shape #t) + (send-event (handle->process (-> self evilsis)) 'center-joint 3) ) ) ) - ((= v1-0 'evilsis) - (let ((a0-44 (handle->process (-> self evilbro)))) - (if a0-44 - (deactivate a0-44) - ) - ) - (let ((a0-48 (handle->process (-> self evilsis)))) - (if a0-48 - (deactivate a0-48) - ) - ) + ) + (('evilsis) + (let ((a0-44 (handle->process (-> self evilbro)))) + (if a0-44 + (deactivate a0-44) + ) ) - ) + (let ((a0-48 (handle->process (-> self evilsis)))) + (if a0-48 + (deactivate a0-48) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc index 8c65acb708..cb4bc0ca0e 100644 --- a/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc +++ b/test/decompiler/reference/jak1/levels/village1/yakow_REF.gc @@ -193,46 +193,44 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 52] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 54] (defbehavior yakow-default-event-handler yakow ((arg0 process-drawable) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'touch) - (let* ((s4-0 arg0) - (v1-2 (if (and (nonzero? s4-0) (type-type? (-> s4-0 type) process-drawable)) - s4-0 - ) - ) - ) - (when (and v1-2 (< 8192.0 (- (-> v1-2 root trans y) (-> self root-override trans y)))) - (do-push-aways! (-> self root-override)) - (send-shove-back - (-> self root-override) - arg0 - (the-as touching-shapes-entry (-> arg3 param 0)) - 0.7 - 6144.0 - 16384.0 - ) - ) - ) - ) - ((= v1-0 'attack) - (let ((v1-9 (-> arg3 param 2))) - (cond - ((!= v1-9 (-> self player-attack-id)) - (set! (-> self player-attack-id) (the-as int v1-9)) - (if (-> self vulnerable) - (go yakow-kicked) - ) + (the-as object (case arg2 + (('touch) + (let* ((s4-0 arg0) + (v1-2 (if (and (nonzero? s4-0) (type-type? (-> s4-0 type) process-drawable)) + s4-0 + ) + ) ) - (else - 'push - ) + (when (and v1-2 (< 8192.0 (- (-> v1-2 root trans y) (-> self root-override trans y)))) + (do-push-aways! (-> self root-override)) + (send-shove-back + (-> self root-override) + arg0 + (the-as touching-shapes-entry (-> arg3 param 0)) + 0.7 + 6144.0 + 16384.0 ) ) ) - ) - ) - ) + ) + (('attack) + (let ((v1-9 (-> arg3 param 2))) + (cond + ((!= v1-9 (-> self player-attack-id)) + (set! (-> self player-attack-id) (the-as int v1-9)) + (if (-> self vulnerable) + (go yakow-kicked) + ) + ) + (else + 'push + ) + ) + ) + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc index 58382d7868..97b9031fb7 100644 --- a/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc +++ b/test/decompiler/reference/jak1/levels/village2/swamp-blimp_REF.gc @@ -1759,13 +1759,13 @@ ;; failed to figure out what this is: (defstate swamp-blimp-idle (swamp-blimp) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'tetherrock-break-evt) - (increment-success-for-hint (game-text-id swamp-tetherrock-eco-yellow-hint)) - (swamp-blimp-setup) - ) - ) - ) + (the-as object (case event-type + (('tetherrock-break-evt) + (increment-success-for-hint (game-text-id swamp-tetherrock-eco-yellow-hint)) + (swamp-blimp-setup) + ) + ) + ) ) :trans (the-as (function none :behavior swamp-blimp) blimp-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/village2/village2-obs_REF.gc b/test/decompiler/reference/jak1/levels/village2/village2-obs_REF.gc index af6b15fb18..beaf55ae95 100644 --- a/test/decompiler/reference/jak1/levels/village2/village2-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/village2/village2-obs_REF.gc @@ -188,13 +188,13 @@ (defstate rigid-body-platform-idle (pontoon) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'die) - (cleanup-for-death self) - (deactivate self) - ) - ) - ) + (the-as object (case event-type + (('die) + (cleanup-for-death self) + (deactivate self) + ) + ) + ) ) ) @@ -567,13 +567,13 @@ ;; failed to figure out what this is: (defstate allpontoons-be-clone (allpontoons) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'end-mode) - (cleanup-for-death self) - (deactivate self) - ) - ) - ) + (the-as object (case event-type + (('end-mode) + (cleanup-for-death self) + (deactivate self) + ) + ) + ) ) :enter (behavior ((arg0 handle)) (logclear! (-> self draw status) (draw-status hidden)) diff --git a/test/decompiler/reference/jak1/levels/village3/minecart_REF.gc b/test/decompiler/reference/jak1/levels/village3/minecart_REF.gc index fef1a18011..ee735cca95 100644 --- a/test/decompiler/reference/jak1/levels/village3/minecart_REF.gc +++ b/test/decompiler/reference/jak1/levels/village3/minecart_REF.gc @@ -43,19 +43,19 @@ (defstate idle (minecartsteel) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (or (= v1-0 'touch) (= v1-0 'attack)) - (when (= (-> proc type) target) - (let ((a2-1 (new 'stack 'collide-overlap-result))) - (if (not (on-platform (-> self root-override) (-> *target* control) a2-1)) - (send-event proc 'no-look-around (seconds 1.5)) - ) - ) - ) - #f - ) - ) - ) + (the-as object (case event-type + (('touch 'attack) + (when (= (-> proc type) target) + (let ((a2-1 (new 'stack 'collide-overlap-result))) + (if (not (on-platform (-> self root-override) (-> *target* control) a2-1)) + (send-event proc 'no-look-around (seconds 1.5)) + ) + ) + ) + #f + ) + ) + ) ) :trans (the-as (function none :behavior minecartsteel) rider-trans) :code (behavior () diff --git a/test/decompiler/reference/jak1/levels/village3/village3-obs_REF.gc b/test/decompiler/reference/jak1/levels/village3/village3-obs_REF.gc index f30578a0b3..cf8baee690 100644 --- a/test/decompiler/reference/jak1/levels/village3/village3-obs_REF.gc +++ b/test/decompiler/reference/jak1/levels/village3/village3-obs_REF.gc @@ -513,16 +513,16 @@ (defstate idle (gondolacables) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'update) - (process-entity-status! self (entity-perm-status complete) #t) - (let ((v0-0 1)) - (set! (-> self draw mgeo effect 0 effect-bits) (the-as uint v0-0)) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('update) + (process-entity-status! self (entity-perm-status complete) #t) + (let ((v0-0 1)) + (set! (-> self draw mgeo effect 0 effect-bits) (the-as uint v0-0)) + v0-0 + ) + ) + ) + ) ) :code (behavior () (loop diff --git a/test/decompiler/reference/jak2/engine/ai/traffic-h_REF.gc b/test/decompiler/reference/jak2/engine/ai/traffic-h_REF.gc index cc20bdd07b..cbb2f28ebf 100644 --- a/test/decompiler/reference/jak2/engine/ai/traffic-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/ai/traffic-h_REF.gc @@ -15,14 +15,14 @@ ;; definition of type traffic-danger-info (deftype traffic-danger-info (structure) - ((sphere sphere :inline :offset-assert 0) - (velocity vector :inline :offset-assert 16) - (handle uint64 :offset-assert 32) - (notify-radius float :offset-assert 40) - (danger-level float :offset-assert 44) - (decay-rate float :offset-assert 48) - (flags uint8 :offset-assert 52) - (danger-type uint8 :offset-assert 53) + ((sphere sphere :inline :offset-assert 0) + (velocity vector :inline :offset-assert 16) + (handle uint64 :offset-assert 32) + (notify-radius float :offset-assert 40) + (danger-level float :offset-assert 44) + (decay-rate float :offset-assert 48) + (flags traffic-danger-flags :offset-assert 52) + (danger-type traffic-danger-type :offset-assert 53) ) :method-count-assert 9 :size-assert #x36 diff --git a/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc b/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc index 49d345a357..2906196602 100644 --- a/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc +++ b/test/decompiler/reference/jak2/engine/anim/fma-sphere_REF.gc @@ -198,8 +198,8 @@ (set! (-> self danger notify-radius) (+ 40960.0 (-> self sphere r))) (set! (-> self danger danger-level) 1.0) (set! (-> self danger decay-rate) 0.0) - (set! (-> self danger flags) (the-as uint 1)) - (set! (-> self danger danger-type) (the-as uint 4)) + (set! (-> self danger flags) (traffic-danger-flags tdf0)) + (set! (-> self danger danger-type) (traffic-danger-type tdt4)) ) ) (else @@ -271,7 +271,3 @@ (go-virtual idle) (none) ) - - - - diff --git a/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc index 0baf0590ae..8580ac55b8 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-combiner_REF.gc @@ -13,13 +13,25 @@ (cond ((= (-> self tracking-status) 3) (cam-calc-follow! (-> self tracking) s1-0 #t) - (slave-set-rotation! (-> self tracking) s1-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (slave-set-rotation! + (-> self tracking) + s1-0 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #t + ) (set! sv-144 (-> self tracking)) (set! s1-0 (-> self trans)) ) ((= (-> self tracking-status) 2) (cam-calc-follow! (-> self tracking) s0-0 #t) - (slave-set-rotation! (-> self tracking) s0-0 (the-as float (-> self tracking-options)) (-> self fov) #t) + (slave-set-rotation! + (-> self tracking) + s0-0 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #t + ) (set! gp-0 (-> self tracking)) (set! s0-0 (-> self trans)) ) @@ -85,9 +97,9 @@ ) (let ((f30-0 (acos (vector-dot (the-as vector (-> s2-0 vector)) (-> s2-0 vector 1))))) (cond - ((logtest? (-> *camera* master-options) 2) - (set! (-> *camera* master-options) (logand -7 (-> *camera* master-options))) - (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) 1)) + ((logtest? (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) + (logclear! (-> *camera* master-options) (cam-master-options-u32 SET_COMBINER_AXIS FLIP_COMBINER)) + (when (and (< 8192.0 f30-0) (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (vector-! (the-as vector (-> s2-0 vector)) (-> *camera* tpos-curr) s1-0) (vector-! (-> s2-0 vector 1) s0-0 s1-0) (vector-flatten! (the-as vector (-> s2-0 vector)) (the-as vector (-> s2-0 vector)) (-> *camera* local-down)) @@ -102,11 +114,11 @@ ) ) ((and (< 16384.0 f30-0) (< (vector-dot (-> self flip-control-axis) s4-0) 0.0)) - (logxor! (-> *camera* master-options) 4) + (logxor! (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER)) ) ) (set! (-> self flip-control-axis quad) (-> s4-0 quad)) - (when (logtest? (-> *camera* master-options) 4) + (when (logtest? (-> *camera* master-options) (cam-master-options-u32 FLIP_COMBINER)) (set! f30-0 (- 65536.0 f30-0)) (vector-negate! s4-0 s4-0) ) @@ -124,140 +136,146 @@ ;; failed to figure out what this is: (defstate cam-combiner-active (camera-combiner) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'fast-rot) - (set! v0-0 (the-as none #t)) - (set! (-> self fast-rot) (the-as basic v0-0)) - v0-0 - ) - ((= v1-0 'set-interpolation) - (let ((f0-1 (the float (-> event param 0)))) - (cond - ((>= 0.0 f0-1) - (set! (-> self interp-val) 1.0) - ) - (else - (set! (-> self interp-val) 0.0) - (set! (-> self interp-step) (/ 5.0 f0-1)) - ) - ) - ) - ) - ((= v1-0 'teleport) - (when (nonzero? (-> self tracking-status)) - (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) - (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! - (-> self tracking) - (-> self trans) - (the-as float (-> self tracking-options)) - (-> self fov) - #f - ) - ) - ) - ((= v1-0 'stop-tracking) - (set! (-> self tracking-status) (the-as uint 0)) - 0 - ) - ((= v1-0 'start-tracking) + (local-vars (v0-0 object)) + (the-as + object + (case event-type + (('fast-rot) + (set! v0-0 #t) + (set! (-> self fast-rot) (the-as basic v0-0)) + v0-0 + ) + (('set-interpolation) + (let ((f0-1 (the float (-> event param 0)))) (cond - ((< arg1 1) - (let ((t9-3 format) - (a0-14 0) - (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") - ) - (let ((v1-8 (-> event param 0))) - (rtype-of v1-8) - ) - (t9-3 a0-14 a1-4) - ) - ) - ((not (type? (-> event param 0) camera-slave)) - (let ((t9-5 format) - (a0-16 0) - (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") - (v1-11 (-> event param 0)) - ) - (t9-5 a0-16 a1-6 (rtype-of v1-11)) - ) - ) - ((zero? (-> self tracking-status)) - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-1 (the-as camera-slave (-> event param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-1 options))) - (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) - (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) - (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) - (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) - (let ((gp-2 (-> gp-1 trans))) - (cam-calc-follow! (-> self tracking) gp-2 #f) - (slave-set-rotation! (-> self tracking) gp-2 (the-as float (-> self tracking-options)) (-> self fov) #f) - ) - ) - ) - ) - ) - ((= v1-0 'copy-tracking) - (cond - ((< arg1 1) - (let ((t9-11 format) - (a0-23 0) - (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") - ) - (let ((v1-23 (-> event param 0))) - (rtype-of v1-23) - ) - (t9-11 a0-23 a1-12) - ) - ) - ((not (type? (-> event param 0) camera-slave)) - (let ((t9-13 format) - (a0-25 0) - (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") - (v1-25 (-> event param 0)) - ) - (t9-13 a0-25 a1-14 (rtype-of v1-25)) - ) - ) - ((nonzero? (-> self tracking-status)) - #f + ((>= 0.0 f0-1) + (set! (-> self interp-val) 1.0) ) (else - (set! (-> self tracking-status) (the-as uint 1)) - (let ((gp-3 (the-as camera-slave (-> event param 0)))) - (set! (-> self tracking-options) (the-as int (-> gp-3 options))) - (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) - (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) - (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) - (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) - (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) - (let* ((a2-23 (-> self tracking)) - (a3-7 (-> gp-3 tracking)) - (v1-37 (-> a3-7 inv-mat vector 0 quad)) - (a0-32 (-> a3-7 inv-mat vector 1 quad)) - (a1-17 (-> a3-7 inv-mat vector 2 quad)) - (a3-8 (-> a3-7 inv-mat trans quad)) - ) - (set! (-> a2-23 inv-mat vector 0 quad) v1-37) - (set! (-> a2-23 inv-mat vector 1 quad) a0-32) - (set! (-> a2-23 inv-mat vector 2 quad) a1-17) - (set! (-> a2-23 inv-mat trans quad) a3-8) - ) - (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) - (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) - (set! v0-0 (the-as none (-> self tracking looking-interesting))) - (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) - ) - v0-0 + (set! (-> self interp-val) 0.0) + (set! (-> self interp-step) (/ 5.0 f0-1)) ) ) ) - ) + ) + (('teleport) + (when (nonzero? (-> self tracking-status)) + (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (the-as object (slave-set-rotation! + (-> self tracking) + (-> self trans) + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ) + (('stop-tracking) + (set! (-> self tracking-status) (the-as uint 0)) + 0 + ) + (('start-tracking) + (cond + ((< arg1 1) + (let ((t9-3 format) + (a0-14 0) + (a1-4 "ERROR : missing camera-slave parameter to *camera-combiner* start-tracking~%") + ) + (let ((v1-8 (-> event param 0))) + (rtype-of v1-8) + ) + (t9-3 a0-14 a1-4) + ) + ) + ((not (type? (-> event param 0) camera-slave)) + (let ((t9-5 format) + (a0-16 0) + (a1-6 "ERROR : invalid type '~A' to *camera-combiner* start-tracking~%") + (v1-11 (-> event param 0)) + ) + (t9-5 a0-16 a1-6 (rtype-of v1-11)) + ) + ) + ((zero? (-> self tracking-status)) + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-1 (the-as camera-slave (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-1 options))) + (set! (-> self tracking no-follow) (-> gp-1 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-1 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-1 tracking underwater-blend)) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-1 tracking point-of-interest-blend)) + (let ((gp-2 (-> gp-1 trans))) + (cam-calc-follow! (-> self tracking) gp-2 #f) + (the-as object (slave-set-rotation! + (-> self tracking) + gp-2 + (the-as cam-slave-options-u32 (-> self tracking-options)) + (-> self fov) + #f + ) + ) + ) + ) + ) + ) + ) + (('copy-tracking) + (cond + ((< arg1 1) + (let ((t9-11 format) + (a0-23 0) + (a1-12 "ERROR : missing camera-slave parameter to *camera-combiner* copy-tracking~%") + ) + (let ((v1-23 (-> event param 0))) + (rtype-of v1-23) + ) + (t9-11 a0-23 a1-12) + ) + ) + ((not (type? (-> event param 0) camera-slave)) + (let ((t9-13 format) + (a0-25 0) + (a1-14 "ERROR : invalid type '~A' to *camera-combiner* copy-tracking~%") + (v1-25 (-> event param 0)) + ) + (t9-13 a0-25 a1-14 (rtype-of v1-25)) + ) + ) + ((nonzero? (-> self tracking-status)) + #f + ) + (else + (set! (-> self tracking-status) (the-as uint 1)) + (let ((gp-3 (the-as camera-slave (-> event param 0)))) + (set! (-> self tracking-options) (the-as int (-> gp-3 options))) + (set! (-> self tracking no-follow) (-> gp-3 tracking no-follow)) + (copy-to (-> self tracking tilt-adjust) (-> gp-3 tracking tilt-adjust)) + (copy-to (-> self tracking underwater-blend) (-> gp-3 tracking underwater-blend)) + (set! (-> self tracking follow-off quad) (-> gp-3 tracking follow-off quad)) + (set! (-> self tracking follow-pt quad) (-> gp-3 tracking follow-pt quad)) + (let* ((a2-23 (-> self tracking)) + (a3-7 (-> gp-3 tracking)) + (v1-37 (-> a3-7 inv-mat vector 0 quad)) + (a0-32 (-> a3-7 inv-mat vector 1 quad)) + (a1-17 (-> a3-7 inv-mat vector 2 quad)) + (a3-8 (-> a3-7 inv-mat trans quad)) + ) + (set! (-> a2-23 inv-mat vector 0 quad) v1-37) + (set! (-> a2-23 inv-mat vector 1 quad) a0-32) + (set! (-> a2-23 inv-mat vector 2 quad) a1-17) + (set! (-> a2-23 inv-mat trans quad) a3-8) + ) + (copy-to (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend)) + (set! (-> self tracking looking-at quad) (-> gp-3 tracking looking-at quad)) + (set! v0-0 (-> self tracking looking-interesting)) + (set! (-> (the-as vector v0-0) quad) (-> gp-3 tracking looking-interesting quad)) + ) + v0-0 + ) + ) + ) ) ) ) @@ -285,7 +303,9 @@ ) 0 ) - (when (and (not (logtest? (-> *camera* master-options) 1)) (!= (-> self tracking-status) 0)) + (when (and (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (!= (-> self tracking-status) 0) + ) (set! (-> self tracking-status) (the-as uint 0)) 0 ) @@ -309,7 +329,7 @@ (slave-set-rotation! (-> self tracking) (-> self trans) - (the-as float (-> self tracking-options)) + (the-as cam-slave-options-u32 (-> self tracking-options)) (-> self fov) (not (-> self fast-rot)) ) @@ -362,7 +382,7 @@ (slave-set-rotation! (-> self tracking) (-> self trans) - (the-as float (-> self tracking-options)) + (the-as cam-slave-options-u32 (-> self tracking-options)) (-> self fov) (not (-> self fast-rot)) ) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc index 6c80c38236..e8a6f8c2e0 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-debug_REF.gc @@ -1,30 +1,40 @@ +;;-*-Lisp-*- (in-package goal) +;; this file is debug only (declare-file (debug)) (when *debug-segment* +;; failed to figure out what this is: (when (or (not *camera-old-cpu*) (zero? *camera-old-cpu*)) (set! *camera-old-cpu* 0) 0 ) +;; failed to figure out what this is: (when (or (not *camera-old-vu*) (zero? *camera-old-vu*)) (set! *camera-old-vu* 0) 0 ) +;; failed to figure out what this is: (when (or (not *camera-old-tfrag-bytes*) (zero? *camera-old-tfrag-bytes*)) (set! *camera-old-tfrag-bytes* 0) 0 ) +;; definition (perm) for symbol *camera-old-level*, type string (define-perm *camera-old-level* string (new 'global 'string 128 (the-as string #f))) +;; definition (perm) for symbol *camera-old-stat-string-tfrag*, type string (define-perm *camera-old-stat-string-tfrag* string (new 'global 'string 128 (the-as string #f))) +;; definition (perm) for symbol *camera-old-stat-string-tfrag-near*, type string (define-perm *camera-old-stat-string-tfrag-near* string (new 'global 'string 128 (the-as string #f))) +;; definition (perm) for symbol *camera-old-stat-string-total*, type string (define-perm *camera-old-stat-string-total* string (new 'global 'string 128 (the-as string #f))) +;; definition of type cam-dbg-scratch (deftype cam-dbg-scratch (structure) ((linevec4w vector4w 2 :inline :offset-assert 0) (color vector4w :inline :offset-assert 32) @@ -48,6 +58,7 @@ :flag-assert #x9000001d0 ) +;; definition for method 3 of type cam-dbg-scratch (defmethod inspect cam-dbg-scratch ((obj cam-dbg-scratch)) (when (not obj) (set! obj obj) @@ -74,6 +85,8 @@ obj ) +;; definition for function cam-slave-options->string +;; WARN: Return type mismatch object vs string. (defun cam-slave-options->string ((arg0 cam-slave-options) (arg1 object)) (if (= (logand arg0 (cam-slave-options SAME_SIDE)) (cam-slave-options SAME_SIDE)) (format arg1 "SAME_SIDE ") @@ -152,6 +165,8 @@ (the-as string arg1) ) +;; definition for function cam-index-options->string +;; WARN: Return type mismatch object vs string. (defun cam-index-options->string ((arg0 cam-index-options) (arg1 object)) (if (= (logand arg0 (cam-index-options SPHERICAL)) (cam-index-options SPHERICAL)) (format arg1 "RADIAL ") @@ -162,6 +177,7 @@ (the-as string arg1) ) +;; definition for function slave-los-state->string (defun slave-los-state->string ((arg0 slave-los-state)) (case arg0 (((slave-los-state between)) @@ -182,6 +198,10 @@ ) ) +;; definition for function cam-line-dma +;; INFO: Used lq/sq +;; WARN: Failed store: (s.w! (+ a0-2 8) 0) at op 78 +;; WARN: Failed store: (s.w! (+ a0-2 12) 0) at op 79 (defun cam-line-dma () (with-dma-buffer-add-bucket ((v1-5 (-> *display* frames (-> *display* on-screen) debug-buf)) (bucket-id debug-no-zbuf1) @@ -245,6 +265,7 @@ ) ) +;; definition for function camera-line2d (defun camera-line2d ((arg0 vector4w) (arg1 vector4w)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 x) (the-as int (* (+ (-> arg0 x) 1792) 16))) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec4w 0 y) @@ -261,6 +282,9 @@ (cam-line-dma) ) +;; definition for function camera-plot-float-func +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun camera-plot-float-func ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 (function float float)) (arg5 vector4w)) (let ((f30-0 (- arg1 arg0)) (f24-0 (- arg3 arg2)) @@ -361,6 +385,9 @@ (none) ) +;; definition for function camera-line-setup +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun camera-line-setup ((arg0 vector4w)) (let ((v1-0 (-> arg0 quad))) (set! (-> (the-as cam-dbg-scratch #x70000000) color quad) v1-0) @@ -370,6 +397,10 @@ (none) ) +;; definition for function camera-line-draw +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +;; WARN: Function camera-line-draw has a return type of none, but the expression builder found a return statement. (defun camera-line-draw ((arg0 vector) (arg1 vector)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 0 quad) (-> arg0 quad)) (set! (-> (the-as cam-dbg-scratch #x70000000) linevec 1 quad) (-> arg1 quad)) @@ -396,6 +427,8 @@ (none) ) +;; definition for function camera-line +;; WARN: Return type mismatch int vs none. (defun camera-line ((arg0 vector) (arg1 vector) (arg2 vector4w)) (camera-line-setup arg2) (camera-line-draw arg0 arg1) @@ -403,12 +436,14 @@ (none) ) +;; definition for function camera-line-rel (defun camera-line-rel ((arg0 vector) (arg1 vector) (arg2 vector4w)) (vector+! (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg0 arg1) (camera-line arg0 (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg2) (none) ) +;; definition for function camera-line-rel-len (defun camera-line-rel-len ((arg0 vector) (arg1 vector) (arg2 float) (arg3 vector4w)) (vector-normalize-copy! (-> (the-as cam-dbg-scratch #x70000000) rel-vec) arg1 arg2) (vector+! @@ -420,6 +455,8 @@ (none) ) +;; definition for function camera-sphere +;; WARN: Return type mismatch int vs none. (defun camera-sphere ((arg0 vector) (arg1 float) (arg2 vector4w)) (camera-line-setup arg2) (dotimes (s4-0 10) @@ -469,6 +506,7 @@ (none) ) +;; definition for function camera-cross (defun camera-cross ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector4w) (arg4 meters)) (vector-normalize-copy! (the-as vector (-> (the-as cam-dbg-scratch #x70000000) crossvec)) arg0 arg4) (vector+! @@ -531,6 +569,9 @@ (none) ) +;; definition for function camera-bounding-box-draw +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun camera-bounding-box-draw ((arg0 bounding-box) (arg1 basic) (arg2 rgba)) (camera-line-setup (new 'static 'vector4w :x #x7f :y #x7f :z #x7f :w #x80)) (set! (-> (the-as cam-dbg-scratch #x70000000) bboxvec 0 quad) (-> arg0 min quad)) @@ -579,6 +620,7 @@ (none) ) +;; definition of type cam-debug-tri (deftype cam-debug-tri (structure) ((vertex vector 3 :inline :offset-assert 0) (intersect vector :inline :offset-assert 48) @@ -589,6 +631,7 @@ :flag-assert #x900000044 ) +;; definition for method 3 of type cam-debug-tri (defmethod inspect cam-debug-tri ((obj cam-debug-tri)) (when (not obj) (set! obj obj) @@ -602,14 +645,20 @@ obj ) +;; definition for symbol *cam-debug-los-tri-current*, type int (define *cam-debug-los-tri-current* 0) +;; definition for symbol *cam-debug-los-tri*, type (inline-array cam-debug-tri) (define *cam-debug-los-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) +;; definition for symbol *cam-debug-coll-tri-current*, type int (define *cam-debug-coll-tri-current* 0) +;; definition for symbol *cam-debug-coll-tri*, type (inline-array cam-debug-tri) (define *cam-debug-coll-tri* (the-as (inline-array cam-debug-tri) (malloc 'debug #x8fc0))) +;; definition for function cam-debug-reset-coll-tri +;; WARN: Return type mismatch int vs none. (defun cam-debug-reset-coll-tri () (set! *cam-debug-los-tri-current* 0) (set! *cam-debug-coll-tri-current* 0) @@ -617,6 +666,9 @@ (none) ) +;; definition for function cam-debug-add-los-tri +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun cam-debug-add-los-tri ((arg0 (inline-array collide-cache-tri)) (arg1 vector) (arg2 vector)) (cond ((>= *cam-debug-los-tri-current* 460) @@ -639,6 +691,9 @@ (none) ) +;; definition for function cam-debug-add-coll-tri +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun cam-debug-add-coll-tri ((arg0 cam-debug-tri) (arg1 vector) (arg2 cam-debug-tri)) (cond ((>= *cam-debug-coll-tri-current* 460) @@ -661,6 +716,8 @@ (none) ) +;; definition for function cam-debug-draw-tris +;; INFO: Used lq/sq (defun cam-debug-draw-tris () (camera-line-setup (new 'stack 'vector4w)) (when *display-cam-los-marks* @@ -718,6 +775,7 @@ ) ) +;; definition for function camera-fov-draw (defun camera-fov-draw ((arg0 int) (arg1 int) (arg2 vector) (arg3 float) (arg4 float) (arg5 vector4w)) (vector+float*! (the-as vector (-> (the-as cam-dbg-scratch #x70000000) fov-vv)) @@ -738,6 +796,9 @@ (none) ) +;; definition for function camera-fov-frame +;; INFO: Used lq/sq +;; WARN: Return type mismatch none vs symbol. (defun camera-fov-frame ((arg0 matrix) (arg1 vector) (arg2 float) (arg3 float) (arg4 float) (arg5 vector4w)) (vector-float*! (-> (the-as cam-dbg-scratch #x70000000) fov-vert) (-> arg0 vector 1) (* arg3 (tan arg2))) (vector-float*! @@ -839,6 +900,8 @@ ) ) +;; definition for method 11 of type tracking-spline +;; WARN: Return type mismatch int vs none. (defmethod debug-point-info tracking-spline ((obj tracking-spline) (arg0 int)) (if (= arg0 (-> obj used-point)) (format 0 "u") @@ -867,6 +930,8 @@ (none) ) +;; definition for method 12 of type tracking-spline +;; WARN: Return type mismatch int vs none. (defmethod debug-all-points tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (while (!= s5-0 -134250495) @@ -879,6 +944,8 @@ (none) ) +;; definition for method 23 of type tracking-spline +;; WARN: Return type mismatch int vs none. (defmethod debug-draw-spline tracking-spline ((obj tracking-spline)) (let ((s5-0 (-> obj used-point))) (let ((s4-0 (-> obj point (-> obj used-point) next))) @@ -936,6 +1003,7 @@ (none) ) +;; definition for function debug-euler (defun debug-euler ((arg0 cam-dbg-scratch)) (let ((s4-0 (new 'stack-no-clear 'euler-angles)) (gp-0 (new 'stack-no-clear 'matrix)) @@ -1023,6 +1091,7 @@ ) ) +;; definition for function bike-cam-limit (defun bike-cam-limit ((arg0 float)) (let* ((f0-1 (* 10012.444 arg0)) (f30-0 (fmax 0.0 f0-1)) @@ -1034,6 +1103,9 @@ ) ) +;; definition for function camera-slave-debug +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun camera-slave-debug ((arg0 camera-slave)) (when *display-camera-marks* (if (-> *setting-control* cam-current use-point-of-interest) @@ -1130,9 +1202,9 @@ (else (vector+float*! s5-1 s4-1 (the-as vector (-> arg0 tracking)) 2048.0) (camera-line s4-1 s5-1 (new 'static 'vector4w :x #xff :w #x80)) - (vector+float*! s5-1 s4-1 (the-as vector (&-> arg0 stack 96)) 2048.0) + (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 1) 2048.0) (camera-line s4-1 s5-1 (new 'static 'vector4w :y #xff :w #x80)) - (vector+float*! s5-1 s4-1 (the-as vector (&-> arg0 stack 112)) 2048.0) + (vector+float*! s5-1 s4-1 (-> arg0 tracking inv-mat vector 2) 2048.0) (camera-line s4-1 s5-1 (new 'static 'vector4w :z #xff :w #x80)) ) ) @@ -1221,6 +1293,9 @@ (none) ) +;; definition for function master-draw-coordinates +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun master-draw-coordinates ((arg0 vector)) (let ((s5-0 (new-stack-vector0)) (gp-0 (new-stack-vector0)) @@ -1310,6 +1385,7 @@ (none) ) +;; definition of type cam-collision-record (deftype cam-collision-record (structure) ((pos vector :inline :offset-assert 0) (vel vector :inline :offset-assert 16) @@ -1332,6 +1408,7 @@ :flag-assert #x9000000a8 ) +;; definition for method 3 of type cam-collision-record (defmethod inspect cam-collision-record ((obj cam-collision-record)) (when (not obj) (set! obj obj) @@ -1357,6 +1434,7 @@ obj ) +;; definition of type cam-collision-record-array (deftype cam-collision-record-array (inline-array-class) ((data cam-collision-record :dynamic :offset-assert 16) ) @@ -1365,6 +1443,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type cam-collision-record-array (defmethod inspect cam-collision-record-array ((obj cam-collision-record-array)) (when (not obj) (set! obj obj) @@ -1378,16 +1457,24 @@ obj ) +;; failed to figure out what this is: (set! (-> cam-collision-record-array heap-base) (the-as uint 176)) +;; definition for symbol *cam-collision-record-first*, type int (define *cam-collision-record-first* 0) +;; definition for symbol *cam-collision-record-last*, type int (define *cam-collision-record-last* 0) +;; definition for symbol *cam-collision-record-show*, type int (define *cam-collision-record-show* 0) +;; definition for symbol *cam-collision-record*, type cam-collision-record-array (define *cam-collision-record* (new 'debug 'cam-collision-record-array 600)) +;; definition for function cam-collision-record-save +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-save ((arg0 vector) (arg1 vector) (arg2 int) (arg3 symbol) (arg4 camera-slave)) (with-pp (when *record-cam-collide-history* @@ -1426,6 +1513,8 @@ ) ) +;; definition for function cam-collision-record-step +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-step ((arg0 int)) (set! *cam-collision-record-show* (+ *cam-collision-record-show* arg0)) (while (>= *cam-collision-record-show* 600) @@ -1438,6 +1527,9 @@ (none) ) +;; definition for function cam-collision-record-draw +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun cam-collision-record-draw () (cond ((cpad-pressed? 0 down) @@ -1596,6 +1688,8 @@ (none) ) +;; definition for function camera-master-debug +;; WARN: Return type mismatch int vs none. (defun camera-master-debug ((arg0 camera-master)) (when *display-cam-other* (let ((f0-1 (* 0.5 (-> *camera-other-fov* data)))) @@ -1656,6 +1750,8 @@ (none) ) +;; definition for function debug-set-camera-pos-rot! +;; INFO: Used lq/sq (defun debug-set-camera-pos-rot! ((arg0 vector) (arg1 matrix)) (when (and *camera* *camera-combiner*) (set! (-> *camera-combiner* trans quad) (-> arg0 quad)) @@ -1677,6 +1773,9 @@ arg0 ) +;; definition (debug) for function cam-restore +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defun-debug cam-restore () (let ((a0-0 (new-stack-vector0)) (a1-0 (new-stack-matrix0)) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc index 3968263d16..45d7dffdaa 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-master_REF.gc @@ -102,12 +102,12 @@ (cond ((and *target* (not gp-0)) (try-update-focus (-> self focus) *target*) - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (reset-target-tracking) ) - ((and (logtest? (-> self master-options) 1) (not gp-0)) - (let ((v0-1 (the-as object (logand -2 (-> self master-options))))) - (set! (-> self master-options) (the-as uint v0-1)) + ((and (logtest? (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (not gp-0)) + (let ((v0-1 (the-as object (logclear (-> self master-options) (cam-master-options-u32 HAVE_TARGET))))) + (set! (-> self master-options) (the-as cam-master-options-u32 v0-1)) v0-1 ) ) @@ -115,7 +115,7 @@ #f ) (gp-0 - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (cond ((>= (- (-> self clock frame-counter) (process-focusable-method-25 (the-as target gp-0))) (-> *CAMERA-bank* attack-timeout) @@ -150,14 +150,14 @@ ((< (-> self ease-t) 1.0) (new 'stack-no-clear 'vector) (cond - ((logtest? (-> self master-options) 8) + ((logtest? (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) (vector-lerp! (-> self tpos-curr) (-> self ease-from) (-> self ease-to) (parameter-ease-sin-clamp (-> self ease-t)) ) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) (else (vector-lerp! @@ -326,7 +326,7 @@ (defun setup-slave-for-hopefull ((arg0 camera-slave)) (when (= (-> arg0 blend-to-type) (camera-blend-to-type unknown-2)) (cam-calc-follow! (-> arg0 tracking) (-> arg0 trans) #f) - (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (the-as float (-> arg0 options)) (-> arg0 fov) #f) + (slave-set-rotation! (-> arg0 tracking) (-> arg0 trans) (-> arg0 options) (-> arg0 fov) #f) ) (none) ) @@ -341,8 +341,8 @@ #t ) (else - (< (vector-dot (the-as vector (&-> arg0 stack 112)) (-> *camera-combiner* inv-camera-rot vector 2)) - (vector-dot (the-as vector (&-> arg1 stack 112)) (-> *camera-combiner* inv-camera-rot vector 2)) + (< (vector-dot (-> arg0 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) + (vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)) ) ) ) @@ -606,7 +606,7 @@ ;; failed to figure out what this is: (defstate cam-master-active (camera-master) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none) (v1-125 uint)) + (local-vars (v0-0 object) (v1-125 uint)) (rlet ((vf0 :class vf)) (init-vf0-vector) (let ((v1-0 event-type)) @@ -678,7 +678,7 @@ (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-2 (new 'static 'vector :y -1.0)) ) (send-event self 'teleport) - (cam-master-activate-slave #f) + (the-as object (cam-master-activate-slave #f)) ) ((= v1-0 'teleport-to-vector-start-string) (when (> arg1 0) @@ -695,7 +695,7 @@ (forward-down->inv-matrix (-> *camera-combiner* inv-camera-rot) gp-3 (new 'static 'vector :y -1.0)) ) (send-event self 'teleport) - (cam-master-activate-slave #f) + (the-as object (cam-master-activate-slave #f)) ) ) ((= v1-0 'change-target) @@ -703,11 +703,11 @@ (cond ((not a1-15) (clear-focused (-> self focus)) - (set! (-> self master-options) (logand -2 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) ) (else (try-update-focus (-> self focus) (the-as process-focusable a1-15)) - (logior! (-> self master-options) 1) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_TARGET)) (reset-target-tracking) ) ) @@ -738,7 +738,7 @@ ) (when (and s5-1 (!= s5-1 gp-4)) (set! (-> self slave) (the-as (pointer camera-slave) s5-1)) - (logior! (-> self master-options) 2) + (logior! (-> self master-options) (cam-master-options-u32 SET_COMBINER_AXIS)) (set! (-> *camera-combiner* tracking tilt-adjust target) (-> self slave 0 tracking tilt-adjust target)) (cond ((or (zero? s4-0) (not gp-4)) @@ -829,7 +829,7 @@ ) ) (if gp-4 - (deactivate (-> gp-4 0)) + (the-as object (deactivate (-> gp-4 0))) ) ) ) @@ -838,24 +838,24 @@ (cond ((< arg1 1) (set! (-> self ease-t) 0.0) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) ((< arg1 2) (if (< (the-as float (-> event param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> event param 0))) ) - (set! (-> self master-options) (logand -9 (-> self master-options))) + (logclear! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) (else (if (< (the-as float (-> event param 0)) (-> self ease-t)) (set! (-> self ease-t) (the-as float (-> event param 0))) ) (set! (-> self ease-to quad) (-> (the-as vector (-> event param 1)) quad)) - (logior! (-> self master-options) 8) + (logior! (-> self master-options) (cam-master-options-u32 HAVE_EASE_TO_POS)) ) ) (set! (-> self ease-step) 0.033333335) - (set! v0-0 (the-as none (-> self ease-from))) + (set! v0-0 (-> self ease-from)) (set! (-> (the-as vector v0-0) quad) (-> self tpos-curr-adj quad)) v0-0 ) @@ -875,11 +875,11 @@ ((= v1-0 'toggle-slave-option) (logxor! (-> self slave-options) (-> event param 0)) (if (-> self slave) - (logxor! (-> self slave 0 options) (-> event param 0)) + (logxor! (-> self slave 0 options) (the-as uint (-> event param 0))) ) (when (-> self decel) - (set! v0-0 (the-as none (logxor (-> self decel 0 options) (-> event param 0)))) - (set! (-> self decel 0 options) (the-as uint v0-0)) + (set! v0-0 (logxor (-> self decel 0 options) (the-as uint (-> event param 0)))) + (set! (-> self decel 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) @@ -888,15 +888,15 @@ ) ((= v1-0 'set-slave-option) (when (-> self slave) - (set! v0-0 (the-as none (logior (-> self slave 0 options) (-> event param 0)))) - (set! (-> self slave 0 options) (the-as uint v0-0)) + (set! v0-0 (logior (-> self slave 0 options) (-> event param 0))) + (set! (-> self slave 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) ((= v1-0 'clear-slave-option) (when (-> self slave) - (set! v0-0 (the-as none (logclear (-> self slave 0 options) (-> event param 0)))) - (set! (-> self slave 0 options) (the-as uint v0-0)) + (set! v0-0 (logclear (-> self slave 0 options) (-> event param 0))) + (set! (-> self slave 0 options) (the-as cam-slave-options-u32 v0-0)) v0-0 ) ) @@ -906,7 +906,7 @@ (vector-reset! (-> self slave 0 tracking follow-off)) ) (set! (-> *camera-combiner* tracking no-follow) (the-as basic #t)) - (set! v0-0 (the-as none (-> *camera-combiner* tracking follow-off))) + (set! v0-0 (-> *camera-combiner* tracking follow-off)) (.svf (&-> (the-as vector v0-0) quad) vf0) v0-0 ) @@ -1071,7 +1071,7 @@ (defbehavior cam-master-init camera-master () (stack-size-set! (-> self main-thread) 512) (logclear! (-> self mask) (process-mask menu)) - (set! (-> self master-options) (the-as uint 0)) + (set! (-> self master-options) (cam-master-options-u32)) (set! (-> self settings) (-> *setting-control* cam-current)) (set! (-> self slave) (the-as (pointer camera-slave) #f)) (set! (-> self decel) (the-as (pointer camera-slave) #f)) diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc index ccd15149c1..3477ccc636 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states-dbg_REF.gc @@ -33,7 +33,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -75,7 +75,7 @@ (let ((s4-0 (new-stack-vector0))) (let ((s3-0 (new-stack-matrix0))) (matrix-axis-angle! s3-0 (the-as vector (-> self tracking)) (- (-> s5-0 x))) - (vector-matrix*! s4-0 (the-as vector (&-> self stack 112)) s3-0) + (vector-matrix*! s4-0 (-> self tracking inv-mat vector 2) s3-0) (matrix-axis-angle! s3-0 (-> *camera* local-down) (- (-> s5-0 y))) (vector-matrix*! s4-0 s4-0 s3-0) ) @@ -482,7 +482,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -498,7 +498,7 @@ :code (behavior () (until #f (let ((a2-0 (-> *camera* local-down))) - (if (logtest? (-> self options) 8) + (if (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT)) (set! a2-0 (the-as vector #f)) ) (cam-free-floating-move diff --git a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc index 94dc676836..a90df8d1a3 100644 --- a/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/cam-states_REF.gc @@ -7,7 +7,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -36,7 +36,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -75,7 +75,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -114,7 +114,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -180,7 +180,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -256,8 +256,8 @@ ((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos 3640.889) (vector-dot s5-0 s3-0))) (set! (-> self trans quad) (-> s2-0 quad)) (vector-negate! (the-as vector (-> self tracking)) (the-as vector (-> s0-0 vector))) - (set! (-> (the-as vector (&-> self stack 96)) quad) (-> s0-0 vector 1 quad)) - (vector-negate! (the-as vector (&-> self stack 112)) (-> s0-0 vector 2)) + (set! (-> (the-as vector (-> self tracking inv-mat vector 1)) quad) (-> s0-0 vector 1 quad)) + (vector-negate! (-> self tracking inv-mat vector 2) (-> s0-0 vector 2)) (set! (-> self fov) (* 2.0 (atan (/ 12.700255 (* 20.3 (-> s1-0 x))) 1.0))) (vector-float*! (the-as vector (-> self tracking)) (the-as vector (-> self tracking)) (/ 1.0 (-> s1-0 x))) (vector-reset! (-> self tracking inv-mat trans)) @@ -298,7 +298,9 @@ (none) ) :trans (behavior () - (if (or (not (handle->process (-> *camera* settings pov-handle))) (zero? (logand (-> *camera* master-options) 1))) + (if (or (not (handle->process (-> *camera* settings pov-handle))) + (zero? (logand (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + ) (cam-slave-go cam-free-floating) ) (none) @@ -375,7 +377,7 @@ (cam-standoff-calc-trans) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as vector (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -385,7 +387,7 @@ (when (not (-> self enter-has-run)) (vector-! (-> self pivot-pt) (-> self trans) (-> *camera* tpos-curr-adj)) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) 0 @@ -400,7 +402,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -439,7 +441,7 @@ (vector+! (-> self trans) (-> *camera* tpos-curr-adj) (-> self pivot-pt)) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x4000) + (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) @@ -502,7 +504,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -524,7 +526,7 @@ ) :exit (behavior () (if (and *target* - (logtest? (-> *camera* master-options) 1) + (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET)) (logtest? (-> *target* focus-status) (focus-status in-head)) ) (send-event *target* 'end-mode) @@ -532,7 +534,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (go cam-free-floating) ) (none) @@ -594,16 +596,16 @@ ) (matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y)) (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) - (when (not (logtest? (-> self options) 8)) - (if (< (vector-dot (the-as vector (&-> self stack 96)) (-> *camera* local-down)) 0.0) + (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) + (if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0) (forward-down->inv-matrix (the-as matrix (-> self tracking)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) ) (forward-down->inv-matrix (the-as matrix (-> self tracking)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) (vector-negate! (new-stack-vector0) (-> *camera* local-down)) ) ) @@ -611,34 +613,34 @@ (matrix-axis-angle! s5-0 (the-as vector (-> self tracking)) (- (-> s4-0 x))) (matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0) ) - (when (not (logtest? (-> self options) 8)) - (let ((f30-1 (vector-dot (-> *camera* local-down) (the-as vector (&-> self stack 112))))) + (when (not (logtest? (-> self options) (cam-slave-options-u32 ALLOW_Z_ROT))) + (let ((f30-1 (vector-dot (-> *camera* local-down) (-> self tracking inv-mat vector 2)))) (set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0)) (when (< (sin (-> *CAM_EYE-bank* max-degrees)) (fabs f30-1)) (vector--float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) f30-1 ) - (vector-normalize! (the-as vector (&-> self stack 112)) (cos (-> *CAM_EYE-bank* max-degrees))) + (vector-normalize! (-> self tracking inv-mat vector 2) (cos (-> *CAM_EYE-bank* max-degrees))) (if (< f30-1 0.0) (vector--float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) (sin (-> *CAM_EYE-bank* max-degrees)) ) (vector+float*! - (the-as vector (&-> self stack 112)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 2) + (-> self tracking inv-mat vector 2) (-> *camera* local-down) (sin (-> *CAM_EYE-bank* max-degrees)) ) ) (vector-cross! - (the-as vector (&-> self stack 96)) - (the-as vector (&-> self stack 112)) + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) (the-as vector (-> self tracking)) ) (set! (-> self tracking inv-mat vector 1 w) 0.0) @@ -674,7 +676,7 @@ (let ((gp-0 (new-stack-vector0))) (set! (-> self fov) (cam-slave-get-fov (-> self cam-entity))) (logior! (-> self options) (cam-slave-get-flags (-> self cam-entity) 'flags)) - (if (logtest? (-> self options) #x4000) + (if (logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) (set! (-> self tracking tilt-adjust target) (cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust)) @@ -721,7 +723,7 @@ ) (cam-curve-pos (-> self trans) (the-as vector #f) (the-as curve #f) #t) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) 0 @@ -739,7 +741,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -765,7 +767,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -820,7 +822,7 @@ (let ((v1-0 event-type)) (the-as object (if (= v1-0 'teleport) #f - (cam-standard-event-handler proc arg1 event-type event) + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -954,7 +956,7 @@ ) (vector-matrix*! arg0 arg1 s4-0) ) - ((and (logtest? (-> self options) 2) + ((and (logtest? (-> self options) (cam-slave-options-u32 SAME_SIDE)) (or (and (>= f26-0 (+ -8192.0 f30-0)) (>= f30-0 (+ -8192.0 (-> self pivot-rad)))) (and (>= (+ 8192.0 f30-0) f26-0) (>= (+ 8192.0 (-> self pivot-rad)) f30-0)) ) @@ -972,7 +974,7 @@ ) (else (set! (-> arg0 quad) (-> arg1 quad)) - (if (logtest? (-> self options) 2048) + (if (logtest? (-> self options) (cam-slave-options-u32 SHRINK_MAX_ANGLE)) (set! (-> self max-angle-curr) f28-0) ) ) @@ -985,17 +987,17 @@ (defbehavior cam-circular-position camera-slave ((arg0 symbol)) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) - (if (logtest? (-> self options) 130) + (if (logtest? (-> self options) (cam-slave-options-u32 SAME_SIDE DRAG)) (vector-! gp-0 (-> self circular-follow) (-> self pivot-pt)) (vector-! gp-0 (-> self pivot-pt) (-> self circular-follow)) ) (vector-! s5-0 (-> self trans) (-> self pivot-pt)) - (when (not (logtest? (-> self options) 4)) + (when (not (logtest? (-> self options) (cam-slave-options-u32 MOVE_SPHERICAL))) (vector-flatten! gp-0 gp-0 (-> *camera* local-down)) (vector-flatten! s5-0 s5-0 (-> *camera* local-down)) ) (cond - ((logtest? (-> self options) 128) + ((logtest? (-> self options) (cam-slave-options-u32 DRAG)) (let ((f30-0 (- (vector-length gp-0) (-> self pivot-rad)))) (when (< 0.0001 (-> *camera-combiner* tracking point-of-interest-blend value)) (let ((s5-1 (new 'stack-no-clear 'vector)) @@ -1050,7 +1052,7 @@ (let ((a2-1 (new-stack-vector0))) (vector-! a2-1 (-> *camera* tpos-curr-adj) (-> self pivot-pt)) (vector-! (-> self circular-follow) (-> self circular-follow) (-> self pivot-pt)) - (if (logtest? (-> self options) 4) + (if (logtest? (-> self options) (cam-slave-options-u32 MOVE_SPHERICAL)) (v-slrp3! (-> self circular-follow) (-> self circular-follow) @@ -1086,14 +1088,14 @@ (let ((v1-0 event-type)) (the-as object (cond ((= v1-0 'teleport) - #f + (the-as vector #f) ) ((= v1-0 'outro-done) (set! (-> self trans quad) (-> *camera-combiner* trans quad)) (cam-circular-position #f) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as vector (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -1168,7 +1170,7 @@ ) ) ) - ((logtest? (-> self options) 128) + ((logtest? (-> self options) (cam-slave-options-u32 DRAG)) (vector-! (-> self pivot-pt) (-> *camera* tpos-curr-adj) (-> self trans)) (vector-flatten! (-> self pivot-pt) (-> self pivot-pt) (-> *camera* local-down)) (set! (-> self pivot-rad) (vector-length (-> self pivot-pt))) @@ -1187,7 +1189,7 @@ ) (cam-circular-position #f) (cond - ((logtest? (-> self options) #x4000) + ((logtest? (-> self options) (cam-slave-options-u32 NO_ROTATE)) (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) (cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking))) @@ -1202,7 +1204,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -1233,7 +1235,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -1328,7 +1330,7 @@ ;; definition for function cam-string-set-position-rel! ;; INFO: Used lq/sq -;; WARN: Return type mismatch uint vs cam-slave-options. +;; WARN: Return type mismatch cam-slave-options-u32 vs cam-slave-options. (defbehavior cam-string-set-position-rel! camera-slave ((arg0 vector)) (vector-flatten! (-> self view-flat) arg0 (-> *camera* local-down)) (set! (-> self min-z-override) (vector-length (-> self view-flat))) @@ -1336,7 +1338,7 @@ (set! (-> self string-trans quad) (-> self desired-pos quad)) (tracking-spline-method-10 (-> self position-spline) (-> self desired-pos)) (vector-reset! (-> self velocity)) - (let ((v0-2 (logand -4097 (-> self options)))) + (let ((v0-2 (logclear (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)))) (set! (-> self options) v0-2) (the-as cam-slave-options v0-2) ) @@ -2043,7 +2045,7 @@ (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self good-point quad) (-> *camera* target-spline point (-> *camera* target-spline used-point) position quad) ) @@ -2124,7 +2126,7 @@ (set! (-> self los-tgt-spline-pt-incarnation) (-> *camera* target-spline point (-> self los-tgt-spline-pt) incarnation) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self good-point quad) (-> *camera* target-spline point s2-2 position quad)) (set! (-> self los-last-pos quad) (-> self good-point quad)) (when *debug-segment* @@ -2223,7 +2225,7 @@ (format 0 "going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) (format *stdcon* " going because u(~f) > 0 frame ~D~%" f30-2 (-> self clock frame-counter)) ) - (logior! (-> self options) 4096) + (logior! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) ) ) ) @@ -2245,7 +2247,7 @@ (cam-los-setup-lateral arg2 s4-1 arg1) ) (cond - ((not (logtest? (-> self options) 1024)) + ((not (logtest? (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED))) ) ((= (-> self string-vel-dir) 5) ) @@ -2294,7 +2296,7 @@ (defbehavior cam-string-follow camera-slave () (let ((f30-0 (vector-length (-> self view-flat)))) (cond - ((logtest? (-> self options) #x8000) + ((logtest? (-> self options) (cam-slave-options-u32 STICKY_ANGLE)) (let ((gp-0 (new 'stack-no-clear 'vector))) (let ((s5-0 (new 'stack-no-clear 'vector))) (vector-cross! s5-0 (-> self view-flat) (-> *camera* local-down)) @@ -2430,7 +2432,7 @@ ;; definition for function cam-string-joystick ;; INFO: Used lq/sq (defbehavior cam-string-joystick camera-slave () - (set! (-> self options) (logand -257 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (when (-> self string-relative) (let ((s5-0 (new 'stack-no-clear 'vector)) (gp-0 (new 'stack-no-clear 'vector)) @@ -2468,7 +2470,7 @@ ) (f30-1 (-> self view-off-param)) ) - (if (logtest? #x10000 (-> self options)) + (if (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) (set! f28-0 0.0) ) (if (-> self have-phony-joystick) @@ -2479,7 +2481,7 @@ ) (set! f28-0 0.05) ) - (when (logtest? #x40000 (-> self options)) + (when (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (if (and (or (< (-> *cpad-list* cpads 0 rightx) (the-as uint 64)) (< (the-as uint 192) (-> *cpad-list* cpads 0 rightx)) ) @@ -2491,7 +2493,7 @@ ) ) (if (!= f28-0 0.0) - (logior! (-> self options) 256) + (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) ) (let ((f26-0 (fmin 1.0 f0-22))) (let ((f0-23 f26-0)) @@ -2533,7 +2535,7 @@ (or (= (-> self los-state) (slave-los-state ccw)) (= (-> self los-state) (slave-los-state cw))) ) ) - ((and (logtest? #x40000 (-> self options)) (< 0.0 f28-0)) + ((and (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (< 0.0 f28-0)) (set! (-> self string-min-val y) (fmax (-> *camera* settings gun-min-height) (- (-> self string-min-val y) (* 24576.0 f28-0))) ) @@ -2544,7 +2546,7 @@ ) ) ) - ((and (logtest? #x40000 (-> self options)) (< f28-0 0.0)) + ((and (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (< f28-0 0.0)) (set! (-> self string-max-val y) (fmin (-> *camera* settings gun-max-height) (- (-> self string-max-val y) (* 24576.0 f28-0))) ) @@ -2555,7 +2557,7 @@ ) ) ) - ((logtest? #x40000 (-> self options)) + ((logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) (set! (-> self string-max-val y) (fmax (+ 8192.0 (-> *camera* settings gun-min-height)) @@ -2592,7 +2594,7 @@ ) ) (cond - ((logtest? #x40000 (-> self options)) + ((logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) ) ((= f28-0 0.0) (set! (-> self view-off z) (-> self string-max-val z)) @@ -2613,10 +2615,12 @@ 128.0 32.0 110.0 - (* 182.04445 (-> self clock seconds-per-frame) (if (logtest? #x40000 (-> self options)) - 120.0 - 120.0 - ) + (* 182.04445 + (-> self clock seconds-per-frame) + (if (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)) + 120.0 + 120.0 + ) ) ) ) @@ -2624,7 +2628,7 @@ (gp-3 (new-stack-vector0)) (s5-3 (new-stack-vector0)) ) - (if (logtest? #x10000 (-> self options)) + (if (logtest? (cam-slave-options-u32 BLOCK_RIGHT_STICK) (-> self options)) (set! f30-2 0.0) ) (if (-> *setting-control* user-default unknowng-symbol-00) @@ -2633,7 +2637,7 @@ (if (-> self have-phony-joystick) (set! f30-2 (* 21845.334 (-> self phony-joystick-x) (-> self clock seconds-per-frame))) ) - (when (logtest? #x20000 (-> self options)) + (when (logtest? (cam-slave-options-u32 ALLOW_SHIFT_BUTTONS) (-> self options)) (when (logtest? (-> *camera* settings master-options) (cam-master-options READ_BUTTONS)) (if (cpad-hold? (-> *CAMERA-bank* joypad) r1) (+! f30-2 (+ (* 10922.667 (-> self clock seconds-per-frame)) @@ -2684,27 +2688,28 @@ ) (cond ((!= f30-2 0.0) - (logior! (-> self options) 256) + (logior! (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (matrix-axis-angle! s4-0 (-> *camera* local-down) f30-2) (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) (set! (-> self butt-timer) (the-as uint 0)) (set! (-> self butt-seek) #f) - (when (logtest? #x800000 (-> self options)) + (when (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) ) - ((or (logtest? (-> self options) 1) (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) - (if (type? s3-0 process-drawable) - s3-0 - ) - ) + ((or (logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) + (let ((s3-0 (handle->process (-> *camera* settings butt-handle)))) + (if (type? s3-0 process-drawable) + s3-0 + ) + ) ) (vector-normalize-copy! gp-3 (-> self view-flat) 1.0) (let ((v1-283 (handle->process (-> *camera* settings butt-handle)))) (cond (v1-283 - (set! (-> self options) (logior #x800000 (-> self options))) + (set! (-> self options) (logior (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options))) (let* ((s3-1 (quaternion->matrix (new 'stack-no-clear 'matrix) (-> (the-as process-drawable v1-283) root quat))) (a2-18 (matrix-axis-angle! (new 'stack-no-clear 'matrix) @@ -2726,15 +2731,17 @@ ) ) (vector-normalize! s5-3 -1.0) - (when (and (logtest? #x800000 (-> self options)) (< (cos 910.2222) (vector-dot gp-3 s5-3))) + (when (and (logtest? (cam-slave-options-u32 HAVE_BUTT_HANDLE) (-> self options)) + (< (cos 910.2222) (vector-dot gp-3 s5-3)) + ) (kill-persister *setting-control* (the-as engine-pers 'butt-handle) 'butt-handle) - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) (matrix-from-two-vectors-max-angle! s4-0 gp-3 s5-3 546.13336) (vector-matrix*! (-> self view-flat) (-> self view-flat) s4-0) ) (else - (set! (-> self options) (logand -8388609 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 HAVE_BUTT_HANDLE)) ) ) (when (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) @@ -2891,7 +2898,7 @@ ) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> s5-1 start-pos quad) (-> self string-trans quad)) (let ((s2-0 s5-1)) (set! (-> s2-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -2935,13 +2942,13 @@ ) (cond ((zero? gp-1) - (set! (-> self options) (logand -1025 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED)) (if *display-cam-los-debug* (format *stdcon* "not blocked~%") ) ) (else - (logior! (-> self options) 1024) + (logior! (-> self options) (cam-slave-options-u32 MOVEMENT_BLOCKED)) (if *display-cam-los-debug* (format *stdcon* "blocked ~D ~f~%" gp-1 f30-2) ) @@ -2982,7 +2989,7 @@ (cam-debug-reset-coll-tri) ) (cam-string-follow) - (if (logtest? (-> self options) 512) + (if (logtest? (-> self options) (cam-slave-options-u32 LINE_OF_SIGHT)) (cam-string-line-of-sight) ) (if (not (paused?)) @@ -2998,18 +3005,18 @@ (vector+! (-> self desired-pos) (-> *camera* tpos-curr-adj) gp-0) ) (set! (-> self desired-pos y) (fmin (-> self desired-pos y) (-> *camera* settings string-camera-ceiling))) - (if (logtest? (-> self options) 64) + (if (logtest? (-> self options) (cam-slave-options-u32 FIND_HIDDEN_TARGET)) (cam-string-find-hidden) ) (cond - ((logtest? (-> self options) 4096) + ((logtest? (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (when *debug-segment* (let ((a1-1 (new 'stack-no-clear 'vector))) (vector-! a1-1 (-> self good-point) (-> self string-trans)) (cam-collision-record-save (-> self string-trans) a1-1 -2 'jump self) ) ) - (set! (-> self options) (logand -4097 (-> self options))) + (logclear! (-> self options) (cam-slave-options-u32 GOTO_GOOD_POINT)) (set! (-> self desired-pos quad) (-> self good-point quad)) (cam-string-move) (vector-! (-> self view-flat) (-> self string-trans) (-> *camera* tpos-curr-adj)) @@ -3042,14 +3049,14 @@ (tracking-spline-method-21 (-> self position-spline) (-> self trans) 4096.0 40960.0 0.1) ) ((and (logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) - (logtest? (-> self options) 256) + (logtest? (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) ) (tracking-spline-method-21 (-> self position-spline) (-> self trans) 102.4 4096.0 0.1) ) ((logtest? (-> *camera* settings slave-options) (cam-slave-options BIKE_MODE)) (tracking-spline-method-21 (-> self position-spline) (-> self trans) 40.96 4096.0 0.1) ) - ((logtest? (-> self options) 256) + ((logtest? (-> self options) (cam-slave-options-u32 PLAYER_MOVING_CAMERA)) (tracking-spline-method-21 (-> self position-spline) (-> self trans) @@ -3077,7 +3084,7 @@ ;; definition for function set-string-params ;; INFO: Used lq/sq (defbehavior set-string-params camera-slave () - (when (not (or (-> self string-val-locked) (logtest? #x40000 (-> self options)))) + (when (not (or (-> self string-val-locked) (logtest? (cam-slave-options-u32 GUN_CAM) (-> self options)))) (set! (-> self string-min-val quad) (-> *camera* string-min value quad)) (let ((v0-0 (-> self string-max-val))) (set! (-> v0-0 quad) (-> *camera* string-max value quad)) @@ -3089,7 +3096,7 @@ ;; failed to figure out what this is: (defstate cam-string (camera-slave) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none)) + (local-vars (v0-0 object)) (let ((v1-0 event-type)) (the-as object @@ -3097,7 +3104,7 @@ ((= v1-0 'get-behind) (set! (-> self butt-timer) (the-as uint (+ (-> self clock frame-counter) (seconds 0.25)))) (set! (-> self butt-seek) (the-as basic #t)) - (set! v0-0 (the-as none (-> self butt-vector))) + (set! v0-0 (-> self butt-vector)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) v0-0 ) @@ -3110,7 +3117,7 @@ ((= v1-0 'joystick) (set! (-> self phony-joystick-x) (the-as float (-> event param 0))) (set! (-> self phony-joystick-y) (the-as float (-> event param 1))) - (set! v0-0 (the-as none #t)) + (set! v0-0 #t) (set! (-> self have-phony-joystick) (the-as basic v0-0)) v0-0 ) @@ -3181,7 +3188,7 @@ ((-> event param 0) (set! (-> self string-val-locked) (the-as basic #t)) (set! (-> self string-relative) (the-as basic #t)) - (set! v0-0 (the-as none (-> self relative-position))) + (set! v0-0 (-> self relative-position)) (set! (-> (the-as vector v0-0) quad) (-> (the-as vector (-> event param 0)) quad)) v0-0 ) @@ -3199,7 +3206,7 @@ (-> self los-state) ) (else - (cam-standard-event-handler proc arg1 event-type event) + (the-as object (cam-standard-event-handler proc arg1 event-type event)) ) ) ) @@ -3247,7 +3254,7 @@ (vector-length (-> self view-flat)) ) (else - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (-> self view-off z) ) @@ -3362,7 +3369,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) @@ -3450,7 +3457,7 @@ (vector-float*! s5-0 (-> self velocity) f30-0) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> gp-2 start-pos quad) (-> self trans quad)) (let ((s1-0 gp-2)) (set! (-> s1-0 radius) (-> *CAMERA-bank* collide-move-rad)) @@ -3515,7 +3522,7 @@ ) ) ) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #t) (none) ) @@ -3536,7 +3543,7 @@ (lerp (-> *CAM_STICK-bank* min-z) (-> *CAM_STICK-bank* max-z) (-> self view-off-param)) ) (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) @@ -3545,12 +3552,12 @@ (vector-reset! (-> self velocity)) (set! (-> self blend-from-type) (the-as uint 2)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-2)) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (when (not (paused?)) @@ -3594,7 +3601,7 @@ (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-16) (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) ) - ((logtest? (-> self options) 1) + ((logtest? (-> self options) (cam-slave-options-u32 BUTT_CAM)) (set-vector! s5-0 0.0 0.0 1.0 1.0) (vector-normalize-copy! s5-0 (-> self view-flat) 1.0) (set! (-> s3-0 quad) (-> (the-as vector (&-> *camera* stack 256)) quad)) @@ -3734,7 +3741,7 @@ (vector-float*! s5-3 (-> self velocity) f30-1) (let ((f28-0 (cond - ((logtest? (-> self options) 32) + ((logtest? (-> self options) (cam-slave-options-u32 COLLIDE)) (set! (-> gp-3 start-pos quad) (-> self trans quad)) (let ((s3-2 gp-3)) (set! (-> s3-2 radius) 4096.0) @@ -3773,7 +3780,7 @@ ) ) (cam-calc-bike-follow! (-> self tracking) (-> self trans) #t) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #t) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #t) (none) ) @@ -3790,7 +3797,7 @@ (set! (-> self view-off x) 0.0) (set! (-> self view-off y) (-> *CAM_BIKE-bank* max-y)) (set! (-> self view-off z) (-> *CAM_BIKE-bank* max-z)) - (vector-flatten! (-> self view-flat) (the-as vector (&-> self stack 112)) (-> *camera* local-down)) + (vector-flatten! (-> self view-flat) (-> self tracking inv-mat vector 2) (-> *camera* local-down)) (vector-negate! (-> self view-flat) (-> self view-flat)) (vector-normalize! (-> self view-flat) (-> self view-off z)) (vector--float*! (-> self desired-pos) (-> self view-flat) (-> *camera* local-down) (-> self view-off y)) @@ -3800,7 +3807,7 @@ (set! (-> self blend-from-type) (the-as uint 0)) (set! (-> self blend-to-type) (camera-blend-to-type unknown-1)) (cam-calc-bike-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) (none) ) @@ -3810,7 +3817,7 @@ (none) ) :trans (behavior () - (if (not (logtest? (-> *camera* master-options) 1)) + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) (cam-slave-go cam-free-floating) ) (none) diff --git a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc index 177a313d5c..0730be5210 100644 --- a/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/camera-h_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition of type cam-index (deftype cam-index (structure) ((flags cam-index-options :offset-assert 0) (vec vector 2 :inline :offset-assert 16) @@ -13,6 +15,7 @@ ) ) +;; definition for method 3 of type cam-index (defmethod inspect cam-index ((obj cam-index)) (when (not obj) (set! obj obj) @@ -25,6 +28,7 @@ obj ) +;; definition of type tracking-point (deftype tracking-point (structure) ((position vector :inline :offset-assert 0) (direction vector :inline :offset-assert 16) @@ -37,6 +41,7 @@ :flag-assert #x90000002c ) +;; definition for method 3 of type tracking-point (defmethod inspect tracking-point ((obj tracking-point)) (when (not obj) (set! obj obj) @@ -52,6 +57,7 @@ obj ) +;; definition of type tracking-spline-sampler (deftype tracking-spline-sampler (structure) ((cur-pt int32 :offset-assert 0) (partial-pt float :offset-assert 4) @@ -61,6 +67,7 @@ :flag-assert #x900000008 ) +;; definition for method 3 of type tracking-spline-sampler (defmethod inspect tracking-spline-sampler ((obj tracking-spline-sampler)) (when (not obj) (set! obj obj) @@ -73,6 +80,7 @@ obj ) +;; definition of type tracking-spline (deftype tracking-spline (structure) ((point tracking-point 32 :inline :offset-assert 0) (summed-len float :offset-assert 1536) @@ -111,6 +119,7 @@ ) ) +;; definition for method 3 of type tracking-spline (defmethod inspect tracking-spline ((obj tracking-spline)) (when (not obj) (set! obj obj) @@ -135,6 +144,7 @@ obj ) +;; definition of type cam-float-seeker (deftype cam-float-seeker (structure) ((target float :offset-assert 0) (value float :offset-assert 4) @@ -155,6 +165,7 @@ ) ) +;; definition for method 3 of type cam-float-seeker (defmethod inspect cam-float-seeker ((obj cam-float-seeker)) (when (not obj) (set! obj obj) @@ -171,6 +182,8 @@ obj ) +;; definition for method 9 of type cam-float-seeker +;; WARN: Return type mismatch int vs none. (defmethod init cam-float-seeker ((obj cam-float-seeker) (arg0 float) (arg1 float) (arg2 float) (arg3 float)) (set! (-> obj target) arg0) (set! (-> obj value) arg0) @@ -182,6 +195,8 @@ (none) ) +;; definition for method 10 of type cam-float-seeker +;; WARN: Return type mismatch int vs none. (defmethod copy-to cam-float-seeker ((obj cam-float-seeker) (arg0 cam-float-seeker)) (set! (-> obj target) (-> arg0 target)) (set! (-> obj value) (-> arg0 value)) @@ -193,6 +208,8 @@ (none) ) +;; definition for method 11 of type cam-float-seeker +;; WARN: Return type mismatch int vs none. (defmethod update! cam-float-seeker ((obj cam-float-seeker) (arg0 float)) (with-pp 0.0 @@ -219,12 +236,14 @@ ) ) +;; definition for method 12 of type cam-float-seeker (defmethod jump-to-target! cam-float-seeker ((obj cam-float-seeker) (arg0 float)) (set! (-> obj value) (+ (-> obj target) arg0)) (set! (-> obj vel) 0.0) 0.0 ) +;; definition of type cam-vector-seeker (deftype cam-vector-seeker (structure) ((target vector :inline :offset-assert 0) (value vector :inline :offset-assert 16) @@ -242,6 +261,7 @@ ) ) +;; definition for method 3 of type cam-vector-seeker (defmethod inspect cam-vector-seeker ((obj cam-vector-seeker)) (when (not obj) (set! obj obj) @@ -258,6 +278,9 @@ obj ) +;; definition for method 9 of type cam-vector-seeker +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. (defmethod init cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector) (arg1 float) (arg2 float) (arg3 float)) (cond (arg0 @@ -277,6 +300,8 @@ (none) ) +;; definition for method 10 of type cam-vector-seeker +;; WARN: Return type mismatch int vs none. (defmethod update! cam-vector-seeker ((obj cam-vector-seeker) (arg0 vector)) (with-pp (let ((v1-0 (new 'stack-no-clear 'vector))) @@ -309,6 +334,7 @@ ) ) +;; definition of type cam-rotation-tracker (deftype cam-rotation-tracker (structure) ((inv-mat matrix :inline :offset-assert 0) (no-follow basic :offset-assert 64) @@ -328,6 +354,7 @@ :flag-assert #x900000108 ) +;; definition for method 3 of type cam-rotation-tracker (defmethod inspect cam-rotation-tracker ((obj cam-rotation-tracker)) (when (not obj) (set! obj obj) @@ -350,6 +377,7 @@ obj ) +;; definition of type camera-combiner (deftype camera-combiner (process) ((trans vector :inline :offset-assert 128) (inv-camera-rot matrix :inline :offset-assert 144) @@ -371,6 +399,7 @@ :flag-assert #xe01b0022c ) +;; definition for method 3 of type camera-combiner (defmethod inspect camera-combiner ((obj camera-combiner)) (when (not obj) (set! obj obj) @@ -396,62 +425,63 @@ obj ) +;; definition of type camera-slave (deftype camera-slave (process) - ((trans vector :inline :offset-assert 128) - (fov float :offset-assert 144) - (fov0 float :offset-assert 148) - (fov1 float :offset-assert 152) - (fov-index cam-index :inline :offset-assert 160) - (tracking cam-rotation-tracker :inline :offset-assert 208) - (view-off-param float :offset-assert 472) - (view-off vector :inline :offset-assert 480) - (joystick-saved-view-off vector :inline :offset-assert 496) - (min-z-override float :offset-assert 512) - (view-flat vector :inline :offset-assert 528) - (string-vel-dir uint32 :offset-assert 544) - (string-trans vector :inline :offset-assert 560) - (position-spline tracking-spline :inline :offset-assert 576) - (pivot-pt vector :inline :offset-assert 2224) - (pivot-rad float :offset-assert 2240) - (circular-follow vector :inline :offset-assert 2256) - (max-angle-offset float :offset-assert 2272) - (max-angle-curr float :offset-assert 2276) - (options uint32 :offset-assert 2280) - (cam-entity entity :offset-assert 2284) - (butt-timer uint64 :offset-assert 2288) - (butt-seek basic :offset-assert 2296) - (butt-vector vector :inline :offset-assert 2304) - (velocity vector :inline :offset-assert 2320) - (desired-pos vector :inline :offset-assert 2336) - (time-dist-too-far uint32 :offset-assert 2352) - (los-state slave-los-state :offset-assert 2356) - (good-point vector :inline :offset-assert 2368) - (los-tgt-spline-pt int32 :offset-assert 2384) - (los-tgt-spline-pt-incarnation int32 :offset-assert 2388) - (los-last-pos vector :inline :offset-assert 2400) - (intro-curve curve :inline :offset-assert 2416) - (intro-offset vector :inline :offset-assert 2448) - (intro-t float :offset-assert 2464) - (intro-t-step float :offset-assert 2468) - (outro-exit-value float :offset-assert 2472) - (spline-exists basic :offset-assert 2476) - (spline-curve curve :inline :offset-assert 2480) - (spline-offset vector :inline :offset-assert 2512) - (index cam-index :inline :offset-assert 2528) - (saved-pt vector :inline :offset-assert 2576) - (spline-tt float :offset-assert 2592) - (spline-follow-dist float :offset-assert 2596) - (enter-has-run symbol :offset-assert 2600) - (blend-from-type uint64 :offset-assert 2608) - (blend-to-type camera-blend-to-type :offset-assert 2616) - (have-phony-joystick basic :offset-assert 2624) - (phony-joystick-x float :offset-assert 2628) - (phony-joystick-y float :offset-assert 2632) - (string-min-val vector :inline :offset-assert 2640) - (string-max-val vector :inline :offset-assert 2656) - (string-val-locked basic :offset-assert 2672) - (relative-position vector :inline :offset-assert 2688) - (string-relative basic :offset-assert 2704) + ((trans vector :inline :offset-assert 128) + (fov float :offset-assert 144) + (fov0 float :offset-assert 148) + (fov1 float :offset-assert 152) + (fov-index cam-index :inline :offset-assert 160) + (tracking cam-rotation-tracker :inline :offset-assert 208) + (view-off-param float :offset-assert 472) + (view-off vector :inline :offset-assert 480) + (joystick-saved-view-off vector :inline :offset-assert 496) + (min-z-override float :offset-assert 512) + (view-flat vector :inline :offset-assert 528) + (string-vel-dir uint32 :offset-assert 544) + (string-trans vector :inline :offset-assert 560) + (position-spline tracking-spline :inline :offset-assert 576) + (pivot-pt vector :inline :offset-assert 2224) + (pivot-rad float :offset-assert 2240) + (circular-follow vector :inline :offset-assert 2256) + (max-angle-offset float :offset-assert 2272) + (max-angle-curr float :offset-assert 2276) + (options cam-slave-options-u32 :offset-assert 2280) + (cam-entity entity :offset-assert 2284) + (butt-timer uint64 :offset-assert 2288) + (butt-seek basic :offset-assert 2296) + (butt-vector vector :inline :offset-assert 2304) + (velocity vector :inline :offset-assert 2320) + (desired-pos vector :inline :offset-assert 2336) + (time-dist-too-far uint32 :offset-assert 2352) + (los-state slave-los-state :offset-assert 2356) + (good-point vector :inline :offset-assert 2368) + (los-tgt-spline-pt int32 :offset-assert 2384) + (los-tgt-spline-pt-incarnation int32 :offset-assert 2388) + (los-last-pos vector :inline :offset-assert 2400) + (intro-curve curve :inline :offset-assert 2416) + (intro-offset vector :inline :offset-assert 2448) + (intro-t float :offset-assert 2464) + (intro-t-step float :offset-assert 2468) + (outro-exit-value float :offset-assert 2472) + (spline-exists basic :offset-assert 2476) + (spline-curve curve :inline :offset-assert 2480) + (spline-offset vector :inline :offset-assert 2512) + (index cam-index :inline :offset-assert 2528) + (saved-pt vector :inline :offset-assert 2576) + (spline-tt float :offset-assert 2592) + (spline-follow-dist float :offset-assert 2596) + (enter-has-run symbol :offset-assert 2600) + (blend-from-type uint64 :offset-assert 2608) + (blend-to-type camera-blend-to-type :offset-assert 2616) + (have-phony-joystick basic :offset-assert 2624) + (phony-joystick-x float :offset-assert 2628) + (phony-joystick-y float :offset-assert 2632) + (string-min-val vector :inline :offset-assert 2640) + (string-max-val vector :inline :offset-assert 2656) + (string-val-locked basic :offset-assert 2672) + (relative-position vector :inline :offset-assert 2688) + (string-relative basic :offset-assert 2704) ) :heap-base #xa20 :method-count-assert 14 @@ -482,6 +512,7 @@ ) ) +;; definition for method 3 of type camera-slave (defmethod inspect camera-slave ((obj camera-slave)) (when (not obj) (set! obj obj) @@ -549,8 +580,9 @@ obj ) +;; definition of type camera-master (deftype camera-master (process) - ((master-options uint32 :offset-assert 128) + ((master-options cam-master-options-u32 :offset-assert 128) (settings cam-setting-data :offset-assert 132) (slave (pointer camera-slave) :offset-assert 136) (decel (pointer camera-slave) :offset-assert 140) @@ -601,6 +633,7 @@ ) ) +;; definition for method 3 of type camera-master (defmethod inspect camera-master ((obj camera-master)) (when (not obj) (set! obj obj) @@ -652,4 +685,5 @@ obj ) +;; failed to figure out what this is: 0 diff --git a/test/decompiler/reference/jak2/engine/camera/camera_REF.gc b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc index dcddaf28a1..33859fcf81 100644 --- a/test/decompiler/reference/jak2/engine/camera/camera_REF.gc +++ b/test/decompiler/reference/jak2/engine/camera/camera_REF.gc @@ -956,10 +956,10 @@ (defbehavior cam-slave-init-vars camera-slave () (cond (*camera* - (set! (-> self options) (-> *camera* slave-options)) + (set! (-> self options) (the-as cam-slave-options-u32 (-> *camera* slave-options))) ) (else - (set! (-> self options) (the-as uint 0)) + (set! (-> self options) (cam-slave-options-u32)) 0 ) ) @@ -1082,7 +1082,7 @@ (('teleport) (jump-to-target! (-> self tracking point-of-interest-blend) 0.0) (cam-calc-follow! (-> self tracking) (-> self trans) #f) - (slave-set-rotation! (-> self tracking) (-> self trans) (the-as float (-> self options)) (-> self fov) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) ) ) (none) @@ -1133,7 +1133,7 @@ ) ) ) - (if (logtest? #x200000 (-> self options)) + (if (logtest? (cam-slave-options-u32 EASE_SPLINE_IDX) (-> self options)) (set! f0-18 (parameter-ease-sin-clamp f0-18)) ) (curve-get-pos! s5-0 f0-18 (-> self spline-curve)) @@ -1401,7 +1401,7 @@ ;; definition for function slave-matrix-blend-2 ;; INFO: Used lq/sq -(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 float) (arg2 vector) (arg3 matrix)) +(defun slave-matrix-blend-2 ((arg0 matrix) (arg1 cam-slave-options-u32) (arg2 vector) (arg3 matrix)) (with-pp (let ((s1-0 (new-stack-vector0)) (s4-0 (new-stack-quaternion0)) @@ -1411,7 +1411,7 @@ ) 0.0 (let* ((f0-1 (cond - ((logtest? (the-as int arg1) 4) + ((logtest? arg1 (cam-slave-options-u32 MOVE_SPHERICAL)) (vector-length arg2) ) (else @@ -1597,7 +1597,7 @@ ;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3] ;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4] ;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5] -(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 float) (arg3 float) (arg4 symbol)) +(defun slave-set-rotation! ((arg0 cam-rotation-tracker) (arg1 vector) (arg2 cam-slave-options-u32) (arg3 float) (arg4 symbol)) (local-vars (f0-9 float) (sv-208 vector) diff --git a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc index 76650cfb4d..2420434db5 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/base-plat_REF.gc @@ -163,12 +163,12 @@ (defbehavior plat-event base-plat ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) "Handles platform related events. Presently all this does is: - if `event-type` is [['bonk]], then call [[base-plat:29]]" - (let ((evt-type event-type)) - (the-as object (if (= evt-type 'bonk) - (start-bouncing! self) - ) - ) - ) + (the-as object (case event-type + (('bonk) + (start-bouncing! self) + ) + ) + ) ) ;; definition of type eco-door @@ -234,23 +234,23 @@ and play the respective sound @unused - likely a leftover from Jak 1" - (let ((evt-type event-type)) - (the-as object (when (= evt-type '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") - ) + (the-as object (case event-type + (('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") + ) ) - #t - ) - ) - ) + (else + (sound-play "door-unlock") + ) + ) + #t + ) + ) + ) ) ;; failed to figure out what this is: diff --git a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc index 19560fa7d7..a173914899 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/basebutton_REF.gc @@ -99,37 +99,37 @@ (defstate up-idle (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'attack) - (let ((attack (the-as attack-info (-> event param 1)))) - (case (-> attack mode) - (('flop 'spin 'punch 'eco-yellow 'eco-red 'eco-blue 'eco-dark) - (when (or (not (or (= (-> attack mode) 'spin) (= (-> attack mode) 'punch))) - (logtest? (-> self button-status) (button-status button-status-3)) - ) - (send-event! self (-> self event-going-down)) - (go-virtual going-down) - ) - ) - ) - ) + (the-as + object + (case event-type + (('attack) + (let ((attack (the-as attack-info (-> event param 1)))) + (case (-> attack mode) + (('flop 'spin 'punch 'eco-yellow 'eco-red 'eco-blue 'eco-dark) + (when (or (not (or (= (-> attack mode) 'spin) (= (-> attack mode) 'punch))) + (logtest? (-> self button-status) (button-status button-status-3)) ) - ((= v1-0 'trigger) - (sound-play "silo-button") - (go-virtual going-down) - ) - ((= v1-0 'touch) - (when (logtest? (-> self button-status) (button-status button-status-4)) - (send-event! self (-> self event-going-down)) - (go-virtual going-down) - ) - ) - ((= v1-0 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) + (send-event! self (-> self event-going-down)) + (go-virtual going-down) + ) ) + ) + ) + ) + (('trigger) + (sound-play "silo-button") + (go-virtual going-down) + ) + (('touch) + (when (logtest? (-> self button-status) (button-status button-status-4)) + (send-event! self (-> self event-going-down)) + (go-virtual going-down) + ) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -158,16 +158,16 @@ (defstate going-down (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'untrigger) - (go-virtual going-up) - ) - ((= evt-type 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) - ) + (the-as + object + (case event-type + (('untrigger) + (go-virtual going-up) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -208,16 +208,16 @@ (defstate down-idle (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'untrigger) - (go-virtual going-up) - ) - ((= evt-type 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ) - ) + (the-as + object + (case event-type + (('untrigger) + (go-virtual going-up) + ) + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + ) ) ) :enter (behavior () @@ -262,16 +262,16 @@ (defstate going-up (basebutton) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'move-to) - (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1))) - ) - ((= v1-0 'trigger) - (go-virtual going-down) - ) - ) - ) + (the-as + object + (case event-type + (('move-to) + (the-as object (move-to! self (the-as vector (-> event param 0)) (the-as quaternion (-> event param 1)))) + ) + (('trigger) + (go-virtual going-down) + ) + ) ) ) :enter (behavior () diff --git a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc index 3eea8f98eb..a4aa46df53 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/blocking-plane_REF.gc @@ -39,61 +39,59 @@ (defstate idle (blocking-plane) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as object (cond - ((= evt-type 'on) - (cond - ((nonzero? (-> self root-override)) - (let ((prim (-> self root-override root-prim))) - (set! (-> prim prim-core collide-as) (-> self root-override backup-collide-as)) - (let ((v0-0 (the-as int (-> self root-override backup-collide-with)))) - (set! (-> prim prim-core collide-with) (the-as collide-spec v0-0)) - v0-0 - ) + (the-as object (case event-type + (('on) + (cond + ((nonzero? (-> self root-override)) + (let ((prim (-> self root-override root-prim))) + (set! (-> prim prim-core collide-as) (-> self root-override backup-collide-as)) + (let ((v0-0 (the-as int (-> self root-override backup-collide-with)))) + (set! (-> prim prim-core collide-with) (the-as collide-spec v0-0)) + v0-0 ) ) - (else - (let ((proc-child-ptr-0 (-> self child))) - (while proc-child-ptr-0 - (let ((proc-child-0 (ppointer->process proc-child-ptr-0))) - (set! proc-child-ptr-0 (-> proc-child-ptr-0 0 brother)) - (if (type? proc-child-0 blocking-plane) - (send-event proc-child-0 'on) - ) - ) + ) + (else + (let ((proc-child-ptr-0 (-> self child))) + (while proc-child-ptr-0 + (let ((proc-child-0 (ppointer->process proc-child-ptr-0))) + (set! proc-child-ptr-0 (-> proc-child-ptr-0 0 brother)) + (if (type? proc-child-0 blocking-plane) + (send-event proc-child-0 'on) + ) ) ) - (the-as int #f) ) + (the-as int #f) ) ) - ((= evt-type 'off) - (cond - ((nonzero? (-> self root-override)) - (let ((v1-13 (-> self root-override root-prim))) - (set! (-> v1-13 prim-core collide-as) (collide-spec)) - (set! (-> v1-13 prim-core collide-with) (collide-spec)) - ) - 0 + ) + (('off) + (cond + ((nonzero? (-> self root-override)) + (let ((v1-13 (-> self root-override root-prim))) + (set! (-> v1-13 prim-core collide-as) (collide-spec)) + (set! (-> v1-13 prim-core collide-with) (collide-spec)) ) - (else - (let ((proc-child-ptr-1 (-> self child))) - (while proc-child-ptr-1 - (let ((proc-child-1 (ppointer->process proc-child-ptr-1))) - (set! proc-child-ptr-1 (-> proc-child-ptr-1 0 brother)) - (if (type? proc-child-1 blocking-plane) - (send-event proc-child-1 'off) - ) - ) + 0 + ) + (else + (let ((proc-child-ptr-1 (-> self child))) + (while proc-child-ptr-1 + (let ((proc-child-1 (ppointer->process proc-child-ptr-1))) + (set! proc-child-ptr-1 (-> proc-child-ptr-1 0 brother)) + (if (type? proc-child-1 blocking-plane) + (send-event proc-child-1 'off) + ) ) ) - (the-as int #f) ) + (the-as int #f) ) ) - ) - ) - ) + ) + ) + ) ) :code (the-as (function none :behavior blocking-plane) sleep-code) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc index 050dcce7a0..e4de4f0955 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/crates_REF.gc @@ -762,17 +762,15 @@ (defstate fall (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'carry-info) - (-> self carry) - ) - ((or (= v1-0 'carry?) (= v1-0 'pickup)) - (the-as carry-info #f) - ) - ) - ) - ) + (the-as object (case event-type + (('carry-info) + (-> self carry) + ) + (('carry? 'pickup) + (the-as carry-info #f) + ) + ) + ) ) :enter (behavior () (if (handle->process (-> self carry other)) @@ -1169,32 +1167,32 @@ (defstate special-contents-die (crate) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'notify) - (case (-> event param 0) - (('pickup) - (let ((gp-0 (-> self entity extra perm))) - (logior! (-> gp-0 status) (entity-perm-status bit-5)) - (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) - (+! (-> self child-count) -1) - (when (<= (-> self child-count) 0) - (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) - (process-entity-status! self (entity-perm-status bit-4) #f) - ) - (process-entity-status! self (entity-perm-status dead) #t) - (process-entity-status! self (entity-perm-status subtask-complete) #t) - (set! (-> gp-0 user-int8 0) 2) - (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) - (set! (-> self mask) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('notify) + (case (-> event param 0) + (('pickup) + (let ((gp-0 (-> self entity extra perm))) + (logior! (-> gp-0 status) (entity-perm-status bit-5)) + (set! (-> gp-0 user-int8 1) (min 127 (+ (-> gp-0 user-int8 1) 1))) + (+! (-> self child-count) -1) + (when (<= (-> self child-count) 0) + (if (or (= (-> self defense) 'iron) (= (-> self defense) 'steel)) + (process-entity-status! self (entity-perm-status bit-4) #f) + ) + (process-entity-status! self (entity-perm-status dead) #t) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> gp-0 user-int8 0) 2) + (let ((v0-0 (logclear (-> self mask) (process-mask sleep)))) + (set! (-> self mask) v0-0) + v0-0 + ) + ) + ) ) - ) - ) - ) + ) + ) + ) + ) ) :trans (-> (method-of-type crate die) trans) :code (behavior () diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc index f068cdf4b6..aa35c3e25f 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs-h_REF.gc @@ -3,7 +3,8 @@ ;; definition of type manipy (deftype manipy (process-drawable) - ((new-trans-hook (function none) :offset-assert 200) + ((root-override collide-shape :offset 128) + (new-trans-hook (function none) :offset-assert 200) (cur-trans-hook (function none) :offset-assert 204) (cur-event-hook (function none) :offset-assert 208) (new-joint-anim art-joint-anim :offset-assert 212) @@ -30,7 +31,7 @@ :size-assert #x174 :flag-assert #x1501000174 (:methods - (manipy-method-20 () none 20) + (idle () _type_ :state 20) ) ) @@ -83,8 +84,8 @@ :size-assert #xb0 :flag-assert #x10003000b0 (:methods - (part-spawner-method-14 () none 14) - (part-spawner-method-15 () none 15) + (active () _type_ :state 14) + (is-in-view? (_type_) symbol 15) ) ) @@ -131,8 +132,8 @@ :size-assert #x168 :flag-assert #x1000f00168 (:methods - (part-tracker-method-14 () none 14) - (part-tracker-method-15 () none 15) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) ) ) @@ -168,14 +169,14 @@ (deftype lightning-tracker (process) ((ppointer-override (pointer lightning-tracker) :offset 28) (root trsqv :offset-assert 128) - (lightning lightning-spec :offset-assert 132) + (lightning lightning-control :offset-assert 132) (callback (function lightning-tracker none) :offset-assert 136) (duration uint64 :offset-assert 144) (start-time time-frame :offset-assert 152) (offset0 vector :inline :offset-assert 160) (offset1 vector :inline :offset-assert 176) - (target0 uint64 :offset-assert 192) - (target1 uint64 :offset-assert 200) + (target0 handle :offset-assert 192) + (target1 handle :offset-assert 200) (target-joint0 int32 :offset-assert 208) (target-joint1 int32 :offset-assert 212) (sound uint32 :offset-assert 216) @@ -189,9 +190,9 @@ :size-assert #x130 :flag-assert #x1100b00130 (:methods - (lightning-tracker-method-14 () none 14) - (lightning-tracker-method-15 () none 15) - (lightning-tracker-method-16 () none 16) + (active () _type_ :state 14) + (notify-parent-of-death (_type_) none 15) + (update (_type_) none 16) ) ) @@ -226,19 +227,20 @@ ;; definition of type touch-tracker (deftype touch-tracker (process-drawable) - ((duration time-frame :offset-assert 200) - (target handle :offset-assert 208) - (event symbol :offset-assert 216) - (run-function (function object) :offset-assert 220) - (callback (function touch-tracker none) :offset-assert 224) - (event-mode basic :offset-assert 228) + ((root-override collide-shape :offset 128) + (duration time-frame :offset-assert 200) + (target handle :offset-assert 208) + (event symbol :offset-assert 216) + (run-function (function object) :offset-assert 220) + (callback (function touch-tracker none) :offset-assert 224) + (event-mode basic :offset-assert 228) ) :heap-base #x70 :method-count-assert 21 :size-assert #xe8 :flag-assert #x15007000e8 (:methods - (touch-tracker-method-20 () none 20) + (active () _type_ :state 20) ) ) @@ -263,21 +265,22 @@ ;; definition of type swingpole (deftype swingpole (process-drawable) - ((edge-length meters :offset-assert 200) - (path-pos float :offset-assert 204) - (joint-track int32 :offset-assert 208) - (speed meters :offset-assert 212) - (dir vector :inline :offset-assert 224) - (sync sync-eased :inline :offset-assert 240) + ((root-override collide-shape :offset 128) + (edge-length meters :offset-assert 200) + (path-pos float :offset-assert 204) + (joint-track int32 :offset-assert 208) + (speed meters :offset-assert 212) + (dir vector :inline :offset-assert 224) + (sync sync-eased :inline :offset-assert 240) ) :heap-base #xa0 :method-count-assert 23 :size-assert #x11c :flag-assert #x1700a0011c (:methods - (swingpole-method-20 () none 20) - (swingpole-method-21 () none 21) - (swingpole-method-22 () none 22) + (idle () _type_ :state 20) + (active (handle) _type_ :state 21) + (move-along-path (_type_) none 22) ) ) @@ -385,19 +388,20 @@ ;; definition of type explosion (deftype explosion (process-drawable) - ((start-time time-frame :offset-assert 200) - (duration uint32 :offset-assert 208) - (linger-duration uint32 :offset-assert 212) - (attack-id uint32 :offset-assert 216) + ((root-override collide-shape :offset 128) + (start-time time-frame :offset-assert 200) + (duration uint32 :offset-assert 208) + (linger-duration uint32 :offset-assert 212) + (attack-id uint32 :offset-assert 216) ) :heap-base #x60 :method-count-assert 23 :size-assert #xdc :flag-assert #x17006000dc (:methods - (explosion-method-20 () none 20) - (explosion-method-21 () none 21) - (explosion-method-22 () none 22) + (explode () _type_ :state 20) + (setup-explosion-collision (_type_) none 21) + (explosion-method-22 (_type_) none 22) ) ) @@ -420,12 +424,12 @@ ;; definition of type explosion-init-params (deftype explosion-init-params (structure) - ((spawn-point vector :inline :offset-assert 0) - (spawn-quat quaternion :inline :offset-assert 16) - (radius float :offset-assert 32) - (group basic :offset-assert 36) - (collide-with collide-spec :offset-assert 40) - (penetrate-using penetrate :offset-assert 48) + ((spawn-point vector :inline :offset-assert 0) + (spawn-quat quaternion :inline :offset-assert 16) + (radius float :offset-assert 32) + (group sparticle-launch-group :offset-assert 36) + (collide-with collide-spec :offset-assert 40) + (penetrate-using penetrate :offset-assert 48) ) :method-count-assert 9 :size-assert #x38 @@ -456,7 +460,7 @@ :size-assert #x80 :flag-assert #xf00000080 (:methods - (process-hidden-method-14 () none 14) + (die () _type_ :state 14) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc new file mode 100644 index 0000000000..3c649ea692 --- /dev/null +++ b/test/decompiler/reference/jak2/engine/common_objs/generic-obs_REF.gc @@ -0,0 +1,3317 @@ +;;-*-Lisp-*- +(in-package goal) + +;; failed to figure out what this is: +(defskelgroup skel-spotlight spotlight 0 -1 + ((1 (meters 999999))) + :bounds (static-spherem 0 0 0 10) + :origin-joint-index 5 + ) + +;; definition for function entity-lookup-part-group +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defun entity-lookup-part-group ((arg0 entity-actor) (arg1 (pointer string)) (arg2 symbol)) + (local-vars (sv-16 res-tag)) + (let ((gp-0 (the-as object #f))) + (set! sv-16 (new 'static 'res-tag)) + (let ((s4-0 (res-lump-data arg0 arg2 pointer :tag-ptr (& sv-16)))) + (if (not s4-0) + (go process-drawable-art-error (the-as string #f)) + ) + (let ((s3-0 (the-as object (-> (the-as (pointer uint32) s4-0))))) + (cond + ((part-group-pointer? (the-as pointer s3-0)) + (set! gp-0 (-> (the-as (pointer uint32) s4-0))) + ) + ((= (-> (the-as basic s3-0) type) string) + (if arg1 + (set! (-> arg1 0) (the-as string s3-0)) + ) + (set! gp-0 (lookup-part-group-pointer-by-name (the-as string s3-0))) + (if (the-as (pointer object) gp-0) + (set! (-> (the-as (pointer int32) s4-0)) (the-as (pointer object) gp-0)) + ) + ) + (else + (go process-drawable-art-error (the-as string s3-0)) + ) + ) + ) + ) + ) + (none) + ) + +;; definition for function clone-anim-once +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defbehavior clone-anim-once process-drawable ((arg0 handle) (arg1 symbol) (arg2 string)) + (logclear! (-> self skel status) (joint-control-status valid-spooled-frame)) + (let ((gp-0 (handle->process arg0))) + (if gp-0 + (joint-control-copy! (-> self skel) (-> (the-as process-drawable gp-0) skel)) + ) + (cond + ((and (the-as process-drawable gp-0) (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> (the-as process-drawable gp-0) draw art-group) + '() + 0 + arg2 + ) + ) + (when arg1 + (let* ((s5-1 (-> self root)) + (a0-7 (if (type? s5-1 collide-shape) + (the-as collide-shape s5-1) + ) + ) + ) + (if a0-7 + (move-to-point! a0-7 (-> (the-as process-drawable gp-0) root trans)) + (set! (-> self root trans quad) (-> (the-as process-drawable gp-0) root trans quad)) + ) + ) + (quaternion-copy! (-> self root quat) (-> (the-as process-drawable gp-0) root quat)) + ) + (if (logtest? (-> (the-as process-drawable gp-0) skel status) (joint-control-status valid-spooled-frame)) + (logior! (-> self skel status) (joint-control-status valid-spooled-frame)) + ) + (logclear! (-> self draw status) (draw-control-status no-draw no-draw-temp uninited)) + (if (or (zero? (-> self skel active-channels)) (not (-> self skel root-channel 0 frame-group))) + (logior! (-> self draw status) (draw-control-status no-draw-temp)) + ) + (let* ((gp-1 self) + (v1-38 (if (type? gp-1 manipy) + gp-1 + ) + ) + ) + (if (and v1-38 (not (-> (the-as manipy v1-38) draw?))) + (logior! (-> self draw status) (draw-control-status no-draw-temp)) + ) + ) + (update-anim-data (-> self skel)) + (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) + (let ((a0-22 (-> self skel effect))) + (if a0-22 + (effect-control-method-9 a0-22) + ) + ) + (if (logtest? (-> self skel status) (joint-control-status blend-shape blend-shape-valid)) + (merc-blend-shape self) + ) + (if (logtest? (-> self skel status) (joint-control-status eye-anim-valid eye-anim)) + (merc-eye-anim self) + ) + ) + (else + (set! (-> self skel active-channels) (the-as uint 0)) + (logior! (-> self draw status) (draw-control-status no-draw)) + (ja-post) + ) + ) + ) + 0 + (none) + ) + +;; definition for function clone-anim +;; WARN: Return type mismatch int vs none. +(defbehavior clone-anim process-drawable ((arg0 handle) (arg1 symbol) (arg2 string)) + (ja-post) + (while (handle->process arg0) + (clone-anim-once arg0 #t arg2) + (suspend) + ) + (logclear! (-> self skel status) (joint-control-status valid-spooled-frame)) + 0 + (none) + ) + +;; definition for method 22 of type swingpole +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod move-along-path swingpole ((obj swingpole)) + (with-pp + (if (nonzero? (-> obj draw)) + (ja-post) + ) + (cond + ((nonzero? (-> obj path)) + (set! (-> obj path-pos) (get-norm! (-> obj sync) 0)) + (let ((s5-0 (new 'stack-no-clear 'vector))) + (get-point-at-percent-along-path! (-> obj path) s5-0 (-> obj path-pos) 'interp) + (set! (-> obj speed) + (* (vector-vector-distance s5-0 (-> obj root-override trans)) (-> pp clock frames-per-second)) + ) + (move-to-point! (-> obj root-override) s5-0) + ) + ) + ((>= (-> obj joint-track) 0) + (let ((v1-15 (ppointer->process (-> obj parent))) + (s5-1 (new 'stack-no-clear 'vector)) + ) + (let ((s4-0 (-> (the-as process-drawable v1-15) node-list data (-> obj joint-track)))) + (vector<-cspace! s5-1 s4-0) + (vector-normalize-copy! (-> obj dir) (the-as vector (-> s4-0 bone transform)) 1.0) + ) + (move-to-point! (-> obj root-override) s5-1) + ) + ) + ) + (when (nonzero? (-> obj sound)) + (set! (-> obj sound trans quad) (-> obj root-override trans quad)) + (let ((f30-0 (lerp-scale -0.1 -0.05 (-> obj speed) 8192.0 20480.0)) + (f0-6 (lerp-scale 0.7 1.0 (-> obj speed) 8192.0 20480.0)) + ) + (set! (-> obj sound pitch) (the int (* 1524.0 f30-0))) + (set! (-> obj sound volume) (the int (* 1024.0 f0-6))) + ) + (update! (-> obj sound)) + ) + 0 + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (swingpole) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('touch 'attack) + (if (send-event proc 'pole-grab (-> event param 0)) + (go-virtual active (process->handle proc)) + ) + #f + ) + ) + ) + ) + :code (behavior () + (if (nonzero? (-> self draw)) + (ja-post) + ) + (update-transforms (-> self root-override)) + (cond + ((or (nonzero? (-> self path)) (>= (-> self joint-track) 0)) + (until #f + (move-along-path self) + (suspend) + ) + #f + ) + (else + (logior! (-> self mask) (process-mask sleep)) + (suspend) + 0 + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate active (swingpole) + :virtual #t + :code (behavior ((arg0 handle)) + (move-along-path self) + (suspend) + (while (let* ((s5-0 (handle->process arg0)) + (a0-7 (if (type? s5-0 process-focusable) + s5-0 + ) + ) + ) + (and a0-7 (logtest? (-> (the-as process-focusable a0-7) focus-status) (focus-status pole))) + ) + (move-along-path self) + (suspend) + ) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (seconds 0.5)) + (move-along-path self) + (suspend) + ) + ) + (go-virtual idle) + (none) + ) + ) + +;; definition for method 11 of type swingpole +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! swingpole ((obj swingpole) (arg0 entity-actor)) + "Copy defaults from the entity." + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((v1-5 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-5 prim-core collide-as) (collide-spec collectable)) + (set! (-> v1-5 prim-core collide-with) (collide-spec jak player-list tobot)) + (set-vector! (-> v1-5 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-5) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-8 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-8 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-8 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) + ) + (set! (-> obj root-override trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root-override quat) (-> arg0 quat)) + (vector-identity! (-> obj root-override scale)) + (vector-y-quaternion! (-> obj dir) (-> obj root-override quat)) + (set! (-> obj joint-track) -1) + (let ((a1-8 (res-lump-struct (-> obj entity) 'art-name structure))) + (if a1-8 + (initialize-skeleton-by-name obj (the-as string a1-8)) + ) + ) + (set! (-> obj dir y) 0.0) + (vector-normalize! (-> obj dir) 1.0) + (set! (-> obj edge-length) 8192.0) + (let ((s4-1 (new 'stack-no-clear 'sync-info-params))) + (let ((a0-19 (res-lump-value arg0 'options uint128 :time -1000000000.0)) + (v1-22 0) + ) + (if (not (logtest? (the-as int a0-19) 8)) + (set! v1-22 (logior v1-22 1)) + ) + (set! (-> s4-1 sync-type) (the-as basic 'sync-eased)) + (set! (-> s4-1 sync-flags) (the-as sync-flags v1-22)) + ) + (set! (-> s4-1 period) (the-as uint 0)) + (set! (-> s4-1 entity) arg0) + (set! (-> s4-1 percent) 0.0) + (set! (-> s4-1 ease-in) 0.2) + (set! (-> s4-1 ease-out) 0.2) + (set! (-> s4-1 pause-in) 0.0) + (set! (-> s4-1 pause-out) 0.0) + (initialize! (-> obj sync) s4-1) + ) + (when (nonzero? (-> obj sync period)) + (set! (-> obj path) (new 'process 'curve-control obj 'path -1000000000.0)) + (logior! (-> obj path flags) (path-control-flag display draw-line draw-point draw-text)) + ) + (set! (-> obj sound) (new 'process 'ambient-sound (-> obj entity) (-> obj root-override trans))) + (go (method-of-object obj idle)) + (none) + ) + +;; definition for function swingpole-init +;; INFO: Used lq/sq +(defbehavior swingpole-init swingpole ((arg0 int)) + (stack-size-set! (-> self main-thread) 128) + (let ((s5-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec collectable)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list tobot)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-4) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-7 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-7 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-7 prim-core collide-with)) + ) + (set! (-> self root-override) s5-0) + ) + (set! (-> self root-override trans quad) (-> (the-as swingpole (-> self parent 0)) root-override trans quad)) + (quaternion-identity! (-> self root-override quat)) + (vector-identity! (-> self root-override scale)) + (set! (-> self joint-track) arg0) + (set-vector! (-> self dir) 0.0 0.0 1.0 1.0) + (set! (-> self edge-length) 8192.0) + (go-virtual idle) + ) + +;; failed to figure out what this is: +(defstate die (process-hidden) + :virtual #t + :code (the-as (function none :behavior process-hidden) nothing) + ) + +;; definition for method 11 of type process-hidden +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! process-hidden ((obj process-hidden) (arg0 entity-actor)) + "Copy defaults from the entity." + (process-entity-status! obj (entity-perm-status dead) #t) + (go (method-of-object obj die)) + (none) + ) + +;; definition of type target-start +(deftype target-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + +;; definition for method 3 of type target-start +(defmethod inspect target-start ((obj target-start)) + (when (not obj) + (set! obj obj) + (goto cfg-68) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tmask: #x~X : (process-mask " (-> obj mask)) + (let ((s5-0 (-> obj mask))) + (if (= (logand s5-0 (process-mask process-tree)) (process-mask process-tree)) + (format #t "process-tree ") + ) + (if (= (logand s5-0 (process-mask target)) (process-mask target)) + (format #t "target ") + ) + (if (= (logand (process-mask collectable) s5-0) (process-mask collectable)) + (format #t "attackable ") + ) + (if (= (logand (process-mask bit18) s5-0) (process-mask bit18)) + (format #t "collectable ") + ) + (if (= (logand (process-mask projectile) s5-0) (process-mask projectile)) + (format #t "projectile ") + ) + (if (= (logand (process-mask no-track) s5-0) (process-mask no-track)) + (format #t "no-track ") + ) + (if (= (logand s5-0 (process-mask sleep-code)) (process-mask sleep-code)) + (format #t "sleep-code ") + ) + (if (= (logand s5-0 (process-mask actor-pause)) (process-mask actor-pause)) + (format #t "actor-pause ") + ) + (if (= (logand (process-mask bot) s5-0) (process-mask bot)) + (format #t "bot ") + ) + (if (= (logand (process-mask vehicle) s5-0) (process-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand (process-mask enemy) s5-0) (process-mask enemy)) + (format #t "enemy ") + ) + (if (= (logand (process-mask entity) s5-0) (process-mask entity)) + (format #t "entity ") + ) + (if (= (logand s5-0 (process-mask heap-shrunk)) (process-mask heap-shrunk)) + (format #t "heap-shrunk ") + ) + (if (= (logand (process-mask sidekick) s5-0) (process-mask sidekick)) + (format #t "sidekick ") + ) + (if (= (logand s5-0 (process-mask going)) (process-mask going)) + (format #t "going ") + ) + (if (= (logand s5-0 (process-mask execute)) (process-mask execute)) + (format #t "execute ") + ) + (if (= (logand (process-mask civilian) s5-0) (shl #x8000 16)) + (format #t "civilian ") + ) + (if (= (logand (process-mask death) s5-0) (process-mask death)) + (format #t "death ") + ) + (if (= (logand (process-mask guard) s5-0) (process-mask guard)) + (format #t "guard ") + ) + (if (= (logand s5-0 (process-mask no-kill)) (process-mask no-kill)) + (format #t "no-kill ") + ) + (if (= (logand (process-mask platform) s5-0) (process-mask platform)) + (format #t "platform ") + ) + (if (= (logand s5-0 (process-mask freeze)) (process-mask freeze)) + (format #t "freeze ") + ) + (if (= (logand s5-0 (process-mask sleep)) (process-mask sleep)) + (format #t "sleep ") + ) + (if (= (logand s5-0 (process-mask progress)) (process-mask progress)) + (format #t "progress ") + ) + (if (= (logand s5-0 (process-mask menu)) (process-mask menu)) + (format #t "menu ") + ) + (if (= (logand (process-mask camera) s5-0) (process-mask camera)) + (format #t "camera ") + ) + (if (= (logand (process-mask ambient) s5-0) (process-mask ambient)) + (format #t "ambient ") + ) + (if (= (logand s5-0 (process-mask dark-effect)) (process-mask dark-effect)) + (format #t "dark-effect ") + ) + (if (= (logand (process-mask crate) s5-0) (process-mask crate)) + (format #t "crate ") + ) + (if (= (logand s5-0 (process-mask kernel-run)) (process-mask kernel-run)) + (format #t "kernel-run ") + ) + (if (= (logand s5-0 (process-mask movie)) (process-mask movie)) + (format #t "movie ") + ) + (if (= (logand s5-0 (process-mask pause)) (process-mask pause)) + (format #t "pause ") + ) + ) + (format #t ")~%") + (format #t "~1Tclock: ~A~%" (-> obj clock)) + (format #t "~1Tparent: #x~X~%" (-> obj parent)) + (format #t "~1Tbrother: #x~X~%" (-> obj brother)) + (format #t "~1Tchild: #x~X~%" (-> obj child)) + (format #t "~1Tppointer: #x~X~%" (-> obj ppointer)) + (format #t "~1Tself: ~A~%" (-> obj self)) + (format #t "~1Tpool: ~A~%" (-> obj pool)) + (format #t "~1Tstatus: ~A~%" (-> obj status)) + (format #t "~1Tpid: ~D~%" (-> obj pid)) + (format #t "~1Tmain-thread: ~A~%" (-> obj main-thread)) + (format #t "~1Ttop-thread: ~A~%" (-> obj top-thread)) + (format #t "~1Tentity: ~A~%" (-> obj entity)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Tstate: ~A~%" (-> obj state)) + (format #t "~1Tnext-state: ~A~%" (-> obj next-state)) + (format #t "~1Ttrans-hook: ~A~%" (-> obj trans-hook)) + (format #t "~1Tpost-hook: ~A~%" (-> obj post-hook)) + (format #t "~1Tevent-hook: ~A~%" (-> obj event-hook)) + (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~1Theap-base: #x~X~%" (-> obj heap-base)) + (format #t "~1Theap-top: #x~X~%" (-> obj heap-top)) + (format #t "~1Theap-cur: #x~X~%" (-> obj heap-cur)) + (format #t "~1Tstack-frame-top: ~A~%" (-> obj stack-frame-top)) + (format #t "~1Theap: #~%" (&-> obj heap-base)) + (format #t "~1Tconnection-list: ~`connectable`P~%" (-> obj connection-list)) + (format #t "~1Tstack[0] @ #x~X~%" (-> obj stack)) + (label cfg-68) + obj + ) + +;; definition of type camera-start +(deftype camera-start (process-hidden) + () + :method-count-assert 15 + :size-assert #x80 + :flag-assert #xf00000080 + ) + +;; definition for method 3 of type camera-start +(defmethod inspect camera-start ((obj camera-start)) + (when (not obj) + (set! obj obj) + (goto cfg-68) + ) + (format #t "[~8x] ~A~%" obj (-> obj type)) + (format #t "~1Tname: ~A~%" (-> obj name)) + (format #t "~1Tmask: #x~X : (process-mask " (-> obj mask)) + (let ((s5-0 (-> obj mask))) + (if (= (logand s5-0 (process-mask process-tree)) (process-mask process-tree)) + (format #t "process-tree ") + ) + (if (= (logand s5-0 (process-mask target)) (process-mask target)) + (format #t "target ") + ) + (if (= (logand (process-mask collectable) s5-0) (process-mask collectable)) + (format #t "attackable ") + ) + (if (= (logand (process-mask bit18) s5-0) (process-mask bit18)) + (format #t "collectable ") + ) + (if (= (logand (process-mask projectile) s5-0) (process-mask projectile)) + (format #t "projectile ") + ) + (if (= (logand (process-mask no-track) s5-0) (process-mask no-track)) + (format #t "no-track ") + ) + (if (= (logand s5-0 (process-mask sleep-code)) (process-mask sleep-code)) + (format #t "sleep-code ") + ) + (if (= (logand s5-0 (process-mask actor-pause)) (process-mask actor-pause)) + (format #t "actor-pause ") + ) + (if (= (logand (process-mask bot) s5-0) (process-mask bot)) + (format #t "bot ") + ) + (if (= (logand (process-mask vehicle) s5-0) (process-mask vehicle)) + (format #t "vehicle ") + ) + (if (= (logand (process-mask enemy) s5-0) (process-mask enemy)) + (format #t "enemy ") + ) + (if (= (logand (process-mask entity) s5-0) (process-mask entity)) + (format #t "entity ") + ) + (if (= (logand s5-0 (process-mask heap-shrunk)) (process-mask heap-shrunk)) + (format #t "heap-shrunk ") + ) + (if (= (logand (process-mask sidekick) s5-0) (process-mask sidekick)) + (format #t "sidekick ") + ) + (if (= (logand s5-0 (process-mask going)) (process-mask going)) + (format #t "going ") + ) + (if (= (logand s5-0 (process-mask execute)) (process-mask execute)) + (format #t "execute ") + ) + (if (= (logand (process-mask civilian) s5-0) (shl #x8000 16)) + (format #t "civilian ") + ) + (if (= (logand (process-mask death) s5-0) (process-mask death)) + (format #t "death ") + ) + (if (= (logand (process-mask guard) s5-0) (process-mask guard)) + (format #t "guard ") + ) + (if (= (logand s5-0 (process-mask no-kill)) (process-mask no-kill)) + (format #t "no-kill ") + ) + (if (= (logand (process-mask platform) s5-0) (process-mask platform)) + (format #t "platform ") + ) + (if (= (logand s5-0 (process-mask freeze)) (process-mask freeze)) + (format #t "freeze ") + ) + (if (= (logand s5-0 (process-mask sleep)) (process-mask sleep)) + (format #t "sleep ") + ) + (if (= (logand s5-0 (process-mask progress)) (process-mask progress)) + (format #t "progress ") + ) + (if (= (logand s5-0 (process-mask menu)) (process-mask menu)) + (format #t "menu ") + ) + (if (= (logand (process-mask camera) s5-0) (process-mask camera)) + (format #t "camera ") + ) + (if (= (logand (process-mask ambient) s5-0) (process-mask ambient)) + (format #t "ambient ") + ) + (if (= (logand s5-0 (process-mask dark-effect)) (process-mask dark-effect)) + (format #t "dark-effect ") + ) + (if (= (logand (process-mask crate) s5-0) (process-mask crate)) + (format #t "crate ") + ) + (if (= (logand s5-0 (process-mask kernel-run)) (process-mask kernel-run)) + (format #t "kernel-run ") + ) + (if (= (logand s5-0 (process-mask movie)) (process-mask movie)) + (format #t "movie ") + ) + (if (= (logand s5-0 (process-mask pause)) (process-mask pause)) + (format #t "pause ") + ) + ) + (format #t ")~%") + (format #t "~1Tclock: ~A~%" (-> obj clock)) + (format #t "~1Tparent: #x~X~%" (-> obj parent)) + (format #t "~1Tbrother: #x~X~%" (-> obj brother)) + (format #t "~1Tchild: #x~X~%" (-> obj child)) + (format #t "~1Tppointer: #x~X~%" (-> obj ppointer)) + (format #t "~1Tself: ~A~%" (-> obj self)) + (format #t "~1Tpool: ~A~%" (-> obj pool)) + (format #t "~1Tstatus: ~A~%" (-> obj status)) + (format #t "~1Tpid: ~D~%" (-> obj pid)) + (format #t "~1Tmain-thread: ~A~%" (-> obj main-thread)) + (format #t "~1Ttop-thread: ~A~%" (-> obj top-thread)) + (format #t "~1Tentity: ~A~%" (-> obj entity)) + (format #t "~1Tlevel: ~A~%" (-> obj level)) + (format #t "~1Tstate: ~A~%" (-> obj state)) + (format #t "~1Tnext-state: ~A~%" (-> obj next-state)) + (format #t "~1Ttrans-hook: ~A~%" (-> obj trans-hook)) + (format #t "~1Tpost-hook: ~A~%" (-> obj post-hook)) + (format #t "~1Tevent-hook: ~A~%" (-> obj event-hook)) + (format #t "~1Tallocated-length: ~D~%" (-> obj allocated-length)) + (format #t "~1Theap-base: #x~X~%" (-> obj heap-base)) + (format #t "~1Theap-top: #x~X~%" (-> obj heap-top)) + (format #t "~1Theap-cur: #x~X~%" (-> obj heap-cur)) + (format #t "~1Tstack-frame-top: ~A~%" (-> obj stack-frame-top)) + (format #t "~1Theap: #~%" (&-> obj heap-base)) + (format #t "~1Tconnection-list: ~`connectable`P~%" (-> obj connection-list)) + (format #t "~1Tstack[0] @ #x~X~%" (-> obj stack)) + (label cfg-68) + obj + ) + +;; definition for function manipy-post +;; WARN: Return type mismatch int vs none. +(defbehavior manipy-post manipy () + ((-> self cur-post-hook)) + (when (and (>= (-> self shadow-volume-joint) 0) (-> self draw shadow-ctrl)) + (let ((a2-0 (-> self node-list data (-> self shadow-volume-joint))) + (a3-0 (-> self draw shadow-ctrl)) + ) + (format *stdcon* "shadow-volume for ~A ~A~%" a2-0 a3-0) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate idle (manipy) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (s4-0 object)) + (let ((v1-0 event-type)) + (the-as + object + (cond + ((= v1-0 'attackable) + (cond + ((-> event param 0) + (set! s4-0 (logior (process-mask collectable) (-> self mask))) + (set! (-> self mask) (the-as process-mask s4-0)) + ) + (else + (set! s4-0 (logclear (-> self mask) (process-mask collectable))) + (set! (-> self mask) (the-as process-mask s4-0)) + ) + ) + s4-0 + ) + ((= v1-0 'blend-shape) + (when (nonzero? (-> self skel)) + (cond + ((-> event param 0) + (set! s4-0 (logior (-> self skel status) (joint-control-status blend-shape eye-anim))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + (else + (set! s4-0 (logclear (-> self skel status) (joint-control-status blend-shape eye-anim))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + ) + s4-0 + ) + ) + ((= v1-0 'shadow) + (when (nonzero? (-> self draw)) + (cond + ((-> event param 0) + (set! s4-0 (-> self shadow-backup)) + (set! (-> self draw shadow) (the-as shadow-geo s4-0)) + s4-0 + ) + (else + (set! (-> self draw shadow) #f) + #f + ) + ) + ) + ) + ((= v1-0 'shadow-volume) + (let ((v1-17 (get-art-by-name-method (-> self draw jgeo) (the-as string (-> event param 0)) (the-as type #f)))) + (if v1-17 + (set! (-> self shadow-volume-joint) (+ (-> (the-as joint v1-17) number) 1)) + ) + ) + (when (and (-> self draw shadow-ctrl) (< 1 arg1) (>= (the-as int (-> event param 1)) 0)) + (let ((v0-1 (command-get-int (-> event param 1) 0))) + (set! (-> self draw shadow-ctrl settings flags) (the-as shadow-flags v0-1)) + v0-1 + ) + ) + ) + ((= v1-0 'shadow-type) + (if (and (-> self draw shadow-ctrl) (> arg1 0)) + (set! (-> self draw shadow-ctrl settings shadow-type) (command-get-int (-> event param 0) 0)) + ) + ) + ((= v1-0 'shadow-dir) + (when (and (-> self draw shadow-ctrl) (> arg1 0)) + (set! s4-0 (-> self draw shadow-ctrl settings shadow-dir)) + (set! (-> (the-as vector s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as vector s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as vector s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as vector s4-0) w) (if (< 3 arg1) + (command-get-float (-> event param 3) 0.0) + 409600.0 + ) + ) + s4-0 + ) + ) + ((= v1-0 'shadow-top-plane) + (when (and (-> self draw shadow-ctrl) (>= arg1 4)) + (set! s4-0 (-> self draw shadow-ctrl settings top-plane)) + (set! (-> (the-as plane s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as plane s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as plane s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as plane s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'shadow-bot-plane) + (when (and (-> self draw shadow-ctrl) (>= arg1 4)) + (set! s4-0 (-> self draw shadow-ctrl settings bot-plane)) + (set! (-> (the-as plane s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as plane s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as plane s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as plane s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'no-fog) + (set! s4-0 (logior (-> self draw status) (draw-control-status disable-fog))) + (set! (-> self draw status) (the-as draw-control-status s4-0)) + s4-0 + ) + ((= v1-0 'setup-spotlight-shadow) + (when (-> self draw shadow-ctrl) + (let ((v1-53 (command-get-process "spotlight" *target*))) + (when v1-53 + (let ((s5-1 (-> (the-as process-drawable v1-53) node-list data 3))) + (vector<-cspace! (new 'stack-no-clear 'vector) s5-1) + (let ((s5-2 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> s5-1 bone transform vector 2) -1.0)) + (s4-1 + (vector<-cspace! (new 'stack-no-clear 'vector) (-> self node-list data (-> self draw shadow-joint-index))) + ) + ) + 1638400.0 + (let ((s3-0 (new 'stack-no-clear 'collide-query)) + (f28-0 122880.0) + ) + (set! (-> s3-0 start-pos quad) (-> s4-1 quad)) + (vector-normalize-copy! (-> s3-0 move-dist) s5-2 f28-0) + (let ((v1-64 s3-0)) + (set! (-> v1-64 radius) 1638.4) + (set! (-> v1-64 collide-with) (collide-spec obstacle hit-by-others-list)) + (set! (-> v1-64 ignore-process0) self) + (set! (-> v1-64 ignore-process1) #f) + (set! (-> v1-64 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-64 action-mask) (collide-action solid)) + ) + (let* ((f0-13 (fill-and-probe-using-line-sphere *collide-cache* s3-0)) + (f28-1 (if (< 0.0 f0-13) + (* f0-13 f28-0) + 122880.0 + ) + ) + (s2-0 (method-of-object (-> self draw shadow-ctrl) shadow-control-method-14)) + ) + (- f28-1 (command-get-float (-> event param 0) 0.0)) + (+ f28-1 (command-get-float (-> event param 1) 0.0)) + (the-as object (s2-0)) + ) + ) + ) + ) + ) + ) + ) + ) + ((= v1-0 'color-mult) + (when (>= arg1 4) + (set! s4-0 (-> self draw color-mult)) + (set! (-> (the-as rgbaf s4-0) x) (command-get-float (-> event param 0) 0.0)) + (set! (-> (the-as rgbaf s4-0) y) (command-get-float (-> event param 1) 0.0)) + (set! (-> (the-as rgbaf s4-0) z) (command-get-float (-> event param 2) 0.0)) + (set! (-> (the-as rgbaf s4-0) w) (command-get-float (-> event param 3) 0.0)) + s4-0 + ) + ) + ((= v1-0 'color-mult-vector) + (set! s4-0 (-> self draw color-mult)) + (set! (-> (the-as rgbaf s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ((= v1-0 'color-emissive-vector) + (set! s4-0 (-> self draw color-emissive)) + (set! (-> (the-as rgbaf s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ((= v1-0 'segment) + (let ((a1-44 (/ (the-as int (-> event param 0)) 8)) + (a2-5 (/ (the-as int (-> event param 1)) 8)) + ) + (the-as object (setup-masks (-> self draw) (the-as int a1-44) (the-as int a2-5))) + ) + ) + ((= v1-0 'trans-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self new-trans-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'post-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self new-post-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'user-data) + (set! s4-0 (-> event param 0)) + (set! (-> self userdata) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'eval) + ((the-as (function manipy object) (-> event param 0)) self) + ) + ((= v1-0 'speed) + (set! (-> self speed) (the-as float (-> event param 0))) + ) + ((= v1-0 'event-hook) + (set! s4-0 (-> event param 0)) + (set! (-> self cur-event-hook) (the-as (function none) s4-0)) + s4-0 + ) + ((= v1-0 'art-joint-anim) + (set! (-> self new-joint-anim) + (get-art-by-name (-> self draw art-group) (the-as string (-> event param 0)) art-joint-anim) + ) + (set! s4-0 (-> event param 1)) + (set! (-> self new-joint-anim-blend) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'anim-mode) + (when (nonzero? (-> self skel)) + (set! (-> self anim-mode) (the-as symbol (-> event param 0))) + (if (= (-> self anim-mode) 'clone-anim) + (ja-post) + ) + (-> self anim-mode) + ) + ) + ((or (= v1-0 'origin-joint-index) (= v1-0 'center-joint)) + (set! (-> self draw origin-joint-index) (-> event param 0)) + (set! s4-0 (-> event param 0)) + (set! (-> self draw shadow-joint-index) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'max-vis-dist) + (set! (-> self draw lod-set lod (-> self draw lod-set max-lod) dist) (the-as float (-> event param 0))) + ) + ((= v1-0 'grab) + (set! (-> self cur-grab-handle) (process->handle (the-as process (-> event param 0)))) + (let ((v1-98 (handle->process (-> self cur-grab-handle)))) + (when v1-98 + (set! s4-0 (-> self old-grab-pos)) + (set! (-> (the-as vector s4-0) quad) (-> (the-as process-drawable v1-98) root trans quad)) + s4-0 + ) + ) + ) + ((= v1-0 'target) + (set! s4-0 (process->handle (the-as process (-> event param 0)))) + (set! (-> self cur-target-handle) (the-as handle s4-0)) + s4-0 + ) + ((= v1-0 'trans) + (cond + ((type? (-> self root-override) collide-shape) + (the-as object (move-to-point! (-> self root-override) (the-as vector (-> event param 0)))) + ) + (else + (set! s4-0 (-> self root-override trans)) + (set! (-> (the-as vector s4-0) quad) (-> (the-as vector (-> event param 0)) quad)) + s4-0 + ) + ) + ) + ((= v1-0 'rot) + (let ((s5-3 (new 'stack-no-clear 'matrix))) + (matrix-rotate-y! s5-3 (the-as float (-> event param 0))) + (matrix->quaternion (-> self root-override quat) s5-3) + ) + ) + ((= v1-0 'rot-quat) + (quaternion-copy! (-> self root-override quat) (the-as quaternion (-> event param 0))) + ) + ((= v1-0 'clone-copy-trans) + (set! s4-0 (-> event param 0)) + (set! (-> self clone-copy-trans) (the-as symbol s4-0)) + s4-0 + ) + ((= v1-0 'release) + (set! (-> self cur-grab-handle) (the-as handle #f)) + #f + ) + ((= v1-0 'draw) + (set! (-> self draw?) (the-as symbol (-> event param 0))) + (cond + ((-> event param 0) + (let ((v1-114 (logtest? (-> self draw status) (draw-control-status no-draw)))) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (when v1-114 + (cond + ((nonzero? (-> self skel)) + (let ((gp-1 (-> self skel status))) + (logior! (-> self skel status) (joint-control-status sync-math)) + (set! s4-0 (the-as object (ja-post))) + (set! (-> self skel status) gp-1) + ) + s4-0 + ) + (else + (the-as object (ja-post)) + ) + ) + ) + ) + ) + (else + (set! s4-0 (logior (-> self draw status) (draw-control-status no-draw))) + (set! (-> self draw status) (the-as draw-control-status s4-0)) + s4-0 + ) + ) + ) + ((= v1-0 'sync) + (when (nonzero? (-> self skel)) + (cond + ((-> event param 0) + (set! s4-0 (logior (-> self skel status) (joint-control-status sync-math))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + (else + (set! s4-0 (logclear (-> self skel status) (joint-control-status sync-math))) + (set! (-> self skel status) (the-as joint-control-status s4-0)) + ) + ) + s4-0 + ) + ) + ((= v1-0 'query) + (case (-> event param 0) + (('grab) + (handle->process (-> self cur-grab-handle)) + ) + (('done) + (case (-> self anim-mode) + (('play1 'play) + (>= (ja-frame-num 0) (the float (+ (-> (ja-group) frames num-frames) -2))) + ) + ) + ) + ) + ) + ((= v1-0 'set-frame-num) + (let ((v1-147 (-> self skel root-channel 0))) + (set! (-> v1-147 num-func) num-func-identity) + (set! (-> v1-147 frame-num) (the-as float (-> event param 0))) + ) + ) + ((= v1-0 'prefix) + (set! s4-0 (-> event param 0)) + (set! (-> self prefix) (the-as basic s4-0)) + s4-0 + ) + ((= v1-0 'light-index) + (let ((v0-40 (command-get-int (-> event param 0) 0))) + (set! (-> self draw light-index) (the-as uint v0-40)) + v0-40 + ) + ) + ((= v1-0 'eye-slot) + (set! (-> self draw mgeo header eye-ctrl eye-slot) (command-get-int (-> event param 0) 0)) + ) + ((= v1-0 'shadow-mask) + (let ((v0-42 (command-get-int (-> event param 0) 0))) + (set! (-> self draw shadow-mask) (the-as uint v0-42)) + v0-42 + ) + ) + ((= v1-0 'shadow-values) + (let ((v0-43 (command-get-int (-> event param 0) 0))) + (set! (-> self draw shadow-values) (the-as uint v0-43)) + v0-43 + ) + ) + ((= v1-0 'mirror) + (cond + ((-> event param 0) + (set! s4-0 (-> self node-list data 2)) + (set! (-> (the-as cspace s4-0) param0) (the-as (function cspace matrix none) cspace<-parented-matrix-mirror!)) + (set! (-> (the-as cspace s4-0) param1) (the-as basic (-> *math-camera* mirror-trans))) + (set! (-> (the-as cspace s4-0) param2) (the-as basic (-> *math-camera* mirror-normal))) + ) + (else + (set! s4-0 (-> self node-list data 2)) + (set! (-> (the-as cspace s4-0) param0) #f) + ) + ) + s4-0 + ) + ((= v1-0 'draw-mirror) + (send-event (ppointer->process (-> self child)) 'draw (-> event param 0)) + ) + ((= v1-0 'user) + (set! s4-0 (-> event param 1)) + (set! (-> self user-uint64 (/ (the-as int (-> event param 0)) 8)) (the-as uint s4-0)) + s4-0 + ) + ((= v1-0 'die) + (the-as object (deactivate self)) + ) + ((= v1-0 'do-effect) + (when (and (nonzero? (-> self skel)) (-> self skel effect)) + (let ((t9-46 (method-of-object (-> self skel effect) effect-control-method-10))) + (-> event param 0) + (-> event param 1) + -1 + (the-as object (t9-46)) + ) + ) + ) + (else + (if (-> self cur-event-hook) + (the-as object ((-> self cur-event-hook))) + ) + ) + ) + ) + ) + ) + :trans (behavior () + (if (!= (-> self cur-trans-hook) (-> self new-trans-hook)) + (set! (-> self cur-trans-hook) (-> self new-trans-hook)) + ) + (if (!= (-> self cur-post-hook) (-> self new-post-hook)) + (set! (-> self cur-post-hook) (-> self new-post-hook)) + ) + (when (and (-> self new-joint-anim) + (nonzero? (-> self skel)) + (and (!= (ja-group) (-> self new-joint-anim)) (!= (-> self anim-mode) 'clone-anim)) + ) + (ja-channel-push! 1 (the-as time-frame (-> self new-joint-anim-blend))) + (ja :group! (-> self new-joint-anim) :num! min) + ) + (let ((v1-20 (handle->process (-> self cur-grab-handle)))) + (when v1-20 + (let ((gp-1 (-> (the-as process-drawable v1-20) root trans))) + (if (type? (-> self root-override) collide-shape) + (move-by-vector! + (the-as collide-shape (-> self root-override)) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + (vector+! + (-> self root-override trans) + (-> self root-override trans) + (vector-! (new 'stack-no-clear 'vector) gp-1 (-> self old-grab-pos)) + ) + ) + (set! (-> self old-grab-pos quad) (-> gp-1 quad)) + ) + ) + ) + ((-> self cur-trans-hook)) + (none) + ) + :code (behavior () + (logclear! (-> self mask) (process-mask heap-shrunk)) + (until #f + (case (-> self anim-mode) + (('loop) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (loop!)) + ) + (('play) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (seek!)) + ) + (('copy-parent) + (let ((v1-17 (-> self skel root-channel 0))) + (set! (-> v1-17 num-func) num-func-identity) + (let ((a0-10 (-> self parent))) + (set! (-> v1-17 frame-num) (-> (the-as process-drawable (if a0-10 + (the-as process-drawable (-> a0-10 0 self)) + ) + ) + skel + root-channel + 0 + frame-num + ) + ) + ) + ) + (ja-post) + (manipy-post) + (suspend) + 0 + ) + (('clone-parent) + (let ((gp-0 (ppointer->process (-> self parent)))) + (set! (-> self post-hook) #f) + (joint-control-copy! (-> self skel) (-> (the-as process-drawable gp-0) skel)) + (joint-control-remap! + (-> self skel) + (-> self draw art-group) + (-> (the-as process-drawable gp-0) draw art-group) + '() + 0 + "" + ) + ) + (update-anim-data (-> self skel)) + (do-joint-math (-> self draw) (-> self node-list) (-> self skel)) + (manipy-post) + (suspend) + 0 + ) + (('clone-anim) + (clone-anim-once + (if (handle->process (-> self cur-target-handle)) + (the-as handle (-> self cur-target-handle)) + (ppointer->handle (-> self parent)) + ) + (-> self clone-copy-trans) + (the-as string (-> self prefix)) + ) + (manipy-post) + (suspend) + 0 + ) + (('mirror) + (let ((gp-1 (if (handle->process (-> self cur-target-handle)) + (-> self cur-target-handle) + (ppointer->handle (-> self parent)) + ) + ) + ) + (clone-anim-once gp-1 (-> self clone-copy-trans) (the-as string (-> self prefix))) + (logior! (-> self draw global-effect) (draw-control-global-effect disable-envmap)) + (set! (-> self draw light-index) (the-as uint 5)) + (if (logtest? (-> (the-as process-drawable (handle->process gp-1)) draw status) + (draw-control-status no-draw no-draw-temp no-draw-bounds) + ) + (logior! (-> self draw status) (draw-control-status no-draw-temp)) + ) + ) + (manipy-post) + (suspend) + 0 + ) + (('still) + (ja-post) + (manipy-post) + (suspend) + 0 + ) + (('play1) + (ja-post) + (manipy-post) + (suspend) + (ja :num! (seek! max (-> self speed))) + (if (ja-done? 0) + (deactivate self) + ) + ) + ) + ) + #f + (none) + ) + ) + +;; definition for function manipy-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior manipy-init manipy ((arg0 vector) (arg1 entity-actor) (arg2 skeleton-group) (arg3 vector) (arg4 object)) + (stack-size-set! (-> self main-thread) 128) + (logior! (-> self mask) (process-mask heap-shrunk)) + (process-entity-set! self arg1) + (cond + ((= arg3 'collide-shape-moving) + (let ((s3-1 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s3-1 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s3-1 reaction) cshape-reaction-default) + (set! (-> s3-1 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-11 (new 'process 'collide-shape-prim-sphere s3-1 (the-as uint 0)))) + (set-vector! (-> v1-11 local-sphere) 0.0 0.0 0.0 4096.0) + (set! (-> s3-1 total-prims) (the-as uint 1)) + (set! (-> s3-1 root-prim) v1-11) + ) + (set! (-> s3-1 nav-radius) (* 0.75 (-> s3-1 root-prim local-sphere w))) + (let ((v1-14 (-> s3-1 root-prim))) + (set! (-> s3-1 backup-collide-as) (-> v1-14 prim-core collide-as)) + (set! (-> s3-1 backup-collide-with) (-> v1-14 prim-core collide-with)) + ) + (set! (-> self root-override) s3-1) + ) + ) + (arg3 + (let ((s3-2 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-18 (new 'process 'collide-shape-prim-sphere s3-2 (the-as uint 0)))) + (set! (-> v1-18 prim-core collide-as) (collide-spec collectable notice-blue-eco-powerup)) + (set! (-> v1-18 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-18 local-sphere) (-> arg3 x) (-> arg3 y) (-> arg3 z) (-> arg3 w)) + (set! (-> s3-2 total-prims) (the-as uint 1)) + (set! (-> s3-2 root-prim) v1-18) + ) + (set! (-> s3-2 nav-radius) (* 0.75 (-> s3-2 root-prim local-sphere w))) + (let ((v1-21 (-> s3-2 root-prim))) + (set! (-> s3-2 backup-collide-as) (-> v1-21 prim-core collide-as)) + (set! (-> s3-2 backup-collide-with) (-> v1-21 prim-core collide-with)) + ) + (set! (-> self root-override) s3-2) + ) + ) + (else + (set! (-> self root-override) (the-as collide-shape (new 'process 'trsqv))) + ) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (initialize-skeleton self arg2 (the-as pair 0)) + (if (type? (-> self root-override) collide-shape) + (update-transforms (the-as collide-shape (-> self root-override))) + ) + (set! (-> self shadow-backup) (-> self draw shadow)) + (set! (-> self shadow-volume-joint) -1) + (set! (-> self options) (the-as manipy-options arg4)) + (when (-> self draw shadow) + (set! (-> self draw shadow-ctrl) + (new 'process 'shadow-control 0.0 0.0 614400.0 (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0) + ) + (quad-copy! (the-as pointer (-> self draw shadow-ctrl settings)) (the-as pointer *default-shadow-settings*) 5) + ) + (set! (-> self new-trans-hook) nothing) + (set! (-> self cur-trans-hook) nothing) + (set! (-> self new-post-hook) nothing) + (set! (-> self cur-post-hook) nothing) + (set! (-> self cur-event-hook) #f) + (set! (-> self cur-grab-handle) (the-as handle #f)) + (set! (-> self cur-target-handle) (the-as handle #f)) + (set! (-> self clone-copy-trans) #t) + (set! (-> self draw?) #t) + (set! (-> self prefix) "") + (set! (-> self speed) 1.0) + (when (logtest? (-> self options) (manipy-options mo-0)) + (let ((v1-56 (get-art-by-name-method (-> self draw jgeo) "neckA" (the-as type #f)))) + (when v1-56 + (set! (-> self joint 0) + (new 'process 'joint-mod (joint-mod-mode flex-blend) self (+ (-> (the-as joint v1-56) number) 1)) + ) + (set! (-> self joint 0 parented-scale?) #t) + ) + ) + ) + (cond + ((nonzero? (-> self skel)) + (set! (-> self new-joint-anim) (ja-group)) + (set! (-> self anim-mode) 'loop) + ) + (else + (set! (-> self anim-mode) 'still) + ) + ) + (set! (-> self event-hook) (-> (method-of-object self idle) event)) + (go-virtual idle) + (none) + ) + +;; definition for method 10 of type part-tracker +(defmethod deactivate part-tracker ((obj part-tracker)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; definition for method 15 of type part-tracker +;; WARN: Return type mismatch object vs none. +(defmethod notify-parent-of-death part-tracker ((obj part-tracker)) + (with-pp + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) (process->ppointer pp)) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> obj parent))) + ) + (s5-0 + (if (type? s4-0 process) + s4-0 + ) + gp-0 + ) + ) + ) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate active (part-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('die) + (the-as symbol (deactivate self)) + ) + ) + ) + ) + :code (behavior () + (set! (-> self start-time) (-> self clock frame-counter)) + (while (or (zero? (-> self duration)) + (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (let* ((gp-0 (handle->process (-> self target))) + (v1-8 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (cond + ((and v1-8 + (nonzero? (-> (the-as process-drawable v1-8) root)) + (nonzero? (-> (the-as process-drawable v1-8) node-list)) + ) + (spawn-with-cspace (-> self part) (-> (the-as process-drawable v1-8) node-list data (-> self target-joint))) + (set! (-> self root trans quad) (-> self part origin trans quad)) + ) + (else + (let ((a0-12 (-> self root trans))) + (set! (-> self mat trans quad) (-> a0-12 quad)) + ) + (spawn-with-matrix (-> self part) (-> self mat)) + ) + ) + ) + (suspend) + ) + (let ((gp-1 (-> self clock frame-counter))) + (until (>= (- (-> self clock frame-counter) gp-1) (the-as time-frame (-> self linger-duration))) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (let* ((s5-0 (handle->process (-> self target))) + (v1-30 (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (if (and v1-30 + (nonzero? (-> (the-as process-drawable v1-30) root)) + (nonzero? (-> (the-as process-drawable v1-30) node-list)) + ) + (vector<-cspace! + (-> self root trans) + (-> (the-as process-drawable v1-30) node-list data (-> self target-joint)) + ) + ) + ) + (suspend) + ) + ) + (if (-> self linger-callback) + ((-> self linger-callback) self) + ) + (notify-parent-of-death self) + (suspend) + 0 + (none) + ) + ) + +;; definition for function part-tracker-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior part-tracker-init part-tracker ((arg0 sparticle-launch-group) + (arg1 time-frame) + (arg2 (function part-tracker none)) + (arg3 (pointer process-drawable)) + (arg4 process) + (arg5 matrix) + ) + (stack-size-set! (-> self main-thread) 128) + (if (= pointer process-tree) + (set! (-> self clock) (-> *display* part-clock)) + ) + (set! (-> self target) (process->handle arg4)) + (cond + (arg4 + (set! (-> self target-joint) (the-as int arg5)) + ) + ((logtest? (-> arg0 flags) (sp-group-flag unk-5)) + (let* ((s1-1 (-> self mat)) + (a2-1 (math-camera-matrix)) + (v1-11 (-> a2-1 vector 0 quad)) + (a0-7 (-> a2-1 vector 1 quad)) + (a1-2 (-> a2-1 vector 2 quad)) + (a2-2 (-> a2-1 trans quad)) + ) + (set! (-> s1-1 vector 0 quad) v1-11) + (set! (-> s1-1 vector 1 quad) a0-7) + (set! (-> s1-1 vector 2 quad) a1-2) + (set! (-> s1-1 trans quad) a2-2) + ) + (set! (-> self mat trans quad) (-> arg5 trans quad)) + (set! (-> self offset quad) (-> self mat trans quad)) + ) + (else + (let* ((v1-14 (-> self mat)) + (a3-1 arg5) + (a0-12 (-> a3-1 vector 0 quad)) + (a1-3 (-> a3-1 vector 1 quad)) + (a2-3 (-> a3-1 vector 2 quad)) + (a3-2 (-> a3-1 trans quad)) + ) + (set! (-> v1-14 vector 0 quad) a0-12) + (set! (-> v1-14 vector 1 quad) a1-3) + (set! (-> v1-14 vector 2 quad) a2-3) + (set! (-> v1-14 trans quad) a3-2) + ) + (set! (-> self offset quad) (-> self mat trans quad)) + ) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self root trans quad) (-> self mat trans quad)) + (if (zero? arg0) + (go process-drawable-art-error "null group") + ) + (set! (-> self callback) (the-as (function part-tracker vector) arg2)) + (set! (-> self linger-callback) #f) + (set! (-> self userdata) (the-as uint arg3)) + (set! arg1 (cond + ((> arg1 0) + (empty) + arg1 + ) + ((= arg1 -1) + 0 + ) + (else + (the-as time-frame (-> arg0 duration)) + ) + ) + ) + (set! (-> self duration) (the-as uint arg1)) + (set! (-> self linger-duration) (-> arg0 linger-duration)) + (set! (-> self part) (create-launch-control arg0 self)) + (go-virtual active) + (none) + ) + +;; definition for function part-tracker-track-root +;; WARN: Return type mismatch int vs none. +(defun part-tracker-track-root ((arg0 sparticle-system) (arg1 sparticle-cpuinfo) (arg2 vector)) + (let ((v1-3 (-> arg1 key proc root trans))) + (set! (-> arg2 x) (-> v1-3 x)) + (set! (-> arg2 y) (-> v1-3 y)) + (set! (-> arg2 z) (-> v1-3 z)) + ) + 0 + (none) + ) + +;; definition for function part-tracker-move-to-target +(defun part-tracker-move-to-target ((arg0 part-tracker)) + (with-pp + (let* ((a0-1 *target*) + (a2-0 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + ) + (vector-lerp! + (-> arg0 root trans) + (-> arg0 offset) + a2-0 + (* 0.006666667 (the float (- (-> pp clock frame-counter) (-> arg0 start-time)))) + ) + ) + ) + ) + +;; definition for function part-tracker-track-target +;; INFO: Used lq/sq +(defun part-tracker-track-target ((arg0 part-tracker)) + (set! (-> arg0 linger-callback) (-> arg0 callback)) + (let* ((a0-1 *target*) + (v1-2 (if (not a0-1) + (-> arg0 root trans) + (get-trans a0-1 3) + ) + ) + (v0-1 (-> arg0 root trans)) + ) + (set! (-> v0-1 quad) (-> v1-2 quad)) + v0-1 + ) + ) + +;; definition for method 15 of type lightning-tracker +;; WARN: Return type mismatch object vs none. +(defmethod notify-parent-of-death lightning-tracker ((obj lightning-tracker)) + (with-pp + (let ((gp-0 (new 'stack-no-clear 'event-message-block))) + (set! (-> gp-0 from) (process->ppointer pp)) + (set! (-> gp-0 num-params) 1) + (set! (-> gp-0 message) 'notify) + (set! (-> gp-0 param 0) (the-as uint 'die)) + (let ((s5-0 send-event-function) + (s4-0 (ppointer->process (-> obj parent))) + ) + (s5-0 + (if (type? s4-0 process) + s4-0 + ) + gp-0 + ) + ) + ) + (none) + ) + ) + +;; definition for method 16 of type lightning-tracker +;; INFO: Used lq/sq +;; WARN: Return type mismatch int vs none. +(defmethod update lightning-tracker ((obj lightning-tracker)) + (if (-> obj callback) + ((-> obj callback) obj) + ) + (let ((a0-6 (cond + ((>= (-> obj target-joint0) 0) + (let ((s5-0 (handle->process (-> obj target0)))) + (if (type? s5-0 process-drawable) + s5-0 + ) + ) + ) + (else + (the-as process #f) + ) + ) + ) + ) + (cond + ((< (-> obj target-joint0) 0) + (when (and (!= (-> obj lightning spec rand-func) 3) (!= (-> obj lightning spec rand-func) 2)) + (let ((v1-17 (-> obj lightning)) + (a0-9 (-> obj offset0)) + ) + (set! (-> v1-17 state meet data 0 quad) (-> a0-9 quad)) + ) + ) + ) + ((or (not a0-6) (zero? (-> (the-as process-focusable a0-6) root-override))) + (deactivate obj) + ) + ((= (-> obj target-joint0) 256) + (let ((s5-1 (-> obj lightning)) + (a0-12 (get-trans (the-as process-focusable a0-6) 3)) + ) + (set! (-> s5-1 state meet data 0 quad) (-> a0-12 quad)) + ) + ) + (else + (let ((s5-2 (-> obj lightning)) + (a0-16 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-focusable a0-6) node-list data (-> obj target-joint0)) + ) + ) + ) + (set! (-> s5-2 state meet data 0 quad) (-> a0-16 quad)) + ) + ) + ) + ) + (let ((a0-22 (cond + ((>= (-> obj target-joint1) 0) + (let ((s5-3 (handle->process (-> obj target1)))) + (if (type? s5-3 process-drawable) + s5-3 + ) + ) + ) + (else + (the-as process #f) + ) + ) + ) + ) + (cond + ((< (-> obj target-joint1) 0) + (when (and (!= (-> obj lightning spec rand-func) 3) (!= (-> obj lightning spec rand-func) 2)) + (let ((a0-26 (-> obj lightning)) + (v1-44 (-> obj offset1)) + ) + (set! (-> a0-26 state meet data (+ (-> a0-26 state points-to-draw) -1) quad) (-> v1-44 quad)) + ) + ) + ) + ((or (not a0-22) (zero? (-> (the-as process-focusable a0-22) root-override))) + (deactivate obj) + ) + ((= (-> obj target-joint1) 256) + (let ((gp-1 (-> obj lightning)) + (v1-51 (get-trans (the-as process-focusable a0-22) 3)) + ) + (set! (-> gp-1 state meet data (+ (-> gp-1 state points-to-draw) -1) quad) (-> v1-51 quad)) + ) + ) + (else + (let ((s5-4 (-> obj lightning)) + (v1-54 (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable a0-22) node-list data (-> obj target-joint1)) + ) + ) + ) + (set! (-> s5-4 state meet data (+ (-> s5-4 state points-to-draw) -1) quad) (-> v1-54 quad)) + ) + ) + ) + ) + 0 + (none) + ) + +;; failed to figure out what this is: +(defstate active (lightning-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('die) + (the-as symbol (deactivate self)) + ) + ) + ) + ) + :exit (behavior () + (when (nonzero? (-> self sound)) + (let ((v1-1 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-1 command) (sound-command set-param)) + (set! (-> v1-1 id) (the-as sound-id (-> self sound))) + (set! (-> v1-1 params volume) -4) + (set! (-> v1-1 auto-time) 240) + (set! (-> v1-1 auto-from) 2) + (set! (-> v1-1 params mask) (the-as uint 17)) + (-> v1-1 id) + ) + ) + (none) + ) + :code (behavior () + (set! (-> self sound) (the-as uint 0)) + (when (!= (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) 0.0) + (let ((gp-0 (-> self clock frame-counter)) + (s5-0 (the int (rand-vu-float-range + (-> self lightning spec delay) + (+ (-> self lightning spec delay) (-> self lightning spec delay-rand)) + ) + ) + ) + ) + (while (< (- (-> self clock frame-counter) gp-0) s5-0) + (suspend) + ) + ) + ) + (let ((gp-1 (-> self lightning spec sound))) + (when gp-1 + (let ((s5-1 (new 'stack-no-clear 'vector))) + (set! (-> s5-1 quad) (-> self offset1 quad)) + (when (and (>= (-> self target-joint1) 0) (< (-> self target-joint1) 256)) + (let* ((s4-0 (handle->process (-> self target1))) + (v1-28 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (if (and v1-28 (nonzero? (-> (the-as process-drawable v1-28) root))) + (set! (-> s5-1 quad) (-> (vector<-cspace! + (new 'stack-no-clear 'vector) + (-> (the-as process-drawable v1-28) node-list data (-> self target-joint1)) + ) + quad + ) + ) + ) + ) + ) + (set! (-> self sound) (the-as uint (sound-play-by-spec (the-as sound-spec gp-1) (new-sound-id) s5-1))) + ) + ) + ) + (let ((v1-33 (-> self lightning)) + (a0-10 1) + ) + (let ((a1-10 (!= a0-10 (-> v1-33 state mode)))) + (case a0-10 + ((3) + (if a1-10 + (set! (-> v1-33 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-33 state start-color) (-> v1-33 spec start-color)) + (set! (-> v1-33 state end-color) (-> v1-33 spec end-color)) + ) + ) + ) + (set! (-> v1-33 state mode) (the-as lightning-mode a0-10)) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (or (zero? (-> self duration)) + (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + ) + (update self) + (suspend) + ) + (let ((f30-0 (-> self lightning spec fade-time))) + (when (< 0.0 f30-0) + (let ((v1-47 (-> self lightning)) + (a0-14 3) + ) + (let ((a1-20 (!= a0-14 (-> v1-47 state mode)))) + (case a0-14 + ((3) + (if a1-20 + (set! (-> v1-47 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-47 state start-color) (-> v1-47 spec start-color)) + (set! (-> v1-47 state end-color) (-> v1-47 spec end-color)) + ) + ) + ) + (set! (-> v1-47 state mode) (the-as lightning-mode a0-14)) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the int f30-0)) + (suspend) + ) + ) + ) + (let ((v1-54 (-> self lightning)) + (a0-17 0) + ) + (let ((a1-30 (!= a0-17 (-> v1-54 state mode)))) + (case a0-17 + ((3) + (if a1-30 + (set! (-> v1-54 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-54 state start-color) (-> v1-54 spec start-color)) + (set! (-> v1-54 state end-color) (-> v1-54 spec end-color)) + ) + ) + ) + (set! (-> v1-54 state mode) (the-as lightning-mode a0-17)) + ) + (notify-parent-of-death self) + (suspend) + 0 + (none) + ) + ) + +;; definition for function lightning-tracker-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior lightning-tracker-init lightning-tracker ((arg0 lightning-spec) (arg1 time-frame) (arg2 symbol) (arg3 process-drawable) (arg4 vector) (arg5 vector)) + (stack-size-set! (-> self main-thread) 128) + (set! (-> self target0) (process->handle arg3)) + (let ((s1-1 (ppointer->process (-> self parent)))) + (set! (-> self target1) (process->handle (the-as process (if (type? s1-1 process-drawable) + s1-1 + ) + ) + ) + ) + ) + (cond + ((>= 256 (the-as int arg4)) + (set! (-> self target-joint0) (the-as int arg4)) + (vector-identity! (-> self offset0)) + ) + (else + (set! (-> self target-joint0) -1) + (set! (-> self offset0 quad) (-> arg4 quad)) + ) + ) + (cond + ((>= 256 (the-as int arg5)) + (set! (-> self target-joint1) (the-as int arg5)) + (vector-identity! (-> self offset1)) + ) + (else + (set! (-> self target-joint1) -1) + (set! (-> self offset1 quad) (-> arg5 quad)) + ) + ) + (set! (-> self root) (new 'process 'trsqv)) + (set! (-> self callback) (the-as (function lightning-tracker none) arg2)) + (set! arg1 + (cond + ((> arg1 0) + (empty) + arg1 + ) + ((= arg1 -1) + 0 + ) + (else + (the-as + time-frame + (the int (rand-vu-float-range (-> arg0 duration) (+ (-> arg0 duration) (-> arg0 duration-rand)))) + ) + ) + ) + ) + (set! (-> self duration) (the-as uint arg1)) + (set! (-> self lightning) (new 'process 'lightning-control arg0 self 0.0)) + (let ((v1-21 (-> self lightning)) + (a0-17 0) + ) + (let ((a1-7 (!= a0-17 (-> v1-21 state mode)))) + (case a0-17 + ((3) + (if a1-7 + (set! (-> v1-21 state counter) 0.0) + ) + ) + ((1) + (set! (-> v1-21 state start-color) (-> v1-21 spec start-color)) + (set! (-> v1-21 state end-color) (-> v1-21 spec end-color)) + ) + ) + ) + (set! (-> v1-21 state mode) (the-as lightning-mode a0-17)) + ) + (go-virtual active) + (none) + ) + +;; definition for function process-grab? +;; WARN: Return type mismatch object vs symbol. +(defbehavior process-grab? process ((arg0 process) (arg1 symbol)) + (let ((a0-1 (command-get-process arg0 *target*))) + (the-as symbol (if a0-1 + (send-event a0-1 'change-mode 'grab (cond + ((= arg1 #t) + #f + ) + ((= arg1 'dead) + 'dead + ) + (else + #t + ) + ) + ) + ) + ) + ) + ) + +;; definition for function process-release? +;; WARN: Return type mismatch object vs symbol. +(defbehavior process-release? process ((arg0 process)) + (let* ((gp-0 (command-get-process arg0 *target*)) + (a0-2 (if (type? gp-0 process-focusable) + (the-as process-focusable gp-0) + ) + ) + ) + (the-as symbol (if (and a0-2 (logtest? (-> a0-2 focus-status) (focus-status grabbed))) + (send-event a0-2 'end-mode) + #t + ) + ) + ) + ) + +;; definition for function camera-look-at +(defun camera-look-at ((arg0 pair) (arg1 uint)) + (let ((gp-0 (command-get-process arg0 *target*))) + (if gp-0 + (send-event *camera* 'change-target gp-0 arg1) + ) + gp-0 + ) + ) + +;; definition for function ja-anim-done? +;; WARN: Return type mismatch object vs symbol. +(defun ja-anim-done? ((arg0 process)) + (with-pp + (let ((gp-0 (command-get-process arg0 *target*))) + (the-as + symbol + (when gp-0 + (cond + ((type? gp-0 manipy) + (send-event gp-0 'query 'done) + ) + ((type? gp-0 process-drawable) + (when (not (logtest? (-> (the-as process-drawable gp-0) skel status) (joint-control-status spooling-not-last-block)) + ) + (let ((s5-0 pp)) + (set! pp gp-0) + (let ((v0-1 (the-as object (ja-done? 0)))) + (set! pp s5-0) + v0-1 + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + +;; definition for function camera-pov-from +;; WARN: Return type mismatch target vs process. +(defun camera-pov-from ((arg0 pair) (arg1 uint)) + (let ((gp-0 (the-as target (command-get-process arg0 *target*)))) + (when gp-0 + (when (= arg1 -10) + (set! arg1 (the-as uint 0)) + (when (> (-> gp-0 skel active-channels) 0) + (let ((v1-7 (get-art-by-name-method (-> gp-0 draw jgeo) "camera" (the-as type #f)))) + (if v1-7 + (set! arg1 (the-as uint (+ (-> (the-as joint v1-7) number) 1))) + ) + ) + ) + ) + (let ((v1-9 (process->ppointer gp-0))) + (set-setting! 'pov-handle (the-as joint v1-9) (the float arg1) (-> (the-as (pointer process) v1-9) 0 pid)) + ) + ) + (the-as process gp-0) + ) + ) + +;; definition of type med-res-level +(deftype med-res-level (process-drawable) + ((level-name basic :offset-assert 200) + (part-mode basic :offset-assert 204) + (index int32 :offset-assert 208) + ) + :heap-base #x60 + :method-count-assert 21 + :size-assert #xd4 + :flag-assert #x15006000d4 + (:methods + (idle () _type_ :state 20) + ) + ) + +;; definition for method 3 of type med-res-level +(defmethod inspect med-res-level ((obj med-res-level)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tlevel-name: ~A~%" (-> obj level-name)) + (format #t "~2Tpart-mode: ~A~%" (-> obj part-mode)) + (format #t "~2Tindex: ~D~%" (-> obj index)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defstate idle (med-res-level) + :virtual #t + :code (behavior () + (until #f + (let ((v1-1 (level-get *level* (the-as symbol (-> self level-name))))) + (cond + ((and v1-1 (= (-> v1-1 display?) 'special)) + (logclear! (-> self draw status) (draw-control-status no-draw)) + (if (nonzero? (-> self skel)) + (ja :num! (loop!)) + ) + ) + ((and v1-1 (= (-> v1-1 status) 'active)) + (logior! (-> self draw status) (draw-control-status no-draw)) + ) + (else + (logclear! (-> self draw status) (draw-control-status no-draw)) + (if (nonzero? (-> self skel)) + (ja :num! (loop!)) + ) + ) + ) + ) + (suspend) + ) + #f + (none) + ) + :post (the-as (function none :behavior med-res-level) ja-post) + ) + +;; definition for method 11 of type med-res-level +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! med-res-level ((obj med-res-level) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (res-lump-struct arg0 'art-name structure)) + (s3-0 (res-lump-struct (-> obj entity) 'level structure)) + (v1-5 (res-lump-value (-> obj entity) 'index uint128 :time -1000000000.0)) + ) + (when s3-0 + (set! (-> obj level-name) (the-as basic s3-0)) + (set! (-> obj index) (the-as int v1-5)) + (set! (-> obj root) (new 'process 'trsqv)) + (process-drawable-from-entity! obj arg0) + (logclear! (-> obj mask) (process-mask actor-pause)) + (initialize-skeleton-by-name obj (the-as string s4-0)) + (logior! (-> obj draw status) (draw-control-status no-closest-distance)) + (if (nonzero? (-> obj draw)) + (go (method-of-object obj idle)) + ) + ) + ) + (none) + ) + +;; definition for method 10 of type part-spawner +(defmethod deactivate part-spawner ((obj part-spawner)) + (if (nonzero? (-> obj part)) + (kill-and-free-particles (-> obj part)) + ) + (if (nonzero? (-> obj sound)) + (stop! (-> obj sound)) + ) + ((method-of-type process deactivate) obj) + (none) + ) + +;; definition for method 15 of type part-spawner +(defmethod is-in-view? part-spawner ((obj part-spawner)) + (sphere<-vector+r! (-> obj world-sphere) (-> obj root trans) (-> obj radius)) + (sphere-in-view-frustum? (-> obj world-sphere)) + ) + +;; failed to figure out what this is: +(defstate active (part-spawner) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('stop) + (process-entity-status! self (entity-perm-status subtask-complete) #t) + (set! (-> self enable) #f) + #t + ) + (('start) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (set! (-> self enable) #t) + #t + ) + (('trans) + (let ((v0-1 (the-as object (-> (the-as vector (-> event param 0)) quad)))) + (set! (-> self root trans quad) (the-as uint128 v0-1)) + v0-1 + ) + ) + ) + ) + :code (behavior () + (until #f + (when (-> self enable) + (spawn (-> self part) (-> self root trans)) + (if (nonzero? (-> self sound)) + (update! (-> self sound)) + ) + ) + (suspend) + ) + #f + (none) + ) + ) + +;; definition for method 11 of type part-spawner +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! part-spawner ((obj part-spawner) (arg0 entity-actor)) + (local-vars (sv-16 string)) + (stack-size-set! (-> obj main-thread) 128) + (set! (-> obj mask) (logior (process-mask ambient) (-> obj mask))) + (set! (-> obj clock) (-> *display* part-clock)) + (set! (-> obj root) (new 'process 'trsqv)) + (set! (-> obj root trans quad) (-> arg0 extra trans quad)) + (quaternion-copy! (-> obj root quat) (-> arg0 quat)) + (vector-identity! (-> obj root scale)) + (set! (-> obj radius) 12288.0) + (set! (-> obj enable) + (not (and (-> obj entity) (logtest? (-> obj entity extra perm status) (entity-perm-status subtask-complete)))) + ) + (set! (-> obj sound) (new 'process 'ambient-sound (-> obj entity) (-> obj root trans))) + (set! sv-16 "#f") + (set! (-> obj mode) + (the-as (pointer sparticle-launch-group) (entity-lookup-part-group arg0 (& sv-16) 'art-name)) + ) + (when (-> obj mode) + (let ((a0-15 (-> obj mode 0))) + (when (and (nonzero? a0-15) (= (-> a0-15 type) sparticle-launch-group)) + (cond + ((logtest? (-> a0-15 flags) (sp-group-flag unk-8)) + (countdown (v1-27 (-> a0-15 length)) + (let* ((a1-8 (-> a0-15 launcher v1-27)) + (a3-2 (-> *part-id-table* (-> a1-8 launcher))) + ) + (when (nonzero? a3-2) + (let ((a2-7 (-> obj level part-engine))) + (when (and a2-7 (< (-> a2-7 length) (-> a2-7 allocated-length))) + (let ((t0-7 (-> a2-7 data (-> a2-7 length)))) + (set! (-> t0-7 next1) (the-as connectable a3-2)) + (set! (-> t0-7 prev1) (the-as connectable (-> a1-8 hour-mask))) + (set! (-> (the-as vector (&-> t0-7 param0)) quad) (-> obj root trans quad)) + (set! (-> t0-7 param3) (the-as int (-> a1-8 fade-after))) + ) + (+! (-> a2-7 length) 1) + ) + ) + ) + ) + ) + (process-entity-status! obj (entity-perm-status dead) #t) + (deactivate obj) + ) + (else + (set! (-> obj part) (create-launch-control a0-15 obj)) + (go (method-of-object obj active)) + ) + ) + ) + ) + ) + (go process-drawable-art-error sv-16) + (none) + ) + +;; definition of type launcher +(deftype launcher (process-drawable) + ((root-override collide-shape :offset 128) + (spring-height meters :offset-assert 200) + (camera state :offset-assert 204) + (active-distance float :offset-assert 208) + (seek-time time-frame :offset-assert 216) + (dest vector :inline :offset-assert 224) + (sound-id sound-id :offset-assert 240) + ) + :heap-base #x80 + :method-count-assert 23 + :size-assert #xf4 + :flag-assert #x17008000f4 + (:methods + (idle () _type_ :state 20) + (active () _type_ :state 21) + (deactivated () _type_ :state 22) + ) + ) + +;; definition for method 3 of type launcher +(defmethod inspect launcher ((obj launcher)) + (when (not obj) + (set! obj obj) + (goto cfg-4) + ) + (let ((t9-0 (method-of-type process-drawable inspect))) + (t9-0 obj) + ) + (format #t "~2Tspring-height: (meters ~m)~%" (-> obj spring-height)) + (format #t "~2Tcamera: ~A~%" (-> obj camera)) + (format #t "~2Tactive-distance: ~f~%" (-> obj active-distance)) + (format #t "~2Tseek-time: ~D~%" (-> obj seek-time)) + (format #t "~2Tdest: ~`vector`P~%" (-> obj dest)) + (format #t "~2Tsound-id: ~D~%" (-> obj sound-id)) + (label cfg-4) + obj + ) + +;; failed to figure out what this is: +(defpartgroup group-beach-launcher + :id 6 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 78 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 79 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 80 :fade-after (meters 50) :falloff-to (meters 80)) + (sp-item 81 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +;; failed to figure out what this is: +(defpart 77 + :init-specs ((sp-flt spt-num 1.5) + (sp-flt spt-x (meters 1.5)) + (sp-flt spt-y (meters -0.5)) + (sp-int spt-rot-x 5) + (sp-flt spt-r 4096.0) + (sp-flt spt-g 2867.2) + (sp-flt spt-b 3276.8) + (sp-flt spt-vel-y (meters 0.026666667)) + (sp-int spt-timer 270) + (sp-cpuinfo-flags distort) + (sp-int spt-next-time 180) + (sp-launcher-by-id spt-next-launcher 82) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 82 + :init-specs ((sp-flt spt-fade-b -4.551111)) + ) + +;; failed to figure out what this is: +(defpart 78 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 1.8) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 79 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.8) (meters 1) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 80 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #x2f :page #xc)) + (sp-flt spt-num 1.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 0.3) (meters 0.4) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.1) (meters 0.1) 1.0) + (sp-rnd-flt spt-r 10.0 6.0 1.0) + (sp-rnd-flt spt-g 64.0 128.0 1.0) + (sp-rnd-flt spt-b 10.0 6.0 1.0) + (sp-flt spt-a 80.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a -0.2) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int-plain-rnd spt-timer 180 119 1) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 81 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 32.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 83 + :init-specs ((sp-flt spt-fade-a -0.18)) + ) + +;; failed to figure out what this is: +(defpartgroup group-jungle-launcher + :id 7 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 84 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 85 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 86 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +;; failed to figure out what this is: +(defpart 84 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 1.0) + (sp-rnd-flt spt-x (meters 0) (meters 1.4) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 2.5) (meters 2.5) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.24414062) (meters 0.48828125) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 85 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :index #xc9 :page #xc)) + (sp-flt spt-num 2.0) + (sp-rnd-flt spt-x (meters 1.4) (meters 0.9) 1.0) + (sp-flt spt-scale-x (meters 0.2)) + (sp-flt spt-rot-x 16384.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-rnd-flt spt-scale-y (meters 0.5) (meters 1) 1.0) + (sp-rnd-int spt-r 0 1 128.0) + (sp-rnd-flt spt-g 64.0 196.0 1.0) + (sp-rnd-flt spt-b 128.0 128.0 1.0) + (sp-flt spt-a 128.0) + (sp-flt spt-scalevel-x (meters -0.0025)) + (sp-rnd-flt spt-scalevel-y (meters 0.048828125) (meters 0.09765625) 1.0) + (sp-int spt-timer 81) + (sp-cpuinfo-flags sp-cpuinfo-flag-3) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpart 86 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 64.0 32.0 1.0) + (sp-rnd-flt spt-g 32.0 32.0 1.0) + (sp-rnd-flt spt-b 10.0 5.0 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2 sp-cpuinfo-flag-3) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; failed to figure out what this is: +(defpartgroup group-swamp-launcher + :id 8 + :bounds (static-bspherem 0 3 0 5) + :parts ((sp-item 77 :fade-after (meters 100) :falloff-to (meters 100)) + (sp-item 78 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 79 :fade-after (meters 70) :falloff-to (meters 100) :flags (is-3d)) + (sp-item 87 :fade-after (meters 70) :falloff-to (meters 100)) + ) + ) + +;; failed to figure out what this is: +(defpart 87 + :init-specs ((sp-tex spt-texture (new 'static 'texture-id :page #xc)) + (sp-flt spt-num 0.5) + (sp-rnd-flt spt-x (meters 2.9) (meters 2.5) 1.0) + (sp-flt spt-y (meters -0.5)) + (sp-rnd-flt spt-scale-x (meters 2) (meters 1) 1.0) + (sp-rnd-flt spt-rot-z (degrees 0.0) (degrees 360.0) 1.0) + (sp-copy-from-other spt-scale-y -4) + (sp-rnd-flt spt-r 16.0 16.0 1.0) + (sp-rnd-flt spt-g 16.0 16.0 1.0) + (sp-rnd-flt spt-b 5.0 2.5 1.0) + (sp-flt spt-a 0.0) + (sp-rnd-flt spt-vel-x (meters -0.011666667) (meters -0.0033333334) 1.0) + (sp-flt spt-vel-y (meters 0)) + (sp-rnd-int-flt spt-rotvel-z (degrees -1.2) 1 436.90668) + (sp-flt spt-fade-a 0.6) + (sp-flt spt-accel-y 6.826667) + (sp-flt spt-friction 0.996) + (sp-int spt-timer 270) + (sp-cpuinfo-flags sp-cpuinfo-flag-2) + (sp-int spt-next-time 45) + (sp-launcher-by-id spt-next-launcher 83) + (sp-rnd-flt spt-rotate-y (degrees 0.0) (degrees 360.0) 1.0) + ) + ) + +;; definition for function cam-launcher-joystick +;; INFO: Used lq/sq +(defbehavior cam-launcher-joystick camera-slave () + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((s5-0 (new-stack-matrix0)) + (gp-0 (vector-reset! (new 'stack-no-clear 'vector))) + ) + (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + (f0-1 (* -546.13336 f0-0)) + (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) + ) + (matrix-axis-angle! s5-0 (-> *camera* local-down) f0-3) + ) + (vector-! gp-0 (-> self trans) (-> *camera* tpos-curr)) + (vector-matrix*! gp-0 gp-0 s5-0) + (vector+! (-> self trans) gp-0 (-> *camera* tpos-curr)) + ) + ) + ) + +;; failed to figure out what this is: +(defstate cam-launcher-shortfall (camera-slave) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (if (= v1-0 'teleport) + #f + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (let ((gp-0 (new 'stack-no-clear 'vector))) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector-flatten! gp-0 (-> self tracking inv-mat vector 2) (-> *camera* local-down)) + (vector-normalize! gp-0 1.0) + (set! (-> self pivot-pt quad) (-> gp-0 quad)) + (vector+float*! gp-0 gp-0 (-> *camera* local-down) 1000.0) + (vector-normalize-copy! (-> self tracking inv-mat vector 2) gp-0 1.0) + ) + (vector-cross! + (-> self tracking inv-mat vector 1) + (-> self tracking inv-mat vector 2) + (the-as vector (-> self tracking)) + ) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + 0 + ) + (none) + ) + :trans (behavior () + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (cam-slave-go cam-free-floating) + ) + (none) + ) + :code (behavior () + (let ((gp-0 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (send-event *camera* 'teleport) + (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (send-event *camera* 'change-state cam-string (seconds 0.5)) + ) + ) + (suspend) + ) + ) + #f + (none) + ) + ) + +;; definition for function cam-launcher-long-joystick +;; INFO: Used lq/sq +(defbehavior cam-launcher-long-joystick camera-slave () + (when (not (logtest? (-> *camera* settings master-options) (cam-master-options IGNORE_ANALOG))) + (let ((gp-0 (new-stack-matrix0))) + (let* ((f0-0 (analog-input (the-as int (+ (-> *cpad-list* cpads 0 rightx) -128)) 0.0 48.0 110.0 -1.0)) + (f0-1 (* -546.13336 f0-0)) + (f0-3 (fmin 546.13336 (fmax -546.13336 f0-1))) + ) + (matrix-axis-angle! gp-0 (-> *camera* local-down) f0-3) + ) + (vector-matrix*! (-> self view-flat) (-> self view-flat) gp-0) + ) + (vector-normalize! (-> self view-flat) 4096.0) + ) + ) + +;; failed to figure out what this is: +(defstate cam-launcher-longfall (camera-slave) + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (let ((v1-0 event-type)) + (the-as object (if (= v1-0 'teleport) + #f + (the-as symbol (cam-standard-event-handler proc arg1 event-type event)) + ) + ) + ) + ) + :enter (behavior () + (when (not (-> self enter-has-run)) + (new 'stack-no-clear 'vector) + (vector-negate! (-> self view-flat) (-> self tracking inv-mat vector 2)) + (vector-normalize! (-> self view-flat) 4096.0) + (vector--float*! (-> self trans) (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (set! (-> self blend-from-type) (the-as uint 0)) + (set! (-> self blend-to-type) (camera-blend-to-type unknown-0)) + (cam-calc-follow! (-> self tracking) (-> self trans) #f) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) + ) + (none) + ) + :trans (behavior () + (if (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (cam-slave-go cam-free-floating) + ) + (cam-launcher-long-joystick) + (none) + ) + :code (behavior () + (let ((gp-0 (-> self clock frame-counter))) + (until #f + (when (not (paused?)) + (let ((s4-0 (new 'stack-no-clear 'vector)) + (s5-0 (new 'stack-no-clear 'vector)) + ) + 0.0 + 0.0 + 0.0 + (send-event *camera* 'teleport) + (let* ((f0-4 (vector-dot (-> self velocity) (-> *camera* local-down))) + (f30-0 (* 0.975 f0-4)) + ) + (vector--float*! s4-0 (-> *camera* tpos-curr) (-> *camera* local-down) 28672.0) + (vector-! s4-0 s4-0 (-> self trans)) + (let ((f28-0 (vector-dot s4-0 (-> *camera* local-down)))) + (vector--float*! s5-0 s4-0 (-> *camera* local-down) f28-0) + (cond + ((< f28-0 f30-0) + (set! f30-0 f28-0) + ) + ((< 20480.0 f28-0) + (let ((f28-1 (+ -20480.0 f28-0))) + (let ((f0-8 (lerp f30-0 f28-1 0.005))) + (if (< f30-0 f0-8) + (set! f30-0 f0-8) + ) + ) + (if (< (* 0.09 f28-1) f30-0) + (set! f30-0 (* 0.09 f28-1)) + ) + ) + ) + ) + ) + (vector+float*! (-> self velocity) s5-0 (-> *camera* local-down) f30-0) + ) + ) + (vector+! (-> self trans) (-> self trans) (-> self velocity)) + (set! (-> self trans x) (-> *camera* tpos-curr x)) + (set! (-> self trans z) (-> *camera* tpos-curr z)) + (vector+! (-> self trans) (-> self trans) (-> self view-flat)) + (if (and (-> *camera* on-ground) (>= (- (-> self clock frame-counter) gp-0) (seconds 1))) + (send-event *camera* 'change-state cam-string (seconds 0.5)) + ) + ) + (vector-reset! (-> self tracking follow-off)) + (vector+! (-> self tracking follow-pt) (-> *camera* tpos-curr-adj) (-> self tracking follow-off)) + (vector--float*! + (-> self tracking follow-pt) + (-> self tracking follow-pt) + (-> *camera* local-down) + (-> *camera* settings target-height) + ) + (slave-set-rotation! (-> self tracking) (-> self trans) (-> self options) (-> self fov) #f) + (suspend) + ) + ) + #f + (none) + ) + ) + +;; failed to figure out what this is: +(defstate idle (launcher) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (the-as object (case event-type + (('instant-death) + (go-virtual deactivated) + ) + (('trans) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) + (the-as object (update-transforms (-> self root-override))) + ) + ) + ) + ) + :trans (behavior () + (when (and *target* (and (>= (-> self active-distance) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (cond + ((send-event *target* 'query 'powerup (pickup-type eco-blue)) + (go-virtual active) + ) + (else + (let ((gp-0 'target-launch)) + (if (= (send-event *target* 'query 'mode) gp-0) + (send-event *target* 'end-mode) + ) + ) + ) + ) + (if (and (and *target* + (and (>= 32768.0 (vector-vector-distance (-> self root-override trans) (-> *target* control trans))) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + ) + (talker-spawn-func (-> *talker-speech* 322) *entity-pool* (target-pos 0) (the-as region #f)) + ) + ) + (none) + ) + :code (the-as (function none :behavior launcher) sleep-code) + ) + +;; failed to figure out what this is: +(defstate active (launcher) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (when (or (= event-type 'touch) (= event-type 'attack)) + (set! (-> self state-time) (-> self clock frame-counter)) + (send-event proc 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) + ) + (the-as object (cond + ((= event-type 'instant-death) + (go-virtual deactivated) + ) + ((= event-type 'trans) + (move-to-point! (-> self root-override) (the-as vector (-> event param 0))) + (the-as object (update-transforms (-> self root-override))) + ) + ) + ) + ) + :exit (behavior () + (let ((v1-0 (the-as sound-rpc-set-param (get-sound-buffer-entry)))) + (set! (-> v1-0 command) (sound-command set-param)) + (set! (-> v1-0 id) (-> self sound-id)) + (set! (-> v1-0 params volume) -4) + (set! (-> v1-0 auto-time) 120) + (set! (-> v1-0 auto-from) 2) + (set! (-> v1-0 params mask) (the-as uint 17)) + (-> v1-0 id) + ) + (none) + ) + :trans (behavior () + (if (or (or (not *target*) (or (< (-> self active-distance) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (logtest? (focus-status teleporting) (-> *target* focus-status)) + ) + ) + (not (send-event *target* 'query 'powerup (pickup-type eco-blue))) + ) + (go-virtual idle) + ) + (spawn (-> self part) (-> self root-override trans)) + (sound-play "launch-idle" :id (-> self sound-id)) + (if (and (and *target* (and (>= (+ 2867.2 (-> self root-override root-prim prim-core world-sphere w)) + (vector-vector-distance (-> self root-override trans) (-> *target* control trans)) + ) + (zero? (logand (focus-status teleporting) (-> *target* focus-status))) + ) + ) + (< (- (-> self clock frame-counter) (-> self state-time)) (seconds 0.5)) + ) + (send-event *target* 'launch (-> self spring-height) (-> self camera) (-> self dest) (-> self seek-time)) + ) + (none) + ) + :code (behavior () + (sound-play "launch-start") + (sleep-code) + (none) + ) + ) + +;; failed to figure out what this is: +(defstate deactivated (launcher) + :virtual #t + :code (the-as (function none :behavior launcher) sleep-code) + ) + +;; definition for method 11 of type launcher +;; WARN: Return type mismatch object vs none. +(defmethod init-from-entity! launcher ((obj launcher) (arg0 entity-actor)) + (stack-size-set! (-> obj main-thread) 128) + (let ((s4-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-4) + ) + (set! (-> s4-0 nav-radius) 13926.4) + (let ((v1-6 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> obj root-override) s4-0) + ) + (process-drawable-from-entity! obj arg0) + (update-transforms (-> obj root-override)) + (set! (-> obj active-distance) 409600.0) + (set! (-> obj spring-height) (res-lump-float arg0 'spring-height :default 163840.0)) + (let ((s4-1 (res-lump-value arg0 'mode uint128 :time -1000000000.0))) + (let ((v1-14 (-> obj level name))) + (set! (-> obj part) (create-launch-control + (cond + ((= v1-14 'beach) + (-> *part-group-id-table* 6) + ) + ((= v1-14 'swamp) + (-> *part-group-id-table* 8) + ) + (else + (-> *part-group-id-table* 7) + ) + ) + obj + ) + ) + ) + (let ((v1-20 (logand (the-as int s4-1) 255))) + (cond + ((= (the-as uint v1-20) 1) + (set! (-> obj camera) cam-launcher-longfall) + ) + ((= (the-as uint v1-20) 2) + (set! (-> obj camera) #f) + ) + (else + (set! (-> obj camera) cam-launcher-shortfall) + ) + ) + ) + ) + (let ((v1-25 (res-lump-struct arg0 'alt-vector vector))) + (when v1-25 + (set-vector! (-> obj dest) (-> v1-25 x) (-> v1-25 y) (-> v1-25 z) 1.0) + (set! (-> obj seek-time) (the-as time-frame (the int (* 300.0 (-> v1-25 w))))) + ) + ) + (set! (-> obj sound-id) (new-sound-id)) + (nav-mesh-connect-from-ent (the-as entity-nav-mesh obj)) + (go (method-of-object obj idle)) + (none) + ) + +;; definition for function launcher-init-by-other +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior launcher-init-by-other launcher ((arg0 vector) (arg1 float) (arg2 int) (arg3 float)) + (stack-size-set! (-> self main-thread) 128) + (let ((s2-0 (new 'process 'collide-shape self (collide-list-enum hit-by-player)))) + (let ((v1-4 (new 'process 'collide-shape-prim-sphere s2-0 (the-as uint 0)))) + (set! (-> v1-4 prim-core collide-as) (collide-spec enemy)) + (set! (-> v1-4 prim-core collide-with) (collide-spec jak player-list)) + (set-vector! (-> v1-4 local-sphere) 0.0 0.0 0.0 12288.0) + (set! (-> s2-0 total-prims) (the-as uint 1)) + (set! (-> s2-0 root-prim) v1-4) + ) + (set! (-> s2-0 nav-radius) (* 0.75 (-> s2-0 root-prim local-sphere w))) + (let ((v1-7 (-> s2-0 root-prim))) + (set! (-> s2-0 backup-collide-as) (-> v1-7 prim-core collide-as)) + (set! (-> s2-0 backup-collide-with) (-> v1-7 prim-core collide-with)) + ) + (set! (-> self root-override) s2-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set-vector! (-> self root-override scale) 1.0 1.0 1.0 1.0) + (set-vector! (-> self root-override quat) 0.0 0.0 0.0 1.0) + (update-transforms (-> self root-override)) + (set! (-> self spring-height) arg1) + (set! (-> self active-distance) arg3) + (let ((v1-18 (-> self level name))) + (set! (-> self part) (create-launch-control + (cond + ((= v1-18 'beach) + (-> *part-group-id-table* 6) + ) + ((= v1-18 'swamp) + (-> *part-group-id-table* 8) + ) + (else + (-> *part-group-id-table* 7) + ) + ) + self + ) + ) + ) + (case (logand arg2 255) + ((1) + (set! (-> self camera) cam-launcher-longfall) + ) + ((2) + (set! (-> self camera) #f) + ) + (else + (set! (-> self camera) cam-launcher-shortfall) + ) + ) + (let ((v1-29 (res-lump-struct (-> self entity) 'alt-vector vector))) + (when v1-29 + (set-vector! (-> self dest) (-> v1-29 x) (-> v1-29 y) (-> v1-29 z) 1.0) + (set! (-> self seek-time) (the-as time-frame (the int (* 300.0 (-> v1-29 w))))) + ) + ) + (set! (-> self sound-id) (new-sound-id)) + (go-virtual idle) + (none) + ) + +;; failed to figure out what this is: +(defstate active (touch-tracker) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (local-vars (v0-0 object)) + (case event-type + (('touched) + (let ((v1-1 (ppointer->process (-> self parent)))) + (when (!= v1-1 proc) + (cond + ((= (-> self event) 'attack) + (let ((a1-1 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-1 from) (process->ppointer v1-1)) + (set! (-> a1-1 num-params) 2) + (set! (-> a1-1 message) (-> self event)) + (set! (-> a1-1 param 0) (the-as uint #f)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 mode) (the-as symbol (-> self event-mode))) + (let* ((a2-3 *game-info*) + (a3-2 (+ (-> a2-3 attack-id) 1)) + ) + (set! (-> a2-3 attack-id) a3-2) + (set! (-> v1-5 id) a3-2) + ) + (set! (-> a1-1 param 1) (the-as uint v1-5)) + ) + (send-event-function proc a1-1) + ) + ) + ((-> self event) + (send-event proc (-> self event) :from v1-1) + ) + (else + (let ((t0-5 (new 'stack-no-clear 'event-message-block))) + (set! (-> t0-5 from) (process->ppointer proc)) + (set! (-> t0-5 num-params) arg1) + (set! (-> t0-5 message) event-type) + (set! (-> t0-5 param 0) (-> event param 0)) + (set! (-> t0-5 param 1) (-> event param 1)) + (set! (-> t0-5 param 2) (-> event param 2)) + (set! (-> t0-5 param 3) (-> event param 3)) + (set! (-> t0-5 param 4) (-> event param 4)) + (set! (-> t0-5 param 5) (-> event param 5)) + (send-event-function v1-1 t0-5) + ) + ) + ) + ) + ) + ) + (('target) + (set! v0-0 (process->handle (the-as process (-> event param 0)))) + (set! (-> self target) (the-as handle v0-0)) + v0-0 + ) + (('event) + (set! (-> self event) (the-as symbol (-> event param 0))) + (set! v0-0 (-> event param 1)) + (set! (-> self event-mode) (the-as basic v0-0)) + v0-0 + ) + (('exit) + (set! v0-0 (-> event param 0)) + (set! (-> self run-function) (the-as (function object) v0-0)) + v0-0 + ) + (('eval) + ((the-as (function touch-tracker object) (-> event param 0)) self) + ) + (('function) + (set! v0-0 (-> event param 0)) + (set! (-> self callback) (the-as (function touch-tracker none) v0-0)) + v0-0 + ) + ) + ) + :code (behavior () + (set! (-> self state-time) (-> self clock frame-counter)) + (while ((-> self run-function)) + (let* ((gp-0 (handle->process (-> self target))) + (a0-4 (if (type? gp-0 process-drawable) + gp-0 + ) + ) + ) + (when a0-4 + (let* ((gp-1 (-> (the-as process-drawable a0-4) root)) + (a0-6 (if (type? gp-1 collide-shape) + gp-1 + ) + ) + ) + (if a0-6 + (set! (-> self root-override trans quad) + (-> (the-as collide-shape a0-6) root-prim prim-core world-sphere quad) + ) + ) + ) + ) + ) + (if (-> self callback) + ((-> self callback) self) + ) + (update-transforms (-> self root-override)) + (let ((a1-3 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-3 options) (overlaps-others-options oo1)) + (set! (-> a1-3 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-3 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-3) + ) + (suspend) + ) + (let ((v1-21 (-> self root-override root-prim))) + (set! (-> v1-21 prim-core collide-as) (collide-spec)) + (set! (-> v1-21 prim-core collide-with) (collide-spec)) + ) + 0 + (suspend) + 0 + (none) + ) + ) + +;; definition for function touch-tracker-init +;; INFO: Used lq/sq +;; WARN: Return type mismatch object vs none. +(defbehavior touch-tracker-init touch-tracker ((arg0 vector) (arg1 float) (arg2 time-frame)) + (let ((s4-0 (new 'process 'collide-shape-moving self (collide-list-enum hit-by-player)))) + (set! (-> s4-0 dynam) (copy *standard-dynamics* 'process)) + (set! (-> s4-0 reaction) cshape-reaction-default) + (set! (-> s4-0 no-reaction) + (the-as (function collide-shape-moving collide-query vector vector object) nothing) + ) + (let ((v1-6 (new 'process 'collide-shape-prim-sphere s4-0 (the-as uint 0)))) + (set! (-> v1-6 prim-core collide-as) (collide-spec jak enemy)) + (set! (-> v1-6 prim-core collide-with) (collide-spec + crate + civilian + enemy + obstacle + vehicle-sphere + hit-by-player-list + hit-by-others-list + collectable + pusher + ) + ) + (set-vector! (-> v1-6 local-sphere) 0.0 0.0 0.0 arg1) + (set! (-> s4-0 total-prims) (the-as uint 1)) + (set! (-> s4-0 root-prim) v1-6) + ) + (set! (-> s4-0 nav-radius) (* 0.75 (-> s4-0 root-prim local-sphere w))) + (let ((v1-9 (-> s4-0 root-prim))) + (set! (-> s4-0 backup-collide-as) (-> v1-9 prim-core collide-as)) + (set! (-> s4-0 backup-collide-with) (-> v1-9 prim-core collide-with)) + ) + (set! (-> s4-0 event-self) 'touched) + (set! (-> self root-override) s4-0) + ) + (set! (-> self root-override trans quad) (-> arg0 quad)) + (set! (-> self duration) arg2) + (set! (-> self target) (the-as handle #f)) + (set! (-> self event) #f) + (set! (-> self callback) #f) + (set! (-> self run-function) (lambda :behavior touch-tracker + () + (< (- (-> self clock frame-counter) (-> self state-time)) (-> self duration)) + ) + ) + (set! (-> self event-hook) (-> (method-of-object self active) event)) + (go-virtual active) + (none) + ) + +;; definition for method 21 of type explosion +;; WARN: Return type mismatch int vs none. +(defmethod setup-explosion-collision explosion ((obj explosion)) + (let ((s5-0 (new 'process 'collide-shape obj (collide-list-enum hit-by-player)))) + (set! (-> s5-0 penetrate-using) (penetrate explode)) + (let ((v1-3 (new 'process 'collide-shape-prim-sphere s5-0 (the-as uint 0)))) + (set! (-> v1-3 prim-core action) (collide-action solid)) + (set-vector! (-> v1-3 local-sphere) 0.0 0.0 0.0 0.0) + (set! (-> s5-0 total-prims) (the-as uint 1)) + (set! (-> s5-0 root-prim) v1-3) + ) + (set! (-> s5-0 nav-radius) (* 0.75 (-> s5-0 root-prim local-sphere w))) + (let ((v1-6 (-> s5-0 root-prim))) + (set! (-> s5-0 backup-collide-as) (-> v1-6 prim-core collide-as)) + (set! (-> s5-0 backup-collide-with) (-> v1-6 prim-core collide-with)) + ) + (set! (-> obj root-override) s5-0) + ) + (set! (-> obj root-override event-self) 'touched) + 0 + (none) + ) + +;; definition for method 22 of type explosion +;; WARN: Return type mismatch int vs none. +(defmethod explosion-method-22 explosion ((obj explosion)) + 0 + (none) + ) + +;; definition for function explosion-init-by-other +;; INFO: Used lq/sq +(defbehavior explosion-init-by-other explosion ((arg0 explosion-init-params)) + (logclear! (-> self mask) (process-mask actor-pause movie)) + (setup-explosion-collision self) + (set! (-> self root-override trans quad) (-> arg0 spawn-point quad)) + (quaternion-copy! (-> self root-override quat) (-> arg0 spawn-quat)) + (set! (-> self root-override penetrate-using) (-> arg0 penetrate-using)) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 local-sphere w) (-> arg0 radius)) + (set! (-> v1-9 prim-core world-sphere w) (-> arg0 radius)) + (set! (-> v1-9 prim-core collide-with) (-> arg0 collide-with)) + ) + (let* ((v1-10 *game-info*) + (a0-9 (+ (-> v1-10 attack-id) 1)) + ) + (set! (-> v1-10 attack-id) a0-9) + (set! (-> self attack-id) a0-9) + ) + (let ((a0-10 (-> arg0 group))) + (when a0-10 + (set! (-> self duration) (-> a0-10 duration)) + (set! (-> self linger-duration) (-> a0-10 linger-duration)) + (set! (-> self part) (create-launch-control a0-10 self)) + ) + ) + (let ((v1-16 (new 'stack-no-clear 'traffic-danger-info))) + (set! (-> v1-16 sphere quad) (-> self root-override trans quad)) + (vector-reset! (-> v1-16 velocity)) + (set! (-> v1-16 sphere r) (* 2.0 (-> arg0 radius))) + (set! (-> v1-16 notify-radius) 204800.0) + (set! (-> v1-16 danger-level) 1.0) + (set! (-> v1-16 decay-rate) 0.0) + (set! (-> v1-16 flags) (traffic-danger-flags tdf0)) + (set! (-> v1-16 danger-type) (traffic-danger-type tdt5)) + (send-event *traffic-manager* 'add-danger-sphere v1-16) + ) + (explosion-method-22 self) + (go-virtual explode) + ) + +;; definition for function explosion-spawn +;; WARN: Return type mismatch (pointer process) vs none. +(defun explosion-spawn ((arg0 process-drawable) (arg1 type) (arg2 explosion-init-params)) + (let ((s4-0 (get-process *default-dead-pool* arg1 #x4000))) + (when s4-0 + (let ((t9-1 (method-of-type process activate))) + (t9-1 s4-0 arg0 (symbol->string (-> arg1 symbol)) (the-as pointer #x70004000)) + ) + (run-now-in-process s4-0 explosion-init-by-other arg2) + (-> s4-0 ppointer) + ) + ) + (none) + ) + +;; failed to figure out what this is: +(defstate explode (explosion) + :virtual #t + :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) + (case event-type + (('touched) + (let* ((s4-0 proc) + (v1-1 (if (type? s4-0 process-drawable) + s4-0 + ) + ) + ) + (when v1-1 + (let ((a0-3 (-> (the-as process-drawable v1-1) root)) + (a1-2 (new 'stack-no-clear 'collide-query)) + ) + (let ((v1-4 (-> self root-override root-prim prim-core)) + (a0-5 (-> (the-as collide-shape a0-3) root-prim prim-core)) + ) + 0.0 + (set! (-> a1-2 start-pos quad) (-> v1-4 world-sphere quad)) + (vector-! (-> a1-2 move-dist) (the-as vector a0-5) (the-as vector v1-4)) + ) + (let ((v1-5 a1-2)) + (set! (-> v1-5 radius) 40.96) + (set! (-> v1-5 collide-with) (collide-spec backgnd)) + (set! (-> v1-5 ignore-process0) #f) + (set! (-> v1-5 ignore-process1) #f) + (set! (-> v1-5 ignore-pat) (new 'static 'pat-surface :noentity #x1 :nojak #x1 :probe #x1 :noendlessfall #x1)) + (set! (-> v1-5 action-mask) (collide-action solid)) + ) + (when (< (fill-and-probe-using-line-sphere *collide-cache* a1-2) 0.0) + (let ((a1-3 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-3 from) (process->ppointer self)) + (set! (-> a1-3 num-params) 2) + (set! (-> a1-3 message) 'attack) + (set! (-> a1-3 param 0) (-> event param 0)) + (let ((v1-12 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-12 id) (-> self attack-id)) + (set! (-> v1-12 mode) 'explode) + (set! (-> a1-3 param 1) (the-as uint v1-12)) + ) + (send-event-function proc a1-3) + ) + ) + ) + ) + ) + ) + ) + ) + :code (behavior () + (set! (-> self start-time) (-> self clock frame-counter)) + (update-transforms (-> self root-override)) + (let ((a1-0 (new 'stack-no-clear 'overlaps-others-params))) + (set! (-> a1-0 options) (overlaps-others-options)) + (set! (-> a1-0 collide-with-filter) (the-as collide-spec -1)) + (set! (-> a1-0 tlist) *touching-list*) + (find-overlapping-shapes (-> self root-override) a1-0) + ) + (let ((v1-9 (-> self root-override root-prim))) + (set! (-> v1-9 prim-core collide-as) (collide-spec)) + (set! (-> v1-9 prim-core collide-with) (collide-spec)) + ) + 0 + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self duration))) + (let ((a1-1 (-> self root-override trans))) + (spawn (-> self part) a1-1) + ) + (suspend) + ) + (set! (-> self start-time) (-> self clock frame-counter)) + (while (< (- (-> self clock frame-counter) (-> self start-time)) (the-as time-frame (-> self linger-duration))) + (suspend) + ) + (none) + ) + ) + +;; definition for function process-drawable-random-point! +(defun process-drawable-random-point! ((arg0 process-drawable) (arg1 vector)) + (let ((v1-1 (-> arg0 node-list length)) + (s4-0 (-> arg0 root)) + ) + (cond + ((>= v1-1 7) + (let ((v1-2 (rand-vu-int-range 3 (+ v1-1 -1)))) + (vector<-cspace! arg1 (-> arg0 node-list data v1-2)) + ) + ) + ((and (nonzero? s4-0) (type? s4-0 collide-shape)) + (vector+! + arg1 + (the-as vector (-> (the-as collide-shape s4-0) root-prim prim-core)) + (rand-vu-sphere-point! arg1 (-> (the-as collide-shape s4-0) root-prim prim-core world-sphere w)) + ) + ) + (else + (vector+! arg1 (-> arg0 root trans) (rand-vu-sphere-point! arg1 (-> arg0 draw bounds w))) + ) + ) + ) + arg1 + ) + +;; definition for function process-drawable-pair-random-point! +;; INFO: Used lq/sq +(defun process-drawable-pair-random-point! ((arg0 process-drawable) (arg1 process-drawable) (arg2 vector) (arg3 float)) + (let ((s4-0 (new-stack-vector0)) + (s3-0 (new-stack-vector0)) + ) + (process-drawable-random-point! arg0 s4-0) + (process-drawable-random-point! arg1 s3-0) + (vector-lerp! arg2 s4-0 s3-0 arg3) + ) + ) + + + + diff --git a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc index 60c41c5692..05c625573d 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/voicebox_REF.gc @@ -390,7 +390,10 @@ :event (-> cam-string event) :enter (-> cam-string enter) :trans (behavior () - (if (or (not *camera*) (not (logtest? (-> *camera* master-options) 1)) (not (-> self child))) + (if (or (not *camera*) + (not (logtest? (-> *camera* master-options) (cam-master-options-u32 HAVE_TARGET))) + (not (-> self child)) + ) (deactivate self) ) (none) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc index c46fc6cf24..60859fc835 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water-anim_REF.gc @@ -378,109 +378,107 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 210] (defbehavior water-anim-event-handler water-anim ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) (local-vars (v0-1 none)) - (let ((v1-0 arg2)) - (the-as - object - (cond - ((= v1-0 'move-to) - (move-to-point! self (the-as vector (-> arg3 param 0))) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) - (set! (-> self mask) (the-as process-mask v0-1)) - v0-1 + (the-as + object + (case arg2 + (('move-to) + (move-to-point! self (the-as vector (-> arg3 param 0))) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('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) ) - ((= v1-0 'move-to-y) - (let ((a1-2 (new 'stack-no-clear 'vector))) - (set! (-> a1-2 quad) (-> self root trans quad)) - (set! (-> a1-2 y) (the-as float (-> arg3 param 0))) - (move-to-point! self a1-2) - ) - (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) - (set! (-> self mask) (the-as process-mask v0-1)) - v0-1 - ) - ((= v1-0 'water) - (let* ((s5-0 (the-as object (-> arg3 param 0))) - (s4-0 (the-as object (-> arg3 param 1))) - (gp-0 (if (type? (the-as process s4-0) process-focusable) - (the-as uint s4-0) - ) - ) + (set! v0-1 (the-as none (logclear (-> self mask) (process-mask sleep-code)))) + (set! (-> self mask) (the-as process-mask v0-1)) + v0-1 + ) + (('water) + (let* ((s5-0 (the-as object (-> arg3 param 0))) + (s4-0 (the-as object (-> arg3 param 1))) + (gp-0 (if (type? (the-as process s4-0) process-focusable) + (the-as uint s4-0) + ) + ) + ) + (when (and (logtest? (-> self flags) (water-flags deadly)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + (the-as uint gp-0) + ) + (let ((v1-15 (-> self attack-event))) + (case v1-15 + ((#f) ) - (when (and (logtest? (-> self flags) (water-flags deadly)) - (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) - (the-as uint gp-0) - ) - (let ((v1-15 (-> self attack-event))) - (case v1-15 - ((#f) - ) - (('heat) - (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) - ) - (('drown-death 'lava 'dark-eco-pool) - (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) - (let ((a1-10 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-10 from) (process->ppointer self)) - (set! (-> a1-10 num-params) 2) - (set! (-> a1-10 message) 'attack-invinc) - (set! (-> a1-10 param 0) (the-as uint #f)) - (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> a2-4 id) (-> self attack-id)) - (set! (-> a2-4 mode) v1-15) - (set! (-> a1-10 param 1) (the-as uint a2-4)) - ) - (send-event-function (the-as process-focusable gp-0) a1-10) + (('heat) + (send-event (the-as process-tree gp-0) 'heat (* 10.0 (-> self clock seconds-per-frame))) + ) + (('drown-death 'lava 'dark-eco-pool) + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-10 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-10 from) (process->ppointer self)) + (set! (-> a1-10 num-params) 2) + (set! (-> a1-10 message) 'attack-invinc) + (set! (-> a1-10 param 0) (the-as uint #f)) + (let ((a2-4 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-4 id) (-> self attack-id)) + (set! (-> a2-4 mode) v1-15) + (set! (-> a1-10 param 1) (the-as uint a2-4)) ) + (send-event-function (the-as process-focusable gp-0) a1-10) ) - (send-event self 'notify 'attack) - ) - ) - (else - (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) - (let ((a1-13 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-13 from) (process->ppointer self)) - (set! (-> a1-13 num-params) 2) - (set! (-> a1-13 message) 'attack) - (set! (-> a1-13 param 0) (the-as uint #f)) - (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> a2-6 id) (-> self attack-id)) - (set! (-> a2-6 mode) v1-15) - (set! (-> a1-13 param 1) (the-as uint a2-6)) - ) - (send-event-function (the-as process-tree gp-0) a1-13) + ) + (send-event self 'notify 'attack) + ) + ) + (else + (if (and (not (logtest? (focus-status board) (-> (the-as process-focusable gp-0) focus-status))) + (let ((a1-13 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-13 from) (process->ppointer self)) + (set! (-> a1-13 num-params) 2) + (set! (-> a1-13 message) 'attack) + (set! (-> a1-13 param 0) (the-as uint #f)) + (let ((a2-6 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> a2-6 id) (-> self attack-id)) + (set! (-> a2-6 mode) v1-15) + (set! (-> a1-13 param 1) (the-as uint a2-6)) ) + (send-event-function (the-as process-tree gp-0) a1-13) ) - (send-event self 'notify 'attack) - ) - ) + ) + (send-event self 'notify 'attack) + ) ) ) ) - (when (and (logtest? (-> self flags) (water-flags flow)) - (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) - ) - (let ((a0-40 (-> self flow))) - (if (nonzero? a0-40) - (push-process a0-40 (the-as process-focusable gp-0)) - ) - ) + ) + (when (and (logtest? (-> self flags) (water-flags flow)) + (logtest? (water-flags touch-water) (-> (the-as water-info s5-0) flags)) + ) + (let ((a0-40 (-> self flow))) + (if (nonzero? a0-40) + (push-process a0-40 (the-as process-focusable gp-0)) + ) ) ) ) - ((= v1-0 'visible) - (cond - ((-> arg3 param 0) - (set! (-> self visible) #t) - ) - (else - (set! (-> self visible) #f) - (logior! (-> self draw status) (draw-control-status no-draw)) - ) + ) + (('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 ) - ) + (logclear! (-> self mask) (process-mask sleep-code)) + #t + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc index 056fa54f41..09bebee69b 100644 --- a/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc +++ b/test/decompiler/reference/jak2/engine/common_objs/water_REF.gc @@ -746,7 +746,7 @@ ;; WARN: Return type mismatch int vs none. (defmethod water-control-method-10 water-control ((obj water-control)) (local-vars - (sv-272 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-272 (function vector entity-actor skeleton-group vector object none :behavior manipy)) (sv-288 vector) (sv-304 entity-actor) ) @@ -863,9 +863,17 @@ (set! sv-304 (-> obj process entity)) (let ((t0-0 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) (t1-0 #f) + (t2-0 0) ) - 0 - ((the-as (function object object object object object object none) s2-1) s0-0 sv-272 sv-288 sv-304 t0-0 t1-0) + ((the-as (function object object object object object object object none) s2-1) + s0-0 + sv-272 + sv-288 + sv-304 + t0-0 + t1-0 + t2-0 + ) ) ) (-> s1-0 ppointer) @@ -1500,26 +1508,18 @@ ) (when (and arg4 (>= (- (-> pp clock frame-counter) (-> obj distort-time)) (seconds 0.3))) (set! (-> obj distort-time) (-> pp clock frame-counter)) - (let* ((s2-0 (get-process *default-dead-pool* manipy #x4000)) - (s3-1 - (when s2-0 - (let ((t9-2 (method-of-type manipy activate))) - (t9-2 (the-as manipy s2-0) (-> obj process) (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s3-2 run-function-in-process) - (s1-0 s2-0) - (s0-0 manipy-init) - (s5-1 (-> obj process entity)) - (t0-1 (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s3-2) s1-0 s0-0 s4-1 s5-1 t0-1 t1-1) - ) - (-> s2-0 ppointer) - ) - ) - ) + (let ((s3-1 (process-spawn + manipy + :init manipy-init + s4-1 + (-> obj process entity) + (art-group-get-by-name *level* "skel-generic-ripples" (the-as (pointer uint32) #f)) + #f + 0 + :to (-> obj process) + ) + ) + ) (when s3-1 (send-event (ppointer->process s3-1) 'anim-mode 'play1) (send-event (ppointer->process s3-1) 'anim "idle") diff --git a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc index d1476e0291..3c1e015703 100644 --- a/test/decompiler/reference/jak2/engine/data/art-h_REF.gc +++ b/test/decompiler/reference/jak2/engine/data/art-h_REF.gc @@ -612,7 +612,7 @@ (get-skeleton-origin (_type_) vector 9) (lod-set! (_type_ int) none 10) (lods-assign! (_type_ lod-set) none 11) - (setup-masks (_type_ uint int) none 12) + (setup-masks (_type_ int int) none 12) (setup-cspace-and-add (_type_ art-joint-geo symbol) none 13) (do-joint-math (_type_ cspace-array joint-control) none 14) ) diff --git a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc index 8e3f0caad7..0befa1b47d 100644 --- a/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc +++ b/test/decompiler/reference/jak2/engine/debug/editable-player_REF.gc @@ -1670,272 +1670,273 @@ (defstate idle (editable-player) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (local-vars (v0-0 none)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'execute) - (let ((a2-1 (-> event param 0))) - (case a2-1 - ((28 27 35 29 31 32) - (editable-array-method-13 - (-> self current) - (the-as uint 15) - (the-as basic a2-1) - "click on the point to insert at (up target, down camera)" + (local-vars (v0-0 object)) + (the-as + object + (case event-type + (('execute) + (let ((a2-1 (-> event param 0))) + (case a2-1 + ((28 27 35 29 31 32) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 15) + (the-as basic a2-1) + "click on the point to insert at (up target, down camera)" + ) + ) + ) + ((51 1 47 36 55 56) + (if (not (-> self left-handed)) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press x to confirm, square to cancel" + ) + ) + (the-as object (editable-array-method-13 + (-> self current) + (the-as uint 16) + (the-as basic a2-1) + "press down to confirm, left to cancel" + ) + ) ) - ) - ((51 1 47 36 55 56) - (if (not (-> self left-handed)) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press x to confirm, square to cancel" - ) - (editable-array-method-13 - (-> self current) - (the-as uint 16) - (the-as basic a2-1) - "press down to confirm, left to cancel" - ) - ) - ) - (else - (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) - ) + ) + (else + (editable-array-method-9 (-> self current) (the-as editable-command a2-1) (the-as editable-array *mouse*)) ) ) ) - ((= v1-0 'exit) - (deactivate self) - ) - ((= v1-0 'menu) - (set! v0-0 (the-as none (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0))))) - (set! (-> self close-menu-time) (the-as time-frame v0-0)) - v0-0 - ) - ((or (= v1-0 'on-enter) (= v1-0 'on-exit) (= v1-0 'on-inside)) - (let ((s4-0 (-> self current region))) - (when s4-0 - (let ((gp-1 (-> event param 0))) - (set! (-> *syntax-context* got-error?) #f) - (eval! *syntax-context* (the-as pair gp-1)) - (when (not (-> *syntax-context* got-error?)) - (set! (-> s4-0 changed) #t) - (cond - ((= event-type 'on-enter) - (set! (-> s4-0 on-enter) (the-as string gp-1)) - ) - ((= event-type 'on-inside) - (set! (-> s4-0 on-inside) (the-as string gp-1)) - ) - ((= event-type 'on-exit) - (set! (-> s4-0 on-exit) (the-as string gp-1)) - ) - ) + ) + (('exit) + (the-as object (deactivate self)) + ) + (('menu) + (set! v0-0 (+ (-> self clock frame-counter) (the-as time-frame (-> event param 0)))) + (set! (-> self close-menu-time) (the-as time-frame v0-0)) + v0-0 + ) + (('on-enter 'on-exit 'on-inside) + (let ((s4-0 (-> self current region))) + (when s4-0 + (let ((gp-1 (-> event param 0))) + (set! (-> *syntax-context* got-error?) #f) + (eval! *syntax-context* (the-as pair gp-1)) + (when (not (-> *syntax-context* got-error?)) + (set! (-> s4-0 changed) #t) + (cond + ((= event-type 'on-enter) + (set! (-> s4-0 on-enter) (the-as string gp-1)) + ) + ((= event-type 'on-inside) + (set! (-> s4-0 on-inside) (the-as string gp-1)) + ) + ((= event-type 'on-exit) + (set! (-> s4-0 on-exit) (the-as string gp-1)) + ) ) ) - (set! v0-0 (the-as none (editable-region-method-12 s4-0))) - (set! (-> s4-0 filter) (the-as editable-filter v0-0)) - v0-0 + ) + (set! v0-0 (editable-region-method-12 s4-0)) + (set! (-> s4-0 filter) (the-as editable-filter v0-0)) + v0-0 + ) + ) + ) + (('select) + (let ((gp-2 (-> event param 0))) + (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) + (let* ((s5-1 (-> self current length)) + (s4-1 0) + (a0-36 (-> self current data s4-1)) + ) + (while (< s4-1 s5-1) + (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) + (logtest? (-> a0-36 region filter) (-> self current filter 1)) + ) + (logtest? (-> a0-36 flags) (editable-flag selected)) + ) + ) + (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) + (set! (-> self current region) (-> a0-36 region)) + (select-editable! a0-36 #t) + ) + ) + (+! s4-1 1) + (set! a0-36 (-> self current data s4-1)) ) ) ) - ((= v1-0 'select) - (let ((gp-2 (-> event param 0))) - (editable-array-method-9 (-> self current) (editable-command select-none) (the-as editable-array #f)) - (let* ((s5-1 (-> self current length)) - (s4-1 0) - (a0-36 (-> self current data s4-1)) - ) - (while (< s4-1 s5-1) - (when (and a0-36 (or (and (logtest? (-> a0-36 region filter) (-> self current filter 0)) - (logtest? (-> a0-36 region filter) (-> self current filter 1)) - ) - (logtest? (-> a0-36 flags) (editable-flag selected)) - ) + #f + ) + (('name) + (let* ((s5-2 (-> self current length)) + (s4-2 0) + (s3-0 (-> self current data s4-2)) + ) + (while (< s4-2 s5-2) + (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) + (let ((v1-60 (if (type? s3-0 editable) + s3-0 + ) ) - (when (and (-> a0-36 region) (= gp-2 (-> a0-36 region id))) - (set! (-> self current region) (-> a0-36 region)) - (select-editable! a0-36 #t) + ) + (when v1-60 + (set! (-> v1-60 name) (the-as string (-> event param 0))) + (logior! (-> v1-60 flags) (editable-flag changed)) + (let ((v1-61 (-> v1-60 region))) + (if v1-61 + (set! (-> v1-61 changed) #t) + ) ) ) - (+! s4-1 1) - (set! a0-36 (-> self current data s4-1)) ) ) + (+! s4-2 1) + (set! s3-0 (-> self current data s4-2)) ) - #f ) - ((= v1-0 'name) - (let* ((s5-2 (-> self current length)) - (s4-2 0) - (s3-0 (-> self current data s4-2)) - ) - (while (< s4-2 s5-2) - (when (and s3-0 (logtest? (-> s3-0 flags) (editable-flag selected))) - (let ((v1-60 (if (type? s3-0 editable) - s3-0 - ) - ) + #f + ) + (('level) + (let ((gp-3 (lookup-level-info (the-as symbol (-> event param 0))))) + (when (-> gp-3 dbname) + (let* ((s5-3 (-> self current length)) + (s4-3 0) + (s3-1 (-> self current data s4-3)) + ) + (while (< s4-3 s5-3) + (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) + (let ((v1-73 (if (type? s3-1 editable) + s3-1 + ) + ) + ) + (when (and v1-73 (-> v1-73 region)) + (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) + (set! (-> v1-73 region changed) #t) ) - (when v1-60 - (set! (-> v1-60 name) (the-as string (-> event param 0))) - (logior! (-> v1-60 flags) (editable-flag changed)) - (let ((v1-61 (-> v1-60 region))) - (if v1-61 - (set! (-> v1-61 changed) #t) + ) + ) + (+! s4-3 1) + (set! s3-1 (-> self current data s4-3)) + ) + ) + #f + ) + ) + ) + (('get-level) + (-> self current level) + ) + (('direction) + (let* ((f30-0 (the-as float (-> event param 0))) + (f28-0 (the-as float (-> event param 1))) + (f26-0 (the-as float (-> event param 2))) + (f24-0 (if (and (zero? (-> event param 0)) (zero? (-> event param 1)) (zero? (-> event param 2))) + 0.0 + 1.0 ) ) - ) - ) - ) - (+! s4-2 1) - (set! s3-0 (-> self current data s4-2)) - ) - ) - #f - ) - ((= v1-0 'level) - (let ((gp-3 (lookup-level-info (the-as symbol (-> event param 0))))) - (when (-> gp-3 dbname) - (let* ((s5-3 (-> self current length)) - (s4-3 0) - (s3-1 (-> self current data s4-3)) - ) - (while (< s4-3 s5-3) - (when (and s3-1 (logtest? (-> s3-1 flags) (editable-flag selected))) - (let ((v1-73 (if (type? s3-1 editable) - s3-1 - ) - ) + (gp-4 (-> self current length)) + (s5-4 0) + (s4-4 (-> self current data s5-4)) + ) + (while (< s5-4 gp-4) + (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) + (let ((s3-2 (if (type? s4-4 editable-light) + (the-as editable-light s4-4) + ) ) - (when (and v1-73 (-> v1-73 region)) - (set! (-> v1-73 region level) (the-as string (-> gp-3 dbname))) - (set! (-> v1-73 region changed) #t) - ) - ) ) - (+! s4-3 1) - (set! s3-1 (-> self current data s4-3)) + (when s3-2 + (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) + (vector-normalize! (-> s3-2 direction) 1.0) + (logior! (-> s3-2 flags) (editable-flag changed)) + (let ((a0-73 (-> s3-2 region))) + (if a0-73 + (set! (-> a0-73 changed) #t) + ) + ) ) ) - #f ) + (+! s5-4 1) + (set! s4-4 (-> self current data s5-4)) ) ) - ((= v1-0 'get-level) - (-> self current level) - ) - ((= v1-0 'direction) - (let* ((f30-0 (the-as float (-> event param 0))) - (f28-0 (the-as float (-> event param 1))) - (f26-0 (the-as float (-> event param 2))) - (f24-0 (if (and (zero? (-> event param 0)) (zero? (-> event param 1)) (zero? (-> event param 2))) - 0.0 - 1.0 - ) - ) - (gp-4 (-> self current length)) - (s5-4 0) - (s4-4 (-> self current data s5-4)) - ) - (while (< s5-4 gp-4) - (when (and s4-4 (logtest? (-> s4-4 flags) (editable-flag selected))) - (let ((s3-2 (if (type? s4-4 editable-light) - (the-as editable-light s4-4) + #f + ) + (('color) + (let* ((f30-1 (the-as float (-> event param 0))) + (f28-1 (the-as float (-> event param 1))) + (f26-1 (the-as float (-> event param 2))) + (f24-1 (the-as float (-> event param 3))) + (gp-5 (-> self current length)) + (s5-5 0) + (s4-5 (-> self current data s5-5)) + ) + (while (< s5-5 gp-5) + (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) + (let ((v1-114 (if (type? s4-5 editable-light) + (the-as editable-light s4-5) ) ) - ) - (when s3-2 - (set-vector! (-> s3-2 direction) f30-0 f28-0 f26-0 f24-0) - (vector-normalize! (-> s3-2 direction) 1.0) - (logior! (-> s3-2 flags) (editable-flag changed)) - (let ((a0-73 (-> s3-2 region))) - (if a0-73 - (set! (-> a0-73 changed) #t) - ) - ) + ) + (when v1-114 + (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) + (logior! (-> v1-114 flags) (editable-flag changed)) + (let ((v1-115 (-> v1-114 region))) + (if v1-115 + (set! (-> v1-115 changed) #t) + ) ) ) ) - (+! s5-4 1) - (set! s4-4 (-> self current data s5-4)) ) + (+! s5-5 1) + (set! s4-5 (-> self current data s5-5)) ) - #f ) - ((= v1-0 'color) - (let* ((f30-1 (the-as float (-> event param 0))) - (f28-1 (the-as float (-> event param 1))) - (f26-1 (the-as float (-> event param 2))) - (f24-1 (the-as float (-> event param 3))) - (gp-5 (-> self current length)) - (s5-5 0) - (s4-5 (-> self current data s5-5)) - ) - (while (< s5-5 gp-5) - (when (and s4-5 (logtest? (-> s4-5 flags) (editable-flag selected))) - (let ((v1-114 (if (type? s4-5 editable-light) - (the-as editable-light s4-5) - ) - ) - ) - (when v1-114 - (set-vector! (-> v1-114 color) f30-1 f28-1 f26-1 f24-1) - (logior! (-> v1-114 flags) (editable-flag changed)) - (let ((v1-115 (-> v1-114 region))) - (if v1-115 - (set! (-> v1-115 changed) #t) - ) - ) - ) - ) - ) - (+! s5-5 1) - (set! s4-5 (-> self current data s5-5)) + #f + ) + (('param) + (let ((s5-6 (-> event param 0)) + (f30-2 (the-as float (-> event param 1))) ) - ) - #f - ) - ((= v1-0 'param) - (let ((s5-6 (-> event param 0)) - (f30-2 (the-as float (-> event param 1))) - ) - (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) - (let* ((gp-6 (-> self current length)) - (s4-6 0) - (s3-3 (-> self current data s4-6)) - ) - (while (< s4-6 gp-6) - (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) - (let ((v1-129 (if (type? s3-3 editable-light) - s3-3 - ) - ) - ) - (when v1-129 - (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) - (logior! (-> v1-129 flags) (editable-flag changed)) - (let ((v1-130 (-> v1-129 region))) - (if v1-130 - (set! (-> v1-130 changed) #t) - ) - ) + (when (and (>= (the-as int s5-6) 0) (>= 2 (the-as int s5-6))) + (let* ((gp-6 (-> self current length)) + (s4-6 0) + (s3-3 (-> self current data s4-6)) + ) + (while (< s4-6 gp-6) + (when (and s3-3 (logtest? (-> s3-3 flags) (editable-flag selected))) + (let ((v1-129 (if (type? s3-3 editable-light) + s3-3 + ) + ) + ) + (when v1-129 + (set! (-> (the-as editable-light (+ (* s5-6 4) (the-as uint v1-129))) decay-start) f30-2) + (logior! (-> v1-129 flags) (editable-flag changed)) + (let ((v1-130 (-> v1-129 region))) + (if v1-130 + (set! (-> v1-130 changed) #t) + ) ) ) ) - (+! s4-6 1) - (set! s3-3 (-> self current data s4-6)) ) + (+! s4-6 1) + (set! s3-3 (-> self current data s4-6)) ) - #f ) + #f ) ) - ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/game/game-save_REF.gc b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc index cddcc2912c..889844e342 100644 --- a/test/decompiler/reference/jak2/engine/game/game-save_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/game-save_REF.gc @@ -1,5 +1,7 @@ +;;-*-Lisp-*- (in-package goal) +;; definition (debug) for function game-save-elt->string (defun-debug game-save-elt->string ((arg0 game-save-elt)) (case arg0 (((game-save-elt task-deaths)) @@ -230,6 +232,7 @@ ) ) +;; definition of type game-save-tag (deftype game-save-tag (structure) ((user-object object 2 :offset 0) (user-uint64 uint64 :offset 0) @@ -252,6 +255,7 @@ :flag-assert #x900000010 ) +;; definition for method 3 of type game-save-tag (defmethod inspect game-save-tag ((obj game-save-tag)) (when (not obj) (set! obj obj) @@ -277,6 +281,7 @@ obj ) +;; definition of type game-save (deftype game-save (basic) ((version int32 :offset-assert 4) (allocated-length int32 :offset-assert 8) @@ -310,6 +315,8 @@ ) ) +;; definition for method 3 of type game-save +;; INFO: this function exists in multiple non-identical object files (defmethod inspect game-save ((obj game-save)) (when (not obj) (set! obj obj) @@ -340,10 +347,13 @@ obj ) +;; definition for method 5 of type game-save +;; WARN: Return type mismatch uint vs int. (defmethod asize-of game-save ((obj game-save)) (the-as int (+ (-> game-save size) (-> obj allocated-length))) ) +;; definition for method 0 of type game-save (defmethod new game-save ((allocation symbol) (type-to-make type) (arg0 int)) (let ((v0-0 (object-new allocation type-to-make (the-as int (+ (-> type-to-make size) arg0))))) (set! (-> v0-0 version) 3) @@ -352,6 +362,8 @@ ) ) +;; definition for method 11 of type game-save +;; INFO: Used lq/sq (defmethod debug-inspect game-save ((obj game-save) (arg0 symbol)) (local-vars (sv-16 int) (sv-32 string) (sv-48 string)) (format #t "[~8x] ~A~%" obj (-> obj type)) @@ -498,10 +510,13 @@ obj ) +;; definition for method 3 of type game-save +;; INFO: this function exists in multiple non-identical object files (defmethod inspect game-save ((obj game-save)) (debug-inspect obj #f) ) +;; definition for method 23 of type game-info (defmethod save-game game-info ((obj game-info) (arg0 game-save) (arg1 string)) (with-pp (dotimes (s4-0 (-> *level* length)) @@ -1294,6 +1309,7 @@ ) ) +;; definition for method 24 of type game-info (defmethod load-game game-info ((obj game-info) (arg0 game-save)) (let ((v1-0 (the-as object (-> arg0 tag)))) (while (< (the-as int v1-0) (the-as int (&-> arg0 tag 0 user-int8 (-> arg0 length)))) @@ -1757,6 +1773,7 @@ arg0 ) +;; definition for method 9 of type game-save (defmethod save-to-file game-save ((obj game-save) (arg0 string)) (let ((s5-0 (new 'stack 'file-stream arg0 'write))) (file-stream-write s5-0 (&-> obj type) (+ (-> obj type size) (-> obj length))) @@ -1765,6 +1782,7 @@ obj ) +;; definition for method 10 of type game-save (defmethod load-from-file game-save ((obj game-save) (arg0 string)) (let ((s5-0 (new 'stack 'file-stream arg0 'read))) (let ((s3-0 (file-stream-length s5-0)) @@ -1799,8 +1817,10 @@ obj ) +;; definition for symbol *auto-save-info*, type mc-slot-info (define *auto-save-info* (new 'global 'mc-slot-info)) +;; definition of type auto-save (deftype auto-save (process) ((card int32 :offset-assert 128) (slot int32 :offset-assert 132) @@ -1832,6 +1852,7 @@ ) ) +;; definition for method 3 of type auto-save (defmethod inspect auto-save ((obj auto-save)) (when (not obj) (set! obj obj) @@ -1856,6 +1877,9 @@ obj ) +;; definition for function auto-save-post +;; WARN: Failed store: (s.w! (+ v1-45 8) 0) at op 192 +;; WARN: Failed store: (s.w! (+ v1-45 12) 0) at op 193 (defbehavior auto-save-post auto-save () (when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) (let ((gp-0 (new @@ -1930,8 +1954,10 @@ ) ) +;; failed to figure out what this is: auto-save-post +;; definition for function auto-save-init-by-other (defbehavior auto-save-init-by-other auto-save ((arg0 symbol) (arg1 process) (arg2 int) (arg3 int) (arg4 symbol)) (when (handle->process (-> *game-info* auto-save-proc)) (send-event arg1 'notify 'error 16) @@ -1980,6 +2006,7 @@ auto-save-post (go-virtual get-heap) ) +;; failed to figure out what this is: (defstate get-heap (auto-save) :virtual #t :code (behavior () @@ -2028,6 +2055,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate get-card (auto-save) :virtual #t :code (behavior () @@ -2083,6 +2111,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate format-card (auto-save) :virtual #t :code (behavior () @@ -2128,6 +2157,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate unformat-card (auto-save) :virtual #t :code (behavior () @@ -2161,6 +2191,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate create-file (auto-save) :virtual #t :code (behavior () @@ -2219,6 +2250,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate save (auto-save) :virtual #t :code (behavior () @@ -2284,6 +2316,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate restore (auto-save) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) @@ -2367,20 +2400,19 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate error (auto-save) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'progress-allowed?) - #t - ) - ((= v1-0 'die) - (deactivate self) - ) - ) - ) - ) + (the-as object (case event-type + (('progress-allowed?) + #t + ) + (('die) + (the-as symbol (deactivate self)) + ) + ) + ) ) :code (behavior ((arg0 mc-status-code)) (if (-> self buffer) @@ -2481,6 +2513,7 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; failed to figure out what this is: (defstate done (auto-save) :virtual #t :code (behavior () @@ -2513,11 +2546,14 @@ auto-save-post :post (the-as (function none :behavior auto-save) auto-save-post) ) +;; definition for function auto-save-command +;; WARN: Return type mismatch (pointer process) vs (pointer auto-save). (defun auto-save-command ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree) (arg4 symbol)) (format #t "AUTO SAVE COMMAND ~S~%" arg0) (process-spawn auto-save arg0 arg3 arg1 arg2 arg4 :to *target-pool* :stack *kernel-dram-stack*) ) +;; definition for function auto-save-check (defun auto-save-check () (when (and (-> *setting-control* user-current auto-save) (not (handle->process (-> *game-info* auto-save-proc)))) (mc-get-slot-info 0 *auto-save-info*) @@ -2530,6 +2566,7 @@ auto-save-post 0 ) +;; definition for function auto-save-user (defun auto-save-user () (case *kernel-boot-message* (('play 'preview) diff --git a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc index 5e7a3c52db..1bf1b0f322 100644 --- a/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc +++ b/test/decompiler/reference/jak2/engine/game/task/task-control_REF.gc @@ -1701,21 +1701,19 @@ (defstate resetting (fail-mission) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'reset) - #t + (the-as object (case event-type + (('reset) + #t + ) + (('query) + (case (-> event param 0) + (('reset) + #t + ) ) - ((= v1-0 'query) - (case (-> event param 0) - (('reset) - #t - ) - ) - ) - ) - ) - ) + ) + ) + ) ) :enter (behavior () '() diff --git a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day_REF.gc b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day_REF.gc index 00fd577c7f..42b6de4eb6 100644 --- a/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day_REF.gc +++ b/test/decompiler/reference/jak2/engine/gfx/mood/time-of-day_REF.gc @@ -144,84 +144,82 @@ ;; failed to figure out what this is: (defstate time-of-day-tick (time-of-day-proc) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'change) - (case (-> event param 0) - (('ratio) - (let ((a0-5 (-> *display* bg-clock)) - (f0-0 (the-as float (-> event param 1))) - ) - (set! (-> self time-ratio) f0-0) - (set! (-> self dest-time-ratio) f0-0) - (update-rates! a0-5 f0-0) - ) + (the-as + object + (case event-type + (('change) + (case (-> event param 0) + (('ratio) + (let ((a0-5 (-> *display* bg-clock)) + (f0-0 (the-as float (-> event param 1))) + ) + (set! (-> self time-ratio) f0-0) + (set! (-> self dest-time-ratio) f0-0) + (update-rates! a0-5 f0-0) ) - (('hour) - (update-counters) - (let ((v1-7 (-> *display* bg-clock frame-counter)) - (a0-7 #x69780) - (a1-5 (/ (the int (* 1080000.0 (the float (-> event param 1)))) 60)) - ) - (set! (-> *display* bg-clock frame-counter) (+ (- v1-7 (the-as time-frame (mod v1-7 a0-7))) a0-7 a1-5)) - ) - (update-counters) - (-> self hours) - (kill-and-free-particles (-> self sun)) - (spawn (-> self sun) (math-camera-pos)) - (set! (-> self sun-count) 1) - (kill-and-free-particles (-> self green-sun)) - (spawn (-> self green-sun) (math-camera-pos)) - (set! (-> self green-sun-count) 1) - (kill-and-free-particles (-> self moon)) - (spawn (-> self moon) (math-camera-pos)) - (let ((v0-0 (the-as number 1))) - (set! (-> self moon-count) (the-as int v0-0)) - v0-0 - ) + ) + (('hour) + (update-counters) + (let ((v1-7 (-> *display* bg-clock frame-counter)) + (a0-7 #x69780) + (a1-5 (/ (the int (* 1080000.0 (the float (-> event param 1)))) 60)) + ) + (set! (-> *display* bg-clock frame-counter) (+ (- v1-7 (the-as time-frame (mod v1-7 a0-7))) a0-7 a1-5)) ) + (update-counters) + (-> self hours) + (kill-and-free-particles (-> self sun)) + (spawn (-> self sun) (math-camera-pos)) + (set! (-> self sun-count) 1) + (kill-and-free-particles (-> self green-sun)) + (spawn (-> self green-sun) (math-camera-pos)) + (set! (-> self green-sun-count) 1) + (kill-and-free-particles (-> self moon)) + (spawn (-> self moon) (math-camera-pos)) + (let ((v0-0 (the-as number 1))) + (set! (-> self moon-count) (the-as int v0-0)) + v0-0 + ) + ) + ) + ) + (('ratio) + (-> self time-ratio) + ) + (('day-length) + (if (= (-> self time-ratio) 0.0) + 0 + (/ 25920000.0 (-> self time-ratio)) ) - ) - ((= v1-0 'ratio) - (-> self time-ratio) - ) - ((= v1-0 'day-length) - (if (= (-> self time-ratio) 0.0) - 0 - (/ 25920000.0 (-> self time-ratio)) + ) + (('time-frame) + (-> self frames) + ) + (('time-of-day) + (-> self time-of-day) + ) + (('time-of-day-norm) + (* 0.041666668 (-> self time-of-day)) + ) + (('hour) + (-> self hours) + ) + (('minute) + (-> self minutes) + ) + (('second) + (-> self seconds) + ) + (('dest-clock-ratio-set) + (set! (-> self dest-time-ratio) (the-as float (-> event param 0))) + (let ((f0-12 (-> self time-ratio)) + (f1-5 (-> self dest-time-ratio)) + (f2-1 (/ 300.0 (the float (-> event param 1)))) ) + (set! (-> self dest-time-delta) (* (fabs (- f0-12 f1-5)) f2-1 (-> *display* real-clock seconds-per-frame))) ) - ((= v1-0 'time-frame) - (-> self frames) - ) - ((= v1-0 'time-of-day) - (-> self time-of-day) - ) - ((= v1-0 'time-of-day-norm) - (* 0.041666668 (-> self time-of-day)) - ) - ((= v1-0 'hour) - (-> self hours) - ) - ((= v1-0 'minute) - (-> self minutes) - ) - ((= v1-0 'second) - (-> self seconds) - ) - ((= v1-0 'dest-clock-ratio-set) - (set! (-> self dest-time-ratio) (the-as float (-> event param 0))) - (let ((f0-12 (-> self time-ratio)) - (f1-5 (-> self dest-time-ratio)) - (f2-1 (/ 300.0 (the float (-> event param 1)))) - ) - (set! (-> self dest-time-delta) (* (fabs (- f0-12 f1-5)) f2-1 (-> *display* real-clock seconds-per-frame))) - ) - (-> self dest-time-ratio) - ) - ) + (-> self dest-time-ratio) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc index b2910f50ef..6fa3475f22 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-drawable_REF.gc @@ -202,7 +202,7 @@ (set! (-> obj mgeo) (-> obj lod-set lod v1-1 geo)) (set! (-> obj cur-lod) v1-1) (if (nonzero? (-> obj seg-mask)) - (setup-masks obj (the-as uint 0) 0) + (setup-masks obj 0 0) ) ) ) @@ -224,7 +224,7 @@ ;; definition for method 12 of type draw-control ;; WARN: Return type mismatch int vs none. -(defmethod setup-masks draw-control ((obj draw-control) (arg0 uint) (arg1 int)) +(defmethod setup-masks draw-control ((obj draw-control) (arg0 int) (arg1 int)) (local-vars (v1-4 int) (a2-1 (array uint64))) (let ((a1-2 (logior (logclear (-> obj seg-mask) arg0) arg1))) (set! (-> obj seg-mask) a1-2) @@ -571,13 +571,13 @@ ;; failed to figure out what this is: (defstate process-drawable-art-error (process-drawable) :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'nav-mesh-kill) - (deactivate self) - #t - ) - ) - ) + (the-as object (case event-type + (('nav-mesh-kill) + (deactivate self) + #t + ) + ) + ) ) :code (behavior ((arg0 string)) (if (-> self entity) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc index b2e12199b8..fdcd46ef3e 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/process-taskable_REF.gc @@ -79,15 +79,15 @@ (defstate hide (process-taskable) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'say) - (let ((v0-0 (-> self clock frame-counter))) - (set! (-> self want-to-say) v0-0) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('say) + (let ((v0-0 (-> self clock frame-counter))) + (set! (-> self want-to-say) v0-0) + v0-0 + ) + ) + ) + ) ) :enter (behavior () (set! (-> self state-time) (-> self clock frame-counter)) @@ -398,7 +398,7 @@ (set! (-> obj talk-height) (res-lump-float (-> obj entity) 'height :default 8192.0)) (set! (-> obj slave) (the-as handle #f)) (set! (-> obj draw shadow-ctrl) - (new 'process 'shadow-control 0.0 0.0 614400.0 0.000000000000000000000000000000000000000000084 245760.0) + (new 'process 'shadow-control 0.0 0.0 614400.0 (shadow-flags shdf02 shdf03 shdf04 disable-draw) 245760.0) ) (let ((s5-0 0)) (let ((v1-15 (the-as joint (get-art-by-name-method (-> obj draw jgeo) "main" (the-as type #f))))) @@ -443,26 +443,8 @@ (format (clear *temp-string*) "skel-~S" (-> obj draw art-group name)) (let ((s4-3 (s4-2 s5-1 *temp-string* (the-as (pointer uint32) #f)))) (when s4-3 - (let* ((s3-2 (get-process *default-dead-pool* manipy #x4000)) - (s5-2 - (when s3-2 - (let ((t9-12 (method-of-type manipy activate))) - (t9-12 (the-as manipy s3-2) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((t9-13 run-function-in-process) - (a0-14 s3-2) - (a1-10 manipy-init) - (a2-9 (-> obj root-override trans)) - (a3-3 (-> obj entity)) - (t1-2 #f) - ) - 0 - ((the-as (function object object object object object object none) t9-13) a0-14 a1-10 a2-9 a3-3 s4-3 t1-2) - ) - (-> s3-2 ppointer) - ) - ) - ) + (let ((s5-2 (process-spawn manipy :init manipy-init (-> obj root-override trans) (-> obj entity) s4-3 #f 0 :to obj)) + ) (send-event (ppointer->process s5-2) 'anim-mode 'mirror) (send-event (ppointer->process s5-2) 'mirror #t) ) diff --git a/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc b/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc index 6b8c1262cd..ce0ee2563f 100644 --- a/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc +++ b/test/decompiler/reference/jak2/engine/process-drawable/simple-focus_REF.gc @@ -46,15 +46,15 @@ (defstate idle (simple-focus) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'move-trans) - (let ((v0-0 (-> self root-override trans))) - (set! (-> v0-0 quad) (-> (the-as vector (-> event param 0)) quad)) - v0-0 - ) - ) - ) - ) + (the-as object (case event-type + (('move-trans) + (let ((v0-0 (-> self root-override trans))) + (set! (-> v0-0 quad) (-> (the-as vector (-> event param 0)) quad)) + v0-0 + ) + ) + ) + ) ) :code (the-as (function none :behavior simple-focus) sleep-code) ) diff --git a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc index c73ef109f5..22419098d1 100644 --- a/test/decompiler/reference/jak2/engine/scene/scene_REF.gc +++ b/test/decompiler/reference/jak2/engine/scene/scene_REF.gc @@ -229,27 +229,24 @@ ) ) (set! sv-96 (get-process *default-dead-pool* manipy #x4000)) - (set! s4-0 - (when sv-96 - (let ((t9-7 (method-of-type manipy activate))) - (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) - ) - (let ((t9-8 run-function-in-process) - (a0-11 sv-96) - (a1-9 manipy-init) - (a2-3 (-> arg0 root trans)) - (a3-1 s1-1) - (t0-0 s2-0) - (t1-0 #f) - ) - (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) - 1 - 0 - ) - ((the-as (function object object object object object object none) t9-8) a0-11 a1-9 a2-3 a3-1 t0-0 t1-0) - ) - (-> sv-96 ppointer) - ) + (set! s4-0 (when sv-96 + (let ((t9-7 (method-of-type manipy activate))) + (t9-7 (the-as manipy sv-96) arg0 (-> obj name) (the-as pointer #x70004000)) + ) + (run-now-in-process + sv-96 + manipy-init + (-> arg0 root trans) + s1-1 + s2-0 + #f + (if (and s3-0 (logtest? (game-secrets big-head little-head) (-> *game-info* secrets))) + 1 + 0 + ) + ) + (-> sv-96 ppointer) + ) ) (set! (-> arg0 level) s0-0) (send-event (ppointer->process s4-0) 'anim-mode 'clone-anim) @@ -309,23 +306,14 @@ ) (when (and s4-0 (logtest? (-> obj flags) 2)) (set! sv-112 (get-process *default-dead-pool* manipy #x4000)) - (let ((s0-1 - (when sv-112 - (let ((t9-24 (method-of-type manipy activate))) - (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) - ) - (let ((t9-25 run-function-in-process) - (a0-51 sv-112) - (a1-26 manipy-init) - (a2-8 (-> arg0 root trans)) - (t1-1 #f) + (let ((s0-1 (when sv-112 + (let ((t9-24 (method-of-type manipy activate))) + (t9-24 (the-as manipy sv-112) (ppointer->process s4-0) (-> obj name) (the-as pointer #x70004000)) ) - 0 - ((the-as (function object object object object object object none) t9-25) a0-51 a1-26 a2-8 s1-1 s2-0 t1-1) + (run-now-in-process sv-112 manipy-init (-> arg0 root trans) s1-1 s2-0 #f 0) + (-> sv-112 ppointer) + ) ) - (-> sv-112 ppointer) - ) - ) ) (send-event (ppointer->process s0-1) 'mirror #t) (send-event (ppointer->process s0-1) 'anim-mode 'mirror) @@ -488,42 +476,40 @@ ;; WARN: Return type mismatch basic vs scene. (defun scene-lookup ((arg0 basic)) "TODO - basic can be a string or a scene" - (let ((v1-0 (-> arg0 type))) - (the-as - scene - (cond - ((= v1-0 string) - (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) - (when (type? s5-0 scene) - (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) - (when (and s5-0 gp-0) - (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) - (when v1-5 - (dotimes (a0-6 6) - (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) - (goto cfg-15) - ) - ) - (format - 0 - "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" - (-> gp-0 name) - (-> v1-5 name) - ) - (return (the-as scene #f)) + (the-as + scene + (case (-> arg0 type) + ((string) + (let ((s5-0 (art-group-get-by-name *level* (the-as string arg0) (the-as (pointer uint32) #f)))) + (when (type? s5-0 scene) + (let ((gp-0 (get-level-by-heap-ptr-and-status *level* (the-as pointer s5-0) 'active))) + (when (and s5-0 gp-0) + (let ((v1-5 (scene-decode-continue (-> s5-0 data 17)))) + (when v1-5 + (dotimes (a0-6 6) + (if (= (-> gp-0 name) (-> v1-5 want a0-6 name)) + (goto cfg-15) + ) ) + (format + 0 + "WARNING: can not find scene level ~A in continue ~A, dropping scene until after load~%" + (-> gp-0 name) + (-> v1-5 name) + ) + (return (the-as scene #f)) ) ) ) - (label cfg-15) - s5-0 ) + (label cfg-15) + s5-0 ) ) - ((= v1-0 scene) - arg0 - ) - ) + ) + ((scene) + arg0 + ) ) ) ) diff --git a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc index c125f15c3b..8c2388e7c2 100644 --- a/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/board/board-states_REF.gc @@ -391,26 +391,18 @@ (-> s5-0 ppointer) ) ) - (let* ((s4-0 (get-process *default-dead-pool* manipy #x4000)) - (s5-1 - (when s4-0 - (let ((t9-13 (method-of-type manipy activate))) - (t9-13 (the-as manipy s4-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-2 run-function-in-process) - (s3-0 s4-0) - (s2-0 manipy-init) - (s1-0 (-> self entity)) - (t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s5-2) s3-0 s2-0 gp-0 s1-0 t0-2 t1-1) - ) - (-> s4-0 ppointer) - ) - ) - ) + (let ((s5-1 (process-spawn + manipy + :init manipy-init + gp-0 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when s5-1 (quaternion-copy! (-> (the-as board (-> s5-1 0)) root quat) (-> self control quat-for-control)) (send-event (ppointer->process s5-1) 'anim-mode 'play1) @@ -882,7 +874,7 @@ ) :enter (behavior ((arg0 meters) (arg1 meters) (arg2 symbol)) (local-vars - (sv-144 (function vector entity-actor skeleton-group vector none :behavior manipy)) + (sv-144 (function vector entity-actor skeleton-group vector object none :behavior manipy)) (sv-160 entity-actor) ) (if (= arg2 'hit) @@ -957,9 +949,17 @@ (set! sv-160 (-> self entity)) (let ((t0-2 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) (t1-1 #f) + (t2-1 0) ) - 0 - ((the-as (function object object object object object object none) s2-3) s0-1 sv-144 s3-2 sv-160 t0-2 t1-1) + ((the-as (function object object object object object object object none) s2-3) + s0-1 + sv-144 + s3-2 + sv-160 + t0-2 + t1-1 + t2-1 + ) ) ) (-> s1-1 ppointer) diff --git a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc index 8fd4df7026..11d21f6d35 100644 --- a/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/gun/gun-red-shot_REF.gc @@ -99,27 +99,18 @@ (when (and (sphere-in-view-frustum? (the-as sphere s5-2)) (< 24576.0 (vector-vector-distance s5-2 (math-camera-pos))) ) - (let* ((s4-1 (get-process *default-dead-pool* manipy #x4000)) - (s5-3 - (when s4-1 - (let ((t9-8 (method-of-type manipy activate))) - (t9-8 (the-as manipy s4-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s5-4 run-function-in-process) - (s3-0 s4-1) - (s2-0 manipy-init) - (s1-0 (-> gp-0 fire-point)) - (s0-0 (-> self entity)) - (t0-1 (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s5-4) s3-0 s2-0 s1-0 s0-0 t0-1 t1-1) - ) - (-> s4-1 ppointer) - ) - ) - ) + (let ((s5-3 (process-spawn + manipy + :init manipy-init + (-> gp-0 fire-point) + (-> self entity) + (art-group-get-by-name *level* "skel-gun-red-cone" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when s5-3 (send-event (ppointer->process s5-3) 'anim-mode 'play1) (send-event (ppointer->process s5-3) 'anim "idle") diff --git a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc index 62e555e49d..43dc14393f 100644 --- a/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/logic-target_REF.gc @@ -1691,27 +1691,18 @@ (set! (-> self mirror) (the-as (pointer process-drawable) #f)) ) (else - (let* ((s5-0 (get-process *default-dead-pool* manipy #x4000)) - (gp-1 - (when s5-0 - (let ((t9-12 (method-of-type manipy activate))) - (t9-12 (the-as manipy s5-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-2 run-function-in-process) - (s4-0 s5-0) - (s3-0 manipy-init) - (s2-0 (-> self control trans)) - (s1-0 (-> self entity)) - (t0-0 (art-group-get-by-name *level* "skel-jchar" (the-as (pointer uint32) #f))) - (t1-0 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-2) s4-0 s3-0 s2-0 s1-0 t0-0 t1-0) - ) - (-> s5-0 ppointer) - ) - ) - ) + (let ((gp-1 (process-spawn + manipy + :init manipy-init + (-> self control trans) + (-> self entity) + (art-group-get-by-name *level* "skel-jchar" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (send-event (ppointer->process gp-1) 'anim-mode 'mirror) (send-event (ppointer->process gp-1) 'mirror #t) (set! (-> self mirror) (the-as (pointer process-drawable) gp-1)) @@ -1851,11 +1842,11 @@ (when (!= (-> self beard?) v1-248) (cond (v1-248 - (setup-masks (-> self draw) (the-as uint 2) 0) + (setup-masks (-> self draw) 2 0) (set! (-> self beard?) #t) ) (else - (setup-masks (-> self draw) (the-as uint 0) 2) + (setup-masks (-> self draw) 0 2) (set! (-> self beard?) #f) ) ) @@ -2288,14 +2279,14 @@ (let ((s5-0 (new 'stack-no-clear 'vector))) (let ((s4-1 (vector+float*! (new 'stack-no-clear 'vector) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) gp-0 (the-as float (-> (the-as swingpole s2-0) edge-length)) ) ) (s3-1 (vector+float*! (new 'stack-no-clear 'vector) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) gp-0 (- (-> (the-as swingpole s2-0) edge-length)) ) @@ -2318,7 +2309,7 @@ (add-debug-vector #t (bucket-id debug-no-zbuf1) - (-> (the-as swingpole s2-0) root trans) + (-> (the-as swingpole s2-0) root-override trans) (-> (the-as swingpole s2-0) dir) (meters 3) (new 'static 'rgba :r #xff :b #xff :a #x80) diff --git a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc index d95f4a807a..c9d917ac7e 100644 --- a/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/sidekick_REF.gc @@ -462,25 +462,22 @@ ) (else (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) - (gp-4 - (when s5-3 - (let ((t9-22 (method-of-type manipy activate))) - (t9-22 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-5 run-function-in-process) - (s4-3 s5-3) - (s3-1 manipy-init) - (s2-0 (-> self root trans)) - (s1-0 (-> self entity)) - (t0-4 (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f))) - (t1-1 #f) + (gp-4 (when s5-3 + (let ((t9-22 (method-of-type manipy activate))) + (t9-22 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) ) - 0 - ((the-as (function object object object object object object none) gp-5) s4-3 s3-1 s2-0 s1-0 t0-4 t1-1) + (run-now-in-process + s5-3 + manipy-init + (-> self root trans) + (-> self entity) + (art-group-get-by-name *level* "skel-sidekick" (the-as (pointer uint32) #f)) + #f + 0 + ) + (the-as (pointer process-drawable) (-> s5-3 ppointer)) + ) ) - (the-as (pointer process-drawable) (-> s5-3 ppointer)) - ) - ) ) (send-event (ppointer->process gp-4) 'anim-mode 'mirror) (send-event (ppointer->process gp-4) 'mirror #t) diff --git a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc index 5e79d5c5c7..243bc7cda7 100644 --- a/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target-darkjak_REF.gc @@ -1331,27 +1331,18 @@ (-> gp-4 ppointer) ) ) - (let* ((s5-0 (get-process *default-dead-pool* manipy #x4000)) - (gp-5 - (when s5-0 - (let ((t9-40 (method-of-type manipy activate))) - (t9-40 (the-as manipy s5-0) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-6 run-function-in-process) - (s4-0 s5-0) - (s3-0 manipy-init) - (s2-0 sv-80) - (s1-0 (-> self entity)) - (t0-8 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-6 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-6) s4-0 s3-0 s2-0 s1-0 t0-8 t1-6) - ) - (-> s5-0 ppointer) - ) - ) - ) + (let ((gp-5 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when gp-5 (send-event (ppointer->process gp-5) 'anim-mode 'play1) (send-event (ppointer->process gp-5) 'anim "idle") @@ -1359,27 +1350,18 @@ (send-event (ppointer->process gp-5) 'trans-hook sv-84) ) ) - (let* ((s5-1 (get-process *default-dead-pool* manipy #x4000)) - (gp-7 - (when s5-1 - (let ((t9-47 (method-of-type manipy activate))) - (t9-47 (the-as manipy s5-1) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((gp-8 run-function-in-process) - (s4-1 s5-1) - (s3-1 manipy-init) - (s2-1 sv-80) - (s1-1 (-> self entity)) - (t0-9 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-7 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-8) s4-1 s3-1 s2-1 s1-1 t0-9 t1-7) - ) - (-> s5-1 ppointer) - ) - ) - ) + (let ((gp-7 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) + ) + ) (when gp-7 (send-event (ppointer->process gp-7) 'anim-mode 'play1) (send-event (ppointer->process gp-7) 'anim "idle") @@ -1396,27 +1378,18 @@ (when (and (logtest? (focus-status dark) (-> self focus-status)) (and (nonzero? (-> self darkjak)) (logtest? (-> self darkjak stage) 32)) ) - (let* ((s5-2 (get-process *default-dead-pool* manipy #x4000)) - (gp-10 - (when s5-2 - (let ((t9-59 (method-of-type manipy activate))) - (t9-59 (the-as manipy s5-2) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + (let ((gp-10 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) ) - (let ((gp-11 run-function-in-process) - (s4-2 s5-2) - (s3-2 manipy-init) - (s2-2 sv-80) - (s1-2 (-> self entity)) - (t0-10 (art-group-get-by-name *level* "skel-bomb-blast" (the-as (pointer uint32) #f))) - (t1-8 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-11) s4-2 s3-2 s2-2 s1-2 t0-10 t1-8) - ) - (-> s5-2 ppointer) - ) - ) - ) + ) (when gp-10 (send-event (ppointer->process gp-10) 'anim-mode 'play1) (send-event (ppointer->process gp-10) 'anim "idle") @@ -1458,27 +1431,18 @@ ) ) ) - (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) - (gp-12 - (when s5-3 - (let ((t9-66 (method-of-type manipy activate))) - (t9-66 (the-as manipy s5-3) self (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) + (let ((gp-12 (process-spawn + manipy + :init manipy-init + sv-80 + (-> self entity) + (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f)) + #f + 0 + :to self + ) ) - (let ((gp-13 run-function-in-process) - (s4-3 s5-3) - (s3-3 manipy-init) - (s2-3 sv-80) - (s1-3 (-> self entity)) - (t0-11 (art-group-get-by-name *level* "skel-generic-blast" (the-as (pointer uint32) #f))) - (t1-9 #f) - ) - 0 - ((the-as (function object object object object object object none) gp-13) s4-3 s3-3 s2-3 s1-3 t0-11 t1-9) - ) - (-> s5-3 ppointer) - ) - ) - ) + ) (when gp-12 (send-event (ppointer->process gp-12) 'anim-mode 'play1) (send-event (ppointer->process gp-12) 'anim "idle") diff --git a/test/decompiler/reference/jak2/engine/target/target_REF.gc b/test/decompiler/reference/jak2/engine/target/target_REF.gc index 32f0a4a596..72e398881f 100644 --- a/test/decompiler/reference/jak2/engine/target/target_REF.gc +++ b/test/decompiler/reference/jak2/engine/target/target_REF.gc @@ -2876,21 +2876,21 @@ :tiltvvf 15.0 :mult-hook (lambda :behavior target ((arg0 surface) (arg1 object) (arg2 object) (arg3 int)) - (let ((v1-0 arg3)) - (the-as symbol (when (= v1-0 1) - (if (and (>= (-> self gun fire-pending) 2) (< (-> self gun fire-pending) 5)) - (logclear! (-> arg0 flags) (surface-flag gun-direct)) - ) - (case (-> self control ground-pat event) - (((pat-event slide)) - (set! (-> arg0 seek0) 0.05) - (set! (-> arg0 seek90) 0.05) - (set! (-> arg0 seek180) 0.05) + (the-as symbol (case arg3 + ((1) + (if (and (>= (-> self gun fire-pending) 2) (< (-> self gun fire-pending) 5)) + (logclear! (-> arg0 flags) (surface-flag gun-direct)) ) + (case (-> self control ground-pat event) + (((pat-event slide)) + (set! (-> arg0 seek0) 0.05) + (set! (-> arg0 seek90) 0.05) + (set! (-> arg0 seek180) 0.05) ) - ) - ) - ) + ) + ) + ) + ) ) :mode 'air :flags (surface-flag check-edge air attack spin gun-direct laser-hide) diff --git a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc index a5c6378c00..dfefd7bde4 100644 --- a/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc +++ b/test/decompiler/reference/jak2/engine/ui/progress/progress_REF.gc @@ -285,42 +285,51 @@ (set! (-> self draw color-mult z) 0.8) (logior! (-> self draw global-effect) (draw-control-global-effect title-light)) (logior! (-> self draw status) (draw-control-status hud)) - (setup-masks (-> self draw) (the-as uint 1) 0) - (setup-masks (-> self draw) (the-as uint 0) 2046) + (setup-masks (-> self draw) 1 0) + (setup-masks (-> self draw) 0 2046) (cond ((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk)) (setup-masks (-> self draw) - (-> *hud-ring-kiosk-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-kiosk-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) ((and (= *cheat-mode* #f) (demo?)) (setup-masks (-> self draw) - (-> *hud-ring-demo-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-demo-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) (else (setup-masks (-> self draw) - (-> *hud-ring-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-graphic-remap* length) + (the-as + int + (-> *hud-ring-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-graphic-remap* length) + ) ) - ) + ) 0 ) ) @@ -345,41 +354,50 @@ (-> (the-as progress (-> self parent-override 0)) node-list data (-> self joint-idx)) ) (when (-> (the-as progress (-> self parent-override 0)) main-menu) - (setup-masks (-> self draw) (the-as uint 0) 2046) + (setup-masks (-> self draw) 0 2046) (cond ((and (= *cheat-mode* #f) (= *kernel-boot-message* 'kiosk)) (setup-masks (-> self draw) - (-> *hud-ring-kiosk-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-kiosk-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) ((and (= *cheat-mode* #f) (demo?)) (setup-masks (-> self draw) - (-> *hud-ring-demo-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-kiosk-graphic-remap* length) + (the-as + int + (-> *hud-ring-demo-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-kiosk-graphic-remap* length) + ) ) - ) + ) 0 ) ) (else (setup-masks (-> self draw) - (-> *hud-ring-graphic-remap* - (mod - (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) - (-> *hud-ring-graphic-remap* length) + (the-as + int + (-> *hud-ring-graphic-remap* + (mod + (+ (-> self graphic-index) (-> (the-as progress (-> self parent-override 0)) graphic-index)) + (-> *hud-ring-graphic-remap* length) + ) ) - ) + ) 0 ) ) @@ -1564,206 +1582,206 @@ (defstate idle (progress) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (when (= v1-0 'notify) - (cond - ((= (-> event param 0) 'done) - (let ((t9-0 format) - (a0-3 #t) - (a1-1 "DONE NOTIFY: ~S ~S~%") - (v1-3 (the-as mc-status-code (-> event param 1))) - ) - (t9-0 - a0-3 - a1-1 - (cond - ((= v1-3 (mc-status-code bad-version)) - "bad-version" - ) - ((= v1-3 (mc-status-code no-save)) - "no-save" - ) - ((= v1-3 (mc-status-code no-last)) - "no-last" - ) - ((= v1-3 (mc-status-code no-space)) - "no-space" - ) - ((= v1-3 (mc-status-code internal-error)) - "internal-error" - ) - ((= v1-3 (mc-status-code no-memory)) - "no-memory" - ) - ((= v1-3 (mc-status-code bad-handle)) - "bad-handle" - ) - ((= v1-3 (mc-status-code busy)) - "busy" - ) - ((= v1-3 (mc-status-code write-error)) - "write-error" - ) - ((= v1-3 (mc-status-code read-error)) - "read-error" - ) - ((= v1-3 (mc-status-code no-card)) - "no-card" - ) - ((= v1-3 (mc-status-code no-format)) - "no-format" - ) - ((= v1-3 (mc-status-code ok)) - "ok" - ) - ((= v1-3 (mc-status-code no-process)) - "no-process" - ) - ((= v1-3 (mc-status-code no-auto-save)) - "no-auto-save" - ) - ((= v1-3 (mc-status-code no-file)) - "no-file" - ) - ((= v1-3 (mc-status-code format-failed)) - "format-failed" - ) - ((= v1-3 (mc-status-code new-game)) - "new-game" - ) - (else - "*unknown*" - ) - ) - (symbol->string (-> self current)) - ) - ) - (case (-> self current) - (('saving) + (the-as + object + (case event-type + (('notify) + (cond + ((= (-> event param 0) 'done) + (let ((t9-0 format) + (a0-3 #t) + (a1-1 "DONE NOTIFY: ~S ~S~%") + (v1-3 (the-as mc-status-code (-> event param 1))) + ) + (t9-0 + a0-3 + a1-1 (cond - ((= (-> self state-stack 0) 'title) - (let ((gp-1 (-> *setting-control* user-default auto-save))) - (sound-volume-off) - (let ((v0-0 (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode))))) - (set! (-> *setting-control* user-default auto-save) gp-1) - v0-0 - ) - ) + ((= v1-3 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-3 (mc-status-code no-save)) + "no-save" + ) + ((= v1-3 (mc-status-code no-last)) + "no-last" + ) + ((= v1-3 (mc-status-code no-space)) + "no-space" + ) + ((= v1-3 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-3 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-3 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-3 (mc-status-code busy)) + "busy" + ) + ((= v1-3 (mc-status-code write-error)) + "write-error" + ) + ((= v1-3 (mc-status-code read-error)) + "read-error" + ) + ((= v1-3 (mc-status-code no-card)) + "no-card" + ) + ((= v1-3 (mc-status-code no-format)) + "no-format" + ) + ((= v1-3 (mc-status-code ok)) + "ok" + ) + ((= v1-3 (mc-status-code no-process)) + "no-process" + ) + ((= v1-3 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-3 (mc-status-code no-file)) + "no-file" + ) + ((= v1-3 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-3 (mc-status-code new-game)) + "new-game" ) (else - (progress-method-30 self) + "*unknown*" ) ) + (symbol->string (-> self current)) ) - (('formatting) - (set-next-state self 'creating 0) - ) - (('creating) - (if (= (-> self state-stack 0) 'title) - (set-next-state self 'select-save-title 0) - (set-next-state self 'select-save 0) - ) - ) - ) - ) - ((= (-> event param 0) 'error) - (let ((t9-7 format) - (a0-18 #t) - (a1-5 "ERROR NOTIFY: ~S ~S ~S~%") - (v1-19 (the-as mc-status-code (-> event param 1))) - ) - (t9-7 - a0-18 - a1-5 - (cond - ((= v1-19 (mc-status-code bad-version)) - "bad-version" - ) - ((= v1-19 (mc-status-code no-save)) - "no-save" - ) - ((= v1-19 (mc-status-code no-last)) - "no-last" - ) - ((= v1-19 (mc-status-code no-space)) - "no-space" - ) - ((= v1-19 (mc-status-code internal-error)) - "internal-error" - ) - ((= v1-19 (mc-status-code no-memory)) - "no-memory" - ) - ((= v1-19 (mc-status-code bad-handle)) - "bad-handle" - ) - ((= v1-19 (mc-status-code busy)) - "busy" - ) - ((= v1-19 (mc-status-code write-error)) - "write-error" - ) - ((= v1-19 (mc-status-code read-error)) - "read-error" - ) - ((= v1-19 (mc-status-code no-card)) - "no-card" - ) - ((= v1-19 (mc-status-code no-format)) - "no-format" - ) - ((= v1-19 (mc-status-code ok)) - "ok" - ) - ((= v1-19 (mc-status-code no-process)) - "no-process" - ) - ((= v1-19 (mc-status-code no-auto-save)) - "no-auto-save" - ) - ((= v1-19 (mc-status-code no-file)) - "no-file" - ) - ((= v1-19 (mc-status-code format-failed)) - "format-failed" - ) - ((= v1-19 (mc-status-code new-game)) - "new-game" - ) - (else - "*unknown*" - ) - ) - (-> self current) - (-> self next) - ) - ) - (case (-> event param 1) - ((14) - (set-next-state self 'insufficient-space 0) - ) - (else - (case (-> self current) - (('formatting 'format-card) - (set-next-state self 'error-formatting 0) - ) - (('creating) - (set-next-state self 'error-creating 0) - ) - (('saving 'select-save 'select-save-title 'select-save-title-hero) - (set-next-state self 'error-saving 0) - ) - (('loading 'select-load) - (set-next-state self 'error-loading 0) + ) + (case (-> self current) + (('saving) + (cond + ((= (-> self state-stack 0) 'title) + (let ((gp-1 (-> *setting-control* user-default auto-save))) + (sound-volume-off) + (let ((v0-0 (progress-intro-start (logtest? (-> *game-info* purchase-secrets) (game-secrets hero-mode))))) + (set! (-> *setting-control* user-default auto-save) gp-1) + v0-0 + ) ) + ) + (else + (progress-method-30 self) ) ) ) - ) + (('formatting) + (set-next-state self 'creating 0) + ) + (('creating) + (if (= (-> self state-stack 0) 'title) + (set-next-state self 'select-save-title 0) + (set-next-state self 'select-save 0) + ) + ) + ) ) - ) + ((= (-> event param 0) 'error) + (let ((t9-7 format) + (a0-18 #t) + (a1-5 "ERROR NOTIFY: ~S ~S ~S~%") + (v1-19 (the-as mc-status-code (-> event param 1))) + ) + (t9-7 + a0-18 + a1-5 + (cond + ((= v1-19 (mc-status-code bad-version)) + "bad-version" + ) + ((= v1-19 (mc-status-code no-save)) + "no-save" + ) + ((= v1-19 (mc-status-code no-last)) + "no-last" + ) + ((= v1-19 (mc-status-code no-space)) + "no-space" + ) + ((= v1-19 (mc-status-code internal-error)) + "internal-error" + ) + ((= v1-19 (mc-status-code no-memory)) + "no-memory" + ) + ((= v1-19 (mc-status-code bad-handle)) + "bad-handle" + ) + ((= v1-19 (mc-status-code busy)) + "busy" + ) + ((= v1-19 (mc-status-code write-error)) + "write-error" + ) + ((= v1-19 (mc-status-code read-error)) + "read-error" + ) + ((= v1-19 (mc-status-code no-card)) + "no-card" + ) + ((= v1-19 (mc-status-code no-format)) + "no-format" + ) + ((= v1-19 (mc-status-code ok)) + "ok" + ) + ((= v1-19 (mc-status-code no-process)) + "no-process" + ) + ((= v1-19 (mc-status-code no-auto-save)) + "no-auto-save" + ) + ((= v1-19 (mc-status-code no-file)) + "no-file" + ) + ((= v1-19 (mc-status-code format-failed)) + "format-failed" + ) + ((= v1-19 (mc-status-code new-game)) + "new-game" + ) + (else + "*unknown*" + ) + ) + (-> self current) + (-> self next) + ) + ) + (case (-> event param 1) + ((14) + (set-next-state self 'insufficient-space 0) + ) + (else + (case (-> self current) + (('formatting 'format-card) + (set-next-state self 'error-formatting 0) + ) + (('creating) + (set-next-state self 'error-creating 0) + ) + (('saving 'select-save 'select-save-title 'select-save-title-hero) + (set-next-state self 'error-saving 0) + ) + (('loading 'select-load) + (set-next-state self 'error-loading 0) + ) + ) + ) + ) + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc index d40b4c432c..54ea16f3ef 100644 --- a/test/decompiler/reference/jak2/levels/common/airlock_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/airlock_REF.gc @@ -425,61 +425,59 @@ (defstate close (com-airlock) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as - object - (cond - ((= v1-0 'close) - (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) - (the-as int (-> event param 0)) - 3000 - ) - ) - ) - (if (and (>= arg1 2) (and (= (-> event 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)) - ) - ((= v1-0 'open) - (set! (-> self latch-open-time) (+ (-> self clock frame-counter) (if (>= arg1 1) + (the-as + object + (case event-type + (('close) + (set! (-> self latch-closed-time) (+ (-> self clock frame-counter) (if (>= arg1 1) (the-as int (-> event param 0)) 3000 ) ) - ) - (if (and (>= arg1 2) (and (= (-> event 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! (identity - (the float (+ (-> (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) frames num-frames) -1)) - ) + ) + (if (and (>= arg1 2) (and (= (-> event 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) (+ (-> self clock frame-counter) (if (>= arg1 1) + (the-as int (-> event param 0)) + 3000 + ) + ) + ) + (if (and (>= arg1 2) (and (= (-> event 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! (identity + (the float (+ (-> (get-art-by-name (-> self draw art-group) "idle" art-joint-anim) frames num-frames) -1)) ) - ) - (and (-> self next-state) (= (-> self next-state name) 'close)) - ) - ((= v1-0 '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)) ) - ) - ((= v1-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)) - ) - ) - ((= v1-0 'sound) - (if (>= (check-crossing-distance self (target-pos 0) #f) 0.0) - (play-city-voice-sound self (the-as symbol (-> event param 0))) + (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)) ) - ((= v1-0 'distance) - (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) + (('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) + (the-as object (play-city-voice-sound self (the-as symbol (-> event param 0)))) + ) + ) + (('distance) + (* (the int (check-crossing-distance self (target-pos 0) #f)) 8) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/battle_REF.gc b/test/decompiler/reference/jak2/levels/common/battle_REF.gc index 41428ce2d9..774f4f265e 100644 --- a/test/decompiler/reference/jak2/levels/common/battle_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/battle_REF.gc @@ -887,72 +887,70 @@ ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 122] ;; WARN: rewrite_to_get_var got a none typed variable. Is there unreachable code? [OP: 147] (defbehavior battle-event-handler battle ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block)) - (let ((v1-0 arg2)) - (the-as object (cond - ((= v1-0 'query) - (case (-> arg3 param 0) - (('beaten) - (and (-> self next-state) (= (-> self next-state name) 'beaten)) - ) - (('hostile) - (and (-> self next-state) (= (-> self next-state name) 'hostile)) - ) - (('idle) - (and (-> self next-state) (= (-> self next-state name) 'idle)) - ) - (('die-count) - (-> self die-count) - ) - (else - #f - ) + (the-as object (case arg2 + (('query) + (case (-> arg3 param 0) + (('beaten) + (and (-> self next-state) (= (-> self next-state name) 'beaten)) + ) + (('hostile) + (and (-> self next-state) (= (-> self next-state name) 'hostile)) + ) + (('idle) + (and (-> self next-state) (= (-> self next-state name) 'idle)) + ) + (('die-count) + (-> self die-count) + ) + (else + #f ) ) - ((= v1-0 'child-die) - (+! (-> self die-count) 1) - (let ((v1-14 (battle-method-30 self arg0))) - (when v1-14 - (set! (-> v1-14 creature) (the-as handle #f)) - #f - ) + ) + (('child-die) + (+! (-> self die-count) 1) + (let ((v1-14 (battle-method-30 self arg0))) + (when v1-14 + (set! (-> v1-14 creature) (the-as handle #f)) + #f ) ) - ((= v1-0 'child-hit) - (let ((a1-3 (battle-method-30 self arg0))) - (when a1-3 - (logior! (-> a1-3 flags) 1) - (battle-method-42 self a1-3 (the-as touch-tracker arg0)) - ) + ) + (('child-hit) + (let ((a1-3 (battle-method-30 self arg0))) + (when a1-3 + (logior! (-> a1-3 flags) 1) + (battle-method-42 self a1-3 (the-as touch-tracker arg0)) ) ) - ((= v1-0 'child-jumped) - (let ((a1-5 (battle-method-30 self arg0))) - (if a1-5 - (battle-method-44 self a1-5) - ) + ) + (('child-jumped) + (let ((a1-5 (battle-method-30 self arg0))) + (if a1-5 + (battle-method-44 self a1-5) + ) + ) + ) + (('trigger) + (if (and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual notice) ) - ) - ((= v1-0 'trigger) - (if (and (-> self next-state) (= (-> self next-state name) 'idle)) - (go-virtual notice) - ) - ) - ((= v1-0 'beaten) - (set! (-> self flags) (the-as uint (logior (the-as int (-> self flags)) 4))) - (if (and (-> self next-state) (= (-> self next-state name) 'idle)) - (go-virtual beaten) - ) - ) - ((= v1-0 'resume) - (set! (-> self flags) (the-as uint (logand -5 (-> self flags)))) - (process-entity-status! self (entity-perm-status subtask-complete) #f) - (if (and (-> self next-state) (= (-> self next-state name) 'beaten)) - (go-virtual hostile) - ) - ) - ) - ) - ) + ) + (('beaten) + (set! (-> self flags) (the-as uint (logior (the-as int (-> self flags)) 4))) + (if (and (-> self next-state) (= (-> self next-state name) 'idle)) + (go-virtual beaten) + ) + ) + (('resume) + (set! (-> self flags) (the-as uint (logand -5 (-> self flags)))) + (process-entity-status! self (entity-perm-status subtask-complete) #f) + (if (and (-> self next-state) (= (-> self next-state name) 'beaten)) + (go-virtual hostile) + ) + ) + ) + ) ) ;; definition for method 27 of type battle diff --git a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc index 9351ab4f3d..bbd9eded99 100644 --- a/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/cty-guard-turret-button_REF.gc @@ -145,18 +145,18 @@ ;; definition for method 32 of type cty-guard-turret-button (defmethod idle-state-transition cty-guard-turret-button ((obj cty-guard-turret-button)) "If `button-status` has [[button-status:0]] set, transition to [[basebutton::27]] otherwise, [[basebutton::30]]" - (setup-masks (-> obj draw) (the-as uint 0) -1) + (setup-masks (-> obj draw) 0 -1) (cond ((logtest? (-> obj button-status) (button-status pressed)) (format #t "off~%") - (setup-masks (-> obj draw) (the-as uint 4) 0) - (setup-masks (-> obj draw) (the-as uint 1) 0) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 1 0) (go (method-of-object obj down-idle)) ) (else (format #t "on~%") - (setup-masks (-> obj draw) (the-as uint 4) 0) - (setup-masks (-> obj draw) (the-as uint 2) 0) + (setup-masks (-> obj draw) 4 0) + (setup-masks (-> obj draw) 2 0) (go (method-of-object obj pop-up)) ) ) @@ -168,9 +168,9 @@ :enter (behavior () (sound-play "gturret-button") (format #t "going-down off~%") - (setup-masks (-> self draw) (the-as uint 0) -1) - (setup-masks (-> self draw) (the-as uint 4) 0) - (setup-masks (-> self draw) (the-as uint 1) 0) + (setup-masks (-> self draw) 0 -1) + (setup-masks (-> self draw) 4 0) + (setup-masks (-> self draw) 1 0) (press! self #t) (none) ) diff --git a/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc b/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc index 640f2c5b4e..1bfeb60c78 100644 --- a/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/elec-gate_REF.gc @@ -416,7 +416,9 @@ ) :trans (behavior () (local-vars - (sv-176 (function lightning-spec time-frame symbol process-drawable vector vector none)) + (sv-176 + (function lightning-spec time-frame symbol process-drawable vector vector none :behavior lightning-tracker) + ) (sv-192 lightning-spec) (sv-208 int) (sv-224 symbol) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc index 4e9112fa3c..1ff1f00891 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/bouncer_REF.gc @@ -46,92 +46,91 @@ (defstate idle (bouncer) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((evt-type event-type)) - (the-as - object - (cond - ((= evt-type 'bonk) - (when ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry (-> event param 0)) - (the-as collide-shape (-> self root)) - (the-as uint 1) - ) - (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) - (sound-play "trampoline") - (go-virtual fire) - ) + (the-as + object + (case event-type + (('bonk) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry (-> event param 0)) + (the-as collide-shape (-> self root)) + (the-as uint 1) + ) + (when (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + (sound-play "trampoline") + (go-virtual fire) ) ) - ((= evt-type 'touch) - (let ((gp-2 (-> event param 0))) - (cond - (((method-of-type touching-shapes-entry prims-touching-action?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (collide-action solid) - (collide-action) - ) - (when ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (the-as uint 1) - ) - (if (not (and (-> self next-state) (let ((v1-21 (-> self next-state name))) - (or (= v1-21 'smush) (= v1-21 'fire)) - ) - ) - ) - (go-virtual smush) - ) - ) - ) - (((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry gp-2) - (the-as collide-shape (-> self root)) - (the-as uint 4) - ) - (persist-with-delay - *setting-control* - (the-as symbol (process->ppointer self)) - (seconds 0.05) - 'double-jump - #f - 0.0 - 0 - ) - ) + ) + (('touch) + (let ((gp-2 (-> event param 0))) + (cond + (((method-of-type touching-shapes-entry prims-touching-action?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (collide-action solid) + (collide-action) ) - ) - ) - ((= evt-type 'attack) - (let ((v1-28 (the-as object (-> event param 1))) - (a0-17 (-> event param 0)) - (a2-7 0) - ) - (cond - ((= (-> (the-as attack-info v1-28) mode) 'flop) - (set! a2-7 1) - ) - ((= (-> (the-as attack-info v1-28) mode) 'board) - (set! a2-7 9) - ) - ) - (when (and (nonzero? a2-7) - (and ((method-of-type touching-shapes-entry prims-touching?) - (the-as touching-shapes-entry a0-17) - (the-as collide-shape (-> self root)) - (the-as uint a2-7) + (when ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (the-as uint 1) + ) + (if (not (and (-> self next-state) (let ((v1-21 (-> self next-state name))) + (or (= v1-21 'smush) (= v1-21 'fire)) + ) ) - (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) - ) - ) - (sound-play "trampoline") - (go-virtual fire) - #f + ) + (go-virtual smush) + ) + ) + ) + (((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry gp-2) + (the-as collide-shape (-> self root)) + (the-as uint 4) ) + (the-as object (persist-with-delay + *setting-control* + (the-as symbol (process->ppointer self)) + (seconds 0.05) + 'double-jump + #f + 0.0 + 0 + ) + ) + ) ) ) - ) + ) + (('attack) + (let ((v1-28 (the-as object (-> event param 1))) + (a0-17 (-> event param 0)) + (a2-7 0) + ) + (cond + ((= (-> (the-as attack-info v1-28) mode) 'flop) + (set! a2-7 1) + ) + ((= (-> (the-as attack-info v1-28) mode) 'board) + (set! a2-7 9) + ) + ) + (when (and (nonzero? a2-7) + (and ((method-of-type touching-shapes-entry prims-touching?) + (the-as touching-shapes-entry a0-17) + (the-as collide-shape (-> self root)) + (the-as uint a2-7) + ) + (send-event proc 'jump (-> self spring-height) (-> self spring-height) (-> self mods)) + ) + ) + (sound-play "trampoline") + (go-virtual fire) + #f + ) + ) + ) ) ) ) diff --git a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc index cdf98753a9..177bf2f648 100644 --- a/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/enemy/guards/guard-conversation_REF.gc @@ -311,21 +311,19 @@ (defstate active (guard-conversation) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (cond - ((= v1-0 'trigger) - (let ((v0-0 #t)) - (set! (-> self triggered?) v0-0) - v0-0 - ) + (the-as object (case event-type + (('trigger) + (let ((v0-0 #t)) + (set! (-> self triggered?) v0-0) + v0-0 ) - ((= v1-0 'untrigger) - (set! (-> self triggered?) #f) - #f - ) - ) - ) - ) + ) + (('untrigger) + (set! (-> self triggered?) #f) + #f + ) + ) + ) ) :trans (behavior () (let ((gp-0 #t)) diff --git a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc index 33525b33ac..0172c132ae 100644 --- a/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/guard-projectile_REF.gc @@ -586,8 +586,8 @@ (set! (-> v1-5 notify-radius) 122880.0) (set! (-> v1-5 danger-level) 1.0) (set! (-> v1-5 decay-rate) 0.0) - (set! (-> v1-5 flags) (the-as uint 1)) - (set! (-> v1-5 danger-type) (the-as uint 0)) + (set! (-> v1-5 flags) (traffic-danger-flags tdf0)) + (set! (-> v1-5 danger-type) (traffic-danger-type tdt0)) (set! (-> v1-5 handle) (the-as uint #f)) (send-event *traffic-manager* 'add-danger-sphere v1-5) ) @@ -864,25 +864,25 @@ (defstate impact (vehicle-grenade) :virtual #t :event (behavior ((proc process) (arg1 int) (event-type symbol) (event event-message-block)) - (let ((v1-0 event-type)) - (the-as object (when (= v1-0 'touched) - (let ((a1-2 (new 'stack-no-clear 'event-message-block))) - (set! (-> a1-2 from) (process->ppointer self)) - (set! (-> a1-2 num-params) 2) - (set! (-> a1-2 message) 'attack) - (set! (-> a1-2 param 0) (-> event param 0)) - (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) - (set! (-> v1-5 id) (-> self attack-id)) - (set! (-> v1-5 mode) 'explode) - (set! (-> a1-2 param 1) (the-as uint v1-5)) - ) - (if (send-event-function proc a1-2) - #t - ) - ) - ) - ) - ) + (the-as object (case event-type + (('touched) + (let ((a1-2 (new 'stack-no-clear 'event-message-block))) + (set! (-> a1-2 from) (process->ppointer self)) + (set! (-> a1-2 num-params) 2) + (set! (-> a1-2 message) 'attack) + (set! (-> a1-2 param 0) (-> event param 0)) + (let ((v1-5 (new 'static 'attack-info :mask (attack-info-mask mode id)))) + (set! (-> v1-5 id) (-> self attack-id)) + (set! (-> v1-5 mode) 'explode) + (set! (-> a1-2 param 1) (the-as uint v1-5)) + ) + (if (send-event-function proc a1-2) + #t + ) + ) + ) + ) + ) ) :code (behavior () (let ((gp-0 (new 'stack-no-clear 'explosion-init-params))) diff --git a/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc b/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc index 9fe7558cf0..aa60c7d008 100644 --- a/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc +++ b/test/decompiler/reference/jak2/levels/common/scene-actor_REF.gc @@ -407,75 +407,48 @@ (the-as pair 0) ) (set! (-> obj draw light-index) (the-as uint 10)) - (let* ((s5-2 (get-process *default-dead-pool* manipy #x4000)) - (s4-1 - (when s5-2 - (let ((t9-5 (method-of-type manipy activate))) - (t9-5 (the-as manipy s5-2) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-2 run-function-in-process) - (s3-0 s5-2) - (s2-0 manipy-init) - (s1-0 (-> obj root trans)) - (s0-0 (-> obj entity)) - (t0-0 (art-group-get-by-name *level* "skel-metalkor-highres-lowtorso" (the-as (pointer uint32) #f))) - (t1-0 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-2) s3-0 s2-0 s1-0 s0-0 t0-0 t1-0) - ) - (-> s5-2 ppointer) - ) - ) - ) + (let ((s4-1 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-lowtorso" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-1) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-1) 'prefix "lowtorso-") ) - (let* ((s5-3 (get-process *default-dead-pool* manipy #x4000)) - (s4-3 - (when s5-3 - (let ((t9-11 (method-of-type manipy activate))) - (t9-11 (the-as manipy s5-3) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-4 run-function-in-process) - (s3-1 s5-3) - (s2-1 manipy-init) - (s1-1 (-> obj root trans)) - (s0-1 (-> obj entity)) - (t0-1 (art-group-get-by-name *level* "skel-metalkor-highres-legs" (the-as (pointer uint32) #f))) - (t1-1 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-4) s3-1 s2-1 s1-1 s0-1 t0-1 t1-1) - ) - (-> s5-3 ppointer) - ) - ) - ) + (let ((s4-3 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-legs" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-3) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-3) 'prefix "legs-") ) - (let* ((s5-4 (get-process *default-dead-pool* manipy #x4000)) - (s4-5 - (when s5-4 - (let ((t9-17 (method-of-type manipy activate))) - (t9-17 (the-as manipy s5-4) obj (symbol->string (-> manipy symbol)) (the-as pointer #x70004000)) - ) - (let ((s4-6 run-function-in-process) - (s3-2 s5-4) - (s2-2 manipy-init) - (s1-2 (-> obj root trans)) - (s0-2 (-> obj entity)) - (t0-2 (art-group-get-by-name *level* "skel-metalkor-highres-wings" (the-as (pointer uint32) #f))) - (t1-2 #f) - ) - 0 - ((the-as (function object object object object object object none) s4-6) s3-2 s2-2 s1-2 s0-2 t0-2 t1-2) - ) - (-> s5-4 ppointer) - ) - ) - ) + (let ((s4-5 (process-spawn + manipy + :init manipy-init + (-> obj root trans) + (-> obj entity) + (art-group-get-by-name *level* "skel-metalkor-highres-wings" (the-as (pointer uint32) #f)) + #f + 0 + :to obj + ) + ) + ) (send-event (ppointer->process s4-5) 'anim-mode 'clone-anim) (send-event (ppointer->process s4-5) 'prefix "wings-") ) diff --git a/test/offline/config/jak2/config.jsonc b/test/offline/config/jak2/config.jsonc index 4cbb293b37..520a931db0 100644 --- a/test/offline/config/jak2/config.jsonc +++ b/test/offline/config/jak2/config.jsonc @@ -203,7 +203,9 @@ // process-drawable - return from thread "(method 19 process-drawable)", - "(method 10 joint-control)" + "(method 10 joint-control)", + + "entity-lookup-part-group" ], "skip_compile_states": {