wip: better stack var support (#4222)

Closes #736

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
This commit is contained in:
water111
2026-04-18 18:14:44 -04:00
committed by GitHub
parent 3e3542cb10
commit 637990314b
1385 changed files with 94985 additions and 111624 deletions
+14 -6
View File
@@ -62,7 +62,8 @@ FormElement* SetVarOp::get_as_form(FormPool& pool, const Env& env) const {
m_dst,
pool.alloc_single_element_form<GenericElement>(
nullptr, GenericOperator::make_fixed(FixedOperatorKind::ADDRESS_OF),
pool.alloc_single_element_form<StackSpillValueElement>(nullptr, -1, offset, false)),
pool.alloc_single_element_form<StackSpillValueElement>(
nullptr, -1, offset, make_stack_slot_access(offset), false)),
true, env.stack_slot_entries.at(offset).typespec);
}
} else {
@@ -843,10 +844,16 @@ FormElement* StackSpillLoadOp::get_as_form(FormPool& pool, const Env& env) const
if (kv != env.stack_slot_entries.end()) {
type = kv->second.typespec;
}
return pool.alloc_element<SetVarElement>(m_dst,
pool.alloc_single_element_form<StackSpillValueElement>(
nullptr, m_size, m_offset, m_is_signed),
true, type);
std::optional<TypeSpec> read_type;
if (env.has_type_analysis()) {
read_type = env.get_types_before_op(m_my_idx).get_slot(m_offset).typespec();
}
return pool.alloc_element<SetVarElement>(
m_dst,
pool.alloc_single_element_form<StackSpillValueElement>(
nullptr, m_size, m_offset, env.get_stack_slot_access_for_op(m_my_idx, m_offset),
m_is_signed, read_type),
true, type);
}
FormElement* StackSpillStoreOp::get_as_form(FormPool& pool, const Env& env) const {
@@ -866,6 +873,7 @@ FormElement* StackSpillStoreOp::get_as_form(FormPool& pool, const Env& env) cons
}
}
return pool.alloc_element<StackSpillStoreElement>(m_value, m_size, m_offset, cast_type);
return pool.alloc_element<StackSpillStoreElement>(
m_value, m_size, m_offset, env.get_stack_slot_access_for_op(m_my_idx, m_offset), cast_type);
}
} // namespace decompiler
+242
View File
@@ -4,6 +4,7 @@
#include <stdexcept>
#include <unordered_set>
#include "AtomicOp.h"
#include "Form.h"
#include "common/goos/PrettyPrinter.h"
@@ -162,6 +163,10 @@ std::string Env::get_variable_name(const RegisterAccess& access) const {
}
std::string Env::get_variable_name_name_only(const RegisterAccess& access) const {
if (is_stack_slot_access(access)) {
return get_spill_slot_var_name(get_stack_slot_offset_from_access(access));
}
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
return var_info.name();
@@ -172,6 +177,14 @@ std::string Env::get_variable_name_name_only(const RegisterAccess& access) const
}
VariableWithCast Env::get_variable_and_cast(const RegisterAccess& access) const {
if (is_stack_slot_access(access)) {
VariableWithCast result;
auto original_name = get_spill_slot_var_name(get_stack_slot_offset_from_access(access));
auto remapped = m_var_remap.find(original_name);
result.name = remapped != m_var_remap.end() ? remapped->second : original_name;
return result;
}
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
// this is a bit of a confusing process. The first step is to grab the auto-generated name:
@@ -272,6 +285,10 @@ goos::Object Env::get_variable_name_with_cast(Register reg, int atomic_idx, Acce
}
std::optional<TypeSpec> Env::get_user_cast_for_access(const RegisterAccess& access) const {
if (is_stack_slot_access(access)) {
return {};
}
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
std::string original_name = var_info.name();
@@ -310,6 +327,22 @@ std::optional<TypeSpec> Env::get_user_cast_for_access(const RegisterAccess& acce
* of the variable.
*/
TypeSpec Env::get_variable_type(const RegisterAccess& access, bool using_user_var_types) const {
if (is_stack_slot_access(access)) {
auto offset = get_stack_slot_offset_from_access(access);
auto it = stack_slot_entries.find(offset);
if (it != stack_slot_entries.end()) {
auto type_of_var = it->second.typespec;
if (using_user_var_types) {
auto retype_kv = m_var_retype.find(it->second.name());
if (retype_kv != m_var_retype.end()) {
type_of_var = retype_kv->second;
}
}
return type_of_var;
}
return TypeSpec("object");
}
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
std::string original_name = var_info.name();
@@ -328,6 +361,37 @@ TypeSpec Env::get_variable_type(const RegisterAccess& access, bool using_user_va
}
}
TP_Type Env::get_variable_tp_type(const RegisterAccess& access, bool using_user_var_types) const {
if (is_stack_slot_access(access)) {
auto offset = get_stack_slot_offset_from_access(access);
auto it = stack_slot_entries.find(offset);
if (it != stack_slot_entries.end()) {
auto type_of_var = it->second.tp_type;
if (using_user_var_types) {
auto retype_kv = m_var_retype.find(it->second.name());
if (retype_kv != m_var_retype.end()) {
type_of_var = TP_Type::make_from_ts(retype_kv->second);
}
}
return type_of_var;
}
return TP_Type::make_from_ts(TypeSpec("object"));
}
if (access.reg().get_kind() == Reg::FPR || access.reg().get_kind() == Reg::GPR) {
auto& var_info = m_var_names.lookup(access.reg(), access.idx(), access.mode());
if (using_user_var_types) {
auto retype_kv = m_var_retype.find(var_info.name());
if (retype_kv != m_var_retype.end()) {
return TP_Type::make_from_ts(retype_kv->second);
}
}
return var_info.type;
}
throw std::runtime_error("TP types are not supported for this kind of register");
}
/*!
* Update the Env with the result of the type analysis pass.
*/
@@ -420,6 +484,9 @@ std::vector<VariableNames::VarInfo> Env::extract_visible_variables(
std::vector<std::pair<RegId, RegisterAccess>> vars;
for (auto& x : var_set) {
if (is_stack_slot_access(x)) {
continue;
}
if (x.reg().get_kind() == Reg::FPR || x.reg().get_kind() == Reg::GPR) {
vars.push_back(std::make_pair(get_program_var_id(x), x));
}
@@ -480,6 +547,16 @@ FunctionVariableDefinitions Env::local_var_type_list(const Form* top_level_form,
int nargs_to_ignore) const {
ASSERT(nargs_to_ignore <= 8);
auto vars = extract_visible_variables(top_level_form);
std::unordered_set<int> visible_stack_slots;
if (top_level_form) {
RegAccessSet var_set;
top_level_form->collect_vars(var_set, true);
for (const auto& var : var_set) {
if (is_stack_slot_access(var)) {
visible_stack_slots.insert(get_stack_slot_offset_from_access(var));
}
}
}
FunctionVariableDefinitions result;
std::vector<goos::Object> elts;
@@ -514,11 +591,17 @@ FunctionVariableDefinitions Env::local_var_type_list(const Form* top_level_form,
// it looks like this is the order the GOAL compiler itself used.
std::vector<StackSpillEntry> spills;
for (auto& x : stack_slot_entries) {
if (top_level_form && !visible_stack_slots.count(x.first)) {
continue;
}
spills.push_back(x.second);
}
std::sort(spills.begin(), spills.end(),
[](const StackSpillEntry& a, const StackSpillEntry& b) { return a.offset < b.offset; });
for (auto& x : spills) {
if (m_vars_defined_in_let.find(x.name()) != m_vars_defined_in_let.end()) {
continue;
}
elts.push_back(pretty_print::build_list(x.name(), x.typespec.print()));
count++;
}
@@ -539,27 +622,186 @@ std::unordered_set<RegId, RegId::hash> Env::get_ssa_var(const RegAccessSet& vars
}
RegId Env::get_program_var_id(const RegisterAccess& var) const {
if (is_stack_slot_access(var)) {
return RegId(Register(Reg::GPR, Reg::SP), get_stack_slot_var_id_from_access(var));
}
return m_var_names.lookup(var.reg(), var.idx(), var.mode()).reg_id;
}
const UseDefInfo& Env::get_use_def_info(const RegisterAccess& ra) const {
ASSERT(has_local_vars());
if (is_stack_slot_access(ra)) {
return m_stack_slot_use_def_info.at(get_program_var_id(ra));
}
auto var_id = get_program_var_id(ra);
return m_var_names.use_def_info.at(var_id);
}
RegisterAccess Env::get_stack_slot_access_for_op(int op_id, int offset) const {
auto it = m_stack_slot_var_by_op.find(op_id);
if (it == m_stack_slot_var_by_op.end()) {
return make_stack_slot_access(offset);
}
return make_stack_slot_access(offset, it->second);
}
void Env::disable_def(const RegisterAccess& access, DecompWarnings& warnings) {
if (is_stack_slot_access(access)) {
// Stack-slot use/def info is intentionally immutable during expression building.
// Unlike registers, the stack-slot analysis models value lifetimes through merged control flow
// with synthetic phi-like vars, and mutating counts here would desynchronize later accesses
// from that analysis.
return;
}
if (has_local_vars()) {
m_var_names.disable_def(access, warnings);
}
}
void Env::disable_use(const RegisterAccess& access) {
if (is_stack_slot_access(access)) {
// See disable_def above.
return;
}
if (has_local_vars()) {
m_var_names.disable_use(access);
}
}
void Env::rebuild_stack_slot_use_def_info() {
m_stack_slot_use_def_info.clear();
m_stack_slot_var_by_op.clear();
if (!func || !func->ir2.atomic_ops) {
return;
}
const auto& ops = *func->ir2.atomic_ops;
const int block_count = (int)ops.block_id_to_first_atomic_op.size();
std::vector<int> op_to_block(ops.ops.size(), -1);
for (int block_id = 0; block_id < block_count; block_id++) {
for (int op_id = ops.block_id_to_first_atomic_op.at(block_id);
op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) {
op_to_block.at(op_id) = block_id;
}
}
std::unordered_set<int> offsets;
for (int op_id = 0; op_id < (int)ops.ops.size(); op_id++) {
if (auto* store = dynamic_cast<const StackSpillStoreOp*>(ops.ops.at(op_id).get())) {
offsets.insert(store->offset());
} else if (auto* load = dynamic_cast<const StackSpillLoadOp*>(ops.ops.at(op_id).get())) {
offsets.insert(load->offset());
}
}
int next_var_id = 1;
for (int offset : offsets) {
std::vector<bool> reads_before_write(block_count, false);
std::vector<bool> writes(block_count, false);
for (int block_id = 0; block_id < block_count; block_id++) {
bool seen_write = false;
for (int op_id = ops.block_id_to_first_atomic_op.at(block_id);
op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) {
const auto* op = ops.ops.at(op_id).get();
if (auto* load = dynamic_cast<const StackSpillLoadOp*>(op)) {
if (load->offset() == offset && !seen_write) {
reads_before_write.at(block_id) = true;
}
} else if (auto* store = dynamic_cast<const StackSpillStoreOp*>(op)) {
if (store->offset() == offset) {
writes.at(block_id) = true;
seen_write = true;
}
}
}
}
std::vector<bool> live_in(block_count, false);
std::vector<bool> live_out(block_count, false);
bool changed = true;
while (changed) {
changed = false;
for (int block_id = block_count - 1; block_id >= 0; block_id--) {
bool new_live_out = false;
for (int succ : {func->basic_blocks.at(block_id).succ_branch,
func->basic_blocks.at(block_id).succ_ft}) {
if (succ != -1 && live_in.at(succ)) {
new_live_out = true;
}
}
bool new_live_in =
reads_before_write.at(block_id) || (new_live_out && !writes.at(block_id));
if (new_live_in != live_in.at(block_id) || new_live_out != live_out.at(block_id)) {
live_in.at(block_id) = new_live_in;
live_out.at(block_id) = new_live_out;
changed = true;
}
}
}
std::vector<int> phi_var(block_count, -1);
std::vector<std::vector<int>> phi_sources(block_count);
for (int block_id = 0; block_id < block_count; block_id++) {
if (live_in.at(block_id)) {
phi_var.at(block_id) = next_var_id++;
}
}
for (int block_id = 0; block_id < block_count; block_id++) {
int current_var = live_in.at(block_id) ? phi_var.at(block_id) : -1;
for (int op_id = ops.block_id_to_first_atomic_op.at(block_id);
op_id < ops.block_id_to_end_atomic_op.at(block_id); op_id++) {
const auto* op = ops.ops.at(op_id).get();
if (auto* load = dynamic_cast<const StackSpillLoadOp*>(op)) {
if (load->offset() != offset) {
continue;
}
ASSERT(current_var != -1);
m_stack_slot_var_by_op[op_id] = current_var;
auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), current_var)];
info.uses.push_back({op_id, block_id, AccessMode::READ, false});
info.ssa_vars.insert(current_var);
} else if (auto* store = dynamic_cast<const StackSpillStoreOp*>(op)) {
if (store->offset() != offset) {
continue;
}
current_var = next_var_id++;
m_stack_slot_var_by_op[op_id] = current_var;
auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), current_var)];
info.defs.push_back({op_id, block_id, AccessMode::WRITE, false});
info.ssa_vars.insert(current_var);
}
}
if (!live_out.at(block_id)) {
continue;
}
ASSERT(current_var != -1);
for (int succ :
{func->basic_blocks.at(block_id).succ_branch, func->basic_blocks.at(block_id).succ_ft}) {
if (succ != -1 && live_in.at(succ)) {
phi_sources.at(succ).push_back(current_var);
}
}
}
for (int block_id = 0; block_id < block_count; block_id++) {
if (phi_var.at(block_id) == -1) {
continue;
}
int first_op = ops.block_id_to_first_atomic_op.at(block_id);
for (int src_var : phi_sources.at(block_id)) {
auto& info = m_stack_slot_use_def_info[RegId(Register(Reg::GPR, Reg::SP), src_var)];
info.uses.push_back({first_op, block_id, AccessMode::READ, false});
}
}
}
}
/*!
* Set the stack hints. This must be done before type analysis.
* This actually parses the types, so it should be done after the dts is set up.
+36
View File
@@ -44,6 +44,36 @@ struct StackSpillEntry {
}
};
constexpr int STACK_SLOT_VAR_STRIDE = 1 << 16;
inline bool is_stack_slot_access(const RegisterAccess& access) {
return access.reg() == Register(Reg::GPR, Reg::SP) && access.idx() < 0;
}
inline int get_stack_slot_offset_from_access(const RegisterAccess& access) {
ASSERT(is_stack_slot_access(access));
return (-access.idx() - 1) / STACK_SLOT_VAR_STRIDE;
}
inline int get_stack_slot_var_id_from_access(const RegisterAccess& access) {
ASSERT(is_stack_slot_access(access));
return (-access.idx() - 1) % STACK_SLOT_VAR_STRIDE;
}
inline RegisterAccess make_stack_slot_access(int offset, int var_id = 0) {
ASSERT(var_id >= 0);
ASSERT(var_id < STACK_SLOT_VAR_STRIDE);
return RegisterAccess(AccessMode::READ, Register(Reg::GPR, Reg::SP),
-1 - (offset * STACK_SLOT_VAR_STRIDE + var_id), true);
}
inline bool same_expression_var(const RegisterAccess& a, const RegisterAccess& b) {
if (is_stack_slot_access(a) || is_stack_slot_access(b)) {
return a == b;
}
return a.reg() == b.reg();
}
struct FunctionVariableDefinitions {
std::optional<goos::Object> local_vars;
bool had_pp = false;
@@ -126,6 +156,7 @@ class Env {
void set_local_vars(const VariableNames& names) {
m_var_names = names;
m_has_local_vars = true;
rebuild_stack_slot_use_def_info();
}
void set_end_var(RegisterAccess var) { m_end_var = var; }
@@ -193,6 +224,7 @@ class Env {
}
const UseDefInfo& get_use_def_info(const RegisterAccess& ra) const;
RegisterAccess get_stack_slot_access_for_op(int op_id, int offset) const;
void disable_use(const RegisterAccess& access);
void disable_def(const RegisterAccess& access, DecompWarnings& warnings);
@@ -228,6 +260,8 @@ class Env {
bool pp_mapped_by_behavior() const { return m_pp_mapped_by_behavior; }
private:
void rebuild_stack_slot_use_def_info();
RegisterAccess m_end_var;
bool m_has_reg_use = false;
@@ -235,6 +269,8 @@ class Env {
bool m_has_local_vars = false;
VariableNames m_var_names;
std::unordered_map<RegId, UseDefInfo, RegId::hash> m_stack_slot_use_def_info;
std::unordered_map<int, int> m_stack_slot_var_by_op;
bool m_has_types = false;
bool m_pp_mapped_by_behavior = false;
+26 -5
View File
@@ -7,6 +7,7 @@
#include "common/type_system/TypeSystem.h"
#include "common/util/print_float.h"
#include "decompiler/IR2/Env.h"
#include "decompiler/ObjectFile/LinkedObjectFile.h"
#include "decompiler/util/DecompilerTypeSystem.h"
#include "decompiler/util/data_decompile.h"
@@ -2775,8 +2776,13 @@ void VectorFloatLoadStoreElement::collect_vf_regs(RegSet& regs) const {
StackSpillStoreElement::StackSpillStoreElement(SimpleAtom value,
int size,
int stack_offset,
RegisterAccess access,
const std::optional<TypeSpec>& cast_type)
: m_value(value), m_size(size), m_stack_offset(stack_offset), m_cast_type(cast_type) {}
: m_value(value),
m_size(size),
m_stack_offset(stack_offset),
m_access(access),
m_cast_type(cast_type) {}
goos::Object StackSpillStoreElement::to_form_internal(const Env& env) const {
return pretty_print::build_list(
@@ -2801,11 +2807,24 @@ void StackSpillStoreElement::get_modified_regs(RegSet&) const {}
// StackSpillValueElement
////////////////////////////////
StackSpillValueElement::StackSpillValueElement(int size, int stack_offset, bool is_signed)
: m_size(size), m_stack_offset(stack_offset), m_is_signed(is_signed) {}
StackSpillValueElement::StackSpillValueElement(int size,
int stack_offset,
RegisterAccess access,
bool is_signed,
std::optional<TypeSpec> read_type)
: m_size(size),
m_stack_offset(stack_offset),
m_access(access),
m_is_signed(is_signed),
m_read_type(std::move(read_type)) {}
goos::Object StackSpillValueElement::to_form_internal(const Env& env) const {
return pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset));
auto var = m_access;
auto base = pretty_print::to_symbol(env.get_spill_slot_var_name(m_stack_offset));
if (m_read_type && env.get_variable_type(var, true) != *m_read_type) {
return pretty_print::build_list("the-as", m_read_type->print(), base);
}
return base;
}
void StackSpillValueElement::apply(const std::function<void(FormElement*)>& f) {
@@ -2813,7 +2832,9 @@ void StackSpillValueElement::apply(const std::function<void(FormElement*)>& f) {
}
void StackSpillValueElement::apply_form(const std::function<void(Form*)>&) {}
void StackSpillValueElement::collect_vars(RegAccessSet&, bool) const {}
void StackSpillValueElement::collect_vars(RegAccessSet& vars, bool) const {
vars.insert(m_access);
}
void StackSpillValueElement::get_modified_regs(RegSet&) const {}
////////////////////////////////
+13 -1
View File
@@ -1545,6 +1545,7 @@ class StackSpillStoreElement : public FormElement {
StackSpillStoreElement(SimpleAtom value,
int size,
int stack_offset,
RegisterAccess access,
const std::optional<TypeSpec>& cast_type);
goos::Object to_form_internal(const Env& env) const override;
void apply(const std::function<void(FormElement*)>& f) override;
@@ -1553,18 +1554,27 @@ class StackSpillStoreElement : public FormElement {
void get_modified_regs(RegSet& regs) const override;
void push_to_stack(const Env& env, FormPool& pool, FormStack& stack) override;
const std::optional<TypeSpec>& cast_type() const { return m_cast_type; }
const RegisterAccess& access() const { return m_access; }
int stack_offset() const { return m_stack_offset; }
private:
SimpleAtom m_value;
int m_size = -1;
int m_stack_offset = -1;
RegisterAccess m_access;
std::optional<TypeSpec> m_cast_type;
};
// the value from a stack load.
class StackSpillValueElement : public FormElement {
public:
StackSpillValueElement(int size, int stack_offset, bool is_signed);
StackSpillValueElement(int size,
int stack_offset,
RegisterAccess access,
bool is_signed,
std::optional<TypeSpec> read_type = std::nullopt);
int stack_offset() const { return m_stack_offset; }
const RegisterAccess& access() const { return m_access; }
goos::Object to_form_internal(const Env& env) const override;
void apply(const std::function<void(FormElement*)>& f) override;
void apply_form(const std::function<void(Form*)>& f) override;
@@ -1579,7 +1589,9 @@ class StackSpillValueElement : public FormElement {
private:
int m_size = -1;
int m_stack_offset = -1;
RegisterAccess m_access;
bool m_is_signed = false;
std::optional<TypeSpec> m_read_type;
};
class MethodOfTypeElement : public FormElement {
+226 -40
View File
@@ -12,6 +12,7 @@
#include "common/util/BitUtils.h"
#include "common/util/print_float.h"
#include "decompiler/IR2/Env.h"
#include "decompiler/IR2/ExpressionHelpers.h"
#include "decompiler/IR2/bitfields.h"
#include "decompiler/ObjectFile/LinkedObjectFile.h"
@@ -65,6 +66,56 @@
namespace decompiler {
namespace {
Form* cast_form(Form* in, const TypeSpec& new_type, FormPool& pool, const Env& env, bool tc_pass);
TypeSpec get_input_type_for_access(const Env& env, const RegisterAccess& access) {
if (is_stack_slot_access(access)) {
return env.get_variable_type(access, true);
}
return env.get_types_before_op(access.idx()).get(access.reg()).typespec();
}
Form* cast_stack_slot_var_if_needed(Form* in,
const TypeSpec& desired_type,
FormPool& pool,
const Env& env) {
auto atom = form_as_atom(in);
if (atom && atom->is_var() && is_stack_slot_access(atom->var()) &&
env.get_variable_type(atom->var(), true) != desired_type) {
return cast_form(in, desired_type, pool, env, false);
}
return in;
}
Form* cast_inlined_function_symbol_if_needed(Form* in,
const TypeSpec& desired_type,
FormPool& pool,
const Env& env) {
if (!env.has_type_analysis() || desired_type.base_type() != "function") {
return in;
}
auto existing_cast = in->try_as_element<CastElement>();
if (existing_cast && existing_cast->type() == desired_type) {
return in;
}
auto obj = in->to_form(env);
if (!obj.is_symbol()) {
return in;
}
try {
auto symbol_type = env.dts->lookup_symbol_type(obj.as_symbol().name_ptr);
if (symbol_type.base_type() == "function" && symbol_type != desired_type) {
return pool.form<CastElement>(desired_type, in);
}
} catch (const std::runtime_error&) {
}
return in;
}
Form* strip_pcypld_64(Form* in) {
auto m = match(Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::PCPYLD),
{Matcher::integer(0), Matcher::any(0)}),
@@ -347,6 +398,9 @@ Form* repop_passthrough_arg(Form* in,
auto as_atom = form_as_atom(in);
if (as_atom && as_atom->is_var()) {
if (is_stack_slot_access(as_atom->var())) {
return in;
}
return stack.pop_reg(as_atom->var().reg(), {}, env, true, -1, orig_out, found_orig_out);
}
return in;
@@ -377,18 +431,37 @@ void pop_helper(const std::vector<RegisterAccess>& vars,
const std::optional<RegSet>& consumes = std::nullopt,
const std::vector<int>& times_used = {}) {
// to submit to stack to attempt popping
std::vector<Register> submit_regs;
// submit_reg[i] is for var submit_reg_to_var[i]
std::vector<size_t> submit_reg_to_var;
std::vector<RegisterAccess> submit_vars;
// submit_vars[i] is for var submit_var_to_var[i]
std::vector<size_t> submit_var_to_var;
// build submission for stack
std::unordered_map<Register, int, Register::hash> reg_counts;
std::unordered_map<std::string, int> stack_var_counts;
for (auto& v : vars) {
reg_counts[v.reg()]++;
if (is_stack_slot_access(v)) {
stack_var_counts[env.get_variable_name_name_only(v)]++;
} else {
reg_counts[v.reg()]++;
}
}
for (size_t var_idx = 0; var_idx < vars.size(); var_idx++) {
const auto& var = vars.at(var_idx);
if (is_stack_slot_access(var)) {
int times = 1;
if (!times_used.empty()) {
times = times_used.at(var_idx);
}
auto& use_def = env.get_use_def_info(var);
if (stack_var_counts.at(env.get_variable_name_name_only(var)) == 1 &&
use_def.use_count() == times && use_def.def_count() == 1) {
submit_var_to_var.push_back(var_idx);
submit_vars.push_back(var);
}
continue;
}
auto& ri = env.reg_use().op.at(var.idx());
RegSet consumes_to_use = consumes.value_or(ri.consumes);
if (consumes_to_use.find(var.reg()) != consumes_to_use.end()) {
@@ -402,8 +475,8 @@ void pop_helper(const std::vector<RegisterAccess>& vars,
auto& use_def = env.get_use_def_info(var);
if (use_def.use_count() == times && use_def.def_count() == 1) {
submit_reg_to_var.push_back(var_idx);
submit_regs.push_back(var.reg());
submit_var_to_var.push_back(var_idx);
submit_vars.push_back(var);
} else {
// auto var_id = env.get_program_var_id(var);
// lg::print(
@@ -429,9 +502,9 @@ void pop_helper(const std::vector<RegisterAccess>& vars,
// submit and get a result! If the stack has nothing to pop, the result here may be nullptr.
std::vector<Form*> pop_result;
// loop in reverse (later vals first)
for (size_t i = submit_regs.size(); i-- > 0;) {
for (size_t i = submit_vars.size(); i-- > 0;) {
// figure out what var we are:
auto var_idx = submit_reg_to_var.at(i);
auto var_idx = submit_var_to_var.at(i);
// anything _less_ than this should be unmodified by the pop
// it's fine to modify yourself in your pop.
@@ -442,7 +515,7 @@ void pop_helper(const std::vector<RegisterAccess>& vars,
// do the pop, with the barrier to prevent out-of-sequence popping.
pop_result.push_back(
stack.pop_reg(submit_regs.at(i), pop_barrier_regs, env, allow_side_effects));
stack.pop_reg(submit_vars.at(i), pop_barrier_regs, env, allow_side_effects));
}
// now flip back to the source order for making the final result
std::reverse(pop_result.begin(), pop_result.end());
@@ -452,9 +525,9 @@ void pop_helper(const std::vector<RegisterAccess>& vars,
forms.resize(vars.size(), nullptr);
if (!pop_result.empty()) {
// success!
for (size_t i = 0; i < submit_regs.size(); i++) {
for (size_t i = 0; i < submit_vars.size(); i++) {
// fill out vars from our submission
forms.at(submit_reg_to_var.at(i)) = pop_result.at(i);
forms.at(submit_var_to_var.at(i)) = pop_result.at(i);
}
}
@@ -555,6 +628,14 @@ std::vector<Form*> pop_to_forms(const std::vector<RegisterAccess>& vars,
for (size_t i = 0; i < vars.size(); i++) {
auto atom = form_as_atom(forms[i]);
bool is_var = atom && atom->is_var();
if (is_var && is_stack_slot_access(atom->var())) {
auto access_type = get_input_type_for_access(env, vars[i]);
if (env.get_variable_type(atom->var(), true) != access_type) {
forms[i] = cast_form(forms[i], access_type, pool, env);
atom = form_as_atom(forms[i]);
is_var = atom && atom->is_var();
}
}
auto cast = env.get_user_cast_for_access(vars[i]);
// only cast if we didn't get a var (compacting expressions).
// there is a separate system for casting variables that will do a better job.
@@ -1008,6 +1089,26 @@ void SimpleExpressionElement::update_from_stack_float_2_nestable(const Env& env,
bool allow_side_effects) {
if (is_float_type(env, m_my_idx, m_expr.get_arg(0).var()) &&
is_float_type(env, m_my_idx, m_expr.get_arg(1).var())) {
if (m_expr.get_arg(0).var() == m_expr.get_arg(1).var()) {
auto arg =
pop_to_forms({m_expr.get_arg(0).var()}, env, pool, stack, allow_side_effects, {}, {2})
.at(0);
if (kind == FixedOperatorKind::MULTIPLICATION) {
result->push_back(pool.alloc_element<GenericElement>(
GenericOperator::make_function(pool.form<ConstantTokenElement>("square")), arg));
return;
}
auto atom = form_as_atom(arg);
if (atom) {
auto arg_copy = pool.form<SimpleAtomElement>(*atom);
auto new_form =
make_and_compact_math_op(arg, arg_copy, {}, {}, pool, env, kind, true, false);
result->push_back(new_form);
return;
}
}
auto args = pop_to_forms({m_expr.get_arg(0).var(), m_expr.get_arg(1).var()}, env, pool, stack,
allow_side_effects);
auto new_form =
@@ -1146,7 +1247,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
ASSERT(used_index);
result->push_back(pool.alloc_element<DerefElement>(args.at(1), out.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env),
out.addr_of, tokens));
return;
} else {
throw std::runtime_error(
@@ -1186,7 +1289,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
ASSERT(used_index);
result->push_back(pool.alloc_element<DerefElement>(args.at(1), out.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env),
out.addr_of, tokens));
return;
} else {
throw std::runtime_error(
@@ -1215,7 +1320,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
ASSERT(used_index);
result->push_back(pool.alloc_element<DerefElement>(args.at(1), out.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env),
out.addr_of, tokens));
return;
} else {
throw std::runtime_error(
@@ -1267,7 +1374,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
ASSERT(used_index);
result->push_back(pool.alloc_element<DerefElement>(args.at(0), rd_ok.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(0), arg0_type.typespec(), pool, env),
rd_ok.addr_of, tokens));
return;
} else {
throw std::runtime_error(fmt::format(
@@ -1318,7 +1427,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
}
}
ASSERT(used_index);
result->push_back(pool.alloc_element<DerefElement>(args.at(1), rd_ok.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env),
rd_ok.addr_of, tokens));
return;
} else {
// TODO - output error to IR
@@ -1341,7 +1452,9 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
tokens.push_back(to_token(tok));
}
result->push_back(pool.alloc_element<DerefElement>(args.at(1), out.addr_of, tokens));
result->push_back(pool.alloc_element<DerefElement>(
cast_stack_slot_var_if_needed(args.at(1), arg1_type.typespec(), pool, env), out.addr_of,
tokens));
return;
}
}
@@ -2357,7 +2470,7 @@ void SimpleExpressionElement::update_from_stack_int_to_float(const Env& env,
// the gpr->fpr operation beacuse it doesn't matter.
auto fpr_convert_matcher =
Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::GPR_TO_FPR), {Matcher::any(0)});
auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec();
auto type = get_input_type_for_access(env, var);
// want to allow any child of integer so integer enums can also be converted to floats.
if (env.dts->ts.tc(TypeSpec("integer"), type) || type == TypeSpec("seconds")) {
auto mr = match(fpr_convert_matcher, arg);
@@ -2379,7 +2492,7 @@ void SimpleExpressionElement::update_from_stack_float_to_int(const Env& env,
bool allow_side_effects) {
auto var = m_expr.get_arg(0).var();
auto arg = pop_to_forms({var}, env, pool, stack, allow_side_effects).at(0);
auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec();
auto type = get_input_type_for_access(env, var);
auto fpr_convert_matcher =
Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::GPR_TO_FPR), {Matcher::any(0)});
auto mr = match(fpr_convert_matcher, arg);
@@ -2412,7 +2525,7 @@ void SimpleExpressionElement::update_from_stack_subu_l32_s7(const Env& env,
bool allow_side_effects) {
auto var = m_expr.get_arg(0).var();
auto arg = pop_to_forms({var}, env, pool, stack, allow_side_effects).at(0);
auto type = env.get_types_before_op(var.idx()).get(var.reg()).typespec();
auto type = get_input_type_for_access(env, var);
if (type != TypeSpec("handle")) {
env.func->warnings.warning(
".subu (32-bit) used on a {} at idx {}. This probably should be a handle.", type.print(),
@@ -2623,6 +2736,12 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
// if we are a reg-reg move that consumes the original, push it without popping from stack.
// it is the Stack's responsibility to untangle these later on.
if (m_src->is_single_element()) {
auto spill_value = dynamic_cast<StackSpillValueElement*>(m_src->back());
if (spill_value) {
stack.push_non_seq_reg_to_reg(m_dst, spill_value->access(), m_src, m_src_type, m_var_info);
return;
}
auto src_as_se = dynamic_cast<SimpleExpressionElement*>(m_src->back());
if (src_as_se) {
if (src_as_se->expr().kind() == SimpleExpression::Kind::IDENTITY &&
@@ -2634,9 +2753,15 @@ void SetVarElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
}
auto var = src_as_se->expr().get_arg(0).var();
auto& info = env.reg_use().op.at(var.idx());
if (var.reg() == Register(Reg::GPR, Reg::S6) ||
info.consumes.find(var.reg()) != info.consumes.end()) {
bool is_consumed_reg_move = false;
if (is_stack_slot_access(var)) {
auto& use_def = env.get_use_def_info(var);
is_consumed_reg_move = use_def.use_count() == 1 && use_def.def_count() == 1;
} else {
auto& info = env.reg_use().op.at(var.idx());
is_consumed_reg_move = info.consumes.find(var.reg()) != info.consumes.end();
}
if (var.reg() == Register(Reg::GPR, Reg::S6) || is_consumed_reg_move) {
stack.push_non_seq_reg_to_reg(m_dst, src_as_se->expr().get_arg(0).var(), m_src,
m_src_type, m_var_info);
return;
@@ -3495,8 +3620,14 @@ void FunctionCallElement::update_from_stack(const Env& env,
}
TypeSpec function_type;
auto& in_type_state = env.get_types_before_op(all_pop_vars.at(0).idx());
auto& tp_type = in_type_state.get(all_pop_vars.at(0).reg());
const TypeState* in_type_state = nullptr;
TP_Type tp_type;
if (!is_stack_slot_access(all_pop_vars.at(0))) {
in_type_state = &env.get_types_before_op(all_pop_vars.at(0).idx());
tp_type = in_type_state->get(all_pop_vars.at(0).reg());
} else {
tp_type = env.get_variable_tp_type(all_pop_vars.at(0), true);
}
if (env.has_type_analysis()) {
function_type = tp_type.typespec();
}
@@ -3504,7 +3635,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
// if we're actually a go:
Form* go_next_state = nullptr;
if (tp_type.kind == TP_Type::Kind::ENTER_STATE_FUNCTION) {
auto& next_state_type = in_type_state.next_state_type;
ASSERT(in_type_state);
auto& next_state_type = in_type_state->next_state_type;
if (next_state_type.typespec().base_type() != "state") {
throw std::runtime_error("Bad state type in expressions (not state): " +
next_state_type.print());
@@ -3591,7 +3723,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
auto val = unstacked.at(arg_id + 1); // first is the function itself.
auto& var = all_pop_vars.at(arg_id + 1);
if (has_good_types) {
auto actual_arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec();
auto actual_arg_type = get_input_type_for_access(env, var);
if (arg_id == 0) {
first_arg_type = actual_arg_type;
@@ -3965,7 +4097,9 @@ void FunctionCallElement::update_from_stack(const Env& env,
}
}
new_form = pool.alloc_element<GenericElement>(GenericOperator::make_function(unstacked.at(0)),
auto called_function =
cast_inlined_function_symbol_if_needed(unstacked.at(0), function_type, pool, env);
new_form = pool.alloc_element<GenericElement>(GenericOperator::make_function(called_function),
arg_forms);
{
@@ -3997,7 +4131,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
ASSERT(new_args.size() >= 3);
for (size_t i = 0; i < 3; i++) {
auto& var = all_pop_vars.at(i + 1); // 0 is the function itself.
auto arg_type = env.get_types_before_op(var.idx()).get(var.reg()).typespec();
auto arg_type = get_input_type_for_access(env, var);
if (!env.dts->ts.tc(expected_arg_types.at(i), arg_type)) {
new_args.at(i) = pool.form<CastElement>(expected_arg_types.at(i), new_args.at(i));
}
@@ -4027,7 +4161,7 @@ void FunctionCallElement::update_from_stack(const Env& env,
if (match_result.matched) {
auto& alloc = match_result.maps.strings.at(allocation);
if (alloc != "global" && alloc != "debug" && alloc != "process" &&
alloc != "loading-level") {
alloc != "loading-level" && alloc != "process-level-heap") {
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
}
auto type_2 = match_result.maps.strings.at(type_for_arg);
@@ -5031,9 +5165,11 @@ void CondWithElseElement::push_to_stack(const Env& env, FormPool& pool, FormStac
// determine if set destination is used
bool set_unused = false;
if (rewrite_as_set) {
auto& info = env.reg_use().op.at(last_var->idx());
if (info.written_and_unused.find(last_var->reg()) != info.written_and_unused.end()) {
set_unused = true;
if (!is_stack_slot_access(*last_var)) {
auto& info = env.reg_use().op.at(last_var->idx());
if (info.written_and_unused.find(last_var->reg()) != info.written_and_unused.end()) {
set_unused = true;
}
}
}
@@ -6019,7 +6155,7 @@ void ConditionElement::push_to_stack(const Env& env, FormPool& pool, FormStack&
if (m_src[i]->is_var()) {
auto& var = m_src[i]->var();
vars.push_back(var);
source_types.push_back(env.get_types_before_op(var.idx()).get(var.reg()).typespec());
source_types.push_back(get_input_type_for_access(env, var));
} else if (m_src[i]->is_int()) {
if (m_src[i]->get_int() == 0 && condition_uses_float(m_kind)) {
// if we're doing a floating point comparison, and one of our arguments is a constant
@@ -6072,7 +6208,7 @@ void ConditionElement::update_from_stack(const Env& env,
if (m_src[i]->is_var()) {
auto& var = m_src[i]->var();
vars.push_back(var);
source_types.push_back(env.get_types_before_op(var.idx()).get(var.reg()).typespec());
source_types.push_back(get_input_type_for_access(env, var));
} else if (m_src[i]->is_int()) {
if (m_src[i]->get_int() == 0 && condition_uses_float(m_kind)) {
// if we're doing a floating point comparison, and one of our arguments is a constant
@@ -6915,11 +7051,53 @@ void StackSpillStoreElement::push_to_stack(const Env& env, FormPool& pool, FormS
src = pool.form<SimpleAtomElement>(m_value);
}
auto dst = pool.form<ConstantTokenElement>(env.get_spill_slot_var_name(m_stack_offset));
if (m_cast_type) {
src = cast_form(src, *m_cast_type, pool, env);
}
stack.push_form_element(pool.alloc_element<SetFormFormElement>(dst, src), true);
TypeSpec stack_type("object");
auto it = env.stack_slot_entries.find(m_stack_offset);
if (it != env.stack_slot_entries.end()) {
stack_type = it->second.typespec;
} else if (m_cast_type) {
stack_type = *m_cast_type;
}
auto src_as_generic = src->try_as_element<GenericElement>();
if (src_as_generic && !src_as_generic->op().is_func()) {
using InplaceOpInfo = std::pair<FixedOperatorKind, FixedOperatorKind>;
const static std::array<InplaceOpInfo, 6> in_place_ops = {
InplaceOpInfo{FixedOperatorKind::ADDITION, FixedOperatorKind::ADDITION_IN_PLACE},
InplaceOpInfo{FixedOperatorKind::ADDITION_PTR, FixedOperatorKind::ADDITION_PTR_IN_PLACE},
InplaceOpInfo{FixedOperatorKind::LOGAND, FixedOperatorKind::LOGAND_IN_PLACE},
InplaceOpInfo{FixedOperatorKind::LOGIOR, FixedOperatorKind::LOGIOR_IN_PLACE},
InplaceOpInfo{FixedOperatorKind::LOGCLEAR, FixedOperatorKind::LOGCLEAR_IN_PLACE},
InplaceOpInfo{FixedOperatorKind::LOGXOR, FixedOperatorKind::LOGXOR_IN_PLACE},
};
auto dst_var = m_access;
auto dst_form = pool.form<SimpleAtomElement>(SimpleAtom::make_var(dst_var))->to_form(env);
for (const auto& [kind, inplace_kind] : in_place_ops) {
if (!src_as_generic->op().is_fixed(kind)) {
continue;
}
for (int inplace_arg : {0, 1}) {
if (src_as_generic->elts().at(inplace_arg)->to_form(env) != dst_form) {
continue;
}
if (inplace_arg != 0) {
std::swap(src_as_generic->elts().at(0), src_as_generic->elts().at(1));
}
src_as_generic->op() = GenericOperator::make_fixed(inplace_kind);
stack.push_form_element(src_as_generic, true);
return;
}
}
}
stack.push_value_to_reg(m_access, src, true, stack_type);
}
namespace {
@@ -7173,13 +7351,21 @@ void StackStructureDefElement::update_from_stack(const Env&,
result->push_back(this);
}
void StackSpillValueElement::update_from_stack(const Env&,
FormPool&,
void StackSpillValueElement::update_from_stack(const Env& env,
FormPool& pool,
FormStack&,
std::vector<FormElement*>* result,
bool) {
mark_popped();
result->push_back(this);
auto var = m_access;
Form* form =
pool.alloc_single_element_form<SimpleAtomElement>(nullptr, SimpleAtom::make_var(var));
if (m_read_type && env.get_variable_type(var, true) != *m_read_type) {
form = cast_form(form, *m_read_type, pool, env);
}
for (auto elt : form->elts()) {
result->push_back(elt);
}
}
void GetSymbolStringPointer::update_from_stack(const Env&,
+81 -17
View File
@@ -9,6 +9,26 @@
#include "decompiler/util/DecompilerTypeSystem.h"
namespace decompiler {
namespace {
bool nonempty_intersection(const RegSet& a, const RegSet& b) {
for (auto x : a) {
if (b.find(x) != b.end()) {
return true;
}
}
return false;
}
bool can_inline_non_seq_source(const RegisterAccess& src, const Env& env) {
if (!is_stack_slot_access(src)) {
return true;
}
const auto& use_def = env.get_use_def_info(src);
return use_def.use_count() == 1 && use_def.def_count() == 1;
}
} // namespace
std::string FormStack::StackEntry::print(const Env& env) const {
if (destination.has_value()) {
ASSERT(source && !elt);
@@ -116,19 +136,61 @@ Form* FormStack::pop_reg(const RegisterAccess& var,
const Env& env,
bool allow_side_effects,
int begin_idx) {
return pop_reg(var.reg(), barrier, env, allow_side_effects, begin_idx);
}
RegSet modified;
size_t begin = m_stack.size();
if (begin_idx >= 0) {
begin = begin_idx;
}
for (size_t i = begin; i-- > 0;) {
auto& entry = m_stack.at(i);
if (entry.active) {
if (entry.destination.has_value() && same_expression_var(*entry.destination, var)) {
entry.source->get_modified_regs(modified);
if (!allow_side_effects && entry.source->has_side_effects()) {
return nullptr;
}
if (nonempty_intersection(modified, barrier)) {
return nullptr;
}
entry.active = false;
ASSERT(entry.source);
if (entry.non_seq_source.has_value()) {
ASSERT(entry.sequence_point == false);
if (can_inline_non_seq_source(*entry.non_seq_source, env)) {
auto result = pop_reg(*entry.non_seq_source, barrier, env, allow_side_effects, i);
if (result) {
return result;
}
}
}
namespace {
bool nonempty_intersection(const RegSet& a, const RegSet& b) {
for (auto x : a) {
if (b.find(x) != b.end()) {
return true;
return entry.source;
} else {
if (entry.sequence_point) {
return nullptr;
}
if (entry.source) {
ASSERT(!entry.elt);
entry.source->get_modified_regs(modified);
if (!allow_side_effects) {
return nullptr;
}
} else {
ASSERT(entry.elt);
entry.elt->get_modified_regs(modified);
if (!allow_side_effects && entry.elt->has_side_effects()) {
return nullptr;
}
}
}
} else {
if (entry.destination.has_value() && same_expression_var(*entry.destination, var)) {
return nullptr;
}
}
}
return false;
return nullptr;
}
} // namespace
Form* FormStack::pop_reg(Register reg,
const RegSet& barrier,
@@ -164,13 +226,15 @@ Form* FormStack::pop_reg(Register reg,
ASSERT(entry.source);
if (entry.non_seq_source.has_value()) {
ASSERT(entry.sequence_point == false);
auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i);
if (result) {
if (found_orig_out) {
*found_orig_out = true;
*orig_out = *entry.destination;
if (can_inline_non_seq_source(*entry.non_seq_source, env)) {
auto result = pop_reg(entry.non_seq_source->reg(), barrier, env, allow_side_effects, i);
if (result) {
if (found_orig_out) {
*found_orig_out = true;
*orig_out = *entry.destination;
}
return result;
}
return result;
}
}
@@ -325,7 +389,7 @@ std::vector<FormElement*> FormStack::rewrite(FormPool& pool, const Env& env) con
while (keep_going && !result.empty()) {
keep_going = false;
auto last_op_as_set = dynamic_cast<SetVarElement*>(result.back());
if (last_op_as_set && last_op_as_set->dst().reg() == var_to_get.reg()) {
if (last_op_as_set && same_expression_var(last_op_as_set->dst(), var_to_get)) {
result.pop_back();
auto as_one = dynamic_cast<SimpleExpressionElement*>(
last_op_as_set->src()->try_as_single_element());
@@ -384,7 +448,7 @@ std::optional<RegisterAccess> rewrite_to_get_var(std::vector<FormElement*>& defa
while (keep_going && !default_result.empty()) {
keep_going = false;
auto last_op_as_set = dynamic_cast<SetVarElement*>(default_result.back());
if (last_op_as_set && last_op_as_set->dst().reg() == var_to_get.reg() &&
if (last_op_as_set && same_expression_var(last_op_as_set->dst(), var_to_get) &&
(first || last_op_as_set->info().is_compactable)) {
default_result.pop_back();
auto as_one =
+7
View File
@@ -305,6 +305,13 @@ bool Matcher::do_match(Form* input, MatchResult::Maps* maps_out, const Env* cons
}
}
auto as_stack_spill =
dynamic_cast<StackSpillValueElement*>(input->try_as_single_active_element());
if (as_stack_spill) {
got = true;
result = as_stack_spill->access();
}
if (got) {
if (m_kind == Kind::REG) {
return result.reg() == *m_reg;
+41 -8
View File
@@ -45,6 +45,8 @@ If the previous let variables appear in the definition of new one, make the let
namespace {
FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats);
FormElement* rewrite_multi_let_as_vector_dot(LetElement* in, const Env& env, FormPool& pool);
bool let_uses_stack_slot_access(const LetElement* in);
std::vector<Form*> path_up_tree(Form* in, const Env&) {
std::vector<Form*> path;
@@ -2409,6 +2411,18 @@ FormElement* rewrite_set_font_single(LetElement* in,
FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewriteStats& stats) {
// ordered based on frequency. for best performance, you check the most likely rewrites first!
if (in->entries().size() >= 6) {
auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool);
if (as_vector_dot) {
stats.vector_dot++;
return as_vector_dot;
}
}
if (let_uses_stack_slot_access(in)) {
return nullptr;
}
auto as_unused = rewrite_empty_let(in, env, pool);
if (as_unused) {
stats.unused++;
@@ -3073,6 +3087,18 @@ FormElement* rewrite_multi_let(LetElement* in,
const Env& env,
FormPool& pool,
LetRewriteStats& stats) {
if (in->entries().size() >= 6) {
auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool);
if (as_vector_dot) {
stats.vector_dot++;
return as_vector_dot;
}
}
if (let_uses_stack_slot_access(in)) {
return in;
}
if (in->entries().size() >= 2) {
auto as_with_dma_buf_add_bucket = rewrite_with_dma_buf_add_bucket(in, env, pool);
if (as_with_dma_buf_add_bucket) {
@@ -3101,14 +3127,6 @@ FormElement* rewrite_multi_let(LetElement* in,
}
}
if (in->entries().size() >= 6) {
auto as_vector_dot = rewrite_multi_let_as_vector_dot(in, env, pool);
if (as_vector_dot) {
stats.vector_dot++;
return as_vector_dot;
}
}
auto as_font_set_origin = rewrite_set_font_origin(in, env, pool);
if (as_font_set_origin) {
stats.font_method++;
@@ -3569,6 +3587,12 @@ FormElement* rewrite_let_sequence(const std::vector<LetElement*>& in,
const Env& env,
FormPool& pool,
LetRewriteStats& stats) {
for (const auto* let : in) {
if (let_uses_stack_slot_access(let)) {
return nullptr;
}
}
if (in.size() == 3) {
auto as_dma_buffer_add_gs_set = rewrite_dma_buffer_add_gs_set(in, env, pool);
if (as_dma_buffer_add_gs_set) {
@@ -3609,6 +3633,15 @@ Form* insert_cast_for_let(RegisterAccess dst,
return src;
}
bool let_uses_stack_slot_access(const LetElement* in) {
for (const auto& entry : in->entries()) {
if (is_stack_slot_access(entry.dest)) {
return true;
}
}
return false;
}
bool register_can_hold_var(const Register& reg) {
return reg.get_kind() == Reg::FPR || reg.get_kind() == Reg::GPR;
}
@@ -2778,7 +2778,7 @@
[[1, 7], "v1", "drawable-region-prim"]
],
"(method 18 drawable-region-face)": [
[[33, 84], "v1", "(inline-array vector)"]
["_stack_", 56, "(inline-array vector)"]
],
"(method 18 drawable-tree-region-prim)": [
[[22, 49], "s2", "drawable-region-prim"]
@@ -4051,7 +4051,9 @@
[64, "a0", "process-drawable"]
],
"process-drawable2-shock-effect": [[59, "v0", "lightning-tracker"]],
"process-drawable-shock-effect": [[156, "v0", "lightning-tracker"]],
"process-drawable-shock-effect": [
["_stack_", 624, "(pointer lightning-tracker)"]
],
"(method 12 top-anim-joint-control)": [
[8, "a1", "art-joint-anim"],
[40, "a1", "art-joint-anim"]
@@ -5967,7 +5969,7 @@
"(post idle drill-plat)": [[4, "t9", "(function none)"]],
"(post idle grenade-point)": [[122, "v1", "lightning-tracker"]],
"(anon-function 12 strip-obs)": [
[103, "a0", "(pointer entity-actor)"],
["_stack_", 16, "(pointer entity-actor)"],
[287, "v1", "int"]
],
"(method 11 strip-hazard)": [
@@ -7,5 +7,6 @@
"task-manager-init-by-other": 2048,
"race-manager-init-by-other": 1024,
"neo-sat-shield-init-by-other": 64,
"bt-gun-manager-init-by-other": 256
"bt-gun-manager-init-by-other": 256,
"(method 11 tpl-holo-eye)": 384
}
+233 -62
View File
@@ -230,7 +230,11 @@
[324, "v1", "(pointer uint64)"],
[334, "v1", "(pointer uint64)"],
[141, "v1", "int"],
[25, "v1", "dma-tag"]
[25, "v1", "dma-tag"],
["_stack_", 16, "uint"],
["_stack_", 32, "dma-packet"],
["_stack_", 64, "dma-packet"],
["_stack_", 80, "dma-packet"]
],
"(method 3 connection-minimap)": [[97, "f0", "float"]],
"dma-buffer-add-ref-texture": [
@@ -1307,7 +1311,8 @@
"target-compute-edge": [[48, "a0", "process-drawable"]],
"history-draw": [
[16, "a1", "int"],
[151, "a0", "uint"]
[151, "a0", "uint"],
["_stack_", 24, "float"]
],
"history-print": [[20, "a1", "int"]],
"target-collision-reaction": [
@@ -2119,7 +2124,11 @@
["_stack_", 16, "dma-packet"],
[91, "v1", "dma-packet"]
],
"target-history-print": [["_stack_", 32, "collide-status"]],
"target-history-print": [
["_stack_", 32, "collide-status"],
["_stack_", 68, "float"],
["_stack_", 40, "float"]
],
"(method 13 sync-linear)": [
["_stack_", 16, "res-tag"],
[27, "v0", "(pointer float)"]
@@ -5316,8 +5325,14 @@
"(code extend min-bridge)": [[49, "v1", "art-joint-anim"]],
"(code extended min-folding-plat)": [[15, "v1", "art-joint-anim"]],
"(code extend min-folding-plat)": [[44, "v1", "art-joint-anim"]],
"(method 11 min-falling-step)": [["_stack_", 16, "res-tag"]],
"(method 11 rat-spawner)": [["_stack_", 16, "res-tag"]],
"(method 11 min-falling-step)": [
["_stack_", 16, "res-tag"],
[19, "v0", "(pointer actor-group)"]
],
"(method 11 rat-spawner)": [
["_stack_", 16, "res-tag"],
[31, "v0", "(pointer actor-group)"]
],
"(method 0 flow-control)": [["_stack_", 16, "res-tag"]],
"(code lowered min-falling-step)": [[18, "v1", "art-joint-anim"]],
"(code lowering min-falling-step)": [[65, "v1", "art-joint-anim"]],
@@ -5354,7 +5369,10 @@
[62, "v1", "collide-shape-prim-group"],
[[65, 71], "v1", "collide-shape-prim-group"]
],
"(method 11 min-rat-engine)": [["_stack_", 16, "res-tag"]],
"(method 11 min-rat-engine)": [
["_stack_", 16, "res-tag"],
[61, "v0", "(pointer actor-group)"]
],
"(method 21 min-target-sign)": [[[21, 25], "gp", "collide-shape-prim-group"]],
"min-bomb-elevator-callback": [[[3, 31], "v1", "min-bomb-elevator"]],
"(enter running min-rat-engine)": [[68, "v1", "collide-shape-prim-group"]],
@@ -5373,7 +5391,10 @@
"(method 34 min-crane-switch)": [[35, "v1", "art-joint-anim"]],
"joint-mod-rat-engine-callback": [[6, "v1", "min-rat-engine"]],
"(method 27 min-rat-engine)": [[14, "a2", "process-focusable"]],
"(method 11 rat-light-manager)": [["_stack_", 16, "res-tag"]],
"(method 11 rat-light-manager)": [
["_stack_", 16, "res-tag"],
[12, "v0", "(pointer actor-group)"]
],
"(code idle manta)": [
[100, "v1", "art-joint-anim"],
[46, "v1", "art-joint-anim"]
@@ -5426,7 +5447,10 @@
[15, "a0", "process-focusable"],
[18, "a0", "process-focusable"]
],
"(method 121 manta)": [["_stack_", 16, "res-tag"]],
"(method 121 manta)": [
["_stack_", 16, "res-tag"],
[87, "v0", "(pointer actor-group)"]
],
"(code wheel-die rat)": [[14, "v1", "art-joint-anim"]],
"rat-joint-mod-roll": [[9, "gp", "rat"]],
"(code running-in-wheel rat)": [
@@ -5544,7 +5568,10 @@
[17, "a0", "task-manager"],
[20, "a0", "task-manager"]
],
"(method 11 min-bomb-train)": [["_stack_", 16, "res-tag"]],
"(method 11 min-bomb-train)": [
["_stack_", 16, "res-tag"],
[129, "v0", "(pointer actor-group)"]
],
"(code hostile-wall gekko)": [
[20, "v1", "art-joint-anim"],
[70, "v1", "art-joint-anim"]
@@ -5633,7 +5660,10 @@
[47, "v1", "art-joint-anim"]
],
"(method 108 gekko)": [[19, "v1", "process-focusable"]],
"(method 11 basebutton)": [["_stack_", 16, "res-tag"]],
"(method 11 basebutton)": [
["_stack_", 16, "res-tag"],
[67, "v0", "(pointer actor-group)"]
],
"clmf-cam-string": [["_stack_", 16, "res-tag"]],
"(code knocked-recover grunt)": [
[15, "v1", "ragdoll-proc"],
@@ -5981,7 +6011,10 @@
"sew-fan-joint-fan": [[[3, 20], "v1", "sew-fan"]],
"(method 82 sew-fan)": [[[46, 63], "v1", "attack-info"]],
"(method 11 sew-wall-switch)": [["_stack_", 16, "res-tag"]],
"(method 11 sew-pipe)": [["_stack_", 16, "res-tag"]],
"(method 11 sew-pipe)": [
["_stack_", 16, "res-tag"],
[87, "v0", "(pointer actor-group)"]
],
"(enter down sew-pipe)": [[13, "v1", "art-joint-anim"]],
"(code lower sew-pipe)": [[83, "v1", "art-joint-anim"]],
"(enter raised sew-m-gate)": [[13, "v1", "art-joint-anim"]],
@@ -6110,7 +6143,10 @@
[194, "v0", "vector"],
["_stack_", 16, "res-tag"]
],
"(method 11 saberfish-spawn-manager-base)": [["_stack_", 16, "res-tag"]],
"(method 11 saberfish-spawn-manager-base)": [
["_stack_", 16, "res-tag"],
[22, "v0", "(pointer actor-group)"]
],
"(method 26 saberfish-spawner)": [
[[9, 49], "gp", "saberfish-spawner-query-msg"],
[[77, 85], "v1", "saberfish-spawner-command"],
@@ -6704,7 +6740,12 @@
[13, "v1", "int"],
[86, "a0", "part-tracker"]
],
"(method 32 task-manager-nest-cocoons)": [["_stack_", 16, "res-tag"]],
"(method 32 task-manager-nest-cocoons)": [
["_stack_", 16, "res-tag"],
[18, "v0", "(pointer actor-group)"],
[17, "v0", "(pointer actor-group)"],
[31, "v0", "(pointer actor-group)"]
],
"(code active task-manager-nest-cocoons)": [
[155, "v1", "(pointer process)"],
[168, "gp", "handle"]
@@ -6789,13 +6830,17 @@
],
"(method 11 spider-manager)": [
["_stack_", 16, "res-tag"],
["_stack_", 32, "res-tag"]
["_stack_", 32, "res-tag"],
[62, "v0", "(pointer actor-group)"]
],
"ripple-find-height": [[[31, 82], "s4", "mei-ripple"]],
"(method 21 task-manager-desert-hover)": [["_stack_", 16, "res-tag"]],
"(method 11 nst-metalhead-eggs)": [["_stack_", 16, "res-tag"]],
"(method 11 nst-falling-stone-bridge)": [["_stack_", 16, "res-tag"]],
"(method 11 sew-m-gate)": [["_stack_", 16, "res-tag"]],
"(method 11 sew-m-gate)": [
["_stack_", 16, "res-tag"],
[87, "v0", "(pointer actor-group)"]
],
"(method 9 turret-control)": [[344, "a0", "collide-shape-prim"]],
"(method 62 v-marauder)": [[[4, 53], "s5", "collide-shape-prim-group"]],
"(method 62 v-marauder-b)": [[[4, 53], "s5", "collide-shape-prim-group"]],
@@ -6966,9 +7011,18 @@
],
"(event closed tpl-break-door-a)": [[[9, 22], "v1", "attack-info"]],
"(event closed tpl-break-alcove)": [[[4, 17], "v1", "attack-info"]],
"(method 11 tpl-fan-three)": [[99, "v0", "(pointer float)"]],
"(method 11 tpl-spindle)": [[131, "v0", "(pointer float)"]],
"(method 11 tpl-fan-two)": [[99, "v0", "(pointer float)"]],
"(method 11 tpl-fan-three)": [
[99, "v0", "(pointer float)"],
["_stack_", 16, "res-tag"]
],
"(method 11 tpl-spindle)": [
[131, "v0", "(pointer float)"],
["_stack_", 16, "res-tag"]
],
"(method 11 tpl-fan-two)": [
[99, "v0", "(pointer float)"],
["_stack_", 16, "res-tag"]
],
"(event idle-up tpl-spike-trap)": [
[42, "gp", "process-drawable"],
[83, "gp", "process-focusable"]
@@ -7004,10 +7058,22 @@
[99, "v0", "(pointer actor-group)"],
["_stack_", 96, "res-tag"]
],
"(method 11 tpl-watcher-manager)": [["_stack_", 16, "res-tag"]],
"(method 11 hover-training-manager)": [["_stack_", 16, "res-tag"]],
"(method 11 tpl-token)": [["_stack_", 16, "res-tag"]],
"(method 11 tpl-holo-eye)": [["_stack_", 16, "res-tag"]],
"(method 11 tpl-watcher-manager)": [
["_stack_", 16, "res-tag"],
[24, "v0", "(pointer actor-group)"]
],
"(method 11 hover-training-manager)": [
["_stack_", 16, "res-tag"],
[23, "v0", "(pointer actor-group)"]
],
"(method 11 tpl-token)": [
["_stack_", 16, "res-tag"],
[110, "v0", "(pointer actor-group)"]
],
"(method 11 tpl-holo-eye)": [
["_stack_", 16, "res-tag"],
[56, "v0", "(pointer actor-group)"]
],
"(code firing tpl-watcher)": [[143, "a1", "process-drawable"]],
"(event firing tpl-watcher)": [[[4, 13], "v1", "attack-info"]],
"(event idle tpl-watcher)": [[[12, 21], "v1", "attack-info"]],
@@ -7306,8 +7372,14 @@
[209, "v1", "art-joint-anim"]
],
"(code active tow-spawner)": [[14, "v1", "art-joint-anim"]],
"(method 11 actor-group-watcher)": [["_stack_", 16, "res-tag"]],
"(method 11 tow-large-plat)": [["_stack_", 16, "res-tag"]],
"(method 11 actor-group-watcher)": [
["_stack_", 16, "res-tag"],
[13, "v0", "(pointer actor-group)"]
],
"(method 11 tow-large-plat)": [
["_stack_", 16, "res-tag"],
[121, "v0", "(pointer actor-group)"]
],
"update-mood-forest": [[[23, 71], "gp", "forest-states"]],
"set-forest-gun-flash!": [[13, "v1", "forest-states"]],
"set-forest-fog-interp!": [
@@ -7345,11 +7417,17 @@
[763, "s5", "handle"],
[761, "v1", "handle"]
],
"(method 32 task-manager-forest-machine)": [["_stack_", 16, "res-tag"]],
"(method 32 task-manager-forest-machine)": [
["_stack_", 16, "res-tag"],
[18, "v0", "(pointer actor-group)"],
[31, "v0", "(pointer actor-group)"],
[17, "v0", "(pointer actor-group)"]
],
"(method 32 task-manager-forest-plants)": [["_stack_", 16, "res-tag"]],
"(code active task-manager-forest-machine-resolution)": [
[78, "v1", "int"],
["_stack_", 16, "res-tag"]
["_stack_", 16, "res-tag"],
[99, "v0", "(pointer actor-group)"]
],
"set-railx-light-brightness-fora!": [
[[30, 35], "v1", "railx-states-fora"],
@@ -7400,7 +7478,10 @@
[15, "v0", "path-control"],
[111, "v0", "entity-actor"]
],
"(method 32 task-manager-forest-ring-chase)": [["_stack_", 16, "res-tag"]],
"(method 32 task-manager-forest-ring-chase)": [
["_stack_", 16, "res-tag"],
[17, "v0", "(pointer actor-group)"]
],
"(enter impact dp-bipedal-grenade-shot)": [
[13, "v1", "collide-shape-prim-group"]
],
@@ -7505,7 +7586,10 @@
[71, "s5", "process-focusable"]
],
"(method 41 dp-bipedal-shield)": [[9, "v1", "attack-info"]],
"(method 121 dp-bipedal)": [["_stack_", 16, "res-tag"]],
"(method 121 dp-bipedal)": [
["_stack_", 16, "res-tag"],
[116, "v0", "(pointer actor-group)"]
],
"(method 121 neo-wasp)": [
[211, "v0", "(pointer float)"],
["_stack_", 16, "res-tag"],
@@ -7543,8 +7627,14 @@
"neo-spawner-handler": [[[71, 119], "gp", "attack-info"]],
"(code vulnerable neo-spawner)": [[14, "v1", "art-joint-anim"]],
"(enter dead neo-spawner)": [[27, "v1", "art-joint-anim"]],
"(method 11 neo-spawner-manager)": [["_stack_", 16, "res-tag"]],
"(method 11 neo-spawner)": [["_stack_", 16, "res-tag"]],
"(method 11 neo-spawner-manager)": [
["_stack_", 16, "res-tag"],
[15, "v0", "(pointer actor-group)"]
],
"(method 11 neo-spawner)": [
["_stack_", 16, "res-tag"],
[134, "v0", "(pointer actor-group)"]
],
"(method 28 for-turret-shot)": [
[29, "s5", "process-drawable"],
[32, "s5", "process-drawable"],
@@ -7580,7 +7670,10 @@
"(anon-function 2 for-turret)": [[[6, 13], "v1", "for-turret"]],
"(anon-function 3 for-turret)": [[[3, 13], "s4", "for-turret"]],
"(anon-function 4 for-turret)": [[6, "v1", "for-turret"]],
"(method 37 for-turret)": [["_stack_", 16, "res-tag"]],
"(method 37 for-turret)": [
["_stack_", 16, "res-tag"],
[18, "v0", "(pointer actor-group)"]
],
"(code idle vol-holo-eye)": [
[14, "v1", "art-joint-anim"],
[80, "v1", "art-joint-anim"]
@@ -7979,8 +8072,14 @@
],
"(code die-eaten kanga-lizard)": [[22, "v1", "art-joint-anim"]],
"(method 11 dm-mine-spider-spawner)": [["_stack_", 16, "res-tag"]],
"(method 11 vol-holo-eye)": [["_stack_", 16, "res-tag"]],
"(method 32 task-manager-kanga-lizard)": [["_stack_", 16, "res-tag"]],
"(method 11 vol-holo-eye)": [
["_stack_", 16, "res-tag"],
[41, "v0", "(pointer actor-group)"]
],
"(method 32 task-manager-kanga-lizard)": [
["_stack_", 16, "res-tag"],
[19, "v0", "(pointer actor-group)"]
],
"(code explode rub-dark-jak-door)": [[129, "v1", "art-joint-anim"]],
"(event idle rub-dark-jak-door)": [[4, "v1", "attack-info"]],
"(code drop rub-falling-step)": [[14, "v1", "art-joint-anim"]],
@@ -8163,12 +8262,17 @@
],
"(method 21 task-manager-arena-fight-2)": [
[[378, 383], "a0", "crate"],
["_stack_", 16, "res-tag"]
["_stack_", 16, "res-tag"],
[57, "v0", "(pointer actor-group)"]
],
"(method 21 task-manager-arena-fight)": [
["_stack_", 16, "res-tag"],
[21, "v0", "(pointer actor-group)"]
],
"(method 21 task-manager-arena-fight)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-arena-fight-3)": [
["_stack_", 16, "res-tag"],
[106, "t0", "float"]
[106, "t0", "float"],
[54, "v0", "(pointer actor-group)"]
],
"wstd-fight-plat-large-init-by-other": [
[[169, 193], "s3", "wstd-fight-plat-smlplat"]
@@ -8195,7 +8299,12 @@
],
"(event active wstd-fight-plat)": [[4, "v1", "float"]],
"(event active wstd-fight-plat-smlplat)": [[12, "v1", "float"]],
"(method 21 task-manager-arena-training)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-arena-training)": [
["_stack_", 16, "res-tag"],
[63, "v0", "(pointer actor-group)"],
[49, "v0", "(pointer actor-group)"],
[50, "v0", "(pointer actor-group)"]
],
"(anon-function 3 arena-scenes)": [[6, "v1", "process-drawable"]],
"(anon-function 6 arena-scenes)": [
[13, "t9", "(function mood-context none)"]
@@ -8293,7 +8402,10 @@
[10, "v0", "(array collide-shape)"],
[309, "a1", "skeet"]
],
"(method 33 task-manager-wascity-gungame)": [["_stack_", 16, "res-tag"]],
"(method 33 task-manager-wascity-gungame)": [
["_stack_", 16, "res-tag"],
[22, "v0", "(pointer actor-group)"]
],
"city-sound-expand-want-list": [[63, "s4", "int"]],
"(method 10 xz-height-map)": [[121, "s0", "pointer"]],
"(method 9 xz-height-map)": [
@@ -8395,7 +8507,8 @@
[67, "a0", "entity-actor"],
[45, "a0", "entity-actor"],
[49, "a0", "entity-actor"],
["_stack_", 16, "res-tag"]
["_stack_", 16, "res-tag"],
[17, "v0", "(pointer actor-group)"]
],
"(method 26 task-manager-wascity-leaper-race)": [
[75, "v1", "process-drawable"]
@@ -8405,7 +8518,10 @@
[21, "v0", "int"]
],
"(post jump flut-racer)": [[6, "t9", "(function none)"]],
"(method 33 task-manager-desert-glide)": [["_stack_", 16, "res-tag"]],
"(method 33 task-manager-desert-glide)": [
["_stack_", 16, "res-tag"],
[17, "v0", "(pointer actor-group)"]
],
"(code idle kleever-catch-lizards)": [[10, "v1", "art-joint-anim"]],
"(code active task-manager-desert-catch-lizards)": [
[858, "gp", "handle"],
@@ -8420,7 +8536,8 @@
],
"(method 26 task-manager-desert-catch-lizards)": [
[275, "v0", "(array collide-shape)"],
["_stack_", 192, "res-tag"]
["_stack_", 192, "res-tag"],
[165, "v0", "(pointer actor-group)"]
],
"(method 82 desert-lizard)": [[96, "v0", "vector"]],
"(code notice desert-lizard)": [[31, "v1", "art-joint-anim"]],
@@ -8492,7 +8609,10 @@
],
"(event idle terraformer-target)": [[53, "a0", "process"]],
"terraformer-mine-explode": [[50, "a0", "process-drawable"]],
"(method 11 terraformer-head)": [["_stack_", 16, "res-tag"]],
"(method 11 terraformer-head)": [
["_stack_", 16, "res-tag"],
[1314, "v0", "(pointer actor-group)"]
],
"joint-mod-disc-look-at-callback": [
[[3, 46], "s4", "joint-mod-disc-look-at"]
],
@@ -8716,7 +8836,10 @@
"(trans active task-manager-bbush-egg-spider)": [[18, "v1", "int"]],
"(code resolution task-manager-bbush-spirit-chase)": [[40, "gp", "handle"]],
"(method 36 task-manager-bbush-spirit-drop)": [[23, "s4", "spirit"]],
"(method 21 task-manager-bbush-spirit-drop)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-bbush-spirit-drop)": [
["_stack_", 16, "res-tag"],
[136, "v0", "(pointer actor-group)"]
],
"(trans idle des-burning-bush)": [
[179, "v1", "vehicle"],
[151, "a1", "int"]
@@ -8752,10 +8875,22 @@
[37, "v1", "process-focusable"],
[[83, 134], "v1", "vehicle"]
],
"(method 21 task-manager-bbush-timer-chase)": [["_stack_", 96, "res-tag"]],
"(method 21 task-manager-bbush-egg-spider)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-bbush-spirit-chase)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-desert-bbush-ring)": [["_stack_", 16, "res-tag"]],
"(method 21 task-manager-bbush-timer-chase)": [
["_stack_", 96, "res-tag"],
[231, "v0", "(pointer actor-group)"]
],
"(method 21 task-manager-bbush-egg-spider)": [
["_stack_", 16, "res-tag"],
[124, "v0", "(pointer actor-group)"]
],
"(method 21 task-manager-bbush-spirit-chase)": [
["_stack_", 16, "res-tag"],
[144, "v0", "(pointer actor-group)"]
],
"(method 21 task-manager-desert-bbush-ring)": [
["_stack_", 16, "res-tag"],
[51, "v0", "(pointer actor-group)"]
],
"(code attack needle-fish)": [
[14, "v1", "art-joint-anim"],
[66, "v1", "art-joint-anim"]
@@ -8816,7 +8951,10 @@
[[13, 21], "a1", "vector"],
[[27, 35], "a0", "vector"]
],
"(method 32 task-manager-mh-centipede)": [["_stack_", 16, "res-tag"]],
"(method 32 task-manager-mh-centipede)": [
["_stack_", 16, "res-tag"],
[18, "v0", "(pointer actor-group)"]
],
"(method 59 mh-bat)": [[[26, 43], "s5", "process-focusable"]],
"(method 126 mh-bat)": [[[20, 24], "v1", "ragdoll-proc"]],
"(method 50 mh-bat)": [
@@ -8862,7 +9000,8 @@
"(method 24 factory-conveyor)": [
[40, "v0", "float"],
[39, "t0", "float"],
["_stack_", 16, "res-tag"]
["_stack_", 16, "res-tag"],
[20, "v0", "(pointer float)"]
],
"(enter perish-immediately)": [
[13, "v1", "art-joint-anim"],
@@ -10205,7 +10344,9 @@
],
"(method 30 boat-base)": [
[280, "v1", "boat-manager"],
[330, "v1", "boat-manager"]
[330, "v1", "boat-manager"],
[274, "v1", "boat-manager"],
[324, "v1", "boat-manager"]
],
"(method 35 htorpedo)": [[[96, 107], "s3", "particle-local-space-info"]],
"(method 17 light-trail-tracker-torpedo)": [[1, "v1", "htorpedo"]],
@@ -10436,14 +10577,18 @@
"(enter fail cty-hijack-manager)": [
[7, "v0", "(state resetter-params cty-hijack-manager)"]
],
"(method 20 ctyport-attack-manager-bbush)": [["_stack_", 96, "res-tag"]],
"(method 20 ctyport-attack-manager-bbush)": [
["_stack_", 96, "res-tag"],
[179, "v0", "(pointer actor-group)"]
],
"(code idle farm-sprinkler-barrels)": [[10, "v1", "art-joint-anim"]],
"(code explode com-power-box)": [
[77, "v1", "collide-shape-prim-group"],
[116, "a0", "process"]
],
"(enter active task-manager-city-destroy-grid)": [
["_stack_", 272, "res-tag"]
["_stack_", 272, "res-tag"],
[177, "v0", "(pointer actor-group)"]
],
"(code wait task-manager-city-destroy-grid)": [[40, "t9", "(function none)"]],
"(code die jinx)": [[37, "v1", "art-joint-anim"]],
@@ -10505,7 +10650,8 @@
"check-onintent-bugs": [[[31, 49], "s3", "sprite-vec-data-2d"]],
"(method 11 cty-sniper-battery)": [
[185, "v1", "art-joint-anim"],
["_stack_", 16, "res-tag"]
["_stack_", 16, "res-tag"],
[149, "v0", "(pointer actor-group)"]
],
"cty-sniper-battery-handler": [
[11, "v1", "vector"],
@@ -10558,7 +10704,10 @@
[[439, 448], "s5", "cspace"],
[17, "v1", "float"]
],
"(method 26 task-manager-city-sniper-fight)": [["_stack_", 16, "res-tag"]],
"(method 26 task-manager-city-sniper-fight)": [
["_stack_", 16, "res-tag"],
[18, "v0", "(pointer actor-group)"]
],
"(code active task-manager-city-sniper-fight)": [
[80, "a1", "process-drawable"]
],
@@ -10604,7 +10753,10 @@
"(code fallen rub-tower)": [[18, "v1", "art-joint-anim"]],
"(code fall rub-tower)": [[33, "v1", "art-joint-anim"]],
"(code unstable rub-tower)": [[20, "v1", "art-joint-anim"]],
"(method 11 rub-elec-gate)": [["_stack_", 16, "res-tag"]],
"(method 11 rub-elec-gate)": [
["_stack_", 16, "res-tag"],
[110, "v0", "(pointer actor-group)"]
],
"birth-func-power-score": [
[2, "v1", "(pointer int32)"],
[4, "v1", "(pointer int32)"],
@@ -10658,8 +10810,14 @@
"update-mood-hiphog": [[[26, 74], "s5", "hiphog-states"]],
"update-mood-vinroom": [[[24, 141], "gp", "vinroom-states"]],
"update-mood-oracle": [[[19, 135], "s5", "oracle-states"]],
"(method 21 gungame-manager)": [["_stack_", 16, "res-tag"]],
"(method 35 gungame-task-manager)": [["_stack_", 16, "res-tag"]],
"(method 21 gungame-manager)": [
["_stack_", 16, "res-tag"],
[12, "v0", "(pointer actor-group)"]
],
"(method 35 gungame-task-manager)": [
["_stack_", 16, "res-tag"],
[12, "v0", "(pointer actor-group)"]
],
"(method 23 gungame-manager)": [[[16, 396], "gp", "hud"]],
"(method 24 gungame-manager)": [[[23, 35], "a1", "training-path"]],
"(method 25 gungame-manager)": [[12, "a0", "training-path"]],
@@ -11077,9 +11235,18 @@
[61, "gp", "collide-shape-prim-group"]
],
"(code dormant precur-laser-beam)": [["_stack_", 16, "res-tag"]],
"(method 11 precur-generator-c)": [["_stack_", 16, "res-tag"]],
"(method 11 precur-generator-d)": [["_stack_", 16, "res-tag"]],
"(method 11 precur-bridge-path-break)": [["_stack_", 16, "res-tag"]],
"(method 11 precur-generator-c)": [
["_stack_", 16, "res-tag"],
[119, "v0", "(pointer actor-group)"]
],
"(method 11 precur-generator-d)": [
["_stack_", 16, "res-tag"],
[116, "v0", "(pointer actor-group)"]
],
"(method 11 precur-bridge-path-break)": [
["_stack_", 16, "res-tag"],
[55, "v0", "(pointer actor-group)"]
],
"(method 11 precura-door-a)": [
[141, "v0", "pair"],
[129, "v0", "pair"]
@@ -11314,7 +11481,10 @@
[[174, 177], "v1", "dma-gif-packet"],
[[186, 202], "a0", "(inline-array vector4w)"]
],
"draw-raw-image": [[[104, 154], "v1", "(inline-array vector4w)"]],
"draw-raw-image": [
[[104, 154], "v1", "(inline-array vector4w)"],
[[195, 198], "v1", "dma-packet"]
],
"draw-color-bars": [
[[11, 16], "v1", "dma-gif-packet"],
[[28, 54], "v1", "(inline-array vector4w)"]
@@ -11744,5 +11914,6 @@
[6, "a0", "timer-bank"],
[24, "a0", "timer-bank"],
[1, "v1", "timer-bank"]
]
],
"(method 11 blow-tower-path-cursor)": [["_stack_", 52, "float"]]
}
+2 -2
View File
@@ -232,7 +232,7 @@
["cam-layout", "cam-layout", 3, ["GAME", "ENGINE"], "engine/camera"],
["cam-debug", "cam-debug", 3, ["GAME", "ENGINE"], "engine/camera"],
["cam-start", "cam-start", 3, ["GAME", "ENGINE"], "engine/camera"],
["process-drawable", "process-drawable", 3, ["GAME", "ENGINE"], "engine/draw"],
["process-drawable", "process-drawable", 3, ["GAME", "ENGINE"], "engine/common-obs"],
["hint-control", "hint-control", 3, ["GAME", "ENGINE"], "engine/game/task"],
["ambient", "ambient", 3, ["GAME", "ENGINE"], "engine/entity"],
["assert", "assert", 3, ["GAME", "ENGINE"], "engine/debug"],
@@ -288,7 +288,7 @@
["ocean-transition", "ocean-transition", 3, ["GAME", "ENGINE"], "engine/gfx/ocean"],
["ocean-near", "ocean-near", 3, ["GAME", "ENGINE"], "engine/gfx/ocean"],
["shadow", "shadow", 3, ["GAME", "ENGINE"], "engine/gfx/shadow"],
["eye", "eye", 3, ["GAME", "ENGINE"], "engine/gfx"],
["eye", "eye", 3, ["GAME", "ENGINE"], "engine/gfx/foreground"],
["glist-h", "glist-h", 3, ["GAME", "ENGINE"], "engine/util"],
["glist", "glist", 3, ["GAME", "ENGINE"], "engine/util"],
["anim-tester", "anim-tester", 3, ["GAME", "ENGINE"], "engine/debug"],
+9 -10
View File
@@ -151,7 +151,6 @@
(none))
(defmethod joint-exploder-method-27 ((this joint-exploder) (arg0 joint-exploder-list) (arg1 int))
(local-vars (sv-16 int) (sv-32 int) (sv-48 int))
(let ((s4-0 (the-as joint-exploder-list #f)))
(let ((v1-0 1))
(until (= v1-0 5)
@@ -174,9 +173,9 @@
(let ((s0-0 (-> s2-0 joint s1-0)))
(cond
((>= (-> s0-0 mat vector 3 x) f30-0)
(set! sv-16 (joint-exploder-method-26 this arg0 s1-0))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-16)
(let ((sv-16 (joint-exploder-method-26 this arg0 s1-0)))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-16))
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-0))
(else (joint-exploder-method-21 this arg0 s0-0) (set! s1-0 (-> s0-0 next))))))))
((= arg1 1)
@@ -185,9 +184,9 @@
(let ((s0-1 (-> s2-0 joint s1-0)))
(cond
((>= (-> s0-1 mat vector 3 y) f30-1)
(set! sv-32 (joint-exploder-method-26 this arg0 s1-0))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-32)
(let ((sv-32 (joint-exploder-method-26 this arg0 s1-0)))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-32))
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-1))
(else (joint-exploder-method-21 this arg0 s0-1) (set! s1-0 (-> s0-1 next))))))))
((= arg1 2)
@@ -196,9 +195,9 @@
(let ((s0-2 (-> s2-0 joint s1-0)))
(cond
((>= (-> s0-2 mat vector 3 z) f30-2)
(set! sv-48 (joint-exploder-method-26 this arg0 s1-0))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-48)
(let ((sv-48 (joint-exploder-method-26 this arg0 s1-0)))
(joint-exploder-method-20 this (the-as joint-exploder-list s3-0) s1-0)
(set! s1-0 sv-48))
(joint-exploder-method-21 this (the-as joint-exploder-list s3-0) s0-2))
(else (joint-exploder-method-21 this arg0 s0-2) (set! s1-0 (-> s0-2 next)))))))))))
s4-0))
+54 -62
View File
@@ -11,8 +11,6 @@
(require "engine/anim/mspace-h.gc")
(require "engine/game/game-h.gc")
;; DECOMP BEGINS
;; The joint-mod system allows an animated character to change in a way that's not described in
;; an animation. For example, this is used to point Jak's head toward an attacking enemy.
@@ -40,6 +38,8 @@
(reset 7) ;; 128
)
;; DECOMP BEGINS
;; The joint-mod itself represents a modification to a single joint.
;; Although the mode is a bitfield, it appears that multiple kinds of mods cannot be
;; activated at the same time.
@@ -230,37 +230,34 @@
(defun joint-mod-look-at-handler ((csp cspace) (xform transformq))
"Update bone transforms for look-at"
(local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector))
(let ((gp-0 (the-as joint-mod (-> csp param1))))
(cspace<-parented-transformq-joint! csp xform)
(set! sv-48
(vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0))
(set! sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0))
(set! sv-56
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0))
(let* ((f30-0 (vector-y-angle sv-52))
(a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48))
(f0-0 (vector-y-angle a0-9))
(f0-1 (deg-diff f30-0 f0-0)))
(if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0))
(let ((f30-1 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y)))))
(if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) (set-mode! gp-0 (joint-mod-handler-mode reset)))
(set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y))))))))
(let ((v1-15 (-> gp-0 up)))
(cond
((zero? v1-15) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))
((= v1-15 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))
(else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))))
(let* ((s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector)
(the-as vector (-> gp-0 process node-list data 0 bone transform))
1.0))
(f30-2 (vector-x-angle sv-52))
(s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1))
(f0-15 (vector-x-angle s3-2))
(f0-21 (fmax (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x))
(- (-> gp-0 twist-max x)))))
(if (< (vector-dot s3-2 sv-52) 0.1) (set! f0-21 0.0))
(set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x)))))))
(let ((sv-48 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0))
(sv-52 (vector-normalize! (-> csp bone transform vector (-> gp-0 nose)) 1.0))
(sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> csp bone transform vector 3)) 1.0)))
(let* ((f30-0 (vector-y-angle sv-52))
(a0-9 (vector-flatten! (new-stack-vector0) sv-56 sv-48))
(f0-0 (vector-y-angle a0-9))
(f0-1 (deg-diff f30-0 f0-0)))
(if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0))
(let ((f30-1 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y)))))
(if (and (-> gp-0 shutting-down?) (= (-> gp-0 twist y) f30-1)) (set-mode! gp-0 (joint-mod-handler-mode reset)))
(set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f30-1 (* 0.1 (fabs (deg-diff f30-1 (-> gp-0 twist y))))))))
(let ((v1-15 (-> gp-0 up)))
(cond
((zero? v1-15) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))
((= v1-15 1) (quaternion-rotate-local-y! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))
(else (quaternion-rotate-z! (-> xform quat) (-> xform quat) (-> gp-0 twist y)))))
(let* ((s3-1 (vector-normalize-copy! (new 'stack-no-clear 'vector)
(the-as vector (-> gp-0 process node-list data 0 bone transform))
1.0))
(f30-2 (vector-x-angle sv-52))
(s3-2 (vector-flatten! (new-stack-vector0) sv-56 s3-1))
(f0-15 (vector-x-angle s3-2))
(f0-21 (fmax (fmin (* (- (deg-diff f30-2 f0-15)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x))
(- (-> gp-0 twist-max x)))))
(if (< (vector-dot s3-2 sv-52) 0.1) (set! f0-21 0.0))
(set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-21 (* 0.1 (fabs (deg-diff f0-21 (-> gp-0 twist x))))))))
(let ((v1-27 (-> gp-0 ear)))
(cond
((zero? v1-27) (quaternion-rotate-x! (-> xform quat) (-> xform quat) (-> gp-0 twist x)))
@@ -278,36 +275,34 @@
(none))
(defun joint-mod-world-look-at-handler ((arg0 cspace) (arg1 transformq))
(local-vars (sv-48 vector) (sv-52 vector) (sv-56 vector))
(let ((gp-0 (the-as joint-mod (-> arg0 param1))))
(let ((s5-0 (-> arg0 bone transform)))
(cspace<-parented-transformq-joint! arg0 arg1)
(set! sv-48
(vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0))
(set! sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0))
(set! sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0))
(let* ((f30-0 (vector-y-angle sv-52))
(a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48))
(f0-0 (vector-y-angle a0-7))
(f0-1 (deg-diff f30-0 f0-0)))
(if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0))
(let ((f0-5 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y)))))
(set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))))))
(when (!= (-> gp-0 twist y) 0.0)
(let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y)))
(s4-2 (-> s5-0 vector 3 quad)))
(matrix*! s5-0 s5-0 a2-3)
(set! (-> s5-0 vector 3 quad) s4-2)))
(let* ((s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector)
(the-as vector (-> gp-0 process node-list data 0 bone transform))
1.0))
(f30-2 (vector-x-angle sv-52))
(s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3))
(f0-14 (vector-x-angle s4-4))
(f0-20 (fmax (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x))
(- (-> gp-0 twist-max x)))))
(if (< (vector-dot s4-4 sv-52) 0.1) (set! f0-20 0.0))
(set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x))))))))
(let ((sv-48 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> gp-0 process node-list data 0 bone transform vector 1) 1.0))
(sv-52 (vector-normalize! (-> s5-0 vector (-> gp-0 nose)) 1.0))
(sv-56 (vector-normalize! (vector-! (new 'stack-no-clear 'vector) (-> gp-0 target) (-> s5-0 vector 3)) 1.0)))
(let* ((f30-0 (vector-y-angle sv-52))
(a0-7 (vector-flatten! (new-stack-vector0) sv-56 sv-48))
(f0-0 (vector-y-angle a0-7))
(f0-1 (deg-diff f30-0 f0-0)))
(if (< (-> gp-0 ignore-angle) (fabs f0-1)) (set! f0-1 0.0))
(let ((f0-5 (fmax (fmin (* f0-1 (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max y)) (- (-> gp-0 twist-max y)))))
(set! (-> gp-0 twist y) (deg-seek (-> gp-0 twist y) f0-5 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-5 (-> gp-0 twist y)))))))))
(when (!= (-> gp-0 twist y) 0.0)
(let ((a2-3 (matrix-rotate-y! (new 'stack-no-clear 'matrix) (-> gp-0 twist y)))
(s4-2 (-> s5-0 vector 3 quad)))
(matrix*! s5-0 s5-0 a2-3)
(set! (-> s5-0 vector 3 quad) s4-2)))
(let* ((s4-3 (vector-normalize-copy! (new 'stack-no-clear 'vector)
(the-as vector (-> gp-0 process node-list data 0 bone transform))
1.0))
(f30-2 (vector-x-angle sv-52))
(s4-4 (vector-flatten! (new-stack-vector0) sv-56 s4-3))
(f0-14 (vector-x-angle s4-4))
(f0-20 (fmax (fmin (* (- (deg-diff f30-2 f0-14)) (-> gp-0 blend) (-> gp-0 flex-blend)) (-> gp-0 twist-max x))
(- (-> gp-0 twist-max x)))))
(if (< (vector-dot s4-4 sv-52) 0.1) (set! f0-20 0.0))
(set! (-> gp-0 twist x) (deg-seek (-> gp-0 twist x) f0-20 (fmax 1.0 (* 0.1 (fabs (deg-diff f0-20 (-> gp-0 twist x)))))))))
(when (!= (-> gp-0 twist x) 0.0)
(let* ((v1-20 (-> gp-0 ear))
(a1-17 ((cond
@@ -506,10 +501,7 @@
(let ((gp-0 (the-as joint-mod-blend-local (-> arg0 param1))))
(cond
((-> gp-0 enable)
(vector-lerp! (the-as vector (-> gp-0 blend-transform))
(-> arg1 trans)
(the-as vector (-> gp-0 transform))
(-> gp-0 blend))
(vector-lerp! (-> gp-0 blend-transform trans) (-> arg1 trans) (-> gp-0 transform trans) (-> gp-0 blend))
(vector-lerp! (-> gp-0 blend-transform scale) (-> arg1 scale) (-> gp-0 transform scale) (-> gp-0 blend))
(quaternion-slerp! (-> gp-0 blend-transform quat) (-> arg1 quat) (-> gp-0 transform quat) (-> gp-0 blend))
(cspace<-parented-transformq-joint! arg0 (-> gp-0 blend-transform)))
+84 -102
View File
@@ -396,11 +396,11 @@
(format #t "#<~A ~S ~D @ #x~X>" (-> this type) (-> this name) (-> this number) this)
this)
(defmethod mem-usage ((this joint) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 66 (-> arg0 length)))
(set! (-> arg0 data 65 name) "joint")
(+! (-> arg0 data 65 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 65 used) v1-6) (+! (-> arg0 data 65 total) (logand -16 (+ v1-6 15))))
(defmethod mem-usage ((this joint) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 66 (-> usage length)))
(set! (-> usage data 65 name) "joint")
(+! (-> usage data 65 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 65 used) v1-6) (+! (-> usage data 65 total) (logand -16 (+ v1-6 15))))
this)
(defmethod print ((this joint-anim))
@@ -448,13 +448,13 @@
((joint-anim-transformq) (format #t "~`transform`P~%" (-> (the-as joint-anim-transformq arg0) data (the int arg1)))))
arg0)
(defmethod mem-usage ((this joint-anim-drawable) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 77 (-> arg0 length)))
(set! (-> arg0 data 76 name) "joint-anim-drawable")
(+! (-> arg0 data 76 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 76 used) v1-6) (+! (-> arg0 data 76 total) (logand -16 (+ v1-6 15))))
(defmethod mem-usage ((this joint-anim-drawable) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 77 (-> usage length)))
(set! (-> usage data 76 name) "joint-anim-drawable")
(+! (-> usage data 76 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 76 used) v1-6) (+! (-> usage data 76 total) (logand -16 (+ v1-6 15))))
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) arg0 arg1))
(mem-usage (-> this data s3-0) usage flags))
this)
(defun jacc-mem-usage ((arg0 joint-anim-compressed-control) (arg1 memory-usage-block) (arg2 int))
@@ -570,37 +570,37 @@
(set! (-> this extra tag) (&+ (the-as (pointer res-tag) (-> this extra)) 28)))
this)
(defmethod mem-usage ((this art-mesh-anim) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 72 (-> arg0 length)))
(set! (-> arg0 data 71 name) "art-mesh-anim")
(+! (-> arg0 data 71 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 71 used) v1-6) (+! (-> arg0 data 71 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512)))
(defmethod mem-usage ((this art-mesh-anim) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 72 (-> usage length)))
(set! (-> usage data 71 name) "art-mesh-anim")
(+! (-> usage data 71 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 71 used) v1-6) (+! (-> usage data 71 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512)))
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) arg0 arg1))
(mem-usage (-> this data s3-0) usage flags))
this)
(defmethod mem-usage ((this art-joint-anim) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 75 (-> arg0 length)))
(set! (-> arg0 data 74 name) "art-joint-anim")
(+! (-> arg0 data 74 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 74 used) v1-6) (+! (-> arg0 data 74 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512)))
(jacc-mem-usage (-> this frames) arg0 arg1)
(defmethod mem-usage ((this art-joint-anim) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 75 (-> usage length)))
(set! (-> usage data 74 name) "art-joint-anim")
(+! (-> usage data 74 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 74 used) v1-6) (+! (-> usage data 74 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512)))
(jacc-mem-usage (-> this frames) usage flags)
(dotimes (s4-1 (-> this length))
(set! (-> arg0 length) (max 67 (-> arg0 length)))
(set! (-> arg0 data 66 name) "joint-anim-compressed")
(+! (-> arg0 data 66 count) 1)
(set! (-> usage length) (max 67 (-> usage length)))
(set! (-> usage data 66 name) "joint-anim-compressed")
(+! (-> usage data 66 count) 1)
(let ((v1-22 (asize-of (-> this data s4-1))))
(+! (-> arg0 data 66 used) v1-22)
(+! (-> arg0 data 66 total) (logand -16 (+ v1-22 15)))))
(+! (-> usage data 66 used) v1-22)
(+! (-> usage data 66 total) (logand -16 (+ v1-22 15)))))
(when (and (nonzero? (-> this eye-anim-data)) (-> this eye-anim-data))
(set! (-> arg0 length) (max 109 (-> arg0 length)))
(set! (-> arg0 data 108 name) "eye-anim")
(+! (-> arg0 data 108 count) 1)
(set! (-> usage length) (max 109 (-> usage length)))
(set! (-> usage data 108 name) "eye-anim")
(+! (-> usage data 108 count) 1)
(let ((v1-41 (* (* (+ (-> this eye-anim-data max-frame) 1) 2) 8)))
(+! (-> arg0 data 108 used) v1-41)
(+! (-> arg0 data 108 total) (logand -16 (+ v1-41 15)))))
(+! (-> usage data 108 used) v1-41)
(+! (-> usage data 108 total) (logand -16 (+ v1-41 15)))))
this)
(defmethod asize-of ((this art-joint-anim))
@@ -670,20 +670,20 @@
(if (-> this data s5-0) (set! (-> this data s5-0) (login (-> this data s5-0)))))
this)
(defmethod mem-usage ((this art-group) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 71 (-> arg0 length)))
(set! (-> arg0 data 70 name) "art-group")
(+! (-> arg0 data 70 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 70 used) v1-6) (+! (-> arg0 data 70 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512)))
(defmethod mem-usage ((this art-group) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 71 (-> usage length)))
(set! (-> usage data 70 name) "art-group")
(+! (-> usage data 70 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 70 used) v1-6) (+! (-> usage data 70 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512)))
(dotimes (s3-0 (-> this length))
(if (-> this data s3-0) (mem-usage (-> this data s3-0) arg0 arg1)))
(if (-> this data s3-0) (mem-usage (-> this data s3-0) usage flags)))
this)
(defmethod relocate ((this art-group) (arg0 kheap) (arg1 (pointer uint8)))
(defmethod relocate ((this art-group) (heap kheap) (name (pointer uint8)))
"Handle a loaded art-group."
(let ((s4-0 (clear *temp-string*)))
(string<-charp s4-0 arg1)
(string<-charp s4-0 name)
(set! this
(cond
((not this) (format 0 "ERROR: art-group ~A is not a valid file.~%" s4-0) (the-as art-group #f))
@@ -693,26 +693,22 @@
((not (file-info-correct-version? (-> this info) (file-kind art-group) 0)) (the-as art-group #f))
(else
(let ((s5-1 (-> *level* loading-level)))
(if (or (not s5-1) (= (-> s5-1 name) 'default))
(login this) ;; not part of level load, just normal login.
)
(if s5-1
(set-loaded-art (-> s5-1 art-group) this) ;; part of level load, add to level's ag, but don't log in yet.
))
(if (or (not s5-1) (= (-> s5-1 name) 'default)) (login this)) ;; not part of level load, just normal login.
(if s5-1 (set-loaded-art (-> s5-1 art-group) this))) ;; part of level load, add to level's ag, but don't log in yet.
this))))
(none))
(defmethod asize-of ((this art-mesh-geo))
(the-as int (+ (-> art size) (* (-> this length) 4))))
(defmethod mem-usage ((this art-mesh-geo) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 73 (-> arg0 length)))
(set! (-> arg0 data 72 name) "art-mesh-geo")
(+! (-> arg0 data 72 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 72 used) v1-6) (+! (-> arg0 data 72 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512)))
(defmethod mem-usage ((this art-mesh-geo) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 73 (-> usage length)))
(set! (-> usage data 72 name) "art-mesh-geo")
(+! (-> usage data 72 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 72 used) v1-6) (+! (-> usage data 72 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512)))
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) arg0 arg1))
(mem-usage (-> this data s3-0) usage flags))
this)
(defmethod login ((this art-joint-anim))
@@ -742,14 +738,14 @@
(the-as int #f))
(else (dotimes (s4-1 (-> this length)) (if (name= arg0 (-> this data s4-1 name)) (return s4-1))) (the-as int #f))))
(defmethod mem-usage ((this art-joint-geo) (arg0 memory-usage-block) (arg1 int))
(set! (-> arg0 length) (max 74 (-> arg0 length)))
(set! (-> arg0 data 73 name) "art-joint-geo")
(+! (-> arg0 data 73 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 73 used) v1-6) (+! (-> arg0 data 73 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) arg0 (logior arg1 512)))
(defmethod mem-usage ((this art-joint-geo) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 74 (-> usage length)))
(set! (-> usage data 73 name) "art-joint-geo")
(+! (-> usage data 73 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 73 used) v1-6) (+! (-> usage data 73 total) (logand -16 (+ v1-6 15))))
(if (-> this extra) (mem-usage (-> this extra) usage (logior flags 512)))
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) arg0 arg1))
(mem-usage (-> this data s3-0) usage flags))
this)
;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -806,44 +802,30 @@
;; ERROR: Failed load: (set! v1-29 (l.wu (+ a0-9 -4))) at op 75
(defun joint-control-remap! ((arg0 joint-control) (arg1 art-group) (arg2 art-group) (arg3 pair) (arg4 int) (arg5 string))
(local-vars
(sv-16 int)
(sv-24 symbol)
(sv-32 int)
(sv-40 int)
(sv-48 joint-control-channel)
(sv-52 object)
(sv-56 int)
(sv-64 joint)
(sv-80 string))
(set! sv-16 (+ (length (-> arg2 name)) 1))
(set! sv-24 #t)
(set! sv-32 arg4)
(set! sv-40 2)
(while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim))
(set! sv-40 (+ sv-40 1)))
(dotimes (s2-1 (-> arg0 active-channels))
(set! sv-48 (-> arg0 channel s2-1))
(when (-> sv-48 frame-group)
(format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16))
(when (not (null? arg3))
(set! sv-52 (nassoc *temp-string* arg3))
(when sv-52
(let ((s1-1 sv-32)
(a0-9 sv-52))
(set! sv-56 (mod s1-1 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))))
(let ((s1-2 format)
(s0-0 (clear *temp-string*)))
(set! sv-80 "~S")
(let ((a2-2 (ref sv-52 (+ sv-56 1)))) (s1-2 s0-0 sv-80 a2-2)))))
(set! sv-64 (lookup-art arg1 *temp-string* art-joint-anim))
(cond
(sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)))
(else
(set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40)))
(set! (-> sv-48 frame-num) 0.0)
(set! sv-24 (the-as symbol #f))))))
sv-24)
(let ((sv-16 (+ (length (-> arg2 name)) 1))
(sv-24 #t))
(let ((sv-32 arg4)
(sv-40 2))
(while (and (< sv-40 (-> arg1 length)) (!= (-> arg1 data sv-40 type) art-joint-anim))
(+! sv-40 1))
(dotimes (s2-1 (-> arg0 active-channels))
(let ((sv-48 (-> arg0 channel s2-1)))
(when (-> sv-48 frame-group)
(format (clear *temp-string*) "~S~G" arg5 (&+ (-> sv-48 frame-group name data) sv-16))
(when (not (null? arg3))
(let ((sv-52 (nassoc *temp-string* arg3)))
(when sv-52
(let* ((a0-9 sv-52)
(sv-56 (mod sv-32 (+ ((method-of-type (rtype-of a0-9) length) a0-9) -1))))
(format (clear *temp-string*) "~S" (ref sv-52 (+ sv-56 1)))))))
(let ((sv-64 (lookup-art arg1 *temp-string* art-joint-anim)))
(cond
(sv-64 (set! (-> sv-48 frame-group) (the-as art-joint-anim sv-64)))
(else
(set! (-> sv-48 frame-group) (the-as art-joint-anim (-> arg1 data sv-40)))
(set! (-> sv-48 frame-num) 0.0)
(set! sv-24 (the-as symbol #f)))))))))
sv-24))
(defun flatten-joint-control-to-spr ((arg0 joint-control))
"Take the current state of the given joint-control and upload it to the scratchpad
+17 -18
View File
@@ -96,7 +96,6 @@
(copy-cam-float-seeker (-> self tracking point-of-interest-blend) (-> gp-3 tracking point-of-interest-blend))))))))
:code
(behavior ()
(local-vars (sv-160 cam-rotation-tracker))
(loop
(when (and (not (logtest? (-> *camera* master-options) 2)) (!= (-> self tracking-status) 0))
(set! (-> self tracking-status) (the-as uint 0))
@@ -129,8 +128,8 @@
(set! (-> a2-4 vector 2 quad) a1-6)
(set! (-> a2-4 vector 3 quad) a3-3)))
(else
(set! sv-160 (-> s5-0 0 tracking))
(let ((s2-0 (-> s5-0 0 trans))
(let ((sv-160 (-> s5-0 0 tracking))
(s2-0 (-> s5-0 0 trans))
(s5-1 (-> s4-0 0 tracking))
(s0-0 (-> s4-0 0 trans)))
(cond
@@ -153,46 +152,46 @@
(let ((s4-1 (new-stack-vector0)))
0.0
(let ((s3-0 (new-stack-matrix0)))
(vector-! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat)))
(vector-! (-> s1-0 vector 0) (the-as vector (-> sv-160 inv-mat)) (the-as vector (-> s5-1 inv-mat)))
(vector-! (-> s1-0 vector 1) (-> sv-160 inv-mat vector 1) (-> s5-1 inv-mat vector 1))
(vector-! (-> s1-0 vector 2) (-> sv-160 inv-mat vector 2) (-> s5-1 inv-mat vector 2))
(let ((f26-0 (vector-length (the-as vector (-> s1-0 vector))))
(let ((f26-0 (vector-length (-> s1-0 vector 0)))
(f28-0 (vector-length (-> s1-0 vector 1)))
(f0-13 (vector-length (-> s1-0 vector 2))))
(cond
((and (< f26-0 f28-0) (< f26-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 1) (-> s1-0 vector 2)))
((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 2)))
(else (vector-cross! s4-1 (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)))))
((and (< f28-0 f26-0) (< f28-0 f0-13)) (vector-cross! s4-1 (-> s1-0 vector 0) (-> s1-0 vector 2)))
(else (vector-cross! s4-1 (-> s1-0 vector 0) (-> s1-0 vector 1)))))
(vector-normalize! s4-1 1.0)
(let ((f0-16 (fabs (vector-dot (the-as vector (-> sv-160 inv-mat)) s4-1)))
(f1-2 (fabs (vector-dot (-> sv-160 inv-mat vector 1) s4-1)))
(f2-2 (fabs (vector-dot (-> sv-160 inv-mat vector 2) s4-1))))
(cond
((and (< f0-16 f1-2) (< f0-16 f2-2))
(vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> sv-160 inv-mat)) s4-1)
(vector-flatten! (-> s1-0 vector 0) (the-as vector (-> sv-160 inv-mat)) s4-1)
(vector-flatten! (-> s1-0 vector 1) (the-as vector (-> s5-1 inv-mat)) s4-1))
((< f1-2 f2-2)
(vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 1) s4-1)
(vector-flatten! (-> s1-0 vector 0) (-> sv-160 inv-mat vector 1) s4-1)
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 1) s4-1))
(else
(vector-flatten! (the-as vector (-> s1-0 vector)) (-> sv-160 inv-mat vector 2) s4-1)
(vector-flatten! (-> s1-0 vector 0) (-> sv-160 inv-mat vector 2) s4-1)
(vector-flatten! (-> s1-0 vector 1) (-> s5-1 inv-mat vector 2) s4-1))))
(vector-normalize! (the-as vector (-> s1-0 vector)) 1.0)
(vector-normalize! (-> s1-0 vector 0) 1.0)
(vector-normalize! (-> s1-0 vector 1) 1.0)
(vector-cross! (-> s1-0 vector 2) (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1))
(vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 0) (-> s1-0 vector 1))
(if (< (vector-dot (-> s1-0 vector 2) s4-1) 0.0) (vector-negate! s4-1 s4-1))
(let ((f28-1 (acos (vector-dot (the-as vector (-> s1-0 vector)) (-> s1-0 vector 1)))))
(let ((f28-1 (acos (vector-dot (-> s1-0 vector 0) (-> s1-0 vector 1)))))
(cond
((logtest? (-> *camera* master-options) 8)
(logand! (-> *camera* master-options) -25)
(when (and (< 8192.0 f28-1) (logtest? (-> *camera* master-options) 2))
(vector-! (the-as vector (-> s1-0 vector)) (-> *camera* tpos-curr) s2-0)
(vector-! (-> s1-0 vector 0) (-> *camera* tpos-curr) s2-0)
(vector-! (-> s1-0 vector 1) s0-0 s2-0)
(vector-flatten! (the-as vector (-> s1-0 vector)) (the-as vector (-> s1-0 vector)) (-> *camera* local-down))
(vector-flatten! (-> s1-0 vector 0) (-> s1-0 vector 0) (-> *camera* local-down))
(vector-flatten! (-> s1-0 vector 1) (-> s1-0 vector 1) (-> *camera* local-down))
(when (and (< 4096.0 (vector-normalize-ret-len! (the-as vector (-> s1-0 vector)) 1.0))
(when (and (< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 0) 1.0))
(< 4096.0 (vector-normalize-ret-len! (-> s1-0 vector 1) 1.0)))
(vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (the-as vector (-> s1-0 vector)))
(vector-cross! (-> s1-0 vector 2) (-> s1-0 vector 1) (-> s1-0 vector 0))
(when (< (vector-dot (-> s1-0 vector 2) s4-1) -0.01)))))
((and (< 16384.0 f28-1) (< (vector-dot (-> self flip-control-axis) s4-1) 0.0))
(logxor! (-> *camera* master-options) 16)))
@@ -201,7 +200,7 @@
(set! f28-1 (- 65536.0 f28-1))
(vector-negate! s4-1 s4-1))
(let ((f30-1 (* f28-1 (- 1.0 f30-0)))) (matrix-axis-sin-cos! s3-0 s4-1 (sin f30-1) (cos f30-1))))
(matrix*! (-> self inv-camera-rot) (the-as matrix s5-1) s3-0)))))))
(matrix*! (-> self inv-camera-rot) (-> s5-1 inv-mat) s3-0)))))))
(cond
((and (< 0.0 (-> *camera* outro-t-step)) (< (-> *camera* outro-t) (-> *camera* outro-exit-value))))
((and (< (-> *camera* outro-t-step) 0.0) (< (-> *camera* outro-exit-value) (-> *camera* outro-t))))
+117 -131
View File
@@ -127,31 +127,18 @@
(the-as float (if (< 0.00001 (fabs f1-1)) (/ (- (-> arg0 w) f0-1) f1-1) 409600000.0))))
(defbehavior cam-layout-entity-volume-info-create cam-layout ((arg0 entity-camera) (arg1 symbol))
(local-vars
(sv-16 res-tag)
(sv-160 vector)
(sv-164 float)
(sv-168 int)
(sv-176 vector)
(sv-192 vector)
(sv-208 vector)
(sv-224 vector)
(sv-240 vector)
(sv-256 int)
(sv-272 int)
(sv-288 int))
(let ((s4-0 0))
(loop
(set! sv-16 (new 'static 'res-tag))
(let ((s3-0 (the-as (inline-array vector)
((method-of-type res-lump get-property-data)
arg0
arg1
'exact
(the float s4-0)
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(let* ((sv-16 (new 'static 'res-tag))
(s3-0 (the-as (inline-array vector)
((method-of-type res-lump get-property-data)
arg0
arg1
'exact
(the float s4-0)
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(cond
(s3-0
(when (>= *volume-descriptor-current* 100)
@@ -166,88 +153,88 @@
(set! *volume-descriptor-current* (+ *volume-descriptor-current* 1))
(+! (-> self num-volumes) 1)
(dotimes (s1-0 (the-as int (-> sv-16 elt-count)))
(set! sv-192 (new 'stack-no-clear 'vector))
(set! (-> sv-192 quad) (the-as uint128 0))
(set! sv-208 (new 'stack-no-clear 'vector))
(set! (-> sv-208 quad) (the-as uint128 0))
(set! sv-224 (new 'stack-no-clear 'vector))
(set! (-> sv-224 quad) (the-as uint128 0))
(set! sv-240 (new 'stack-no-clear 'vector))
(set! (-> sv-240 quad) (the-as uint128 0))
0.0
0.0
0.0
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(let ((s0-0 (new-stack-vector0)))
(set! sv-256 0)
(set! sv-272 0)
(while (< sv-272 (the-as int (-> sv-16 elt-count)))
(when (!= s1-0 sv-272)
(vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w))
(vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0))
(vector-normalize! sv-208 (the-as float 1.0))
(vector-cross! sv-224 sv-208 (-> s3-0 sv-272))
(vector-normalize! sv-224 (the-as float 1.0))
(let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224)))
(when (!= f0-6 409600000.0)
(vector+float*! sv-240 sv-192 sv-224 f0-6)
(set! sv-160 (new-stack-vector0))
(set! sv-164 0.0)
(set! sv-168 0)
(set! sv-176 (new-stack-vector0))
(set! (-> sv-160 quad) (-> sv-240 quad))
(set! sv-288 0)
(while (< sv-288 (the-as int (-> sv-16 elt-count)))
(when (and (!= sv-288 s1-0) (!= sv-288 sv-272))
(let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208)))
(cond
((= f30-0 409600000.0))
((zero? sv-168)
(vector+float*! sv-160 sv-160 sv-208 f30-0)
(set! (-> sv-176 quad) (-> s3-0 sv-288 quad))
(set! sv-164 8192000.0)
(set! sv-168 1))
((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)))
((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0)
(when (< (fabs f30-0) (fabs sv-164))
(set! sv-164 f30-0)
(set! sv-168 (+ sv-168 1))))
(else
(vector+float*! sv-160 sv-160 sv-208 f30-0)
(set! (-> sv-176 quad) (-> s3-0 sv-288 quad))
(set! sv-168 (+ sv-168 1))
(if (< (fabs f30-0) (fabs sv-164)) (set! sv-164 (- sv-164 f30-0)) (set! sv-164 0.0))))))
(set! sv-288 (+ sv-288 1)))
(cond
((zero? sv-168))
((= sv-164 0.0))
(else
(dotimes (v1-87 (the-as int (-> sv-16 elt-count)))
(when (and (!= v1-87 s1-0) (!= v1-87 sv-272))
(if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) (goto cfg-47))))
(vector+float*! sv-240 sv-160 sv-208 sv-164)
(cond
((>= *volume-point-current* 999) (format 0 "ERROR <GMJ>: camera editing out of volume points~%"))
(else
(set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad))
(set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad))
(set! *volume-point-current* (+ *volume-point-current* 2))
(+! (-> s2-0 point-count) 2)))
(vector+! s0-0 s0-0 sv-160)
(vector+! s0-0 s0-0 sv-240)
(set! sv-256 (+ sv-256 2))
sv-256)))))
(label cfg-47)
(set! sv-272 (+ sv-272 1)))
(when (nonzero? sv-256)
(vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256)))
(cond
((>= *volume-normal-current* 599) (format 0 "ERROR <GMJ>: camera editing out of volume normals~%"))
(else
(set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad))
(set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad))
(set! *volume-normal-current* (+ *volume-normal-current* 2))
(set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)))))))))
(let ((sv-192 (new 'stack-no-clear 'vector)))
(set! (-> sv-192 quad) (the-as uint128 0))
(let ((sv-208 (new 'stack-no-clear 'vector)))
(set! (-> sv-208 quad) (the-as uint128 0))
(let ((sv-224 (new 'stack-no-clear 'vector)))
(set! (-> sv-224 quad) (the-as uint128 0))
(let ((sv-240 (new 'stack-no-clear 'vector)))
(set! (-> sv-240 quad) (the-as uint128 0))
0.0
0.0
0.0
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(let ((s0-0 (new-stack-vector0))
(sv-256 0))
(let ((sv-272 0))
(while (< sv-272 (the-as int (-> sv-16 elt-count)))
(when (!= s1-0 sv-272)
(vector-float*! sv-192 (-> s3-0 sv-272) (-> s3-0 sv-272 w))
(vector-cross! sv-208 (-> s3-0 sv-272) (-> s3-0 s1-0))
(vector-normalize! sv-208 (the-as float 1.0))
(vector-cross! sv-224 sv-208 (-> s3-0 sv-272))
(vector-normalize! sv-224 (the-as float 1.0))
(let ((f0-6 (cam-layout-intersect-dist (-> s3-0 s1-0) sv-192 sv-224)))
(when (!= f0-6 409600000.0)
(vector+float*! sv-240 sv-192 sv-224 f0-6)
(let ((sv-160 (new-stack-vector0))
(sv-164 0.0)
(sv-168 0))
(let ((sv-176 (new-stack-vector0)))
(set! (-> sv-160 quad) (-> sv-240 quad))
(let ((sv-288 0))
(while (< sv-288 (the-as int (-> sv-16 elt-count)))
(when (and (!= sv-288 s1-0) (!= sv-288 sv-272))
(let ((f30-0 (cam-layout-intersect-dist (-> s3-0 sv-288) sv-160 sv-208)))
(cond
((= f30-0 409600000.0))
((zero? sv-168)
(vector+float*! sv-160 sv-160 sv-208 f30-0)
(set! (-> sv-176 quad) (-> s3-0 sv-288 quad))
(set! sv-164 8192000.0)
(set! sv-168 1))
((begin (vector-float*! sv-240 sv-208 f30-0) (>= (vector-dot sv-240 sv-176) 0.0)))
((>= (vector-dot sv-240 (-> s3-0 sv-288)) 0.0) (when (< (fabs f30-0) (fabs sv-164)) (set! sv-164 f30-0) (+! sv-168 1)))
(else
(vector+float*! sv-160 sv-160 sv-208 f30-0)
(set! (-> sv-176 quad) (-> s3-0 sv-288 quad))
(+! sv-168 1)
(set! sv-164
(cond
((< (fabs f30-0) (fabs sv-164)) (set! sv-164 (- sv-164 f30-0)) sv-164)
(else 0.0)))))))
(+! sv-288 1))))
(cond
((zero? sv-168))
((= sv-164 0.0))
(else
(dotimes (v1-87 (the-as int (-> sv-16 elt-count)))
(when (and (!= v1-87 s1-0) (!= v1-87 sv-272))
(if (< 4096.0 (- (vector-dot sv-160 (-> s3-0 v1-87)) (-> s3-0 v1-87 w))) (goto cfg-47))))
(vector+float*! sv-240 sv-160 sv-208 sv-164)
(cond
((>= *volume-point-current* 999) (format 0 "ERROR <GMJ>: camera editing out of volume points~%"))
(else
(set! (-> *volume-point* data *volume-point-current* quad) (-> sv-160 quad))
(set! (-> *volume-point* data (+ *volume-point-current* 1) quad) (-> sv-240 quad))
(set! *volume-point-current* (+ *volume-point-current* 2))
(+! (-> s2-0 point-count) 2)))
(vector+! s0-0 s0-0 sv-160)
(vector+! s0-0 s0-0 sv-240)
(+! sv-256 2)
sv-256))))))
(label cfg-47)
(+! sv-272 1)))
(when (nonzero? sv-256)
(vector-float*! s0-0 s0-0 (/ 1.0 (the float sv-256)))
(cond
((>= *volume-normal-current* 599) (format 0 "ERROR <GMJ>: camera editing out of volume normals~%"))
(else
(set! (-> *volume-normal* data *volume-normal-current* quad) (-> s0-0 quad))
(set! (-> *volume-normal* data (+ *volume-normal-current* 1) quad) (-> s3-0 s1-0 quad))
(set! *volume-normal-current* (+ *volume-normal-current* 2))
(set! (-> s2-0 normal-count) (+ (-> s2-0 normal-count) 2)))))))))))))
(else (return #f))))
(+! s4-0 1)))
(the-as symbol #f))
@@ -597,7 +584,7 @@
arg1)
(defbehavior clmf-pos-rot cam-layout ((arg0 symbol) (arg1 symbol))
(local-vars (s2-0 structure) (s3-1 structure) (sv-192 matrix))
(local-vars (s2-0 structure) (s3-1 structure))
(cam-layout-print 16 *camera-layout-message-ypos* "x/z pos: left stick, down: l1, up: r1")
(set! *camera-layout-message-ypos* (+ *camera-layout-message-ypos* 8))
(when (and arg1 (nonzero? arg1))
@@ -635,28 +622,28 @@
(format *temp-string* "ERROR <GMJ>: can't add ~A" 'quaternion)
(cam-layout-print 120 100 *temp-string*))
s2-0)))
(let ((s1-1 (new 'stack-no-clear 'matrix)))
(set! sv-192 (new 'stack-no-clear 'matrix))
(let ((s0-1 (new 'stack-no-clear 'vector)))
(if (not s3-1) (return #f))
(clmf-input s5-0 s4-0 0)
(vector+float*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 409.6))
(cond
((not arg1) (the-as quaternion #f))
((zero? arg1) (the-as quaternion #f))
(else
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192)
(vector-float*! s5-0 s5-0 100.0)
(matrix-rotate-x! s1-1 (- (-> s5-0 x)))
(matrix*! sv-192 s1-1 sv-192)
(matrix-rotate-y! s1-1 (-> s5-0 y))
(matrix*! sv-192 sv-192 s1-1)
(matrix-rotate-z! s1-1 (- (-> s5-0 z)))
(matrix*! sv-192 s1-1 sv-192)
(matrix->quaternion (the-as quaternion s0-1) sv-192)
(quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect)))
(quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0))
(quaternion-normalize! (the-as quaternion s2-0)))))))
(let ((s1-1 (new 'stack-no-clear 'matrix))
(sv-192 (new 'stack-no-clear 'matrix))
(s0-1 (new 'stack-no-clear 'vector)))
(if (not s3-1) (return #f))
(clmf-input s5-0 s4-0 0)
(vector+float*! (the-as vector s3-1) (the-as vector s3-1) s4-0 (the-as float 409.6))
(cond
((not arg1) (the-as quaternion #f))
((zero? arg1) (the-as quaternion #f))
(else
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) sv-192)
(vector-float*! s5-0 s5-0 100.0)
(matrix-rotate-x! s1-1 (- (-> s5-0 x)))
(matrix*! sv-192 s1-1 sv-192)
(matrix-rotate-y! s1-1 (-> s5-0 y))
(matrix*! sv-192 sv-192 s1-1)
(matrix-rotate-z! s1-1 (- (-> s5-0 z)))
(matrix*! sv-192 s1-1 sv-192)
(matrix->quaternion (the-as quaternion s0-1) sv-192)
(quaternion-inverse! (the-as quaternion s2-0) (the-as quaternion (-> self cam-entity connect)))
(quaternion*! (the-as quaternion s2-0) (the-as quaternion s0-1) (the-as quaternion s2-0))
(quaternion-normalize! (the-as quaternion s2-0))))))
(set! *camera-read-analog* #f)
#t)
@@ -1624,10 +1611,9 @@
#t)
(defbehavior clmf-cam-string cam-layout ((arg0 string) (arg1 symbol))
(local-vars (sv-16 res-tag))
(format arg0 ":")
(set! sv-16 (new 'static 'res-tag))
(let ((s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))))
(let* ((sv-16 (new 'static 'res-tag))
(s5-1 (res-lump-data (-> self cam-entity) arg1 pointer :tag-ptr (& sv-16) :time (the-as float -1000000000.0))))
(when s5-1
(dotimes (s4-0 (the-as int (-> sv-16 elt-count)))
(format arg0 " ~S" (-> (the-as (pointer uint32) (&+ s5-1 (* s4-0 4))))))))
+23 -32
View File
@@ -340,19 +340,18 @@
v0-1)))))
(defun in-cam-entity-volume? ((arg0 vector) (arg1 entity) (arg2 float) (arg3 symbol))
(local-vars (sv-16 res-tag))
(let ((s2-0 0))
(loop
(set! sv-16 (new 'static 'res-tag))
(let ((v1-1 (the-as object
((method-of-type res-lump get-property-data)
arg1
arg3
'exact
(the float s2-0)
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-1 (the-as object
((method-of-type res-lump get-property-data)
arg1
arg3
'exact
(the float s2-0)
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(cond
((not (the-as pointer v1-1)) (return #f))
(else
@@ -411,7 +410,7 @@
(vector-dot (-> arg1 tracking inv-mat vector 2) (-> *camera-combiner* inv-camera-rot vector 2)))))
(defbehavior master-switch-to-entity camera-master ((arg0 entity))
(local-vars (v0-21 object) (gp-0 (pointer process)) (sv-16 res-tag) (sv-112 process) (sv-128 string) (sv-144 string))
(local-vars (v0-21 object) (gp-0 (pointer process)))
(set! (-> self cam-entity) arg0)
10
(let ((s4-0 (cam-state-from-entity arg0)))
@@ -432,8 +431,8 @@
(else
(format 0 "ERROR <GMJ>: camera region '~S' didn't produce a state~%" (res-lump-struct arg0 'name structure))
(return #f))))
(set! sv-16 (new 'static 'res-tag))
(let ((s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(s4-2 (res-lump-data arg0 'alternates (pointer string) :tag-ptr (& sv-16))))
(when s4-2
(dotimes (s3-2 (the-as int (-> sv-16 elt-count)))
(let ((s2-0 (entity-by-name (-> s4-2 s3-2))))
@@ -444,12 +443,11 @@
(cond
((= s0-0 *camera-base-mode*) (deactivate (-> gp-0 0)) (master-base-region s2-0) (return #t) v0-21)
(s0-0
(set! sv-112 (get-process *camera-dead-pool* camera-slave #x4000))
(let ((s1-0 (when sv-112
(let ((t9-15 (method-of-type camera-slave activate)))
(t9-15 (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000)))
(run-now-in-process sv-112 cam-slave-init s0-0 s2-0)
(-> sv-112 ppointer))))
(let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000))
(s1-0 (when sv-112
((method-of-type camera-slave activate) (the-as camera-slave sv-112) self 'camera-slave (the-as pointer #x70004000))
(run-now-in-process sv-112 cam-slave-init s0-0 s2-0)
(-> sv-112 ppointer))))
(cond
(s1-0
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s1-0)))
@@ -462,16 +460,9 @@
(else (deactivate (-> s1-0 0)))))
(else (format 0 "ERROR <GMJ>: alternate region activate failed~%")))))
(else
(let ((s1-1 format)
(s0-1 0))
(set! sv-128 "ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%")
(let ((a2-10 (res-lump-struct s2-0 'name structure))) (s1-1 s0-1 sv-128 a2-10)))))))
(format 0 "ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%" (res-lump-struct s2-0 'name structure))))))
(else
(let ((s2-1 format)
(s1-2 0)
(s0-2 "ERROR <GMJ>: alternate '~S' not found for '~S'~%"))
(set! sv-144 (-> s4-2 s3-2))
(let ((a3-8 (res-lump-struct arg0 'name structure))) (s2-1 s1-2 s0-2 sv-144 a3-8))))))))))
(format 0 "ERROR <GMJ>: alternate '~S' not found for '~S'~%" (-> s4-2 s3-2) (res-lump-struct arg0 'name structure)))))))))
(let ((v1-48 (the int (* 300.0 (cam-slave-get-interp-time (-> (the-as camera-slave (-> gp-0 0)) cam-entity))))))
(if (nonzero? (-> self force-blend)) (set! v1-48 (min v1-48 (the-as int (-> self force-blend-time)))))
(send-event *camera* 'change-state (ppointer->process gp-0) v1-48))
@@ -556,7 +547,7 @@
(send-event self 'change-state cam-free-floating 0)
(dotimes (s5-1 (-> self num-slaves))
(set! (-> self slave s5-1 0 trans quad) (-> (the-as matrix gp-1) vector 0 quad))
(quaternion->matrix (the-as matrix (-> self slave s5-1 0 tracking)) (the-as quaternion (+ (the-as uint gp-1) 16)))))
(quaternion->matrix (-> self slave s5-1 0 tracking inv-mat) (the-as quaternion (+ (the-as uint gp-1) 16)))))
(send-event self 'teleport))))
((= v1-0 'teleport-to-other-start-string)
(let ((gp-2 (new 'stack-no-clear 'vector)))
@@ -614,9 +605,9 @@
((= v1-0 'reset-root)
(dotimes (gp-4 (-> self num-slaves))
(set! (-> self slave gp-4 0 trans quad) (the-as uint128 0))
(matrix-identity! (the-as matrix (-> self slave gp-4 0 tracking))))
(matrix-identity! (-> self slave gp-4 0 tracking inv-mat)))
(vector-reset! (-> *camera-combiner* trans))
(set! v0-0 (matrix-identity! (the-as matrix (-> *camera-combiner* tracking)))))
(set! v0-0 (matrix-identity! (-> *camera-combiner* tracking inv-mat))))
((= v1-0 'set-fov)
(set! (-> *camera-combiner* fov) (the-as float (-> block param 0)))
(dotimes (v1-86 (-> self num-slaves))
+72 -101
View File
@@ -35,7 +35,7 @@
(cam-curve-pos (-> self trans) gp-0 (the-as curve #f) #f)
(when (!= (-> gp-0 w) 0.0)
(vector-normalize! gp-0 (the-as float 1.0))
(forward-down->inv-matrix (the-as matrix (-> self tracking)) gp-0 (-> *camera* local-down)))))
(forward-down->inv-matrix (-> self tracking inv-mat) gp-0 (-> *camera* local-down)))))
(suspend))))
(defstate cam-fixed-read-entity (camera-slave)
@@ -50,7 +50,7 @@
((-> self enter-has-run))
((-> self cam-entity)
(cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) (-> self trans) 'trans)
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking)))
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat))
(set! (-> self fov) (cam-slave-get-fov (-> self cam-entity)))
(cam-curve-setup (-> self trans))
((-> cam-fixed enter)))
@@ -136,7 +136,7 @@
(cond
((and (< (vector-vector-distance s2-0 gp-0) 40960.0) (< (cos (the-as float 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)))
(vector-negate! (the-as vector (-> self tracking)) (-> s0-0 vector 0))
(set! (-> 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))) (the-as float 1.0))))
@@ -224,7 +224,7 @@
(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) #x8000)
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking)))
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat))
(set! (-> self tracking tilt-adjust target)
(cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust))))
((-> cam-standoff enter)))
@@ -316,17 +316,15 @@
((and (= (-> s4-0 x) 0.0) (= (-> s4-0 y) 0.0)) (set! gp-0 (current-time)))
(else (let ((v1-44 (min 10 (max 1 (- (current-time) gp-0))))) (vector-float*! s4-0 s4-0 (* 0.1 (the float v1-44))))))
(matrix-axis-angle! s5-0 (-> *camera* local-down) (-> s4-0 y))
(matrix*! (the-as matrix (-> self tracking)) (the-as matrix (-> self tracking)) s5-0)
(matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0)
(when (not (logtest? (-> self options) 8))
(if (< (vector-dot (-> self tracking inv-mat vector 1) (-> *camera* local-down)) 0.0)
(forward-down->inv-matrix (the-as matrix (-> self tracking))
(-> self tracking inv-mat vector 2)
(-> *camera* local-down))
(forward-down->inv-matrix (the-as matrix (-> self tracking))
(forward-down->inv-matrix (-> self tracking inv-mat) (-> self tracking inv-mat vector 2) (-> *camera* local-down))
(forward-down->inv-matrix (-> self tracking inv-mat)
(-> self tracking inv-mat vector 2)
(vector-negate! (new-stack-vector0) (-> *camera* local-down)))))
(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))
(matrix*! (-> self tracking inv-mat) (-> self tracking inv-mat) s5-0))
(when (not (logtest? (-> self options) 8))
(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))
@@ -372,7 +370,7 @@
(set! (-> self blend-to-type) (the-as uint 0))
0)
(set! (-> self fov) 9830.4)
(matrix-rotate-y! (the-as matrix (-> self tracking)) (the-as float -32768.0)))
(matrix-rotate-y! (-> self tracking inv-mat) (the-as float -32768.0)))
:exit
(behavior ()
'())
@@ -441,7 +439,7 @@
(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) #x8000)
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (the-as matrix (-> self tracking)))
(cam-slave-get-rot (the-as entity-actor (-> self cam-entity)) (-> self tracking inv-mat))
(set! (-> self tracking tilt-adjust target)
(cam-slave-get-float (-> self cam-entity) 'tiltAdjust (-> *CAMERA-bank* default-tilt-adjust))))
(cam-slave-get-vector-with-offset (the-as entity-actor (-> self cam-entity)) gp-0 'trans)
@@ -906,59 +904,58 @@
(arg4 clip-travel-vector-to-mesh-return-info)
(arg5 vector)
(arg6 float))
(local-vars (sv-128 float) (sv-144 vector) (sv-160 vector) (sv-176 vector) (sv-192 vector) (sv-208 int))
(with-pp
(set! sv-128 arg3)
(let ((gp-0 arg4))
(set! sv-144 arg5)
(let ((s4-0 arg6))
(set! sv-160 (new 'stack-no-clear 'vector))
(set! sv-176 (new 'stack-no-clear 'vector))
(let ((s5-0 (new 'stack-no-clear 'matrix)))
(set! sv-192 (new 'stack-no-clear 'vector))
(let ((f30-0 0.0)
(s0-0 #f))
(set! sv-208 0)
(while (< sv-208 4)
(cond
((= sv-208 3) (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) (set! (-> s5-0 vector sv-208 z) 0.0))
(else
(vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208))
(set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down)))
(vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368)))))
(vector-flatten! sv-160 sv-160 (-> *camera* local-down))
(vector-cross! sv-176 sv-160 arg2)
(let ((f28-0 (vector-dot sv-176 (-> *camera* local-down))))
(cond
((< (* f28-0 f30-0) 0.0) (set! s0-0 #t))
((!= f28-0 0.0) (set! f30-0 f28-0)))
(set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2))
(cond
((= sv-208 3) (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) (vector-flatten! sv-192 sv-192 arg1))
(else (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x))))
(if (< f28-0 0.0)
(set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192)))
(set! (-> s5-0 vector sv-208 y) (vector-length sv-192))))
(set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x)))
(set! sv-208 (+ sv-208 1)))
(let ((sv-128 arg3)
(gp-0 arg4)
(sv-144 arg5)
(s4-0 arg6)
(sv-160 (new 'stack-no-clear 'vector))
(sv-176 (new 'stack-no-clear 'vector))
(s5-0 (new 'stack-no-clear 'matrix))
(sv-192 (new 'stack-no-clear 'vector))
(f30-0 0.0)
(s0-0 #f))
(let ((sv-208 0))
(while (< sv-208 4)
(cond
((= sv-208 3) (vector-! sv-160 sv-144 (the-as vector (&-> pp stack 368))) (set! (-> s5-0 vector sv-208 z) 0.0))
(else
(vector-! sv-160 sv-144 (-> arg0 0 vertex sv-208))
(set! (-> s5-0 vector sv-208 z) (vector-dot sv-160 (-> *camera* local-down)))
(vector-! sv-160 (-> arg0 0 vertex sv-208) (the-as vector (&-> pp stack 368)))))
(vector-flatten! sv-160 sv-160 (-> *camera* local-down))
(vector-cross! sv-176 sv-160 arg2)
(let ((f28-0 (vector-dot sv-176 (-> *camera* local-down))))
(cond
((and s0-0 (!= s4-0 -100000000.0))
(dotimes (s4-1 4)
(dist-info-append (the-as collide-los-dist-info (-> gp-0 vert-0)) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))))
#f)
((< (-> s5-0 vector 3 y) 0.0)
(dotimes (s4-2 4)
(when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y))
(set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y)))
(dist-info-append (the-as collide-los-dist-info (-> gp-0 next-normal))
(the-as vector (+ (the-as uint s5-0) (* s4-2 16))))))
#f)
(else
(dotimes (s4-3 4)
(if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y))
(dist-info-append (the-as collide-los-dist-info (-> gp-0 intersection))
(the-as vector (+ (the-as uint s5-0) (* s4-3 16))))))
#f))))))))
((< (* f28-0 f30-0) 0.0) (set! s0-0 #t))
((!= f28-0 0.0) (set! f30-0 f28-0)))
(set! (-> s5-0 vector sv-208 x) (vector-dot sv-160 arg2))
(cond
((= sv-208 3) (vector-! sv-192 sv-144 (the-as vector (&-> pp stack 368))) (vector-flatten! sv-192 sv-192 arg1))
(else (vector--float*! sv-192 sv-160 arg2 (-> s5-0 vector sv-208 x))))
(if (< f28-0 0.0)
(set! (-> s5-0 vector sv-208 y) (- (vector-length sv-192)))
(set! (-> s5-0 vector sv-208 y) (vector-length sv-192))))
(set! (-> s5-0 vector sv-208 x) (- sv-128 (-> s5-0 vector sv-208 x)))
(+! sv-208 1)))
(cond
((and s0-0 (!= s4-0 -100000000.0))
(dotimes (s4-1 4)
(dist-info-append (the-as collide-los-dist-info (-> gp-0 vert-0)) (the-as vector (+ (the-as uint s5-0) (* s4-1 16)))))
#f)
((< (-> s5-0 vector 3 y) 0.0)
(dotimes (s4-2 4)
(when (>= (-> s5-0 vector 3 y) (-> s5-0 vector s4-2 y))
(set! (-> s5-0 vector s4-2 y) (- (-> s5-0 vector s4-2 y)))
(dist-info-append (the-as collide-los-dist-info (-> gp-0 next-normal))
(the-as vector (+ (the-as uint s5-0) (* s4-2 16))))))
#f)
(else
(dotimes (s4-3 4)
(if (>= (-> s5-0 vector s4-3 y) (-> s5-0 vector 3 y))
(dist-info-append (the-as collide-los-dist-info (-> gp-0 intersection))
(the-as vector (+ (the-as uint s5-0) (* s4-3 16))))))
#f)))))
(defun cam-los-spline-collide ((arg0 vector) (arg1 vector) (arg2 pat-surface))
(let ((s5-0 (new 'stack-no-clear 'vector))
@@ -1078,7 +1075,7 @@
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f3, f6]
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f2, f4, f7]
(defbehavior cam-los-collide camera-slave ((arg0 vector) (arg1 vector) (arg2 clip-travel-vector-to-mesh-return-info) (arg3 pat-surface))
(local-vars (s1-3 int) (s2-2 int) (f2-1 float) (sv-224 vector) (sv-240 vector))
(local-vars (s1-3 int) (s2-2 int) (f2-1 float))
(dist-info-init (the-as collide-los-dist-info (-> arg2 intersection)))
(dist-info-init (the-as collide-los-dist-info (-> arg2 next-normal)))
(dist-info-init (the-as collide-los-dist-info (-> arg2 vert-0)))
@@ -1102,41 +1099,23 @@
(if (< f26-1 0.0) (set! f26-1 0.0))
(if (< 1.0 f28-0) (set! f28-0 1.0))
(countdown (s0-1 (-> s0-0 num-tris))
(set! sv-240 (new 'stack-no-clear 'vector))
(set! sv-224 (new 'stack-no-clear 'vector))
(let ((f0-7 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224)))
(let* ((sv-240 (new 'stack-no-clear 'vector))
(sv-224 (new 'stack-no-clear 'vector))
(f0-7 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad) (-> s1-1 0) sv-240 sv-224)))
(cond
((or (< f0-7 0.0) (< 1.0 f0-7)))
((let ((f1-2 0.0))
(let* ((v1-21 arg1)
(f2-0 (-> v1-21 x))
(f3-0 (-> v1-21 y))
(f4-0 (-> v1-21 z))
(f5-0 (-> sv-224 x))
(f6-0 (-> sv-224 y))
(f7-0 (-> sv-224 z)))
;; og:preserve-this inlined vector-dot
; (.mula.s f2-0 f5-0)
; (.madda.s f3-0 f6-0)
; (.madd.s f2-1 f4-0 f7-0)
(set! f2-1 (+ (* f2-0 f5-0) (* f3-0 f6-0) (* f4-0 f7-0))))
(< f1-2 f2-1))
((let ((f1-2 0.0)) (let* ((v1-21 arg1)) (set! f2-1 (vector-dot v1-21 sv-224))) (< f1-2 f2-1))
(when (< f28-0 f0-7)
(let* ((t1-2 (new 'stack-no-clear 'vector))
(t0-2 (new 'stack-no-clear 'vector))
(f24-0 (moving-sphere-triangle-intersect arg0 arg1 (-> *CAM_STRING-bank* los-coll-rad2) (-> s1-1 0) t0-2 t1-2)))
(los-cw-ccw s1-1 s2-0 s4-0 f30-0 arg2 sv-240 f24-0)
(when *debug-segment*
(cond
((= f24-0 -100000000.0)
(let ((t9-11 cam-debug-add-los-tri)
(a0-13 s1-1)
(a2-7 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80))))
(t9-11 a0-13 sv-240 a2-7)))
(else
(cam-debug-add-los-tri s1-1
sv-240
(new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80)))))))))
(if (= f24-0 -100000000.0)
(cam-debug-add-los-tri s1-1 sv-240 (new 'static 'vector :x (the-as float #x80) :w (the-as float #x80)))
(cam-debug-add-los-tri s1-1
sv-240
(new 'static 'vector :x (the-as float #x80) :y (the-as float #x80) :w (the-as float #x80))))))))
((< f0-7 f26-1)
(let* ((t1-4 (new 'stack-no-clear 'vector))
(t0-4 (new 'stack-no-clear 'vector))
@@ -1478,7 +1457,6 @@
;; WARN: Stack slot load at 240 mismatch: defined as size 4, got size 16
;; WARN: Stack slot load at 256 mismatch: defined as size 4, got size 16
(defbehavior cam-string-move camera-slave ()
(local-vars (sv-240 float) (sv-256 float))
(vector-! (-> self velocity) (-> self desired-pos) (-> self string-trans))
(if *display-cam-los-debug* (format *stdcon* "vel ~M~%" (vector-length (-> self velocity))))
(let ((s5-1 (new 'stack-no-clear 'vector))
@@ -1525,15 +1503,8 @@
s4-2
(new 'static 'pat-surface :nocamera #x1))
-100000000.0)))
(when *display-cam-los-debug*
(let ((s2-0 format)
(s1-0 *stdcon*)
(s0-0 "vp ~f vr ~f r ~f ta ~f~%"))
(set! sv-240 (vector-length s5-2))
(set! sv-256 f30-2)
(let ((t0-3 (/ (vector-length s5-2) f30-2))
(t1-1 f28-1))
(s2-0 s1-0 s0-0 sv-240 sv-256 t0-3 t1-1))))
(if *display-cam-los-debug*
(format *stdcon* "vp ~f vr ~f r ~f ta ~f~%" (vector-length s5-2) f30-2 (/ (vector-length s5-2) f30-2) f28-1))
(cond
((>= f28-1 0.0)
(let* ((f1-7 (fmax 0.01 (/ 40.96 (vector-length s5-2))))
+11 -14
View File
@@ -38,7 +38,6 @@
(defun update-view-planes ((arg0 math-camera) (arg1 (inline-array plane)) (arg2 float))
"Compute the frustum planes from the given camera."
(local-vars (sv-240 vector))
(when (not *artist-fix-frustum*)
(let ((s5-0 (new 'stack 'view-frustum)))
(let ((f30-0 (* arg2 (-> arg0 x-ratio) (-> arg0 d)))
@@ -66,19 +65,17 @@
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0)))
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(set! sv-240 (new 'stack-no-clear 'vector))
(set! (-> sv-240 quad) (the-as uint128 0))
(let ((v1-5 (-> arg0 inv-camera-rot vector 3 quad))) (set! (-> sv-240 quad) v1-5))
(vector-! s2-0 (-> s5-0 yon-top-left) sv-240)
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
(vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240)
(plane-from-points arg1 s2-0 s1-0 sv-240 0)
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
(plane-from-points arg1 s3-1 s2-0 sv-240 2)
(let ((t9-20 plane-from-points)
(t0-3 3))
(t9-20 arg1 s1-0 s0-0 sv-240 t0-3)))))
(let ((sv-240 (new 'stack-no-clear 'vector)))
(set! (-> sv-240 quad) (the-as uint128 0))
(set! (-> sv-240 quad) (-> arg0 inv-camera-rot vector 3 quad))
(vector-! s2-0 (-> s5-0 yon-top-left) sv-240)
(vector-! s3-1 (-> s5-0 yon-top-right) sv-240)
(vector-! s1-0 (-> s5-0 yon-bottom-left) sv-240)
(vector-! s0-0 (-> s5-0 yon-bottom-right) sv-240)
(plane-from-points arg1 s2-0 s1-0 sv-240 0)
(plane-from-points arg1 s0-0 s3-1 sv-240 1)
(plane-from-points arg1 s3-1 s2-0 sv-240 2)
(plane-from-points arg1 s1-0 s0-0 sv-240 3)))))
(none))
;; if we should still attempt vis updates when outside of the bsp's boxes.
+128 -200
View File
@@ -134,7 +134,7 @@
(else (* 0.5 (+ 1.0 (sqrtf (+ -1.0 (* 2.0 arg0))))))))
(defun fourth-power ((arg0 float))
(let ((f0-2 (* arg0 arg0))) (* f0-2 f0-2)))
(square (square arg0)))
(defun third-power ((arg0 float))
(* arg0 arg0 arg0))
@@ -143,15 +143,8 @@
(cond
((>= arg0 1.0) 1.0)
((>= 0.0 arg0) 0.0)
((>= 0.5 arg0)
(let ((f0-3 0.5)
(f1-4 (* 2.0 arg0)))
(* f0-3 (* f1-4 f1-4))))
(else
(let ((f0-5 1.0)
(f1-7 0.5)
(f2-2 (* 2.0 (- 1.0 arg0))))
(- f0-5 (* f1-7 (* f2-2 f2-2)))))))
((>= 0.5 arg0) (* 0.5 (square (* 2.0 arg0))))
(else (- 1.0 (* 0.5 (square (* 2.0 (- 1.0 arg0))))))))
(defun parameter-ease-sin-clamp ((arg0 float))
(cond
@@ -160,22 +153,17 @@
(else (+ 0.5 (* 0.5 (sin (* 182.04445 (+ -90.0 (* 180.0 arg0)))))))))
(defmethod cam-index-method-9 ((this cam-index) (arg0 symbol) (arg1 entity) (arg2 vector) (arg3 curve))
(local-vars (sv-32 (function _varargs_ object)))
(format (clear *cam-res-string*) "~S-flags" arg0)
(set! (-> this flags) (the-as cam-index-options (cam-slave-get-flags arg1 (string->symbol *res-key-string*))))
(let ((s3-2 (res-lump-data arg1 arg0 pointer))
(s0-1 (method-of-type res-lump get-property-struct)))
(set! sv-32 format)
(let ((a0-7 (clear *res-key-string*))
(a1-4 "~S~S")
(a3-2 '-offset))
(sv-32 a0-7 a1-4 arg0 a3-2))
(format (clear *res-key-string*) "~S~S" arg0 '-offset)
(let ((v0-8 (s0-1 arg1 (string->symbol *res-key-string*) 'interp -1000000000.0 #f (the-as (pointer res-tag) #f) *res-static-buf*)))
(cond
(s3-2
(cond
(v0-8
(vector+! (the-as vector (-> this vec)) (the-as vector (&+ s3-2 0)) (the-as vector v0-8))
(vector+! (-> this vec 0) (the-as vector (&+ s3-2 0)) (the-as vector v0-8))
(vector+! (-> this vec 1) (the-as vector (&+ s3-2 16)) (the-as vector v0-8)))
(else
(set! (-> this vec 0 quad) (-> (the-as (pointer uint128) (&+ s3-2 0))))
@@ -190,26 +178,26 @@
((logtest? (-> this flags) (cam-index-options SPHERICAL))
(vector-! s4-1 (-> this vec 1) arg2)
(set! (-> this vec 1 w) (vector-length s4-1))
(vector-! s4-1 (the-as vector (-> this vec)) arg2)
(vector-! s4-1 (-> this vec 0) arg2)
(set! (-> this vec 1 x) (vector-length s4-1))
(set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x)))
(set! (-> this vec 0 quad) (-> arg2 quad)))
((logtest? (-> this flags) (cam-index-options RADIAL))
(vector-! s4-1 (-> this vec 1) arg2)
(set! (-> this vec 1 w) (vector-length s4-1))
(vector-! s4-1 (the-as vector (-> this vec)) arg2)
(vector-! s4-1 (-> this vec 0) arg2)
(set! (-> this vec 1 x) (vector-length s4-1))
(set! (-> this vec 1 w) (- (-> this vec 1 w) (-> this vec 1 x)))
(set! (-> this vec 0 quad) (-> arg2 quad)))
(else
(vector-! (-> this vec 1) (-> this vec 1) (the-as vector (-> this vec)))
(vector-! (-> this vec 1) (-> this vec 1) (-> this vec 0))
(set! (-> this vec 1 w) (vector-normalize-ret-len! (-> this vec 1) 1.0)))))
#t)
(defmethod cam-index-method-10 ((this cam-index) (arg0 vector))
(let ((s5-0 (new-stack-vector0)))
0.0
(vector-! s5-0 arg0 (the-as vector (-> this vec)))
(vector-! s5-0 arg0 (-> this vec 0))
(cond
((logtest? (-> this flags) (cam-index-options SPHERICAL))
(vector-flatten! s5-0 s5-0 (-> *camera* local-down))
@@ -252,8 +240,8 @@
(let ((v1-11 (-> this point arg0 next)))
(set! (-> this summed-len) (- (-> this summed-len) (-> this point arg0 tp-length)))
(vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0)))
(the-as vector (-> this point v1-11))
(the-as vector (-> this point arg0))))
(-> this point v1-11 position)
(-> this point arg0 position)))
(set! (-> this point arg0 tp-length)
(vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 arg0))) 1.0))
(+! (-> this summed-len) (-> this point arg0 tp-length))
@@ -291,7 +279,7 @@
(let ((a2-0 (new 'stack-no-clear 'tracking-point)))
(set! (-> s5-0 cur-pt) (-> this used-point))
(set! (-> s5-0 partial-pt) (-> this partial-point))
(tracking-spline-method-19 this (-> this sample-len) (the-as vector a2-0) s5-0))
(tracking-spline-method-19 this (-> this sample-len) (-> a2-0 position) s5-0))
(if (or (= (-> s5-0 cur-pt) (-> this end-point))
(= (-> s5-0 cur-pt) (-> this next-to-last-point))
(= (-> this point (-> s5-0 cur-pt) next) (-> this next-to-last-point)))
@@ -341,9 +329,7 @@
(defmethod tracking-spline-method-17 ((this tracking-spline) (arg0 vector) (arg1 float) (arg2 float) (arg3 symbol))
(let ((s3-0 (-> this free-point))
(s2-0 (-> this end-point)))
(vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0)))
arg0
(the-as vector (-> this point s2-0)))
(vector-! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) arg0 (-> this point s2-0 position))
(set! (-> this point s2-0 tp-length)
(vector-normalize-ret-len! (the-as vector (+ (the-as uint (-> this point 0 direction)) (* 48 s2-0))) 1.0))
(if (< (-> this point s2-0 tp-length) arg1) (return 0))
@@ -375,7 +361,7 @@
(cond
((= (-> arg2 cur-pt) (-> this end-point))
(set! (-> arg2 partial-pt) 0.0)
(vector+! arg1 arg1 (the-as vector (-> this point (-> arg2 cur-pt))))
(vector+! arg1 arg1 (-> this point (-> arg2 cur-pt) position))
(return arg1))
((begin
(set! f0-4 (+ (-> arg2 partial-pt) (/ arg0 (-> this point (-> arg2 cur-pt) tp-length))))
@@ -383,10 +369,7 @@
(set! (-> arg2 partial-pt) f0-4)
(let ((s5-0 (new 'stack-no-clear 'tracking-spline-sampler)))
(let ((a2-5 (-> this point (-> arg2 cur-pt) next)))
(vector-lerp! (the-as vector s5-0)
(the-as vector (-> this point (-> arg2 cur-pt)))
(the-as vector (-> this point a2-5))
f0-4))
(vector-lerp! (the-as vector s5-0) (-> this point (-> arg2 cur-pt) position) (-> this point a2-5 position) f0-4))
(vector+! arg1 arg1 (the-as vector s5-0)))
(return arg1))
(else
@@ -402,7 +385,7 @@
(defmethod tracking-spline-method-20 ((this tracking-spline) (arg0 vector) (arg1 int))
(let ((s3-0 (new 'stack-no-clear 'vector)))
(vector-! s3-0 (the-as vector (-> this point (-> this used-point))) (the-as vector (-> this point (-> this end-point))))
(vector-! s3-0 (-> this point (-> this used-point) position) (-> this point (-> this end-point) position))
(let* ((f0-0 (vector-length s3-0))
(f1-1 (* 0.33333334 (- 1.5 (/ f0-0 METER_LENGTH)))))
0.0
@@ -433,18 +416,20 @@
(cond
((< f26-0 0.0)
(if (and *debug-segment* *display-camera-marks*)
(camera-line-rel-len (the-as vector (-> this point s1-0))
(camera-line-rel-len (-> this point s1-0 position)
s2-0
(* -40.96 f26-0)
(the-as vector4w
(new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80))))))
(-> (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #xff #xff #x0 #x80)))
0
vector4w)))
(vector--float*! arg0 arg0 s2-0 f26-0))
((and *debug-segment* *display-camera-marks*)
(camera-line-rel-len (the-as vector (-> this point s1-0))
(camera-line-rel-len (-> this point s1-0 position)
s2-0
(* 40.96 f26-0)
(the-as vector4w
(new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80))))))))
(-> (new 'static 'inline-array qword 1 (new 'static 'qword :data (new 'static 'array uint32 4 #x80 #x80 #x0 #x80)))
0
vector4w)))))
(set! v1-8 s1-0))))))
0
(none))
@@ -558,7 +543,7 @@
(set! (-> self velocity quad) (-> *camera-combiner* velocity quad)))
(else
(vector-reset! (-> self trans))
(matrix-identity! (the-as matrix (-> self tracking)))
(matrix-identity! (-> self tracking inv-mat))
(set! (-> self fov) 11650.845)
(vector-reset! (-> self velocity))))
(set! (-> self time-dist-too-far) (the-as uint 0))
@@ -732,9 +717,7 @@
(cond
((< (-> *camera* ease-t) 1.0))
((< (-> arg0 follow-blend) 1.0)
(let* ((f0-18 (-> arg0 follow-blend))
(f0-19 (* f0-18 f0-18))
(f0-20 (* f0-19 f0-19)))
(let ((f0-20 (square (square (-> arg0 follow-blend)))))
(vector-! s5-1 s5-1 (-> arg0 follow-off))
(vector-float*! s5-1 s5-1 f0-20))
(+! (-> arg0 follow-blend) (/ (-> *display* time-adjust-ratio) 60))
@@ -758,9 +741,9 @@
(f30-2 (cond
((< f0-28 0.0) 1.0)
(else
(let* ((f0-29 (* f0-28 f0-28))
(let* ((f0-29 (square f0-28))
(f0-30 (- 1.0 f0-29)))
(* f0-30 (* f0-30 f0-30)))))))
(* f0-30 (square f0-30)))))))
(vector-! s3-2 arg1 (-> *camera* tpos-curr-adj))
(vector-flatten! s3-2 s3-2 (-> *camera* local-down))
(let* ((f0-33 (* 0.000022194603 (+ -20480.0 (vector-length s3-2))))
@@ -822,7 +805,6 @@
(quaternion->matrix arg0 s4-0)))
(defun vector-into-frustum-nosmooth! ((arg0 matrix) (arg1 vector) (arg2 float))
(local-vars (sv-112 (inline-array vector)) (sv-128 vector) (sv-144 vector) (sv-160 vector) (sv-176 vector))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf))
@@ -837,33 +819,37 @@
(vector-! s3-0 (-> *camera* tpos-curr) arg1)
(vector-flatten! s3-0 s3-0 (-> arg0 vector 1))
(vector-normalize! s3-0 1.0)
(let ((f28-0 (vector-dot s3-0 (the-as vector (-> arg0 vector)))))
(set! sv-128 s2-0)
(set! sv-112 (-> arg0 vector))
(let ((f0-6 (* 0.8 (tan (/ arg2 2))))) (.lvf vf1 (&-> sv-112 0 quad)) (let ((v1-6 f0-6)) (.mov vf2 v1-6)))
(.add.x.vf.w vf1 vf0 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> sv-128 quad) vf1)
(let ((f28-0 (vector-dot s3-0 (-> arg0 vector 0))))
(let ((sv-128 s2-0))
(let ((sv-112 (-> arg0 vector))
(f0-6 (* 0.8 (tan (/ arg2 2)))))
(.lvf vf1 (&-> sv-112 0 quad))
(let ((v1-6 f0-6)) (.mov vf2 v1-6)))
(.add.x.vf.w vf1 vf0 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> sv-128 quad) vf1))
(vector+! s2-0 s2-0 (-> arg0 vector 2))
(vector-normalize! s2-0 1.0)
(let ((f0-8 (vector-dot s2-0 (the-as vector (-> arg0 vector)))))
(let ((f0-8 (vector-dot s2-0 (-> arg0 vector 0))))
(when (< f0-8 (fabs f28-0))
(if (< f28-0 0.0) (vector--float*! s2-0 s2-0 (the-as vector (-> arg0 vector)) (* 2.0 f0-8)))
(if (< f28-0 0.0) (vector--float*! s2-0 s2-0 (-> arg0 vector 0) (* 2.0 f0-8)))
(matrix-from-two-vectors! s5-0 s2-0 s3-0)
(vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0)
(vector-cross! (the-as vector (-> arg0 vector)) (-> arg0 vector 1) (-> arg0 vector 2)))))
(vector-cross! (-> arg0 vector 0) (-> arg0 vector 1) (-> arg0 vector 2)))))
(vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off))
(vector-! s3-0 s3-0 arg1)
(vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* foot-offset))
(vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector)))
(vector-flatten! s3-0 s3-0 (-> arg0 vector 0))
(vector-normalize! s3-0 1.0)
(let ((f28-1 (vector-dot s3-0 (-> arg0 vector 1))))
(set! sv-160 s2-0)
(set! sv-144 (-> arg0 vector 1))
(let ((f0-15 (* 0.525 (tan (/ arg2 2))))) (.lvf vf1 (&-> sv-144 quad)) (let ((v1-23 f0-15)) (.mov vf2 v1-23)))
(.add.x.vf.w vf1 vf0 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> sv-160 quad) vf1)
(let ((sv-160 s2-0))
(let ((sv-144 (-> arg0 vector 1))
(f0-15 (* 0.525 (tan (/ arg2 2)))))
(.lvf vf1 (&-> sv-144 quad))
(let ((v1-23 f0-15)) (.mov vf2 v1-23)))
(.add.x.vf.w vf1 vf0 vf0)
(.mul.x.vf.xyz vf1 vf1 vf2)
(.svf (&-> sv-160 quad) vf1))
(vector+! s2-0 s2-0 (-> arg0 vector 2))
(vector-normalize! s2-0 1.0)
(let ((f0-17 (vector-dot s2-0 (-> arg0 vector 1))))
@@ -873,33 +859,25 @@
(vector-! s3-0 (-> *camera* tpos-curr) (-> *camera* pitch-off))
(vector-! s3-0 s3-0 arg1)
(vector--float*! s3-0 s3-0 (-> *camera* local-down) (-> *camera* head-offset))
(vector-flatten! s3-0 s3-0 (the-as vector (-> arg0 vector)))
(vector-flatten! s3-0 s3-0 (-> arg0 vector 0))
(vector-normalize! s3-0 1.0)
(let ((f28-2 (vector-dot s3-0 (-> arg0 vector 1))))
(let ((s0-1 s2-0))
(set! sv-176 (-> arg0 vector 1))
(let ((f0-25 (* 0.525 (tan (/ arg2 2))))) (vector-float*! s0-1 sv-176 f0-25)))
(vector-float*! s2-0 (-> arg0 vector 1) (* 0.525 (tan (/ arg2 2))))
(vector+! s2-0 s2-0 (-> arg0 vector 2))
(vector-normalize! s2-0 1.0)
(let ((f0-27 (vector-dot s2-0 (-> arg0 vector 1))))
(cond
((and (< 0.0 f28-2) (< f0-27 f28-2)) (set! f30-0 (vector-dot s2-0 s3-0)) (set! s4-0 #f))
((< f30-0 0.0) (let ((f0-32 (- (vector-dot s2-0 s3-0)))) (if (< f0-32 f30-0) (set! f30-0 f0-32)))))))
(let ((f0-34 (if s4-0 (- (acos f30-0)) (acos f30-0)))) (matrix-axis-angle! s5-0 (the-as vector (-> arg0 vector)) f0-34))))
(let ((f0-34 (if s4-0 (- (acos f30-0)) (acos f30-0)))) (matrix-axis-angle! s5-0 (-> arg0 vector 0) f0-34))))
(vector-matrix*! (-> arg0 vector 2) (-> arg0 vector 2) s5-0))
(vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (the-as vector (-> arg0 vector)))))
(vector-cross! (-> arg0 vector 1) (-> arg0 vector 2) (-> arg0 vector 0))))
;; 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))
(local-vars
(f0-8 float)
(sv-192 vector)
(sv-208 vector)
(sv-224 matrix)
(sv-240 (function matrix vector float vector))
(sv-256 matrix))
(local-vars (f0-8 float))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -910,60 +888,44 @@
(let ((f30-0 (-> arg0 tilt-adjust value)))
(cond
((< 0.0001 (-> arg0 point-of-interest-blend value))
(set! sv-192 (new 'stack-no-clear 'vector))
0.0
(vector-! s1-0 (-> arg0 follow-pt) arg1)
(let ((f28-0 (vector-length s1-0)))
(vector-! sv-192 (-> arg0 point-of-interest) arg1)
(vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value)))
(let ((v1-3 s1-0))
(let ((a0-5 s1-0)) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> a0-5 quad)))
(.lvf vf5 (&-> sv-192 quad))
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-3 quad) vf6))
(vector-normalize! s1-0 f28-0)))
(let ((sv-192 (new 'stack-no-clear 'vector)))
0.0
(vector-! s1-0 (-> arg0 follow-pt) arg1)
(let ((f28-0 (vector-length s1-0)))
(vector-! sv-192 (-> arg0 point-of-interest) arg1)
(vector-normalize! sv-192 (* f28-0 (-> arg0 point-of-interest-blend value)))
(let ((v1-3 s1-0))
(let ((a0-5 s1-0)) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> a0-5 quad)))
(.lvf vf5 (&-> sv-192 quad))
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-3 quad) vf6))
(vector-normalize! s1-0 f28-0))))
(else (vector-! s1-0 (-> arg0 follow-pt) arg1)))
(forward-down->inv-matrix s5-0 s1-0 (-> *camera* local-down))
(when (!= f30-0 0.0)
0.0
0.0
(set! sv-224 (new 'stack-no-clear 'matrix))
(set! sv-208 (new 'stack-no-clear 'vector))
(vector-normalize-copy! sv-208 s1-0 1.0)
(let* ((v1-11 (-> *camera* local-down))
(f0-7 (-> sv-208 x))
(f1-1 (-> sv-208 y))
(f2-0 (-> sv-208 z))
(f3-0 (-> v1-11 x))
(f4-0 (-> v1-11 y))
(f5-0 (-> v1-11 z)))
;; og:preserve-this inlined vector-dot
; (.mula.s f0-7 f3-0)
; (.madda.s f1-1 f4-0)
; (.madd.s f0-8 f2-0 f5-0)
(set! f0-8 (+ (* f0-7 f3-0) (* f1-1 f4-0) (* f2-0 f5-0))))
(let* ((f28-1 f0-8)
(f0-10 (acos (fabs f28-1))))
(cond
((< 0.0 f30-0)
(set! f30-0
(if (< 0.0 f28-1) (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))))))
((< f30-0 0.0)
(set! f30-0
(if (< 0.0 f28-1)
(fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))))
(fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))))))))
(matrix-rotate-x! sv-224 f30-0)
(let ((t9-7 matrix*!)
(a0-16 s5-0)
(a2-3 s5-0))
(t9-7 a0-16 sv-224 a2-3))))
(let ((sv-224 (new 'stack-no-clear 'matrix)))
(let ((sv-208 (new 'stack-no-clear 'vector)))
(vector-normalize-copy! sv-208 s1-0 1.0)
(let* ((v1-11 (-> *camera* local-down))) (set! f0-8 (vector-dot sv-208 v1-11))))
(let* ((f28-1 f0-8)
(f0-10 (acos (fabs f28-1))))
(cond
((< 0.0 f30-0)
(set! f30-0
(if (< 0.0 f28-1) (fmin f30-0 (fmax 0.0 (+ -2730.6667 f0-10))) (fmin f30-0 (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))))))
((< f30-0 0.0)
(set! f30-0
(if (< 0.0 f28-1)
(fmax f30-0 (- (fmax 0.0 (- 32768.0 (+ 2730.6667 f0-10)))))
(fmax f30-0 (- (fmax 0.0 (+ -2730.6667 f0-10)))))))))
(matrix-rotate-x! sv-224 f30-0)
(matrix*! s5-0 sv-224 s5-0))))
(if (and (= (-> *camera* under-water) 2) *target* (!= (-> *target* next-state name) 'target-swim-up))
(set! (-> arg0 underwater-blend target) 1.0)
(set! (-> arg0 underwater-blend target) 0.0))
(set! sv-240 vector-into-frustum-nosmooth!)
(set! sv-256 s5-0)
(let ((a2-5 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))) (sv-240 sv-256 arg1 a2-5))
(vector-into-frustum-nosmooth! s5-0 arg1 (lerp-clamp arg3 (/ arg3 4) (-> arg0 underwater-blend value)))
(cond
(arg4 (slave-matrix-blend-2 (-> arg0 inv-mat) arg2 s1-0 s5-0))
(else
@@ -985,67 +947,50 @@
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4]
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
(defun v-slrp2! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 float) (arg4 vector) (arg5 float))
(local-vars (f0-10 float) (f28-0 float) (f30-0 float) (sv-144 float) (sv-160 vector) (sv-176 matrix) (sv-192 vector))
(set! sv-144 arg5)
(let ((s0-0 (new-stack-vector0)))
(set! sv-160 (new 'stack-no-clear 'vector))
(local-vars (f0-10 float) (f28-0 float) (f30-0 float))
(let ((sv-144 arg5)
(s0-0 (new-stack-vector0))
(sv-160 (new 'stack-no-clear 'vector)))
(set! (-> sv-160 quad) (the-as uint128 0))
1.0
1.0
(let ((s3-0 (new-stack-vector0)))
0.0
1.0
(set! sv-176 (new 'stack-no-clear 'matrix))
(set! (-> sv-176 vector 0 quad) (the-as uint128 0))
(set! (-> sv-176 vector 1 quad) (the-as uint128 0))
(set! (-> sv-176 vector 2 quad) (the-as uint128 0))
(set! (-> sv-176 vector 3 quad) (the-as uint128 0))
(cond
((< 1.0 arg3) (set! arg3 1.0))
((< arg3 0.0) (set! arg3 0.0)))
(cond
(arg4
(vector-flatten! s0-0 arg1 arg4)
(vector-flatten! sv-160 arg2 arg4)
(set! f30-0 (vector-normalize-ret-len! s0-0 1.0))
(set! f28-0 (vector-normalize-ret-len! sv-160 1.0))
(vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0)
(let ((f26-0 (vector-dot arg4 s3-0)))
(vector-normalize-copy! s3-0 arg4 1.0)
(if (< f26-0 0.0) (vector-negate! s3-0 s3-0))))
(else
(set! (-> s0-0 quad) (-> arg1 quad))
(set! (-> sv-160 quad) (-> arg2 quad))
(set! f30-0 (vector-normalize-ret-len! s0-0 1.0))
(set! f28-0 (vector-normalize-ret-len! sv-160 1.0))
(vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0)))
(let ((t9-10 acos))
(let* ((v1-18 s0-0)
(f0-9 (-> v1-18 x))
(f1-2 (-> v1-18 y))
(f2-0 (-> v1-18 z))
(f3-0 (-> sv-160 x))
(f4-0 (-> sv-160 y))
(f5-0 (-> sv-160 z)))
;; og:preserve-this inlined vector-dot
; (.mula.s f0-9 f3-0)
; (.madda.s f1-2 f4-0)
; (.madd.s f0-10 f2-0 f5-0)
(set! f0-10 (+ (* f2-0 f5-0) (* f1-2 f4-0) (* f0-9 f3-0))))
(let* ((f1-3 (t9-10 f0-10))
(f0-12 (* arg3 f1-3)))
(when (< sv-144 f0-12)
(set! f0-12 sv-144)
(set! arg3 (/ sv-144 f1-3)))
(let* ((f0-13 (cos f0-12))
(t9-12 matrix-axis-sin-cos!)
(a0-20 sv-176)
(a1-13 s3-0)
(f1-5 1.0)
(f2-3 f0-13))
(t9-12 a0-20 a1-13 (sqrtf (- f1-5 (* f2-3 f2-3))) f0-13))))
(vector-matrix*! arg0 s0-0 sv-176)
(let ((s0-1 vector-normalize!)) (set! sv-192 arg0) (let ((a1-16 (lerp f30-0 f28-0 arg3))) (s0-1 sv-192 a1-16)))
(let ((sv-176 (new 'stack-no-clear 'matrix)))
(set! (-> sv-176 vector 0 quad) (the-as uint128 0))
(set! (-> sv-176 vector 1 quad) (the-as uint128 0))
(set! (-> sv-176 vector 2 quad) (the-as uint128 0))
(set! (-> sv-176 vector 3 quad) (the-as uint128 0))
(cond
((< 1.0 arg3) (set! arg3 1.0))
((< arg3 0.0) (set! arg3 0.0)))
(cond
(arg4
(vector-flatten! s0-0 arg1 arg4)
(vector-flatten! sv-160 arg2 arg4)
(set! f30-0 (vector-normalize-ret-len! s0-0 1.0))
(set! f28-0 (vector-normalize-ret-len! sv-160 1.0))
(vector-normalize! (vector-cross! s3-0 sv-160 s0-0) 1.0)
(let ((f26-0 (vector-dot arg4 s3-0)))
(vector-normalize-copy! s3-0 arg4 1.0)
(if (< f26-0 0.0) (vector-negate! s3-0 s3-0))))
(else
(set! (-> s0-0 quad) (-> arg1 quad))
(set! (-> sv-160 quad) (-> arg2 quad))
(set! f30-0 (vector-normalize-ret-len! s0-0 1.0))
(set! f28-0 (vector-normalize-ret-len! sv-160 1.0))
(vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0)))
(let ((t9-10 acos))
(let* ((v1-18 s0-0)) (set! f0-10 (vector-dot v1-18 sv-160)))
(let* ((f1-3 (t9-10 f0-10))
(f0-12 (* arg3 f1-3)))
(when (< sv-144 f0-12)
(set! f0-12 sv-144)
(set! arg3 (/ sv-144 f1-3)))
(let ((f0-13 (cos f0-12))) (matrix-axis-sin-cos! sv-176 s3-0 (sqrtf (- 1.0 (square f0-13))) f0-13))))
(vector-matrix*! arg0 s0-0 sv-176))
(vector-normalize! arg0 (lerp f30-0 f28-0 arg3))
(when arg4
(vector+float*! arg0 arg0 s3-0 (vector-dot arg1 s3-0))
(vector+float*! arg0 arg0 s3-0 (* arg3 (vector-dot (vector-! (new-stack-vector0) arg2 arg1) s3-0))))))
@@ -1055,10 +1000,10 @@
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4]
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
(defun v-slrp3! ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float))
(local-vars (f0-7 float) (f26-0 float) (f28-0 float) (sv-144 float) (sv-160 vector))
(set! sv-144 arg4)
(let ((s1-0 (new-stack-vector0)))
(set! sv-160 (new 'stack-no-clear 'vector))
(local-vars (f0-7 float) (f26-0 float) (f28-0 float))
(let ((sv-144 arg4)
(s1-0 (new-stack-vector0))
(sv-160 (new 'stack-no-clear 'vector)))
(set! (-> sv-160 quad) (the-as uint128 0))
0.0
0.0
@@ -1083,29 +1028,12 @@
(set! f26-0 (vector-normalize-ret-len! sv-160 1.0))
(vector-normalize! (vector-cross! s3-0 arg2 arg1) 1.0)))
(let ((t9-10 acos))
(let* ((v1-9 s1-0)
(f0-6 (-> v1-9 x))
(f1-0 (-> v1-9 y))
(f2-0 (-> v1-9 z))
(f3-0 (-> sv-160 x))
(f4-0 (-> sv-160 y))
(f5-0 (-> sv-160 z)))
;; og:preserve-this inlined vector-dot
; (.mula.s f0-6 f3-0)
; (.madda.s f1-0 f4-0)
; (.madd.s f0-7 f2-0 f5-0)
(set! f0-7 (+ (* f0-6 f3-0) (* f1-0 f4-0) (* f2-0 f5-0))))
(let* ((v1-9 s1-0)) (set! f0-7 (vector-dot v1-9 sv-160)))
(let ((f0-8 (t9-10 f0-7)))
(when (< sv-144 f0-8)
(set! f30-0 (/ sv-144 f0-8))
(set! f0-8 sv-144))
(let* ((f0-9 (cos f0-8))
(t9-12 matrix-axis-sin-cos!)
(a0-20 s0-0)
(a1-13 s3-0)
(f1-3 1.0)
(f2-1 f0-9))
(t9-12 a0-20 a1-13 (sqrtf (- f1-3 (* f2-1 f2-1))) f0-9))))
(let ((f0-9 (cos f0-8))) (matrix-axis-sin-cos! s0-0 s3-0 (sqrtf (- 1.0 (square f0-9))) f0-9))))
(vector-matrix*! arg0 s1-0 s0-0))
(vector-normalize! arg0 (lerp f28-0 f26-0 f30-0))
(when arg3
@@ -61,7 +61,6 @@
;; Find edges that we might be able to grab
(find-grabbable-edges! gp-0)
(when (nonzero? (-> gp-0 num-edges))
;;
(set! (-> gp-0 search-pt quad) (-> *target* control unknown-vector90 quad))
;; for the search, we either use the direction of the stick, or the heading of target.
(when (!= (-> *cpad-list* cpads (-> *target* control unknown-cpad-info00 number) stick0-speed) 0.0)
@@ -114,7 +113,6 @@
(defmethod-mips2c "(method 18 collide-edge-work)" 18 collide-edge-work)
(defmethod check-grab-for-collisions ((this collide-edge-work) (arg0 collide-edge-hold-item) (arg1 edge-grab-info))
(local-vars (sv-144 (function vector vector vector float vector)) (sv-160 vector) (sv-176 vector))
(let* ((s3-0 (-> arg0 edge))
(s1-0 (-> s3-0 etri ctri))
(s4-0 (-> s1-0 prim-index)))
@@ -122,12 +120,7 @@
(vector+*! s0-0 (-> arg0 center-pt) (-> s3-0 edge-vec-norm) 1105.92)
(let ((f0-0 (collide-edge-work-method-14 this (-> arg1 right-hand-hold) s0-0 (the-as int s4-0))))
(if (< 491.52 f0-0) (return #f)))
(set! sv-144 vector+*!)
(set! sv-160 s0-0)
(set! sv-176 (-> arg0 center-pt))
(let ((a2-3 (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)))
(a3-2 1105.92))
(sv-144 sv-160 sv-176 a2-3 a3-2))
(vector+*! s0-0 (-> arg0 center-pt) (vector-negate! (new 'stack-no-clear 'vector) (-> s3-0 edge-vec-norm)) 1105.92)
(let ((f0-1 (collide-edge-work-method-14 this (-> arg1 left-hand-hold) s0-0 (the-as int s4-0))))
(if (< 491.52 f0-1) (return #f))))
(set! (-> arg1 tri-vertex 0 quad) (-> s1-0 vertex 0 quad))
@@ -138,8 +131,7 @@
(set! (-> arg1 world-vertex 0 quad) (-> s3-0 vertex-ptr 0 0 quad))
(set! (-> arg1 world-vertex 1 quad) (-> s3-0 vertex-ptr 1 0 quad))
(set! (-> arg1 hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
(vector-normalize! (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (the-as vector (-> arg1 world-vertex)))
1.0)
(vector-normalize! (vector-! (-> arg1 hanging-matrix vector 2) (-> arg1 world-vertex 1) (-> arg1 world-vertex 0)) 1.0)
(vector-normalize! (vector-cross! (the-as vector (-> arg1 hanging-matrix))
(-> arg1 hanging-matrix vector 2)
(-> arg1 hanging-matrix vector 1))
@@ -161,7 +153,7 @@
(a0-35 (-> (the-as collide-shape-prim v1-36) cshape)))
(cond
(a0-35
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as int (-> a0-35 process))))
(set! (-> arg1 actor-cshape-prim-offset) (- (the-as int v1-36) (the-as uint (the-as int (-> a0-35 process)))))
(set! (-> arg1 actor-handle) (process->handle (-> a0-35 process)))
(let ((a1-19 (-> a0-35 process node-list data (-> (the-as collide-shape-prim v1-36) transform-index) bone transform))
(s5-1 (new 'stack-no-clear 'matrix)))
@@ -217,8 +209,7 @@
(b! #t cfg-27 :delay (nop!))
(label cfg-17)
(set! (-> this hanging-matrix vector 1 quad) (-> *target* control dynam gravity-normal quad))
(vector-normalize! (vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (the-as vector (-> this world-vertex)))
1.0)
(vector-normalize! (vector-! (-> this hanging-matrix vector 2) (-> this world-vertex 1) (-> this world-vertex 0)) 1.0)
(vector-normalize! (vector-cross! (the-as vector (-> this hanging-matrix))
(-> this hanging-matrix vector 2)
(-> this hanging-matrix vector 1))
@@ -247,12 +238,12 @@
(set! (-> a1-14 ignore-pat) (new 'static 'pat-surface :noentity #x1))
(set! (-> a1-14 solid-only) #t)
(label cfg-21)
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24))
(b! (not (fill-and-probe-using-spheres *collide-cache* a1-14)) cfg-24 :delay (empty-form)))
(set! v0-0 #f)
(b! #t cfg-27 :delay (nop!))
(the-as none 0)
(label cfg-24)
(b! (not (the-as int s5-0)) cfg-26)
(b! (not (the-as int s5-0)) cfg-26 :delay (empty-form))
(let ((v1-40 (-> (the-as collide-shape-prim s5-0) cshape))) (send-event (-> v1-40 process) 'edge-grabbed this)))
(label cfg-26)
(set! v0-0 #t)
@@ -319,7 +310,7 @@
(.lvf vf5 (&-> v1-0 trans quad)))))
(.por v1-1 t1-1 a3-1)
(let ((f0-0 (-> this max-dist-sqrd-to-outward-pt)))
(.ppach v1-2 r0-0 v1-1)
(.ppach v1-2 (the-as uint128 0) v1-1)
(let ((f1-0 (-> this max-dir-cosa-delta)))
(b! (nonzero? (shl (the-as int v1-2) 16)) cfg-4 :delay (.lvf vf6 (&-> this search-dir-vec quad)))
(.mul.x.vf vf10 vf3 vf4)
@@ -419,7 +410,7 @@
(defmethod debug-draw ((this edge-grab-info))
(add-debug-line #t
(bucket-id debug-no-zbuf)
(the-as vector (-> this world-vertex))
(-> this world-vertex 0)
(-> this world-vertex 1)
(new 'static 'rgba :r #xff :a #x60)
#f
@@ -433,7 +424,7 @@
(new 'static 'rgba :r #xff :g #xff :a #x60))
(add-debug-outline-triangle #t
(bucket-id debug-no-zbuf)
(the-as vector (-> this tri-vertex))
(-> this tri-vertex 0)
(-> this world-vertex 4)
(-> this world-vertex 5)
(new 'static 'rgba :r #xff :a #x30))
@@ -502,19 +493,14 @@
(set! s4-0 (-> s4-0 next))))
(format *stdcon* "hold list has ~D item(s)~%" s5-0))
(dotimes (s5-1 (the-as int (-> this num-attempts)))
(add-debug-sphere #t (bucket-id debug-no-zbuf) (the-as vector (-> this attempts s5-1)) 409.6 (new 'static 'rgba :a #x40)))
(add-debug-sphere #t (bucket-id debug-no-zbuf) (-> this attempts s5-1 vector) 409.6 (new 'static 'rgba :a #x40)))
(format *stdcon* "hold list has ~D attempt(s)~%" (-> this num-attempts)))
(defmethod debug-draw-tris ((this collide-edge-work))
(dotimes (s5-0 (the-as int (-> this num-tris)))
(let* ((v1-3 (-> this tris s5-0 ctri))
(t1-0 (copy-and-set-field (-> *pat-mode-info* (-> v1-3 pat mode) color) a 64)))
(add-debug-outline-triangle #t
(bucket-id debug-no-zbuf)
(the-as vector (-> v1-3 vertex))
(-> v1-3 vertex 1)
(-> v1-3 vertex 2)
t1-0)))
(add-debug-outline-triangle #t (bucket-id debug-no-zbuf) (-> v1-3 vertex 0) (-> v1-3 vertex 1) (-> v1-3 vertex 2) t1-0)))
(none))
(let ((v1-1 (new 'static
@@ -541,6 +527,7 @@
:slope-up-traction 1.0
:align-speed 1.0
:flags (surface-flags moving-ground))))
;; og:preserve-this added
(define *rotate-surface* v1-1)
(set! *rotate-surface* v1-1)
(set! (-> v1-1 mult-hook)
@@ -570,6 +557,7 @@
:slope-up-traction 0.9
:align-speed 1.0
:flags (surface-flags no-turn-around always-rotate-toward-transv))))
;; og:preserve-this added
(define *no-walk-surface* v1-2)
(set! *no-walk-surface* v1-2)
(set! (-> v1-2 mult-hook) (the-as (function surface surface surface int none) nothing))
@@ -165,6 +165,7 @@
(defun collide-upload-vu0 ()
"Upload the probe program to VU0."
;; og:preserve-this
(#unless PC_PORT
(let ((gp-0 *vu0-dma-list*))
;; reset the buffer
@@ -236,10 +237,7 @@
;; I guess collision with the ground during the misty ambush was too slow, so they wrote this hack.
(defun distc ((arg0 vector) (arg1 vector))
(let* ((f0-1 (- (-> arg0 x) (-> arg1 x)))
(f0-3 (* f0-1 f0-1))
(f1-2 (- (-> arg0 z) (-> arg1 z))))
(sqrtf (+ f0-3 (* f1-2 f1-2)))))
(sqrtf (+ (square (- (-> arg0 x) (-> arg1 x))) (square (- (-> arg0 z) (-> arg1 z))))))
(defun interpolate ((arg0 float) (arg1 float) (arg2 float) (arg3 float) (arg4 float))
(let ((f0-1 (- arg3 arg1))
@@ -14,7 +14,7 @@
(when (and (logtest? (-> s5-0 collide-with) (-> s4-0 prim-core collide-as))
(logtest? (-> s5-0 prim-core action) (collide-action rider-plat-sticky))
(logtest? (-> s4-0 prim-core action) (collide-action rider-target)))
(let ((f0-4 (- (- (vector-vector-distance (the-as vector (-> s5-0 prim-core)) (the-as vector (-> s4-0 prim-core)))
(let ((f0-4 (- (- (vector-vector-distance (-> s5-0 prim-core world-sphere) (-> s4-0 prim-core world-sphere))
(-> s5-0 prim-core world-sphere w))
(-> s4-0 prim-core world-sphere w))))
(if (< f0-4 122.88) (on-platform-test s5-0 s4-0 arg1 f0-4)))))
@@ -32,7 +32,7 @@
;; check collide kind
(when (and (logtest? (-> s1-0 collide-with) s3-0) (logtest? (-> s1-0 prim-core action) (collide-action rider-plat-sticky)))
;; check dist
(let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> s1-0 prim-core)) (the-as vector (-> arg0 prim-core)))
(let ((f0-2 (- (- (vector-vector-distance (-> s1-0 prim-core world-sphere) (-> arg0 prim-core world-sphere))
(-> s1-0 prim-core world-sphere w))
(-> arg0 prim-core world-sphere w))))
;; dist close enough, check!
@@ -48,7 +48,7 @@
(dotimes (s2-0 (-> (the-as collide-shape-prim-group arg0) num-prims))
(let ((s1-0 (-> (the-as collide-shape-prim-group arg0) prims s2-0)))
(when (and (logtest? s3-0 (-> s1-0 prim-core collide-as)) (logtest? (-> s1-0 prim-core action) (collide-action rider-target)))
(let ((f0-2 (- (- (vector-vector-distance (the-as vector (-> this prim-core)) (the-as vector (-> s1-0 prim-core)))
(let ((f0-2 (- (- (vector-vector-distance (-> this prim-core world-sphere) (-> s1-0 prim-core world-sphere))
(-> this prim-core world-sphere w))
(-> s1-0 prim-core world-sphere w))))
(if (< f0-2 122.88) (on-platform-test this s1-0 arg1 f0-2))))))))
@@ -64,15 +64,11 @@
(set! (-> this mesh-cache-tris) (the-as (inline-array collide-mesh-cache-tri) v1-17))
(set! (-> this mesh-cache-id) (-> s2-1 id))
(populate-cache! s3-1
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
(-> this mesh-cache-tris 0)
(-> this cshape process node-list data (-> this transform-index) bone transform)))
(else (return #f))))))
(let* ((s2-2 (new 'stack-no-clear 'collide-tri-result))
(f0-4 (sphere-on-platform-test s3-1
(the-as collide-mesh-cache-tri (-> this mesh-cache-tris))
s2-2
(the-as vector (-> arg0 prim-core))
(-> arg1 best-dist))))
(f0-4 (sphere-on-platform-test s3-1 (-> this mesh-cache-tris 0) s2-2 (-> arg0 prim-core world-sphere) (-> arg1 best-dist))))
(when (< f0-4 (-> arg1 best-dist))
(set! (-> arg1 best-dist) f0-4)
(set! (-> arg1 best-from-prim) this)
@@ -115,7 +111,7 @@
*collide-player-list*
(let ((s3-0 (-> v1-7 next0)))
(while (!= v1-7 (-> *collide-player-list* alive-list-end))
(let* ((s2-0 (-> (the-as connection v1-7) param1))
(let* ((s2-0 (the-as object (-> (the-as connection v1-7) param1)))
(v1-8 (-> (the-as collide-shape s2-0) root-prim)))
(when (logtest? s4-0 (-> v1-8 prim-core collide-as))
(when (and (logtest? (-> v1-8 prim-core action) (collide-action rider-target))
@@ -142,7 +138,7 @@
*collide-hit-by-player-list*
(let ((s3-1 (-> v1-37 next0)))
(while (!= v1-37 (-> *collide-hit-by-player-list* alive-list-end))
(let* ((s2-1 (-> (the-as connection v1-37) param1))
(let* ((s2-1 (the-as object (-> (the-as connection v1-37) param1)))
(v1-38 (-> (the-as collide-shape s2-1) root-prim)))
(when (logtest? s4-0 (-> v1-38 prim-core collide-as))
(when (and (logtest? (-> v1-38 prim-core action) (collide-action rider-target))
@@ -168,7 +164,7 @@
*collide-usually-hit-by-player-list*
(let ((s3-2 (-> v1-66 next0)))
(while (!= v1-66 (-> *collide-usually-hit-by-player-list* alive-list-end))
(let* ((s2-2 (-> (the-as connection v1-66) param1))
(let* ((s2-2 (the-as object (-> (the-as connection v1-66) param1)))
(v1-67 (-> (the-as collide-shape s2-2) root-prim)))
(when (logtest? s4-0 (-> v1-67 prim-core collide-as))
(when (and (logtest? (-> v1-67 prim-core action) (collide-action rider-target))
@@ -194,7 +190,7 @@
*collide-hit-by-others-list*
(let ((s3-3 (-> v1-94 next0)))
(while (!= v1-94 (-> *collide-hit-by-others-list* alive-list-end))
(let* ((s2-3 (-> (the-as connection v1-94) param1))
(let* ((s2-3 (the-as object (-> (the-as connection v1-94) param1)))
(v1-95 (-> (the-as collide-shape s2-3) root-prim)))
(when (logtest? s4-0 (-> v1-95 prim-core collide-as))
(when (and (logtest? (-> v1-95 prim-core action) (collide-action rider-target))
@@ -240,7 +236,7 @@
(defmethod pull-rider! ((this collide-shape) (arg0 pull-rider-info))
"Move a rider."
(local-vars (at-0 int) (sv-160 (function collide-shape-moving float collide-kind none)))
(local-vars (at-0 int))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf))
@@ -254,11 +250,7 @@
((logtest? (-> this root-prim prim-core action) (collide-action rider-plat))
(let ((s1-0 (-> this root-prim prim-core collide-as)))
(set! (-> this root-prim prim-core collide-as) (collide-kind))
(let ((s0-0 gp-0))
(set! sv-160 (method-of-object s0-0 fill-cache-for-shape!))
(let ((a1-3 (+ 8192.0 (vector-length s3-0)))
(a2-0 (-> gp-0 root-prim collide-with)))
(sv-160 s0-0 a1-3 a2-0)))
(fill-cache-for-shape! gp-0 (+ 8192.0 (vector-length s3-0)) (-> gp-0 root-prim collide-with))
(set! (-> this root-prim prim-core collide-as) s1-0))
(let ((s2-1 (new 'stack-no-clear 'vector)))
(set! (-> s2-1 quad) (-> s3-0 quad))
+2 -2
View File
@@ -83,10 +83,10 @@
(- (* (/ (- (/ arg0 60) arg1) arg2) (- 1.0 arg2)) arg1))
(defun calc-terminal2-vel ((arg0 float) (arg1 float) (arg2 float) (arg3 float))
(let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) (- f0-4 (+ arg1 (* arg2 (* f0-4 f0-4))))))
(let ((f0-4 (sqrtf (/ (- (/ arg0 60) arg1) arg2)))) (- f0-4 (+ arg1 (* arg2 (square f0-4))))))
(defun calc-terminal4-vel ((arg0 float) (arg1 float) (arg2 float))
(let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) (- f0-5 (+ arg1 (* arg2 (* f0-5 f0-5 f0-5 f0-5))))))
(let ((f0-5 (sqrtf (sqrtf (/ (- (/ arg0 60) arg1) arg2))))) (- f0-5 (+ arg1 (* arg2 (* (square f0-5) f0-5 f0-5))))))
(defmethod print ((this surface))
;; seems this format string is wrong.
+77 -110
View File
@@ -47,7 +47,6 @@
(initialize (_type_) _type_)
(initialize-params (_type_ time-frame float) none)))
(defmethod initialize-params ((this collectable) (arg0 time-frame) (arg1 float))
(logclear! (-> this mask) (process-mask crate enemy platform ambient))
(logior! (-> this mask) (process-mask collectable))
@@ -102,7 +101,6 @@
(animate (_type_) none)
(blocked () _type_ :state)))
(defmethod initialize ((this eco-collectable))
(stack-size-set! (-> this main-thread) 192) ;; og:preserve-this hack increased from 128
(logior! (-> this mask) (process-mask actor-pause))
@@ -537,7 +535,6 @@
(deftype eco (eco-collectable) ())
(defmethod animate ((this eco))
(let ((a0-1 (-> this part))
(a1-0 (-> this root root-prim prim-core)))
@@ -576,28 +573,24 @@
(deftype eco-yellow (eco) ())
(defmethod init-from-entity! ((this eco-yellow) (arg0 entity-actor))
(initialize-eco this arg0 (pickup-type eco-yellow) (-> *FACT-bank* eco-single-inc))
(none))
(deftype eco-red (eco) ())
(defmethod init-from-entity! ((this eco-red) (arg0 entity-actor))
(initialize-eco this arg0 (pickup-type eco-red) (-> *FACT-bank* eco-single-inc))
(none))
(deftype eco-blue (eco) ())
(defmethod init-from-entity! ((this eco-blue) (arg0 entity-actor))
(initialize-eco this arg0 (pickup-type eco-blue) (-> *FACT-bank* eco-single-inc))
(none))
(deftype health (eco-collectable) ())
(defmethod animate ((this health))
(let ((a0-1 (-> this part))
(a1-0 (-> this root root-prim prim-core)))
@@ -612,7 +605,6 @@
(deftype eco-pill (eco-collectable) ())
(defmethod animate ((this eco-pill))
(let ((a0-1 (-> this part))
(a1-0 (-> this root root-prim prim-core)))
@@ -669,7 +661,6 @@
(deftype money (eco-collectable) ())
(defmethod run-logic? ((this money))
(or (not (logtest? (-> this mask) (process-mask actor-pause)))
(or (and (nonzero? (-> this draw))
@@ -764,7 +755,7 @@
(set-vector! (-> this draw color-mult) 0.8 0.8 0.8 1.0)
(set-vector! (-> this draw color-emissive) 0.2 0.2 0.2 1.0)
;; og:preserve-this added money starburst
(set! (-> this part) (create-launch-control (-> *part-group-id-table* 64) this))
(set! (-> this part) (create-launch-control group-money-starburst this))
this)
(defmethod init-from-entity! ((this money) (arg0 entity-actor))
@@ -823,7 +814,6 @@
(:states (fuel-cell-clone-anim handle)
(fuel-cell-spline-slider handle float float)))
(defun fuel-cell-pick-anim ((arg0 process-drawable))
(let* ((gp-0 (-> arg0 entity extra trans))
(a0-2 (res-lump-value (-> arg0 entity) 'movie-mask uint128 :time (the-as float -1000000000.0)))
@@ -966,7 +956,6 @@
(send-event *camera* 'teleport-to-other-start-string)))))
:code
(behavior ((arg0 object) (arg1 handle))
(local-vars (sv-96 res-tag))
(sound-play "pu-powercell")
(clear-collide-with-as (-> self root))
(logclear! (-> self mask) (process-mask actor-pause))
@@ -985,8 +974,8 @@
(spool-push *art-control* (-> self victory-anim name) 0 self (the-as float -99.0))
(format #t "WARNING: fuel-cell stall on not cloning.~%")
(suspend))
(set! sv-96 (new 'static 'res-tag))
(let* ((v1-34 (res-lump-data (-> self entity) 'movie-pos (inline-array vector) :tag-ptr (& sv-96) :time (the-as float -1000000000.0)))
(let* ((sv-96 (new 'static 'res-tag))
(v1-34 (res-lump-data (-> self entity) 'movie-pos (inline-array vector) :tag-ptr (& sv-96) :time (the-as float -1000000000.0)))
(gp-1 (if (and v1-34 (< (-> self movie-pos-index) (the-as int (-> sv-96 elt-count))))
(-> v1-34 (-> self movie-pos-index))
(the-as vector #f))))
@@ -1230,7 +1219,6 @@
(deftype buzzer (eco-collectable)
((victory-anim spool-anim)))
(defmethod animate ((this buzzer))
(quaternion-rotate-y! (-> this root quat) (-> this root quat) (* 40049.777 (seconds-per-frame)))
(let ((a0-2 (-> this skel root-channel 0)))
@@ -1397,20 +1385,9 @@
(v1-52 symbol)
(v1-58 symbol)
(v1-64 symbol)
(v1-71 symbol)
(sv-32 fact-info)
(sv-48 int)
(sv-64 process)
(sv-80 process)
(sv-96 process)
(sv-112 process)
(sv-128 process)
(sv-144 process)
(sv-160 process)
(sv-176 process)
(sv-192 (pointer process)))
(set! sv-32 arg5)
(let ((s1-0 (new-stack-vector0))
(v1-71 symbol))
(let ((sv-32 arg5)
(s1-0 (new-stack-vector0))
(t9-0 (method-of-type res-lump get-property-value-float)))
(let ((v1-1 sv-32)) (b! (not v1-1) cfg-3 :likely-delay (set! v1-2 sv-32)))
(set! v1-2 (nonzero? (-> sv-32 process)))
@@ -1425,111 +1402,107 @@
((= arg2 1.0) 409.6)
(else 8192.0)))
(the-as (pointer res-tag) #f)
*res-static-buf*)))
(set! sv-192 (the-as (pointer process) #f))
(set! sv-48 (the int arg2))
(let ((s0-0 (new 'static 'fact-info)))
*res-static-buf*))
(sv-192 (the-as (pointer process) #f)))
(let ((sv-48 (the int arg2))
(s0-0 (new 'static 'fact-info)))
(set! (-> s0-0 options) (fact-options))
(if sv-32 (mem-copy! (&-> s0-0 type) (&-> sv-32 type) 40))
(set! (-> s0-0 pickup-type) arg1)
(set! (-> s0-0 pickup-spawn-amount) 1.0)
(while (> sv-48 0)
(set! sv-48 (+ sv-48 -1))
(+! sv-48 -1)
(when arg3
(set-vector! s1-0 0.0 57001.605 f30-0 1.0)
(vector-rotate-around-y! s1-0 s1-0 (/ (* 65536.0 (the float sv-48)) arg2)))
(let ((v1-25 arg1))
(cond
((= v1-25 (pickup-type eco-yellow))
(set! sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000))
(set! v1-28
(when sv-64
(set! sv-192 (the-as (pointer process) v1-28))
(let ((t9-4 (method-of-type eco-yellow activate)))
(t9-4 (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000)))
(run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-64 ppointer))
v1-28))
(let ((sv-64 (get-process *pickup-dead-pool* eco-yellow #x4000)))
(set! v1-28
(when sv-64
(set! sv-192 (the-as (pointer process) v1-28))
((method-of-type eco-yellow activate) (the-as eco-yellow sv-64) arg4 'eco-yellow (the-as pointer #x70004000))
(run-now-in-process sv-64 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-64 ppointer))
v1-28)))
sv-192)
((= v1-25 (pickup-type eco-red))
(set! sv-80 (get-process *pickup-dead-pool* eco-red #x4000))
(set! v1-34
(when sv-80
(set! sv-192 (the-as (pointer process) v1-34))
(let ((t9-7 (method-of-type eco-red activate))) (t9-7 (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000)))
(run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-80 ppointer))
v1-34))
(let ((sv-80 (get-process *pickup-dead-pool* eco-red #x4000)))
(set! v1-34
(when sv-80
(set! sv-192 (the-as (pointer process) v1-34))
((method-of-type eco-red activate) (the-as eco-red sv-80) arg4 'eco-red (the-as pointer #x70004000))
(run-now-in-process sv-80 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-80 ppointer))
v1-34)))
(level-hint-spawn (text-id misty-eco-red-hint) "sksp0071" (the-as entity #f) *entity-pool* (game-task none)))
((= v1-25 (pickup-type eco-blue))
(set! sv-96 (get-process *pickup-dead-pool* eco-blue #x4000))
(set! v1-40
(when sv-96
(set! sv-192 (the-as (pointer process) v1-40))
(let ((t9-11 (method-of-type eco-blue activate)))
(t9-11 (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000)))
(run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-96 ppointer))
v1-40))
(let ((sv-96 (get-process *pickup-dead-pool* eco-blue #x4000)))
(set! v1-40
(when sv-96
(set! sv-192 (the-as (pointer process) v1-40))
((method-of-type eco-blue activate) (the-as eco-blue sv-96) arg4 'eco-blue (the-as pointer #x70004000))
(run-now-in-process sv-96 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-96 ppointer))
v1-40)))
sv-192)
((= v1-25 (pickup-type eco-green))
(set! sv-112 (get-process *pickup-dead-pool* health #x4000))
(set! v1-46
(when sv-112
(set! sv-192 (the-as (pointer process) v1-46))
(let ((t9-14 (method-of-type health activate))) (t9-14 (the-as health sv-112) arg4 'health (the-as pointer #x70004000)))
(run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-112 ppointer))
v1-46))
(let ((sv-112 (get-process *pickup-dead-pool* health #x4000)))
(set! v1-46
(when sv-112
(set! sv-192 (the-as (pointer process) v1-46))
((method-of-type health activate) (the-as health sv-112) arg4 'health (the-as pointer #x70004000))
(run-now-in-process sv-112 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-112 ppointer))
v1-46)))
sv-192)
((= v1-25 (pickup-type eco-pill))
(set! sv-128 (get-process *pickup-dead-pool* eco-pill #x4000))
(set! v1-52
(when sv-128
(set! sv-192 (the-as (pointer process) v1-52))
(let ((t9-17 (method-of-type eco-pill activate)))
(t9-17 (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000)))
(run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-128 ppointer))
v1-52))
(let ((sv-128 (get-process *pickup-dead-pool* eco-pill #x4000)))
(set! v1-52
(when sv-128
(set! sv-192 (the-as (pointer process) v1-52))
((method-of-type eco-pill activate) (the-as eco-pill sv-128) arg4 'eco-pill (the-as pointer #x70004000))
(run-now-in-process sv-128 initialize-eco-by-other arg0 s1-0 s0-0)
(set! sv-192 (-> sv-128 ppointer))
v1-52)))
sv-192)
((= v1-25 (pickup-type money))
(set! sv-144 (get-process *pickup-dead-pool* money #x4000))
(set! v1-58
(when sv-144
(set! sv-192 (the-as (pointer process) v1-58))
(let ((t9-20 (method-of-type money activate))) (t9-20 (the-as money sv-144) arg4 'money (the-as pointer #x70004000)))
(run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-144 ppointer))
v1-58))
(let ((sv-144 (get-process *pickup-dead-pool* money #x4000)))
(set! v1-58
(when sv-144
(set! sv-192 (the-as (pointer process) v1-58))
((method-of-type money activate) (the-as money sv-144) arg4 'money (the-as pointer #x70004000))
(run-now-in-process sv-144 money-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-144 ppointer))
v1-58)))
sv-192)
((= v1-25 (pickup-type fuel-cell))
(set! (-> s0-0 pickup-spawn-amount) arg2)
(set! sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000))
(set! v1-64
(when sv-160
(set! sv-192 (the-as (pointer process) v1-64))
(let ((t9-23 (method-of-type fuel-cell activate)))
(t9-23 (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000)))
(run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-160 ppointer))
v1-64))
(let ((sv-160 (get-process *pickup-dead-pool* fuel-cell #x4000)))
(set! v1-64
(when sv-160
(set! sv-192 (the-as (pointer process) v1-64))
((method-of-type fuel-cell activate) (the-as fuel-cell sv-160) arg4 'fuel-cell (the-as pointer #x70004000))
(run-now-in-process sv-160 fuel-cell-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-160 ppointer))
v1-64)))
(set! sv-48 0)
sv-48)
((= v1-25 (pickup-type buzzer))
(set! (-> s0-0 pickup-spawn-amount) arg2)
(set! sv-176 (get-process *pickup-dead-pool* buzzer #x4000))
(set! v1-71
(when sv-176
(set! sv-192 (the-as (pointer process) v1-71))
(let ((t9-26 (method-of-type buzzer activate))) (t9-26 (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000)))
(run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-176 ppointer))
v1-71))
(let ((sv-176 (get-process *pickup-dead-pool* buzzer #x4000)))
(set! v1-71
(when sv-176
(set! sv-192 (the-as (pointer process) v1-71))
((method-of-type buzzer activate) (the-as buzzer sv-176) arg4 'buzzer (the-as pointer #x70004000))
(run-now-in-process sv-176 buzzer-init-by-other arg0 s1-0 s0-0 (-> self entity))
(set! sv-192 (-> sv-176 ppointer))
v1-71)))
(set! sv-48 0)
sv-48)
(else (format 0 "ERROR: unknown type of eco ~d~%" arg1) #f)))))))
sv-192)
(else (format 0 "ERROR: unknown type of eco ~d~%" arg1) #f)))))
sv-192)))
(defmethod drop-pickup ((this fact-info) (arg0 symbol) (arg1 process-tree) (arg2 fact-info) (arg3 int))
(let ((s3-0 (-> this pickup-type))
@@ -1576,7 +1549,6 @@
(:states
ecovalve-idle))
(defskelgroup *ecovalve-sg*
ecovalve
ecovalve-geo-jg
@@ -1648,7 +1620,6 @@
(vent-pickup handle)
vent-wait-for-touch))
(defmethod initialize ((this vent) (arg0 entity-actor) (arg1 pickup-type))
(stack-size-set! (-> this main-thread) 128)
(logior! (-> this mask) (process-mask actor-pause))
@@ -1790,28 +1761,24 @@
(deftype ventyellow (vent) ())
(defmethod init-from-entity! ((this ventyellow) (arg0 entity-actor))
(initialize this arg0 (pickup-type eco-yellow))
(none))
(deftype ventred (vent) ())
(defmethod init-from-entity! ((this ventred) (arg0 entity-actor))
(initialize this arg0 (pickup-type eco-red))
(none))
(deftype ventblue (vent) ())
(defmethod init-from-entity! ((this ventblue) (arg0 entity-actor))
(initialize this arg0 (pickup-type eco-blue))
(none))
(deftype ecovent (vent) ())
(defmethod init-from-entity! ((this ecovent) (arg0 entity-actor))
(initialize this arg0 (pickup-type eco-blue))
(none))
@@ -314,8 +314,7 @@
(let ((t9-0 (-> (method-of-type water-anim water-vol-idle) trans))) (if t9-0 (t9-0)))
(let* ((gp-0 (-> self draw ripple))
(f0-1 (the float (logand (current-time) #xffff)))
(f0-3 (cos (* 5.0 f0-1)))
(f30-0 (* f0-3 f0-3)))
(f30-0 (square (cos (* 5.0 f0-1)))))
(let ((s5-0 (-> self draw ripple query)))
(set! (-> self draw ripple send-query) #t)
(set! (-> s5-0 start-vertex) (rand-vu-int-range 0 255))
+10 -12
View File
@@ -406,7 +406,7 @@
(defbehavior command-get-process camera-tracker ((arg0 object) (arg1 process))
(the-as process
(cond
((null? arg0) arg1)
((null? arg0) (empty) arg1)
((type-type? (rtype-of arg0) process) (the-as process arg0))
((= arg0 'target) *target*)
((= arg0 'sidekick) (when *target* (let ((v1-6 (-> *target* sidekick))) (if v1-6 (the-as process (-> v1-6 0 self))))))
@@ -421,8 +421,8 @@
((= arg0 'look-at) (handle->process (-> v1-13 look-at-target)))
((= arg0 'pov) (handle->process (-> v1-13 pov-target)))
((= arg0 'anim) (handle->process (-> v1-13 anim-process)))
(else arg1))))
(else arg1))))
(else (empty) arg1))))
(else (empty) arg1))))
(defun command-get-camera ((arg0 object) (arg1 state))
(cond
@@ -437,7 +437,7 @@
(defun command-get-trans ((arg0 object) (arg1 vector))
(cond
((null? arg0) arg1)
((null? arg0) (empty) arg1)
((= arg0 'null) *null-vector*)
((= arg0 'target) (target-pos 0))
((pair? arg0)
@@ -445,8 +445,8 @@
(v1-4 (command-get-int (car (cdr arg0)) 0)))
(cond
(s4-0 (-> (the-as target s4-0) node-list data v1-4 bone transform vector 3))
(else arg1))))
(else arg1)))
(else (empty) arg1))))
(else (empty) arg1)))
(defbehavior process-grab? camera-tracker ((arg0 process))
(let ((gp-0 (command-get-process arg0 *target*)))
@@ -724,12 +724,11 @@
(define *lev-string* (new 'global 'string 64 (the-as string #f)))
(defmethod init-from-entity! ((this med-res-level) (arg0 entity-actor))
(local-vars (sv-16 res-tag))
(stack-size-set! (-> this main-thread) 128)
"#f"
(let ((s4-0 (the-as (pointer sparticle-launch-group) #f)))
(set! sv-16 (new 'static 'res-tag))
(let* ((s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16)))
(let* ((sv-16 (new 'static 'res-tag))
(s3-0 (res-lump-data arg0 'art-name (pointer symbol) :tag-ptr (& sv-16)))
(s2-0 (-> s3-0 0)))
(cond
((not s3-0))
@@ -781,7 +780,6 @@
(suspend))))
(defmethod init-from-entity! ((this part-spawner) (arg0 entity-actor))
(local-vars (sv-16 res-tag))
(stack-size-set! (-> this main-thread) 128)
(logior! (-> this mask) (process-mask ambient))
(set! (-> this root) (new 'process 'trsqv))
@@ -793,8 +791,8 @@
(set! (-> this sound) (new 'process 'ambient-sound (-> this entity) (-> this root trans)))
(let ((s4-0 (the-as object "#f")))
(let ((s3-0 (the-as (pointer sparticle-launch-group) #f)))
(set! sv-16 (new 'static 'res-tag))
(let* ((s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16)))
(let* ((sv-16 (new 'static 'res-tag))
(s5-1 (res-lump-data arg0 'art-name (pointer (pointer sparticle-launch-group)) :tag-ptr (& sv-16)))
(s2-0 (-> s5-1 0)))
(cond
((part-group-pointer? s2-0) (set! s3-0 (-> s5-1 0)))
+3 -4
View File
@@ -66,7 +66,7 @@
(when *target*
(if *target*
(look-at-enemy! (-> *target* neck)
(the-as vector (-> this collide-info root-prim prim-core))
(-> this collide-info root-prim prim-core world-sphere)
(if (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf2)) 'attacking)
this))
(if (and (nonzero? (-> this neck)) (logtest? (-> this nav-enemy-flags) (nav-enemy-flags navenmf14)))
@@ -1198,7 +1198,6 @@ nav-enemy-default-event-handler
(countdown (v1-9 (-> gp-0 num-spheres))
(let* ((a0-10 (-> gp-0 sphere v1-9))
(f2-2 (- (-> a0-10 x) f0-1))
(f3-1 (- (-> a0-10 z) f1-2))
(f4-0 (-> a0-10 w)))
(if (>= (* f4-0 f4-0) (+ (* f2-2 f2-2) (* f3-1 f3-1))) (return #t)))))))
(f3-1 (- (-> a0-10 z) f1-2)))
(if (>= (square (-> a0-10 w)) (+ (square f2-2) (square f3-1))) (return #t)))))))
#f)
+3 -12
View File
@@ -55,18 +55,9 @@
(let* ((f0-4 arg0)
(f1-1 12.0)
(f0-5 (* f0-4 (/ 1.0 f1-1))))
(let* ((f1-4 arg2)
(f1-6 (* f1-4 f1-4))
(f2-1 arg3))
(set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ f1-6 (* f2-1 f2-1)))))
(let* ((f1-9 arg1)
(f1-11 (* f1-9 f1-9))
(f2-4 arg3))
(set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ f1-11 (* f2-4 f2-4)))))
(let* ((f1-14 arg1)
(f1-16 (* f1-14 f1-14))
(f2-7 arg2))
(set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ f1-16 (* f2-7 f2-7))))))
(set! (-> this inertial-tensor vector 0 x) (* f0-5 (+ (square arg2) (square arg3))))
(set! (-> this inertial-tensor vector 1 y) (* f0-5 (+ (square arg1) (square arg3))))
(set! (-> this inertial-tensor vector 2 z) (* f0-5 (+ (square arg1) (square arg2)))))
(let ((f0-7 (-> this inertial-tensor vector 0 x))) (set! (-> this inv-inertial-tensor vector 0 x) (/ 1.0 f0-7)))
(let ((f0-10 (-> this inertial-tensor vector 1 y))) (set! (-> this inv-inertial-tensor vector 1 y) (/ 1.0 f0-10)))
(let ((f0-13 (-> this inertial-tensor vector 2 z))) (set! (-> this inv-inertial-tensor vector 2 z) (/ 1.0 f0-13)))
+51 -54
View File
@@ -4,6 +4,55 @@
(require "engine/common-obs/process-drawable.gc")
(require "engine/gfx/foreground/ripple.gc")
(require "engine/common-obs/water-h.gc")
(defenum water-look
(water-anim-sunken-big-room 0)
(water-anim-sunken-first-room-from-entrance 1)
(water-anim-sunken-qbert-room 2)
(water-anim-sunken-first-right-branch 3)
(water-anim-sunken-circular-with-bullys 4)
(water-anim-sunken-hall-with-one-whirlpool 5)
(water-anim-sunken-hall-with-three-whirlpools 6)
(water-anim-sunken-start-of-helix-slide 7)
(water-anim-sunken-room-above-exit-chamber 8)
(water-anim-sunken-hall-before-big-room 9)
(water-anim-sunken-dark-eco-qbert 10)
(water-anim-sunken-short-piece 11)
(water-anim-sunken-big-room-upper-water 12)
(water-anim-sunken-dark-eco-platform-room 13)
(water-anim-maincave-water-with-crystal 14)
(water-anim-maincave-center-pool 15)
(water-anim-maincave-lower-right-pool 16)
(water-anim-maincave-mid-right-pool 17)
(water-anim-maincave-lower-left-pool 18)
(water-anim-maincave-mid-left-pool 19)
(water-anim-robocave-main-pool 20)
(water-anim-misty-mud-by-arena 21)
(water-anim-misty-mud-above-skeleton 22)
(water-anim-misty-mud-behind-skeleton 23)
(water-anim-misty-mud-above-skull-back 24)
(water-anim-misty-mud-above-skull-front 25)
(water-anim-misty-mud-other-near-skull 26)
(water-anim-misty-mud-near-skull 27)
(water-anim-misty-mud-under-spine 28)
(water-anim-misty-mud-by-dock 29)
(water-anim-misty-mud-island-near-dock 30)
(water-anim-misty-mud-lonely-island 31)
(water-anim-misty-dark-eco-pool 32)
(water-anim-ogre-lava 33)
(water-anim-jungle-river 34)
(water-anim-village3-lava 35)
(water-anim-training-lake 36)
(water-anim-darkcave-water-with-crystal 37)
(water-anim-rolling-water-back 38)
(water-anim-rolling-water-front 39)
(water-anim-sunken-dark-eco-helix-room 40)
(water-anim-finalboss-dark-eco-pool 41)
(water-anim-lavatube-energy-lava 42)
(water-anim-village1-rice-paddy 43)
(water-anim-village1-fountain 44)
(water-anim-village1-rice-paddy-mid 45)
(water-anim-village1-rice-paddy-top 46)
(water-anim-village2-bucket 47))
;; DECOMP BEGINS
@@ -353,57 +402,6 @@
(anim int32)
(ambient-sound-spec sound-spec)))
;; og:preserve-this added
(defenum water-look
(water-anim-sunken-big-room 0)
(water-anim-sunken-first-room-from-entrance 1)
(water-anim-sunken-qbert-room 2)
(water-anim-sunken-first-right-branch 3)
(water-anim-sunken-circular-with-bullys 4)
(water-anim-sunken-hall-with-one-whirlpool 5)
(water-anim-sunken-hall-with-three-whirlpools 6)
(water-anim-sunken-start-of-helix-slide 7)
(water-anim-sunken-room-above-exit-chamber 8)
(water-anim-sunken-hall-before-big-room 9)
(water-anim-sunken-dark-eco-qbert 10)
(water-anim-sunken-short-piece 11)
(water-anim-sunken-big-room-upper-water 12)
(water-anim-sunken-dark-eco-platform-room 13)
(water-anim-maincave-water-with-crystal 14)
(water-anim-maincave-center-pool 15)
(water-anim-maincave-lower-right-pool 16)
(water-anim-maincave-mid-right-pool 17)
(water-anim-maincave-lower-left-pool 18)
(water-anim-maincave-mid-left-pool 19)
(water-anim-robocave-main-pool 20)
(water-anim-misty-mud-by-arena 21)
(water-anim-misty-mud-above-skeleton 22)
(water-anim-misty-mud-behind-skeleton 23)
(water-anim-misty-mud-above-skull-back 24)
(water-anim-misty-mud-above-skull-front 25)
(water-anim-misty-mud-other-near-skull 26)
(water-anim-misty-mud-near-skull 27)
(water-anim-misty-mud-under-spine 28)
(water-anim-misty-mud-by-dock 29)
(water-anim-misty-mud-island-near-dock 30)
(water-anim-misty-mud-lonely-island 31)
(water-anim-misty-dark-eco-pool 32)
(water-anim-ogre-lava 33)
(water-anim-jungle-river 34)
(water-anim-village3-lava 35)
(water-anim-training-lake 36)
(water-anim-darkcave-water-with-crystal 37)
(water-anim-rolling-water-back 38)
(water-anim-rolling-water-front 39)
(water-anim-sunken-dark-eco-helix-room 40)
(water-anim-finalboss-dark-eco-pool 41)
(water-anim-lavatube-energy-lava 42)
(water-anim-village1-rice-paddy 43)
(water-anim-village1-fountain 44)
(water-anim-village1-rice-paddy-mid 45)
(water-anim-village1-rice-paddy-top 46)
(water-anim-village2-bucket 47))
(define *water-anim-look*
(new 'static
'boxed-array
@@ -604,11 +602,10 @@
(none))
(defmethod water-vol-method-25 ((this water-anim))
(local-vars (sv-16 res-tag))
(set! (-> this play-ambient-sound?) #t)
(set! (-> this look) (res-lump-value (-> this entity) 'look int :default (the-as uint128 -1)))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-3 (res-lump-data (-> this entity) 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(when v1-3
(+! (-> this root trans x) (-> v1-3 0))
(+! (-> this root trans y) (-> v1-3 1))
+10 -11
View File
@@ -996,7 +996,6 @@
(none))
(defmethod init! ((this water-vol))
(local-vars (sv-16 res-tag))
(set! (-> this attack-event)
(the-as symbol
((method-of-type res-lump get-property-struct)
@@ -1013,16 +1012,16 @@
(logior! (-> this vol flags) 3)
(set! (-> this bottom-height) 32768.0)
(set! (-> this target) (the-as handle #f))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-8 (the-as (pointer float)
((method-of-type res-lump get-property-data)
(-> this entity)
'water-height
'exact
-1000000000.0
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-8 (the-as (pointer float)
((method-of-type res-lump get-property-data)
(-> this entity)
'water-height
'exact
-1000000000.0
(the-as pointer #f)
(& sv-16)
*res-static-buf*))))
(when v1-8
(set! (-> this water-height) (-> v1-8 0))
(set! (-> this wade-height) (-> v1-8 1))
+49 -62
View File
@@ -548,12 +548,7 @@
(let ((s2-2 draw-string-adv)) (format (clear *temp-string*) "~Smax" arg0) (s2-2 *temp-string* s3-0 arg3)))
(else
(let ((s0-0 draw-string-adv))
(set! sv-16 format)
(let ((a0-11 (clear *temp-string*))
(a1-5 "~S~3,,0f")
(a2-5 arg0)
(a3-1 (+ arg1 arg2)))
(sv-16 a0-11 a1-5 a2-5 a3-1))
(format (clear *temp-string*) "~S~3,,0f" arg0 (+ arg1 arg2))
(s0-0 *temp-string* s3-0 arg3))))
(let ((a3-2 (-> s3-0 base)))
(let ((v1-6 (the-as object (-> s3-0 base))))
@@ -928,9 +923,6 @@
(none))
(defun anim-test-edit-sequence-list-handler ((arg0 int) (arg1 list-control))
(local-vars
(sv-192 (function string dma-buffer int int font-color font-flags float))
(sv-208 (function _varargs_ object)))
(let ((gp-0 (-> arg1 the-node))
(s4-0 (the-as object (-> arg1 list-owner)))
(s2-0 (and (logtest? (-> *anim-tester* 0 flags) (anim-tester-flags fanimt3)) (zero? (-> *anim-tester* 0 item-field)))))
@@ -968,21 +960,19 @@
(the-as (pointer dma-tag) a3-4))))))
(let* ((s0-1 (-> *display* frames (-> *display* on-screen) frame debug-buf))
(s1-1 (-> s0-1 base)))
(set! sv-192 draw-string-xy)
(set! sv-208 format)
(let ((a0-18 (clear *temp-string*))
(a1-7 "~S~S~-27S")
(a2-11 (if (= (-> arg1 the-index) (-> arg1 highlight-index)) ">" " "))
(a3-6 (if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) "*" " "))
(t0-2 (-> (the-as anim-test-seq-item gp-0) privname)))
(sv-208 a0-18 a1-7 a2-11 a3-6 t0-2))
(let ((a0-19 *temp-string*)
(a1-8 s0-1)
(a2-12 (-> arg1 xpos))
(a3-7 (-> arg1 ypos))
(t0-4 (if (= (-> arg1 the-index) (-> arg1 current-index)) 15 12))
(t1-2 3))
(sv-192 a0-19 a1-8 a2-12 a3-7 (the-as font-color t0-4) (the-as font-flags t1-2)))
(let ((sv-192 draw-string-xy))
(let ((sv-208 format))
(sv-208 (clear *temp-string*)
"~S~S~-27S"
(if (= (-> arg1 the-index) (-> arg1 highlight-index)) ">" " ")
(if (= (-> arg1 the-index) (-> (the-as anim-test-sequence s4-0) playing-item)) "*" " ")
(-> (the-as anim-test-seq-item gp-0) privname)))
(sv-192 *temp-string*
s0-1
(-> arg1 xpos)
(-> arg1 ypos)
(if (= (-> arg1 the-index) (-> arg1 current-index)) (font-color menu-flag-on) (font-color menu))
(font-flags shadow kerning)))
(let ((a3-8 (-> s0-1 base)))
(let ((v1-44 (the-as object (-> s0-1 base))))
(set! (-> (the-as dma-packet v1-44) dma) (new 'static 'dma-tag :id (dma-tag-id next)))
@@ -997,11 +987,9 @@
(let* ((s2-2 (-> *display* frames (-> *display* on-screen) frame debug-buf))
(s4-1 (the-as anim-test-sequence (-> s2-2 base))))
(when (not (logtest? (-> (the-as anim-test-seq-item gp-0) flags) 1))
(let ((v1-57 s3-0)
(a1-13 (+ (-> arg1 xpos) (* (-> *ANIM_TESTER-bank* EDIT_STATS_X) (-> *DISP_LIST-bank* CHAR_WIDTH))))
(a0-29 (-> arg1 ypos)))
(set! (-> v1-57 origin x) (the float a1-13))
(set! (-> v1-57 origin y) (the float a0-29)))
(set-origin! s3-0
(+ (-> arg1 xpos) (* (-> *ANIM_TESTER-bank* EDIT_STATS_X) (-> *DISP_LIST-bank* CHAR_WIDTH)))
(-> arg1 ypos))
(cond
((and (< (-> (the-as anim-test-seq-item gp-0) speed) 0) (< -100 (-> (the-as anim-test-seq-item gp-0) speed)))
(let ((s1-2 draw-string-adv))
@@ -1573,7 +1561,6 @@
#f)
(defun anim-tester-add-newobj ((arg0 anim-tester) (arg1 string) (arg2 art-group))
(local-vars (sv-96 art-element) (sv-112 art-element) (sv-128 anim-test-obj))
(let ((s2-0 (the-as anim-test-obj #f))
(s5-0 (the-as anim-test-obj #f)))
(let ((s1-0 (the-as art-element #f))
@@ -1581,18 +1568,18 @@
(dotimes (s3-0 (-> arg2 length))
(cond
((and (= (-> arg2 data s3-0 type) merc-ctrl) (not s2-0))
(set! sv-96 (-> arg2 data s3-0))
(set! s0-0 (and s2-0 s0-0))
(if s0-0 (anim-test-obj-remove-invalid s2-0))
(anim-tester-load-object-seqs arg0 (-> sv-96 name))
(set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name))))
(set! s0-0 (if s2-0 #t #f))
(cond
((the-as symbol s0-0))
(else (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) (glst-add-tail (-> arg0 obj-list) s2-0)))
(anim-test-obj-init s2-0 (the-as list-control arg0))
(set! (-> s2-0 obj-art-group) arg2)
(set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96))
(let ((sv-96 (-> arg2 data s3-0)))
(set! s0-0 (and s2-0 s0-0))
(if s0-0 (anim-test-obj-remove-invalid s2-0))
(anim-tester-load-object-seqs arg0 (-> sv-96 name))
(set! s2-0 (the-as anim-test-obj (glst-find-node-by-name (-> arg0 obj-list) (-> sv-96 name))))
(set! s0-0 (if s2-0 #t #f))
(cond
((the-as symbol s0-0))
(else (set! s2-0 (new 'global 'anim-test-obj 1 (-> sv-96 name) arg2)) (glst-add-tail (-> arg0 obj-list) s2-0)))
(anim-test-obj-init s2-0 (the-as list-control arg0))
(set! (-> s2-0 obj-art-group) arg2)
(set! (-> s2-0 mesh-geo) (the-as merc-ctrl sv-96)))
(set! (-> s2-0 joint-geo) (the-as art-joint-geo s1-0))
(if (not s5-0) (set! s5-0 s2-0)))
((= (-> arg2 data s3-0 type) art-joint-geo)
@@ -1600,26 +1587,26 @@
(if (not s1-0) (set! s1-0 (-> arg2 data s3-0))))
((= (-> arg2 data s3-0 type) art-joint-anim)
(when s2-0
(set! sv-112 (-> arg2 data s3-0))
(set! sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name))))
(when (not sv-128)
(set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name))))
(glst-add-tail (-> s2-0 seq-list) sv-128)
(anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0)
(let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name))))
(glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11)))
(set! (-> sv-128 list-con user-info) (the-as int s2-0))
(set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2))
(let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-48 tailpred) v1-48))
(let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list)))
"return the start of the list"
(let ((v1-52 (-> v1-51 head)))
(set! (-> (the-as anim-test-seq-item v1-52) num-frames) (the float (-> (the-as art-joint-anim sv-112) data 0 length)))
(set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base))
(set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128))))
sv-128))))
(let* ((sv-112 (-> arg2 data s3-0))
(sv-128 (the-as anim-test-obj (glst-find-node-by-name (-> s2-0 seq-list) (-> sv-112 name)))))
(when (not sv-128)
(set! sv-128 (the-as anim-test-obj (new 'debug 'anim-test-sequence 1 (-> sv-112 name))))
(glst-add-tail (-> s2-0 seq-list) sv-128)
(anim-test-sequence-init (the-as anim-test-sequence sv-128) s2-0)
(let ((a1-11 (new 'debug 'anim-test-seq-item 1 (-> sv-112 name))))
(glst-add-tail (the-as glst-list (&-> sv-128 obj-art-group)) a1-11)))
(set! (-> sv-128 list-con user-info) (the-as int s2-0))
(set! (-> sv-128 flags) (logior (-> (the-as anim-test-sequence sv-128) flags) 2))
(let ((v1-48 (-> (the-as anim-test-sequence sv-128) item-list)))
"is the list empty, #t = empty"
(when (not (= (-> v1-48 tailpred) v1-48))
(let ((v1-51 (-> (the-as anim-test-sequence sv-128) item-list)))
"return the start of the list"
(let ((v1-52 (-> v1-51 head)))
(set! (-> (the-as anim-test-seq-item v1-52) num-frames) (the float (-> (the-as art-joint-anim sv-112) data 0 length)))
(set! (-> (the-as anim-test-seq-item v1-52) artist-base) (-> (the-as art-joint-anim sv-112) artist-base))
(set! (-> (the-as anim-test-seq-item v1-52) parent) (the-as anim-test-sequence sv-128))))
sv-128)))))
(else))))
(if s2-0 (anim-test-obj-remove-invalid s2-0))
(when s5-0
+14 -14
View File
@@ -16,7 +16,6 @@
((point vector 300 :inline)))
(defun make-debug-sphere-table ((arg0 debug-sphere-table))
(local-vars (sv-80 int))
(let ((s5-0 (new-stack-vector0))
(f30-0 1.0)
(s4-0 0))
@@ -30,19 +29,20 @@
(set! (-> s2-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float s3-0))) f30-0)))
(set! (-> s1-0 y) (-> s2-0 y))
(set! (-> s0-0 y) (+ (-> s5-0 y) (* (cos (* (degrees (/ 180 DEBUG_SPHERE_SEC_H)) (the float (+ s3-0 1)))) f30-0)))
(set! sv-80 0)
(while (< sv-80 DEBUG_SPHERE_SEC_W)
(set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
(set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
(set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
(set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
(set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
(set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
(set! (-> arg0 point s4-0 quad) (-> s2-0 quad))
(set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad))
(set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad))
(+! s4-0 3)
(set! sv-80 (+ sv-80 1))))))
(let ((sv-80 0))
(while (< sv-80 DEBUG_SPHERE_SEC_W)
(set! (-> s2-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
(set! (-> s2-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f28-0)))
(set! (-> s1-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
(set! (-> s1-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float (+ sv-80 1)))) f28-0)))
(set! (-> s0-0 x) (+ (-> s5-0 x) (* (cos (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
(set! (-> s0-0 z) (+ (-> s5-0 z) (* (sin (* (degrees (/ 360 DEBUG_SPHERE_SEC_W)) (the float sv-80))) f26-0)))
(set! (-> arg0 point s4-0 quad) (-> s2-0 quad))
(set! (-> arg0 point (+ s4-0 1) quad) (-> s1-0 quad))
(set! (-> arg0 point (+ s4-0 2) quad) (-> s0-0 quad))
(+! s4-0 3)
(1+! sv-80))))))
0
(none))
(define *debug-sphere-table* (new 'static 'debug-sphere-table))
+89 -63
View File
@@ -463,17 +463,27 @@
(if (not arg0) (return #f))
(let ((f30-0 0.0)
(s1-0 (new-stack-vector0))
(s0-0 (new-stack-vector0)))
(dotimes (sv-48 12)
(set-vector! s1-0 (* arg3 (cos f30-0)) 0.0 (* arg3 (sin f30-0)) 1.0)
(s0-0 (new-stack-vector0))
(sv-48 0))
(while (< sv-48 12)
(let ((sv-64 s1-0))
(set! (-> sv-64 x) (* arg3 (cos f30-0)))
(set! (-> sv-64 y) 0.0)
(set! (-> sv-64 z) (* arg3 (sin f30-0)))
(set! (-> sv-64 w) 1.0))
(set! f30-0 (+ 5461.3335 f30-0))
(set-vector! s0-0 (* arg3 (cos f30-0)) 0.0 (* arg3 (sin f30-0)) 1.0)
(let ((sv-80 s0-0))
(set! (-> sv-80 x) (* arg3 (cos f30-0)))
(set! (-> sv-80 y) 0.0)
(set! (-> sv-80 z) (* arg3 (sin f30-0)))
(set! (-> sv-80 w) 1.0))
(when arg5
(vector-matrix*! s1-0 s1-0 arg5)
(vector-matrix*! s0-0 s0-0 arg5))
(vector+! s1-0 s1-0 arg2)
(vector+! s0-0 s0-0 arg2)
(add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1))))
(add-debug-line #t arg1 s1-0 s0-0 arg4 #f (the-as rgba -1))
(+! sv-48 1)))
#f)
(defun-debug add-debug-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 vector) (arg4 meters) (arg5 rgba))
@@ -497,6 +507,7 @@
(add-debug-vector arg0 arg1 arg3 (-> arg2 vector 2) (meters 2) (new 'static 'rgba :b #xff :a #x80))
arg2)
;; WARN: Stack slot load at 32 mismatch: defined as size 4, got size 16
(defun-debug add-debug-yrot-vector ((arg0 symbol) (arg1 bucket-id) (arg2 vector) (arg3 float) (arg4 float) (arg5 rgba))
(let ((sv-32 arg3)
(s0-0 arg4)
@@ -512,35 +523,48 @@
"note: you may pass #f for orientation"
(if (not arg0) (return #f))
(let ((f30-0 arg3)
(sv-48 (new-stack-vector0))
(sv-64 (new-stack-vector0)))
(dotimes (sv-80 12)
(set-vector! sv-48 (* arg5 (sin f30-0)) 0.0 (* arg5 (cos f30-0)) 1.0)
(+! f30-0 (the float (/ (the int (- arg4 arg3)) 12)))
(set-vector! sv-64 (* arg5 (sin f30-0)) 0.0 (* arg5 (cos f30-0)) 1.0)
(when arg7
(vector-matrix*! sv-48 sv-48 arg7)
(vector-matrix*! sv-64 sv-64 arg7))
(vector+! sv-48 sv-48 arg2)
(vector+! sv-64 sv-64 arg2)
(add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1))
(cond
((zero? sv-80) (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)))
((= sv-80 11) (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1))))))
(sv-48 (new 'stack-no-clear 'vector)))
(set! (-> sv-48 quad) (the-as uint128 0))
(let ((sv-64 (new 'stack-no-clear 'vector)))
(set! (-> sv-64 quad) (the-as uint128 0))
(let ((sv-80 0))
(while (< sv-80 12)
(let ((sv-96 sv-48))
(set! (-> sv-96 x) (* arg5 (sin f30-0)))
(set! (-> sv-96 y) 0.0)
(set! (-> sv-96 z) (* arg5 (cos f30-0)))
(set! (-> sv-96 w) 1.0))
(+! f30-0 (the float (/ (the int (- arg4 arg3)) 12)))
(let ((sv-112 sv-64))
(set! (-> sv-112 x) (* arg5 (sin f30-0)))
(set! (-> sv-112 y) 0.0)
(set! (-> sv-112 z) (* arg5 (cos f30-0)))
(set! (-> sv-112 w) 1.0))
(when arg7
(vector-matrix*! sv-48 sv-48 arg7)
(vector-matrix*! sv-64 sv-64 arg7))
(vector+! sv-48 sv-48 arg2)
(vector+! sv-64 sv-64 arg2)
(add-debug-line #t arg1 sv-48 sv-64 arg6 #f (the-as rgba -1))
(cond
((zero? sv-80) (add-debug-line #t arg1 sv-48 arg2 arg6 #f (the-as rgba -1)))
((= sv-80 11) (add-debug-line #t arg1 sv-64 arg2 arg6 #f (the-as rgba -1))))
(+! sv-80 1)))))
#f)
(defun-debug add-debug-curve ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array vector)) (arg3 int) (arg4 (pointer float)) (arg5 int) (arg6 rgba))
(if (not arg0) (return #f))
(let ((s0-0 (new-stack-vector0))
(sv-48 (new-stack-vector0))
(sv-64 (* arg3 4)))
(curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5)
(let ((sv-80 0))
(while (< sv-80 sv-64)
(set! (-> s0-0 quad) (-> sv-48 quad))
(curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5)
(add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1))
(set! sv-80 (+ sv-80 1)))))
(sv-48 (new 'stack-no-clear 'vector)))
(set! (-> sv-48 quad) (the-as uint128 0))
(let ((sv-64 (* arg3 4)))
(curve-evaluate! sv-48 (-> arg4 0) arg2 arg3 arg4 arg5)
(let ((sv-80 0))
(while (< sv-80 sv-64)
(set! (-> s0-0 quad) (-> sv-48 quad))
(curve-evaluate! sv-48 (/ (the float (+ sv-80 1)) (the float sv-64)) arg2 arg3 arg4 arg5)
(add-debug-line #t arg1 s0-0 sv-48 arg6 #f (the-as rgba -1))
(+! sv-80 1)))))
#f)
(defun-debug add-debug-curve2 ((arg0 symbol) (arg1 bucket-id) (arg2 curve) (arg3 rgba) (arg4 symbol))
@@ -554,19 +578,32 @@
(set! (-> sv-96 quad) (the-as uint128 0))
(set! (-> sv-96 quad) (-> arg2 s0-0 quad))
(if (!= arg5 0.0) (set! (-> sv-96 y) arg5))
(add-debug-text-3d #t arg1 (string-format "~d" s0-0) sv-96 (font-color white) (the vector2h #f))
(add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) (static-rgba #xff #xff #xff #x80) arg4)))))
(let ((sv-32 add-debug-text-3d)
(sv-48 #t)
(sv-64 arg1))
(format (clear *temp-string*) "~d" s0-0)
(sv-32 sv-48 sv-64 *temp-string* sv-96 (font-color white) (the-as vector2h #f)))
(add-debug-x #t arg1 sv-96 (if (= s0-0 arg6) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80) arg4)))))
#f)
(defun-debug debug-percent-bar ((arg0 symbol) (arg1 bucket-id) (arg2 int) (arg3 int) (arg4 float) (arg5 rgba))
(if (not arg0) (return #f))
(with-dma-buffer-add-bucket ((s0-0 (-> (current-frame) debug-buf)) arg1)
(let* ((s0-0 (-> *display* frames (-> *display* on-screen) frame debug-buf))
(s5-0 (-> s0-0 base)))
(draw-sprite2d-xy s0-0 arg2 arg3 255 14 (new 'static 'rgba :a #x40))
(draw-sprite2d-xy s0-0 arg2 (+ arg3 2) (the int (* 255.0 arg4)) 10 arg5))
(draw-sprite2d-xy s0-0 arg2 (+ arg3 2) (the int (* 255.0 arg4)) 10 arg5)
(let ((a3-3 (-> s0-0 base)))
(let ((v1-5 (the-as dma-packet (-> s0-0 base))))
(set! (-> v1-5 dma) (new 'static 'dma-tag :id (dma-tag-id next)))
(set! (-> v1-5 vif0) (new 'static 'vif-tag))
(set! (-> v1-5 vif1) (new 'static 'vif-tag))
(set! (-> s0-0 base) (&+ (the-as pointer v1-5) 16)))
(dma-bucket-insert-tag (-> *display* frames (-> *display* on-screen) frame bucket-group)
arg1
s5-0
(the-as (pointer dma-tag) a3-3))))
#f)
;; this function is broken and unused
;; TODO fix it (expand array)
(defun-debug debug-pad-display ((arg0 cpad-info))
(let ((gp-0
;; og:preserve-this
@@ -623,24 +660,14 @@
(defun-debug add-debug-light ((arg0 symbol) (arg1 bucket-id) (arg2 light) (arg3 vector) (arg4 string))
(if (not arg0) (return #f))
(when (!= (-> arg2 levels x) 0.0)
(add-debug-vector arg0 arg1 arg3 (-> arg2 direction) (meters 3) (static-rgba #xff #xff #xff #x80))
(let ((light-vec-end (vector+*! (new-stack-vector0) arg3 (-> arg2 direction) (* (meters 3) (-> arg2 levels x))))
;; the original code here uses w for alpha but that looks terrible
(light-rgba (new 'static
'rgba
:r
(the int (* 128.0 (-> arg2 color x)))
:g
(the int (* 128.0 (-> arg2 color y)))
:b
(the int (* 128.0 (-> arg2 color z)))
:a 128)))
(add-debug-text-sphere arg0
arg1
light-vec-end
(* (meters 0.5) (-> arg2 levels x))
(string-format "~S ~,,2f" arg4 (-> arg2 levels x))
light-rgba)))
(add-debug-vector arg0 arg1 arg3 (-> arg2 direction) (meters 3) (new 'static 'rgba :r #xff :g #xff :b #xff :a #x80))
(let ((s2-1 (vector+*! (new-stack-vector0) arg3 (-> arg2 direction) (* 12288.0 (-> arg2 levels x))))
(s1-0 (logior (logior (logior (shr (shl (the int (* 128.0 (-> arg2 color w))) 56) 32) (shr (shl (the int (* 128.0 (-> arg2 color z))) 56) 40))
(shr (shl (the int (* 128.0 (-> arg2 color y))) 56) 48))
(shr (shl (the int (* 128.0 (-> arg2 color x))) 56) 56))))
(format (clear *temp-string*) "~S ~,,2f" arg4 (-> arg2 levels x))
(let ((t0-2 *temp-string*))
(add-debug-text-sphere arg0 arg1 s2-1 (* 2048.0 (-> arg2 levels x)) t0-2 (the-as rgba s1-0)))))
#f)
(defun-debug add-debug-lights ((arg0 symbol) (arg1 bucket-id) (arg2 (inline-array light)) (arg3 vector))
@@ -651,15 +678,13 @@
(add-debug-light arg0 arg1 (-> arg2 3) arg3 "ambi")
#f)
(defun-extern drawable-frag-count drawable int)
(defun-debug drawable-frag-count ((arg0 drawable))
(defun-debug-recursive drawable-frag-count int ((arg0 drawable))
(let ((gp-0 0))
(cond
((not arg0))
((type-type? (-> arg0 type) drawable-group)
(dotimes (s4-0 (-> (the drawable-group arg0) length))
(+! gp-0 (drawable-frag-count (-> (the drawable-group arg0) data s4-0)))))
(dotimes (s4-0 (-> (the-as drawable-group arg0) length))
(+! gp-0 (drawable-frag-count (-> (the-as drawable-group arg0) data s4-0)))))
(else (+! gp-0 1)))
gp-0))
@@ -677,17 +702,18 @@
(defun-debug history-init ((arg0 pos-history) (arg1 int))
(set! (-> arg0 num-points) arg1)
(set! (-> arg0 points) (the (inline-array vector) #f))
(set! (-> arg0 points) (the-as (inline-array vector) #f))
arg0)
(defun-debug history-draw-and-update ((arg0 pos-history) (arg1 int) (arg2 vector))
(if (and arg1 (not (-> arg0 points)))
(set! (-> arg0 points) (the (inline-array vector) (malloc 'debug (* (-> arg0 num-points) 16)))))
(set! (-> arg0 points) (the-as (inline-array vector) (malloc 'debug (* (-> arg0 num-points) 16)))))
(when (-> arg0 points)
(set! (-> (-> arg0 points) (-> arg0 h-first) quad) (-> arg2 quad))
(set! (-> arg0 h-first) (+ (-> arg0 h-first) 1))
(set! (-> arg0 points (-> arg0 h-first) quad) (-> arg2 quad))
(+! (-> arg0 h-first) 1)
(when (>= (-> arg0 h-first) (-> arg0 num-points))
(set! (-> arg0 h-first) 0)))
(set! (-> arg0 h-first) 0)
0))
(when arg1
(dotimes (s5-1 (1- (-> arg0 num-points)))
(if (!= (+ s5-1 1) (-> arg0 h-first))
+8 -8
View File
@@ -24,7 +24,7 @@
(format #t "-------------------------------------------------------------~%")
this)
(defmethod mem-usage ((this object) (arg0 memory-usage-block) (arg1 int))
(defmethod mem-usage ((this object) (usage memory-usage-block) (flags int))
"Most general mem-usage message. Just prints a warning, in case you expect this to do something."
(if this (format #t "WARNING: mem-usage called on object, probably not what was wanted for ~A~%" this))
this)
@@ -55,20 +55,20 @@
(set! (-> this mem-usage) (calculate-total (-> this mem-usage-block))))
(-> this mem-usage-block))
(defmethod mem-usage ((this process-tree) (arg0 memory-usage-block) (arg1 int))
(defmethod mem-usage ((this process-tree) (usage memory-usage-block) (flags int))
"Compute the memory usage of a process tree."
(let ((v1-0 87))
(let* ((a0-1 *dead-pool-list*)
(a3-0 (car a0-1)))
(while (not (null? a0-1))
(set! (-> arg0 data v1-0 name) (symbol->string (the-as symbol a3-0)))
(set! (-> usage data v1-0 name) (symbol->string (the-as symbol a3-0)))
(+! v1-0 1)
(set! a0-1 (cdr a0-1))
(set! a3-0 (car a0-1))))
(set! (-> arg0 length) (max (-> arg0 length) v1-0)))
(set! (-> arg0 data 93 name) "*debug-dead-pool*")
(set! *temp-mem-usage* arg0)
(when (logtest? arg1 32)
(set! (-> usage length) (max (-> usage length) v1-0)))
(set! (-> usage data 93 name) "*debug-dead-pool*")
(set! *temp-mem-usage* usage)
(when (logtest? flags 32)
(let* ((s5-0 87)
(s4-0 *dead-pool-list*)
(v1-4 (car s4-0)))
@@ -106,7 +106,7 @@
(set! (-> gp-0 length) (max 96 (-> gp-0 length)))
(set! (-> gp-0 data 95 name) "heap-total")
(+! (-> gp-0 data 95 count) 1)
(let ((v1-34 (+ (- -4 (the-as int arg0)) (the-as int (-> arg0 heap-cur)))))
(let ((v1-34 (+ (the-as uint (- -4 (the-as int arg0))) (the-as uint (-> arg0 heap-cur)))))
(+! (-> gp-0 data 95 used) v1-34)
(+! (-> gp-0 data 95 total) (logand -16 (+ v1-34 15))))
(set! (-> gp-0 length) (max 97 (-> gp-0 length)))
+25 -29
View File
@@ -48,6 +48,7 @@
(set! (-> gp-0 root-menu) #f)
(set! (-> gp-0 joypad-func) #f)
(set! (-> gp-0 joypad-item) #f)
;; og:preserve-this added pc-hack flag
(set! (-> gp-0 font)
(new 'debug 'font-context *font-default-matrix* 0 0 0.0 (font-color default) (font-flags shadow kerning pc-hack)))
gp-0))
@@ -372,7 +373,8 @@
(was-active (-> context is-active)))
(if was-active (debug-menu-context-send-msg context (debug-menu-msg deactivate) (debug-menu-dest activation)))
(set! (-> item parent) menu)
(set! (-> menu items) (the-as pair (append! (-> menu items) (dcons item '())))) ;; was normal cons
;; og:preserve-this was normal cons
(set! (-> menu items) (the-as pair (append! (-> menu items) (dcons item '()))))
(debug-menu-rebuild menu)
(if was-active (debug-menu-context-send-msg context (debug-menu-msg activate) (debug-menu-dest activation))))
item)
@@ -404,7 +406,7 @@
- flag - flag entry
- function - function entry
- var, int-var, int-var-gat1, hex-var, float-var, flat-fixed-var"
(local-vars (s5-0 basic) (sv-16 object) (sv-32 int) (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float))
(local-vars (s5-0 basic))
(when (or (not arg1) (null? arg1))
(set! s5-0 #f)
(goto cfg-41))
@@ -449,41 +451,35 @@
(new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (car (cdr (cdr (cdr arg1)))))))
((or (= s4-0 'int-var) (= s4-0 'int-var-gat1) (= s4-0 'hex-var))
(set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))))
(let ((s3-4 debug-menu-item-var-make-int)
(s2-3 (the-as debug-menu-item-var s5-0))
(s1-3 (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(s0-1 (/ (the-as int (ref arg1 5)) 8)))
(set! sv-16 (ref arg1 6))
(set! sv-32 (/ (the-as int (ref arg1 7)) 8))
(let ((t1-0 (/ (the-as int (ref arg1 8)) 8))
(t2-0 (= s4-0 'hex-var)))
(s3-4 s2-3 (the-as (function int debug-menu-msg int int int) s1-3) s0-1 (the-as symbol sv-16) sv-32 t1-0 t2-0)))
(debug-menu-item-var-make-int (the-as debug-menu-item-var s5-0)
(the-as (function int debug-menu-msg int int int) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(/ (the-as int (ref arg1 5)) 8)
(the-as symbol (ref arg1 6))
(/ (the-as int (ref arg1 7)) 8)
(/ (the-as int (ref arg1 8)) 8)
(= s4-0 'hex-var))
;; changed... i have no idea what they were trying to do here
(set! (-> (the-as debug-menu-item-var s5-0) ifloat-p) (= s4-0 'int-var-gat1)) ;;#t)
s5-0)
((= s4-0 'float-var)
(set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))))
(let ((s4-5 debug-menu-item-var-make-float)
(s3-6 (the-as debug-menu-item-var s5-0))
(s2-5 (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(s1-5 (the float (/ (the-as int (ref arg1 5)) 8)))
(s0-2 (ref arg1 6)))
(set! sv-48 (the float (/ (the-as int (ref arg1 7)) 8)))
(set! sv-64 (the float (/ (the-as int (ref arg1 8)) 8)))
(let ((t2-1 (/ (the-as int (ref arg1 9)) 8)))
(s4-5 s3-6 (the-as (function int debug-menu-msg float float float) s2-5) s1-5 (the-as symbol s0-2) sv-48 sv-64 t2-1)))
(debug-menu-item-var-make-float (the-as debug-menu-item-var s5-0)
(the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(the float (/ (the-as int (ref arg1 5)) 8))
(the-as symbol (ref arg1 6))
(the float (/ (the-as int (ref arg1 7)) 8))
(the float (/ (the-as int (ref arg1 8)) 8))
(/ (the-as int (ref arg1 9)) 8))
s5-0)
((= s4-0 'float-fixed-var)
(set! s5-0 (new 'debug 'debug-menu-item-var s5-1 (the-as int (car (cdr (cdr arg1)))) (the-as int (ref arg1 4))))
(let ((s4-7 debug-menu-item-var-make-float)
(s3-8 (the-as debug-menu-item-var s5-0))
(s2-7 (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(s1-7 (* 0.001 (the float (/ (the-as int (ref arg1 5)) 8))))
(s0-3 (ref arg1 6)))
(set! sv-80 (* 0.001 (the float (/ (the-as int (ref arg1 7)) 8))))
(set! sv-96 (* 0.001 (the float (/ (the-as int (ref arg1 8)) 8))))
(let ((t2-2 (/ (the-as int (ref arg1 9)) 8)))
(s4-7 s3-8 (the-as (function int debug-menu-msg float float float) s2-7) s1-7 (the-as symbol s0-3) sv-80 sv-96 t2-2)))
(debug-menu-item-var-make-float (the-as debug-menu-item-var s5-0)
(the-as (function int debug-menu-msg float float float) (debug-menu-func-decode (car (cdr (cdr (cdr arg1))))))
(* 0.001 (the float (/ (the-as int (ref arg1 5)) 8)))
(the-as symbol (ref arg1 6))
(* 0.001 (the float (/ (the-as int (ref arg1 7)) 8)))
(* 0.001 (the float (/ (the-as int (ref arg1 8)) 8)))
(/ (the-as int (ref arg1 9)) 8))
s5-0)
(else #f))))))
(label cfg-41)
+5 -7
View File
@@ -134,19 +134,17 @@
(none))
(defun add-a-bunch ((arg0 string) (arg1 int) (arg2 int) (arg3 float))
(local-vars (sv-32 process))
(dotimes (s2-0 arg1)
(dotimes (s1-0 arg2)
(let ((s0-0 (new-stack-vector0)))
(position-in-front-of-camera! s0-0 40960.0 4096.0)
(+! (-> s0-0 x) (the float (* (- s2-0 (/ arg1 2)) (the int arg3))))
(+! (-> s0-0 z) (the float (* (- s1-0 (/ arg2 2)) (the int arg3))))
(set! sv-32 (get-process *default-dead-pool* viewer #x4000))
(when sv-32
(let ((t9-2 (method-of-type viewer activate)))
(t9-2 (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000)))
(run-now-in-process sv-32 init-viewer-for-other arg0 s0-0)
(-> sv-32 ppointer)))))
(let ((sv-32 (get-process *default-dead-pool* viewer #x4000)))
(when sv-32
((method-of-type viewer activate) (the-as viewer sv-32) *entity-pool* 'viewer (the-as pointer #x70004000))
(run-now-in-process sv-32 init-viewer-for-other arg0 s0-0)
(-> sv-32 ppointer))))))
#f)
(defun birth-viewer ((arg0 process) (arg1 entity-actor))
+2 -1
View File
@@ -161,7 +161,8 @@
but creates a reference to the existing VU function."
;; The first 4 bytes of a vu-function object's data are discarded because they aren't aligned.
(let ((func-ptr (the-as pointer (&-> vu-func data 4)))
(qlen (-> vu-func qlength)) ;; number of quadwords
;; og:preserve-this we rely on the vu functions being empty on pc
(qlen (#if PC_PORT 0 (-> vu-func qlength))) ;; number of quadwords
(origin (-> vu-func origin)) ;; destination address in VU instruction memory.
)
;; loop until whole program is transferred.
+33 -32
View File
@@ -18,6 +18,7 @@
(string1 string)
(string2 string)))
(define *vif-disasm-table*
(new 'static
'boxed-array
@@ -25,38 +26,38 @@
vif-disasm-element
:length 34
(new 'static 'vif-disasm-element :mask #x7f :string1 "nop")
(new 'static 'vif-disasm-element :mask #x7f :tag #x1 :print #x2 :string1 "stcycl")
(new 'static 'vif-disasm-element :mask #x7f :tag #x2 :print #x1 :string1 "offset" :string2 "offset")
(new 'static 'vif-disasm-element :mask #x7f :tag #x3 :print #x1 :string1 "base" :string2 "base")
(new 'static 'vif-disasm-element :mask #x7f :tag #x4 :print #x1 :string1 "itop" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag #x5 :print #x1 :string1 "stmod" :string2 "mode")
(new 'static 'vif-disasm-element :mask #x7f :tag #x6 :print #x1 :string1 "mskpath3" :string2 "mask")
(new 'static 'vif-disasm-element :mask #x7f :tag #x7 :print #x1 :string1 "mark" :string2 "mark")
(new 'static 'vif-disasm-element :mask #x7f :tag #x10 :string1 "flushe")
(new 'static 'vif-disasm-element :mask #x7f :tag #x11 :string1 "flush")
(new 'static 'vif-disasm-element :mask #x7f :tag #x13 :string1 "flusha")
(new 'static 'vif-disasm-element :mask #x7f :tag #x14 :print #x1 :string1 "mscal" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag #x17 :string1 "mscnt")
(new 'static 'vif-disasm-element :mask #x7f :tag #x15 :print #x1 :string1 "mscalf" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag #x20 :print #x3 :string1 "stmask" :string2 "mask")
(new 'static 'vif-disasm-element :mask #x7f :tag #x30 :print #x4 :string1 "strow" :string2 "row")
(new 'static 'vif-disasm-element :mask #x7f :tag #x31 :print #x4 :string1 "stcol" :string2 "col")
(new 'static 'vif-disasm-element :mask #x7f :tag #x4a :print #x5 :string1 "mpg")
(new 'static 'vif-disasm-element :mask #x7f :tag #x50 :print #x6 :string1 "direct")
(new 'static 'vif-disasm-element :mask #x7f :tag #x51 :print #x6 :string1 "directhl")
(new 'static 'vif-disasm-element :mask #x6f :tag #x60 :val #x10 :print #x7 :string1 "unpack-s-32")
(new 'static 'vif-disasm-element :mask #x6f :tag #x61 :val #x8 :print #x7 :string1 "unpack-s-16")
(new 'static 'vif-disasm-element :mask #x6f :tag #x62 :val #x4 :print #x7 :string1 "unpack-s-8")
(new 'static 'vif-disasm-element :mask #x6f :tag #x64 :val #x8 :print #x7 :string1 "unpack-v2-32")
(new 'static 'vif-disasm-element :mask #x6f :tag #x65 :val #x4 :print #x7 :string1 "unpack-v2-16")
(new 'static 'vif-disasm-element :mask #x6f :tag #x66 :val #x2 :print #x7 :string1 "unpack-v2-8")
(new 'static 'vif-disasm-element :mask #x6f :tag #x68 :val #xc :print #x7 :string1 "unpack-v3-32")
(new 'static 'vif-disasm-element :mask #x6f :tag #x69 :val #x6 :print #x7 :string1 "unpack-v3-16")
(new 'static 'vif-disasm-element :mask #x6f :tag #x6a :val #x3 :print #x7 :string1 "unpack-v3-8")
(new 'static 'vif-disasm-element :mask #x6f :tag #x6c :val #x10 :print #x7 :string1 "unpack-v4-32")
(new 'static 'vif-disasm-element :mask #x6f :tag #x6d :val #x8 :print #x7 :string1 "unpack-v4-16")
(new 'static 'vif-disasm-element :mask #x6f :tag #x6e :val #x4 :print #x7 :string1 "unpack-v4-8")
(new 'static 'vif-disasm-element :mask #x6f :tag #x6f :val #x2 :print #x7 :string1 "unpack-v4-5")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcycl) :print #x2 :string1 "stcycl")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 offset) :print #x1 :string1 "offset" :string2 "offset")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 base) :print #x1 :string1 "base" :string2 "base")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 itop) :print #x1 :string1 "itop" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stmod) :print #x1 :string1 "stmod" :string2 "mode")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mskpath3) :print #x1 :string1 "mskpath3" :string2 "mask")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mark) :print #x1 :string1 "mark" :string2 "mark")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flushe) :string1 "flushe")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flush) :string1 "flush")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 flusha) :string1 "flusha")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscal) :print #x1 :string1 "mscal" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscnt) :string1 "mscnt")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mscalf) :print #x1 :string1 "mscalf" :string2 "addr")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stmask) :print #x3 :string1 "stmask" :string2 "mask")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 strow) :print #x4 :string1 "strow" :string2 "row")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 stcol) :print #x4 :string1 "stcol" :string2 "col")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 mpg) :print #x5 :string1 "mpg")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 direct) :print #x6 :string1 "direct")
(new 'static 'vif-disasm-element :mask #x7f :tag (vif-cmd-32 directhl) :print #x6 :string1 "directhl")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-32) :val #x10 :print #x7 :string1 "unpack-s-32")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-16) :val #x8 :print #x7 :string1 "unpack-s-16")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-s-8) :val #x4 :print #x7 :string1 "unpack-s-8")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-32) :val #x8 :print #x7 :string1 "unpack-v2-32")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-16) :val #x4 :print #x7 :string1 "unpack-v2-16")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v2-8) :val #x2 :print #x7 :string1 "unpack-v2-8")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-32) :val #xc :print #x7 :string1 "unpack-v3-32")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-16) :val #x6 :print #x7 :string1 "unpack-v3-16")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v3-8) :val #x3 :print #x7 :string1 "unpack-v3-8")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-32) :val #x10 :print #x7 :string1 "unpack-v4-32")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-16) :val #x8 :print #x7 :string1 "unpack-v4-16")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-8) :val #x4 :print #x7 :string1 "unpack-v4-8")
(new 'static 'vif-disasm-element :mask #x6f :tag (vif-cmd-32 unpack-v4-5) :val #x2 :print #x7 :string1 "unpack-v4-5")
(new 'static 'vif-disasm-element :print #x8)))
(defun disasm-vif-details ((stream symbol) (data (pointer uint8)) (kind vif-cmd) (count int))
+180 -195
View File
@@ -105,7 +105,7 @@
(.mov a0-1 vf10)
(.pcgtw a0-2 0 a0-1)
(.ppach a0-3 (the-as uint128 0) a0-2)
(zero? (logand (the-as int v1-3) (the-as int a0-3)))))
(not (logtest? (the-as int v1-3) (the-as int a0-3)))))
(defun vis-cull ((id int))
"Is this thing visible? By draw-node id."
@@ -185,11 +185,11 @@
((drawable-tree-instance-shrub)
(let ((s2-0 (-> (the-as drawable-tree-instance-shrub v1-7) info prototype-inline-array-shrub)))
(dotimes (s1-0 (-> s2-0 length))
(if (string= arg0 (the-as string (-> s2-0 data s1-0 name))) (return (-> s2-0 data s1-0))))))
(if (string= arg0 (-> s2-0 data s1-0 name)) (return (-> s2-0 data s1-0))))))
((drawable-tree-instance-tie)
(let ((s2-1 (-> (the-as drawable-tree-instance-tie v1-7) prototypes prototype-array-tie)))
(dotimes (s1-1 (-> s2-1 length))
(if (string= arg0 (the-as string (-> s2-1 array-data s1-1 name))) (return (-> s2-1 array-data s1-1)))))))))))))
(if (string= arg0 (-> s2-1 array-data s1-1 name)) (return (-> s2-1 array-data s1-1)))))))))))))
(the-as prototype-bucket #f))
(defun-debug find-instance-by-index ((arg0 type) (arg1 int) (arg2 bsp-header))
@@ -224,7 +224,7 @@
(set! (-> arg0 dists z) (+ (-> arg0 dists x) (* 0.33333334 (- (-> arg0 dists w) (-> arg0 dists x)))))
(set! (-> arg0 rdists x) (/ 1.0 (- (-> arg0 dists z) (-> arg0 dists x))))))
(set! (-> arg0 rdists z) (/ 1.0 (- (-> arg0 dists w) (-> arg0 dists z))))
(set! (-> arg0 dists y) (* 0.5 (-> arg0 dists x)))
(set! (-> arg0 dists y) (/ (-> arg0 dists x) 2))
(set! (-> arg0 rdists y) (/ 1.0 (-> arg0 dists y)))
arg0)
@@ -419,7 +419,7 @@
|#
(defun dma-add-process-drawable ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer))
(local-vars (v1-37 float) (sv-16 process-drawable))
(local-vars (v1-37 float))
(rlet ((acc :class vf)
(Q :class vf)
(vf0 :class vf)
@@ -443,176 +443,178 @@
(vf4 :class vf)
(vf5 :class vf))
(init-vf0-vector)
(set! sv-16 arg0)
(logclear! (-> arg1 status) (draw-status was-drawn))
(when (zero? (logand (-> arg1 status) (draw-status hidden no-anim no-skeleton-update)))
(let ((s4-0 (the-as vector (+ 48 (the-as int (scratchpad-object int)))))
(vu-lgt (the-as vu-lights (+ 64 (the-as int (scratchpad-object int)))))
(tod *time-of-day-context*))
(.lvf vf16 (&-> arg1 origin quad))
(.lvf vf17 (&-> arg1 bounds quad))
(.mul.x.vf.w vf16 vf16 vf0)
(.add.vf vf16 vf16 vf17)
(.svf (&-> s4-0 quad) vf16)
(.lvf vf28 (&-> arg1 color-mult quad))
(.lvf vf29 (&-> arg1 color-emissive quad))
(when (sphere-in-view-frustum? (the-as sphere s4-0))
(case (-> arg1 global-effect)
(((draw-effect title))
(when (not (-> tod title-updated))
(set! (-> tod title-updated) #t)
(let ((s0-0 (-> *math-camera* inv-camera-rot))
(a1-1 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector)))
(set-vector! a1-1 0.612 0.5 -0.612 0.0)
(set-vector! s1-0 -0.696 0.174 0.696 0.0)
(vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0)
(vector-matrix*! (the-as vector (-> tod title-light-group dir1)) s1-0 s0-0))
(set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0))
(vu-lights<-light-group! vu-lgt (-> tod title-light-group)))
(else
(let ((interp (-> arg1 secondary-interp))
(cur-interp (-> arg1 current-secondary-interp))
(shadow-msk (-> arg1 shadow-mask))
(lev-idx (-> arg1 level-index))
(lgt (-> tod light-group (-> *target* draw light-index)))
(cur-lgt (new 'stack-no-clear 'light-group)))
(cond
((= (-> arg1 light-index) 255))
((= lev-idx 2) (set! lgt (-> tod light-group (-> arg1 light-index))))
(else (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index)))))
(when (not (or (= lev-idx 2) (zero? shadow-msk)))
(let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx))
(lgt-msk-1 (-> tod light-masks-1 lev-idx))
(lgt-interp (-> tod light-interp lev-idx))
(a0-13 (logand lgt-msk-0 shadow-msk))
(v1-18 (logand lgt-msk-1 shadow-msk)))
(cond
((and (zero? a0-13) (zero? v1-18)))
(else
(set! interp
(cond
((and (nonzero? a0-13) (nonzero? v1-18)) 1.0)
((zero? a0-13)
(quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)
(set! lgt cur-lgt)
(set! (-> lgt dir1 levels x) 0.0)
lgt-interp)
(else
(quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)
(set! lgt cur-lgt)
(set! (-> lgt dir0 levels x) 0.0)
(- 1.0 lgt-interp))))))))
(if *teleport* (set! cur-interp interp))
(when (not (or (paused?) (= interp cur-interp)))
(let ((f0-15 (- cur-interp interp)))
(set! cur-interp
(cond
((< (fabs f0-15) 0.2) interp)
((< f0-15 0.0) (+ 0.2 cur-interp))
(else (+ -0.2 cur-interp)))))
(set! (-> arg1 current-secondary-interp) cur-interp))
(cond
((= cur-interp 0.0) (vu-lights<-light-group! vu-lgt lgt))
(else
(if (!= lgt cur-lgt) (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12))
(let ((f0-20 (- 1.0 cur-interp)))
(set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20))
(set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20))
(set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20))
(set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20))
(set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20))
(set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)))
(vu-lights<-light-group! vu-lgt cur-lgt))))
(.lvf vf2 (&-> vu-lgt color 0 quad))
(.lvf vf3 (&-> vu-lgt color 1 quad))
(.lvf vf4 (&-> vu-lgt color 2 quad))
(.lvf vf5 (&-> vu-lgt ambient quad))
(.mul.vf vf5 vf5 vf28)
(.mul.vf vf2 vf2 vf28)
(.mul.vf vf3 vf3 vf28)
(.mul.vf vf4 vf4 vf28)
(.add.vf vf5 vf5 vf29)
(.svf (&-> vu-lgt color 0 quad) vf2)
(.svf (&-> vu-lgt color 1 quad) vf3)
(.svf (&-> vu-lgt color 2 quad) vf4)
(.svf (&-> vu-lgt ambient quad) vf5)
(.mov v1-37 vf5)))
(if *display-lights*
(add-debug-lights #t (bucket-id debug) (the-as (inline-array light) (-> tod light-group)) (-> arg1 origin)))
(let ((at-0 *math-camera*))
(.lvf vf16 (&-> at-0 plane 0 quad))
(.lvf vf17 (&-> at-0 plane 1 quad))
(.lvf vf18 (&-> at-0 plane 2 quad))
(.lvf vf19 (&-> at-0 plane 3 quad))
(.lvf vf20 (&-> at-0 guard-plane 0 quad))
(.lvf vf21 (&-> at-0 guard-plane 1 quad))
(.lvf vf22 (&-> at-0 guard-plane 2 quad))
(.lvf vf23 (&-> at-0 guard-plane 3 quad))
(.lvf vf24 (&-> at-0 camera-rot vector 0 quad))
(.lvf vf25 (&-> at-0 camera-rot vector 1 quad))
(.lvf vf26 (&-> at-0 camera-rot vector 2 quad))
(.lvf vf27 (&-> at-0 camera-rot vector 3 quad)))
(let ((v1-42 (the-as vector (+ 176 (the-as int (scratchpad-object int))))))
(.lvf vf15 (&-> s4-0 quad))
(.mul.w.vf acc vf27 vf0)
(.add.mul.x.vf acc vf24 vf15 acc)
(.add.mul.y.vf acc vf25 vf15 acc)
(.add.mul.z.vf.xyz vf15 vf26 vf15 acc)
(.mul.vf vf28 vf15 vf15)
(.max.w.vf vf29 vf0 vf0)
(.add.y.vf acc vf28 vf28)
(.add.mul.z.vf.x vf28 vf29 vf28 acc)
(.sqrt.vf Q vf28 :ftf #b0)
(.sub.w.vf.w vf28 vf0 vf15)
(.wait.vf)
(.add.vf.w vf15 vf28 Q)
(.svf (&-> v1-42 quad) vf15)
(when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w)))
(let ((lod-to-use 0))
(let ((cam-dist (-> v1-42 w)))
(when (nonzero? (-> arg1 lod-set max-lod))
(cond
((>= (-> arg1 force-lod) 0)
(set! lod-to-use (-> arg1 force-lod))
(if (#if (not PC_PORT)
(< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist)
(and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist)))
(return #f)))
(else
(while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist))
(+! lod-to-use 1)))))
;; og:preserve-this lod hacks!
(with-pc
(if (not (-> *pc-settings* ps2-lod-dist?))
(set! lod-to-use (minmax (-> *pc-settings* lod-force-actor) 0 (-> arg1 lod-set max-lod)))))
(if (#if (not PC_PORT)
(and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0))
(and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)))
(return #f))
(let ((v1-64 (-> arg1 sink-group level))
(a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)))
(when (#if (not PC_PORT)
(not (logtest? (-> arg1 status) (draw-status do-not-check-distance)))
(and (-> *pc-settings* ps2-lod-dist?) (not (logtest? (-> arg1 status) (draw-status do-not-check-distance)))))
(if (< cam-dist (-> v1-64 closest-object a0-26)) (set! (-> v1-64 closest-object a0-26) cam-dist))
(when (and (!= a0-26 6) (!= (-> arg1 level-index) 2))
(let ((a1-45 (cond
((< 102400.0 cam-dist) (-> arg1 mgeo header masks 0))
((< 81920.0 cam-dist) (-> arg1 mgeo header masks 1))
(else (-> arg1 mgeo header masks 2)))))
(logior! (-> v1-64 texture-mask a0-26) a1-45)))))
(if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d))))
(logior! (-> arg1 status) (draw-status needs-clip))
(logclear! (-> arg1 status) (draw-status needs-clip)))
(logior! (-> arg1 status) (draw-status was-drawn))
(if (logtest? (-> arg1 status) (draw-status skip-bones)) (return #f))
(draw-bones arg1 arg3 cam-dist))
(when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels)))
;; og:preserve-this added this check for PC port to prevent memory corruption
(if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT)
(let ((v1-82 *matrix-engine*)) (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) (+! (-> v1-82 length) 1))))
(lod-set! arg1 lod-to-use)))))))
(let ((sv-16 arg0))
(logclear! (-> arg1 status) (draw-status was-drawn))
(when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update)))
;; og:preserve-this scratchpad
(let ((s4-0 (-> (scratchpad-object terrain-context) work foreground joint-work temp-mtx vector 2))
(vu-lgt (the-as vu-lights (-> (scratchpad-object terrain-context) work foreground joint-work temp-mtx vector 3)))
(tod *time-of-day-context*))
(.lvf vf16 (&-> arg1 origin quad))
(.lvf vf17 (&-> arg1 bounds quad))
(.mul.x.vf.w vf16 vf16 vf0)
(.add.vf vf16 vf16 vf17)
(.svf (&-> s4-0 quad) vf16)
(.lvf vf28 (&-> arg1 color-mult quad))
(.lvf vf29 (&-> arg1 color-emissive quad))
(when (sphere-in-view-frustum? (the-as sphere s4-0))
(case (-> arg1 global-effect)
(((draw-effect title))
(when (not (-> tod title-updated))
(set! (-> tod title-updated) #t)
(let ((s0-0 (-> *math-camera* inv-camera-rot))
(a1-1 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'vector)))
(set-vector! a1-1 0.612 0.5 -0.612 0.0)
(set-vector! s1-0 -0.696 0.174 0.696 0.0)
(vector-matrix*! (the-as vector (-> tod title-light-group)) a1-1 s0-0)
(vector-matrix*! (-> tod title-light-group dir1 direction) s1-0 s0-0))
(set-vector! (-> *time-of-day-context* current-shadow) 0.612 -0.5 -0.612 1.0))
(vu-lights<-light-group! vu-lgt (-> tod title-light-group)))
(else
(let ((interp (-> arg1 secondary-interp))
(cur-interp (-> arg1 current-secondary-interp))
(shadow-msk (-> arg1 shadow-mask))
(lev-idx (-> arg1 level-index))
(lgt (-> tod light-group (-> *target* draw light-index)))
(cur-lgt (new 'stack-no-clear 'light-group)))
(cond
((= (-> arg1 light-index) 255))
((= lev-idx 2) (set! lgt (-> tod light-group (-> arg1 light-index))))
(else (set! lgt (-> tod moods lev-idx light-group (-> arg1 light-index)))))
(when (not (or (= lev-idx 2) (zero? shadow-msk)))
(let* ((lgt-msk-0 (-> tod light-masks-0 lev-idx))
(lgt-msk-1 (-> tod light-masks-1 lev-idx))
(lgt-interp (-> tod light-interp lev-idx))
(a0-13 (logand lgt-msk-0 shadow-msk))
(v1-18 (logand lgt-msk-1 shadow-msk)))
(cond
((and (zero? a0-13) (zero? v1-18)))
(else
(set! interp
(cond
((and (nonzero? a0-13) (nonzero? v1-18)) 1.0)
((zero? a0-13)
(quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)
(set! lgt cur-lgt)
(set! (-> lgt dir1 levels x) 0.0)
lgt-interp)
(else
(quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12)
(set! lgt cur-lgt)
(set! (-> lgt dir0 levels x) 0.0)
(- 1.0 lgt-interp))))))))
(if *teleport* (set! cur-interp interp))
(when (not (or (paused?) (= interp cur-interp)))
(let ((f0-15 (- cur-interp interp)))
(set! cur-interp
(cond
((< (fabs f0-15) 0.2) interp)
((< f0-15 0.0) (+ 0.2 cur-interp))
(else (+ -0.2 cur-interp)))))
(set! (-> arg1 current-secondary-interp) cur-interp))
(cond
((= cur-interp 0.0) (vu-lights<-light-group! vu-lgt lgt))
(else
(if (!= lgt cur-lgt) (quad-copy! (the-as pointer cur-lgt) (the-as pointer lgt) 12))
(let ((f0-20 (- 1.0 cur-interp)))
(set! (-> cur-lgt dir0 levels x) (* (-> cur-lgt dir0 levels x) f0-20))
(set! (-> cur-lgt dir0 levels y) (* (-> cur-lgt dir0 levels y) f0-20))
(set! (-> cur-lgt dir1 levels x) (* (-> cur-lgt dir1 levels x) f0-20))
(set! (-> cur-lgt dir1 levels y) (* (-> cur-lgt dir1 levels y) f0-20))
(set! (-> cur-lgt dir2 levels x) (* (-> cur-lgt dir2 levels x) f0-20))
(set! (-> cur-lgt dir2 levels y) (* (-> cur-lgt dir2 levels y) f0-20)))
(vu-lights<-light-group! vu-lgt cur-lgt))))
(.lvf vf2 (&-> vu-lgt color 0 quad))
(.lvf vf3 (&-> vu-lgt color 1 quad))
(.lvf vf4 (&-> vu-lgt color 2 quad))
(.lvf vf5 (&-> vu-lgt ambient quad))
(.mul.vf vf5 vf5 vf28)
(.mul.vf vf2 vf2 vf28)
(.mul.vf vf3 vf3 vf28)
(.mul.vf vf4 vf4 vf28)
(.add.vf vf5 vf5 vf29)
(.svf (&-> vu-lgt color 0 quad) vf2)
(.svf (&-> vu-lgt color 1 quad) vf3)
(.svf (&-> vu-lgt color 2 quad) vf4)
(.svf (&-> vu-lgt ambient quad) vf5)
(.mov v1-37 vf5)))
(if *display-lights* (add-debug-lights #t (bucket-id debug) (-> tod light-group 0 lights) (-> arg1 origin)))
(let ((at-0 *math-camera*))
(.lvf vf16 (&-> at-0 plane 0 quad))
(.lvf vf17 (&-> at-0 plane 1 quad))
(.lvf vf18 (&-> at-0 plane 2 quad))
(.lvf vf19 (&-> at-0 plane 3 quad))
(.lvf vf20 (&-> at-0 guard-plane 0 quad))
(.lvf vf21 (&-> at-0 guard-plane 1 quad))
(.lvf vf22 (&-> at-0 guard-plane 2 quad))
(.lvf vf23 (&-> at-0 guard-plane 3 quad))
(.lvf vf24 (&-> at-0 camera-rot vector 0 quad))
(.lvf vf25 (&-> at-0 camera-rot vector 1 quad))
(.lvf vf26 (&-> at-0 camera-rot vector 2 quad))
(.lvf vf27 (&-> at-0 camera-rot vector 3 quad)))
(let ((v1-42 (-> (scratchpad-object terrain-context) work foreground joint-work joint-stack data 1 vector 1)))
(.lvf vf15 (&-> s4-0 quad))
(.mul.w.vf acc vf27 vf0)
(.add.mul.x.vf acc vf24 vf15 acc)
(.add.mul.y.vf acc vf25 vf15 acc)
(.add.mul.z.vf.xyz vf15 vf26 vf15 acc)
(.mul.vf vf28 vf15 vf15)
(.max.w.vf vf29 vf0 vf0)
(.add.y.vf acc vf28 vf28)
(.add.mul.z.vf.x vf28 vf29 vf28 acc)
(.sqrt.vf Q vf28 :ftf #b0)
(.sub.w.vf.w vf28 vf0 vf15)
(.wait.vf)
(.add.vf.w vf15 vf28 Q)
(.svf (&-> v1-42 quad) vf15)
(when (< 0.0 (+ (-> v1-42 z) (-> arg1 bounds w)))
(let ((lod-to-use 0))
(let ((cam-dist (-> v1-42 w)))
(when (nonzero? (-> arg1 lod-set max-lod))
(cond
((>= (-> arg1 force-lod) 0)
(set! lod-to-use (-> arg1 force-lod))
;; og:preserve-this lod hacks
(if (#if (not PC_PORT)
(< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist)
(and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod (-> arg1 lod-set max-lod) dist) cam-dist)))
(return #f)))
(else
(while (and (< lod-to-use (-> arg1 lod-set max-lod)) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist))
(+! lod-to-use 1)))))
;; og:preserve-this lod hacks!
(with-pc
(if (not (-> *pc-settings* ps2-lod-dist?))
(set! lod-to-use (minmax (-> *pc-settings* lod-force-actor) 0 (-> arg1 lod-set max-lod)))))
;; og:preserve-this lod hacks
(if (#if (not PC_PORT)
(and (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0))
(and (-> *pc-settings* ps2-lod-dist?) (< (-> arg1 lod-set lod lod-to-use dist) cam-dist) (< (-> arg1 force-lod) 0)))
(return #f))
(let ((v1-64 (-> arg1 sink-group level))
(a0-26 (+ (-> arg1 sink-group merc-sink foreground-texture-page) 6)))
(when (#if (not PC_PORT)
(not (logtest? (-> arg1 status) (draw-status do-not-check-distance)))
(and (-> *pc-settings* ps2-lod-dist?) (not (logtest? (-> arg1 status) (draw-status do-not-check-distance)))))
(if (< cam-dist (-> v1-64 closest-object a0-26)) (set! (-> v1-64 closest-object a0-26) cam-dist))
(when (and (!= a0-26 6) (!= (-> arg1 level-index) 2))
(let ((a1-45 (cond
((< 102400.0 cam-dist) (-> arg1 mgeo header masks 0))
((< 81920.0 cam-dist) (-> arg1 mgeo header masks 1))
(else (-> arg1 mgeo header masks 2)))))
(logior! (-> v1-64 texture-mask a0-26) a1-45)))))
(if (or (guard-band-cull s4-0) (< cam-dist (* 1.2 (-> *math-camera* d))))
(logior! (-> arg1 status) (draw-status needs-clip))
(logclear! (-> arg1 status) (draw-status needs-clip)))
(logior! (-> arg1 status) (draw-status was-drawn))
(if (logtest? (-> arg1 status) (draw-status skip-bones)) (return #f))
(draw-bones arg1 arg3 cam-dist))
(when (and (< lod-to-use (-> arg1 cur-lod)) (logtest? (-> arg1 status) (draw-status has-joint-channels)))
;; og:preserve-this added this check for PC port to prevent memory corruption
(if (< (-> *matrix-engine* length) MATRIX_ENGINE_AMOUNT)
(let ((v1-82 *matrix-engine*)) (set! (-> v1-82 (-> v1-82 length)) (process->handle sv-16)) (+! (-> v1-82 length) 1))))
(lod-set! arg1 lod-to-use))))))))
0
(none)))
@@ -634,7 +636,7 @@
(defun dma-add-process-drawable-hud ((arg0 process-drawable) (arg1 draw-control) (arg2 symbol) (arg3 dma-buffer))
(logclear! (-> arg1 status) (draw-status was-drawn))
(when (zero? (logand (-> arg1 status) (draw-status hidden no-anim no-skeleton-update)))
(when (not (logtest? (-> arg1 status) (draw-status hidden no-anim no-skeleton-update)))
(let ((v1-6 (the-as vu-lights (+ 64 (scratchpad-object int))))
(a0-3 *hud-lights*))
(set! (-> v1-6 direction 0 quad) (-> a0-3 direction 0 quad))
@@ -758,6 +760,7 @@
(if (= (-> s5-0 status) 'active) (print-mem-usage (compute-memory-usage s5-0 #f) s5-0 *stdcon*)))))
(reset! *dma-mem-usage*))
;; todo shrub matrix
; (shrub-make-perspective-matrix (-> *math-camera* shrub-mat))
;; initialize dma buckets that are generic sinks.
;; other renderers may output to these, so do them first.
(generic-init-buffers)
@@ -940,25 +943,7 @@
(let* ((a3-4 t0-0)
(t1-2 (the-as object (-> a3-4 base))))
(set! (-> (the-as gs-gif-tag t1-2) tag) (new 'static 'gif-tag64 :nloop #x1 :eop #x1 :nreg #x2))
(set! (-> (the-as gs-gif-tag t1-2) regs)
(new 'static
'gif-tag-regs
:regs0 (gif-reg-id a+d)
:regs1 (gif-reg-id a+d)
:regs2 (gif-reg-id a+d)
:regs3 (gif-reg-id a+d)
:regs4 (gif-reg-id a+d)
:regs5 (gif-reg-id a+d)
:regs6 (gif-reg-id a+d)
:regs7 (gif-reg-id a+d)
:regs8 (gif-reg-id a+d)
:regs9 (gif-reg-id a+d)
:regs10 (gif-reg-id a+d)
:regs11 (gif-reg-id a+d)
:regs12 (gif-reg-id a+d)
:regs13 (gif-reg-id a+d)
:regs14 (gif-reg-id a+d)
:regs15 (gif-reg-id a+d)))
(set! (-> (the-as gs-gif-tag t1-2) regs) GIF_REGS_ALL_AD)
(set! (-> a3-4 base) (&+ (the-as pointer t1-2) 16)))
(let* ((a3-5 t0-0)
(t1-4 (-> a3-5 base)))
+4 -7
View File
@@ -26,10 +26,8 @@
(defun entity-actor-lookup ((lump res-lump) (name symbol) (idx int))
"Given an entity (the res-lump), look up a reference to another entity and return that entity."
(local-vars (sv-16 res-tag))
(set! sv-16 (new 'static 'res-tag))
;; look up the reference
(let ((v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-1 (res-lump-data lump name (pointer uint32) :tag-ptr (& sv-16))))
(the-as entity-actor
;; check in range, and lookup succesful
(when (and v1-1 (< idx (the-as int (-> sv-16 elt-count))))
@@ -41,9 +39,8 @@
(defun entity-actor-count ((res res-lump) (name symbol))
"Get the number of entities that this res references under the name.
This works on more than just next/prev."
(local-vars (tag res-tag))
(set! tag (new 'static 'res-tag))
(if (res-lump-data res name pointer :tag-ptr (& tag)) (the-as int (-> tag elt-count)) 0))
(let ((tag (new 'static 'res-tag)))
(if (res-lump-data res name pointer :tag-ptr (& tag)) (the-as int (-> tag elt-count)) 0)))
;; entity-actors are part of a linked list of entities.
;; these prevent you from looking up next-actor, prev-actor again and again to iterate.
+47 -50
View File
@@ -77,20 +77,19 @@
gp-0))
(defun level-hint-task-process ((arg0 entity) (arg1 uint128) (arg2 string))
(local-vars (sv-16 res-tag))
(let ((gp-0 (res-lump-value arg0 'text-id int :default arg1))
(s5-0 0))
(cond
((can-hint-be-played? (the-as text-id gp-0) arg0 arg2)
(set! sv-16 (new 'static 'res-tag))
(let ((s4-1 ((method-of-type res-lump get-property-data)
arg0
'cmds
'exact
-1000000000.0
(the-as pointer #f)
(& sv-16)
*res-static-buf*)))
(let* ((sv-16 (new 'static 'res-tag))
(s4-1 ((method-of-type res-lump get-property-data)
arg0
'cmds
'exact
-1000000000.0
(the-as pointer #f)
(& sv-16)
*res-static-buf*)))
(when s4-1
(while (and (>= s5-0 0) (< s5-0 (the-as int (-> sv-16 elt-count))))
(set! s5-0 (level-hint-process-cmd (the-as (pointer int32) s4-1) s5-0 (the-as int (-> sv-16 elt-count))))
@@ -206,8 +205,8 @@
(defmethod print-text ((this level-hint))
(when (!= *common-text* #f)
(let ((s5-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-3 s5-0)) (set! (-> v1-3 width) (the float 400)))
(let ((v1-4 s5-0)) (set! (-> v1-4 height) (the float 96)))
(set-width! s5-0 400)
(set-height! s5-0 96)
(set! (-> s5-0 flags) (font-flags shadow kerning middle large))
(print-game-text (lookup-text! *common-text* (-> this text-id-to-display) #f) s5-0 #f 128 22)))
0
@@ -369,12 +368,12 @@
(behavior ((arg0 string) (arg1 string))
(remove-setting! 'hint)
(suspend-for (seconds 1)
(when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?))
(let ((s3-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-7 s3-0)) (set! (-> v1-7 width) (the float 400)))
(let ((v1-8 s3-0)) (set! (-> v1-8 height) (the float 96)))
(set! (-> s3-0 flags) (font-flags shadow kerning middle))
(let ((s2-0 print-game-text)) (format (clear *temp-string*) "~S~S" arg0 arg1) (s2-0 *temp-string* s3-0 #f 128 22)))))
(when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?))
(let ((s3-0 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning))))
(set-width! s3-0 400)
(set-height! s3-0 96)
(set! (-> s3-0 flags) (font-flags shadow kerning middle))
(let ((s2-0 print-game-text)) (format (clear *temp-string*) "~S~S" arg0 arg1) (s2-0 *temp-string* s3-0 #f 128 22)))))
(go level-hint-exit)))
(defstate level-hint-exit (level-hint)
@@ -406,8 +405,8 @@
((zero? s5-0)
(when (and *debug-segment* (not (paused?)) (not (str-is-playing?)) (bottom-hud-hidden?))
(let ((a1-3 (new 'stack 'font-context *font-default-matrix* 56 160 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-5 a1-3)) (set! (-> v1-5 width) (the float 400)))
(let ((v1-6 a1-3)) (set! (-> v1-6 height) (the float 96)))
(set-width! a1-3 400)
(set-height! a1-3 96)
(set! (-> a1-3 flags) (font-flags shadow kerning middle large))
(print-game-text "AS: UNKNOWN ID" a1-3 #f 128 22))))
((!= s5-0 -1) (kill-current-level-hint '() '() 'exit) (process-spawn level-hint s5-0 #f (-> arg0 ambient) :to pp))))
@@ -415,7 +414,6 @@
(none)))
(defun ambient-type-sound ((arg0 drawable-ambient) (arg1 vector))
(local-vars (sv-16 string) (sv-112 res-tag))
(let* ((s5-0 (-> arg0 ambient))
(s4-0 (-> s5-0 ambient-data user-uint64 0)))
(when (>= (current-time) (the-as time-frame s4-0))
@@ -426,31 +424,31 @@
(the int (* 300.0 (-> (the-as (pointer float) v1-5) 0)))
(rand-vu-int-count (the int (* 300.0 (-> (the-as (pointer float) v1-5) 1))))))))
(when (< (the-as uint (- (current-time) (the-as int s4-0))) (the-as uint 300))
(let ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2))))))
(set! sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0)))
(let ((s4-2 (new 'stack 'sound-spec)))
(set! (-> s4-2 sound-name) (string->sound-name sv-16))
(logior! (-> s4-2 mask) (sound-mask volume))
(set! (-> s4-2 volume) 1024)
(logior! (-> s4-2 mask) (sound-mask bend))
(set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))))
(set! sv-112 (new 'static 'res-tag))
(let ((a1-7 ((method-of-type res-lump get-property-data)
s5-0
'effect-param
'exact
f30-0
(the-as pointer #f)
(& sv-112)
*res-static-buf*)))
(if a1-7 (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count)))))
(when *debug-effect-control*
(format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16)
(format #t
"volume: ~f pitch-mod: ~f~%"
(* 0.09765625 (the float (-> s4-2 volume)))
(* 0.000656168 (the float (-> s4-2 pitch-mod)))))
(sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere)))))))
(let* ((f30-0 (the float (rand-vu-int-count (the-as int (-> s5-0 ambient-data user-float 2)))))
(sv-16 (symbol->string (res-lump-struct s5-0 'effect-name symbol :time f30-0)))
(s4-2 (new 'stack 'sound-spec)))
(set! (-> s4-2 sound-name) (string->sound-name sv-16))
(logior! (-> s4-2 mask) (sound-mask volume))
(set! (-> s4-2 volume) 1024)
(logior! (-> s4-2 mask) (sound-mask bend))
(set! (-> s4-2 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))))
(let* ((sv-112 (new 'static 'res-tag))
(a1-7 ((method-of-type res-lump get-property-data)
s5-0
'effect-param
'exact
f30-0
(the-as pointer #f)
(& sv-112)
*res-static-buf*)))
(if a1-7 (effect-param->sound-spec s4-2 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count)))))
(when *debug-effect-control*
(format #t "(~5D) effect sound ~A ~S " (current-time) (res-lump-struct s5-0 'name structure) sv-16)
(format #t
"volume: ~f pitch-mod: ~f~%"
(* 0.09765625 (the float (-> s4-2 volume)))
(* 0.000656168 (the float (-> s4-2 pitch-mod)))))
(sound-play-by-spec s4-2 (new-sound-id) (-> arg0 bsphere))))))
0
(none))
@@ -620,7 +618,7 @@
(set! (-> this ambient-data user-float 0) (the-as float (new-sound-id)))
(let ((v1-28 ((method-of-type res-lump lookup-tag-idx) this 'effect-param 'exact 0.0)))
(set! (-> this ambient-data user-float 1)
(the-as float (if (< (the-as int v1-28) 0) (the-as (pointer res-tag) #f) (&-> (-> this tag) (-> v1-28 lo))))))
(the-as float (if (< (the-as int v1-28) 0) (the-as (pointer res-tag) #f) (&-> this tag (-> v1-28 lo))))))
(set! (-> this ambient-data user-float 2) (the-as float s5-0))
(set! (-> this ambient-data function) ambient-type-sound-loop))))))
(('poi)
@@ -665,7 +663,6 @@
;; ERROR: function was not converted to expressions. Cannot decompile.
(defmethod draw-debug ((this entity-ambient))
(local-vars (sv-16 uint128))
(let ((gp-0 (-> this trans))
(s5-0 (res-lump-struct this 'type symbol))
(s3-0 #f))
@@ -681,8 +678,8 @@
(set! s3-0 #t)))
((= s5-0 'hint)
(when *display-ambient-hint-marks*
(set! sv-16 (res-lump-value this 'text-id uint128))
(let ((s3-2 add-debug-text-3d)
(let ((sv-16 (res-lump-value this 'text-id uint128))
(s3-2 add-debug-text-3d)
(s2-1 #t)
(s1-1 68))
(format (clear *temp-string*) "TEXT ID #x~X" sv-16)
+163 -183
View File
@@ -24,24 +24,24 @@
;; entity basic methods
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod mem-usage ((this drawable-actor) (arg0 memory-usage-block) (arg1 int))
(defmethod mem-usage ((this drawable-actor) (usage memory-usage-block) (flags int))
"Update memory use for a drawable-actor"
(set! (-> arg0 length) (max 44 (-> arg0 length)))
(set! (-> arg0 data 43 name) "entity")
(+! (-> arg0 data 43 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> arg0 data 43 used) v1-6) (+! (-> arg0 data 43 total) (logand -16 (+ v1-6 15))))
(set! (-> usage length) (max 44 (-> usage length)))
(set! (-> usage data 43 name) "entity")
(+! (-> usage data 43 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 43 used) v1-6) (+! (-> usage data 43 total) (logand -16 (+ v1-6 15))))
;; note: does something with flags here.
(mem-usage (-> this actor) arg0 (logior arg1 64))
(mem-usage (-> this actor) usage (logior flags 64))
(the-as drawable-actor 0))
(defmethod mem-usage ((this drawable-inline-array-actor) (arg0 memory-usage-block) (arg1 int))
(defmethod mem-usage ((this drawable-inline-array-actor) (usage memory-usage-block) (flags int))
"update memory use for a group of drawable actors."
(set! (-> arg0 length) (max 1 (-> arg0 length)))
(set! (-> arg0 data 0 name) (symbol->string 'drawable-group))
(+! (-> arg0 data 0 count) 1)
(let ((v1-7 32)) (+! (-> arg0 data 0 used) v1-7) (+! (-> arg0 data 0 total) (logand -16 (+ v1-7 15))))
(set! (-> usage length) (max 1 (-> usage length)))
(set! (-> usage data 0 name) (symbol->string 'drawable-group))
(+! (-> usage data 0 count) 1)
(let ((v1-7 32)) (+! (-> usage data 0 used) v1-7) (+! (-> usage data 0 total) (logand -16 (+ v1-7 15))))
(dotimes (s3-0 (-> this length))
(mem-usage (-> this data s3-0) arg0 arg1))
(mem-usage (-> this data s3-0) usage flags))
(the-as drawable-inline-array-actor 0))
(defmethod print ((this entity-links))
@@ -415,7 +415,7 @@
(none))
(defmethod update-vis-volumes ((this level-group))
(local-vars (v1-10 symbol) (sv-16 process) (sv-32 (function process-drawable vector vector none)) (sv-48 process-tree))
(local-vars (v1-10 symbol) (sv-16 process))
(format 0 "call to update-vis-volumes, which may have a compiler bug.~%")
(dotimes (s5-0 (-> this length))
(let ((v1-3 (-> this level s5-0)))
@@ -442,12 +442,11 @@
(update-actor-vis-box (the-as process-drawable sv-16) s2-0 s1-0)
(let ((s0-2 (-> sv-16 child)))
(while s0-2
(set! sv-32 update-actor-vis-box)
(set! sv-48 (-> s0-2 0))
(let ((a0-7 (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) sv-48))
(a1-5 s2-0)
(a2-2 s1-0))
(sv-32 (the-as process-drawable a0-7) a1-5 a2-2))
(let ((sv-32 update-actor-vis-box)
(sv-48 (-> s0-2 0)))
(sv-32 (the-as process-drawable (if (and (nonzero? sv-48) (type-type? (-> sv-48 type) process-drawable)) sv-48))
s2-0
s1-0))
(set! s0-2 (-> s0-2 0 brother)))))))))))
0
(none))
@@ -455,7 +454,6 @@
(defmethod update-vis-volumes-from-nav-mesh ((this level-group))
"Update the visvol to fit the entire nav-mesh. Does this for all actors in bsps.
Probably only used for debugging."
(local-vars (sv-16 entity) (sv-32 entity))
;; loop over levels
(dotimes (s5-0 (-> this length))
(let ((v1-3 (-> this level s5-0)))
@@ -463,16 +461,19 @@
;; loop over entities
(let ((s4-0 (-> v1-3 bsp level entity)))
(dotimes (s3-0 (-> s4-0 length))
(set! sv-32 (-> s4-0 data s3-0 entity))
;; look up the bounding box.
(let* ((v0-0 (res-lump-data sv-32 'visvol (inline-array vector)))
(let* ((sv-32 (-> s4-0 data s3-0 entity))
(v0-0 (res-lump-data sv-32 'visvol (inline-array vector)))
(s1-0 (-> v0-0 0))
(s2-0 (-> v0-0 1)))
(let ((s0-0 (-> sv-32 extra trans)))
(let ((s0-0 (-> sv-32 extra trans))
(sv-16 sv-32))
;; sometimes the nav-mesh may be in a different actor, I guess.
;; so try to look that up.
(set! sv-16 sv-32)
(let* ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0))) (when v0-1 (set! sv-16 v0-1)))
(let ((v0-1 (entity-actor-lookup sv-32 'nav-mesh-actor 0)))
(when v0-1
(set! sv-16 v0-1)
(the-as entity-actor (the-as entity-actor sv-16))))
(cond
((and (type-type? (-> sv-16 type) entity-actor) (nonzero? (-> (the-as entity-actor sv-16) nav-mesh)))
;; we got a nav-mesh! compute the bounding box
@@ -504,24 +505,23 @@
(defmethod print-volume-sizes ((this level-group))
"Loop through all entities and print their visibility.
Excludes crate, fuel-cell and springbox."
(local-vars (sv-16 type) (sv-32 (function _varargs_ object)) (sv-48 symbol) (sv-64 string) (sv-80 entity))
(local-vars (sv-16 type))
(dotimes (s5-0 (-> this length))
(let ((v1-3 (-> this level s5-0)))
(when (= (-> v1-3 status) 'active)
(let ((s4-0 (-> v1-3 bsp level entity)))
(dotimes (s3-0 (-> s4-0 length))
(set! sv-80 (-> s4-0 data s3-0 entity))
;; lookup volume and dist.
(let ((s1-0 (res-lump-data sv-80 'visvol (inline-array vector)))
(f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0))
(s2-0 (-> sv-80 extra trans)))
(if (type-type? (-> sv-80 type) entity-actor)
(set! sv-16 (-> (the-as entity-actor sv-80) etype))
(set! sv-16 (the-as type #f)))
(let ((s0-0 (-> s1-0 0))
(s1-1 (-> s1-0 1)))
;; This technically will work on type objects because it just checks for value equality.
;; the code here is super weird. I have no idea what was going on, or why there are two or's.
(let* ((sv-80 (-> s4-0 data s3-0 entity))
(s1-0 (the-as object (res-lump-data sv-80 'visvol pointer)))
(f30-0 (res-lump-float sv-80 'vis-dist :default 409600.0))
(s2-0 (-> sv-80 extra trans)))
(set! sv-16
(cond
((type-type? (-> sv-80 type) entity-actor) (set! sv-16 (-> (the-as entity-actor sv-80) etype)) sv-16)
(else (the-as type #f))))
(let ((s0-0 (-> (the-as (inline-array vector) s1-0) 0))
(s1-1 (-> (the-as (inline-array vector) s1-0) 1)))
(when (not (or (name= sv-16 money) (or (name= sv-16 crate) (name= sv-16 fuel-cell) (name= sv-16 springbox))))
(format #t "actor-vis ~S ~6,,1M " (res-lump-struct sv-80 'name basic) f30-0)
(format #t
@@ -555,24 +555,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmethod debug-draw-actors ((this level-group) (arg0 symbol))
(local-vars
(sv-48 (function symbol bucket-id string vector font-color vector2h symbol))
(sv-64 symbol)
(sv-80 int)
(sv-96 (function symbol bucket-id string vector font-color vector2h symbol))
(sv-112 symbol)
(sv-128 int)
(sv-144 (function _varargs_ object))
(sv-160 string)
(sv-176 string)
(sv-192 (function symbol bucket-id string vector font-color vector2h symbol))
(sv-208 symbol)
(sv-224 int)
(sv-240 (function symbol bucket-id vector vector rgba symbol))
(sv-256 symbol)
(sv-272 int)
(sv-288 pointer)
(sv-304 pointer))
(when (and arg0 (not (or (= *master-mode* 'menu) (= *master-mode* 'progress))))
(dotimes (s4-0 (-> this length))
(let ((v1-8 (-> this level s4-0)))
@@ -585,14 +567,12 @@
((and (= arg0 'process) (-> s0-0 extra process) (type-type? (-> s0-0 extra process type) process-drawable))
(let ((s1-1 (the-as process-drawable (-> s0-0 extra process))))
(add-debug-x #t (bucket-id debug-no-zbuf) (-> s1-1 root trans) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80))
(set! sv-48 add-debug-text-3d)
(set! sv-64 #t)
(set! sv-80 68)
(let ((a2-2 (res-lump-struct s0-0 'name structure))
(a3-2 (-> s1-1 root trans))
(t0-1 1)
(t1-1 (new 'static 'vector2h :y 8)))
(sv-48 sv-64 (the-as bucket-id sv-80) (the-as string a2-2) a3-2 (the-as font-color t0-1) t1-1))
(add-debug-text-3d #t
(bucket-id debug-no-zbuf)
(res-lump-struct s0-0 'name string)
(-> s1-1 root trans)
(font-color white)
(new 'static 'vector2h :y 8))
(add-debug-text-3d #t
(bucket-id debug-no-zbuf)
(symbol->string (-> s1-1 state name))
@@ -601,20 +581,16 @@
(new 'static 'vector2h :y 16))
(let ((s0-1 (res-lump-data (-> s1-1 entity) 'eco-info (pointer int32) :time 0.0)))
(when s0-1
(set! sv-96 add-debug-text-3d)
(set! sv-112 #t)
(set! sv-128 68)
(set! sv-144 format)
(set! sv-160 (clear *temp-string*))
(set! sv-176 "~S ~D~%")
(let ((a2-7 (pickup-type->string (the-as pickup-type (-> s0-1 0))))
(a3-5 (-> s0-1 1)))
(sv-144 sv-160 sv-176 a2-7 a3-5))
(let ((a2-8 *temp-string*)
(a3-6 (-> s1-1 root trans))
(t0-4 1)
(t1-4 (new 'static 'vector2h :y 24)))
(sv-96 sv-112 (the-as bucket-id sv-128) a2-8 a3-6 (the-as font-color t0-4) t1-4))))
(let ((sv-96 add-debug-text-3d)
(sv-112 #t)
(sv-128 68))
(format (clear *temp-string*) "~S ~D~%" (pickup-type->string (the-as pickup-type (-> s0-1 0))) (-> s0-1 1))
(sv-96 sv-112
(the-as bucket-id sv-128)
*temp-string*
(-> s1-1 root trans)
(font-color white)
(new 'static 'vector2h :y 24)))))
(let ((v0-10 (res-lump-struct (-> s1-1 entity) 'art-name symbol)))
(if (and (the-as structure v0-10) (= (-> v0-10 type) symbol))
(add-debug-text-3d #t
@@ -628,13 +604,15 @@
(bucket-id debug-no-zbuf)
s1-0
(if (-> s0-0 extra process) (new 'static 'rgba :r #x80 :g #xff :b #x80 :a #x80) (new 'static 'rgba :r #xff :a #x80)))
(set! sv-192 add-debug-text-3d)
(set! sv-208 #t)
(set! sv-224 68)
(let ((a2-13 (res-lump-struct s0-0 'name structure))
(t0-8 (if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) 1 5))
(t1-8 (new 'static 'vector2h :y 8)))
(sv-192 sv-208 (the-as bucket-id sv-224) (the-as string a2-13) s1-0 (the-as font-color t0-8) t1-8)))))))))))
(let ((sv-192 add-debug-text-3d)
(sv-208 #t)
(sv-224 68))
(sv-192 sv-208
(the-as bucket-id sv-224)
(res-lump-struct s0-0 'name string)
s1-0
(if (logtest? (-> s0-0 extra perm status) (entity-perm-status bit-0 bit-1)) (font-color white) (font-color yellow))
(new 'static 'vector2h :y 8))))))))))))
(when (and *display-actor-vis* (not (or *display-actor-anim* *display-process-anim*)))
(let ((s5-1 *display-actor-vis*))
(dotimes (s4-1 (-> this length))
@@ -646,13 +624,16 @@
(let ((v0-15 (res-lump-data s0-2 'visvol pointer))
(a1-16 (-> s0-2 extra vis-id)))
(when (and v0-15 (or (= s5-1 #t) (= s5-1 'box)))
(set! sv-240 add-debug-box)
(set! sv-256 #t)
(set! sv-272 68)
(set! sv-288 (&+ v0-15 0))
(set! sv-304 (&+ v0-15 16))
(let ((t0-10 (if (is-object-visible? s3-1 a1-16) (the-as uint #x80808000) (the-as uint #x80800080))))
(sv-240 sv-256 (the-as bucket-id sv-272) (the-as vector sv-288) (the-as vector sv-304) (the-as rgba t0-10)))))
(let ((sv-240 add-debug-box)
(sv-256 #t)
(sv-272 68)
(sv-288 (&+ v0-15 0))
(sv-304 (&+ v0-15 16)))
(sv-240 sv-256
(the-as bucket-id sv-272)
(the-as vector sv-288)
(the-as vector sv-304)
(if (is-object-visible? s3-1 a1-16) (new 'static 'rgba :g #x80 :b #x80 :a #x80) (new 'static 'rgba :r #x80 :b #x80 :a #x80))))))
(when (or (= s5-1 #t) (= s5-1 'sphere))
(let ((s0-3 (-> s0-2 extra process)))
(when s0-3
@@ -757,7 +738,7 @@
(countdown (s2-4 (-> s3-4 length))
(add-debug-box #t
(bucket-id debug)
(the-as vector (-> s3-4 data s2-4))
(-> s3-4 data s2-4 min)
(the-as vector (+ (the-as uint (-> s3-4 data 0 max)) (* s2-4 32)))
(if (zero? (-> s4-4 index)) (new 'static 'rgba :g #x80 :b #x80 :a #x80) (new 'static 'rgba :r #xff :g #x80 :b #x80 :a #x80))))))))))
(when (or *display-ambient-hint-marks*
@@ -1033,7 +1014,6 @@
(< (vector-vector-distance (-> this trans) arg0) (-> *ACTOR-bank* birth-dist))))
(defmethod actors-update ((this level-group))
(local-vars (sv-16 vector) (sv-24 int) (sv-32 entity-links) (sv-48 int) (sv-64 string) (sv-80 int))
(when *compact-actors*
(if (and (= *compact-actors* 'debug) (= (-> *nk-dead-pool* alive-list prev) (-> *nk-dead-pool* first-gap)))
(churn *nk-dead-pool* 1))
@@ -1042,99 +1022,99 @@
(the int (lerp-scale 8.0 1.0 (the float (-> *display* frames (-> *display* last-screen) frame run-time)) 2000.0 8000.0))))
(when (not (paused?))
(let ((s5-1 (-> *display* frames (-> *display* last-screen) frame run-time)))
(let ((f0-5 (fmax (meters 80) (fmin (+ (meters 80) (* (meters 0.05) (the float (- 7000 s5-1)))) (-> *ACTOR-bank* birth-dist)))))
(seek! (-> *ACTOR-bank* pause-dist) f0-5 (* 81920.0 (-> *display* seconds-per-frame))))
(let ((f0-5 (fmax 327680.0 (fmin (+ 327680.0 (* 204.8 (the float (- 7000 s5-1)))) (-> *ACTOR-bank* birth-dist)))))
(seek! (-> *ACTOR-bank* pause-dist) f0-5 (* 81920.0 (seconds-per-frame))))
(seekl! (-> *ACTOR-bank* birth-max) (the int (lerp-scale 25.0 1.0 (the float s5-1) 2000.0 7000.0)) 10))
(if (movie?) (set! (-> *ACTOR-bank* birth-max) 1000)))
(when *spawn-actors*
(set! sv-16 (camera-pos))
(set! sv-24 0)
(dotimes (s5-2 (-> this length))
(let ((s4-2 (-> this level s5-2)))
(when (= (-> s4-2 status) 'active)
(cond
((= (-> s4-2 display?) 'special)
(let* ((s4-3 (-> s4-2 entity))
(s3-1 (-> s4-3 length)))
(dotimes (s2-0 s3-1)
(let ((v1-44 (-> s4-3 data s2-0)))
(cond
((logtest? (-> v1-44 perm status) (entity-perm-status bit-7))
(when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> v1-44 entity))
(set! sv-24 (+ sv-24 1))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-44 entity)))))))))
((= (-> s4-2 display?) 'special-vis)
(let* ((s3-2 (-> s4-2 entity))
(s2-1 (-> s3-2 length)))
(dotimes (s1-0 s2-1)
(let ((s0-0 (-> s3-2 data s1-0)))
(cond
((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id)))
(when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> s0-0 entity))
(set! sv-24 (+ sv-24 1))))
(else
(when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3))))
(kill! (-> s0-0 entity))
(set! sv-24 (+ sv-24 1))))))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))))
((= (-> s4-2 display?) 'actor)
(let* ((s4-4 (-> s4-2 entity))
(s3-3 (-> s4-4 length)))
(dotimes (s2-2 s3-3)
(let ((v1-84 (-> s4-4 data s2-2)))
(cond
(#t
(when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> v1-84 entity))
(set! sv-24 (+ sv-24 1))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-84 entity)))))))))
((not *vis-actors*)
(let* ((s4-5 (-> s4-2 entity))
(s3-4 (-> s4-5 length)))
(dotimes (s2-3 s3-4)
(let ((s1-1 (-> s4-5 data s2-3)))
(cond
((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist))
(not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))))
(when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> s1-1 entity))
(set! sv-24 (+ sv-24 1))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) (kill! (-> s1-1 entity)))))))))
(*vis-actors*
(when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?)))
(let* ((s3-5 (-> s4-2 entity))
(s2-4 (-> s3-5 length))
(s0-1 #f))
(dotimes (s1-2 s2-4)
(set! sv-32 (-> s3-5 data s1-2))
(cond
((and (#if PC_PORT
(or (with-pc (not (-> *pc-settings* ps2-actor-vis?))) (is-object-visible? s4-2 (-> sv-32 vis-id)))
(is-object-visible? s4-2 (-> sv-32 vis-id)))
(zero? (logand (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))))
(when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1))
(birth! (-> sv-32 entity))
(set! sv-24 (+ sv-24 1))
(when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1)
(let ((s0-2 format))
(set! sv-48 0)
(set! sv-64 "WARNING: low actor memory, no birth triggered!!! ~D/~D~%")
(set! sv-80 (memory-free *nk-dead-pool*))
(let ((a3-2 (memory-total *nk-dead-pool*))) (s0-2 sv-48 sv-64 sv-80 a3-2)))
(set! s0-1 #t))))
(else
(when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3))))
(kill! (-> sv-32 entity))
(set! sv-24 (+ sv-24 1)))))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))))))))))
(let ((sv-16 (camera-pos))
(sv-24 0))
(dotimes (s5-2 (-> this length))
(let ((s4-2 (-> this level s5-2)))
(when (= (-> s4-2 status) 'active)
(cond
((= (-> s4-2 display?) 'special)
(let* ((s4-3 (-> s4-2 entity))
(s3-1 (-> s4-3 length)))
(dotimes (s2-0 s3-1)
(let ((v1-44 (-> s4-3 data s2-0)))
(cond
((logtest? (-> v1-44 perm status) (entity-perm-status bit-7))
(when (not (or (-> v1-44 process) (logtest? (-> v1-44 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> v1-44 entity))
(+! sv-24 1)
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> v1-44 process) (not (logtest? (-> v1-44 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-44 entity)))))))))
((= (-> s4-2 display?) 'special-vis)
(let* ((s3-2 (-> s4-2 entity))
(s2-1 (-> s3-2 length)))
(dotimes (s1-0 s2-1)
(let ((s0-0 (-> s3-2 data s1-0)))
(cond
((and (logtest? (-> s0-0 perm status) (entity-perm-status bit-7)) (is-object-visible? s4-2 (-> s0-0 vis-id)))
(when (not (or (-> s0-0 process) (logtest? (-> s0-0 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> s0-0 entity))
(+! sv-24 1)))
(else
(when (and (-> s0-0 process) (not (logtest? (-> s0-0 perm status) (entity-perm-status bit-3))))
(kill! (-> s0-0 entity))
(+! sv-24 1)))))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f))))))
((= (-> s4-2 display?) 'actor)
(let* ((s4-4 (-> s4-2 entity))
(s3-3 (-> s4-4 length)))
(dotimes (s2-2 s3-3)
(let ((v1-84 (-> s4-4 data s2-2)))
(cond
(#t
(when (not (or (-> v1-84 process) (logtest? (-> v1-84 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> v1-84 entity))
(+! sv-24 1)
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> v1-84 process) (not (logtest? (-> v1-84 perm status) (entity-perm-status bit-3)))) (kill! (-> v1-84 entity)))))))))
((not *vis-actors*)
(let* ((s4-5 (-> s4-2 entity))
(s3-4 (-> s4-5 length)))
(dotimes (s2-3 s3-4)
(let ((s1-1 (-> s4-5 data s2-3)))
(cond
((and (< (vector-vector-distance (-> s1-1 trans) sv-16) (-> *ACTOR-bank* birth-dist))
(not (logtest? (-> s1-1 perm status) (entity-perm-status bit-9 bit-10))))
(when (not (or (-> s1-1 process) (logtest? (-> s1-1 perm status) (entity-perm-status bit-0 dead))))
(birth! (-> s1-1 entity))
(+! sv-24 1)
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))
(else
(if (and (-> s1-1 process) (not (logtest? (-> s1-1 perm status) (entity-perm-status bit-3)))) (kill! (-> s1-1 entity)))))))))
(*vis-actors*
(when (not (and (-> s4-2 vis-info 0) (-> s4-2 all-visible?)))
(let* ((s3-5 (-> s4-2 entity))
(s2-4 (-> s3-5 length))
(s0-1 #f))
(dotimes (s1-2 s2-4)
(let ((sv-32 (-> s3-5 data s1-2)))
(cond
;; og:preserve-this check for actor culling setting
((and (#if PC_PORT
(or (with-pc (not (-> *pc-settings* ps2-actor-vis?))) (is-object-visible? s4-2 (-> sv-32 vis-id)))
(is-object-visible? s4-2 (-> sv-32 vis-id)))
(not (logtest? (-> sv-32 perm status) (entity-perm-status bit-9 bit-10))))
(when (not (or (-> sv-32 process) (logtest? (-> sv-32 perm status) (entity-perm-status bit-0 dead)) s0-1))
(birth! (-> sv-32 entity))
(+! sv-24 1)
(when (< (/ (the float (memory-free *nk-dead-pool*)) (the float (memory-total *nk-dead-pool*))) 0.1)
(format 0
"WARNING: low actor memory, no birth triggered!!! ~D/~D~%"
(memory-free *nk-dead-pool*)
(memory-total *nk-dead-pool*))
(set! s0-1 #t))))
(else
(when (and (-> sv-32 process) (not (logtest? (-> sv-32 perm status) (entity-perm-status bit-3))))
(kill! (-> sv-32 entity))
(+! sv-24 1)))))
(if (>= sv-24 (-> *ACTOR-bank* birth-max)) (return (the-as object #f)))))))))))))
0)
(defun entity-birth-no-kill ((arg0 entity))
+25 -27
View File
@@ -78,8 +78,8 @@ This is updated from the entity system used in Crash 2, which had most of these
(set! (-> this allocated-length) data-count)
(set! (-> this data-size) data-size)
(set! (-> this length) 0)
(set! (-> this data-base) (&-> (-> this tag) data-count))
(set! (-> this data-top) (&-> (-> this tag) data-count))
(set! (-> this data-base) (&-> this tag data-count))
(set! (-> this data-top) (&-> this tag data-count))
this))
(defmethod length ((this res-lump))
@@ -516,24 +516,23 @@ This is updated from the entity system used in Crash 2, which had most of these
(defmethod mem-usage ((this res-lump) (block memory-usage-block) (flags int))
"Get the memory usage of this lump and its data"
(local-vars (sv-16 int))
;; get the name and ID
(let ((mem-use-id (mem-usage-id res))
(mem-use-name "res"))
(cond
((nonzero? (logand flags 256)) (set! mem-use-id (mem-usage-id camera)) (set! mem-use-name "camera"))
((nonzero? (logand flags 64)) (set! mem-use-id (mem-usage-id entity)) (set! mem-use-name "entity"))
((nonzero? (logand flags 128)) (set! mem-use-id (mem-usage-id ambient)) (set! mem-use-name "ambient"))
((nonzero? (logand flags 512)) (set! mem-use-id (mem-usage-id art-joint-geo)) (set! mem-use-name "art-joint-geo")))
((logtest? flags 256) (set! mem-use-id (mem-usage-id camera)) (set! mem-use-name "camera"))
((logtest? flags 64) (set! mem-use-id (mem-usage-id entity)) (set! mem-use-name "entity"))
((logtest? flags 128) (set! mem-use-id (mem-usage-id ambient)) (set! mem-use-name "ambient"))
((logtest? flags 512) (set! mem-use-id (mem-usage-id art-joint-geo)) (set! mem-use-name "art-joint-geo")))
;; set up the block
(set! (-> block length) (max (-> block length) (+ mem-use-id 1)))
(set! (-> block data mem-use-id name) mem-use-name)
;; the lump counts as 1 in the count field
(set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1))
(+! (-> block data mem-use-id count) 1)
;; add the size of the lump itself.
(let ((obj-size (asize-of this)))
(set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) obj-size))
(set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ obj-size 15)))))
(+! (-> block data mem-use-id used) obj-size)
(+! (-> block data mem-use-id total) (logand -16 (+ obj-size 15))))
;; add the tags
(dotimes (tag-idx (-> this length))
(when (zero? (-> this tag tag-idx inlined?))
@@ -549,35 +548,34 @@ This is updated from the entity system used in Crash 2, which had most of these
;; this seems identical to the else case.
(set! (-> block length) (max (-> block length) (+ mem-use-id 1)))
(set! (-> block data mem-use-id name) mem-use-name)
(set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1))
(+! (-> block data mem-use-id count) 1)
(let ((v1-47 (asize-of tag-data)))
(set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-47))
(set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-47 15))))))
((nav-mesh collide-mesh)
;; these have their own implementation.
(mem-usage tag-data block flags))
(+! (-> block data mem-use-id used) v1-47)
(+! (-> block data mem-use-id total) (logand -16 (+ v1-47 15)))))
;; these have their own implementation.
((nav-mesh collide-mesh) (mem-usage (the-as collide-mesh tag-data) block flags))
((array)
(set! (-> block length) (max (-> block length) (+ mem-use-id 1)))
(set! (-> block data mem-use-id name) mem-use-name)
(set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1))
(+! (-> block data mem-use-id count) 1)
(let ((v1-63 (asize-of (the-as (array object) tag-data))))
(set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-63))
(set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-63 15)))))
(+! (-> block data mem-use-id used) v1-63)
(+! (-> block data mem-use-id total) (logand -16 (+ v1-63 15))))
;; call mem usage on all of our children.
(set! sv-16 0)
(while (< sv-16 (-> (the-as array tag-data) length))
(let ((a0-58 (-> (the-as (array object) tag-data) sv-16)))
((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags))
(set! sv-16 (+ sv-16 1))))
(let ((sv-16 0))
(while (< sv-16 (-> (the-as array tag-data) length))
(let ((a0-58 (-> (the-as (array object) tag-data) sv-16)))
((method-of-type (rtype-of a0-58) mem-usage) a0-58 block flags))
(+! sv-16 1))))
(else
;; unknown type.
;; we assume its nothing fancy and use the asize of.
(set! (-> block length) (max (-> block length) (+ mem-use-id 1)))
(set! (-> block data mem-use-id name) mem-use-name)
(set! (-> block data mem-use-id count) (+ (-> block data mem-use-id count) 1))
(+! (-> block data mem-use-id count) 1)
(let ((v1-88 (asize-of tag-data)))
(set! (-> block data mem-use-id used) (+ (-> block data mem-use-id used) v1-88))
(set! (-> block data mem-use-id total) (+ (-> block data mem-use-id total) (logand -16 (+ v1-88 15))))))))))))
(+! (-> block data mem-use-id used) v1-88)
(+! (-> block data mem-use-id total) (logand -16 (+ v1-88 15)))))))))))
(the-as res-lump 0))
(define *res-static-buf* (malloc 'global 128))
+46 -104
View File
@@ -47,8 +47,8 @@
((!= s5-0 (-> this last-frame-group))
(set! (-> this res) (-> s5-0 extra))
(let ((v1-6 (-> (lookup-tag-idx (-> s5-0 extra) 'effect-name 'base -1000000000.0) lo)))
(set! (-> this name) (if (>= (the-as int v1-6) 0) (&-> (-> s5-0 extra tag) v1-6) (the-as (pointer res-tag) #f))))
(if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) (set! (-> this name) (&-> (-> this name) 1)))
(set! (-> this name) (if (>= (the-as int v1-6) 0) (&-> s5-0 extra tag v1-6) (the-as (pointer res-tag) #f))))
(if (and (-> this name) (= (-> this name 0 key-frame) -1000000000.0)) (set! (-> this name) (&-> this name 1)))
(effect-control-method-14 this f30-0 f30-0 f30-0))
((or (not (-> this name)) (= f30-0 (-> this last-frame-num))))
(else
@@ -102,16 +102,6 @@
(none))
(defmethod effect-control-method-10 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int))
(local-vars
(sv-160 int)
(sv-176 symbol)
(sv-192 symbol)
(sv-208 symbol)
(sv-224 int)
(sv-240 symbol)
(sv-256 symbol)
(sv-272 symbol)
(sv-288 res-lump))
(let ((s3-0 (-> arg0 value))
(s5-0 (cond
((< arg2 0)
@@ -158,28 +148,16 @@
(when (and (nonzero? s3-0) (= (-> (the-as sparticle-launch-group s3-0) type) sparticle-launch-group))
(if *debug-effect-control*
(format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> this process name) arg0 arg1 s5-0))
(let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-1
(let ((t9-7 (method-of-type part-tracker activate)))
(t9-7 (the-as part-tracker s4-1) (-> this process) 'part-tracker (the-as pointer #x70004000)))
(let ((s2-1 run-function-in-process)
(s1-0 s4-1)
(s0-0 part-tracker-init))
(set! sv-160 -1)
(set! sv-176 (the-as symbol #f))
(set! sv-192 (the-as symbol #f))
(set! sv-208 (the-as symbol #f))
(let ((t3-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0))))
((the-as (function object object object object object object object object none) s2-1)
s1-0
s0-0
(the-as sparticle-launch-group s3-0)
sv-160
sv-176
sv-192
sv-208
t3-0)))
(-> s4-1 ppointer)))))
(process-spawn part-tracker
:init
part-tracker-init
(the-as sparticle-launch-group s3-0)
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0))
:to (-> this process))))
((= arg0 'camera-shake) (activate! *camera-smush-control* 819.2 37 600 1.0 0.995))
((zero? s3-0) (effect-control-method-12 this arg0 arg1 s5-0 (-> this res) (string->sound-name (symbol->string arg0))))
((= (-> (the-as basic s3-0) type) sparticle-launcher)
@@ -191,28 +169,16 @@
((= (-> (the-as basic s3-0) type) sparticle-launch-group)
(if *debug-effect-control*
(format #t "(~5D) effect group ~A ~A frame ~F joint ~D~%" (current-time) (-> this process name) arg0 arg1 s5-0))
(let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-3
(let ((t9-19 (method-of-type part-tracker activate)))
(t9-19 (the-as part-tracker s4-3) (-> this process) 'part-tracker (the-as pointer #x70004000)))
(let ((s2-3 run-function-in-process)
(s1-2 s4-3)
(s0-2 part-tracker-init))
(set! sv-224 -1)
(set! sv-240 (the-as symbol #f))
(set! sv-256 (the-as symbol #f))
(set! sv-272 (the-as symbol #f))
(let ((t3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0))))
((the-as (function object object object object object object object object none) s2-3)
s1-2
s0-2
s3-0
sv-224
sv-240
sv-256
sv-272
t3-1)))
(-> s4-3 ppointer))))
(process-spawn part-tracker
:init
part-tracker-init
s3-0
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data s5-0))
:to (-> this process)))
((= (-> (the-as basic s3-0) type) sound-spec)
(sound-play-by-spec (the-as sound-spec s3-0)
(new-sound-id)
@@ -232,23 +198,18 @@
(set! (-> v1-67 death-timer) (+ a0-55 1)))
(set! (-> v1-67 death-timer-org) (-> v1-67 death-timer))
(set! (-> v1-67 death-draw-overlap) (-> (the-as death-info s3-0) overlap)))
(when (-> (the-as death-info s3-0) sound)
(let* ((s2-5 this)
(s1-3 (method-of-object s2-5 effect-control-method-12))
(s0-3 (-> (the-as death-info s3-0) sound)))
(set! sv-288 (-> this res))
(let ((t1-11 (string->sound-name (symbol->string (-> (the-as death-info s3-0) sound)))))
(s1-3 s2-5 s0-3 arg1 s5-0 sv-288 t1-11))))
(if (-> (the-as death-info s3-0) sound)
(effect-control-method-12 this
(-> (the-as death-info s3-0) sound)
arg1
s5-0
(-> this res)
(string->sound-name (symbol->string (-> (the-as death-info s3-0) sound)))))
(send-event (-> this process) 'death-start (the-as death-info s3-0)))
(else (effect-control-method-12 this arg0 arg1 s5-0 (-> this res) (string->sound-name (symbol->string arg0)))))))
0)
(defmethod effect-control-method-11 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 pat-surface))
(local-vars
(sv-48 (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none))
(sv-64 sparticle-system)
(sv-80 (function sparticle-system sparticle-launcher vector sparticle-launch-state sparticle-launch-control float none))
(sv-96 sparticle-system))
(let ((s1-0 (the-as sound-name #f)))
(let ((a0-4 (-> *display* frames (-> *display* last-screen) frame run-time)))
(case arg0
@@ -408,14 +369,8 @@
((= v1-36 (pat-material swamp)) (-> *part-id-table* 2257))
((= v1-36 (pat-material neutral)) (-> *part-id-table* 2773))
(else (-> *part-id-table* 96)))))
(when (nonzero? s0-0)
(set! sv-48 sp-launch-particles-var)
(set! sv-64 *sp-particle-system-2d*)
(let ((a2-36 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)))
(a3-6 #f)
(t0-1 #f)
(t1-1 1.0))
(sv-48 sv-64 s0-0 a2-36 (the-as sparticle-launch-state a3-6) (the-as sparticle-launch-control t0-1) t1-1)))))
(if (nonzero? s0-0)
(launch-particles s0-0 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))))))
(('effect-jump-droppings)
(let* ((v1-61 (-> arg4 material))
(s0-1 (cond
@@ -436,22 +391,15 @@
((= v1-61 (pat-material swamp)) (-> *part-id-table* 2270))
((= v1-61 (pat-material neutral)) (-> *part-id-table* 2774))
(else (-> *part-id-table* 107)))))
(when (nonzero? s0-1)
(set! sv-80 sp-launch-particles-var)
(set! sv-96 *sp-particle-system-2d*)
(let ((a2-37 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)))
(a3-7 #f)
(t0-2 #f)
(t1-2 1.0))
(sv-80 sv-96 s0-1 a2-37 (the-as sparticle-launch-state a3-7) (the-as sparticle-launch-control t0-2) t1-2)))))))
(if (nonzero? s0-1)
(launch-particles s0-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2))))))))
(if s1-0 (effect-control-method-12 this arg0 arg1 arg2 arg3 s1-0)))
0
(none))
(defmethod effect-control-method-12 ((this effect-control) (arg0 symbol) (arg1 float) (arg2 int) (arg3 basic) (arg4 sound-name))
(local-vars (sv-112 res-tag) (sv-128 sound-name) (sv-144 basic) (sv-160 (function vector vector float)))
(set! sv-144 arg3)
(let ((s0-0 arg4)
(let ((sv-144 arg3)
(s0-0 arg4)
(gp-0 (new 'stack 'sound-spec))
(s5-0 (if (< arg2 0) (the-as vector #f) (vector<-cspace! (new 'stack-no-clear 'vector) (-> this process node-list data arg2)))))
(set! (-> gp-0 sound-name) s0-0)
@@ -459,26 +407,20 @@
(set! (-> gp-0 volume) 1024)
(logior! (-> gp-0 mask) (sound-mask bend))
(set! (-> gp-0 bend) (the int (* 327.66998 (rand-vu-float-range -100.0 100.0))))
(set! sv-112 (new 'static 'res-tag))
(let* ((t9-3 (method-of-type res-lump get-property-data))
(a1-6 'effect-param)
(a2-1 'exact)
(a3-1 arg1)
(t0-1 #f)
(t1-1 (the-as (pointer res-tag) (& sv-112)))
(t2-0 *res-static-buf*)
(a1-7 (t9-3 (the-as res-lump sv-144) a1-6 a2-1 a3-1 (the-as pointer t0-1) t1-1 t2-0)))
(let* ((sv-112 (new 'static 'res-tag))
(a1-7 ((method-of-type res-lump get-property-data)
(the-as res-lump sv-144)
'effect-param
'exact
arg1
(the-as pointer #f)
(& sv-112)
*res-static-buf*)))
(if a1-7 (effect-param->sound-spec gp-0 (the-as (pointer float) a1-7) (the-as int (-> sv-112 elt-count)))))
(if (and (nonzero? (-> gp-0 fo-max))
(let ((f30-1 (* 4096.0 (the float (-> gp-0 fo-max)))))
(set! sv-160 vector-vector-distance)
(let ((a0-6 (ear-trans))
(a1-8 s5-0))
(< f30-1 (sv-160 a0-6 a1-8)))))
(if (and (nonzero? (-> gp-0 fo-max)) (< (* 4096.0 (the float (-> gp-0 fo-max))) (vector-vector-distance (ear-trans) s5-0)))
(return 0))
(when *debug-effect-control*
(set! sv-128 s0-0)
(string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128)))
(let ((sv-128 s0-0)) (string<-charp (clear *temp-string*) (the-as (pointer uint8) (& sv-128))))
(format #t
"(~5D) effect sound ~A ~A (~S) frame ~F joint ~D "
(current-time)
+2 -2
View File
@@ -154,9 +154,9 @@
(goto cfg-10))
;; remember who we belong to
(set! (-> this process) proc)
(set! tag (new 'static 'res-tag))
;; eco may override the pickup type and amount, so try to get this.
(let ((v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0)))
(let* ((tag (new 'static 'res-tag))
(v1-6 (res-lump-data ent 'eco-info (pointer int32) :tag-ptr (& tag) :time 0.0)))
(cond
(v1-6
;; eco-info lookup succeeded,
+3 -2
View File
@@ -143,7 +143,7 @@
The cause can be 'dead if you die, or 'game to reset everything.
If save-to-load is not #f will load data from that.
If continue-point-override is not #f, will use that."
(local-vars (v0-0 int) (sv-96 symbol))
(local-vars (v0-0 int))
(case cause
(('dead)
;; reload game-info because we died. Increase death counts
@@ -534,7 +534,8 @@
(none))))
(process-spawn-function process
(lambda ((arg0 process-drawable))
(let ((s5-0 (current-time))) (until (time-elapsed? s5-0 (seconds 0.6)) (send-event arg0 'effect 'eco-blue) (suspend)))
(suspend-for (seconds 0.6)
(send-event arg0 'effect 'eco-blue))
(none))
s5-1
:from
+24 -31
View File
@@ -17,7 +17,6 @@
;; Having two state machines, one in C++ and one in GOAL is kind of a questionable and confusing design.
(define-extern mark-speedrun-started (function none))
;; DECOMP BEGINS
;; version identifier
(defconstant SAVE_VERSION 1)
@@ -187,19 +186,14 @@
(let ((tag (the-as game-save-tag (-> this tag)))
(tag-idx 0))
(while (< (the-as int tag) (the-as int (&-> this tag 0 user-int8 (-> this length))))
(let ((a3-2 (game-save-elt->string (-> tag elt-type)))
(t0-1 (-> tag elt-count))
(t1-1 (-> tag elt-size))
(t2-1 (-> tag user-uint64))
(t3-0 (-> tag user-float0)))
(format #t
"~T [~3D] ~-32S [~3D/~3D] ~12D ~8f "
tag-idx
(game-save-elt->string (-> tag elt-type))
(-> tag elt-count)
(-> tag elt-size)
(-> tag user-uint64)
(-> tag user-float0)))
(format #t
"~T [~3D] ~-32S [~3D/~3D] ~12D ~8f "
tag-idx
(game-save-elt->string (-> tag elt-type))
(-> tag elt-count)
(-> tag elt-size)
(-> tag user-uint64)
(-> tag user-float0))
(let ((v1-0 (-> tag elt-type)))
(if (or (= v1-0 (game-save-elt name)) (= v1-0 (game-save-elt continue)))
(format #t "= \"~G\"~%" (&+ (the-as pointer tag) 16))
@@ -327,7 +321,7 @@
(set! (-> s2-0 elt-type) (game-save-elt name))
(set! (-> s2-0 elt-count) (+ (length arg1) 1))
(set! (-> s2-0 elt-size) (the-as uint 1)))
(copy-charp<-charp (the-as (pointer uint8) (-> (the-as (inline-array game-save-tag) s3-2) 1)) (-> arg1 data))
(copy-charp<-charp (-> (the-as (inline-array game-save-tag) s3-2) 1 user-uint8) (-> arg1 data))
(let ((v1-37 (&+ (the-as pointer s3-2) (+ (logand -16 (+ (-> (the-as (inline-array game-save-tag) s3-2) 0 elt-count) 15)) 16))))
(let ((a0-15 (the-as game-save-tag (&+ v1-37 0))))
(set! (-> a0-15 elt-type) (game-save-elt base-time))
@@ -354,7 +348,7 @@
(set! (-> s2-1 elt-type) (game-save-elt continue))
(set! (-> s2-1 elt-count) (+ ((method-of-type string length) s3-3) 1))
(set! (-> s2-1 elt-size) (the-as uint 1)))
(copy-charp<-charp (the-as (pointer uint8) (the-as game-save-tag (&+ (the-as game-save-tag s4-1) 16))) (-> s3-3 data)))
(copy-charp<-charp (-> (the-as game-save-tag (&+ (the-as game-save-tag s4-1) 16)) user-uint8) (-> s3-3 data)))
(let ((v1-50 (&+ (the-as pointer s4-1) (+ (logand -16 (+ (-> (the-as game-save-tag s4-1) elt-count) 15)) 16))))
(let ((a0-24 (the-as game-save-tag (&+ v1-50 0))))
(set! (-> a0-24 elt-type) (game-save-elt life))
@@ -836,36 +830,35 @@
((method-of-type process deactivate) this)
(none))
(defmethod relocate ((this auto-save) (arg0 int))
(defmethod relocate ((this auto-save) (offset int))
"Relocate an auto-save process by arg0 bytes."
;; update our reference particle launch control, which is allocated on our process heap
(if (nonzero? (-> this part)) (&+! (-> this part) arg0))
(if (nonzero? (-> this part)) (&+! (-> this part) offset))
;; then relocate the process. This will relocate the heap (memory, and basics on it).
(the-as auto-save ((method-of-type process relocate) this arg0)))
(the-as auto-save ((method-of-type process relocate) this offset)))
(defbehavior auto-save-post auto-save ()
;; debug text
(when (and (= *cheat-mode* 'debug) (logtest? (-> *cpad-list* cpads 0 button0-abs 0) (pad-buttons l3)))
(when (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3))
(let ((gp-0 (new 'stack 'font-context *font-default-matrix* 32 160 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-5 gp-0)) (set! (-> v1-5 width) (the float 440)))
(let ((v1-6 gp-0)) (set! (-> v1-6 height) (the float 80)))
(set-width! gp-0 440)
(set-height! gp-0 80)
(set! (-> gp-0 flags) (font-flags shadow kerning))
(format (clear *temp-string*) "~S / ~S ~D~%" (-> self mode) (-> self state name) (-> self which))
(print-game-text *temp-string* gp-0 #f 128 22)))
;; auto-save drawing
(when (and (= (-> self mode) 'auto-save) (!= (-> self next-state name) 'done))
(let ((gp-1 (new 'stack 'font-context *font-default-matrix* 20 40 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-15 gp-1)) (set! (-> v1-15 scale) 0.8))
(let ((v1-16 gp-1)) (set! (-> v1-16 width) (the float 472)))
(let ((v1-17 gp-1)) (set! (-> v1-17 height) (the float 20)))
(set-scale! gp-1 0.8)
(set-width! gp-1 472)
(set-height! gp-1 20)
(set! (-> gp-1 flags) (font-flags shadow kerning middle middle-vert large))
;; if this is the first time saving, display a warning.
(when (zero? (-> *game-info* auto-save-count))
(print-game-text (lookup-text! *common-text* (text-id saving-data) #f) gp-1 #f 128 22)
(set! (-> gp-1 origin x) 20.0)
(set! (-> gp-1 origin y) 130.0)
(let ((v1-23 gp-1)) (set! (-> v1-23 scale) 0.7))
(let ((v1-24 gp-1)) (set! (-> v1-24 height) (the float 40)))
(set-scale! gp-1 0.7)
(set-height! gp-1 40)
(let ((s5-2 print-game-text))
((the-as (function object string object none) format)
(clear *temp-string*)
@@ -908,7 +901,7 @@
(set! (-> self result) (mc-status-code ok))
(set! (-> self save) #f)
(set! (-> self notify) (process->handle notify-proc))
(set! (-> self part) (create-launch-control (-> *part-group-id-table* 656) self))
(set! (-> self part) (create-launch-control group-part-save-icon self))
(set! (-> self part matrix) (sprite-allocate-user-hvdf))
(cond
((= desired-mode 'auto-save)
@@ -1068,7 +1061,7 @@
(debug-print (-> self save) (user? dass)))
(label cfg-7)
(set! (-> self result)
(mc-save (-> self card) (-> self which) (&-> (-> self save) type) (the-as int (-> self save info-int32))))
(mc-save (-> self card) (-> self which) (&-> self save type) (the-as int (-> self save info-int32))))
(when (!= (-> self result) (mc-status-code ok))
(suspend)
(goto cfg-7))
@@ -1184,7 +1177,7 @@
(activate-progress *dproc* (progress-screen auto-save))))))))
(defun auto-save-command ((arg0 symbol) (arg1 int) (arg2 int) (arg3 process-tree))
(process-spawn auto-save arg0 arg3 arg1 arg2)
(process-spawn auto-save arg0 arg3 arg1 arg2 :stack *kernel-dram-stack*)
(none))
(defun auto-save-check ()
+52 -60
View File
@@ -67,52 +67,48 @@
(-> gp-0 match)))
(defun projectile-collision-reaction ((arg0 collide-shape-moving) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(local-vars (sv-64 vector) (sv-68 vector) (sv-72 matrix) (sv-80 int) (sv-224 symbol))
(set! sv-64 (new-stack-vector0))
(set! sv-68 (new-stack-vector0))
(set! sv-72 (new 'stack-no-clear 'matrix))
(set! sv-80 0)
(set! (-> sv-72 vector 0 quad) (-> arg3 quad))
(let ((a1-1 (new 'stack-no-clear 'vector)))
(vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u))
(move-by-vector! arg0 a1-1))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(case (-> arg1 best-tri pat material)
(((pat-material stopproj)) (send-event (-> arg0 process) 'die)))
(vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect))
(set! (-> sv-64 w) 1.0)
(vector-normalize! sv-64 1.0)
(set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal)))
(let ((v1-22 (-> sv-64 quad))) (set! (-> sv-68 quad) v1-22))
(when (= (-> arg1 best-u) 0.0)
(let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) (move-by-vector! arg0 a1-7)))
(set! (-> arg0 surface-normal quad) (-> sv-68 quad))
(set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad))
(set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal)))
(set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal)))
(set! (-> arg0 touch-angle)
(vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)))
(if (< (-> arg0 poly-angle) -0.2) (set! sv-80 (logior sv-80 16)))
(set! sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))
(if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf)))
(set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))))
(set! sv-80 (logior sv-80 4))
(if (-> arg1 best-to-prim) (set! sv-80 (logior sv-80 32)))
(cond
(sv-224
(set! sv-80 (logior sv-80 8))
(set! (-> arg0 cur-pat mode) 1)
(set! (-> arg0 local-normal quad) (-> sv-68 quad)))
(else (set! sv-80 (logior sv-80 1)) (set! (-> arg0 local-normal quad) (-> sv-68 quad))))
(vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68)
(when (and (not sv-224) (>= (-> arg0 coverage) 0.9))
(set! sv-80 (logior sv-80 2))
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(when (!= (-> arg0 poly-pat mode) (pat-mode wall))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad))))
(logior! (-> arg0 status) sv-80)
(the-as cshape-moving-flags sv-80))
(let ((sv-64 (new-stack-vector0))
(sv-68 (new-stack-vector0))
(sv-72 (new 'stack-no-clear 'matrix))
(sv-80 0))
(set! (-> sv-72 vector 0 quad) (-> arg3 quad))
(let ((a1-1 (new 'stack-no-clear 'vector)))
(vector-float*! a1-1 (-> arg1 move-vec) (-> arg1 best-u))
(move-by-vector! arg0 a1-1))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(case (-> arg1 best-tri pat material)
(((pat-material stopproj)) (send-event (-> arg0 process) 'die)))
(vector-! sv-64 (-> arg1 best-from-prim prim-core world-sphere) (-> arg1 best-tri intersect))
(set! (-> sv-64 w) 1.0)
(vector-normalize! sv-64 1.0)
(set! (-> arg0 coverage) (vector-dot sv-64 (-> arg1 best-tri normal)))
(set! (-> sv-68 quad) (-> sv-64 quad))
(when (= (-> arg1 best-u) 0.0)
(let ((a1-7 (vector-float*! (new 'stack-no-clear 'vector) sv-68 32.0))) (move-by-vector! arg0 a1-7)))
(set! (-> arg0 surface-normal quad) (-> sv-68 quad))
(set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad))
(set! (-> arg0 surface-angle) (vector-dot sv-68 (-> arg0 dynam gravity-normal)))
(set! (-> arg0 poly-angle) (vector-dot (-> arg0 poly-normal) (-> arg0 dynam gravity-normal)))
(set! (-> arg0 touch-angle)
(vector-dot sv-68 (vector-normalize! (vector-negate! (new-stack-vector0) (the-as vector sv-72)) 1.0)))
(if (< (-> arg0 poly-angle) -0.2) (logior! sv-80 16))
(let ((sv-224 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))))
(if (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf)))
(set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal)))))
(logior! sv-80 4)
(if (-> arg1 best-to-prim) (logior! sv-80 32))
(cond
(sv-224 (logior! sv-80 8) (set! (-> arg0 cur-pat mode) 1) (set! (-> arg0 local-normal quad) (-> sv-68 quad)))
(else (logior! sv-80 1) (set! (-> arg0 local-normal quad) (-> sv-68 quad))))
(vector-reflect-flat-above! arg2 (the-as vector sv-72) sv-68)
(when (and (not sv-224) (>= (-> arg0 coverage) 0.9))
(logior! sv-80 2)
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(when (!= (-> arg0 poly-pat mode) (pat-mode wall))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad)))))
(logior! (-> arg0 status) sv-80)
(the-as cshape-moving-flags sv-80)))
(defpartgroup group-yellow-eco-fireball
:id 102
@@ -882,7 +878,6 @@
(none))
(defun spawn-projectile-blue ((arg0 target))
(local-vars (sv-48 entity-actor))
(with-pp
(when arg0
(let ((s3-0 (rand-vu-int-range 3 (+ (-> arg0 node-list length) -1)))
@@ -898,19 +893,16 @@
(t9-5 (the-as projectile-blue s4-1) pp 'projectile-blue (the-as pointer #x70004000)))
(let ((s2-0 run-function-in-process)
(s1-0 s4-1)
(s0-0 projectile-init-by-other))
(set! sv-48 (-> pp entity))
(let ((a3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0)))
(t1-0 8)
(t2-0 (process->handle pp)))
((the-as (function process function object object object object object object) s2-0)
s1-0
s0-0
sv-48
a3-1
gp-0
t1-0
t2-0)))
(s0-0 projectile-init-by-other)
(sv-48 (-> pp entity)))
((the-as (function process function object object object object object object) s2-0)
s1-0
s0-0
sv-48
(vector<-cspace! (new 'stack-no-clear 'vector) (-> arg0 node-list data s3-0))
gp-0
8
(process->handle pp)))
(-> s4-1 ppointer)))))
0
(none)))
+36 -67
View File
@@ -34,25 +34,6 @@
(defmethod debug-draw ((this cylinder) (arg0 vector4w))
"Debug draw a cylinder. This is slow and ugly"
(local-vars
(sv-896 matrix)
(sv-912 int)
(sv-928 (function vector vector vector float vector))
(sv-944 vector)
(sv-960 vector)
(sv-976 vector)
(sv-992 (function vector vector vector float vector))
(sv-1008 vector)
(sv-1024 vector)
(sv-1040 vector)
(sv-1056 (function vector vector vector float vector))
(sv-1072 vector)
(sv-1088 vector)
(sv-1104 vector)
(sv-1120 (function vector vector vector float vector))
(sv-1136 vector)
(sv-1152 vector)
(sv-1168 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -69,41 +50,30 @@
(s4-0 (new 'stack-no-clear 'cylinder-verts))
(s3-0 (new 'stack-no-clear 'matrix)))
(matrix-axis-angle! s3-0 (-> this axis) 4096.0)
(set! sv-896 (new 'stack-no-clear 'matrix))
(vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0)
(let ((v1-5 (-> s3-0 vector 3)))
(.lvf vf4 (&-> (-> this origin) quad))
(.lvf vf5 (&-> sv-896 vector 0 quad))
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-5 quad) vf6))
(set! sv-912 0)
(while (< sv-912 8)
(vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0)
(vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912))
(set! sv-912 (+ sv-912 1)))
(let ((sv-896 (new 'stack-no-clear 'matrix)))
(vector-matrix*! (the-as vector sv-896) (-> this origin) s3-0)
(let ((v1-5 (-> s3-0 vector 3)))
(.lvf vf4 (&-> (-> this origin) quad))
(.lvf vf5 (&-> sv-896 vector 0 quad))
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-5 quad) vf6)))
(let ((sv-912 0))
(while (< sv-912 8)
(vector+! (-> s5-0 vert (+ sv-912 8)) (-> this origin) s1-0)
(vector+float*! (-> s5-0 vert (+ sv-912 8)) (-> s5-0 vert (+ sv-912 8)) s0-0 (the float sv-912))
(+! sv-912 1)))
(dotimes (s0-1 8)
(set! sv-928 vector+float*!)
(set! sv-944 (-> s5-0 vert s0-1))
(set! sv-960 (-> this origin))
(set! sv-976 s1-0)
(let ((a3-1 (cos (* 2048.0 (the float (- 7 s0-1)))))) (sv-928 sv-944 sv-960 sv-976 a3-1))
(set! sv-992 vector+float*!)
(set! sv-1008 (-> s5-0 vert s0-1))
(set! sv-1024 (-> s5-0 vert s0-1))
(set! sv-1040 (-> this axis))
(let ((a3-2 (* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))) (sv-992 sv-1008 sv-1024 sv-1040 a3-2))
(set! sv-1056 vector+float*!)
(set! sv-1072 (-> s5-0 vert (+ s0-1 16)))
(set! sv-1088 (-> this origin))
(set! sv-1104 s1-0)
(let ((a3-3 (cos (* 2048.0 (the float s0-1))))) (sv-1056 sv-1072 sv-1088 sv-1104 a3-3))
(set! sv-1120 vector+float*!)
(set! sv-1136 (-> s5-0 vert (+ s0-1 16)))
(set! sv-1152 (-> s5-0 vert (+ s0-1 16)))
(set! sv-1168 (-> this axis))
(let ((a3-4 (+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1)))))))
(sv-1120 sv-1136 sv-1152 sv-1168 a3-4)))
(vector+float*! (-> s5-0 vert s0-1) (-> this origin) s1-0 (cos (* 2048.0 (the float (- 7 s0-1)))))
(vector+float*! (-> s5-0 vert s0-1)
(-> s5-0 vert s0-1)
(-> this axis)
(* (- (-> this radius)) (sin (* 2048.0 (the float (- 7 s0-1))))))
(vector+float*! (-> s5-0 vert (+ s0-1 16)) (-> this origin) s1-0 (cos (* 2048.0 (the float s0-1))))
(vector+float*! (-> s5-0 vert (+ s0-1 16))
(-> s5-0 vert (+ s0-1 16))
(-> this axis)
(+ (-> this length) (* (-> this radius) (sin (* 2048.0 (the float s0-1)))))))
(dotimes (s2-1 16)
(dotimes (s1-1 24)
(vector-matrix*! (-> s4-0 vert s1-1) (-> s5-0 vert s1-1) s3-0)
@@ -153,7 +123,6 @@
(defmethod debug-draw ((this cylinder-flat) (arg0 vector4w))
(local-vars (sv-448 vector) (sv-464 int))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -170,19 +139,19 @@
(s4-0 (new 'stack-no-clear 'cylinder-flat-verts))
(s3-0 (new 'stack-no-clear 'matrix)))
(matrix-axis-angle! s3-0 (-> this axis) 4096.0)
(set! sv-448 (new 'stack-no-clear 'vector))
(vector-matrix*! sv-448 (-> this origin) s3-0)
(let ((v1-5 (-> s3-0 vector 3)))
(.lvf vf4 (&-> (-> this origin) quad))
(.lvf vf5 (&-> sv-448 quad))
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-5 quad) vf6))
(set! sv-464 0)
(while (< sv-464 8)
(vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0)
(vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464))
(set! sv-464 (+ sv-464 1)))
(let ((sv-448 (new 'stack-no-clear 'vector)))
(vector-matrix*! sv-448 (-> this origin) s3-0)
(let ((v1-5 (-> s3-0 vector 3)))
(.lvf vf4 (&-> (-> this origin) quad))
(.lvf vf5 (&-> sv-448 quad))
(.mov.vf.w vf6 vf0)
(.sub.vf.xyz vf6 vf4 vf5)
(.svf (&-> v1-5 quad) vf6)))
(let ((sv-464 0))
(while (< sv-464 8)
(vector+! (-> s5-0 vert (+ sv-464 1)) (-> this origin) s1-0)
(vector+float*! (-> s5-0 vert (+ sv-464 1)) (-> s5-0 vert (+ sv-464 1)) s0-0 (the float sv-464))
(+! sv-464 1)))
(set! (-> s5-0 vert 0 quad) (-> this origin quad))
(vector+float*! (-> s5-0 vert 9) (-> this origin) (-> this axis) (-> this length))
(dotimes (s2-1 16)
+3 -5
View File
@@ -44,7 +44,6 @@
(new (symbol type process symbol float) _type_)))
(defmethod new path-control ((allocation symbol) (type-to-make type) (proc process) (name symbol) (time float))
(local-vars (tag res-tag))
(let ((this (object-new allocation type-to-make (the-as int (-> type-to-make size)))))
(when (zero? this)
;; allocation failed.
@@ -56,11 +55,10 @@
(let ((ent (-> proc entity)))
(when (= name 'path)
;; if we are a path, try to look up the path-actor.
(let ((lookup-entity (entity-actor-lookup (the-as res-lump ent) 'path-actor 0)))
(if lookup-entity (set! ent lookup-entity))))
(let ((lookup-entity (entity-actor-lookup ent 'path-actor 0))) (if lookup-entity (set! ent lookup-entity))))
;; look up the curve data
(set! tag (new 'static 'res-tag))
(let ((data (res-lump-data ent name pointer :tag-ptr (& tag) :time time)))
(let* ((tag (new 'static 'res-tag))
(data (res-lump-data ent name pointer :tag-ptr (& tag) :time time)))
(cond
(data
;; success, we got some data
+87 -95
View File
@@ -13,107 +13,99 @@
(if (< 0.00001 (fabs f1-1)) (/ (- (-> arg0 w) f0-1) f1-1) 409600000.0)))
(defmethod init-vol! ((this plane-volume) (arg0 symbol) (arg1 vector-array) (arg2 vector-array))
(local-vars
(sv-144 vector)
(sv-148 float)
(sv-152 int)
(sv-160 vector)
(sv-176 vector)
(sv-192 vector)
(sv-208 vector)
(sv-224 vector)
(sv-240 int)
(sv-256 int))
(set! (-> this volume-type) arg0)
(set! (-> this point-count) 0)
(set! (-> this first-point) (the-as (pointer vector) (-> arg1 data (-> arg1 length))))
(set! (-> this normal-count) 0)
(set! (-> this first-normal) (the-as (pointer vector) (-> arg2 data (-> arg2 length))))
(dotimes (s3-0 (-> this num-planes))
(set! sv-176 (new 'stack-no-clear 'vector))
(set! (-> sv-176 quad) (the-as uint128 0))
(set! sv-192 (new 'stack-no-clear 'vector))
(set! (-> sv-192 quad) (the-as uint128 0))
(set! sv-208 (new 'stack-no-clear 'vector))
(set! (-> sv-208 quad) (the-as uint128 0))
(set! sv-224 (new 'stack-no-clear 'vector))
(set! (-> sv-224 quad) (the-as uint128 0))
0.0
0.0
0.0
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(let ((s1-0 (new-stack-vector0))
(s0-0 0)
(s2-0 (-> this plane)))
(set! sv-240 0)
(while (< sv-240 (-> this num-planes))
(when (!= s3-0 sv-240)
(vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w))
(vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0)))
(vector-normalize! sv-192 1.0)
(vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240)))
(vector-normalize! sv-208 1.0)
(let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208)))
(when (!= f0-4 409600000.0)
(vector+float*! sv-224 sv-176 sv-208 f0-4)
(set! sv-144 (new-stack-vector0))
(set! sv-148 0.0)
(set! sv-152 0)
(set! sv-160 (new-stack-vector0))
(set! (-> sv-144 quad) (-> sv-224 quad))
(set! sv-256 0)
(while (< sv-256 (-> this num-planes))
(when (and (!= sv-256 s3-0) (!= sv-256 sv-240))
(let ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192)))
(cond
((= f30-0 409600000.0))
((zero? sv-152)
(vector+float*! sv-144 sv-144 sv-192 f30-0)
(set! (-> sv-160 quad) (-> s2-0 sv-256 quad))
(set! sv-148 8192000.0)
(set! sv-152 1))
((begin (vector-float*! sv-224 sv-192 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)))
((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0)
(when (< (fabs f30-0) (fabs sv-148))
(set! sv-148 f30-0)
(set! sv-152 (+ sv-152 1))))
(else
(vector+float*! sv-144 sv-144 sv-192 f30-0)
(set! (-> sv-160 quad) (-> s2-0 sv-256 quad))
(set! sv-152 (+ sv-152 1))
(if (< (fabs f30-0) (fabs sv-148)) (set! sv-148 (- sv-148 f30-0)) (set! sv-148 0.0))))))
(set! sv-256 (+ sv-256 1)))
(cond
((zero? sv-152))
((= sv-148 0.0))
(else
(dotimes (v1-70 (-> this num-planes))
(when (and (!= v1-70 s3-0) (!= v1-70 sv-240))
(if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) (goto cfg-42))))
(vector+float*! sv-224 sv-144 sv-192 sv-148)
(cond
((< (-> arg1 allocated-length) (+ (-> arg1 length) 2))
(format 0 "ERROR <AG>: vol-control #x~X out of volume points~%" this))
(else
(set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad))
(set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad))
(+! (-> arg1 length) 2)
(+! (-> this point-count) 2)))
(vector+! s1-0 s1-0 sv-144)
(vector+! s1-0 s1-0 sv-224)
(+! s0-0 2))))))
(label cfg-42)
(set! sv-240 (+ sv-240 1)))
(when (nonzero? s0-0)
(vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0)))
(cond
((< (-> arg2 allocated-length) (+ (-> arg2 length) 2))
(format 0 "ERROR <AG>: vol-control #x~X out of volume normals~%" this))
(else
(set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad))
(set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad))
(+! (-> arg2 length) 2)
(set! (-> this normal-count) (+ (-> this normal-count) 2)))))))
(let ((sv-176 (new 'stack-no-clear 'vector)))
(set! (-> sv-176 quad) (the-as uint128 0))
(let ((sv-192 (new 'stack-no-clear 'vector)))
(set! (-> sv-192 quad) (the-as uint128 0))
(let ((sv-208 (new 'stack-no-clear 'vector)))
(set! (-> sv-208 quad) (the-as uint128 0))
(let ((sv-224 (new 'stack-no-clear 'vector)))
(set! (-> sv-224 quad) (the-as uint128 0))
0.0
0.0
0.0
(set! (-> (new 'stack-no-clear 'vector) quad) (the-as uint128 0))
(let ((s1-0 (new-stack-vector0))
(s0-0 0)
(s2-0 (-> this plane)))
(let ((sv-240 0))
(while (< sv-240 (-> this num-planes))
(when (!= s3-0 sv-240)
(vector-float*! sv-176 (the-as vector (-> s2-0 sv-240)) (-> s2-0 sv-240 w))
(vector-cross! sv-192 (the-as vector (-> s2-0 sv-240)) (the-as vector (-> s2-0 s3-0)))
(vector-normalize! sv-192 1.0)
(vector-cross! sv-208 sv-192 (the-as vector (-> s2-0 sv-240)))
(vector-normalize! sv-208 1.0)
(let ((f0-4 (plane-volume-intersect-dist (-> s2-0 s3-0) sv-176 sv-208)))
(when (!= f0-4 409600000.0)
(vector+float*! sv-224 sv-176 sv-208 f0-4)
(let ((sv-144 (new-stack-vector0))
(sv-148 0.0)
(sv-152 0))
(let ((sv-160 (new-stack-vector0)))
(set! (-> sv-144 quad) (-> sv-224 quad))
(let ((sv-256 0))
(while (< sv-256 (-> this num-planes))
(when (and (!= sv-256 s3-0) (!= sv-256 sv-240))
(let ((f30-0 (plane-volume-intersect-dist (-> s2-0 sv-256) sv-144 sv-192)))
(cond
((= f30-0 409600000.0))
((zero? sv-152)
(vector+float*! sv-144 sv-144 sv-192 f30-0)
(set! (-> sv-160 quad) (-> s2-0 sv-256 quad))
(set! sv-148 8192000.0)
(set! sv-152 1))
((begin (vector-float*! sv-224 sv-192 f30-0) (>= (vector-dot sv-224 sv-160) 0.0)))
((>= (vector-dot sv-224 (the-as vector (-> s2-0 sv-256))) 0.0)
(when (< (fabs f30-0) (fabs sv-148))
(set! sv-148 f30-0)
(+! sv-152 1)))
(else
(vector+float*! sv-144 sv-144 sv-192 f30-0)
(set! (-> sv-160 quad) (-> s2-0 sv-256 quad))
(+! sv-152 1)
(set! sv-148
(cond
((< (fabs f30-0) (fabs sv-148)) (set! sv-148 (- sv-148 f30-0)) sv-148)
(else 0.0)))))))
(+! sv-256 1))))
(cond
((zero? sv-152))
((= sv-148 0.0))
(else
(dotimes (v1-70 (-> this num-planes))
(when (and (!= v1-70 s3-0) (!= v1-70 sv-240))
(if (< 4096.0 (- (vector-dot sv-144 (the-as vector (-> s2-0 v1-70))) (the-as float (-> s2-0 v1-70 w)))) (goto cfg-42))))
(vector+float*! sv-224 sv-144 sv-192 sv-148)
(cond
((< (-> arg1 allocated-length) (+ (-> arg1 length) 2))
(format 0 "ERROR <AG>: vol-control #x~X out of volume points~%" this))
(else
(set! (-> arg1 data (-> arg1 length) quad) (-> sv-144 quad))
(set! (-> arg1 data (+ (-> arg1 length) 1) quad) (-> sv-224 quad))
(+! (-> arg1 length) 2)
(+! (-> this point-count) 2)))
(vector+! s1-0 s1-0 sv-144)
(vector+! s1-0 s1-0 sv-224)
(+! s0-0 2)))))))
(label cfg-42)
(+! sv-240 1)))
(when (nonzero? s0-0)
(vector-float*! s1-0 s1-0 (/ 1.0 (the float s0-0)))
(cond
((< (-> arg2 allocated-length) (+ (-> arg2 length) 2))
(format 0 "ERROR <AG>: vol-control #x~X out of volume normals~%" this))
(else
(set! (-> arg2 data (-> arg2 length) quad) (-> s1-0 quad))
(set! (-> arg2 data (+ (-> arg2 length) 1) quad) (-> s2-0 s3-0 quad))
(+! (-> arg2 length) 2)
(set! (-> this normal-count) (+ (-> this normal-count) 2)))))))))))
#f)
(defmethod debug-draw ((this plane-volume))
+10 -11
View File
@@ -105,7 +105,6 @@
(fmax -127.0 (fmin 127.0 f30-0))))
(defun ripple-find-height ((arg0 process-drawable) (arg1 int) (arg2 vector))
(local-vars (sv-16 float) (sv-32 float))
(let* ((f30-0 (-> arg0 root trans y))
(v1-1 (-> arg0 draw))
(a1-5 (-> v1-1 lod-set lod (-> v1-1 cur-lod) geo effect)))
@@ -129,13 +128,13 @@
(ripple-update-waveform-offs s5-0)
(let* ((f22-1 (the float (the int f28-1)))
(f24-1 (the float (the int f26-1)))
(f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1)))
(set! sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1))
(set! sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1)))
(let* ((f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1)))
(f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0))))
(f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32))))
(f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22))))
(f0-23 (-> gp-0 faded-scale)))
(if (< f0-23 0.0) (set! f0-23 (-> gp-0 global-scale)))
(+ f30-0 (* (/ f1-12 128) f0-23))))))))
(f20-0 (ripple-slow-add-sine-waves s5-0 f22-1 f24-1))
(sv-16 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) f24-1))
(sv-32 (ripple-slow-add-sine-waves s5-0 f22-1 (+ 1.0 f24-1)))
(f1-6 (ripple-slow-add-sine-waves s5-0 (+ 1.0 f22-1) (+ 1.0 f24-1)))
(f0-22 (+ f20-0 (* (- f28-1 f22-1) (- sv-16 f20-0))))
(f1-9 (+ sv-32 (* (- f28-1 f22-1) (- f1-6 sv-32))))
(f1-12 (+ f0-22 (* (- f26-1 f24-1) (- f1-9 f0-22))))
(f0-23 (-> gp-0 faded-scale)))
(if (< f0-23 0.0) (set! f0-23 (-> gp-0 global-scale)))
(+ f30-0 (* (/ f1-12 128) f0-23)))))))
+7 -6
View File
@@ -40,6 +40,7 @@
((fog-end float)
(fog-start float)))
(defun fog-corrector-setup ((corrector fog-corrector) (math-cam math-camera))
"Set the fog corrector based on the supplied math-camera"
(set! (-> corrector fog-end) (* (-> math-cam fog-end) (-> math-cam fov-correction-factor)))
@@ -81,8 +82,8 @@
(let ((x-rat (-> math-cam x-ratio))
(y-rat (-> math-cam y-ratio))
(cull-info (-> math-cam cull-info)))
(let ((x-thing (/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (* x-rat x-rat))))
(y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (* y-rat y-rat)))))
(/ (+ 1.0 (* 4.0 x-rat x-rat)) (+ 1.0 (square x-rat)))
(let ((y-thing (/ (+ 1.0 (* 4.0 y-rat y-rat)) (+ 1.0 (square y-rat)))))
(set! (-> cull-info x-fact) (/ (+ 1.0 (* 4.0 x-rat x-rat)) (* x-rat (sqrtf (+ 1.0 (* 16.0 x-rat x-rat))))))
(set! (-> cull-info y-fact) (/ (+ 1.0 (* 4.0 y-rat y-rat)) (* y-rat (sqrtf (+ 1.0 (* 16.0 y-rat y-rat))))))
(set! (-> cull-info z-fact)
@@ -98,8 +99,8 @@
(d-temp-2 (-> math-cam d))
(dx-rat-times-4 (* 4.0 dx-rat-2))
(d-temp-3 (-> math-cam d)))
(let ((inverse-x-len (/ 1.0 (sqrtf (+ (* dx-rat-2 dx-rat-2) (* d-temp-2 d-temp-2)))))
(inverse-x-len-2 (/ 1.0 (sqrtf (+ (* dx-rat-times-4 dx-rat-times-4) (* d-temp-3 d-temp-3))))))
(let ((inverse-x-len (/ 1.0 (sqrtf (+ (square dx-rat-2) (square d-temp-2)))))
(inverse-x-len-2 (/ 1.0 (sqrtf (+ (square dx-rat-times-4) (square d-temp-3))))))
(set! (-> cull-info xz-dir-ax) (* dx-rat-2 inverse-x-len))
(set! (-> cull-info xz-dir-az) (* d-temp-2 inverse-x-len))
(set! (-> cull-info xz-dir-bx) (* dx-rat-times-4 inverse-x-len-2))
@@ -109,8 +110,8 @@
(d-temp-4 (-> math-cam d))
(dy-rat-times-4 (* 4.0 dy-rat))
(d-temp-5 (-> math-cam d)))
(let ((inverse-y-len (/ 1.0 (sqrtf (+ (* dy-rat dy-rat) (* d-temp-4 d-temp-4)))))
(inverse-y-len-2 (/ 1.0 (sqrtf (+ (* dy-rat-times-4 dy-rat-times-4) (* d-temp-5 d-temp-5))))))
(let ((inverse-y-len (/ 1.0 (sqrtf (+ (square dy-rat) (square d-temp-4)))))
(inverse-y-len-2 (/ 1.0 (sqrtf (+ (square dy-rat-times-4) (square d-temp-5))))))
(set! (-> cull-info yz-dir-ay) (* dy-rat inverse-y-len))
(set! (-> cull-info yz-dir-az) (* d-temp-4 inverse-y-len))
(set! (-> cull-info yz-dir-by) (* dy-rat-times-4 inverse-y-len-2))
+38 -44
View File
@@ -27,8 +27,8 @@
(set! (-> v1-2 direction w) 0.0))
(set-vector! (-> arg0 dir1 color) 0.8 0.775 0.7 1.0)
(set! (-> arg0 dir1 levels x) arg3)
(vector-matrix*! (the-as vector (-> arg0 dir0)) (the-as vector (-> arg0 dir0)) s4-0)
(vector-matrix*! (the-as vector (-> arg0 dir1)) (the-as vector (-> arg0 dir1)) s4-0))
(vector-matrix*! (-> arg0 dir0 direction) (-> arg0 dir0 direction) s4-0)
(vector-matrix*! (-> arg0 dir1 direction) (-> arg0 dir1 direction) s4-0))
(let ((v1-4 (-> arg0 dir2)))
(set! (-> v1-4 direction x) 0.0)
(set! (-> v1-4 direction y) -1.0)
@@ -210,11 +210,7 @@
(set! (-> v1-0 y) (- (-> arg0 direction y)))
(set! (-> v1-0 z) (- (-> arg0 direction z)))
(when (< (-> arg0 direction y) 0.9063)
(let* ((f0-7 0.4226)
(f1-1 (-> v1-0 x))
(f1-3 (* f1-1 f1-1))
(f2-0 (-> v1-0 z))
(f0-8 (/ f0-7 (sqrtf (+ f1-3 (* f2-0 f2-0))))))
(let ((f0-8 (/ 0.4226 (sqrtf (+ (square (-> v1-0 x)) (square (-> v1-0 z)))))))
(set! (-> v1-0 x) (* (-> v1-0 x) f0-8))
(set! (-> v1-0 y) -0.9063)
(set! (-> v1-0 z) (* (-> v1-0 z) f0-8)))))
@@ -241,12 +237,12 @@
(set! (-> s5-0 x) (* 2.0 (-> s5-0 x)))
(set! (-> s5-0 y) (* 2.0 (-> s5-0 y)))
(set! (-> s5-0 z) (* 2.0 (-> s5-0 z)))
(vector+float*! (the-as vector s4-0) (-> arg2 amb-color) (-> arg2 lgt-color) (-> arg2 direction y))
(vector*! (the-as vector s4-0) (the-as vector s4-0) (-> *ocean-map-village2* far-color))
(vector+float*! (-> s4-0 fog-color) (-> arg2 amb-color) (-> arg2 lgt-color) (-> arg2 direction y))
(vector*! (-> s4-0 fog-color) (-> s4-0 fog-color) (-> *ocean-map-village2* far-color))
(set! (-> s4-0 fog-color x) (* 2.0 (-> s4-0 fog-color x)))
(set! (-> s4-0 fog-color y) (* 2.0 (-> s4-0 fog-color y)))
(set! (-> s4-0 fog-color z) (* 2.0 (-> s4-0 fog-color z)))
(vector4-lerp! s5-0 s5-0 (the-as vector s4-0) 0.5))
(vector4-lerp! s5-0 s5-0 (-> s4-0 fog-color) 0.5))
(let ((f0-15 (* 0.003921569 (- 255.0 (-> arg0 fog-dists w))))) (vector4-lerp! s5-0 s5-0 (-> arg0 fog-color) f0-15)))
0
(none))
@@ -660,7 +656,7 @@
:shadow
(new 'static 'vector :x 0.5393 :y 0.7652 :z -0.3514)))))
(update-mood-shadow-direction (the-as mood-lights (-> *village1-mood-lights-table* data)))
(update-mood-shadow-direction (-> *village1-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *village1-mood-lights-table* data 1))
@@ -940,7 +936,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *snow-mood-lights-table* data)))
(update-mood-shadow-direction (-> *snow-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *snow-mood-lights-table* data 1))
@@ -948,8 +944,7 @@
(update-mood-shadow-direction (-> *snow-mood-lights-table* data 3))
(update-mood-erase-color (the-as mood-fog (-> *snow-mood-fog-table* data))
(the-as mood-lights (-> *snow-mood-lights-table* data)))
(update-mood-erase-color (-> *snow-mood-fog-table* data 0) (-> *snow-mood-lights-table* data 0))
(update-mood-erase-color (-> *snow-mood-fog-table* data 2) (-> *snow-mood-lights-table* data 1))
@@ -958,7 +953,7 @@
(update-mood-erase-color (-> *snow-mood-fog-table* data 6) (-> *snow-mood-lights-table* data 3))
(update-mood-erase-color2 (-> *snow-mood-fog-table* data 1)
(the-as mood-lights (-> *snow-mood-lights-table* data))
(-> *snow-mood-lights-table* data 0)
(-> *snow-mood-lights-table* data 1))
(update-mood-erase-color2 (-> *snow-mood-fog-table* data 3)
@@ -971,46 +966,46 @@
(update-mood-erase-color2 (-> *snow-mood-fog-table* data 7)
(-> *snow-mood-lights-table* data 3)
(the-as mood-lights (-> *snow-mood-lights-table* data)))
(-> *snow-mood-lights-table* data 0))
(vector4-lerp! (-> *snow-mood-fog-table* data 0 erase-color)
(-> *snow-mood-fog-table* data 0 erase-color)
(the-as vector (-> *snow-mood-fog-table* data))
(-> *snow-mood-fog-table* data 0 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 1 erase-color)
(-> *snow-mood-fog-table* data 1 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 1))
(-> *snow-mood-fog-table* data 1 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 2 erase-color)
(-> *snow-mood-fog-table* data 2 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 2))
(-> *snow-mood-fog-table* data 2 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 3 erase-color)
(-> *snow-mood-fog-table* data 3 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 3))
(-> *snow-mood-fog-table* data 3 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 4 erase-color)
(-> *snow-mood-fog-table* data 4 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 4))
(-> *snow-mood-fog-table* data 4 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 5 erase-color)
(-> *snow-mood-fog-table* data 5 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 5))
(-> *snow-mood-fog-table* data 5 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 6 erase-color)
(-> *snow-mood-fog-table* data 6 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 6))
(-> *snow-mood-fog-table* data 6 fog-color)
0.41)
(vector4-lerp! (-> *snow-mood-fog-table* data 7 erase-color)
(-> *snow-mood-fog-table* data 7 erase-color)
(the-as vector (-> *snow-mood-fog-table* data 7))
(-> *snow-mood-fog-table* data 7 fog-color)
0.41)
(define *snow-mood-sun-table*
@@ -1428,7 +1423,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *misty-mood-lights-table* data)))
(update-mood-shadow-direction (-> *misty-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *misty-mood-lights-table* data 1))
@@ -1623,7 +1618,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *village2-mood-lights-table* data)))
(update-mood-shadow-direction (-> *village2-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *village2-mood-lights-table* data 1))
@@ -1812,7 +1807,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *swamp-mood-lights-table* data)))
(update-mood-shadow-direction (-> *swamp-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *swamp-mood-lights-table* data 1))
@@ -1937,7 +1932,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *sunken-mood-lights-table* data)))
(update-mood-shadow-direction (-> *sunken-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *sunken-mood-lights-table* data 1))
@@ -2102,7 +2097,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *rolling-mood-lights-table* data)))
(update-mood-shadow-direction (-> *rolling-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *rolling-mood-lights-table* data 1))
@@ -2300,7 +2295,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *firecanyon-mood-lights-table* data)))
(update-mood-shadow-direction (-> *firecanyon-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *firecanyon-mood-lights-table* data 1))
@@ -2521,7 +2516,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *ogre-mood-lights-table* data)))
(update-mood-shadow-direction (-> *ogre-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *ogre-mood-lights-table* data 1))
@@ -2616,7 +2611,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *ogre2-mood-lights-table* data)))
(update-mood-shadow-direction (-> *ogre2-mood-lights-table* data 0))
(update-mood-shadow-direction (-> *ogre2-mood-lights-table* data 1))
@@ -2680,7 +2675,7 @@
(new 'static 'mood-lights)
(new 'static 'mood-lights))))
(update-mood-shadow-direction (the-as mood-lights (-> *ogre3-mood-lights-table* data)))
(update-mood-shadow-direction (-> *ogre3-mood-lights-table* data 0))
(define *village3-mood-fog-table*
(new 'static
@@ -2931,7 +2926,7 @@
:shadow
(new 'static 'vector :y -1.0)))))
(update-mood-shadow-direction (the-as mood-lights (-> *lavatube-mood-lights-table* data)))
(update-mood-shadow-direction (-> *lavatube-mood-lights-table* data 0))
(define *lavatube-mood-sun-table*
(new 'static
@@ -3085,8 +3080,7 @@
:erase-color
(new 'static 'vector :w 128.0)))))
(update-mood-erase-color (the-as mood-fog (-> *finalboss-mood-fog-table* data))
(the-as mood-lights (-> *village1-mood-lights-table* data)))
(update-mood-erase-color (-> *finalboss-mood-fog-table* data 0) (-> *village1-mood-lights-table* data 0))
(update-mood-erase-color (-> *finalboss-mood-fog-table* data 1) (-> *village1-mood-lights-table* data 1))
@@ -3107,42 +3101,42 @@
(vector4-lerp! (-> *finalboss-mood-fog-table* data 0 erase-color)
(-> *finalboss-mood-fog-table* data 0 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data))
(-> *finalboss-mood-fog-table* data 0 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 1 erase-color)
(-> *finalboss-mood-fog-table* data 1 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 1))
(-> *finalboss-mood-fog-table* data 1 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 2 erase-color)
(-> *finalboss-mood-fog-table* data 2 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 2))
(-> *finalboss-mood-fog-table* data 2 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 3 erase-color)
(-> *finalboss-mood-fog-table* data 3 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 3))
(-> *finalboss-mood-fog-table* data 3 fog-color)
1.0)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 4 erase-color)
(-> *finalboss-mood-fog-table* data 4 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 4))
(-> *finalboss-mood-fog-table* data 4 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 5 erase-color)
(-> *finalboss-mood-fog-table* data 5 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 5))
(-> *finalboss-mood-fog-table* data 5 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 6 erase-color)
(-> *finalboss-mood-fog-table* data 6 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 6))
(-> *finalboss-mood-fog-table* data 6 fog-color)
0.41)
(vector4-lerp! (-> *finalboss-mood-fog-table* data 7 erase-color)
(-> *finalboss-mood-fog-table* data 7 erase-color)
(the-as vector (-> *finalboss-mood-fog-table* data 7))
(-> *finalboss-mood-fog-table* data 7 fog-color)
0.41)
(define *citadel-mood-fog-table*
+40 -73
View File
@@ -228,9 +228,9 @@
(else
(set! (-> arg0 sky-times s5-0) (- 1.0 f30-0))
(set! (-> arg0 sky-times s4-0) f30-0)
(vector4-lerp! (the-as vector (-> arg0 current-sun))
(the-as vector (-> arg0 mood-sun-table data s5-0))
(the-as vector (-> arg0 mood-sun-table data s4-0))
(vector4-lerp! (-> arg0 current-sun sun-color)
(-> arg0 mood-sun-table data s5-0 sun-color)
(-> arg0 mood-sun-table data s4-0 sun-color)
f30-0)
(vector4-lerp! (-> arg0 current-sun env-color)
(the-as vector (+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32)))
@@ -287,7 +287,6 @@
(update-mood-prt-color arg0)))
(defun update-mood-interp ((arg0 mood-context) (arg1 mood-context) (arg2 mood-context) (arg3 float))
(local-vars (sv-16 light))
(cond
((= arg3 0.0)
(set! (-> arg0 current-fog fog-color quad) (-> arg1 current-fog fog-color quad))
@@ -310,27 +309,21 @@
(set! (-> arg0 current-shadow-color quad) (-> arg2 current-shadow-color quad))
(quad-copy! (the-as pointer (-> arg0 light-group)) (the-as pointer (-> arg2 light-group)) 12))
(else
(vector4-lerp! (the-as vector (-> arg0 current-fog))
(the-as vector (-> arg1 current-fog))
(the-as vector (-> arg2 current-fog))
arg3)
(vector4-lerp! (-> arg0 current-fog fog-color) (-> arg1 current-fog fog-color) (-> arg2 current-fog fog-color) arg3)
(vector4-lerp! (-> arg0 current-fog fog-dists) (-> arg1 current-fog fog-dists) (-> arg2 current-fog fog-dists) arg3)
(vector4-lerp! (-> arg0 current-fog erase-color)
(-> arg1 current-fog erase-color)
(-> arg2 current-fog erase-color)
arg3)
(vector4-lerp! (-> arg0 current-prt-color) (-> arg1 current-prt-color) (-> arg2 current-prt-color) arg3)
(vector4-lerp! (the-as vector (-> arg0 current-sun))
(the-as vector (-> arg1 current-sun))
(the-as vector (-> arg2 current-sun))
arg3)
(vector4-lerp! (-> arg0 current-sun sun-color) (-> arg1 current-sun sun-color) (-> arg2 current-sun sun-color) arg3)
(vector4-lerp! (-> arg0 current-sun env-color) (-> arg1 current-sun env-color) (-> arg2 current-sun env-color) arg3)
(vector4-lerp! (-> arg0 current-shadow) (-> arg1 current-shadow) (-> arg2 current-shadow) arg3)
(vector4-lerp! (-> arg0 current-shadow-color) (-> arg1 current-shadow-color) (-> arg2 current-shadow-color) arg3)
(dotimes (s2-0 3)
(let ((s1-0 (-> arg0 light-group 0 lights s2-0)))
(let ((s0-0 (-> arg1 light-group 0 lights s2-0)))
(set! sv-16 (-> arg2 light-group 0 lights s2-0))
(let ((s0-0 (-> arg1 light-group 0 lights s2-0))
(sv-16 (-> arg2 light-group 0 lights s2-0)))
(vector4-lerp! (-> s1-0 direction) (-> s0-0 direction) (-> sv-16 direction) arg3)
(vector4-lerp! (-> s1-0 color) (-> s0-0 color) (-> sv-16 color) arg3)
(vector4-lerp! (-> s1-0 levels) (-> s0-0 levels) (-> sv-16 levels) arg3))
@@ -753,7 +746,7 @@
(let ((f30-0 (fmax 0.0 (-> *math-camera* camera-rot vector 1 z))))
(let ((a2-4 (new 'stack-no-clear 'vector)))
(set-vector! a2-4 0.0 32.0 48.0 128.0)
(vector4-lerp! (the-as vector (-> arg0 current-fog)) (the-as vector (-> arg0 current-fog)) a2-4 (/ f30-0 2)))
(vector4-lerp! (-> arg0 current-fog fog-color) (-> arg0 current-fog fog-color) a2-4 (/ f30-0 2)))
(let ((f0-7 (-> arg0 current-fog fog-dists w))
(f1-1 255.0))
(set! (-> arg0 current-fog fog-dists w) (+ f0-7 (* 0.666 f30-0 (- f1-1 f0-7))))))
@@ -1007,7 +1000,6 @@
(set! (-> *sunken-mood* state 0) (the-as uint 255))
(defun update-mood-sunken ((arg0 mood-context) (arg1 float) (arg2 int))
(local-vars (sv-80 vector))
(when (not (paused?))
(update-mood-fog arg0 arg1)
(update-mood-sky-texture arg0 arg1)
@@ -1046,28 +1038,23 @@
(vector4-lerp! (-> s5-1 0 ambi color) s2-0 s1-0 f30-0))
(let ((s2-1 (new 'static 'vector :x 0.193 :y 0.432 :z 0.721))
(s1-1 (new 'static 'vector :x 0.193 :y 0.338 :z 0.603))
(s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721)))
(set! sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674))
(let ((s3-2 (new 'stack-no-clear 'vector))
(s4-3 (new 'stack-no-clear 'vector))
(f26-3 (+ 0.75
(* 0.0625 (cos (the float (* 4000 (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))))) ;; changed for high fps
(* 0.0625
(cos (the float (shl (the int (* (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))) 11)))) ;; changed for high fps
(* 0.125 (cos (the float (* 1500 (/ (-> *display* time-factor) 5) (-> *display* integral-frame-counter))))) ;; changed for high fps
)))
(vector4-lerp! s3-2 s2-1 s1-1 f28-0)
(let ((t9-16 vector4-lerp!)
(a0-19 s4-3)
(a3-7 f28-0))
(t9-16 a0-19 s0-0 sv-80 a3-7))
(let ((v1-18 (-> s5-1 0 dir2)))
(set! (-> v1-18 direction x) 0.0)
(set! (-> v1-18 direction y) 0.999)
(set! (-> v1-18 direction z) 0.011)
(set! (-> v1-18 direction w) 1.0))
(vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0)
(set! (-> s5-1 0 dir2 levels x) f26-3)))))
(s0-0 (new 'static 'vector :x 0.193 :y 0.336 :z 0.721))
(sv-80 (new 'static 'vector :x 0.215 :y 0.309 :z 0.674))
(s3-2 (new 'stack-no-clear 'vector))
(s4-3 (new 'stack-no-clear 'vector))
(f26-3 (+ 0.75
(* 0.0625 (cos (the float (* 4000 (-> *display* integral-frame-counter)))))
(* 0.0625 (cos (the float (shl (-> *display* integral-frame-counter) 11))))
(* 0.125 (cos (the float (* 1500 (-> *display* integral-frame-counter))))))))
(vector4-lerp! s3-2 s2-1 s1-1 f28-0)
(vector4-lerp! s4-3 s0-0 sv-80 f28-0)
(let ((v1-18 (-> s5-1 0 dir2)))
(set! (-> v1-18 direction x) 0.0)
(set! (-> v1-18 direction y) 0.999)
(set! (-> v1-18 direction z) 0.011)
(set! (-> v1-18 direction w) 1.0))
(vector4-lerp! (-> s5-1 0 dir2 color) s4-3 s3-2 f30-0)
(set! (-> s5-1 0 dir2 levels x) f26-3))))
(update-mood-itimes arg0))
0
(none))
@@ -1273,7 +1260,7 @@
(while (>= s1-0 s2-0)
(let ((f28-0 (-> *palette-fade-controls* control s2-0 fade)))
(set! (-> arg0 times s2-0 w) f28-0)
(vector-! s3-0 (the-as vector (-> *palette-fade-controls* control s2-0)) (-> *target* control trans))
(vector-! s3-0 (-> *palette-fade-controls* control s2-0 trans) (-> *target* control trans))
(let* ((f3-0 (vector-length s3-0))
(f28-1 (* f28-0 (fmax 0.0 (fmin 1.0 (- 1.0 (/ f3-0 (meters 20))))))))
(vector-normalize! s3-0 f28-1)
@@ -1291,11 +1278,7 @@
(set! (-> v1-21 y) (- (-> s4-0 y)))
(set! (-> v1-21 z) (- (-> s4-0 z)))
(when (< (-> s4-0 y) 0.9063)
(let* ((f0-22 0.4226)
(f1-3 (-> v1-21 x))
(f1-5 (* f1-3 f1-3))
(f2-2 (-> v1-21 z))
(f0-23 (/ f0-22 (sqrtf (+ f1-5 (* f2-2 f2-2))))))
(let ((f0-23 (/ 0.4226 (sqrtf (+ (square (-> v1-21 x)) (square (-> v1-21 z)))))))
(set! (-> v1-21 x) (* (-> v1-21 x) f0-23))
(set! (-> v1-21 y) -0.9063)
(set! (-> v1-21 z) (* (-> v1-21 z) f0-23)))))))
@@ -1468,22 +1451,10 @@
(vector-lerp! (-> arg0 mood-lights-table data 1 amb-color) s4-0 (-> arg0 mood-lights-table data 1 amb-color) f30-3)
(vector-lerp! (-> arg0 mood-lights-table data 2 amb-color) s4-0 (-> arg0 mood-lights-table data 2 amb-color) f30-3)
(vector-lerp! (-> arg0 mood-lights-table data 3 amb-color) s4-0 (-> arg0 mood-lights-table data 3 amb-color) f30-3)
(vector-lerp! (the-as vector (-> arg0 mood-lights-table data))
s5-1
(the-as vector (-> arg0 mood-lights-table data))
f30-3)
(vector-lerp! (the-as vector (-> arg0 mood-lights-table data 1))
s5-1
(the-as vector (-> arg0 mood-lights-table data 1))
f30-3)
(vector-lerp! (the-as vector (-> arg0 mood-lights-table data 2))
s5-1
(the-as vector (-> arg0 mood-lights-table data 2))
f30-3)
(vector-lerp! (the-as vector (-> arg0 mood-lights-table data 3))
s5-1
(the-as vector (-> arg0 mood-lights-table data 3))
f30-3))))
(vector-lerp! (-> arg0 mood-lights-table data 0 direction) s5-1 (-> arg0 mood-lights-table data 0 direction) f30-3)
(vector-lerp! (-> arg0 mood-lights-table data 1 direction) s5-1 (-> arg0 mood-lights-table data 1 direction) f30-3)
(vector-lerp! (-> arg0 mood-lights-table data 2 direction) s5-1 (-> arg0 mood-lights-table data 2 direction) f30-3)
(vector-lerp! (-> arg0 mood-lights-table data 3 direction) s5-1 (-> arg0 mood-lights-table data 3 direction) f30-3))))
(update-mood-itimes arg0)
0
(none))
@@ -1565,10 +1536,10 @@
(vector4-lerp! (the-as vector (-> s5-2 0)) (the-as vector (-> s4-2 0)) (the-as vector (-> s5-2 0)) f30-1)
(vector4-lerp! (-> s5-2 0 dir0 color) (-> s4-2 0 dir0 color) (-> s5-2 0 dir0 color) f30-1)
(vector4-lerp! (-> s5-2 0 dir0 levels) (-> s4-2 0 dir0 levels) (-> s5-2 0 dir0 levels) f30-1)
(vector4-lerp! (the-as vector (-> s5-2 0 dir1)) (the-as vector (-> s4-2 0 dir1)) (the-as vector (-> s5-2 0 dir1)) f30-1)
(vector4-lerp! (-> s5-2 0 dir1 direction) (-> s4-2 0 dir1 direction) (-> s5-2 0 dir1 direction) f30-1)
(vector4-lerp! (-> s5-2 0 dir1 color) (-> s4-2 0 dir1 color) (-> s5-2 0 dir1 color) f30-1)
(vector4-lerp! (-> s5-2 0 dir1 levels) (-> s4-2 0 dir1 levels) (-> s5-2 0 dir1 levels) f30-1)
(vector4-lerp! (the-as vector (-> s5-2 0 ambi)) (the-as vector (-> s4-2 0 ambi)) (the-as vector (-> s5-2 0 ambi)) f30-1)
(vector4-lerp! (-> s5-2 0 ambi direction) (-> s4-2 0 ambi direction) (-> s5-2 0 ambi direction) f30-1)
(vector4-lerp! (-> s5-2 0 ambi color) (-> s4-2 0 ambi color) (-> s5-2 0 ambi color) f30-1)
(vector4-lerp! (-> s5-2 0 ambi levels) (-> s4-2 0 ambi levels) (-> s5-2 0 ambi levels) f30-1)
(vector4-lerp! (-> arg0 current-shadow) (-> *ogre2-mood* current-shadow) (-> arg0 current-shadow) f30-1))))))
@@ -1603,19 +1574,19 @@
(vector4-lerp! (the-as vector (-> s5-3 0)) (the-as vector (-> s4-3 0)) (the-as vector (-> s5-3 0)) f30-3)
(vector4-lerp! (-> s5-3 0 dir0 color) (-> s4-3 0 dir0 color) (-> s5-3 0 dir0 color) f30-3)
(vector4-lerp! (-> s5-3 0 dir0 levels) (-> s4-3 0 dir0 levels) (-> s5-3 0 dir0 levels) f30-3)
(vector4-lerp! (the-as vector (-> s5-3 0 dir1)) (the-as vector (-> s4-3 0 dir1)) (the-as vector (-> s5-3 0 dir1)) f30-3)
(vector4-lerp! (-> s5-3 0 dir1 direction) (-> s4-3 0 dir1 direction) (-> s5-3 0 dir1 direction) f30-3)
(vector4-lerp! (-> s5-3 0 dir1 color) (-> s4-3 0 dir1 color) (-> s5-3 0 dir1 color) f30-3)
(vector4-lerp! (-> s5-3 0 dir1 levels) (-> s4-3 0 dir1 levels) (-> s5-3 0 dir1 levels) f30-3)
(vector4-lerp! (the-as vector (-> s5-3 0 dir2)) (the-as vector (-> s4-3 0 dir2)) (the-as vector (-> s5-3 0 dir1)) f30-3)
(vector4-lerp! (-> s5-3 0 dir2 direction) (-> s4-3 0 dir2 direction) (-> s5-3 0 dir1 direction) f30-3)
(vector4-lerp! (-> s5-3 0 dir2 color) (-> s4-3 0 dir2 color) (-> s5-3 0 dir1 color) f30-3)
(vector4-lerp! (-> s5-3 0 dir2 levels) (-> s4-3 0 dir2 levels) (-> s5-3 0 dir1 levels) f30-3)
(vector4-lerp! (the-as vector (-> s5-3 0 ambi)) (the-as vector (-> s4-3 0 ambi)) (the-as vector (-> s5-3 0 ambi)) f30-3)
(vector4-lerp! (-> s5-3 0 ambi direction) (-> s4-3 0 ambi direction) (-> s5-3 0 ambi direction) f30-3)
(vector4-lerp! (-> s5-3 0 ambi color) (-> s4-3 0 ambi color) (-> s5-3 0 ambi color) f30-3)
(vector4-lerp! (-> s5-3 0 ambi levels) (-> s4-3 0 ambi levels) (-> s5-3 0 ambi levels) f30-3)
(vector4-lerp! (-> arg0 current-shadow) (-> *ogre3-mood* current-shadow) (-> arg0 current-shadow) f30-3)
(vector4-lerp! (the-as vector (-> arg0 current-fog))
(the-as vector (-> *ogre3-mood* current-fog))
(the-as vector (-> arg0 current-fog))
(vector4-lerp! (-> arg0 current-fog fog-color)
(-> *ogre3-mood* current-fog fog-color)
(-> arg0 current-fog fog-color)
f30-3)
(vector4-lerp! (-> arg0 current-fog fog-dists)
(-> *ogre3-mood* current-fog fog-dists)
@@ -1692,11 +1663,7 @@
(set! (-> v1-45 y) (- (-> a0-22 direction y)))
(set! (-> v1-45 z) (- (-> a0-22 direction z)))
(when (< (-> a0-22 direction y) 0.9063)
(let* ((f0-23 0.4226)
(f1-25 (-> v1-45 x))
(f1-27 (* f1-25 f1-25))
(f2-4 (-> v1-45 z))
(f0-24 (/ f0-23 (sqrtf (+ f1-27 (* f2-4 f2-4))))))
(let ((f0-24 (/ 0.4226 (sqrtf (+ (square (-> v1-45 x)) (square (-> v1-45 z)))))))
(set! (-> v1-45 x) (* (-> v1-45 x) f0-24))
(set! (-> v1-45 y) -0.9063)
(set! (-> v1-45 z) (* (-> v1-45 z) f0-24)))))
+8 -12
View File
@@ -104,9 +104,9 @@
(+! (-> self year) 1)))))))))
;; set the time of day float. This is in hours (0-24)
(let* ((f0-4 (the float (-> self frame)))
(f0-6 (+ (* 0.0033333334 f0-4) (the float (-> self second))))
(f0-8 (+ (* 0.016666668 f0-6) (the float (-> self minute))))
(f0-10 (+ (* 0.016666668 f0-8) (the float (-> self hour)))))
(f0-6 (+ (/ f0-4 300) (the float (-> self second))))
(f0-8 (+ (/ f0-6 60) (the float (-> self minute))))
(f0-10 (+ (/ f0-8 60) (the float (-> self hour)))))
(set! (-> self time-of-day) f0-10)
(set! (-> *time-of-day-context* time) f0-10))
(suspend)))
@@ -201,7 +201,7 @@
(when (= (-> a0-4 status) 'active)
(if (-> a0-4 info sky) (set! (-> arg0 sky) #t)))))
;; level distances
(let ((s4-0 (new 'stack-no-clear 'array 'float 2))) ;; was a boxed array, but the GOAL implementation seems buggy.
(let ((s4-0 (the-as (array float) (new 'stack 'boxed-array float 2))))
(set! (-> s4-0 0) 0.0)
(set! (-> s4-0 1) 0.0)
0.0
@@ -331,9 +331,9 @@
(-> arg0 moods 0 current-prt-color)
(-> arg0 moods 1 current-prt-color)
f30-0)
(vector4-lerp! (the-as vector (-> arg0 current-sun))
(the-as vector (-> arg0 moods 0 current-sun))
(the-as vector (-> arg0 moods 1 current-sun))
(vector4-lerp! (-> arg0 current-sun sun-color)
(-> arg0 moods 0 current-sun sun-color)
(-> arg0 moods 1 current-sun sun-color)
f30-0)
(vector4-lerp! (-> arg0 current-sun env-color)
(-> arg0 moods 0 current-sun env-color)
@@ -429,11 +429,7 @@
(set! (-> a2-30 y) (- (-> s5-2 dir0 direction y)))
(set! (-> a2-30 z) (- (-> s5-2 dir0 direction z)))
(when (< (-> s5-2 dir0 direction y) 0.9063)
(let* ((f0-56 0.4226)
(f1-17 (-> a2-30 x))
(f1-19 (* f1-17 f1-17))
(f2-7 (-> a2-30 z))
(f0-57 (/ f0-56 (sqrtf (+ f1-19 (* f2-7 f2-7))))))
(let ((f0-57 (/ 0.4226 (sqrtf (+ (square (-> a2-30 x)) (square (-> a2-30 z)))))))
(set! (-> a2-30 x) (* (-> a2-30 x) f0-57))
(set! (-> a2-30 y) -0.9063)
(set! (-> a2-30 z) (* (-> a2-30 z) f0-57))))
+33 -62
View File
@@ -242,7 +242,6 @@
(&+! (-> arg0 base) 576)
(none))
;; definition for function ocean-matrix*!
(defun ocean-matrix*! ((arg0 matrix) (arg1 matrix) (arg2 matrix))
(rlet ((acc :class vf)
(vf1 :class vf)
@@ -287,7 +286,6 @@
(.svf (&-> arg0 vector 3 quad) vf12)
arg0))
;; definition for function ocean-vector-matrix*!
(defun ocean-vector-matrix*! ((arg0 vector) (arg1 vector) (arg2 matrix))
(rlet ((acc :class vf)
(vf0 :class vf)
@@ -309,9 +307,6 @@
(.svf (&-> arg0 quad) vf5)
arg0))
;; definition for function ocean-mid-add-matrices
;; INFO: Return type mismatch pointer vs none.
;; Used lq/sq
(defun ocean-mid-add-matrices ((arg0 dma-buffer) (arg1 vector))
(let ((s5-0 (new-stack-vector0)))
(-> *math-camera* camera-rot)
@@ -343,8 +338,6 @@
(&+! (-> arg0 base) 128)
(none))
;; definition for function ocean-mid-check
;; Used lq/sq
(defun ocean-mid-check ((arg0 pointer) (arg1 int) (arg2 int) (arg3 vector))
(local-vars (v0-0 symbol) (v1-10 float) (a3-2 float) (a3-6 float) (a3-10 float))
(rlet ((vf1 :class vf)
@@ -368,7 +361,7 @@
(when (< a3-2 309237600000.0)
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
(return #f))
(set! (-> v1-0 x) (+ 393216.0 (-> v1-0 x)))
(+! (-> v1-0 x) 393216.0)
(let ((a3-5 v1-0)
(t1-1 t0-1))
(.lvf vf2 (&-> a3-5 quad))
@@ -381,7 +374,7 @@
(when (< a3-6 309237600000.0)
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
(return #f))
(set! (-> v1-0 z) (+ 393216.0 (-> v1-0 z)))
(+! (-> v1-0 z) 393216.0)
(let ((a3-9 v1-0)
(t1-2 t0-1))
(.lvf vf2 (&-> a3-9 quad))
@@ -394,7 +387,7 @@
(when (< a3-10 309237600000.0)
(logior! (-> (the-as (pointer uint8) (+ arg2 (the-as int arg0)))) (ash 1 arg1))
(return #f))
(set! (-> v1-0 x) (+ -393216.0 (-> v1-0 x)))
(+! (-> v1-0 x) -393216.0)
(.lvf vf2 (&-> v1-0 quad))
(.lvf vf3 (&-> t0-1 quad)))
(.sub.vf vf1 vf3 vf2)
@@ -407,8 +400,6 @@
(return #f)
v0-0)))
;; definition for function ocean-mid-add-call
;; INFO: Return type mismatch pointer vs none.
(defun ocean-mid-add-call ((arg0 dma-buffer) (arg1 int))
(let* ((v1-0 arg0)
(a0-1 (the-as object (-> v1-0 base))))
@@ -418,8 +409,6 @@
(set! (-> v1-0 base) (&+ (the-as pointer a0-1) 16)))
(none))
;; definition for function ocean-mid-add-call-flush
;; INFO: Return type mismatch pointer vs none.
(defun ocean-mid-add-call-flush ((arg0 dma-buffer) (arg1 uint))
(let* ((v1-0 arg0)
(a0-1 (the-as object (-> v1-0 base))))
@@ -430,8 +419,6 @@
(none))
(defun ocean-mid-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 int) (arg4 int) (arg5 float))
"Add DMA data to upload data needed to draw an ocean tile."
;; calculate the location of the tile.
(let ((gp-0 (new-stack-vector0)))
(let ((v1-1 (-> *ocean-map* start-corner)))
(set! (-> gp-0 x) (+ (-> v1-1 x) (* 3145728.0 (the float arg2))))
@@ -484,7 +471,6 @@
(if (and (>= a1-12 0) (>= a2-7 0) (< a1-12 8) (< a2-7 8)) (ocean-mid-check s5-1 a1-12 a2-7 gp-0))))))
#f)))
;; definition for function ocean-mid-camera-masks-bit?
(defun ocean-mid-camera-masks-bit? ((arg0 uint) (arg1 uint))
(cond
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #t)
@@ -496,7 +482,6 @@
(a1-3 (+ (* 6 a3-0) a2-3)))
(logtest? (-> (the-as (pointer uint8) (+ (+ a0-1 (* a1-3 8)) (the-as uint *ocean-work*))) 2300) (ash 1 v1-1))))))
;; definition for function ocean-mid-mask-ptrs-bit?
(defun ocean-mid-mask-ptrs-bit? ((arg0 uint) (arg1 uint))
(cond
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #t)
@@ -510,7 +495,6 @@
(logtest? (-> (the-as (pointer uint8) (+ a0-1 (the-as uint (-> *ocean-work* mid-mask-ptrs a1-3)))) 0) (ash 1 v1-1))
#t)))))
;; definition for function ocean-mid-camera-masks-set!
(defun ocean-mid-camera-masks-set! ((arg0 uint) (arg1 uint))
(cond
((or (< (the-as int arg0) 0) (>= (the-as int arg0) 48) (< (the-as int arg1) 0) (>= (the-as int arg1) 48)) #f)
@@ -528,16 +512,8 @@
(else (logior! (-> (the-as (pointer uint8) (+ v1-1 (the-as uint a1-5))) 0) (ash 1 a0-1)) #t)))
(else #f))))))
;; definition for function ocean-mid-add-upload-table
;; WARN: Function may read a register that is not set: f31
;; Used lq/sq
(defun ocean-mid-add-upload-table ((arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 (pointer float)) (arg4 int) (arg5 symbol))
(local-vars
(r0-0 int)
(r0-1 int)
(r0-2 int)
(r0-3 int)
(r0-4 int)
(v1-8 float)
(a0-19 uint128)
(a0-20 uint128)
@@ -546,8 +522,7 @@
(a1-15 uint128)
(a1-16 uint128)
(a2-15 uint128)
(a3-11 uint128)
(f31-0 none))
(a3-11 uint128))
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
@@ -580,15 +555,15 @@
(a2-14 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2))))
(a3-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1))))))))
(.pextlb a0-19 0 a0-18)
(.mov r0-0 f31-0)
(nop!)
(.pextlb a1-14 0 a1-13)
(.mov r0-1 f31-0)
(nop!)
(.pextlb a2-15 0 a2-14)
(.mov r0-2 f31-0)
(nop!)
(.pextlb a3-11 0 a3-10))
(.mov r0-3 f31-0)
(nop!)
(.pextlh a0-20 0 a0-19)
(.mov r0-4 f31-0)
(nop!)
(.pextlh a1-15 0 a1-14)
(.mov vf1 a0-20)
(.pextlh a0-21 0 a2-15)
@@ -624,7 +599,6 @@
(if arg5 (ocean-mid-add-call arg0 275) (ocean-mid-add-call arg0 107)))
(none)))
;; definition for function ocean-mid-add-upload-top
(defun ocean-mid-add-upload-top ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
(let ((s2-0 (-> *ocean-work* mid-minx))
(s1-0 (-> *ocean-work* mid-maxx))
@@ -660,7 +634,6 @@
(s3-0 (ocean-mid-add-upload-table arg0 (+ arg1 -1) arg2 *ocean-down-table* 7 #t))))
(none))
;; definition for function ocean-mid-add-upload-middle
(defun ocean-mid-add-upload-middle ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
(let ((s3-0 (-> *ocean-work* mid-minx))
(s2-0 (-> *ocean-work* mid-maxx))
@@ -679,7 +652,6 @@
(else (ocean-mid-add-upload-table arg0 arg1 arg2 *ocean-left-table* 7 #t))))))
(none))
;; definition for function ocean-mid-add-upload-bottom
(defun ocean-mid-add-upload-bottom ((arg0 dma-buffer) (arg1 uint) (arg2 uint))
(let ((s2-0 (-> *ocean-work* mid-minx))
(s1-0 (-> *ocean-work* mid-maxx))
@@ -715,8 +687,6 @@
(s3-0 (ocean-mid-add-upload-table arg0 (+ arg1 1) arg2 *ocean-up-table* 7 #t))))
(none))
;; definition for function ocean-seams-add-constants
;; INFO: Return type mismatch pointer vs none.
(defun ocean-seams-add-constants ((arg0 dma-buffer))
(let* ((a2-0 4)
(v1-0 arg0)
@@ -765,30 +735,30 @@
;; definition for function draw-ocean-mid-seams
;; INFO: Return type mismatch symbol vs none.
(defun draw-ocean-mid-seams ((arg0 dma-buffer))
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere))
(ocean-seams-add-constants arg0)
(set! sv-32 (-> *ocean-work* mid-minx))
(set! sv-33 (-> *ocean-work* mid-maxx))
(set! sv-34 (-> *ocean-work* mid-minz))
(set! sv-35 (-> *ocean-work* mid-maxz))
(set! sv-36 (new 'stack 'sphere))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 278045.7)
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
(when (sphere-cull-for-ocean sv-36)
(cond
((= s5-0 sv-34) (ocean-mid-add-upload-top arg0 s5-0 s3-0))
((= s5-0 sv-35) (ocean-mid-add-upload-bottom arg0 s5-0 s3-0))
(else (ocean-mid-add-upload-middle arg0 s5-0 s3-0))))
(+! s3-0 1)))
(+! s5-0 1)))
(let ((sv-32 (-> *ocean-work* mid-minx))
(sv-33 (-> *ocean-work* mid-maxx))
(sv-34 (-> *ocean-work* mid-minz))
(sv-35 (-> *ocean-work* mid-maxz))
(sv-36 (new 'stack 'sphere)))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 278045.7)
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
;; og:preserve-this
(when (sphere-cull-for-ocean sv-36)
(cond
((= s5-0 sv-34) (ocean-mid-add-upload-top arg0 s5-0 s3-0))
((= s5-0 sv-35) (ocean-mid-add-upload-bottom arg0 s5-0 s3-0))
(else (ocean-mid-add-upload-middle arg0 s5-0 s3-0))))
(+! s3-0 1)))
(+! s5-0 1))))
(dotimes (v1-26 36)
(if (and (-> *ocean-work* mid-mask-ptrs v1-26) (nonzero? (-> *ocean-work* mid-camera-masks v1-26)))
(logior! (-> *ocean-work* mid-mask-ptrs v1-26 0) (-> *ocean-work* mid-camera-masks v1-26))))
@@ -875,6 +845,7 @@
(s0-0 (-> (the-as (pointer int16) (+ (* s2-0 2) (the-as int (-> *ocean-map* ocean-mid-indices)))))))
;; (format 0 "draw ocean tile: ~d x ~d = ~d index ~d~%" s4-0 s3-0 s2-0 s0-0)
;; (debug-draw-ocean-tile s4-0 s3-0 (new 'static 'rgba :r #x80 :a #x80) (new 'static 'rgba :g #x80 :a #x80) s0-0)
;; og:preserve-this
(when (sphere-cull-for-ocean s1-0)
;;(format 0 " vis!~%")
(cond
+20 -21
View File
@@ -177,16 +177,15 @@
(none))
(defun draw-ocean-texture ((arg0 dma-buffer) (arg1 (inline-array vector)) (arg2 symbol))
(local-vars (sv-16 (inline-array vector)) (sv-32 int) (sv-48 vector) (sv-64 (inline-array vector)))
(set! sv-64 arg1)
(let* ((s0-0 arg2)
(ocean-tex-page-0 *ocean-base-page*)
(ocean-tex-block-0 *ocean-base-block*)
(ocean-tex-page-1 (+ ocean-tex-page-0 8))
(ocean-tex-block-1 (* ocean-tex-page-1 32))
(ocean-tex-page-2 (+ ocean-tex-page-0 10))
(ocean-tex-block-2 (* ocean-tex-page-2 32)))
(set-display-gs-state arg0 ocean-tex-page-0 128 128 0 0)
(let* ((sv-64 arg1)
(s0-0 arg2)
(a1-1 *ocean-base-page*)
(s2-0 *ocean-base-block*)
(s1-0 (+ a1-1 8))
(s4-0 (* s1-0 32))
(s3-0 (+ a1-1 10))
(s5-0 (* s3-0 32)))
(set-display-gs-state arg0 a1-1 128 128 0 0)
(dma-buffer-add-vu-function arg0 ocean-texture-vu1-block 1)
(let* ((v1-0 arg0)
(a0-3 (the-as object (-> v1-0 base))))
@@ -196,17 +195,17 @@
(set! (-> v1-0 base) (&+ (the-as pointer a0-3) 16)))
(ocean-texture-add-constants arg0)
(ocean-texture-add-envmap arg0)
(set! sv-16 sv-64)
(ocean-texture-add-verts arg0 sv-16)
(set! sv-48 (-> sv-16 192))
(ocean-texture-add-call-start arg0)
(set! sv-32 0)
(while (< sv-32 9)
(ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48))
(set! sv-48 (-> (the-as (inline-array vector) sv-48) 192))
(ocean-texture-add-call-rest arg0)
(set! sv-32 (+ sv-32 1)))
(ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64)
(let ((sv-16 sv-64))
(ocean-texture-add-verts arg0 sv-16)
(let ((sv-48 (-> sv-16 192)))
(ocean-texture-add-call-start arg0)
(let ((sv-32 0))
(while (< sv-32 9)
(ocean-texture-add-verts arg0 (the-as (inline-array vector) sv-48))
(set! sv-48 (-> (the-as (inline-array vector) sv-48) 192))
(ocean-texture-add-call-rest arg0)
(+! sv-32 1)))
(ocean-texture-add-verts-last arg0 (the-as (inline-array vector) sv-48) sv-64)))
(ocean-texture-add-call-rest arg0)
(ocean-texture-add-call-done arg0)
; (when s0-0
+120 -151
View File
@@ -4,7 +4,8 @@
(require "engine/gfx/ocean/ocean-mid.gc")
(require "engine/collide/collide-frag-h.gc")
;; definition for function ocean-trans-camera-masks-bit?
;; DECOMP BEGINS
(defun ocean-trans-camera-masks-bit? ((arg0 uint) (arg1 uint))
(let ((v1-3 (- arg0 (* (-> *ocean-work* mid-minz) 4)))
(a0-4 (- arg1 (* (-> *ocean-work* mid-minx) 4))))
@@ -18,7 +19,6 @@
(a0-6 (+ (* a3-0 4) a2-3)))
(logtest? (-> *ocean-work* trans-camera-masks 0 mask (+ a1-2 (* a0-6 8))) (ash 1 v1-4)))))))
;; definition for function ocean-trans-mask-ptrs-bit?
(defun ocean-trans-mask-ptrs-bit? ((arg0 int) (arg1 int))
(let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4))))
(a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))))
@@ -36,7 +36,6 @@
(a0-11 (-> *ocean-work* trans-mask-ptrs (+ (* (+ (* a3-0 4) a2-3) 4) a1-2))))
(if a0-11 (logtest? (-> a0-11 1) (ash 1 v1-4)) #f))))))
;; definition for function ocean-trans-mask-ptrs-set!
(defun ocean-trans-mask-ptrs-set! ((arg0 int) (arg1 int))
(let ((v1-3 (- arg0 (the-as int (* (-> *ocean-work* mid-minz) 4))))
(a0-4 (- arg1 (the-as int (* (-> *ocean-work* mid-minx) 4)))))
@@ -61,16 +60,8 @@
#t)))
(else #f)))))))
;; definition for function ocean-trans-add-upload-table
;; WARN: Function may read a register that is not set: f31
;; Used lq/sq
(defun ocean-trans-add-upload-table ((arg0 dma-buffer) (arg1 int) (arg2 int) (arg3 (pointer float)) (arg4 int) (arg5 symbol))
(local-vars
(r0-0 int)
(r0-1 int)
(r0-2 int)
(r0-3 int)
(r0-4 int)
(v1-12 (inline-array vector))
(v1-14 float)
(a0-23 uint128)
@@ -80,8 +71,7 @@
(a1-17 uint128)
(a2-15 uint128)
(a2-16 uint128)
(a3-10 uint128)
(f31-0 none))
(a3-10 uint128))
(rlet ((acc :class vf)
(vf1 :class vf)
(vf10 :class vf)
@@ -166,15 +156,15 @@
(t0-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (+ a0-16 1)) a1-11))))
(a0-22 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ a1-11 1 (* 52 (+ a0-16 1)))))))
(.pextlb a1-15 0 a2-14)
(.mov r0-0 f31-0)
(nop!)
(.pextlb a2-15 0 a3-9)
(.mov r0-1 f31-0)
(nop!)
(.pextlb a3-10 0 t0-10)
(.mov r0-2 f31-0)
(nop!)
(.pextlb a0-23 0 a0-22)))
(.mov r0-3 f31-0)
(nop!)
(.pextlh a1-16 0 a1-15)
(.mov r0-4 f31-0)
(nop!)
(.pextlh a2-16 0 a2-15)
(.mov vf1 a1-16)
(.pextlh a1-17 0 a3-10)
@@ -236,16 +226,8 @@
(if arg5 (ocean-mid-add-call arg0 275) (ocean-mid-add-call arg0 107)))
(none)))
;; definition for function ocean-trans-add-upload-strip
;; WARN: Function may read a register that is not set: f31
;; Used lq/sq
(defun ocean-trans-add-upload-strip ((arg0 dma-buffer) (arg1 uint) (arg2 uint) (arg3 uint) (arg4 uint) (arg5 uint))
(local-vars
(r0-0 int)
(r0-1 int)
(r0-2 int)
(r0-3 int)
(r0-4 int)
(v1-8 float)
(a0-23 uint128)
(a0-24 uint128)
@@ -254,8 +236,7 @@
(a1-15 uint128)
(a1-16 uint128)
(a2-15 uint128)
(a3-11 uint128)
(f31-0 none))
(a3-11 uint128))
(rlet ((vf1 :class vf)
(vf2 :class vf)
(vf3 :class vf)
@@ -291,15 +272,15 @@
(a2-14 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ (* 52 (the-as int (+ arg1 1))) arg2))))
(a3-10 (the-as uint128 (-> *ocean-map* ocean-colors colors (+ arg2 1 (* 52 (the-as int (+ arg1 1))))))))
(.pextlb a0-23 0 a0-22)
(.mov r0-0 f31-0)
(nop!)
(.pextlb a1-14 0 a1-13)
(.mov r0-1 f31-0)
(nop!)
(.pextlb a2-15 0 a2-14)
(.mov r0-2 f31-0)
(nop!)
(.pextlb a3-11 0 a3-10))
(.mov r0-3 f31-0)
(nop!)
(.pextlh a0-24 0 a0-23)
(.mov r0-4 f31-0)
(nop!)
(.pextlh a1-15 0 a1-14)
(.mov vf1 a0-24)
(.pextlh a0-25 0 a2-15)
@@ -343,8 +324,6 @@
(ocean-mid-add-call arg0 107)
(none)))
;; definition for function ocean-transition-check
;; Used lq/sq
(defun ocean-transition-check ((arg0 ocean-trans-mask) (arg1 int) (arg2 int) (arg3 vector))
(local-vars (v0-0 symbol) (v1-10 float) (a3-2 float) (a3-6 float) (a3-10 float))
(rlet ((vf1 :class vf)
@@ -368,7 +347,7 @@
(when (< a3-2 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(return #f))
(set! (-> v1-0 x) (+ 98304.0 (-> v1-0 x)))
(+! (-> v1-0 x) 98304.0)
(let ((a3-5 v1-0)
(t1-1 t0-1))
(.lvf vf2 (&-> a3-5 quad))
@@ -381,7 +360,7 @@
(when (< a3-6 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(return #f))
(set! (-> v1-0 z) (+ 98304.0 (-> v1-0 z)))
(+! (-> v1-0 z) 98304.0)
(let ((a3-9 v1-0)
(t1-2 t0-1))
(.lvf vf2 (&-> a3-9 quad))
@@ -394,7 +373,7 @@
(when (< a3-10 19327350000.0)
(logior! (-> arg0 mask arg2) (ash 1 arg1))
(return #f))
(set! (-> v1-0 x) (+ -98304.0 (-> v1-0 x)))
(+! (-> v1-0 x) -98304.0)
(.lvf vf2 (&-> v1-0 quad))
(.lvf vf3 (&-> t0-1 quad)))
(.sub.vf vf1 vf3 vf2)
@@ -407,27 +386,23 @@
(return #f)
v0-0)))
;; definition for function ocean-make-trans-camera-masks
;; Used lq/sq
(defun ocean-make-trans-camera-masks ((arg0 uint) (arg1 uint) (arg2 uint) (arg3 uint))
(local-vars (sv-48 ocean-trans-mask) (sv-52 vector) (sv-56 vector) (sv-60 vector))
(set! sv-48 (-> *ocean-work* trans-camera-masks (+ (* arg2 4) arg3)))
(set! sv-52 (-> *math-camera* trans))
(set! sv-56 (new-stack-vector0))
(set! sv-60 (new-stack-vector0))
(set! (-> sv-56 x) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1))))
(set! (-> sv-56 y) (-> *ocean-map* start-corner y))
(set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0))))
(set! (-> sv-56 w) 1.0)
(dotimes (gp-0 4)
(dotimes (s5-0 4)
(set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-0))) (-> sv-52 x)))
(set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y)))
(set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float gp-0))) (-> sv-52 z)))
(ocean-transition-check sv-48 s5-0 gp-0 sv-56)))
(let ((sv-48 (-> *ocean-work* trans-camera-masks (+ (* arg2 4) arg3)))
(sv-52 (-> *math-camera* trans))
(sv-56 (new-stack-vector0))
(sv-60 (new-stack-vector0)))
(set! (-> sv-56 x) (+ (-> *ocean-map* start-corner x) (* 393216.0 (the float arg1))))
(set! (-> sv-56 y) (-> *ocean-map* start-corner y))
(set! (-> sv-56 z) (+ (-> *ocean-map* start-corner z) (* 393216.0 (the float arg0))))
(set! (-> sv-56 w) 1.0)
(dotimes (gp-0 4)
(dotimes (s5-0 4)
(set! (-> sv-60 x) (- (+ (-> sv-56 x) (* 98304.0 (the float s5-0))) (-> sv-52 x)))
(set! (-> sv-60 y) (- (-> sv-56 y) (-> sv-52 y)))
(set! (-> sv-60 z) (- (+ (-> sv-56 z) (* 98304.0 (the float gp-0))) (-> sv-52 z)))
(ocean-transition-check sv-48 s5-0 gp-0 sv-56))))
#f)
;; definition for function ocean-trans-add-upload
(defun ocean-trans-add-upload ((arg0 dma-buffer) (arg1 int) (arg2 int))
(when (not (ocean-trans-mask-ptrs-bit? arg1 arg2))
(let ((s1-0 (ocean-trans-camera-masks-bit? (the-as uint (+ arg1 -1)) (the-as uint arg2)))
@@ -486,29 +461,27 @@
(else (ocean-trans-add-upload-table arg0 arg1 arg2 *ocean-trans-down-right-table* 18 #f))))))))
(none))
;; definition for function draw-ocean-transition-seams
(defun draw-ocean-transition-seams ((arg0 dma-buffer))
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere))
(set! sv-32 (-> *ocean-work* near-minx))
(set! sv-33 (-> *ocean-work* near-maxx))
(set! sv-34 (-> *ocean-work* near-minz))
(set! sv-35 (-> *ocean-work* near-maxz))
(set! sv-36 (new 'stack 'sphere))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 69511.42)
(when (and (< sv-32 sv-33) (< sv-34 sv-35))
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
(when (sphere-cull sv-36)
(if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0))))
(+! s3-0 1)))
(+! s5-0 1))))
(let ((sv-32 (-> *ocean-work* near-minx))
(sv-33 (-> *ocean-work* near-maxx))
(sv-34 (-> *ocean-work* near-minz))
(sv-35 (-> *ocean-work* near-maxz))
(sv-36 (new 'stack 'sphere)))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 69511.42)
(when (and (< sv-32 sv-33) (< sv-34 sv-35))
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(set! (-> sv-36 x) (+ 49152.0 (* 98304.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 49152.0 (* 98304.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
(when (sphere-cull sv-36)
(if (not (ocean-trans-camera-masks-bit? s5-0 s3-0)) (ocean-trans-add-upload arg0 (the-as int s5-0) (the-as int s3-0))))
(+! s3-0 1)))
(+! s5-0 1)))))
(dotimes (v1-27 16)
(when (nonzero? (-> *ocean-work* trans-camera-masks v1-27 word))
(dotimes (a0-12 4)
@@ -516,7 +489,6 @@
(if a1-8 (logior! (-> a1-8 1) (-> *ocean-work* trans-temp-masks 0 mask (+ a0-12 (* v1-27 8)))))))))
#f)
;; definition for function ocean-trans-add-constants
(defun ocean-trans-add-constants ((arg0 dma-buffer))
(let* ((a2-0 4)
(v1-0 arg0)
@@ -532,84 +504,81 @@
(set-vector! (-> v1-1 vector 3) 98304.0 0.0 98304.0 1.0))
(let ((v0-0 (&+ (-> arg0 base) 64))) (set! (-> arg0 base) v0-0) v0-0))
;; definition for function draw-ocean-transition
;; INFO: Return type mismatch int vs none.
(defun draw-ocean-transition ((arg0 dma-buffer))
(local-vars (sv-32 uint) (sv-33 uint) (sv-34 uint) (sv-35 uint) (sv-36 sphere) (sv-40 ocean-trans-mask) (sv-44 uint))
(dotimes (v1-0 16)
(set! (-> *ocean-work* trans-camera-masks v1-0 word) (the-as uint 0))
(set! (-> *ocean-work* near-mask-indices v1-0) (the-as uint -1)))
(dotimes (v1-3 64)
(set! (-> *ocean-work* trans-mask-ptrs v1-3) (the-as (pointer int32) #f)))
(set! sv-32 (-> *ocean-work* mid-minx))
(set! sv-33 (-> *ocean-work* mid-maxx))
(set! sv-34 (-> *ocean-work* mid-minz))
(set! sv-35 (-> *ocean-work* mid-maxz))
(set! sv-36 (new 'stack 'sphere))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 278045.7)
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0))
(when (ocean-mid-camera-masks-bit? s5-0 s3-0)
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
(if (sphere-cull sv-36) (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)))))
(+! s3-0 1)))
(+! s5-0 1)))
(let ((a2-2 192)
(a1-8 0)
(a0-11 192)
(v1-32 0))
(let ((a3-1 sv-34)
(t0-0 sv-35))
(while (>= t0-0 a3-1)
(let ((t1-0 sv-32)
(t2-0 sv-33))
(while (>= t2-0 t1-0)
(set! sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32))))
(when (nonzero? (-> sv-40 word))
(dotimes (t3-10 4)
(let ((t4-5 (-> sv-40 mask t3-10)))
(when (nonzero? t4-5)
(let ((t5-2 (+ (* a3-1 4) t3-10)))
(if (< t5-2 (the-as uint a0-11)) (set! a0-11 (the-as int t5-2)))
(if (< (the-as uint v1-32) t5-2) (set! v1-32 (the-as int t5-2))))
(dotimes (t5-3 4)
(when (logtest? t4-5 (ash 1 t5-3))
(let ((t6-9 (+ (* t1-0 4) t5-3)))
(if (< t6-9 (the-as uint a2-2)) (set! a2-2 (the-as int t6-9)))
(if (< (the-as uint a1-8) t6-9) (set! a1-8 (the-as int t6-9))))))))))
(+! t1-0 1)))
(+! a3-1 1)))
(set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1)))
(set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1)))
(set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1)))
(set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))))
(dotimes (v1-34 16)
(set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)))
(let ((s5-1 sv-34)
(s4-1 sv-35))
(while (>= s4-1 s5-1)
(let ((s3-1 sv-32)
(s2-1 sv-33))
(while (>= s2-1 s3-1)
(when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1))
(when (ocean-mid-camera-masks-bit? s5-1 s3-1)
(let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1))))
(when (>= (-> v1-43 parent) 0)
(set! sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32)))
(set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child)))
(let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent))))
(dotimes (s0-0 4)
(let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0)))
(if (!= a3-5 255) (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0))))))))))
(+! s3-1 1)))
(+! s5-1 1)))
(let ((sv-32 (-> *ocean-work* mid-minx))
(sv-33 (-> *ocean-work* mid-maxx))
(sv-34 (-> *ocean-work* mid-minz))
(sv-35 (-> *ocean-work* mid-maxz)))
(let ((sv-36 (new 'stack 'sphere)))
(set! (-> sv-36 y) (-> *ocean-map* start-corner y))
(set! (-> sv-36 w) 278045.7)
(let ((s5-0 sv-34)
(s4-0 sv-35))
(while (>= s4-0 s5-0)
(let ((s3-0 sv-32)
(s2-0 sv-33))
(while (>= s2-0 s3-0)
(when (not (ocean-mid-mask-ptrs-bit? s5-0 s3-0))
(when (ocean-mid-camera-masks-bit? s5-0 s3-0)
(set! (-> sv-36 x) (+ 196608.0 (* 393216.0 (the float s3-0)) (-> *ocean-map* start-corner x)))
(set! (-> sv-36 z) (+ 196608.0 (* 393216.0 (the float s5-0)) (-> *ocean-map* start-corner z)))
(if (sphere-cull sv-36) (ocean-make-trans-camera-masks s5-0 s3-0 (- s5-0 sv-34) (- s3-0 sv-32)))))
(+! s3-0 1)))
(+! s5-0 1))))
(let ((a2-2 192)
(a1-8 0)
(a0-11 192)
(v1-32 0))
(let ((a3-1 sv-34)
(t0-0 sv-35))
(while (>= t0-0 a3-1)
(let ((t1-0 sv-32)
(t2-0 sv-33))
(while (>= t2-0 t1-0)
(let ((sv-40 (-> *ocean-work* trans-camera-masks (+ (* (- a3-1 sv-34) 4) (- t1-0 sv-32)))))
(when (nonzero? (-> sv-40 word))
(dotimes (t3-10 4)
(let ((t4-5 (-> sv-40 mask t3-10)))
(when (nonzero? t4-5)
(let ((t5-2 (+ (* a3-1 4) t3-10)))
(if (< t5-2 (the-as uint a0-11)) (set! a0-11 (the-as int t5-2)))
(if (< (the-as uint v1-32) t5-2) (set! v1-32 (the-as int t5-2))))
(dotimes (t5-3 4)
(when (logtest? t4-5 (ash 1 t5-3))
(let ((t6-9 (+ (* t1-0 4) t5-3)))
(if (< t6-9 (the-as uint a2-2)) (set! a2-2 (the-as int t6-9)))
(if (< (the-as uint a1-8) t6-9) (set! a1-8 (the-as int t6-9)))))))))))
(+! t1-0 1)))
(+! a3-1 1)))
(set! (-> *ocean-work* near-minx) (the-as uint (+ a2-2 -1)))
(set! (-> *ocean-work* near-maxx) (the-as uint (+ a1-8 1)))
(set! (-> *ocean-work* near-minz) (the-as uint (+ a0-11 -1)))
(set! (-> *ocean-work* near-maxz) (the-as uint (+ v1-32 1))))
(dotimes (v1-34 16)
(set! (-> *ocean-work* trans-temp-masks v1-34 word) (-> *ocean-work* trans-camera-masks v1-34 word)))
(let ((s5-1 sv-34)
(s4-1 sv-35))
(while (>= s4-1 s5-1)
(let ((s3-1 sv-32)
(s2-1 sv-33))
(while (>= s2-1 s3-1)
(when (not (ocean-mid-mask-ptrs-bit? s5-1 s3-1))
(when (ocean-mid-camera-masks-bit? s5-1 s3-1)
(let ((v1-43 (-> *ocean-map* ocean-trans-indices data (+ (* (the-as uint 48) s5-1) s3-1))))
(when (>= (-> v1-43 parent) 0)
(let ((sv-44 (+ (* (- s5-1 sv-34) 4) (- s3-1 sv-32))))
(set! (-> *ocean-work* near-mask-indices sv-44) (the-as uint (-> v1-43 child)))
(let ((s1-0 (-> *ocean-map* ocean-mid-masks data (-> v1-43 parent))))
(dotimes (s0-0 4)
(let ((a3-5 (-> (the-as ocean-mid-mask (+ s0-0 (the-as int s1-0))) mask 0)))
(if (!= a3-5 255) (ocean-trans-add-upload-strip arg0 s5-1 s3-1 a3-5 sv-44 (the-as uint s0-0)))))))))))
(+! s3-1 1)))
(+! s5-1 1))))
(ocean-mid-add-call-flush arg0 (the-as uint 41))
(ocean-trans-add-constants arg0)
(draw-ocean-transition-seams arg0)
+6 -14
View File
@@ -39,33 +39,25 @@
(none))
(defun compute-and-draw-shadow ((arg0 vector) (arg1 vector) (arg2 vector) (arg3 vector) (arg4 float) (arg5 float))
(local-vars
(v1-10 float)
(v1-11 float)
(sv-96 vector)
(sv-112 (function quaternion vector float quaternion))
(sv-128 vector)
(sv-144 vector))
(local-vars (v1-10 float) (v1-11 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf))
(init-vf0-vector)
(set! sv-96 arg2)
(let ((s4-0 arg3)
(let ((sv-96 arg2)
(s4-0 arg3)
(s3-0 arg4)
(s2-0 arg5))
(when (< (- (-> arg0 y) (-> arg1 y)) s3-0)
(set! sv-144 (new 'stack-no-clear 'vector))
(let ((s0-0 (new 'stack-no-clear 'vector))
(let ((sv-144 (new 'stack-no-clear 'vector))
(s0-0 (new 'stack-no-clear 'vector))
(s1-0 (new 'stack-no-clear 'sparticle-cpuinfo)))
(+! (-> arg1 y) 40.96)
(set! (-> sv-144 x) (-> sv-96 z))
(set! (-> sv-144 y) 0.0)
(set! (-> sv-144 z) (- (-> sv-96 x)))
(vector-normalize! sv-144 1.0)
(set! sv-112 quaternion-vector-angle!)
(set! sv-128 s0-0)
(let ((a2-1 (acos (-> sv-96 y)))) (sv-112 (the-as quaternion sv-128) sv-144 a2-1))
(quaternion-vector-angle! (the-as quaternion s0-0) sv-144 (acos (-> sv-96 y)))
(let ((v1-9 s1-0))
(cond
((< (-> s0-0 w) 0.0)
@@ -215,6 +215,7 @@
(tidhash uint16 80)
(spadgif adgif-shader 80 :inline)))
(define *particle-adgif-cache* (new 'global 'particle-adgif-cache))
(set! (-> *particle-adgif-cache* used) 0)
@@ -333,7 +334,7 @@
(set! (-> v1-0 x) f0-0)
(set! (-> v1-0 y) f1-0)
(set! (-> v1-0 z) f3-0)
(set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))))
(set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))))
(quaternion->matrix s5-0 a1-1))
;; rotate, preserving z as usual
(vector3s-rotate*! (the-as vector3s (-> arg0 launchrot)) (the-as vector3s (-> arg0 launchrot)) s5-0)
@@ -473,7 +474,7 @@
(set! (-> arg2 fade x) 99999.0)
(set! (-> arg2 fade y) 99999.0)
(set! (-> arg2 fade z) 99999.0)
(let ((a1-2 (sp-init-fields! (the-as (pointer float) (-> arg3 x-y-z-sx))
(let ((a1-2 (sp-init-fields! (&-> arg3 x-y-z-sx x)
(the-as (inline-array sp-field-init-spec) a1-1)
(sp-field-id sprite-fields-start)
(sp-field-id sprite-fields-end)
@@ -496,7 +497,7 @@
(if (= (-> arg2 fade y) 99999.0) (set! (-> arg2 fade y) f28-0) (set! (-> arg2 fade y) (* (-> arg2 fade y) (-> v1-16 y))))
(if (= (-> arg2 fade z) 99999.0) (set! (-> arg2 fade z) f30-0) (set! (-> arg2 fade z) (* (-> arg2 fade z) (-> v1-16 z)))))))
(else
(let ((a1-3 (sp-init-fields! (the-as (pointer float) (-> arg3 x-y-z-sx))
(let ((a1-3 (sp-init-fields! (&-> arg3 x-y-z-sx x)
(the-as (inline-array sp-field-init-spec) a1-1)
(sp-field-id sprite-fields-start)
(sp-field-id sprite-fields-end)
@@ -533,7 +534,7 @@
(set! (-> v1-0 x) f0-0)
(set! (-> v1-0 y) f1-0)
(set! (-> v1-0 z) f3-0)
(set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))))
(set! (-> v1-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))))
(set! (-> arg3 qx-qy-qz-sy x) 0.0)
(set! (-> arg3 qx-qy-qz-sy y) 0.0)
(set! (-> arg3 qx-qy-qz-sy z) 0.0)
@@ -832,7 +833,7 @@
(set! (-> s4-0 x) f0-0)
(set! (-> s4-0 y) f1-0)
(set! (-> s4-0 z) f3-0)
(set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))))
(set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))))
(quaternion-rotate-y! (the-as quaternion s4-0) (the-as quaternion s4-0) (-> s5-0 sprite rot))
(let ((v1-3 arg2))
(cond
@@ -875,7 +876,7 @@
(set! (-> s4-0 x) f0-0)
(set! (-> s4-0 y) f1-0)
(set! (-> s4-0 z) f3-0)
(set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (* f3-0 f3-0)) (* f1-0 f1-0)) (* f0-0 f0-0)))))
(set! (-> s4-0 w) (sqrtf (- (- (- 1.0 (square f3-0)) (square f1-0)) (square f0-0)))))
(let ((a1-1 (new-stack-vector0)))
(set! (-> a1-1 y) (-> s5-0 sprite rot))
(set! (-> a1-1 z)
+4 -3
View File
@@ -16,6 +16,7 @@
(x-origin float)
(z-origin float)))
(define *lb-editor-parms* (new 'global 'lb-editor-parms))
(set! (-> *lb-editor-parms* boundary) #f)
@@ -776,7 +777,7 @@
(f2-2 (* 0.5 (+ f0-0 f2-0)))
(f1-1 (- f3-2 f1-0))
(f0-1 (- f2-2 f0-0))
(f0-4 (sqrtf (+ (* f1-1 f1-1) (* f0-1 f0-1)))))
(f0-4 (sqrtf (+ (square f1-1) (square f0-1)))))
(set-vector! (-> arg0 rejector) f3-2 0.0 f2-2 f0-4)))
0
(none))
@@ -898,7 +899,7 @@
(a2-0 (-> arg0 data (-> arg0 data s5-0 v1)))
(a3-0 (-> arg0 data (-> arg0 data s5-0 v2)))
(s4-0 (new 'stack-no-clear 'vector)))
(normal-of-plane s4-0 (the-as vector a1-0) (the-as vector a2-0) (the-as vector a3-0))
(normal-of-plane s4-0 (-> a1-0 v) (-> a2-0 v) (-> a3-0 v))
(if (or (!= (-> s4-0 x) 0.0) (!= (-> s4-0 z) 0.0)) (format 0 "ERROR in the load-boundary code : tell Eddie!!!~%"))
(when (< (-> s4-0 y) 0.0)
(let ((v1-22 (-> arg0 data s5-0 v0)))
@@ -1355,7 +1356,7 @@
(let ((f0-1 (- (-> a1-0 x) (-> arg0 rejector x)))
(f1-2 (- (-> a1-0 z) (-> arg0 rejector z))))
(cond
((< (+ (* f0-1 f0-1) (* f1-2 f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w)))
((< (+ (square f0-1) (square f1-2)) (* (-> arg0 rejector w) (-> arg0 rejector w)))
(if (logtest? (-> arg0 flags) (load-boundary-flags closed))
(set! s5-0 (check-closed-boundary arg0 a1-0 a2-0))
(set! s5-0 (check-open-boundary arg0 a1-0 a2-0))))
+105 -118
View File
@@ -28,28 +28,25 @@
(mem-size (-> this data-array i) #f 0)))
this)
(defmethod mem-usage ((this load-dir) (arg0 memory-usage-block) (arg1 int))
"Get the memory usage data of a load-dir"
(set! (-> arg0 length) (max 82 (-> arg0 length)))
(set! (-> arg0 data 81 name) "array")
(set! (-> arg0 data 81 count) (+ (-> arg0 data 81 count) 1))
(let ((v1-6 (asize-of this)))
(set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-6))
(set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-6 15)))))
(set! (-> arg0 length) (max 82 (-> arg0 length)))
(set! (-> arg0 data 81 name) "array")
(set! (-> arg0 data 81 count) (-> arg0 data 81 count))
(defmethod mem-usage ((this load-dir) (usage memory-usage-block) (flags int))
(set! (-> usage length) (max 82 (-> usage length)))
(set! (-> usage data 81 name) "array")
(+! (-> usage data 81 count) 1)
(let ((v1-6 (asize-of this))) (+! (-> usage data 81 used) v1-6) (+! (-> usage data 81 total) (logand -16 (+ v1-6 15))))
(set! (-> usage length) (max 82 (-> usage length)))
(set! (-> usage data 81 name) "array")
(set! (-> usage data 81 count) (-> usage data 81 count))
(let ((v1-15 (asize-of (-> this string-array))))
(set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-15))
(set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-15 15)))))
(set! (-> arg0 length) (max 82 (-> arg0 length)))
(set! (-> arg0 data 81 name) "array")
(set! (-> arg0 data 81 count) (-> arg0 data 81 count))
(+! (-> usage data 81 used) v1-15)
(+! (-> usage data 81 total) (logand -16 (+ v1-15 15))))
(set! (-> usage length) (max 82 (-> usage length)))
(set! (-> usage data 81 name) "array")
(set! (-> usage data 81 count) (-> usage data 81 count))
(let ((v1-24 (asize-of (-> this data-array))))
(set! (-> arg0 data 81 used) (+ (-> arg0 data 81 used) v1-24))
(set! (-> arg0 data 81 total) (+ (-> arg0 data 81 total) (logand -16 (+ v1-24 15)))))
(+! (-> usage data 81 used) v1-24)
(+! (-> usage data 81 total) (logand -16 (+ v1-24 15))))
(dotimes (s3-0 (-> this data-array length))
(mem-usage (-> this data-array s3-0) arg0 arg1))
(mem-usage (-> this data-array s3-0) usage flags))
(the-as load-dir #f))
(defmethod load-to-heap-by-name ((this load-dir-art-group) (art-name string) (do-reload symbol) (heap kheap) (version int))
@@ -475,7 +472,7 @@
(if (and (-> this preload-stream name) (or (not s4-4) (< (-> this preload-stream priority) (-> s4-4 priority))))
(set! s4-4 (-> this preload-stream)))
(cond
(s4-4 (mem-copy! (&-> (-> this last-preload-stream) type) (&-> s4-4 type) 44) (str-play-queue (-> s4-4 name)))
(s4-4 (mem-copy! (&-> this last-preload-stream type) (&-> s4-4 type) 44) (str-play-queue (-> s4-4 name)))
(else (set! (-> this last-preload-stream name) #f) (set! (-> this last-preload-stream owner) (the-as handle #f)))))
(when (and debug-print *display-art-control*)
(dotimes (s5-1 3)
@@ -633,103 +630,93 @@
(define-extern ja-abort-spooled-anim (function spool-anim art-joint-anim int int :behavior process-drawable))
(defbehavior ja-play-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 art-joint-anim) (arg3 (function process-drawable symbol)))
(local-vars
(v0-39 int)
(spool-part int)
(sv-24 float)
(old-skel-status janim-status)
(sv-32 int)
(sv-40 int)
(sv-48 int)
(sv-56 int)
(spool-sound sound-id)
(sv-72 int))
(set! spool-part 0)
(set! sv-24 -17.0)
(set! old-skel-status (-> self skel status))
(set! sv-32 -2)
(set! sv-40 0)
(set! sv-48 0)
(set! sv-56 0)
(set! spool-sound (new-sound-id))
(backup-load-state-and-set-cmds *load-state* (-> arg0 command-list))
(set-setting! 'spooling (process->ppointer self) 0.0 0)
(logior! (-> self skel status) (janim-status inited drawn done))
(kill-current-level-hint '() '() 'die)
(level-hint-surpress!)
(apply-settings *setting-control*)
(when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game))
(cond
(arg1 (when (!= (ja-group) arg1) (ja-channel-push! 1 (seconds 0.05)) (ja :group! arg1 :num! min)))
(else (ja-channel-set! 0)))
(while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game))
(format #t "WARNING: ---------------------> loader stall on lock~%")
(if (arg3 self) (goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -9.0)
(suspend)
(if arg1 (ja :num! (loop!)))))
(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! 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)
(update *art-control* #f)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active)
(cond
(arg1 (when (!= (ja-group) arg1) (ja-channel-set! 1) (ja :group! arg1 :num! min)))
(else (ja-channel-set! 0)))
(while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active)
(if (arg3 self) (goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part)
(suspend)
(if arg1 (ja :num! (loop!)))))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim))))
(cond
(s2-4
(ja-channel-set! 1)
(ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0)
(when (zero? spool-part)
(str-play-async (-> arg0 name) spool-sound)
(set! (-> *art-control* active-stream) (-> arg0 name)))
(let* ((f30-0 (* 0.05859375 (-> s2-4 speed)))
(f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))))
(set! sv-72 (current-str-pos spool-sound))
(set! sv-40 (the-as int (-> *display* base-frame-counter)))
(until (>= (the float v0-39) f28-0)
(if (= (-> self skel root-channel 0) (-> self skel channel)) (logior! (-> self skel status) (janim-status spool)))
(if (or (arg3 self)
(and (<= sv-72 0) (>= (- (-> *display* base-frame-counter) sv-40) (seconds 4)))
(and (< 300 sv-56) (<= sv-72 0)))
(goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(if (< (+ spool-part 1) (-> arg0 parts))
(spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0)
(logclear! (-> self skel status) (janim-status done)))
(execute-commands-up-to *load-state* (ja-aframe-num 0))
(cond
((and (< sv-32 sv-72) (= (current-str-id) spool-sound))
(set! sv-56 (+ sv-56 (- (-> *display* base-frame-counter) (-> *display* old-base-frame-counter))))
(set! sv-40 (the-as int (-> *display* base-frame-counter))))
(else 0))
(set! sv-32 sv-72)
(set! sv-48 (the-as int (-> *display* base-frame-counter)))
(suspend)
(let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0)))
(ja-no-eval :num! (seek!) :frame-num f0-14))
(set! v0-39 (current-str-pos spool-sound))
(set! sv-72 v0-39))
(set! sv-24 f28-0))
(logclear! (-> self skel status) (janim-status spool)))
(else
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part)
(goto cfg-88))))
(set! spool-part (+ spool-part 1)))
(set! spool-part (+ spool-part -1))
(label cfg-88)
(ja-abort-spooled-anim arg0 arg2 spool-part)
(local-vars (v0-39 int))
(let ((spool-part 0))
(let ((sv-24 -17.0))
(let ((old-skel-status (-> self skel status))))
(let ((sv-32 -2)
(sv-40 0)
(sv-48 0)
(sv-56 0)
(spool-sound (new-sound-id)))
(backup-load-state-and-set-cmds *load-state* (-> arg0 command-list))
(set-setting! 'spooling (process->ppointer self) 0.0 0)
(logior! (-> self skel status) (janim-status inited drawn done))
(kill-current-level-hint '() '() 'die)
(level-hint-surpress!)
(apply-settings *setting-control*)
(when (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game))
(cond
(arg1 (when (!= (ja-group) arg1) (ja-channel-push! 1 (seconds 0.05)) (ja :group! arg1 :num! min)))
(else (ja-channel-set! 0)))
(while (or (handle->process (-> *art-control* spool-lock)) (!= *master-mode* 'game))
(format #t "WARNING: ---------------------> loader stall on lock~%")
(if (arg3 self) (goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -9.0)
(suspend)
(if arg1 (ja :num! (loop!)))))
(set! (-> *art-control* spool-lock) (process->handle self))
(set! sv-48 (the-as int (current-time)))
(while (< spool-part (-> arg0 parts))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(update *art-control* #f)
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(when (!= (file-status *art-control* (-> arg0 name) spool-part) 'active)
(cond
(arg1 (when (!= (ja-group) arg1) (ja-channel-set! 1) (ja :group! arg1 :num! min)))
(else (ja-channel-set! 0)))
(while (!= (file-status *art-control* (-> arg0 name) spool-part) 'active)
(if (arg3 self) (goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(format #t "WARNING: ---------------------> loader stall on art ~S ~D~%" (-> arg0 name) spool-part)
(suspend)
(if arg1 (ja :num! (loop!)))))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(let ((s2-4 (the-as art-joint-anim (lookup-art (-> self draw art-group) (-> arg0 name) art-joint-anim))))
(cond
(s2-4
(ja-channel-set! 1)
(ja-no-eval :group! s2-4 :num! (seek!) :frame-num 0.0)
(when (zero? spool-part)
(str-play-async (-> arg0 name) spool-sound)
(set! (-> *art-control* active-stream) (-> arg0 name)))
(let* ((f30-0 (* 0.05859375 (-> s2-4 speed)))
(f28-0 (+ sv-24 (/ (the float (+ (-> s2-4 data 0 length) -1)) f30-0))))
(let ((sv-72 (current-str-pos spool-sound)))
(set! sv-40 (the-as int (current-time)))
(until (>= (the float v0-39) f28-0)
(if (= (-> self skel root-channel 0) (-> self skel channel)) (logior! (-> self skel status) (janim-status spool)))
(if (or (arg3 self)
(and (<= sv-72 0) (time-elapsed? (the-as time-frame sv-40) (seconds 4)))
(and (< 300 sv-56) (<= sv-72 0)))
(goto cfg-88))
(spool-push *art-control* (-> arg0 name) spool-part self -20.0)
(if (< (+ spool-part 1) (-> arg0 parts))
(spool-push *art-control* (-> arg0 name) (+ spool-part 1) self -10.0)
(logclear! (-> self skel status) (janim-status done)))
(execute-commands-up-to *load-state* (ja-aframe-num 0))
(cond
((and (< sv-32 sv-72) (= (current-str-id) spool-sound))
(+! sv-56 (- (current-time) (-> *display* old-base-frame-counter)))
(set! sv-40 (the-as int (current-time))))
(else 0))
(set! sv-32 sv-72)
(set! sv-48 (the-as int (current-time)))
(suspend)
(let ((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0)))
(ja-no-eval :num! (seek!) :frame-num f0-14))
(set! v0-39 (current-str-pos spool-sound))
(set! sv-72 v0-39)))
(set! sv-24 f28-0))
(logclear! (-> self skel status) (janim-status spool)))
(else
;; og:preserve-this fixed broken format string
(format 0 "ERROR: <asg> ~A in spool anim loop for ~A ~D, but not loaded.~%" self (-> arg0 name) spool-part)
(goto cfg-88))))
(+! spool-part 1))))
(+! spool-part -1)
(label cfg-88)
(ja-abort-spooled-anim arg0 arg2 spool-part))
0)
(defbehavior ja-abort-spooled-anim process-drawable ((arg0 spool-anim) (arg1 art-joint-anim) (arg2 int))
@@ -738,7 +725,7 @@
(str-play-stop (-> arg0 name))
(set! (-> *art-control* active-stream) #f)
(logclear! (-> self skel status) (janim-status drawn done))
(if (zero? (logand (-> self skel status) (janim-status inited))) (logclear! (-> self skel status) (janim-status inited)))
(if (not (logtest? (-> self skel status) (janim-status inited))) (logclear! (-> self skel status) (janim-status inited)))
(remove-setting! 'spooling)
(cond
((and arg1 (>= arg2 0))
+3
View File
@@ -5,6 +5,9 @@
;; various math helpers
(defmacro square (x)
`(* ,x ,x))
;; DECOMP BEGINS
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+4 -7
View File
@@ -133,16 +133,13 @@
;; the basic idea is that we apply two rotations:
;; the first moves our y axis toward the desired's y axis, and the second moves
;; out z axis. These are both rate limited.
(local-vars (sv-96 vector))
(let ((quat (get-quaternion this)))
(let ((temp-quat (new 'stack-no-clear 'quaternion)))
(when (< 0.0 z-rate)
(let ((s1-0 quaternion-from-two-vectors-max-angle!)
(s0-0 temp-quat))
(set! sv-96 (vector-y-quaternion! (new 'stack-no-clear 'vector) quat))
(let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) target))
(a3-1 (* z-rate (seconds-per-frame))))
(s1-0 s0-0 sv-96 a2-1 a3-1)))
(quaternion-from-two-vectors-max-angle! temp-quat
(vector-y-quaternion! (new 'stack-no-clear 'vector) quat)
(vector-y-quaternion! (new 'stack-no-clear 'vector) target)
(* z-rate (seconds-per-frame)))
(quaternion-normalize! (quaternion*! quat temp-quat quat)))
(when (< 0.0 y-rate)
(quaternion-from-two-vectors-max-angle! temp-quat
File diff suppressed because it is too large Load Diff
+2 -4
View File
@@ -46,10 +46,8 @@
(none))
(defmethod setup-from-to-y-vel! ((this trajectory) (from vector) (to vector) (y-vel float) (grav float))
"Set up a trajectory with the given initial y velocity."
(let* ((f0-0 y-vel)
(f1-3 (- (* f0-0 f0-0) (* 2.0 (- (-> from y) (-> to y)) grav)))
(f0-3 900.0))
(let ((f1-3 (- (square y-vel) (* 2.0 (- (-> from y) (-> to y)) grav)))
(f0-3 900.0))
(when (>= f1-3 0.0)
(let ((f0-4 (sqrtf f1-3))) (set! f0-3 (fmax (/ (- (- y-vel) f0-4) grav) (/ (+ (- y-vel) f0-4) grav)))))
(setup-from-to-duration! this from to f0-3 grav))
@@ -20,242 +20,221 @@
(arg3 (pointer uint32))
(arg4 (pointer uint64))
(arg5 (pointer symbol)))
(local-vars
(sv-16 vector)
(sv-20 (pointer uint32))
(sv-24 (pointer uint64))
(sv-28 (pointer symbol))
(sv-32 uint)
(sv-40 uint)
(sv-48 symbol)
(sv-52 vector)
(sv-56 vector)
(sv-160 vector)
(sv-164 collide-tri-result)
(sv-208 vector)
(sv-212 vector)
(sv-272 vector)
(sv-276 vector))
(set! sv-16 arg2)
(set! sv-20 arg3)
(set! sv-24 arg4)
(set! sv-28 arg5)
(set! sv-32 (-> arg3 0))
(set! sv-40 (-> arg4 0))
(set! sv-48 (-> arg5 0))
(set! sv-52 (-> arg0 unknown-vector60))
(set! sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16))
(vector-normalize! sv-56 1.0)
(if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) (set! sv-32 (logior sv-32 512)))
(vector-cross! sv-52 sv-16 sv-56)
(if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) (vector-negate! sv-52 sv-52))
(vector-normalize! sv-52 1.0)
(set! sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal)))
(set! sv-164 (new 'stack 'collide-tri-result))
(vector-normalize! sv-160 1.0)
(if (< (vector-dot sv-160 sv-16) 0.0) (vector-negate! sv-160 sv-160))
(set! (-> arg0 unknown-float-coverage-0) 4095996000.0)
(set! (-> arg0 unknown-float-coverage-2) 4095996000.0)
(set! sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2))
(set! sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))
(vector+float*! sv-212 sv-212 sv-160 4096.0)
(when (>= (probe-using-line-sphere *collide-cache*
sv-208
sv-212
409.6
(-> arg1 best-from-prim collide-with)
sv-164
(new 'static 'pat-surface :noentity #x1))
0.0)
(set! (-> arg0 unknown-float-coverage-0)
(vector-dot (-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect))))
(set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad))
0)
(set! sv-272
(vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 dynam gravity-normal) 819.2))
(set! sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0))
(vector+float*! sv-272 sv-272 sv-160 -819.2)
(vector+float*! sv-276 sv-276 sv-160 -4096.0)
(when (>= (probe-using-line-sphere *collide-cache*
sv-272
sv-276
409.6
(-> arg1 best-from-prim collide-with)
sv-164
(new 'static 'pat-surface :noentity #x1))
0.0)
(set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect)))
(set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad))
0)
(when (and (not (logtest? sv-32 512))
(and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1))
(and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w)))
(zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)))))
(set! sv-32 (logior sv-32 128))
(set! (-> arg0 unknown-dword-coverage) (the-as int (current-time)))
(set! sv-40 (logior sv-40 128))
(set-time! (-> arg0 unknown-dword21))
(let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22)))
(f0-21 (if (logtest? sv-32 2) (cos (- 16384.0 (acos (-> arg0 coverage)))) (-> arg0 coverage)))
(f1-11 (vector-dot (-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)))))
(if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) (set! sv-48 (the-as symbol #f)))
(when (and (or (and (< f0-21 0.95) (>= f30-0 0.0))
(and (logtest? sv-32 32) (< f0-21 0.3))
(< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)))
(>= (vector-dot sv-52 sv-16) -0.000001))
(set! (-> arg0 surf) *edge-surface*)
(set! sv-32 (logior sv-32 1024))
(set! sv-48 (the-as symbol #f))
(when (logtest? sv-32 32)
(set! sv-48 #t)
(set! sv-32 (logior sv-32 4096))))))
(if (< (-> arg0 surface-angle) 0.0) (set! sv-48 #t))
(when sv-48
(cond
((and (or (= (-> arg0 poly-pat mode) (pat-mode ground))
(and (logtest? sv-32 8)
(>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61))
(< 0.3 (fabs (-> arg0 surface-angle)))))
(not (logtest? sv-32 128)))
(set! sv-32 (logior sv-32 64))
(set! sv-40 (logior sv-40 128))
(set-time! (-> arg0 unknown-dword21))
(set! sv-48 (the-as symbol #f)))
(#t (set! sv-32 (logior sv-32 64)) (set! sv-40 (logior sv-40 128)) (set-time! (-> arg0 unknown-dword21)))))
(set! (-> sv-24 0) sv-40)
(set! (-> sv-20 0) sv-32)
(set! (-> sv-28 0) sv-48)
(let ((sv-16 arg2)
(sv-20 arg3)
(sv-24 arg4)
(sv-28 arg5)
(sv-32 (-> arg3 0))
(sv-40 (-> arg4 0))
(sv-48 (-> arg5 0)))
(let ((sv-52 (-> arg0 unknown-vector60)))
(let ((sv-56 (vector-cross! (-> arg0 unknown-vector-coverage-2) (-> arg0 poly-normal) sv-16)))
(vector-normalize! sv-56 1.0)
(if (>= (fabs (vector-dot (-> arg0 dynam gravity-normal) sv-56)) 0.866) (logior! sv-32 512))
(vector-cross! sv-52 sv-16 sv-56))
(if (< 0.0 (vector-dot (-> arg0 dynam gravity-normal) sv-52)) (vector-negate! sv-52 sv-52))
(vector-normalize! sv-52 1.0)
(let ((sv-160 (vector-flatten! (-> arg0 unknown-vector-coverage-3) sv-52 (-> arg0 dynam gravity-normal)))
(sv-164 (new 'stack 'collide-tri-result)))
(vector-normalize! sv-160 1.0)
(if (< (vector-dot sv-160 sv-16) 0.0) (vector-negate! sv-160 sv-160))
(set! (-> arg0 unknown-float-coverage-0) 4095996000.0)
(set! (-> arg0 unknown-float-coverage-2) 4095996000.0)
(let ((sv-208 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) sv-160 2867.2))
(sv-212 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)))
(vector+float*! sv-212 sv-212 sv-160 4096.0)
(when (>= (probe-using-line-sphere *collide-cache*
sv-208
sv-212
409.6
(-> arg1 best-from-prim collide-with)
sv-164
(new 'static 'pat-surface :noentity #x1))
0.0)
(set! (-> arg0 unknown-float-coverage-0)
(vector-dot (-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> sv-164 intersect))))
(set! (-> arg0 unknown-float-coverage-1) (the-as float (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-0 quad) (-> sv-164 normal quad))
0))
(let ((sv-272 (vector+float*! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 dynam gravity-normal) 819.2))
(sv-276 (vector-normalize-copy! (new 'stack-no-clear 'vector) (-> arg0 dynam gravity-normal) -20480.0)))
(vector+float*! sv-272 sv-272 sv-160 -819.2)
(vector+float*! sv-276 sv-276 sv-160 -4096.0)
(when (>= (probe-using-line-sphere *collide-cache*
sv-272
sv-276
409.6
(-> arg1 best-from-prim collide-with)
sv-164
(new 'static 'pat-surface :noentity #x1))
0.0)
(set! (-> arg0 unknown-float-coverage-2) (vector-vector-distance sv-272 (-> sv-164 intersect)))
(set! (-> arg0 unknown-u32-coverage-0) (the-as uint (-> sv-164 pat)))
(set! (-> arg0 unknown-vector-coverage-1 quad) (-> sv-164 normal quad))
0)))
(when (and (not (logtest? sv-32 512))
(and (or (< (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(= (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61) 1))
(and (< (-> arg0 unknown-float-coverage-2) (* 2.0 (-> arg1 best-from-prim local-sphere w)))
(zero? (shr (shl (-> arg0 unknown-u32-coverage-0) 58) 61)))))
(logior! sv-32 128)
(set! (-> arg0 unknown-dword-coverage) (the-as int (current-time)))
(logior! sv-40 128)
(set-time! (-> arg0 unknown-dword21))
(let ((f30-0 (vector-dot sv-52 (-> arg0 unknown-vector22)))
(f0-21 (if (logtest? sv-32 2) (cos (- 16384.0 (acos (-> arg0 coverage)))) (-> arg0 coverage)))
(f1-11 (vector-dot (-> arg0 dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg0 trans) (-> arg1 best-tri intersect)))))
(if (or (not (logtest? sv-32 32)) (< 0.5 f0-21)) (set! sv-48 (the-as symbol #f)))
(when (and (or (and (< f0-21 0.95) (>= f30-0 0.0))
(and (logtest? sv-32 32) (< f0-21 0.3))
(< f1-11 (/ (-> arg1 best-from-prim local-sphere w) -4)))
(>= (vector-dot sv-52 sv-16) -0.000001))
(set! (-> arg0 surf) *edge-surface*)
(logior! sv-32 1024)
(set! sv-48 (the-as symbol #f))
(when (logtest? sv-32 32)
(set! sv-48 #t)
(logior! sv-32 4096))))))
(if (< (-> arg0 surface-angle) 0.0) (set! sv-48 #t))
(when sv-48
(cond
((and (or (= (-> arg0 poly-pat mode) (pat-mode ground))
(and (logtest? sv-32 8)
(>= (* 1.25 (-> arg1 best-from-prim local-sphere w)) (-> arg0 unknown-float-coverage-0))
(zero? (shr (shl (the-as int (-> arg0 unknown-float-coverage-1)) 58) 61))
(< 0.3 (fabs (-> arg0 surface-angle)))))
(not (logtest? sv-32 128)))
(logior! sv-32 64)
(logior! sv-40 128)
(set-time! (-> arg0 unknown-dword21))
(set! sv-48 (the-as symbol #f)))
(#t (logior! sv-32 64) (logior! sv-40 128) (set-time! (-> arg0 unknown-dword21)))))
(set! (-> sv-24 0) sv-40)
(set! (-> sv-20 0) sv-32)
(set! (-> sv-28 0) sv-48))
(the-as uint 0))
(defun target-collision-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(local-vars (sv-80 vector) (sv-84 vector) (sv-88 matrix) (sv-96 int) (sv-104 int) (sv-160 symbol))
(set! sv-80 (new-stack-vector0))
(set! sv-84 (new-stack-vector0))
(let ((v1-2 (new 'stack-no-clear 'matrix)))
(let ((sv-80 (new-stack-vector0))
(sv-84 (new-stack-vector0))
(v1-2 (new 'stack-no-clear 'matrix)))
(dotimes (a0-1 2)
(set! (-> v1-2 vector a0-1 quad) (the-as uint128 0)))
(set! sv-88 v1-2))
(set! sv-96 0)
(set! sv-104 0)
(set! (-> sv-88 vector 0 quad) (-> arg3 quad))
(set! (-> sv-88 vector 1 quad) (-> arg3 quad))
(let ((a1-3 (new 'stack-no-clear 'vector)))
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(move-by-vector! arg0 a1-3))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(if (= (-> arg0 poly-pat mode) (pat-mode wall)) (set! sv-104 (logior sv-104 1)))
(if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) (set! sv-104 (logior sv-104 32)))
(let ((v1-23 (new 'stack-no-clear 'vector)))
(set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(vector-! sv-80 v1-23 (-> arg1 best-tri intersect)))
(vector-normalize! sv-80 1.0)
(set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal)))
(when (< (-> arg0 coverage) 0.0)
(set! (-> arg0 coverage) 0.0)
(vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal))
(vector-normalize! sv-80 1.0))
(if (< (-> arg0 coverage) 0.9999) (set! sv-104 (logior sv-104 24)))
(let ((v1-33 (-> sv-80 quad))) (set! (-> sv-84 quad) v1-33))
(if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)))
(set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad))
(collide-shape-moving-angle-set! arg0 sv-84 (the-as vector (-> sv-88 vector)))
(if (< (-> arg0 poly-angle) -0.2) (set! sv-96 (logior sv-96 16)))
(if (< (-> arg0 poly-angle) 0.0) (set! sv-96 (logior sv-96 #x4000)))
(set! sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle)))
(if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle)))))
(set! sv-160 (the-as symbol #f)))
(if sv-160 (set! sv-104 (logior sv-104 2)))
(if (logtest? sv-104 8)
(target-collision-low-coverage arg0
arg1
sv-84
(the-as (pointer uint32) (& sv-104))
(the-as (pointer uint64) (& sv-96))
(& sv-160)))
(when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf)))
(set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))))
(set! sv-96 (logior sv-96 2048))
(when (not sv-160)
(let ((f30-0 (- 1.0 (-> arg0 surf impact-fric))))
(when (< f30-0 1.0)
(let ((s3-1 (new-stack-vector0))
(f28-0 (vector-dot (-> arg0 dynam gravity-normal) (the-as vector (-> sv-88 vector)))))
0.0
(vector-! s3-1 (the-as vector (-> sv-88 vector)) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0))
(let* ((f0-20 (vector-length s3-1))
(f1-9 f0-20))
(if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0)))
(vector+! (the-as vector (-> sv-88 vector))
(vector-float*! (the-as vector (-> sv-88 vector)) (-> arg0 dynam gravity-normal) f28-0)
(vector-float*! s3-1 s3-1 (/ f0-20 f1-9)))))))))
(set! sv-96 (logior sv-96 4))
(cond
((-> arg1 best-to-prim)
(set! sv-96 (logior sv-96 32))
(set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))))
((= (-> arg0 poly-pat material) (pat-material waterbottom)))
(else (set! sv-96 (logior sv-96 4096))))
(cond
(sv-160
(set! sv-104 (logior sv-104 4))
(set! sv-96 (logior sv-96 8))
(set! (-> arg0 cur-pat mode) 1)
(set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad))
(set! (-> arg0 wall-pat) (-> arg1 best-tri pat))
(-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127))
(cond
(#f
(sound-play "cursor-options")
(set! sv-104 (logior sv-104 8192))
(vector-reflect-flat-above! arg2 (the-as vector (-> sv-88 vector)) sv-84))
(else (vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84)))
(cond
((not (and (>= (-> arg1 best-from-prim local-sphere w)
(vector-dot (-> arg0 ground-poly-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point))))
(and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2))
(not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3)))
(not (logtest? sv-104 32))))))
(else
(set! sv-104 (logior sv-104 256))
(set! sv-104 (logand -65 sv-104))
(let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal))))
(vector-normalize! s3-4 1.0)
(vector-float*! arg2 s3-4 (vector-dot (the-as vector (-> sv-88 vector)) s3-4)))
(vector+! arg2 arg2 (-> arg0 poly-normal)))))
(else
(set! sv-96 (logior sv-96 1))
(set! (-> arg0 cur-pat mode) 0)
(if (= (-> arg1 best-from-prim prim-id) 6) (set! (-> arg0 local-normal quad) (-> sv-84 quad)))
(vector-reflect-flat! arg2 (the-as vector (-> sv-88 vector)) sv-84)
(vector+! arg2 arg2 sv-84)
(set! (-> arg0 ground-touch-point w) 0.0)
(when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event))))
(set! sv-96 (logior sv-96 2))
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad))
(set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal)))
(set-time! (-> arg0 unknown-dword10))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(set! sv-104 (logior sv-104 2048))
(if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (set! sv-96 (logior sv-96 1024))))))
(logior! (-> arg0 status) sv-96)
(set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104))
(update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 vector 1) arg2)
(set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127))
(the-as cshape-moving-flags sv-96))
(let ((sv-88 v1-2)
(sv-96 0))
(let ((sv-104 0))
(set! (-> sv-88 vector 0 quad) (-> arg3 quad))
(set! (-> sv-88 vector 1 quad) (-> arg3 quad))
(let ((a1-3 (new 'stack-no-clear 'vector)))
(vector-float*! a1-3 (-> arg1 move-vec) (-> arg1 best-u))
(move-by-vector! arg0 a1-3))
(set-and-handle-pat! arg0 (-> arg1 best-tri pat))
(if (= (-> arg0 poly-pat mode) (pat-mode wall)) (logior! sv-104 1))
(if (logtest? (-> arg0 unknown-surface00 flags) (surface-flags jump)) (logior! sv-104 32))
(let ((v1-23 (new 'stack-no-clear 'vector)))
(set! (-> v1-23 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(vector-! sv-80 v1-23 (-> arg1 best-tri intersect)))
(vector-normalize! sv-80 1.0)
(set! (-> arg0 coverage) (vector-dot sv-80 (-> arg1 best-tri normal)))
(when (< (-> arg0 coverage) 0.0)
(set! (-> arg0 coverage) 0.0)
(vector-flatten! sv-80 sv-80 (-> arg1 best-tri normal))
(vector-normalize! sv-80 1.0))
(if (< (-> arg0 coverage) 0.9999) (logior! sv-104 24))
(set! (-> sv-84 quad) (-> sv-80 quad))
(if (= (-> arg1 best-u) 0.0) (move-by-vector! arg0 (vector-normalize-copy! (new-stack-vector0) sv-84 3.0)))
(set! (-> arg0 poly-normal quad) (-> arg1 best-tri normal quad))
(collide-shape-moving-angle-set! arg0 sv-84 (-> sv-88 vector 0))
(if (< (-> arg0 poly-angle) -0.2) (logior! sv-96 16))
(if (< (-> arg0 poly-angle) 0.0) (logior! sv-96 #x4000))
(let ((sv-160 (< (fabs (-> arg0 surface-angle)) (-> *pat-mode-info* (-> arg0 cur-pat mode) wall-angle))))
(if (and sv-160 (and (= (-> arg0 unknown-surface00 mode) 'dive) (< 0.2 (fabs (-> arg0 surface-angle)))))
(set! sv-160 (the-as symbol #f)))
(if sv-160 (logior! sv-104 2))
(if (logtest? sv-104 8)
(target-collision-low-coverage arg0
arg1
sv-84
(the-as (pointer uint32) (& sv-104))
(the-as (pointer uint64) (& sv-96))
(& sv-160)))
(when (not (logtest? (-> arg0 prev-status) (cshape-moving-flags onsurf)))
(set! (-> arg0 ground-impact-vel) (- (vector-dot (-> arg0 transv) (-> arg0 dynam gravity-normal))))
(logior! sv-96 2048)
(when (not sv-160)
(let ((f30-0 (- 1.0 (-> arg0 surf impact-fric))))
(when (< f30-0 1.0)
(let ((s3-1 (new-stack-vector0))
(f28-0 (vector-dot (-> arg0 dynam gravity-normal) (-> sv-88 vector 0))))
0.0
(vector-! s3-1 (-> sv-88 vector 0) (vector-float*! s3-1 (-> arg0 dynam gravity-normal) f28-0))
(let* ((f0-20 (vector-length s3-1))
(f1-9 f0-20))
(if (< f28-0 0.0) (set! f28-0 (* f28-0 f30-0)))
(vector+! (-> sv-88 vector 0)
(vector-float*! (-> sv-88 vector 0) (-> arg0 dynam gravity-normal) f28-0)
(vector-float*! s3-1 s3-1 (/ f0-20 f1-9)))))))))
(logior! sv-96 4)
(cond
((-> arg1 best-to-prim)
(logior! sv-96 32)
(set! (-> arg0 unknown-vector72 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector73 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-handle00) (process->handle (-> arg1 best-to-prim cshape process))))
((= (-> arg0 poly-pat material) (pat-material waterbottom)))
(else (logior! sv-96 4096)))
(cond
(sv-160
(logior! sv-104 4)
(logior! sv-96 8)
(set! (-> arg0 cur-pat mode) 1)
(set! (-> arg0 unknown-vector70 quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector71 quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector121 quad) (-> sv-84 quad))
(set! (-> arg0 wall-pat) (-> arg1 best-tri pat))
(-> arg0 history-data (logand (+ (-> arg0 unknown-halfword00) 127) 127))
(cond
(#f (sound-play "cursor-options") (logior! sv-104 8192) (vector-reflect-flat-above! arg2 (-> sv-88 vector 0) sv-84))
(else (vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84)))
(cond
((not (and (>= (-> arg1 best-from-prim local-sphere w)
(vector-dot (-> arg0 ground-poly-normal)
(vector-! (new 'stack-no-clear 'vector) (-> arg1 best-tri intersect) (-> arg0 ground-touch-point))))
(and (< 0.0 (vector-dot (-> arg0 ground-poly-normal) arg2))
(not (time-elapsed? (-> arg0 unknown-dword10) (seconds 0.3)))
(not (logtest? sv-104 32))))))
(else
(logior! sv-104 256)
(logand! sv-104 -65)
(let ((s3-4 (vector-cross! (new 'stack-no-clear 'vector) (-> arg0 poly-normal) (-> arg0 ground-poly-normal))))
(vector-normalize! s3-4 1.0)
(vector-float*! arg2 s3-4 (vector-dot (-> sv-88 vector 0) s3-4)))
(vector+! arg2 arg2 (-> arg0 poly-normal)))))
(else
(logior! sv-96 1)
(set! (-> arg0 cur-pat mode) 0)
(if (= (-> arg1 best-from-prim prim-id) 6) (set! (-> arg0 local-normal quad) (-> sv-84 quad)))
(vector-reflect-flat! arg2 (-> sv-88 vector 0) sv-84)
(vector+! arg2 arg2 sv-84)
(set! (-> arg0 ground-touch-point w) 0.0)
(when (not (or (logtest? sv-104 15) (nonzero? (-> arg0 poly-pat event))))
(logior! sv-96 2)
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(set! (-> arg0 unknown-vector53 quad) (-> sv-84 quad))
(set! (-> arg0 unknown-float60) (vector-dot sv-84 (-> arg0 dynam gravity-normal)))
(set-time! (-> arg0 unknown-dword10))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad))
(set! (-> arg0 unknown-vector55 quad) (-> arg1 best-from-prim prim-core world-sphere quad))
(logior! sv-104 2048)
(if (= (-> arg0 poly-pat material) (pat-material waterbottom)) (logior! sv-96 1024))))))
(logior! (-> arg0 status) sv-96)
(set! (-> arg0 reaction-flag) (the-as cshape-reaction-flags sv-104)))
(update! (-> arg0 history-data (-> arg0 unknown-halfword00)) arg0 (-> arg1 best-tri intersect) (-> sv-88 vector 1) arg2)
(set! (-> arg0 unknown-halfword00) (logand (+ (-> arg0 unknown-halfword00) 1) 127))
(the-as cshape-moving-flags sv-96))))
(defun target-collision-no-reaction ((arg0 control-info) (arg1 collide-shape-intersect) (arg2 vector) (arg3 vector))
(if (= (-> arg0 unknown-surface00 mode) 'air) (logior! (-> arg0 reaction-flag) (cshape-reaction-flags csrf05)))
+58 -76
View File
@@ -159,37 +159,25 @@
;; WARN: Stack slot load at 160 mismatch: defined as size 4, got size 16
;; WARN: Stack slot load at 176 mismatch: defined as size 4, got size 16
(defun-debug target-print-stats ((arg0 target) (arg1 symbol))
(local-vars
(sv-64 string)
(sv-80 string)
(sv-96 string)
(sv-112 string)
(sv-128 string)
(sv-144 string)
(sv-160 float)
(sv-176 float))
(when (and *display-ground-stats* arg0)
(let ((s4-0 format)
(s3-0 arg1)
(s2-0 "~0kpoly:~6X mode:~-8S material:~-10S event:~S~%")
(s1-0 (-> arg0 control poly-pat))
(s0-0 (pat-mode->string (-> arg0 control poly-pat))))
(set! sv-64 (pat-material->string (-> arg0 control poly-pat)))
(let ((t1-0 (pat-event->string (-> arg0 control poly-pat)))) (s4-0 s3-0 s2-0 s1-0 s0-0 sv-64 t1-0)))
(let ((s4-1 format)
(s3-1 arg1)
(s2-1 "~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%")
(s1-1 (-> arg0 control ground-pat))
(s0-1 (pat-mode->string (-> arg0 control ground-pat))))
(set! sv-80 (pat-material->string (-> arg0 control ground-pat)))
(let ((t1-1 (pat-event->string (-> arg0 control ground-pat)))) (s4-1 s3-1 s2-1 s1-1 s0-1 sv-80 t1-1)))
(let ((s4-2 format)
(s3-2 arg1)
(s2-2 "~0kwall:~6X mode:~-8S material:~-10S event:~S~%")
(s1-2 (-> arg0 control wall-pat))
(s0-2 (pat-mode->string (-> arg0 control wall-pat))))
(set! sv-96 (pat-material->string (-> arg0 control wall-pat)))
(let ((t1-2 (pat-event->string (-> arg0 control wall-pat)))) (s4-2 s3-2 s2-2 s1-2 s0-2 sv-96 t1-2))))
(format arg1
"~0kpoly:~6X mode:~-8S material:~-10S event:~S~%"
(-> arg0 control poly-pat)
(pat-mode->string (-> arg0 control poly-pat))
(pat-material->string (-> arg0 control poly-pat))
(pat-event->string (-> arg0 control poly-pat)))
(format arg1
"~0kgrnd:~6X mode:~-8S material:~-10S event:~S~%"
(-> arg0 control ground-pat)
(pat-mode->string (-> arg0 control ground-pat))
(pat-material->string (-> arg0 control ground-pat))
(pat-event->string (-> arg0 control ground-pat)))
(format arg1
"~0kwall:~6X mode:~-8S material:~-10S event:~S~%"
(-> arg0 control wall-pat)
(pat-mode->string (-> arg0 control wall-pat))
(pat-material->string (-> arg0 control wall-pat))
(pat-event->string (-> arg0 control wall-pat))))
(when (and *stats-target* arg0)
(format arg1
"~0ks: ~M ~X/~X ~A ~A ~A~%"
@@ -230,39 +218,36 @@
(-> arg0 control poly-angle))
(let ((v1-74 (-> arg0 control trans)))
(format arg1 "pos: ~6,,2m ~6,,2m ~6,,2m " (-> v1-74 x) (-> v1-74 y) (-> v1-74 z)))
(let ((s4-3 format)
(s3-3 arg1)
(s2-3 "~0kpol:~X/~S/~S/~S~%")
(s1-3 (-> arg0 control poly-pat))
(s0-3 (pat-mode->string (-> arg0 control poly-pat))))
(set! sv-112 (pat-material->string (-> arg0 control poly-pat)))
(let ((t1-7 (pat-event->string (-> arg0 control poly-pat)))) (s4-3 s3-3 s2-3 s1-3 s0-3 sv-112 t1-7)))
(let ((s4-4 format)
(s3-4 arg1)
(s2-4 "~0kcur:~X/~S/~S/~S ")
(s1-4 (-> arg0 control cur-pat))
(s0-4 (pat-mode->string (-> arg0 control cur-pat))))
(set! sv-128 (pat-material->string (-> arg0 control cur-pat)))
(let ((t1-8 (pat-event->string (-> arg0 control cur-pat)))) (s4-4 s3-4 s2-4 s1-4 s0-4 sv-128 t1-8)))
(let ((s4-5 format)
(s3-5 arg1)
(s2-5 "~0kgnd:~X/~S/~S/~S~%")
(s1-5 (-> arg0 control ground-pat))
(s0-5 (pat-mode->string (-> arg0 control ground-pat))))
(set! sv-144 (pat-material->string (-> arg0 control ground-pat)))
(let ((t1-9 (pat-event->string (-> arg0 control ground-pat)))) (s4-5 s3-5 s2-5 s1-5 s0-5 sv-144 t1-9)))
(format arg1
"~0kpol:~X/~S/~S/~S~%"
(-> arg0 control poly-pat)
(pat-mode->string (-> arg0 control poly-pat))
(pat-material->string (-> arg0 control poly-pat))
(pat-event->string (-> arg0 control poly-pat)))
(format arg1
"~0kcur:~X/~S/~S/~S "
(-> arg0 control cur-pat)
(pat-mode->string (-> arg0 control cur-pat))
(pat-material->string (-> arg0 control cur-pat))
(pat-event->string (-> arg0 control cur-pat)))
(format arg1
"~0kgnd:~X/~S/~S/~S~%"
(-> arg0 control ground-pat)
(pat-mode->string (-> arg0 control ground-pat))
(pat-material->string (-> arg0 control ground-pat))
(pat-event->string (-> arg0 control ground-pat)))
(let ((s4-6 format)
(s3-6 arg1)
(s2-6 "~0kvel: x:~M y:~M z:~M yv:~M xzv:~M~%")
(s1-6 (-> arg0 control transv x))
(s0-6 (-> arg0 control transv y)))
(set! sv-160 (-> arg0 control transv z))
(set! sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))
(let ((a0-36 (new-stack-vector0)))
(let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))))
0.0
(vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)))
(let ((f0-18 (vector-length a0-36))) f0-18 (let ((t2-4 f0-18)) (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 t2-4)))))
(s0-6 (-> arg0 control transv y))
(sv-160 (-> arg0 control transv z))
(sv-176 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv)))
(a0-36 (new-stack-vector0)))
(let ((f0-17 (vector-dot (-> arg0 control dynam gravity-normal) (-> arg0 control transv))))
0.0
(vector-! a0-36 (-> arg0 control transv) (vector-float*! a0-36 (-> arg0 control dynam gravity-normal) f0-17)))
(let ((f0-18 (vector-length a0-36))) f0-18 (s4-6 s3-6 s2-6 s1-6 s0-6 sv-160 sv-176 f0-18)))
(format arg1
"~0ky:~,,2M t:~d cy: ~,,2M my: ~,,2M impv:~,,2M "
(-> arg0 control unknown-vector52 y)
@@ -425,7 +410,7 @@
(f0-11 (vector-xz-length s5-0)))
(if (< 0.0 f30-1)
(vector-xz-normalize! s5-0 (+ f0-11 (* f30-1 (-> self control unknown-surface01 slope-down-factor))))
(vector-xz-normalize! s5-0 (- f0-11 (* f30-1 f30-1 (-> self control unknown-surface01 slope-up-factor)))))))))
(vector-xz-normalize! s5-0 (- f0-11 (* (square f30-1) (-> self control unknown-surface01 slope-up-factor)))))))))
(let ((t9-12 vector-xz-normalize!)
(a0-17 (new-stack-vector0)))
(set! (-> a0-17 quad) (-> s5-0 quad))
@@ -470,7 +455,7 @@
(< 0.0
(vector-dot (-> self control dynam gravity-normal)
(vector-! (new 'stack-no-clear 'vector)
(the-as vector (-> self control unknown-sphere-array00 1 prim-core))
(-> self control unknown-sphere-array00 1 prim-core world-sphere)
(-> self control unknown-vector70)))))
(set-time! (-> self control unknown-dword70)))
(if (not (time-elapsed? (-> self control unknown-dword70) (seconds 0.2))) (set! f30-4 (+ 204800.0 f30-4)))
@@ -755,8 +740,7 @@
(if (not (edge-grab-info-method-9 s5-0)) (send-event self 'end-mode))
(if *display-edge-collision-marks* (debug-draw s5-0))
(set! (-> self control ground-pat) (the-as pat-surface (-> s5-0 edge-tri-pat)))
(vector-normalize! (vector-! (-> self control unknown-vector100) (the-as vector (-> s5-0 world-vertex)) (-> s5-0 world-vertex 1))
1.0)
(vector-normalize! (vector-! (-> self control unknown-vector100) (-> s5-0 world-vertex 0) (-> s5-0 world-vertex 1)) 1.0)
(let ((gp-1 (vector-cross! (-> self control unknown-vector101)
(-> self control unknown-vector100)
(-> self control dynam gravity-normal))))
@@ -789,8 +773,7 @@
(let ((gp-0 *edge-grab-info*))
(if (not (edge-grab-info-method-9 gp-0)) (send-event self 'end-mode))
(if *display-edge-collision-marks* (debug-draw gp-0))
(vector-normalize! (vector-! (-> self control unknown-vector100) (the-as vector (-> gp-0 world-vertex)) (-> gp-0 world-vertex 1))
1.0)
(vector-normalize! (vector-! (-> self control unknown-vector100) (-> gp-0 world-vertex 0) (-> gp-0 world-vertex 1)) 1.0)
(vector-cross! (-> self control unknown-vector101)
(-> self control unknown-vector100)
(-> self control dynam gravity-normal))
@@ -863,26 +846,25 @@
(vector<-cspace! gp-0 (joint-node eichar-lod0-jg main))
(+! (-> gp-0 y) -5896.192)
(< (fabs (- (-> gp-0 y) (-> self control trans y))) 8192.0)))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> gp-0 quad)))
(set! (-> (&-> self control unknown-qword00) 0) (-> gp-0 quad)))
(else
(let ((v1-11 (-> self water flags)))
(cond
((and (logtest? v1-11 (water-flags wt09)) (logtest? v1-11 (water-flags wt11 wt12)))
(vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)))
(vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0))
(if (not (and (logtest? (-> self water flags) (water-flags wt12)) (not (logtest? (-> self water flags) (water-flags wt04)))))
(set! (-> self control unknown-float30) (- (-> self water base-height) (-> self water swim-height))))
(&-> (-> self control) unknown-qword00))
(&-> self control unknown-qword00))
((and (logtest? (-> self water flags) (water-flags wt09)) (logtest? (water-flags wt18) (-> self water flags)))
(vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)))
(vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0))
(set! (-> self control unknown-float30) (-> self water base-height)))
((logtest? (-> self control root-prim prim-core action) (collide-action racer))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad)))
(set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad)))
((logtest? (-> self control root-prim prim-core action) (collide-action tube))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control shadow-pos quad)))
(set! (-> (&-> self control unknown-qword00) 0) (-> self control shadow-pos quad)))
((logtest? (-> self draw status) (draw-status hidden no-anim))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad)))
(else
(vector<-cspace! (the-as vector (&-> (-> self control) unknown-qword00)) (the-as cspace (-> self node-list data)))))))))
(set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad)))
(else (vector<-cspace! (the-as vector (&-> self control unknown-qword00)) (-> self node-list data 0))))))))
0
(none))
@@ -1155,7 +1137,7 @@
(quaternion-identity! (-> self control unknown-quaternion00))
(quaternion-identity! (-> self control dir-targ))
(set! (-> self control transv quad) (the-as uint128 0))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> self control trans quad)))
(set! (-> (&-> self control unknown-qword00) 0) (-> self control trans quad)))
(target-exit)
(target-timed-invulnerable-off self)
(set! (-> self control status) (cshape-moving-flags))
@@ -1234,7 +1216,7 @@
(backup-collide-with-as (-> self control))
(set! (-> self game) *game-info*)
(move-to-point! (-> self control) (-> arg0 trans))
(set! (-> (&-> (-> self control) unknown-qword00) 0) (-> arg0 trans quad))
(set! (-> (&-> self control unknown-qword00) 0) (-> arg0 trans quad))
(set! (-> self control unknown-cpad-info00) (-> *cpad-list* cpads 0))
(set! (-> self control unknown-surface01) (new 'process 'surface))
(set! (-> self control unknown-surface01 name) 'current)
+66 -151
View File
@@ -237,30 +237,6 @@
(go arg4 arg0 (-> self attack-info-rec))))))
(defbehavior target-send-attack target ((arg0 process) (arg1 uint) (arg2 touching-shapes-entry) (arg3 int) (arg4 int))
(local-vars
(sv-96 touching-prims-entry)
(sv-128 touching-prims-entry)
(sv-176 touching-prims-entry)
(sv-224 int)
(sv-240 symbol)
(sv-256 symbol)
(sv-272 symbol)
(sv-288 int)
(sv-304 symbol)
(sv-320 symbol)
(sv-336 symbol)
(sv-352 int)
(sv-368 symbol)
(sv-384 symbol)
(sv-400 symbol)
(sv-416 int)
(sv-432 symbol)
(sv-448 symbol)
(sv-464 symbol)
(sv-480 int)
(sv-496 symbol)
(sv-512 symbol)
(sv-528 symbol))
(let ((v1-0 (new 'stack-no-clear 'event-message-block)))
(set! (-> v1-0 from) self)
(set! (-> v1-0 num-params) 4)
@@ -274,33 +250,20 @@
(let ((v1-5 (-> self control unknown-symbol30)))
(cond
((or (= v1-5 'spin) (= v1-5 'spin-air))
(set! sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64)))
(cond
(sv-96
(let ((s4-0 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-0
(let ((t9-3 (method-of-type part-tracker activate)))
(t9-3 (the-as part-tracker s4-0) self 'part-tracker (the-as pointer #x70004000)))
(let ((s3-0 run-function-in-process)
(s2-0 s4-0)
(s1-0 part-tracker-init)
(s0-0 group-spin-hit))
(set! sv-224 -1)
(set! sv-240 (the-as symbol #f))
(set! sv-256 (the-as symbol #f))
(set! sv-272 (the-as symbol #f))
(let ((t3-0 (get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2)))
((the-as (function object object object object object object object object none) s3-0)
s2-0
s1-0
s0-0
sv-224
sv-240
sv-256
sv-272
t3-0)))
(-> s4-0 ppointer))))
(else (effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74)))
(let ((sv-96 (prims-touching? arg2 (-> self control) (the-as uint 64))))
(if sv-96
(process-spawn part-tracker
:init
part-tracker-init
group-spin-hit
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(get-intersect-point (new 'stack-no-clear 'vector) sv-96 (-> self control) arg2)
:to
self)
(effect-control-method-10 (-> self skel effect) 'group-spin-hit (the-as float -1.0) 74)))
(effect-control-method-12 (-> self skel effect)
(-> self control unknown-symbol30)
(the-as float -1.0)
@@ -309,56 +272,32 @@
(static-sound-name "spin-hit"))
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.2)))
((= v1-5 'punch)
(set! sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64)))
(cond
(sv-128
(let ((s4-1 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-1
(let ((t9-11 (method-of-type part-tracker activate)))
(t9-11 (the-as part-tracker s4-1) self 'part-tracker (the-as pointer #x70004000)))
(let ((s3-1 run-function-in-process)
(s2-1 s4-1)
(s1-1 part-tracker-init)
(s0-1 group-punch-hit))
(set! sv-288 -1)
(set! sv-304 (the-as symbol #f))
(set! sv-320 (the-as symbol #f))
(set! sv-336 (the-as symbol #f))
(let ((t3-1 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2)))
((the-as (function object object object object object object object object none) s3-1)
s2-1
s1-1
s0-1
sv-288
sv-304
sv-320
sv-336
t3-1)))
(-> s4-1 ppointer))))
((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-128 v0-14) v0-14)
(let ((s4-2 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-2
(let ((t9-16 (method-of-type part-tracker activate)))
(t9-16 (the-as part-tracker s4-2) self 'part-tracker (the-as pointer #x70004000)))
(let ((s3-2 run-function-in-process)
(s2-2 s4-2)
(s1-2 part-tracker-init)
(s0-2 group-punch-hit))
(set! sv-352 -1)
(set! sv-368 (the-as symbol #f))
(set! sv-384 (the-as symbol #f))
(set! sv-400 (the-as symbol #f))
(let ((t3-2 (get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2)))
((the-as (function object object object object object object object object none) s3-2)
s2-2
s1-2
s0-2
sv-352
sv-368
sv-384
sv-400
t3-2)))
(-> s4-2 ppointer)))))
(let ((sv-128 (prims-touching? arg2 (-> self control) (the-as uint 64))))
(cond
(sv-128
(process-spawn part-tracker
:init
part-tracker-init
group-punch-hit
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2)
:to
self))
((let ((v0-14 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-128 v0-14) v0-14)
(process-spawn part-tracker
:init
part-tracker-init
group-punch-hit
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(get-intersect-point (new 'stack-no-clear 'vector) sv-128 (-> self control) arg2)
:to
self))))
(effect-control-method-12 (-> self skel effect)
(-> self control unknown-symbol30)
(the-as float -1.0)
@@ -375,56 +314,32 @@
(static-sound-name "punch-hit"))
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 (seconds 0.1)))
((= v1-5 'uppercut)
(set! sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64)))
(cond
(sv-176
(let ((s4-3 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-3
(let ((t9-25 (method-of-type part-tracker activate)))
(t9-25 (the-as part-tracker s4-3) self 'part-tracker (the-as pointer #x70004000)))
(let ((s3-3 run-function-in-process)
(s2-3 s4-3)
(s1-3 part-tracker-init)
(s0-3 group-punch-hit))
(set! sv-416 -1)
(set! sv-432 (the-as symbol #f))
(set! sv-448 (the-as symbol #f))
(set! sv-464 (the-as symbol #f))
(let ((t3-3 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2)))
((the-as (function object object object object object object object object none) s3-3)
s2-3
s1-3
s0-3
sv-416
sv-432
sv-448
sv-464
t3-3)))
(-> s4-3 ppointer))))
((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-176 v0-26) v0-26)
(let ((s4-4 (get-process *default-dead-pool* part-tracker #x4000)))
(when s4-4
(let ((t9-30 (method-of-type part-tracker activate)))
(t9-30 (the-as part-tracker s4-4) self 'part-tracker (the-as pointer #x70004000)))
(let ((s3-4 run-function-in-process)
(s2-4 s4-4)
(s1-4 part-tracker-init)
(s0-4 group-punch-hit))
(set! sv-480 -1)
(set! sv-496 (the-as symbol #f))
(set! sv-512 (the-as symbol #f))
(set! sv-528 (the-as symbol #f))
(let ((t3-4 (get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2)))
((the-as (function object object object object object object object object none) s3-4)
s2-4
s1-4
s0-4
sv-480
sv-496
sv-512
sv-528
t3-4)))
(-> s4-4 ppointer)))))
(let ((sv-176 (prims-touching? arg2 (-> self control) (the-as uint 64))))
(cond
(sv-176
(process-spawn part-tracker
:init
part-tracker-init
group-punch-hit
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2)
:to
self))
((let ((v0-26 (prims-touching? arg2 (-> self control) (the-as uint 32)))) (set! sv-176 v0-26) v0-26)
(process-spawn part-tracker
:init
part-tracker-init
group-punch-hit
-1
(the-as symbol #f)
(the-as symbol #f)
(the-as symbol #f)
(get-intersect-point (new 'stack-no-clear 'vector) sv-176 (-> self control) arg2)
:to
self))))
(effect-control-method-10 (-> self skel effect) 'group-uppercut-hit (the-as float -1.0) 23)
(effect-control-method-12 (-> self skel effect)
(-> self control unknown-symbol30)
+5 -5
View File
@@ -63,15 +63,15 @@
(none)))
(defun birth-func-target-orient ((arg0 int) (arg1 sparticle-cpuinfo) (arg2 sparticle-launchinfo))
(local-vars (v1-10 float) (v1-11 float) (sv-16 target))
(local-vars (v1-10 float) (v1-11 float))
(rlet ((vf0 :class vf)
(vf1 :class vf)
(vf2 :class vf))
(init-vf0-vector)
(set! sv-16 *target*)
;; og:preserve-this added check here
(if (not sv-16) (return #f))
(let ((s3-0 (new 'stack-no-clear 'vector)))
(let ((sv-16 *target*)
(s3-0 (new 'stack-no-clear 'vector)))
;; og:preserve-this added check here
(if (not sv-16) (return #f))
(new 'stack-no-clear 'vector)
(let ((s5-0 (new 'stack-no-clear 'quaternion)))
(let ((s2-0 (-> sv-16 control local-normal)))
+52 -44
View File
@@ -114,7 +114,6 @@
hud-normal
hud-waiting))
(define *fp-hud-stack* (malloc 'global #x3800))
(defmethod deactivate ((this first-person-hud))
@@ -341,7 +340,6 @@
(camera-change-to (the-as string 'base) 60 #f)))
:trans
(behavior ()
(local-vars (sv-48 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -364,15 +362,20 @@
(let ((s3-0 run-function-in-process)
(s2-0 s4-0)
(s1-0 projectile-init-by-other)
(s0-0 (-> self entity)))
(set! sv-48 s5-1)
(s0-0 (-> self entity))
(sv-48 s5-1))
(let ((v0-3 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-3 quad)))
(.lvf vf5 (&-> s5-1 quad))
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> sv-48 quad) vf6)
(let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 56 40))
(t2-0 #f))
((the-as (function object object object object object object object none) s3-0) s2-0 s1-0 s0-0 sv-48 gp-1 t1-0 t2-0)))
((the-as (function object object object object object object object none) s3-0)
s2-0
s1-0
s0-0
sv-48
gp-1
(if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 56 40)
#f))
(-> s4-0 ppointer))))
(set-time! (-> self control unknown-dword82)))
(when (cpad-pressed? (-> self control unknown-cpad-info00 number) triangle)
@@ -420,7 +423,6 @@
(target-exit))
:trans
(behavior ()
(local-vars (sv-48 vector))
(rlet ((vf0 :class vf)
(vf4 :class vf)
(vf5 :class vf)
@@ -443,15 +445,20 @@
(let ((s3-0 run-function-in-process)
(s2-0 s4-0)
(s1-0 projectile-init-by-other)
(s0-0 (-> self entity)))
(set! sv-48 s5-1)
(s0-0 (-> self entity))
(sv-48 s5-1))
(let ((v0-4 (camera-pos))) (.mov.vf.w vf6 vf0) (.lvf vf4 (&-> v0-4 quad)))
(.lvf vf5 (&-> s5-1 quad))
(.add.vf.xyz vf6 vf4 vf5)
(.svf (&-> sv-48 quad) vf6)
(let ((t1-0 (if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 120 104))
(t2-0 #f))
((the-as (function object object object object object object object none) s3-0) s2-0 s1-0 s0-0 sv-48 gp-1 t1-0 t2-0)))
((the-as (function object object object object object object object none) s3-0)
s2-0
s1-0
s0-0
sv-48
gp-1
(if (>= (-> self fact eco-level) (-> *FACT-bank* eco-level-max)) 120 104)
#f))
(-> s4-0 ppointer))))
(set-time! (-> self control unknown-dword82)))))
:code
@@ -1638,37 +1645,38 @@
(if (nonzero? arg3)
(process-spawn-function process
(lambda :behavior process ((arg0 vector) (arg1 time-frame) (arg2 float))
(local-vars (sv-32 time-frame) (sv-40 vector) (sv-44 symbol))
(set! sv-32 (current-time))
(let ((v1-2 (new-stack-vector0))) (set! (-> v1-2 quad) (-> arg0 quad)) (set! sv-40 v1-2))
(set! sv-44 #t)
(until (time-elapsed? sv-32 arg1)
(let ((s4-0 (ppointer->process (-> self parent))))
(cond
((and sv-44 (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control unknown-vector52 y)) arg2))
(vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0))
;; og:preserve-this PAL patch here
(when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0)
(let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40)))
(set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-16 x)))))
(set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-16 z))))))))
(else
(if sv-44 (set! sv-32 (current-time)))
(set! sv-44 (the-as symbol #f))
(when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump)
(= (-> (the-as target s4-0) next-state name) 'target-falling))
(let ((v1-30 (-> (the-as target s4-0) control trans))
(s3-0 (-> (the-as target s4-0) control transv)))
(set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x)))
(set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z)))
(let ((f30-0 (vector-xz-length s3-0)))
(if (< 122880.0 f30-0) (vector-xz-normalize! s3-0 (the-as float 122880.0)))
(if (< 4096.0 f30-0)
(forward-up-nopitch->quaternion (-> (the-as target s4-0) control dir-targ)
(vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 (the-as float 1.0))
(vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat))))))))))
(suspend)
0)
(let ((sv-32 (current-time))
(v1-2 (new-stack-vector0)))
(set! (-> v1-2 quad) (-> arg0 quad))
(let ((sv-40 v1-2)
(sv-44 #t))
(until (time-elapsed? sv-32 arg1)
(let ((s4-0 (ppointer->process (-> self parent))))
(cond
((and sv-44 (< (- (-> (the-as target s4-0) control trans y) (-> (the-as target s4-0) control unknown-vector52 y)) arg2))
(vector-xz-normalize! (-> (the-as target s4-0) control transv) (the-as float 0.0))
;; og:preserve-this PAL patch here
(when (< (vector-vector-xz-distance (-> (the-as target s4-0) control trans) sv-40) 20480.0)
(let ((v1-16 (vector-! (new-stack-vector0) (-> (the-as target s4-0) control trans) sv-40)))
(set! (-> (the-as target s4-0) control trans x) (+ (-> sv-40 x) (fmax -2867.2 (fmin 2867.2 (-> v1-16 x)))))
(set! (-> (the-as target s4-0) control trans z) (+ (-> sv-40 z) (fmax -2867.2 (fmin 2867.2 (-> v1-16 z))))))))
(else
(if sv-44 (set! sv-32 (current-time)))
(set! sv-44 (the-as symbol #f))
(when (or (= (-> (the-as target s4-0) next-state name) 'target-duck-high-jump-jump)
(= (-> (the-as target s4-0) next-state name) 'target-falling))
(let ((v1-30 (-> (the-as target s4-0) control trans))
(s3-0 (-> (the-as target s4-0) control transv)))
(set! (-> s3-0 x) (- (-> sv-40 x) (-> v1-30 x)))
(set! (-> s3-0 z) (- (-> sv-40 z) (-> v1-30 z)))
(let ((f30-0 (vector-xz-length s3-0)))
(if (< 122880.0 f30-0) (vector-xz-normalize! s3-0 (the-as float 122880.0)))
(if (< 4096.0 f30-0)
(forward-up-nopitch->quaternion (-> (the-as target s4-0) control dir-targ)
(vector-normalize-copy! (new 'stack-no-clear 'vector) s3-0 (the-as float 1.0))
(vector-y-quaternion! (new 'stack-no-clear 'vector) (-> (the-as target s4-0) control quat))))))))))
(suspend)
0)))
#f)
arg2
arg3
+215 -263
View File
@@ -11,15 +11,6 @@
(if (< arg0 arg1) 0 (- arg0 arg1)))
(defmethod draw-fuel-cell-screen ((this progress) (arg0 int))
(local-vars
(sv-112 int)
(sv-128 int)
(sv-144 int)
(sv-160 (function trsqv float quaternion))
(sv-176 trsqv)
(sv-192 int)
(sv-208 int)
(sv-224 (function string float font-context int none)))
(hide-progress-icons)
(let ((s5-0 (-> *level-task-data* arg0)))
(if (and (= *cheat-mode* 'debug) (cpad-hold? 0 l3)) (format *stdcon* "fcd:~d~%" (-> *game-info* fuel-cell-deaths)))
@@ -27,92 +18,88 @@
(set! (-> *progress-process* 0 particles 15 init-pos x) -320.0)
(set! (-> *progress-process* 0 icons 4 icon-x) -320)
(when (and (!= s5-0 #f) (= (-> *game-info* level-opened arg0) 1))
(set! sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset)))
(set! sv-128 (the int (* 47.0 (-> this transition-percentage-invert))))
0
(let ((s0-0 6)
(s2-0 0)
(s4-1 (if (= (-> this level-transition) 1) (- (-> this transition-offset)) (-> this transition-offset)))
(f30-0 (-> this transition-percentage-invert))
(s1-0 0)
(s3-0 #f))
(when (-> this stat-transition)
(set! sv-128 47)
(set! s2-0
(if (!= (-> this display-state) (-> this next-display-state)) (- (-> this transition-offset)) (-> this transition-offset)))
(set! s4-1 0)
(set! f30-0 1.0))
(set! sv-144 0)
(while (< sv-144 4)
(let ((a0-18 (-> this icons sv-144 icon 0 root)))
(set! sv-176 a0-18)
(set! sv-160 (method-of-object sv-176 set-yaw-angle-clear-roll-pitch!))
(let ((a1-2 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2))))) (sv-160 sv-176 a1-2)))
(set! sv-144 (+ sv-144 1)))
(set! sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2)))
(set! sv-208 0)
(while (< sv-208 (-> s5-0 nb-of-tasks))
(let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id)))
(v1-59 -1)
(a0-25 #f))
(set! (-> this particle-state s0-0) 2)
(cond
((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown)))
(if (= *kernel-boot-message* 'play) (set! (-> this particle-state s0-0) 1)))
((= v0-4 (task-status invalid))
(set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved))
(set! (-> this particle-state s0-0) 3)
(set! a0-25 #t))
((= v0-4 (task-status need-introduction)) (set! v1-59 0))
((= v0-4 (task-status need-reminder-a)) (set! v1-59 0))
((= v0-4 (task-status need-reminder)) (set! v1-59 1))
((= v0-4 (task-status need-reward-speech)) (set! v1-59 2))
((= v0-4 (task-status need-resolution)) (set! v1-59 2)))
(if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) (set! v1-59 0))
(set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0)))
(set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204)))
(+! s0-0 1)
(when (= sv-208 (-> this task-index))
(set! s1-0 v1-59)
(set! s3-0 a0-25)
(set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0)))
(set! (-> this particles 5 init-pos y) (the float (+ s4-1 204)))))
(set! sv-192 (+ sv-192 sv-128))
(set! sv-208 (+ sv-208 1)))
(dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks)))
(set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320)))
(set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194)))
(+! s0-0 1))
(when *common-text*
(when (and (!= s1-0 -1)
(> (-> s5-0 nb-of-tasks) 0)
(>= (-> this task-index) 0)
(< (-> this task-index) (-> s5-0 nb-of-tasks)))
(let ((s0-1 (new 'stack
'font-context
*font-default-matrix*
(- (+ s2-0 32) (-> this left-x-offset))
(+ (/ s4-1 2) 125)
8325000.0
(font-color progress-yellow)
(font-flags shadow kerning))))
(let ((v1-91 s0-1)) (set! (-> v1-91 width) (the float 328)))
(let ((v1-92 s0-1)) (set! (-> v1-92 height) (the float 50)))
(let ((v1-93 s0-1)) (set! (-> v1-93 scale) 0.7))
(set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large))
(set! sv-224 print-game-text-scaled)
(let ((a0-47 (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f))
(a1-57 f30-0)
(a2-15 s0-1)
(a3-2 (the int (* 128.0 f30-0))))
(sv-224 a0-47 a1-57 a2-15 a3-2))
(when s3-0
(set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset))))
(set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175)))
(let ((a0-49 s0-1)) (set! (-> a0-49 color) (font-color progress-blue)))
(let ((v1-104 s0-1)) (set! (-> v1-104 height) (the float 15)))
(let ((v1-105 s0-1)) (set! (-> v1-105 scale) 0.5))
(print-game-text-scaled (lookup-text! *common-text* (text-id task-completed) #f) f30-0 s0-1 (the int (* 128.0 f30-0))))))))))
(let ((sv-112 (- (-> *task-egg-starting-x* (-> s5-0 nb-of-tasks)) (-> this left-x-offset)))
(sv-128 (the int (* 47.0 (-> this transition-percentage-invert)))))
0
(let ((s0-0 6)
(s2-0 0)
(s4-1 (if (= (-> this level-transition) 1) (- (-> this transition-offset)) (-> this transition-offset)))
(f30-0 (-> this transition-percentage-invert))
(s1-0 0)
(s3-0 #f))
(when (-> this stat-transition)
(set! sv-128 47)
(set! s2-0
(if (!= (-> this display-state) (-> this next-display-state)) (- (-> this transition-offset)) (-> this transition-offset)))
(set! s4-1 0)
(set! f30-0 1.0))
(let ((sv-144 0))
(while (< sv-144 4)
(let ((a0-18 (-> this icons sv-144 icon 0 root)))
(set-yaw-angle-clear-roll-pitch! a0-18 (+ (y-angle a0-18) (* 182.04445 (/ (-> *display* time-adjust-ratio) 2)))))
(+! sv-144 1)))
(let ((sv-192 (+ sv-112 (/ (- (* 47 (-> s5-0 nb-of-tasks)) (* sv-128 (-> s5-0 nb-of-tasks))) 2)))
(sv-208 0))
(while (< sv-208 (-> s5-0 nb-of-tasks))
(let ((v0-4 (get-task-status (-> s5-0 task-info sv-208 task-id)))
(v1-59 -1)
(a0-25 #f))
(set! (-> this particle-state s0-0) 2)
(cond
((or (= v0-4 (task-status need-hint)) (= v0-4 (task-status unknown)))
(if (= *kernel-boot-message* 'play) (set! (-> this particle-state s0-0) 1)))
((= v0-4 (task-status invalid))
(set! v1-59 (-> s5-0 task-info sv-208 text-index-when-resolved))
(set! (-> this particle-state s0-0) 3)
(set! a0-25 #t))
((= v0-4 (task-status need-introduction)) (set! v1-59 0))
((= v0-4 (task-status need-reminder-a)) (set! v1-59 0))
((= v0-4 (task-status need-reminder)) (set! v1-59 1))
((= v0-4 (task-status need-reward-speech)) (set! v1-59 2))
((= v0-4 (task-status need-resolution)) (set! v1-59 2)))
(if (and (!= *kernel-boot-message* 'play) (= v1-59 -1)) (set! v1-59 0))
(set! (-> this particles s0-0 init-pos x) (the float (+ sv-192 s2-0)))
(set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 204)))
(+! s0-0 1)
(when (= sv-208 (-> this task-index))
(set! s1-0 v1-59)
(set! s3-0 a0-25)
(set! (-> this particles 5 init-pos x) (the float (+ sv-192 s2-0)))
(set! (-> this particles 5 init-pos y) (the float (+ s4-1 204)))))
(+! sv-192 sv-128)
(+! sv-208 1)))
(dotimes (v1-77 (- 8 (-> s5-0 nb-of-tasks)))
(set! (-> *progress-process* 0 particles s0-0 init-pos x) (the float (+ s2-0 -320)))
(set! (-> this particles s0-0 init-pos y) (the float (+ s4-1 194)))
(+! s0-0 1))
(when *common-text*
(when (and (!= s1-0 -1)
(> (-> s5-0 nb-of-tasks) 0)
(>= (-> this task-index) 0)
(< (-> this task-index) (-> s5-0 nb-of-tasks)))
(let ((s0-1 (new 'stack
'font-context
*font-default-matrix*
(- (+ s2-0 32) (-> this left-x-offset))
(+ (/ s4-1 2) 125)
8325000.0
(font-color progress-yellow)
(font-flags shadow kerning))))
(set-width! s0-1 328)
(set-height! s0-1 50)
(set-scale! s0-1 0.7)
(set! (-> s0-1 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (-> s5-0 task-info (-> this task-index) task-name s1-0) #f)
f30-0
s0-1
(the int (* 128.0 f30-0)))
(when s3-0
(set! (-> s0-1 origin x) (the float (- (+ s2-0 32) (-> this left-x-offset))))
(set! (-> s0-1 origin y) (the float (+ (/ s4-1 2) 175)))
(let ((a0-49 s0-1)) (set! (-> a0-49 color) (font-color progress-blue)))
(set-height! s0-1 15)
(set-scale! s0-1 0.5)
(print-game-text-scaled (lookup-text! *common-text* (text-id task-completed) #f) f30-0 s0-1 (the int (* 128.0 f30-0)))))))))))
0
(none))
@@ -142,13 +129,13 @@
8325000.0
(font-color default)
(font-flags shadow kerning))))
(let ((v1-19 s4-1)) (set! (-> v1-19 width) (the float 328)))
(let ((v1-20 s4-1)) (set! (-> v1-20 height) (the float 70)))
(set-width! s4-1 328)
(set-height! s4-1 70)
(set! (-> s4-1 flags) (font-flags shadow kerning large))
(let ((s3-1 print-game-text-scaled))
(format (clear *temp-string*) "~D/~D" (-> *game-info* money-per-level arg0) (-> *game-counts* data arg0 money-count))
(s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))))
(let ((v1-26 s4-1)) (set! (-> v1-26 width) (the float 428)))
(set-width! s4-1 428)
(+! (-> s4-1 origin x) -220.0)
(+! (-> s4-1 origin y) 40.0)
(set! (-> s4-1 flags) (font-flags shadow kerning middle large))
@@ -189,13 +176,13 @@
8325000.0
(font-color default)
(font-flags shadow kerning))))
(let ((v1-9 s4-1)) (set! (-> v1-9 width) (the float 328)))
(let ((v1-10 s4-1)) (set! (-> v1-10 height) (the float 70)))
(set-width! s4-1 328)
(set-height! s4-1 70)
(set! (-> s4-1 flags) (font-flags shadow kerning large))
(let ((s3-1 print-game-text-scaled))
(format (clear *temp-string*) "~D/~D" s2-0 (-> *game-counts* data arg0 buzzer-count))
(s3-1 *temp-string* f30-0 s4-1 (the int (* 128.0 f30-0))))
(let ((v1-14 s4-1)) (set! (-> v1-14 width) (the float 428)))
(set-width! s4-1 428)
(+! (-> s4-1 origin x) -220.0)
(+! (-> s4-1 origin y) 40.0)
(set! (-> s4-1 flags) (font-flags shadow kerning middle large))
@@ -211,9 +198,9 @@
(none))
(defmethod draw-memcard-storage-error ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.55))
(let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265)))
(let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55)))
(set-scale! arg0 0.55)
(set-width! arg0 265)
(set-height! arg0 55)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(let ((s4-0 (text-id memcard-not-formatted-title)))
(case (-> this display-state)
@@ -224,20 +211,20 @@
(s3-0 *temp-string* (-> this transition-percentage-invert) arg0 128)))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 70.0)
(let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 350)))
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 40)))
(set-width! arg0 350)
(set-height! arg0 40)
(let ((s4-1 print-game-text-scaled))
(format (clear *temp-string*)
(lookup-text! *common-text* (text-id memcard-space-requirement1) #f)
(if (-> this card-info) (-> this card-info mem-required) 0))
(s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128))
(set! (-> arg0 origin y) 115.0)
(let ((v1-17 arg0)) (set! (-> v1-17 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id memcard-space-requirement2) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-19 arg0)) (set! (-> v1-19 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 160.0)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
@@ -248,24 +235,24 @@
(defmethod draw-memcard-format ((this progress) (arg0 font-context))
(set! (-> arg0 origin y) 35.0)
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.55))
(let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265)))
(let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55)))
(set-scale! arg0 0.55)
(set-width! arg0 265)
(set-height! arg0 55)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(let ((s4-0 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-not-formatted-title) #f) 1)
(s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 105.0)
(let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360)))
(let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40)))
(set-width! arg0 360)
(set-height! arg0 40)
(print-game-text-scaled (lookup-text! *common-text* (text-id memcard-not-formatted-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-10 arg0)) (set! (-> v1-10 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 138.0)
(let ((v1-11 arg0)) (set! (-> v1-11 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id format?) #f)
(-> this transition-percentage-invert)
arg0
@@ -274,19 +261,19 @@
(none))
(defmethod draw-memcard-data-exists ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 55.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75)))
(set-width! arg0 365)
(set-height! arg0 75)
(print-game-text-scaled (lookup-text! *common-text* (text-id save-data-already-exists) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin y) 140.0)
(let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360)))
(let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40)))
(set-width! arg0 360)
(set-height! arg0 40)
(print-game-text-scaled (lookup-text! *common-text* (text-id overwrite?) #f)
(-> this transition-percentage-invert)
arg0
@@ -295,18 +282,18 @@
(none))
(defmethod draw-memcard-no-data ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 40.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75)))
(set-width! arg0 365)
(set-height! arg0 75)
(let ((s4-0 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id no-save-data) #f) 1)
(s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128))
(set! (-> arg0 origin y) 130.0)
(let ((v1-7 arg0)) (set! (-> v1-7 width) (the float 360)))
(let ((v1-8 arg0)) (set! (-> v1-8 height) (the float 40)))
(set-width! arg0 360)
(set-height! arg0 40)
(print-game-text-scaled (lookup-text! *common-text* (text-id create-save-data?) #f)
(-> this transition-percentage-invert)
arg0
@@ -315,12 +302,12 @@
(none))
(defmethod draw-memcard-accessing ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 1.0))
(set-scale! arg0 1.0)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 35.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 365)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 75)))
(set-width! arg0 365)
(set-height! arg0 75)
(when (or (< (mod (-> *display* real-frame-counter) 300) 150) (!= (-> this transition-percentage-invert) 1.0))
(let ((a1-1 (text-id loading-data)))
(case (-> this display-state)
@@ -328,12 +315,12 @@
(((progress-screen memcard-formatting)) (set! a1-1 (text-id formatting)))
(((progress-screen memcard-creating)) (set! a1-1 (text-id creating-save-data))))
(print-game-text-scaled (lookup-text! *common-text* a1-1 #f) (-> this transition-percentage-invert) arg0 128)))
(let ((v1-18 arg0)) (set! (-> v1-18 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset))))
(set! (-> arg0 origin y) 100.0)
(let ((v1-22 arg0)) (set! (-> v1-22 width) (the float 370)))
(let ((v1-23 arg0)) (set! (-> v1-23 height) (the float 75)))
(set-width! arg0 370)
(set-height! arg0 75)
(let ((s4-1 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-do-not-remove) #f) 1)
(s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128))
@@ -341,12 +328,12 @@
(none))
(defmethod draw-memcard-insert ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 35.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 310)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 110)))
(set-width! arg0 310)
(set-height! arg0 110)
;; og:preserve-this PAL patch here
(let ((v1-6 (-> this card-info)))
(when (and (= (-> *setting-control* default language) (language-enum japanese)) v1-6 (zero? (-> v1-6 handle)))
@@ -358,24 +345,14 @@
(let ((s4-1 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id insert-memcard) #f) 1)
(s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128))
(let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 130.0)
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id back?) #f) (-> this transition-percentage-invert) arg0 128)
0
(none))
(defmethod draw-memcard-file-select ((this progress) (arg0 font-context))
(local-vars
(sv-16 (function _varargs_ object))
(sv-32 (function _varargs_ object))
(sv-48 (function _varargs_ object))
(sv-64 (function _varargs_ object))
(sv-80 (function _varargs_ object))
(sv-96 (function _varargs_ object))
(sv-112 (function _varargs_ object))
(sv-128 (function _varargs_ object))
(sv-144 (function _varargs_ object)))
(let ((s4-0 (* (+ (-> this transition-offset) -256) 2)))
(if (< s4-0 0) (set! s4-0 0))
(if (< 500 s4-0) (set! s4-0 700))
@@ -392,12 +369,12 @@
128
(if (< f0-13 0.0) (set! f0-13 0.0))
(let ((s4-1 (the int (* 128.0 f0-13))))
(let ((v1-29 arg0)) (set! (-> v1-29 scale) 0.5))
(set-scale! arg0 0.5)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 102 (-> this left-x-offset))))
(set! (-> arg0 origin y) 5.0)
(let ((v1-33 arg0)) (set! (-> v1-33 width) (the float 200)))
(let ((v1-34 arg0)) (set! (-> v1-34 height) (the float 20)))
(set-width! arg0 200)
(set-height! arg0 20)
(print-game-text (lookup-text! *common-text*
(if (= (-> this display-state) (progress-screen load-game)) (text-id select-file-to-load) (text-id select-file-to-save))
#f)
@@ -406,18 +383,18 @@
s4-1
22)
(set! (-> arg0 origin y) 26.0)
(let ((v1-37 arg0)) (set! (-> v1-37 height) (the float 20)))
(set-height! arg0 20)
(let ((s3-3 (-> this card-info))
(s2-0 23))
(dotimes (s1-0 4)
(set! (-> arg0 origin x) (the float (- 41 (-> this left-x-offset))))
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(let ((a0-17 arg0)) (set! (-> a0-17 color) (font-color default)))
(let ((v1-42 arg0)) (set! (-> v1-42 width) (the float 320)))
(set-width! arg0 320)
(cond
((and s3-3 (= (-> s3-3 formatted) 1) (= (-> s3-3 inited) 1) (= (-> s3-3 file s1-0 present) 1))
(set! (-> this particles s2-0 init-pos x) (the float (- 66 (-> this left-x-offset))))
(let ((v1-57 arg0)) (set! (-> v1-57 scale) 0.6))
(set-scale! arg0 0.6)
(if (and (< (-> s3-3 file s1-0 level-index) (length *level-task-data-remap*)) (> (-> s3-3 file s1-0 level-index) 0))
(print-game-text (lookup-text! *common-text*
(-> *level-task-data* (-> *level-task-data-remap* (+ (-> s3-3 file s1-0 level-index) -1)) level-name-id)
@@ -433,46 +410,30 @@
(or (< (mod (- (-> *display* real-frame-counter) (-> this last-option-index-change)) 1200) 600)
(!= (-> this option-index) s1-0)
(-> this in-transition)))
(let ((v1-87 arg0)) (set! (-> v1-87 scale) 0.5))
(set-scale! arg0 0.5)
(+! (-> arg0 origin y) 16.0)
(set! (-> arg0 flags) (font-flags shadow kerning middle large))
(set! (-> arg0 origin x) (the float (- -73 (-> this left-x-offset))))
(let ((v1-91 arg0)) (set! (-> v1-91 width) (the float 350)))
(set-width! arg0 350)
(let ((s0-2 print-game-text))
(set! sv-16 format)
(let ((a0-40 (clear *temp-string*))
(a1-13 "~D")
(a2-5 (the int (-> s3-3 file s1-0 fuel-cell-count))))
(sv-16 a0-40 a1-13 a2-5))
(format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 fuel-cell-count)))
(s0-2 *temp-string* arg0 #f s4-1 22))
(set! (-> arg0 origin x) (the float (- 1 (-> this left-x-offset))))
(let ((s0-3 print-game-text))
(set! sv-32 format)
(let ((a0-44 (clear *temp-string*))
(a1-15 "~D")
(a2-7 (the int (-> s3-3 file s1-0 money-count))))
(sv-32 a0-44 a1-15 a2-7))
(format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 money-count)))
(s0-3 *temp-string* arg0 #f s4-1 22))
(set! (-> arg0 origin x) (the float (- 79 (-> this left-x-offset))))
(let ((s0-4 print-game-text))
(set! sv-48 format)
(let ((a0-48 (clear *temp-string*))
(a1-17 "~D")
(a2-9 (the int (-> s3-3 file s1-0 buzzer-count))))
(sv-48 a0-48 a1-17 a2-9))
(format (clear *temp-string*) "~D" (the int (-> s3-3 file s1-0 buzzer-count)))
(s0-4 *temp-string* arg0 #f s4-1 22))
(+! (-> arg0 origin y) 1.0)
(let ((v1-108 arg0)) (set! (-> v1-108 scale) 1.0))
(set-scale! arg0 1.0)
(set! (-> arg0 flags) (font-flags shadow kerning right large))
(set! (-> arg0 origin x) (the float (- 352 (-> this left-x-offset))))
(let ((s0-5 print-game-text))
(set! sv-64 format)
(let ((a0-52 (clear *temp-string*))
(a1-19 "~D%")
(a2-11 (the int (-> s3-3 file s1-0 completion-percentage))))
(sv-64 a0-52 a1-19 a2-11))
(format (clear *temp-string*) "~D%" (the int (-> s3-3 file s1-0 completion-percentage)))
(s0-5 *temp-string* arg0 #f s4-1 22))
(let ((v1-116 arg0)) (set! (-> v1-116 scale) 0.5))
(set-scale! arg0 0.5)
(+! (-> arg0 origin y) 9.0)
;; og:preserve-this add 'middle' flag when custom-aspect to snap totals with counts
(if (-> *pc-settings* use-vis?)
@@ -481,37 +442,28 @@
;; og:preserve-this when custom-aspect use same offsets from counts for totals
(set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 85 -73) (-> this left-x-offset))))
(let ((s0-6 print-game-text))
(set! sv-80 format)
(let ((a0-56 (clear *temp-string*))
(a1-21 "/~D")
(a2-17 (if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) (-> this total-nb-of-power-cells) 100)))
(sv-80 a0-56 a1-21 a2-17))
(let ((sv-80 format))
(sv-80 (clear *temp-string*)
"/~D"
(if (< 100 (the int (-> s3-3 file s1-0 fuel-cell-count))) (-> this total-nb-of-power-cells) 100)))
(s0-6 *temp-string* arg0 #f s4-1 22))
;; og:preserve-this when custom-aspect use same offsets from counts for totals
(set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 150 1) (-> this left-x-offset))))
(let ((s0-7 print-game-text))
(set! sv-96 format)
(let ((a0-60 (clear *temp-string*))
(a1-23 "/~D")
(a2-19 (-> this total-nb-of-orbs)))
(sv-96 a0-60 a1-23 a2-19))
(format (clear *temp-string*) "/~D" (-> this total-nb-of-orbs))
(s0-7 *temp-string* arg0 #f s4-1 22))
;; og:preserve-this when custom-aspect use same offsets from counts for totals
(set! (-> arg0 origin x) (the float (- (if (-> *pc-settings* use-vis?) 238 79) (-> this left-x-offset))))
(let ((s0-8 print-game-text))
(set! sv-112 format)
(let ((a0-64 (clear *temp-string*))
(a1-25 "/~D")
(a2-21 (-> this total-nb-of-buzzers)))
(sv-112 a0-64 a1-25 a2-21))
(format (clear *temp-string*) "/~D" (-> this total-nb-of-buzzers))
(s0-8 *temp-string* arg0 #f s4-1 22))
(+! (-> arg0 origin y) 15.0))
(else
(+! (-> arg0 origin y) 18.0)
(set! (-> arg0 origin x) (the float (- 28 (-> this left-x-offset))))
(let ((v1-131 arg0)) (set! (-> v1-131 scale) 0.8))
(set-scale! arg0 0.8)
(set! (-> arg0 flags) (font-flags shadow kerning middle large))
(let ((v1-133 arg0)) (set! (-> v1-133 width) (the float 350)))
(set-width! arg0 350)
;; og:preserve-this pc port stuff here, added YMD
(case (scf-get-territory)
((GAME_TERRITORY_SCEA)
@@ -552,7 +504,7 @@
(else
(set! (-> this particles s2-0 init-pos x) -320.0)
(+! (-> arg0 origin y) 12.0)
(let ((v1-173 arg0)) (set! (-> v1-173 scale) 0.7))
(set-scale! arg0 0.7)
(print-game-text (lookup-text! *common-text* (text-id empty) #f) arg0 #f s4-1 22)
(+! (-> arg0 origin y) 29.0)))
(+! s2-0 1)))))
@@ -560,40 +512,40 @@
(none))
(defmethod draw-memcard-auto-save-error ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.6))
(set-scale! arg0 0.6)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 70 (-> this left-x-offset))))
(set! (-> arg0 origin y) 5.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 265)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 35)))
(set-width! arg0 265)
(set-height! arg0 35)
(print-game-text-scaled (lookup-text! *common-text* (text-id error-saving) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 34.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 50)))
(set-width! arg0 360)
(set-height! arg0 50)
(let ((s4-1 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id check-memcard) #f) 1)
(s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128))
(set! (-> arg0 origin y) 89.0)
(let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 360)))
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20)))
(set-width! arg0 360)
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-title) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin y) 118.0)
(let ((v1-15 arg0)) (set! (-> v1-15 width) (the float 360)))
(let ((v1-16 arg0)) (set! (-> v1-16 height) (the float 60)))
(set-width! arg0 360)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-18 arg0)) (set! (-> v1-18 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 160.0)
(let ((v1-19 arg0)) (set! (-> v1-19 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -602,33 +554,33 @@
(none))
(defmethod draw-memcard-removed ((this progress) (arg0 font-context))
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.6))
(set-scale! arg0 0.6)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(set! (-> arg0 origin x) (the float (- 70 (-> this left-x-offset))))
(set! (-> arg0 origin y) 10.0)
(let ((v1-4 arg0)) (set! (-> v1-4 width) (the float 265)))
(let ((v1-5 arg0)) (set! (-> v1-5 height) (the float 55)))
(set-width! arg0 265)
(set-height! arg0 55)
(let ((s4-0 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id memcard-removed) #f) 1)
(s4-0 *temp-string* (-> this transition-percentage-invert) arg0 128))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 78.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 20)))
(set-width! arg0 360)
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-title) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin y) 112.0)
(let ((v1-12 arg0)) (set! (-> v1-12 width) (the float 360)))
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 60)))
(set-width! arg0 360)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-disabled-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-15 arg0)) (set! (-> v1-15 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 160.0)
(let ((v1-16 arg0)) (set! (-> v1-16 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -638,9 +590,9 @@
(defmethod draw-memcard-error ((this progress) (arg0 font-context))
(set! (-> arg0 origin y) 15.0)
(let ((v1-0 arg0)) (set! (-> v1-0 scale) 0.7))
(let ((v1-1 arg0)) (set! (-> v1-1 width) (the float 265)))
(let ((v1-2 arg0)) (set! (-> v1-2 height) (the float 55)))
(set-scale! arg0 0.7)
(set-width! arg0 265)
(set-height! arg0 55)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(let ((s4-0 (text-id error-loading)))
(case (-> this display-state)
@@ -652,14 +604,14 @@
(s3-0 *temp-string* (-> this transition-percentage-invert) arg0 128)))
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 80.0)
(let ((v1-13 arg0)) (set! (-> v1-13 width) (the float 360)))
(let ((v1-14 arg0)) (set! (-> v1-14 height) (the float 70)))
(set-width! arg0 360)
(set-height! arg0 70)
(let ((s4-1 print-game-text-scaled))
(format (clear *temp-string*) (lookup-text! *common-text* (text-id check-memcard-and-retry) #f) 1)
(s4-1 *temp-string* (-> this transition-percentage-invert) arg0 128))
(let ((v1-16 arg0)) (set! (-> v1-16 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 155.0)
(let ((v1-17 arg0)) (set! (-> v1-17 height) (the float 60)))
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -670,9 +622,9 @@
(defmethod draw-auto-save ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 35 (-> this left-x-offset))))
(set! (-> arg0 origin y) 18.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 330)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 60)))
(set-scale! arg0 0.6)
(set-width! arg0 330)
(set-height! arg0 60)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-warn-title) #f)
(-> this transition-percentage-invert)
@@ -680,15 +632,15 @@
128)
(set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset))))
(set! (-> arg0 origin y) 110.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 370)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60)))
(set-width! arg0 370)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id autosave-warn-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 175.0)
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20)))
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -704,9 +656,9 @@
(defmethod draw-pal-change-to-60hz ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 20.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40)))
(set-scale! arg0 0.6)
(set-width! arg0 300)
(set-height! arg0 40)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id screen-change-to-60hz) #f)
(-> this transition-percentage-invert)
@@ -714,21 +666,21 @@
128)
(set! (-> arg0 origin x) (the float (- 15 (-> this left-x-offset))))
(set! (-> arg0 origin y) 60.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 370)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60)))
(set-width! arg0 370)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-warn-support) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin y) 120.0)
(let ((v1-12 arg0)) (set! (-> v1-12 height) (the float 50)))
(set-height! arg0 50)
(print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-warn-timer) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-14 arg0)) (set! (-> v1-14 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 175.0)
(let ((v1-15 arg0)) (set! (-> v1-15 height) (the float 20)))
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -739,9 +691,9 @@
(defmethod draw-no-disc ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 50.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40)))
(set-scale! arg0 0.6)
(set-width! arg0 300)
(set-height! arg0 40)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id no-disc-title) #f)
(-> this transition-percentage-invert)
@@ -749,16 +701,16 @@
128)
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 90.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60)))
(set-width! arg0 360)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id no-disc-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(when (is-cd-in?)
(let ((v1-13 arg0)) (set! (-> v1-13 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 155.0)
(let ((v1-14 arg0)) (set! (-> v1-14 height) (the float 20)))
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -769,9 +721,9 @@
(defmethod draw-bad-disc ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 50.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40)))
(set-scale! arg0 0.6)
(set-width! arg0 300)
(set-height! arg0 40)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id bad-disc-title) #f)
(-> this transition-percentage-invert)
@@ -779,15 +731,15 @@
128)
(set! (-> arg0 origin x) (the float (- 20 (-> this left-x-offset))))
(set! (-> arg0 origin y) 90.0)
(let ((v1-9 arg0)) (set! (-> v1-9 width) (the float 360)))
(let ((v1-10 arg0)) (set! (-> v1-10 height) (the float 60)))
(set-width! arg0 360)
(set-height! arg0 60)
(print-game-text-scaled (lookup-text! *common-text* (text-id bad-disc-msg) #f)
(-> this transition-percentage-invert)
arg0
128)
(let ((v1-12 arg0)) (set! (-> v1-12 scale) 0.65))
(set-scale! arg0 0.65)
(set! (-> arg0 origin y) 155.0)
(let ((v1-13 arg0)) (set! (-> v1-13 height) (the float 20)))
(set-height! arg0 20)
(print-game-text-scaled (lookup-text! *common-text* (text-id continue?) #f)
(-> this transition-percentage-invert)
arg0
@@ -798,9 +750,9 @@
(defmethod draw-quit ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 70.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 40)))
(set-scale! arg0 0.6)
(set-width! arg0 300)
(set-height! arg0 40)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id quit?) #f) (-> this transition-percentage-invert) arg0 128)
0
@@ -809,16 +761,16 @@
(defmethod draw-pal-now-60hz ((this progress) (arg0 font-context))
(set! (-> arg0 origin x) (the float (- 50 (-> this left-x-offset))))
(set! (-> arg0 origin y) 45.0)
(let ((v1-2 arg0)) (set! (-> v1-2 scale) 0.6))
(let ((v1-3 arg0)) (set! (-> v1-3 width) (the float 300)))
(let ((v1-4 arg0)) (set! (-> v1-4 height) (the float 50)))
(set-scale! arg0 0.6)
(set-width! arg0 300)
(set-height! arg0 50)
(set! (-> arg0 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (text-id screen-now-60hz) #f)
(-> this transition-percentage-invert)
arg0
128)
(set! (-> arg0 origin y) 95.0)
(let ((v1-7 arg0)) (set! (-> v1-7 height) (the float 50)))
(set-height! arg0 50)
(print-game-text-scaled (lookup-text! *common-text* (text-id screen-60hz-keep?) #f)
(-> this transition-percentage-invert)
arg0
@@ -1085,14 +1037,14 @@
0.0
(font-color default)
(font-flags shadow kerning))))
(let ((v1-29 s4-2)) (set! (-> v1-29 width) (the float 100)))
(let ((v1-30 s4-2)) (set! (-> v1-30 height) (the float 15)))
(let ((v1-31 s4-2)) (set! (-> v1-31 scale) 0.5))
(set-width! s4-2 100)
(set-height! s4-2 15)
(set-scale! s4-2 0.5)
(set! (-> s4-2 flags) (font-flags shadow kerning large))
(print-game-text (lookup-text! *common-text* (text-id options) #f) s4-2 #f 128 22)
(let ((v1-34 s4-2)) (set! (-> v1-34 width) (the float 160)))
(let ((v1-35 s4-2)) (set! (-> v1-35 height) (the float 22)))
(let ((v1-36 s4-2)) (set! (-> v1-36 scale) 1.3))
(set-width! s4-2 160)
(set-height! s4-2 22)
(set-scale! s4-2 1.3)
(let ((a0-31 s4-2)) (set! (-> a0-31 color) (font-color progress-percent)))
(set! (-> s4-2 origin x)
(+ (- 435.0 (the float (if (< (-> *progress-process* 0 completion-percentage) 10.0) 93 80))) f30-0))
+17 -14
View File
@@ -32,8 +32,8 @@
(movie?)
(handle->process (-> *game-info* pov-camera-handle))
(handle->process (-> *game-info* other-camera-handle))
(< (-> *display* base-frame-counter) (-> *game-info* letterbox-time))
(< (-> *display* base-frame-counter) (-> *game-info* blackout-time))
(< (current-time) (-> *game-info* letterbox-time))
(< (current-time) (-> *game-info* blackout-time))
(!= (-> *setting-control* current bg-a) 0.0)
(!= (-> *setting-control* current bg-a-force) 0.0)
(not (-> *setting-control* current allow-progress))
@@ -43,7 +43,7 @@
(= *cheat-mode* 'camera)))))
(defun pause-allowed? ()
(not (or (< (-> *display* base-frame-counter) (-> *game-info* blackout-time))
(not (or (< (current-time) (-> *game-info* blackout-time))
(!= (-> *setting-control* current bg-a) 0.0)
(!= (-> *setting-control* current bg-a-force) 0.0)
(not (-> *setting-control* current allow-pause))
@@ -229,6 +229,7 @@
(define *progress-save-info* (new 'global 'mc-slot-info))
;; og:preserve-this
(defmacro progress-make-icon (this &key skel &key x &key y &key z &key scale-x &key scale-y)
`(when (< (-> ,this nb-of-icons) 6)
(let ((icon-idx (-> ,this nb-of-icons)))
@@ -410,6 +411,7 @@
(define *progress-stack* (the-as (pointer uint8) (malloc 'global #x3800)))
;; og:preserve-this
(defconstant *progress-stack-top* (&-> *progress-stack* #x3800))
(defun activate-progress ((creator process) (screen progress-screen))
@@ -421,6 +423,7 @@
(make-levels-with-tasks-available-to-progress)
(disable-level-text-file-loading)
(set! (-> *progress-state* starting-state) screen)
;; og:preserve-this
(set! *progress-process* (process-spawn progress :to creator :stack *progress-stack-top*))
(let ((s5-1 *progress-process*))
(set! (-> s5-1 0 completion-percentage) (calculate-completion (-> s5-1 0)))
@@ -485,18 +488,18 @@
0
(none))
(defmethod relocate ((this game-count-info) (arg0 int))
(defmethod relocate ((this game-count-info) (offset int))
"Load in the game-count-info. This is a bit of a hack."
(set! *game-counts* this)
this)
(defmethod relocate ((this progress) (arg0 int))
(defmethod relocate ((this progress) (offset int))
(dotimes (v1-0 (-> this nb-of-particles))
(when (-> this particles v1-0 part)
(if (nonzero? (-> this particles v1-0 part))
(set! (-> this particles v1-0 part)
(the-as sparticle-launch-control (&+ (the-as pointer (-> this particles v1-0 part)) arg0))))))
(the-as progress ((method-of-type process relocate) this arg0)))
(the-as sparticle-launch-control (&+ (the-as pointer (-> this particles v1-0 part)) offset))))))
(the-as progress ((method-of-type process relocate) this offset)))
(defmethod adjust-sprites ((this progress))
(let ((f0-1 (* (1/ METER_LENGTH) (the float (-> this in-out-position)))))
@@ -998,7 +1001,7 @@
(set! (-> (the-as (pointer float) (-> s5-0 (-> this option-index) value-to-modify)))
(-> *progress-state* slider-backup)))
(((game-option-type language))
(set! (-> (the-as (pointer language-enum) (-> s5-0 (-> this option-index) value-to-modify)))
(set! (-> (the-as (pointer language-enum) (-> s5-0 (-> this option-index) value-to-modify)) 0)
(-> *progress-state* language-backup)))
(((game-option-type on-off))
(set! (-> (the-as (pointer symbol) (-> s5-0 (-> this option-index) value-to-modify)) 0)
@@ -1157,7 +1160,7 @@
(sound-volume-off)
(set! (-> *game-info* mode) 'play)
(cond
;; Start a new game differently if speedrunning mode is active
;; og:preserve-this start a new game differently if speedrunning mode is active
((= (-> *pc-settings* speedrunner-mode?) #t) (speedrun-start-full-game-run))
;; start the game normally
(else
@@ -1356,8 +1359,8 @@
(the-as float 8325000.0)
(font-color progress-blue)
(font-flags shadow kerning))))
(let ((v1-103 s5-1)) (set! (-> v1-103 width) (the float 328)))
(let ((v1-104 s5-1)) (set! (-> v1-104 height) (the float 45)))
(set-width! s5-1 328)
(set-height! s5-1 45)
(set! (-> s5-1 flags) (font-flags shadow kerning middle middle-vert large))
(print-game-text-scaled (lookup-text! *common-text* (-> gp-0 level-name-id) #f) f30-0 s5-1 (the int (* 128.0 f30-0)))))))
(case (-> self display-state)
@@ -1523,9 +1526,9 @@
(bucket-id debug)
gp-3
(the-as (pointer dma-tag) a3-10))))
(let ((gp-4 (new 'stack 'font-context *font-default-matrix* 32 50 0.0 (font-color default) (font-flags shadow kerning))))
(let ((v1-42 gp-4)) (set! (-> v1-42 width) (the float 328)))
(let ((v1-43 gp-4)) (set! (-> v1-43 height) (the float 100)))
(let ((gp-4 (new 'stack 'font-context *font-default-matrix* 32 50 (the-as float 0.0) (font-color default) (font-flags shadow kerning))))
(set-width! gp-4 328)
(set-height! gp-4 100)
(logior! (-> gp-4 flags) (font-flags shadow kerning large))
(draw-debug-text-box gp-4)
(print-game-text (-> *common-text* data (-> self current-debug-string) text) gp-4 #f 128 22))))
+12 -13
View File
@@ -57,7 +57,6 @@
(defun store-image ((oddeven int))
"Store an image to image.raw"
(local-vars (ptr-1 (pointer uint128)) (y-idx int) (y-idx-2 int))
(let ((width 512)
(height (-> *video-parms* screen-sy))
(file (new 'debug 'file-stream "image.raw" 'write)))
@@ -77,21 +76,21 @@
(gs-store-image packet (-> buff1 data)))
;; wait for capture to complete.
(sync-path 0 0)
(let ((ptr-0 (-> buff0 data)))
(set! ptr-1 (-> buff1 data))
(let ((ptr-0 (-> buff0 data))
(ptr-1 (-> buff1 data)))
(cond
((zero? oddeven)
(set! y-idx 0)
(while (< y-idx height)
(file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4)))
(file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4)))
(set! y-idx (+ y-idx 1))))
(let ((y-idx 0))
(while (< y-idx height)
(file-stream-write file (&+ ptr-0 (* y-idx (* width 4))) (the-as uint (* width 4)))
(file-stream-write file (&+ ptr-1 (* y-idx (* width 4))) (the-as uint (* width 4)))
(+! y-idx 1))))
(else
(set! y-idx-2 0)
(while (< y-idx-2 height)
(file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4)))
(file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4)))
(set! y-idx-2 (+ y-idx-2 1))))))
(let ((y-idx-2 0))
(while (< y-idx-2 height)
(file-stream-write file (&+ ptr-1 (* y-idx-2 (* width 4))) (the-as uint (* width 4)))
(file-stream-write file (&+ ptr-0 (* y-idx-2 (* width 4))) (the-as uint (* width 4)))
(+! y-idx-2 1))))))
(format #t "oddeven = ~d~%" oddeven)
;; this does nothing.
(delete buff1))
+10 -13
View File
@@ -39,7 +39,7 @@
(let* ((total-normal-phase (- 1.0 total-easing-phase))
(f0-10 out-param)
(f1-12 (+ out-param total-normal-phase))
(f2-5 (* f0-10 f0-10))
(f2-5 (square f0-10))
(f3-3 (+ (* 2.0 f0-10 (- f1-12 f0-10)) f2-5))
(f4-3 (/ f0-10 (- 1.0 f1-12)))
(y-end (+ (* (- 1.0 f1-12) (- 1.0 f1-12) f4-3) f3-3)))
@@ -74,9 +74,8 @@
(defmethod load-params! ((this sync-info) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float))
"Load params from the res of a process, and set them up. If the res lookup fails, returns #f and uses
the specified defaults."
(local-vars (sv-16 res-tag))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(cond
(v1-1
;; res lookup succeeded, we should have two values: a period (not yet in seconds) and a phase.
@@ -94,9 +93,8 @@
(defmethod load-params! ((this sync-info-eased) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float))
"Load settings from a res. Can load settings from just a sync-info and uses defaults.
If res lookup totally fails, will return #f and use all defaults."
(local-vars (sv-16 res-tag))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(cond
(v1-1
;; we may not get all the parameters
@@ -116,9 +114,8 @@
(defmethod load-params! ((this sync-info-paused) (proc process) (default-period uint) (default-phase float) (default-out float) (default-in float))
"Load and setup a sync-info-paused."
(local-vars (sv-16 res-tag))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-1 (res-lump-data (-> proc entity) 'sync pointer :tag-ptr (& sv-16))))
(cond
(v1-1
(if (>= (-> sv-16 elt-count) (the-as uint 4))
@@ -286,7 +283,7 @@
max-times-two: maximum range. result is centered around zero."
(set! (-> this min-time) min-tim)
(set! (-> this max-time) max-time)
(set! (-> this max-val) (* 0.5 max-times-two))
(set! (-> this max-val) (/ max-times-two 2))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(set! (-> this value) 0.0)
@@ -383,8 +380,8 @@
y-range: y results in (-range/2, range/2)"
(set! (-> this min-time) min-time)
(set! (-> this max-time) max-time)
(set! (-> this xz-max) (* 0.5 xz-range))
(set! (-> this y-max) (* 0.5 y-range))
(set! (-> this xz-max) (/ xz-range 2))
(set! (-> this y-max) (/ y-range 2))
(set! (-> this start-time) 0)
(set! (-> this timer) 0)
(vector-reset! (-> this value))
+15 -16
View File
@@ -473,7 +473,6 @@
(set-time! (-> self state-time)))
:code
(behavior ((arg0 symbol))
(local-vars (sv-128 symbol))
(ja-channel-set! 0)
(clear-collide-with-as (-> self root))
(ja-post)
@@ -497,7 +496,7 @@
(f1-2 (- (-> s5-1 z) (-> v1-14 z)))
(f2-1 7372.8)
(f30-0 5734.4)
(f2-2 (/ f2-1 (sqrtf (+ (* f0-1 f0-1) (* f1-2 f1-2)))))
(f2-2 (/ f2-1 (sqrtf (+ (square f0-1) (square f1-2)))))
(f28-0 (* f0-1 f2-2))
(f26-0 (* f1-2 f2-2))
(s4-0 (new-stack-vector0))
@@ -525,20 +524,20 @@
(vector-float*! s3-0 s3-0 10.0)
(spawn-flying-rock s4-0 s3-0 1.0 (-> self entity))))
(when (or (-> self link prev) (-> self link next))
(set! sv-128 (the-as symbol #f))
(apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128))
(when sv-128
(suspend-for (seconds 0.5))
(let ((gp-1 (cond
(arg0 (the-as int #f))
(else
(ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera)
(ppointer->handle (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self))))))
(process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f)
(while (handle->process (the-as handle gp-1))
(suspend)))
(while (-> self child)
(suspend))))
(let ((sv-128 (the-as symbol #f)))
(apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128))
(when sv-128
(suspend-for (seconds 0.5))
(let ((gp-1 (cond
(arg0 (the-as int #f))
(else
(ambient-hint-spawn "gamcam10" (the-as vector #f) *entity-pool* 'camera)
(ppointer->handle (process-spawn pov-camera (-> self root trans) *beachcam-sg* (-> self name) 0 #f '() :to self))))))
(process-drawable-birth-fuel-cell (the-as entity #f) (the-as vector #f) #f)
(while (handle->process (the-as handle gp-1))
(suspend)))
(while (-> self child)
(suspend)))))
(process-entity-status! self (entity-perm-status dead) #t)
(deactivate self)))
+1 -10
View File
@@ -559,7 +559,6 @@
(defstate citb-robotboss-idle (citb-robotboss)
:event
(behavior ((proc process) (argc int) (message symbol) (block event-message-block))
(local-vars (sv-96 int) (sv-112 int))
(the-as symbol
(cond
((= message 'shield-off)
@@ -570,15 +569,7 @@
((= message 'shield-on) (let ((v0-3 #t)) (set! (-> self shield-on) v0-3) v0-3))
((= message 'die) (cleanup-for-death self) (the-as symbol (deactivate self)))
((or (= message 'touch) (= message 'attack))
(let ((s4-0 sound-play-by-name)
(s3-0 (make-u128 #x7061 (the-as uint #x7a2d646c65696873)))
(s2-0 (new-sound-id))
(s1-0 1024)
(s0-0 0))
(set! sv-96 0)
(set! sv-112 1)
(let ((t2-1 (target-pos 0)))
(s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-96 (the-as sound-group sv-112) (the-as symbol t2-1))))
(sound-play "shield-zap" :position (the-as symbol (target-pos 0)))
(the-as symbol
(send-event proc 'shove (-> block param 0) (static-attack-info ((shove-up (meters 2)) (shove-back (meters 3))))))))))
:code
+1 -1
View File
@@ -538,7 +538,7 @@
(set! (-> v1-3 x) f0-13)
(set! (-> v1-3 y) f1-4)
(set! (-> v1-3 z) f2-0)
(set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (* f2-0 f2-0)) (* f1-4 f1-4)) (* f0-13 f0-13)))))
(set! (-> v1-3 w) (sqrtf (- (- (- 1.0 (square f2-0)) (square f1-4)) (square f0-13)))))
(quaternion-rotate-y! (the-as quaternion s5-0) (the-as quaternion s5-0) (+ 16384.0 f30-0))
(cond
((< (-> s5-0 w) 0.0)
+16 -19
View File
@@ -123,8 +123,7 @@
(set! (-> gp-0 quad) (-> self root trans quad))
(set! (-> gp-0 y) (-> (the-as process-drawable (-> self parent 0)) root trans y))
(loop
(let ((f0-6 (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))))
(set! (-> self interp) (* f0-6 f0-6)))
(set! (-> self interp) (square (fmax 0.0 (- 1.0 (* 0.0033333334 (the float (- (current-time) (-> self state-time))))))))
(set! (-> self root trans y)
(- (-> (the-as process-drawable (-> self parent 0)) root trans y) (* 204800.0 (-> self interp))))
(when (and (not s5-0) (< (-> self interp) 0.05))
@@ -204,9 +203,7 @@
(s5-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector)))
(set! (-> s3-0 x) (* 65536.0 (rand-vu)))
(let ((f30-1 14563.556)
(f0-2 (rand-vu-float-range -1.0 1.0)))
(set! (-> s3-0 y) (* f30-1 (* f0-2 f0-2))))
(set! (-> s3-0 y) (* 14563.556 (square (rand-vu-float-range -1.0 1.0))))
(vector-sincos! s5-0 s4-0 s3-0)
(set! (-> this spin-axis x) (* (-> s4-0 y) (-> s4-0 x)))
(set! (-> this spin-axis y) (-> s5-0 y))
@@ -259,7 +256,7 @@
(the-as citb-drop-plat ((method-of-type process-drawable relocate) this offset)))
(defbehavior citb-drop-plat-spawn-children citb-drop-plat ()
(local-vars (s0-0 int) (sv-48 process) (sv-64 int))
(local-vars (s0-0 int))
(let ((gp-0 (new 'stack-no-clear 'vector)))
6
0
@@ -276,19 +273,19 @@
(vector+*! gp-0 gp-0 (-> self z-dir) (* (-> self z-spacing) (the float s5-0)))
(if (-> self child-color-array) (set! s0-0 (-> self child-color-array s1-0)) (set! s0-0 (rand-vu-int-range 0 5)))
(when (nonzero? s0-0)
(set! sv-64 (the int (* 150.0 (rand-vu))))
(set! sv-48 (get-process *default-dead-pool* drop-plat #x4000))
(set! (-> self child-array data s1-0)
(ppointer->handle (when sv-48
(let ((t9-6 (method-of-type drop-plat activate)))
(t9-6 (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000)))
(let ((t9-7 run-function-in-process)
(a0-8 sv-48)
(a1-5 drop-plat-init-by-other)
(a2-4 gp-0)
(t0-0 (-> self duration)))
((the-as (function process function vector int int int none) t9-7) a0-8 a1-5 a2-4 sv-64 (the-as int t0-0) s0-0))
(-> sv-48 ppointer)))))))
(let ((sv-64 (the int (* 150.0 (rand-vu))))
(sv-48 (get-process *default-dead-pool* drop-plat #x4000)))
(set! (-> self child-array data s1-0)
(ppointer->handle (when sv-48
((method-of-type drop-plat activate) (the-as drop-plat sv-48) self 'drop-plat (the-as pointer #x70004000))
((the-as (function process function vector int int int none) run-function-in-process)
sv-48
drop-plat-init-by-other
gp-0
sv-64
(the-as int (-> self duration))
s0-0)
(-> sv-48 ppointer))))))))
(suspend-for (seconds 0.12))
(+! s5-0 s4-0))))
(set-time! (-> self drop-time))
+2 -2
View File
@@ -234,7 +234,7 @@
(when (< f30-0 0.0)
(set! (-> self root trans y) (-> self rise-height))
(go-virtual citb-base-plat-active))
(set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))))
(set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))))
(let ((f0-12 (fmax 0.0 (fmin 1.0 (* 0.000012207031 (+ 409600.0 (-> self root trans y)))))))
(set! (-> self draw color-mult x) f0-12)
(set! (-> self draw color-mult y) f0-12)
@@ -770,7 +770,7 @@
(when (< f30-0 0.0)
(set! (-> self root trans y) (-> self rise-height))
(go-virtual plat-button-idle))
(set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (* f30-0 f30-0))))
(set! (-> self root trans y) (lerp (-> self rise-height) (-> self idle-height) (square f30-0))))
(suspend)))
:post rider-post)
@@ -390,7 +390,6 @@ battlecontroller-default-event-handler
(none)))
(defmethod battlecontroller-method-27 ((this battlecontroller))
(local-vars (sv-16 res-tag))
(set! (-> this fact) (new 'process 'fact-info this (pickup-type eco-pill-random) (-> *FACT-bank* default-pill-inc)))
(set! (-> this path) (new 'process 'path-control this 'path 0.0))
(logior! (-> this path flags) (path-control-flag display draw-line draw-point draw-text))
@@ -439,8 +438,8 @@ battlecontroller-default-event-handler
(set! (-> this creature-type-array 0 type2) babak)
(set! (-> this creature-type-array 0 percent) 1.0)
(let ((s5-3 0))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-49 (res-lump-data (-> this entity) 'lurker-type pointer :tag-ptr (& sv-16))))
(when v1-49
(dotimes (a0-22 (the-as int (-> sv-16 elt-count)))
(let ((a1-15 (-> (the-as (pointer uint32) (&+ v1-49 (* a0-22 4))))))
+5 -4
View File
@@ -12,15 +12,16 @@
(state-time time-frame))
(:state-methods (idle int time-frame symbol)))
(defmethod relocate ((this static-screen) (arg0 int))
(defmethod relocate ((this static-screen) (offset int))
(let ((v1-0 *kernel-context*))
(set! (-> v1-0 relocating-process) this)
(set! (-> v1-0 relocating-min) (the-as int (&-> this type)))
(set! (-> v1-0 relocating-max) (the-as int (+ (+ (-> this allocated-length) -4 (-> process size)) (the-as int this))))
(set! (-> v1-0 relocating-offset) arg0))
(set! (-> v1-0 relocating-offset) offset))
(dotimes (v1-2 1)
(if (nonzero? (-> this part v1-2)) (&+! (-> this part v1-2) arg0)))
(the-as static-screen ((method-of-type process relocate) this arg0)))
(if (nonzero? (-> this part v1-2)) (&+! (-> this part v1-2) offset)))
(the-as static-screen ((method-of-type process relocate) this offset)))
(defmethod deactivate ((this static-screen))
(dotimes (s5-0 1)
+10 -13
View File
@@ -244,7 +244,6 @@
(set-letterbox-frames (seconds 0.017)))
:code
(behavior ((arg0 basic) (arg1 handle))
(local-vars (sv-144 process) (sv-160 vector) (sv-176 process) (sv-192 vector))
(let ((a0-2 (get-task-control (game-task finalboss-movies)))) (save-reminder a0-2 (logior (get-reminder a0-2 0) 2) 0))
(move-to-point! (-> self control) (new 'static 'vector :x 11368946.0 :y 2215900.2 :z -19405602.0 :w 1.0))
(set-quaternion! (-> self control) (the-as quaternion (new 'static 'vector :y -0.8472 :w 0.5312)))
@@ -259,24 +258,22 @@
(s3-1 (vector<-cspace! (new 'stack-no-clear 'vector) (joint-node eichar-lod0-jg neckB))))
(dotimes (s2-0 50)
(when (handle->process (the-as handle arg0))
(let ((s1-0 (handle->process (the-as handle arg0)))
(s0-0 (+ s2-0 4)))
(set! sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)))
(set! sv-144 (get-process *default-dead-pool* powercellalt #x4000))
(let* ((s1-0 (handle->process (the-as handle arg0)))
(s0-0 (+ s2-0 4))
(sv-160 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-0) node-list data s0-0)))
(sv-144 (get-process *default-dead-pool* powercellalt #x4000)))
(when sv-144
(let ((t9-16 (method-of-type powercellalt activate)))
(t9-16 (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000)))
((method-of-type powercellalt activate) (the-as powercellalt sv-144) s1-0 'powercellalt (the-as pointer #x70004000))
(run-now-in-process sv-144 powercellalt-init-by-other s4-3 s3-1 sv-160 s0-0)
(-> sv-144 ppointer))))
(suspend-for (seconds 0.1))
(when (handle->process arg1)
(let ((s1-2 (handle->process arg1))
(s0-1 (+ s2-0 4)))
(set! sv-192 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)))
(set! sv-176 (get-process *default-dead-pool* powercellalt #x4000))
(let* ((s1-2 (handle->process arg1))
(s0-1 (+ s2-0 4))
(sv-192 (vector<-cspace! (new 'stack-no-clear 'vector) (-> (the-as process-drawable s1-2) node-list data s0-1)))
(sv-176 (get-process *default-dead-pool* powercellalt #x4000)))
(when sv-176
(let ((t9-20 (method-of-type powercellalt activate)))
(t9-20 (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000)))
((method-of-type powercellalt activate) (the-as powercellalt sv-176) s1-2 'powercellalt (the-as pointer #x70004000))
(run-now-in-process sv-176 powercellalt-init-by-other s4-3 s3-1 sv-192 s0-1)
(-> sv-176 ppointer))))
(suspend-for (seconds 0.1))))
@@ -25,7 +25,7 @@
(vector-flatten! s5-0 gp-0 (-> this axis))
(vector-normalize! s5-0 (-> this radius-primary))
(vector-! arg1 gp-0 s5-0)
(< (vector-length-squared arg1) (* f30-0 f30-0))))
(< (vector-length-squared arg1) (square f30-0))))
(defmethod torus-method-11 ((this torus) (arg0 vector))
(let ((s4-0 (the-as collide-shape-prim-group (-> *target* control root-prim))))
@@ -43,7 +43,6 @@
(defmethod torus-method-9 ((this torus) (arg0 vector))
(local-vars (sv-256 int) (sv-272 int) (sv-288 int))
(let ((s0-0 (new 'stack-no-clear 'vector))
(s4-0 (new 'stack-no-clear 'vector))
(s3-0 (new 'stack-no-clear 'vector))
@@ -55,30 +54,27 @@
(vector-cross! s4-0 s0-0 (-> this axis))
(matrix-axis-angle! s2-0 s4-0 8192.0)
(vector-float*! (-> s1-0 0) s0-0 (-> this radius-secondary))
(set! sv-256 0)
(while (< sv-256 7)
(vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0)
(set! sv-256 (+ sv-256 1)))
(let ((sv-256 0)) (while (< sv-256 7) (vector-matrix*! (-> s1-0 (+ sv-256 1)) (-> s1-0 sv-256) s2-0) (+! sv-256 1)))
(vector-float*! s0-0 s0-0 (-> this radius-primary))
(dotimes (v1-21 8)
(vector+! (-> s1-0 v1-21) (-> s1-0 v1-21) s0-0))
(matrix-axis-angle! s2-0 (-> this axis) 4096.0)
(dotimes (s0-1 16)
(set! sv-272 0)
(while (< sv-272 7)
(vector+! s4-0 (-> s1-0 sv-272) (-> this origin))
(vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin))
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-272 (+ sv-272 1)))
(let ((sv-272 0))
(while (< sv-272 7)
(vector+! s4-0 (-> s1-0 sv-272) (-> this origin))
(vector+! s3-0 (-> s1-0 (+ sv-272 1)) (-> this origin))
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(+! sv-272 1)))
(vector+! s4-0 (-> s1-0 0) (-> this origin))
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 0)
(while (< sv-288 8)
(vector+! s4-0 (-> s1-0 sv-288) (-> this origin))
(vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0)
(vector+! s3-0 (-> s1-0 sv-288) (-> this origin))
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(set! sv-288 (+ sv-288 1)))))
(let ((sv-288 0))
(while (< sv-288 8)
(vector+! s4-0 (-> s1-0 sv-288) (-> this origin))
(vector-matrix*! (-> s1-0 sv-288) (-> s1-0 sv-288) s2-0)
(vector+! s3-0 (-> s1-0 sv-288) (-> this origin))
(camera-line s4-0 s3-0 (the-as vector4w arg0))
(+! sv-288 1)))))
0
(none))
@@ -122,7 +118,7 @@
(if (< (-> arg0 y) (-> arg1 y)) (set! v1-2 (+ v1-2 (- (-> arg1 y) (-> arg0 y)))))
(let ((f0-6 (* -4.0 v1-2))
(f3-1 (* 4.0 v1-2 (- (-> arg1 y) (-> arg0 y)))))
(set! (-> self y-vel) (* 0.5 (- (sqrtf (- (* f0-6 f0-6) (* 4.0 f3-1))) f0-6))))
(set! (-> self y-vel) (* 0.5 (- (sqrtf (- (square f0-6) (* 4.0 f3-1))) f0-6))))
(set! (-> self grav) (/ (- (* (-> self y-vel) (-> self y-vel))) (* 2.0 v1-2)))))
(defbehavior arcing-shot-calculate arcing-shot ((arg0 vector) (arg1 float))
@@ -529,19 +525,18 @@
:post transform-post)
(defbehavior redshot-init-by-other redshot ((arg0 vector) (arg1 vector) (arg2 float) (arg3 time-frame) (arg4 time-frame) (arg5 int))
(local-vars (sv-16 collide-shape-prim-sphere))
(let ((s0-0 (new 'process 'collide-shape-moving self (collide-list-enum usually-hit-by-player))))
(set! (-> s0-0 dynam) (copy *standard-dynamics* 'process))
(set! (-> s0-0 reaction) default-collision-reaction)
(set! (-> s0-0 no-reaction) (the-as (function collide-shape-moving collide-shape-intersect vector vector none) nothing))
(set! sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0)))
(set! (-> sv-16 prim-core collide-as) (collide-kind wall-object))
(set! (-> sv-16 collide-with) (collide-kind target))
(set! (-> sv-16 prim-core action) (collide-action solid))
(set! (-> sv-16 prim-core offense) (collide-offense indestructible))
(set! (-> sv-16 transform-index) 4)
(set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0)
(set-root-prim! s0-0 sv-16)
(let ((sv-16 (new 'process 'collide-shape-prim-sphere s0-0 (the-as uint 0))))
(set! (-> sv-16 prim-core collide-as) (collide-kind wall-object))
(set! (-> sv-16 collide-with) (collide-kind target))
(set! (-> sv-16 prim-core action) (collide-action solid))
(set! (-> sv-16 prim-core offense) (collide-offense indestructible))
(set! (-> sv-16 transform-index) 4)
(set-vector! (-> sv-16 local-sphere) 0.0 0.0 0.0 12288.0)
(set-root-prim! s0-0 sv-16))
(set! (-> s0-0 nav-radius) (* 0.75 (-> s0-0 root-prim local-sphere w)))
(backup-collide-with-as s0-0)
(set! (-> self root) s0-0))
+26 -26
View File
@@ -919,38 +919,38 @@
;; WARN: Stack slot load at 64 mismatch: defined as size 4, got size 16
(defbehavior robotboss-redshot robotboss ((arg0 redshot-launch-info) (arg1 symbol))
(local-vars (sv-32 redshot-launch-info) (sv-48 vector) (sv-64 float) (sv-80 time-frame) (sv-96 time-frame))
(set! sv-32 arg0)
(let ((s5-0 arg1))
(let ((sv-32 arg0)
(s5-0 arg1))
(+! (-> self children-spawned) 1)
(let ((gp-0 (new 'stack-no-clear 'vector)))
(vector<-cspace! gp-0 (joint-node robotboss-basic-lod0-jg red_ecoTip))
(let ((s4-0 (get-process *default-dead-pool* redshot #x4000)))
(when s4-0
(let ((t9-2 (method-of-type redshot activate))) (t9-2 (the-as redshot s4-0) self 'redshot (the-as pointer #x70004000)))
(let ((s3-0 run-function-in-process)
(s2-0 s4-0)
(s1-0 redshot-init-by-other)
(s0-0 gp-0))
(set! sv-48 (-> sv-32 dest))
(let ((f30-0 20480.0)
(f28-0 12288.0))
(set! sv-64 (+ f30-0 (* f28-0 (rand-float-gen)))))
(set! sv-80 (-> sv-32 flight-time))
(set! sv-96 (-> sv-32 stall-time))
(let* ((f30-1 300.0)
(v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-20 (the-as number (logior #x3f800000 v1-19)))
(t3-0 (the int (* f30-1 (+ -1.0 (the-as float v1-20))))))
((the-as (function object object object object object object object object none) s3-0)
s2-0
s1-0
s0-0
sv-48
sv-64
sv-80
sv-96
t3-0)))
(let* ((s3-0 run-function-in-process)
(s2-0 s4-0)
(s1-0 redshot-init-by-other)
(s0-0 gp-0)
(sv-48 (-> sv-32 dest))
(f30-0 20480.0)
(f28-0 12288.0)
(v1-10 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-11 (the-as number (logior #x3f800000 v1-10)))
(sv-64 (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-11)))))
(sv-80 (-> sv-32 flight-time))
(sv-96 (-> sv-32 stall-time))
(f30-1 300.0)
(v1-19 (/ (the-as int (rand-uint31-gen *random-generator*)) 256))
(v1-20 (the-as number (logior #x3f800000 v1-19))))
((the-as (function object object object object object object object object none) s3-0)
s2-0
s1-0
s0-0
sv-48
sv-64
sv-80
sv-96
(the int (* f30-1 (+ -1.0 (the-as float v1-20))))))
(-> s4-0 ppointer)))
(when s5-0
(process-spawn part-tracker :init part-tracker-init group-robotboss-redshot-launch 300 #f #f #f gp-0 :to *entity-pool*)
+12 -22
View File
@@ -577,7 +577,6 @@
(if (not (logtest? (-> *camera* master-options) 2)) (cam-slave-go cam-free-floating)))
:code
(behavior ()
(local-vars (sv-32 int) (sv-48 int))
(let* ((gp-0 (-> self change-event-from))
(f28-0 (the-as float (-> (the-as periscope (-> gp-0 0)) tilt)))
(f30-0 (the-as float (-> (the-as periscope (-> gp-0 0)) turn)))
@@ -599,18 +598,10 @@
-1.0)))
(set! (-> s5-0 y) (- (-> s5-0 y) (* 136.53334 (- f26-0))))
(set! (-> s5-0 x) (- (-> s5-0 x) (* 136.53334 (- f0-0))))
(cond
((and (= f26-0 0.0) (= f0-0 0.0)) (sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id)))
(else
(let ((s4-0 sound-play-by-name)
(s3-0 (make-u128 101 (the-as uint #x706f6373656c6574)))
(s2-0 (-> (the-as periscope (-> gp-0 0)) sound-id))
(s1-0 1024)
(s0-0 0))
(set! sv-32 0)
(set! sv-48 1)
(let ((t2-0 (target-pos 0)))
(the-as int (s4-0 (the-as sound-name s3-0) s2-0 s1-0 s0-0 sv-32 (the-as sound-group sv-48) (the-as symbol t2-0)))))))))
(if (and (= f26-0 0.0) (= f0-0 0.0))
(sound-stop (-> (the-as periscope (-> gp-0 0)) sound-id))
(the-as int
(sound-play "telescope" :id (-> (the-as periscope (-> gp-0 0)) sound-id) :position (the-as symbol (target-pos 0)))))))
(cond
((< 136.53334 (-> s5-0 x)) (set! (-> s5-0 x) 136.53334))
((< (-> s5-0 x) -136.53334) (set! (-> s5-0 x) -136.53334)))
@@ -871,15 +862,14 @@
(none))
(defbehavior periscope-test-task-complete? periscope ()
(local-vars (sv-16 symbol))
(set! sv-16 #t)
(apply-all (-> self link)
(lambda ((arg0 entity-actor) (arg1 (pointer symbol)))
(when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete))))
(set! (-> arg1 0) #f)
#t))
(& sv-16))
sv-16)
(let ((sv-16 #t))
(apply-all (-> self link)
(lambda ((arg0 entity-actor) (arg1 (pointer symbol)))
(when (and (= (-> arg0 etype) periscope) (not (logtest? (-> arg0 extra perm status) (entity-perm-status complete))))
(set! (-> arg1 0) #f)
#t))
(& sv-16))
sv-16))
(defbehavior peri-beamcam-init-by-other process ((arg0 string))
(let ((gp-0 (entity-by-name "junglecam-1")))
+8 -9
View File
@@ -56,7 +56,7 @@
((> (-> self draw cur-lod) 0) (ja-post))
(else
(transform-post)
(if *target* (look-at-enemy! (-> *target* neck) (the-as vector (-> self root root-prim prim-core)) #f self)))))
(if *target* (look-at-enemy! (-> *target* neck) (-> self root root-prim prim-core world-sphere) #f self)))))
(suspend)
(ja :num! (seek!))))))
@@ -305,7 +305,6 @@
:post rider-post)
(defmethod init-from-entity! ((this lurkerm-piston) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-32 res-tag))
(logior! (-> this mask) (process-mask platform))
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
@@ -329,15 +328,15 @@
(logior! (-> this skel status) (janim-status inited))
(update-transforms! (-> this root))
(set! (-> this base quad) (-> this root trans quad))
(let ((f30-0 (-> this base y)))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16))))
(set! (-> this base y)
(+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) 0.0)))))
(let* ((f30-0 (-> this base y))
(sv-16 (new 'static 'res-tag))
(v1-32 (res-lump-data arg0 'height-info pointer :tag-ptr (& sv-16))))
(set! (-> this base y)
(+ f30-0 (if (and v1-32 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-32)) 0.0))))
(let ((s4-1 (-> this height)))
(set! (-> s4-1 x) 0.0)
(set! sv-32 (new 'static 'res-tag))
(let ((v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32))))
(let* ((sv-32 (new 'static 'res-tag))
(v1-35 (res-lump-data arg0 'height-info (pointer float) :tag-ptr (& sv-32))))
(set! (-> s4-1 y) (if (and v1-35 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-35 1) 20480.0)))
(set! (-> s4-1 z) 0.0)
(set! (-> s4-1 w) 1.0))
+21 -21
View File
@@ -20,6 +20,7 @@
(:states
plat-flip-idle))
(defskelgroup *plat-flip-sg*
plat-flip
plat-flip-geo-jg
@@ -75,7 +76,6 @@
:post rider-post)
(defmethod init-from-entity! ((this plat-flip) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag))
(logior! (-> this mask) (process-mask platform))
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-player))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
@@ -97,30 +97,30 @@
(set! (-> this base-pos quad) (-> this root trans quad))
(initialize-skeleton this *plat-flip-sg* '())
(logior! (-> this skel status) (janim-status inited))
(let ((f30-0 300.0))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))))
(set! (-> this before-turn-down-time)
(* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-28)) 2.0)))))
(let ((f30-1 300.0))
(set! sv-32 (new 'static 'res-tag))
(let ((v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32))))
(set! (-> this before-turn-up-time)
(* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-31) 1) 0.2)))))
(let* ((f30-0 300.0)
(sv-16 (new 'static 'res-tag))
(v1-28 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))))
(set! (-> this before-turn-down-time)
(* f30-0 (if (and v1-28 (> (the-as int (-> sv-16 elt-count)) 0)) (-> (the-as (pointer float) v1-28)) 2.0))))
(let* ((f30-1 300.0)
(sv-32 (new 'static 'res-tag))
(v1-31 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-32))))
(set! (-> this before-turn-up-time)
(* f30-1 (if (and v1-31 (< 1 (the-as int (-> sv-32 elt-count)))) (-> (the-as (pointer float) v1-31) 1) 0.2))))
(set! (-> this turn-down-time) 300.0)
(set! (-> this turn-up-time) 300.0)
(set! (-> this total-time)
(+ (-> this before-turn-down-time) (-> this turn-down-time) (-> this before-turn-up-time) (-> this turn-up-time)))
(let ((s4-1 (-> this sync))
(s3-1 (method-of-type sync-info setup-params!))
(s2-0 (the int (-> this total-time))))
(set! sv-48 (new 'static 'res-tag))
(let ((v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48))))
(s3-1 s4-1
(the-as uint s2-0)
(if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-35) 0) 0.0)
0.15
0.15)))
(let* ((s4-1 (-> this sync))
(s3-1 (method-of-type sync-info setup-params!))
(s2-0 (the int (-> this total-time)))
(sv-48 (new 'static 'res-tag))
(v1-35 (res-lump-data arg0 'sync-percent pointer :tag-ptr (& sv-48))))
(s3-1 s4-1
(the-as uint s2-0)
(if (and v1-35 (> (the-as int (-> sv-48 elt-count)) 0)) (-> (the-as (pointer float) v1-35) 0) 0.0)
0.15
0.15))
(update-transforms! (-> this root))
(go plat-flip-idle)
(none))
@@ -555,14 +555,13 @@
(ja :num! (seek!))))))
(defmethod init-from-entity! ((this darkecobarrel) (arg0 entity-actor))
(local-vars (sv-16 res-tag))
(set! (-> this root) (the-as collide-shape-moving (new 'process 'trsqv)))
(darkecobarrel-base-init arg0)
(set! (-> this sound) (new 'process 'ambient-sound (static-sound-spec "lav-dark-eco" :fo-max 30) (-> this root trans)))
(logior! (-> this draw status) (draw-status hidden))
(set! (-> this speed) (/ 300.0 (res-lump-float (-> this entity) 'speed :default 61440.0)))
(set! sv-16 (new 'static 'res-tag))
(let ((s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(s5-1 (res-lump-data arg0 'delay pointer :tag-ptr (& sv-16))))
(cond
(s5-1
(set! (-> this spawn-array) (new 'process 'boxed-array time-frame (the-as int (-> sv-16 elt-count))))
@@ -192,7 +192,6 @@
(:conerot-y (degrees 0) (degrees 360))))
(defbehavior driller-lurker-default-event-handler driller-lurker ((arg0 process) (arg1 int) (arg2 symbol) (arg3 event-message-block))
(local-vars (sv-96 collide-shape-prim))
(cond
((= arg2 'attack)
(cond
@@ -215,11 +214,11 @@
(let* ((s1-0 (the-as touching-shapes-entry (-> arg3 param 0)))
(s0-0 (-> s1-0 head)))
(while s0-0
(set! sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0))
(if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid))
(logtest? (-> sv-96 prim-id) 1))
(set! s2-0 #t))
(if (logtest? (-> sv-96 prim-id) 2) (set! s3-0 #t))
(let ((sv-96 (get-touched-prim s0-0 (-> self root-overeride) s1-0)))
(if (and (logtest? (-> (get-touched-prim s0-0 (-> s4-0 control) s1-0) prim-core action) (collide-action solid))
(logtest? (-> sv-96 prim-id) 1))
(set! s2-0 #t))
(if (logtest? (-> sv-96 prim-id) 2) (set! s3-0 #t)))
(set! s0-0 (-> s0-0 next))))
(cond
((or s2-0 (not s3-0))
@@ -644,7 +643,6 @@
(none))
(defmethod init-from-entity! ((this driller-lurker) (arg0 entity-actor))
(local-vars (sv-16 res-tag))
(set! (-> this hit-player?) #f)
(set! (-> this played-drill-sound?) #f)
(set! (-> this hit-player-time) 0)
@@ -731,7 +729,7 @@
(set! (-> this path-speed) 15360.0)
(set! (-> this targ-path-speed) 15360.0)
(set! (-> this up-blend) 0.0)
(set! sv-16 (new 'static 'res-tag))
(let ((sv-16 (new 'static 'res-tag))))
(let ((v1-91 (res-lump-data arg0 'driller-lurker (pointer float) :tag-ptr (the-as (pointer res-tag) (new 'stack-no-clear 'vector)))))
(when v1-91
(set! (-> this path-u) (fmax 0.0 (fmin 1.0 (-> v1-91 0))))
+29 -35
View File
@@ -359,7 +359,6 @@
(none))
(defmethod gnawer-method-24 ((this gnawer))
(local-vars (sv-48 vector) (sv-64 vector))
(let ((s5-0 0)
(s4-0 0))
(let ((f30-0 -1.0)
@@ -370,15 +369,15 @@
(when (= s1-0 s0-0)
(set! s0-0 (rand-vu-int-count s3-0))
(if (= s1-0 s0-0) (set! s0-0 (mod (+ s1-0 1) s3-0))))
(set! sv-48 (new 'stack-no-clear 'vector))
(set! sv-64 (new 'stack-no-clear 'vector))
(eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp)
(eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp)
(let ((f0-4 (vector-vector-distance sv-48 sv-64)))
(when (< f30-0 f0-4)
(set! f30-0 f0-4)
(set! s5-0 s1-0)
(set! s4-0 s0-0))))))
(let ((sv-48 (new 'stack-no-clear 'vector))
(sv-64 (new 'stack-no-clear 'vector)))
(eval-path-curve-div! (-> this path) sv-48 (the float s1-0) 'interp)
(eval-path-curve-div! (-> this path) sv-64 (the float s0-0) 'interp)
(let ((f0-4 (vector-vector-distance sv-48 sv-64)))
(when (< f30-0 f0-4)
(set! f30-0 f0-4)
(set! s5-0 s1-0)
(set! s4-0 s0-0)))))))
(set! (-> this route src-pt-index) s5-0)
(set! (-> this route dest-pt-index) s4-0))
(let ((v1-13 (-> this route src-pt-index))
@@ -411,7 +410,7 @@
(f28-0 (- (-> this route dest-pt-offset y) (-> this route src-pt-offset y))))
(set-vector! (-> this route surface-dir) f30-5 f28-0 0.0 1.0)
(vector-normalize! (-> this route surface-dir) 1.0)
(let ((f0-25 (sqrtf (+ (* f30-5 f30-5) (* f28-0 f28-0)))))
(let ((f0-25 (sqrtf (+ (square f30-5) (square f28-0)))))
(set! (-> this route surface-dist) f0-25)
(set! (-> this route total-dist) (+ 20480.0 f0-25))))
(set! (-> this route total-travel-time)
@@ -442,7 +441,7 @@
(let* ((f0-10 (- (-> s4-0 max x) (-> this root trans x)))
(f1-12 (- (-> s4-0 max y) (-> this root trans y)))
(f2-7 (- (-> s4-0 max z) (-> this root trans z)))
(f0-14 (sqrtf (+ (* f0-10 f0-10) (* f1-12 f1-12) (* f2-7 f2-7))))
(f0-14 (sqrtf (+ (square f0-10) (square f1-12) (square f2-7))))
(a0-3 (-> this draw bounds))
(v1-21 (-> this root root-prim))
(f0-15 (+ 12288.0 f0-14)))
@@ -574,7 +573,6 @@
(set! (-> arg2 y) (+ 4096.0 (-> arg2 y))))
(defmethod gnawer-method-30 ((this gnawer) (arg0 process-drawable))
(local-vars (sv-48 vector))
(let ((gp-0 (-> this entity extra perm)))
(logior! (-> gp-0 status) (entity-perm-status user-set-from-cstage))
(let ((s5-0 (-> gp-0 user-uint16 0))
@@ -583,15 +581,13 @@
(s1-0 (-> this path curve num-cverts)))
(dotimes (s0-0 s1-0)
(when (logtest? (ash 1 s0-0) s5-0)
(let ((a2-0 (new 'stack-no-clear 'vector)))
(set! sv-48 (new 'stack-no-clear 'vector))
(gnawer-method-29 this s0-0 a2-0 sv-48))
(let* ((t9-1 vector-vector-xz-distance)
(a1-2 (-> arg0 root trans))
(f0-0 (t9-1 sv-48 a1-2)))
(when (or (< s2-0 0) (< f0-0 f30-0))
(set! s2-0 s0-0)
(set! f30-0 f0-0))))))
(let ((a2-0 (new 'stack-no-clear 'vector))
(sv-48 (new 'stack-no-clear 'vector)))
(gnawer-method-29 this s0-0 a2-0 sv-48)
(let ((f0-0 (vector-vector-xz-distance sv-48 (-> arg0 root trans))))
(when (or (< s2-0 0) (< f0-0 f30-0))
(set! s2-0 s0-0)
(set! f30-0 f0-0)))))))
(when (>= s2-0 0)
(let ((v0-2 (logxor s5-0 (the-as uint (ash 1 s2-0))))) (set! (-> gp-0 user-int16 0) (the-as int v0-2)) v0-2)))))
@@ -807,7 +803,6 @@
(spool-push *art-control* "maincavecam-gnawer-fuel-cell" 0 self -1.0))
:code
(behavior ()
(local-vars (sv-128 symbol))
(clear-collide-with-as (-> self root))
(set! (-> self skel postbind-function) #f)
(ja-channel-set! 0)
@@ -832,11 +827,11 @@
(set-time! (-> self state-time))
(until (time-elapsed? (-> self state-time) (seconds 0.05))
(suspend)))
(set! sv-128 (the-as symbol #f))
(apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128))
(when sv-128
(save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3)
(go gnawer-give-fuel-cell))
(let ((sv-128 (the-as symbol #f)))
(apply-all (-> self link) actor-link-subtask-complete-hook (& sv-128))
(when sv-128
(save-reminder (get-task-control (game-task cave-gnawers)) (-> self gnawer-id) 3)
(go gnawer-give-fuel-cell)))
(set! (-> self trans-hook) #f)
(process-entity-status! self (entity-perm-status bit-3) #f)
(logior! (-> self mask) (process-mask actor-pause))
@@ -953,7 +948,6 @@
(call-parent-method this offset))
(defmethod init-from-entity! ((this gnawer) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag))
(set! (-> this hidden?) #f)
(set! (-> this show-damage?) #f)
(set! (-> this hit-points) 6)
@@ -1034,8 +1028,8 @@
(let ((f0-40 (res-lump-float (-> this entity) 'rotoffset)))
(quaternion-rotate-y! (-> this root quat) (-> this root quat) f0-40))
(+! (-> this root trans y) -2048.0)
(set! sv-16 (new 'static 'res-tag))
(let ((v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-81 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(when v1-81
(+! (-> this root trans x) (-> v1-81 0))
(+! (-> this root trans y) (-> v1-81 1))
@@ -1046,14 +1040,14 @@
(set! (-> this part2) (create-launch-control group-gnawer-crumbs this))
(set! (-> this total-money) 0)
(set! (-> this money-mask) (the-as uint 0))
(set! sv-32 (new 'static 'res-tag))
(let ((v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32))))
(let* ((sv-32 (new 'static 'res-tag))
(v1-96 (res-lump-data arg0 'extra-count (pointer int32) :tag-ptr (& sv-32))))
(when v1-96
(case (-> v1-96 0)
((5) (set! (-> this total-money) (-> v1-96 1))))))
(when (> (-> this total-money) 0)
(set! sv-48 (new 'static 'res-tag))
(let ((a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48))))
(let* ((sv-48 (new 'static 'res-tag))
(a0-49 (res-lump-data arg0 'gnawer (pointer int32) :tag-ptr (& sv-48))))
(cond
(a0-49
(let ((v1-100 0))
+21 -22
View File
@@ -346,7 +346,7 @@
(cond
((< gp-0 a0-1)
(when (sphere-in-view-frustum? (the-as sphere (-> self root root-prim prim-core)))
(launch-particles (-> *part-id-table* 704) (the-as vector (-> self launch-pos)))
(launch-particles (-> *part-id-table* 704) (-> self launch-pos 0))
(launch-particles (-> *part-id-table* 705) (the-as vector (&-> self stack 112))))
(when (-> self should-play-sound?)
(set! (-> self should-play-sound?) #f)
@@ -369,7 +369,6 @@
(suspend))))
(defmethod init-from-entity! ((this caveflamepots) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag))
(set! (-> this was-deadly?) #f)
(set! (-> this should-play-sound?) #f)
(set! (-> this shove-up) (res-lump-float arg0 'shove :default 8192.0))
@@ -424,8 +423,8 @@
(set! (-> v1-53 0 y) 0.0)
(set! (-> v1-53 0 z) 0.0)
(set! (-> v1-53 0 w) 1.0))
(vector-rotate-around-y! (the-as vector s4-1) (the-as vector s4-1) f30-0)
(vector+! (the-as vector s4-1) (the-as vector s4-1) (-> this root trans)))
(vector-rotate-around-y! (-> s4-1 0) (-> s4-1 0) f30-0)
(vector+! (-> s4-1 0) (-> s4-1 0) (-> this root trans)))
(let ((s4-2 (the-as object (&-> this stack 112))))
(set-vector! (the-as vector s4-2) -6144.0 0.0 0.0 1.0)
(vector-rotate-around-y! (the-as vector s4-2) (the-as vector s4-2) f30-0)
@@ -435,21 +434,21 @@
(let ((a1-19 (-> (the-as collide-shape-prim-group s4-3) prims s3-1 local-sphere)))
(vector-rotate-around-y! a1-19 a1-19 f30-0)))))
(update-transforms! (-> this root))
(let ((f30-1 300.0))
(set! sv-16 (new 'static 'res-tag))
(let ((v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))))
(set! (-> this cycle-speed)
(the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) (-> v1-70 0) 4.0))))))
(let ((f30-2 (the float (-> this cycle-speed))))
(set! sv-32 (new 'static 'res-tag))
(let ((v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32))))
(set! (-> this cycle-offset)
(the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-74 1) 0.0)))))))
(let ((f30-3 300.0))
(set! sv-48 (new 'static 'res-tag))
(let ((v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48))))
(set! (-> this cycle-pause)
(the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) (-> v1-77 2) 2.0))))))
(let* ((f30-1 300.0)
(sv-16 (new 'static 'res-tag))
(v1-70 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-16))))
(set! (-> this cycle-speed)
(the int (* f30-1 (if (and v1-70 (> (the-as int (-> sv-16 elt-count)) 0)) (-> v1-70 0) 4.0)))))
(let* ((f30-2 (the float (-> this cycle-speed)))
(sv-32 (new 'static 'res-tag))
(v1-74 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-32))))
(set! (-> this cycle-offset)
(the-as uint (the int (* f30-2 (if (and v1-74 (< 1 (the-as int (-> sv-32 elt-count)))) (-> v1-74 1) 0.0))))))
(let* ((f30-3 300.0)
(sv-48 (new 'static 'res-tag))
(v1-77 (res-lump-data arg0 'cycle-speed (pointer float) :tag-ptr (& sv-48))))
(set! (-> this cycle-pause)
(the int (* f30-3 (if (and v1-77 (< 2 (the-as int (-> sv-48 elt-count)))) (-> v1-77 2) 2.0)))))
(go caveflamepots-active)
(none))
@@ -809,7 +808,7 @@
(none))
(defmethod init-from-entity! ((this caveelevator) (arg0 entity-actor))
(local-vars (v1-43 int) (sv-16 res-tag))
(local-vars (v1-43 int))
(set! (-> this prev-frame-num) 10000.0)
(set! (-> this last-update-bounce-time) 0)
(logior! (-> this mask) (process-mask platform))
@@ -833,8 +832,8 @@
(initialize-skeleton this *caveelevator-sg* '())
(logior! (-> this skel status) (janim-status inited))
(set! (-> this skel postbind-function) caveelevator-joint-callback)
(set! sv-16 (new 'static 'res-tag))
(let ((v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-28 (res-lump-data arg0 'trans-offset (pointer float) :tag-ptr (& sv-16))))
(when v1-28
(+! (-> this root trans x) (-> v1-28 0))
(+! (-> this root trans y) (-> v1-28 1))
+15 -17
View File
@@ -340,7 +340,6 @@
#f)
(defmethod mother-spider-method-21 ((this mother-spider) (arg0 vector) (arg1 float) (arg2 symbol))
(local-vars (sv-112 process) (sv-128 vector) (sv-144 vector))
(let ((f30-0 (vector-length (-> this swing-pos))))
(when (< 0.0 f30-0)
(let ((s1-0 (new 'stack-no-clear 'vector))
@@ -367,9 +366,9 @@
(logior! (-> this leg-socket-part-mask) (ash 1 s4-1))
(set-time! (-> this leg-socket-part-time s4-1))
(let ((s1-1 (-> *mother-spider-leg-infos* s4-1)))
(let ((s0-0 (new 'stack-no-clear 'vector)))
(set! sv-128 (new 'stack-no-clear 'vector))
(set! sv-144 (new 'stack-no-clear 'vector))
(let ((s0-0 (new 'stack-no-clear 'vector))
(sv-128 (new 'stack-no-clear 'vector))
(sv-144 (new 'stack-no-clear 'vector)))
(vector<-cspace! s0-0 (-> this node-list data (-> s1-1 joint-index0)))
(vector<-cspace! sv-128 (-> this node-list data (-> s1-1 joint-index1)))
(vector-! sv-128 sv-128 s0-0)
@@ -378,12 +377,15 @@
(vector-normalize! sv-144 1.0)
(+! (-> sv-144 y) (rand-vu-float-range 0.0 0.3))
(vector-normalize! sv-144 1.0)
(set! sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000))
(when sv-112
(let ((t9-15 (method-of-type mother-spider-leg activate)))
(t9-15 (the-as mother-spider-leg sv-112) this 'mother-spider-leg (the-as pointer #x70004000)))
(run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144)
(-> sv-112 ppointer)))
(let ((sv-112 (get-process *default-dead-pool* mother-spider-leg #x4000)))
(when sv-112
((method-of-type mother-spider-leg activate)
(the-as mother-spider-leg sv-112)
this
'mother-spider-leg
(the-as pointer #x70004000))
(run-now-in-process sv-112 mother-spider-leg-init-by-other this s0-0 sv-128 sv-144)
(-> sv-112 ppointer))))
(let ((v1-43 (-> (the-as collide-shape-prim-group s3-1) prims (-> s1-1 cprim-index))))
(set! (-> v1-43 collide-with) (collide-kind))
(set! (-> v1-43 prim-core collide-as) (collide-kind))))
@@ -1068,7 +1070,6 @@
(the-as mother-spider ((method-of-type process-drawable relocate) this offset)))
(defmethod init-from-entity! ((this mother-spider) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-64 vector))
(set! (-> this baby-count) 0)
(set! (-> this spit-counter) 0)
(set! (-> this leg-socket-part-mask) 0)
@@ -1194,8 +1195,8 @@
(set! (-> this max-swing-radius) 73728.0)
(set! (-> this max-baby-count) 4)
(let ((s4-1 #f))
(set! sv-16 (new 'static 'res-tag))
(let ((v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v0-31 (res-lump-data arg0 'mother-spider pointer :tag-ptr (& sv-16))))
(cond
(v0-31
(+! (-> this thread-min-trans y) (-> (the-as (pointer float) v0-31) 0))
@@ -1246,10 +1247,7 @@
(eval-path-curve-div! (-> this path) s4-2 (the float s2-9) 'interp)
(vector-! s3-1 (target-pos 0) s4-2)
(set! (-> s3-1 y) 0.0)
(let ((s1-2 vector-rotate-around-y!)
(s0-0 s3-1))
(set! sv-64 s3-1)
(let ((a2-21 (rand-vu-float-range -7281.778 7281.778))) (s1-2 s0-0 sv-64 a2-21)))
(vector-rotate-around-y! s3-1 s3-1 (rand-vu-float-range -7281.778 7281.778))
(vector-normalize! s3-1 1.0)
(spawn-child this s4-2 s3-1 #f))))
(logclear! (-> this mask) (process-mask actor-pause))
+16 -18
View File
@@ -577,27 +577,25 @@
(set! (-> self dead) #t))
:code
(behavior ()
(local-vars (v1-27 symbol) (sv-16 symbol) (sv-20 (pointer process-tree)) (sv-24 entity-actor))
(local-vars (v1-27 symbol))
(process-entity-status! self (entity-perm-status bit-4) #t)
(process-entity-status! self (entity-perm-status dead) #t)
(when (or (-> self link prev) (-> self link next))
(set! sv-16 (the-as symbol #f))
(set! sv-20 (-> self child))
(set! sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0))
(entity-birth-no-kill sv-24)
(apply-all (-> self link) actor-link-dead-hook (& sv-16))
(when (and sv-16 sv-24)
(process-grab? *target*)
(suspend-for (seconds 1))
(process-release? *target*)
(while (let ((a1-4 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-4 from) self)
(set! (-> a1-4 num-params) 0)
(set! (-> a1-4 message) 'task-complete)
(let ((t9-7 send-event-function)
(v1-17 sv-24))
(not (t9-7 (if v1-17 (-> v1-17 extra process)) a1-4))))
(suspend))))
(let ((sv-16 (the-as symbol #f)))
(let ((sv-20 (-> self child))))
(let ((sv-24 (entity-actor-lookup (-> self entity) 'alt-actor 0)))
(entity-birth-no-kill sv-24)
(apply-all (-> self link) actor-link-dead-hook (& sv-16))
(when (and sv-16 sv-24)
(process-grab? *target*)
(suspend-for (seconds 1))
(process-release? *target*)
(while (let ((a1-4 (new 'stack-no-clear 'event-message-block)))
(set! (-> a1-4 from) self)
(set! (-> a1-4 num-params) 0)
(set! (-> a1-4 message) 'task-complete)
(let ((v1-17 sv-24)) (not (send-event-function (if v1-17 (-> v1-17 extra process)) a1-4))))
(suspend))))))
(set! (-> self buoyancy-factor) (* 4.0 (-> self buoyancy-factor)))
(until v1-27
(suspend)
+55 -56
View File
@@ -183,7 +183,6 @@
:event keg-event-handler
:code
(behavior ()
(local-vars (sv-48 float) (sv-64 float) (sv-80 float) (sv-96 float) (sv-112 float))
(let ((gp-0 (new-stack-vector0))
(s5-0 (new 'stack 'vector3s)))
0.0
@@ -195,62 +194,62 @@
(f24-0 102379.1))
(/ 1.0 f24-0)
(let ((f22-0 1.0)
(f20-0 2.5))
(set! sv-48 0.0)
(set! sv-64 0.0)
(set! sv-80 (- (-> *standard-dynamics* gravity-length)))
(f20-0 2.5)
(sv-48 0.0)
(sv-64 0.0)
(sv-80 (- (-> *standard-dynamics* gravity-length))))
(loop
(let ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1)))
(set! sv-96 (- f0-13 (the float (the int f0-13)))))
(if (< sv-96 f30-0) (go keg-in-chute))
(set! f30-0 sv-96)
(set! sv-112 (* sv-96 f28-0))
(eval-path-curve-div! (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) (-> self path-position) sv-112 'interp)
(path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112)
(seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1))
(set! (-> self root trans quad) (-> self path-position quad))
(when (= (-> self keg-behavior) 1)
(cond
((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0)
(let ((v1-32 (-> self draw shadow-ctrl))) (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)))
0
(let ((v1-35 (-> self draw shadow-ctrl))) (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))))
0
(let ((v1-38 (-> self draw shadow-ctrl)))
(set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))))
0)
(else
(let ((v1-41 (-> self draw shadow-ctrl))) (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)))
0
(let ((v1-44 (-> self draw shadow-ctrl))) (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))))
0
(let ((v1-47 (-> self draw shadow-ctrl)))
(set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))))
0))
(let ((f0-32 (- f28-0 sv-112))) (if (< f0-32 f20-0) (set! f22-0 (/ f0-32 f20-0))))
(set! sv-64 (+ sv-64 (* sv-80 (seconds-per-frame))))
(set! sv-48 (+ sv-48 (* sv-64 (seconds-per-frame))))
(when (< sv-48 0.0)
(set! sv-48 0.0)
(activate! (-> self smush) -0.15 90 150 1.0 1.0)
(set! sv-64 f24-0)
(sound-play "barrel-bounce" :vol 80)
(process-spawn part-tracker
:init
part-tracker-init
group-keg-bounce
-1
keg-bounce-set-particle-rotation-callback
(-> self ppointer)
#f
(-> self root trans)
:to
self))
(let ((f0-39 (update! (-> self smush)))) (keg-update-smush self f0-39))
(+! (-> self root trans y) (* f22-0 sv-48))
(set! (-> s5-0 x) 0.0)
(set! (-> s5-0 y) 1.0)
(set! (-> s5-0 z) 0.0))
(let* ((f0-13 (+ (get-current-phase (-> (the-as keg-conveyor-paddle (-> self parent 0)) sync)) f26-1))
(sv-96 (- f0-13 (the float (the int f0-13)))))
(if (< sv-96 f30-0) (go keg-in-chute))
(set! f30-0 sv-96)
(let ((sv-112 (* sv-96 f28-0)))
(eval-path-curve-div! (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) (-> self path-position) sv-112 'interp)
(path-control-method-12 (-> (the-as keg-conveyor-paddle (-> self parent 0)) path) gp-0 sv-112)
(seek-toward-heading-vec! (-> self root) gp-0 131072.0 (seconds 0.1))
(set! (-> self root trans quad) (-> self path-position quad))
(when (= (-> self keg-behavior) 1)
(cond
((>= (vector4-dot (camera-pos) (-> self shadow-enable-plane)) 0.0)
(let ((v1-32 (-> self draw shadow-ctrl))) (logclear! (-> v1-32 settings flags) (shadow-flags disable-draw)))
0
(let ((v1-35 (-> self draw shadow-ctrl))) (set! (-> v1-35 settings top-plane w) (- (-> self path-position y))))
0
(let ((v1-38 (-> self draw shadow-ctrl)))
(set! (-> v1-38 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))))
0)
(else
(let ((v1-41 (-> self draw shadow-ctrl))) (logior! (-> v1-41 settings flags) (shadow-flags disable-draw)))
0
(let ((v1-44 (-> self draw shadow-ctrl))) (set! (-> v1-44 settings top-plane w) (- (-> self path-position y))))
0
(let ((v1-47 (-> self draw shadow-ctrl)))
(set! (-> v1-47 settings bot-plane w) (- (+ -8192.0 (-> self path-position y)))))
0))
(let ((f0-32 (- f28-0 sv-112))) (if (< f0-32 f20-0) (set! f22-0 (/ f0-32 f20-0))))
(+! sv-64 (* sv-80 (seconds-per-frame)))
(+! sv-48 (* sv-64 (seconds-per-frame)))
(when (< sv-48 0.0)
(set! sv-48 0.0)
(activate! (-> self smush) -0.15 90 150 1.0 1.0)
(set! sv-64 f24-0)
(sound-play "barrel-bounce" :vol 80)
(process-spawn part-tracker
:init
part-tracker-init
group-keg-bounce
-1
keg-bounce-set-particle-rotation-callback
(-> self ppointer)
#f
(-> self root trans)
:to
self))
(let ((f0-39 (update! (-> self smush)))) (keg-update-smush self f0-39))
(+! (-> self root trans y) (* f22-0 sv-48))
(set! (-> s5-0 x) 0.0)
(set! (-> s5-0 y) 1.0)
(set! (-> s5-0 z) 0.0))))
(ja :num! (loop!))
(suspend))))))))
:post keg-post)
+7 -8
View File
@@ -973,7 +973,7 @@
(f0-3 f1-3)
(f30-0 (- (* arg2 arg1 arg1)))
(f2-6 (+ f1-3 (* arg1 arg1 arg3)))
(f1-5 (- (* f30-0 f30-0) (* 4.0 f2-6 f0-3)))
(f1-5 (- (square f30-0) (* 4.0 f2-6 f0-3)))
(f28-0 (/ 0.5 f0-3)))
(if (< f1-5 0.0) (return #f))
(let ((f26-0 (sqrtf f1-5)))
@@ -1230,7 +1230,6 @@
:post rider-post)
(defmethod init-from-entity! ((this mistycannon) (arg0 entity-actor))
(local-vars (sv-16 res-tag) (sv-32 res-tag) (sv-48 res-tag))
(logior! (-> this mask) (process-mask enemy))
(let ((s4-0 (new 'process 'collide-shape-moving this (collide-list-enum hit-by-others))))
(set! (-> s4-0 dynam) (copy *standard-dynamics* 'process))
@@ -1286,15 +1285,15 @@
(set! (-> this center-point quad) (-> this root trans quad))
(set! (-> this center-point w) (-> this fact idle-distance)))
(else
(set! sv-16 (new 'static 'res-tag))
(let ((v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16))))
(let* ((sv-16 (new 'static 'res-tag))
(v1-64 (res-lump-data arg0 'center-point pointer :tag-ptr (& sv-16))))
(set! (-> this center-point x)
(if (and v1-64 (< 0.0 (the float (-> sv-16 elt-count)))) (-> (the-as (pointer float) v1-64)) 0.0)))
(set! sv-32 (new 'static 'res-tag))
(let ((v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32))))
(let* ((sv-32 (new 'static 'res-tag))
(v1-67 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-32))))
(set! (-> this center-point y) (if (and v1-67 (< 1.0 (the float (-> sv-32 elt-count)))) (-> v1-67 1) 0.0)))
(set! sv-48 (new 'static 'res-tag))
(let ((v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48))))
(let* ((sv-48 (new 'static 'res-tag))
(v1-70 (res-lump-data arg0 'center-point (pointer float) :tag-ptr (& sv-48))))
(set! (-> this center-point z) (if (and v1-70 (< 2.0 (the float (-> sv-48 elt-count)))) (-> v1-70 2) 0.0)))))
(set! (-> this accuracy-range) 16384.0)
(mistycannon-pick-random-target-point)

Some files were not shown because too many files have changed in this diff Show More