mirror of
https://github.com/open-goal/jak-project
synced 2026-07-03 13:00:50 -04:00
[decomp] game-info (#779)
* support more process stuff * more of game info * add ref file * progress on save
This commit is contained in:
@@ -1370,6 +1370,9 @@ bool TypeSystem::typecheck_base_types(const std::string& input_expected,
|
||||
}
|
||||
|
||||
if (expected == "seconds") {
|
||||
if (actual == "seconds") {
|
||||
return true;
|
||||
}
|
||||
expected = "uint";
|
||||
}
|
||||
|
||||
|
||||
@@ -914,26 +914,18 @@ bool ControlFlowGraph::find_infinite_continue() {
|
||||
int my_block = b0->get_first_block_id();
|
||||
int dest_block = b0->succ_branch->get_first_block_id();
|
||||
|
||||
fmt::print("Considering {} as an infinite continue:\n", b0->to_string());
|
||||
// fmt::print("Considering {} as an infinite continue:\n", b0->to_string());
|
||||
|
||||
if (b0->end_branch.asm_branch) {
|
||||
return true;
|
||||
}
|
||||
if (dest_block >= my_block) {
|
||||
fmt::print(" Rejecting because destination block {} comes after me {}\n", dest_block,
|
||||
my_block);
|
||||
return true;
|
||||
} else {
|
||||
fmt::print(" Order OK {} -> {}\n", my_block, dest_block);
|
||||
}
|
||||
|
||||
int prev_count = get_prev_count(b0, b0->succ_branch);
|
||||
if (prev_count == -1) {
|
||||
fmt::print(
|
||||
" Rejecting because we can't find the destination in the current ungrouped sequence.");
|
||||
return true;
|
||||
} else {
|
||||
fmt::print(" Sequencing OK: {} prev's\n", prev_count);
|
||||
}
|
||||
replaced = true;
|
||||
|
||||
@@ -1232,6 +1224,7 @@ bool ControlFlowGraph::clean_up_asm_branches() {
|
||||
else {
|
||||
lg::error("unhandled sequences in clean_up_asm_branches likely seq: {} {}", !!b0_seq,
|
||||
!!b1_seq);
|
||||
lg::error("{} {}\n", b0->get_first_block_id(), b1->get_first_block_id());
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -289,8 +289,6 @@ void Function::resize_first_block(int new_start, const LinkedObjectFile&) {
|
||||
basic_blocks.at(0).start_word = new_start;
|
||||
|
||||
if (basic_blocks.size() >= 2 && basic_blocks.at(1).start_word == new_start) {
|
||||
lg::warn("Function {} loops back to the first instruction. This is rare/less tested.",
|
||||
guessed_name.to_string());
|
||||
// block 1 is now zero size, so we should eliminate it
|
||||
auto& block0 = basic_blocks.at(0);
|
||||
auto& block1 = basic_blocks.at(1);
|
||||
|
||||
@@ -629,6 +629,14 @@ TP_Type SimpleExpression::get_type_int2(const TypeState& input,
|
||||
return TP_Type::make_from_ts(TypeSpec("float"));
|
||||
}
|
||||
|
||||
auto& name = env.func->guessed_name;
|
||||
if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 &&
|
||||
env.func->type.arg_count() == 3) {
|
||||
if (m_kind == Kind::ADD && arg1_type.typespec() == TypeSpec("int")) {
|
||||
return arg0_type;
|
||||
}
|
||||
}
|
||||
|
||||
throw std::runtime_error(fmt::format("Cannot get_type_int2: {}, args {} and {}",
|
||||
to_form(env.file->labels, env).print(), arg0_type.print(),
|
||||
arg1_type.print()));
|
||||
|
||||
@@ -1828,6 +1828,14 @@ std::string fixed_operator_to_string(FixedOperatorKind kind) {
|
||||
return "l32-false-check";
|
||||
case FixedOperatorKind::VECTOR_3_DOT:
|
||||
return "vector-dot";
|
||||
case FixedOperatorKind::PROCESS_TO_PPOINTER:
|
||||
return "process->ppointer";
|
||||
case FixedOperatorKind::PPOINTER_TO_HANDLE:
|
||||
return "ppointer->handle";
|
||||
case FixedOperatorKind::PROCESS_TO_HANDLE:
|
||||
return "process->handle";
|
||||
case FixedOperatorKind::PPOINTER_TO_PROCESS:
|
||||
return "ppointer->process";
|
||||
default:
|
||||
assert(false);
|
||||
return "";
|
||||
|
||||
@@ -118,6 +118,21 @@ Form* try_cast_simplify(Form* in,
|
||||
}
|
||||
}
|
||||
|
||||
if (new_type == TypeSpec("handle")) {
|
||||
auto in_generic = in->try_as_element<GenericElement>();
|
||||
if (in_generic && (in_generic->op().is_fixed(FixedOperatorKind::PROCESS_TO_HANDLE) ||
|
||||
in_generic->op().is_fixed(FixedOperatorKind::PPOINTER_TO_HANDLE))) {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
||||
if (new_type == TypeSpec("process")) {
|
||||
auto in_generic = in->try_as_element<GenericElement>();
|
||||
if (in_generic && in_generic->op().is_fixed(FixedOperatorKind::PPOINTER_TO_PROCESS)) {
|
||||
return in;
|
||||
}
|
||||
}
|
||||
|
||||
auto type_info = env.dts->ts.lookup_type(new_type);
|
||||
auto bitfield_info = dynamic_cast<BitFieldType*>(type_info);
|
||||
if (bitfield_info) {
|
||||
@@ -1004,6 +1019,17 @@ void SimpleExpressionElement::update_from_stack_add_i(const Env& env,
|
||||
}
|
||||
}
|
||||
|
||||
auto& name = env.func->guessed_name;
|
||||
if (name.kind == FunctionName::FunctionKind::METHOD && name.method_id == 7 &&
|
||||
env.func->type.arg_count() == 3) {
|
||||
if (env.dts->ts.tc(TypeSpec("structure"), arg0_type.typespec()) && (arg1_i || arg1_u)) {
|
||||
auto new_form = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::ADDITION_PTR), args.at(0), args.at(1));
|
||||
result->push_back(new_form);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (false && ((arg0_i && arg1_i) || (arg0_u && arg1_u))) {
|
||||
auto new_form = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::ADDITION), args.at(0), args.at(1));
|
||||
@@ -1569,6 +1595,46 @@ void SimpleExpressionElement::update_from_stack_logor_or_logand(const Env& env,
|
||||
return;
|
||||
}
|
||||
|
||||
auto make_handle_matcher = Matcher::op_fixed(
|
||||
FixedOperatorKind::LOGIOR,
|
||||
{Matcher::op_fixed(
|
||||
FixedOperatorKind::SHL,
|
||||
{Matcher::deref(Matcher::any_reg(0), false,
|
||||
{DerefTokenMatcher::integer(0), DerefTokenMatcher::string("pid")}),
|
||||
Matcher::integer(32)}),
|
||||
Matcher::op_fixed(FixedOperatorKind::ASM_SLLV_R0, {Matcher::any_reg(1)})});
|
||||
|
||||
auto handle_mr = match(make_handle_matcher, &hack_form);
|
||||
if (handle_mr.matched) {
|
||||
auto var_a = handle_mr.maps.regs.at(0).value();
|
||||
auto var_b = handle_mr.maps.regs.at(1).value();
|
||||
if (env.get_variable_name(var_a) == env.get_variable_name(var_b) &&
|
||||
env.dts->ts.tc(TypeSpec("pointer", {TypeSpec("process")}),
|
||||
env.get_variable_type(var_a, true))) {
|
||||
auto* menv = const_cast<Env*>(&env);
|
||||
menv->disable_use(var_a);
|
||||
|
||||
auto repopped = stack.pop_reg(var_b, {}, env, true, stack.size() - 1);
|
||||
|
||||
if (!repopped) {
|
||||
fmt::print("repop failed.\n{}\n", stack.print(env));
|
||||
repopped = var_to_form(var_b, pool);
|
||||
}
|
||||
|
||||
auto proc_to_ppointer_matcher =
|
||||
Matcher::op_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER, {Matcher::any(0)});
|
||||
auto proc_to_ppointer_mr = match(proc_to_ppointer_matcher, repopped);
|
||||
if (proc_to_ppointer_mr.matched) {
|
||||
element = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::PROCESS_TO_HANDLE),
|
||||
proc_to_ppointer_mr.maps.forms.at(0));
|
||||
} else {
|
||||
element = pool.alloc_element<GenericElement>(
|
||||
GenericOperator::make_fixed(FixedOperatorKind::PPOINTER_TO_HANDLE), repopped);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result->push_back(element);
|
||||
}
|
||||
|
||||
@@ -2737,7 +2803,8 @@ void FunctionCallElement::update_from_stack(const Env& env,
|
||||
match_result = match(matcher, temp_form);
|
||||
if (match_result.matched) {
|
||||
auto alloc = match_result.maps.strings.at(allocation);
|
||||
if (alloc != "global" && alloc != "debug" && alloc != "process") {
|
||||
if (alloc != "global" && alloc != "debug" && alloc != "process" &&
|
||||
alloc != "loading-level") {
|
||||
throw std::runtime_error("Unrecognized heap symbol for new: " + alloc);
|
||||
}
|
||||
auto type_2 = match_result.maps.strings.at(type_for_arg);
|
||||
@@ -2994,6 +3061,107 @@ void WhileElement::push_to_stack(const Env& env, FormPool& pool, FormStack& stac
|
||||
stack.push_form_element(this, true);
|
||||
}
|
||||
|
||||
namespace {
|
||||
// (if x (-> x ppointer)) -> (process->ppointer x)
|
||||
Form* try_rewrite_as_process_to_ppointer(CondNoElseElement* value,
|
||||
FormStack& stack,
|
||||
FormPool& pool,
|
||||
const Env& env) {
|
||||
if (value->entries.size() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto condition = value->entries.at(0).condition;
|
||||
auto body = value->entries[0].body;
|
||||
|
||||
// safe to look for a reg directly here.
|
||||
auto condition_matcher =
|
||||
Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY), {Matcher::any_reg(0)});
|
||||
auto condition_mr = match(condition_matcher, condition);
|
||||
if (!condition_mr.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto body_matcher =
|
||||
Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::string("ppointer")});
|
||||
auto body_mr = match(body_matcher, body);
|
||||
|
||||
if (!body_mr.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto body_var = *body_mr.maps.regs.at(0);
|
||||
auto condition_var = *condition_mr.maps.regs.at(0);
|
||||
|
||||
if (env.get_variable_name(body_var) != env.get_variable_name(condition_var)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// fmt::print("Matched condition {} in {}\n", condition_var.to_string(env),
|
||||
// value->to_string(env));
|
||||
|
||||
auto* menv = const_cast<Env*>(&env);
|
||||
menv->disable_use(body_var);
|
||||
auto repopped = stack.pop_reg(condition_var, {}, env, true);
|
||||
if (!repopped) {
|
||||
repopped = var_to_form(condition_var, pool);
|
||||
}
|
||||
|
||||
return pool.alloc_single_element_form<GenericElement>(
|
||||
nullptr, GenericOperator::make_fixed(FixedOperatorKind::PROCESS_TO_PPOINTER), repopped);
|
||||
}
|
||||
|
||||
// (if x (-> x 0 self)) -> (ppointer->process x)
|
||||
Form* try_rewrite_as_pppointer_to_process(CondNoElseElement* value,
|
||||
FormStack& stack,
|
||||
FormPool& pool,
|
||||
const Env& env) {
|
||||
if (value->entries.size() != 1) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto condition = value->entries.at(0).condition;
|
||||
auto body = value->entries[0].body;
|
||||
|
||||
// safe to look for a reg directly here.
|
||||
auto condition_matcher =
|
||||
Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY), {Matcher::any_reg(0)});
|
||||
auto condition_mr = match(condition_matcher, condition);
|
||||
if (!condition_mr.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto body_matcher =
|
||||
Matcher::deref(Matcher::any_reg(0), false,
|
||||
{DerefTokenMatcher::integer(0), DerefTokenMatcher::string("self")});
|
||||
auto body_mr = match(body_matcher, body);
|
||||
|
||||
if (!body_mr.matched) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto body_var = *body_mr.maps.regs.at(0);
|
||||
auto condition_var = *condition_mr.maps.regs.at(0);
|
||||
|
||||
if (env.get_variable_name(body_var) != env.get_variable_name(condition_var)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// fmt::print("Matched condition {} in {}\n", condition_var.to_string(env),
|
||||
// value->to_string(env));
|
||||
|
||||
auto* menv = const_cast<Env*>(&env);
|
||||
menv->disable_use(body_var);
|
||||
auto repopped = stack.pop_reg(condition_var, {}, env, true);
|
||||
if (!repopped) {
|
||||
repopped = var_to_form(condition_var, pool);
|
||||
}
|
||||
|
||||
return pool.alloc_single_element_form<GenericElement>(
|
||||
nullptr, GenericOperator::make_fixed(FixedOperatorKind::PPOINTER_TO_PROCESS), repopped);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
///////////////////
|
||||
// CondNoElseElement
|
||||
///////////////////
|
||||
@@ -3049,8 +3217,21 @@ void CondNoElseElement::push_to_stack(const Env& env, FormPool& pool, FormStack&
|
||||
|
||||
if (used_as_value) {
|
||||
// TODO - is this wrong?
|
||||
stack.push_value_to_reg(write_as_value, pool.alloc_single_form(nullptr, this), true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
auto as_process_to_ppointer = try_rewrite_as_process_to_ppointer(this, stack, pool, env);
|
||||
if (as_process_to_ppointer) {
|
||||
stack.push_value_to_reg(write_as_value, as_process_to_ppointer, true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
} else {
|
||||
auto as_ppointer_to_process = try_rewrite_as_pppointer_to_process(this, stack, pool, env);
|
||||
if (as_ppointer_to_process) {
|
||||
stack.push_value_to_reg(write_as_value, as_ppointer_to_process, true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
} else {
|
||||
stack.push_value_to_reg(write_as_value, pool.alloc_single_form(nullptr, this), true,
|
||||
env.get_variable_type(final_destination, false));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
stack.push_form_element(this, true);
|
||||
}
|
||||
@@ -3976,7 +4157,8 @@ void ReturnElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
|
||||
if (var) {
|
||||
const auto& func_type = env.func->type.last_arg();
|
||||
return_type = env.get_variable_type(*var, false);
|
||||
if (func_type != return_type) {
|
||||
// functions with no return can return stuff.
|
||||
if (func_type != return_type && func_type != TypeSpec("none")) {
|
||||
auto as_cast = return_code->try_as_element<CastElement>();
|
||||
if (as_cast) {
|
||||
return_code->clear();
|
||||
@@ -4324,6 +4506,22 @@ void BranchElement::push_to_stack(const Env& env, FormPool& pool, FormStack& sta
|
||||
branch_delay = pool.alloc_single_element_form<SetVarElement>(
|
||||
nullptr, dst, src_form, true, env.get_variable_type(src, true));
|
||||
} break;
|
||||
case IR2_BranchDelay::Kind::SET_REG_FALSE: {
|
||||
auto dst = m_op->branch_delay().var(0);
|
||||
auto src_form = pool.alloc_single_element_form<SimpleAtomElement>(
|
||||
nullptr, SimpleAtom::make_sym_val("#f"));
|
||||
|
||||
branch_delay = pool.alloc_single_element_form<SetVarElement>(nullptr, dst, src_form, true,
|
||||
TypeSpec("symbol"));
|
||||
} break;
|
||||
case IR2_BranchDelay::Kind::SET_REG_TRUE: {
|
||||
auto dst = m_op->branch_delay().var(0);
|
||||
auto src_form = pool.alloc_single_element_form<SimpleAtomElement>(
|
||||
nullptr, SimpleAtom::make_sym_val("#t"));
|
||||
|
||||
branch_delay = pool.alloc_single_element_form<SetVarElement>(nullptr, dst, src_form, true,
|
||||
TypeSpec("symbol"));
|
||||
} break;
|
||||
default:
|
||||
throw std::runtime_error("Unhandled branch delay in BranchElement::push_to_stack: " +
|
||||
m_op->to_string(env));
|
||||
@@ -4552,11 +4750,13 @@ void ArrayFieldAccess::update_with_val(Form* new_val,
|
||||
{Matcher::integer(m_expected_stride), Matcher::any(0)});
|
||||
mult_matcher = Matcher::match_or(
|
||||
{Matcher::cast("uint", mult_matcher), Matcher::cast("int", mult_matcher), mult_matcher});
|
||||
auto add_matcher = Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
|
||||
{Matcher::any(1), mult_matcher});
|
||||
add_matcher = Matcher::match_or(
|
||||
{add_matcher, Matcher::op(GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
|
||||
{mult_matcher, Matcher::any(1)})});
|
||||
|
||||
auto op_match =
|
||||
GenericOpMatcher::or_match({GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
|
||||
GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)});
|
||||
auto add_matcher = Matcher::op(op_match, {Matcher::any(1), mult_matcher});
|
||||
add_matcher =
|
||||
Matcher::match_or({add_matcher, Matcher::op(op_match, {mult_matcher, Matcher::any(1)})});
|
||||
|
||||
auto mr = match(add_matcher, new_val);
|
||||
if (!mr.matched) {
|
||||
|
||||
@@ -128,6 +128,8 @@ class FormStack {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
int size() const { return m_stack.size(); }
|
||||
|
||||
private:
|
||||
std::vector<StackEntry> m_stack;
|
||||
bool m_is_root_stack = false;
|
||||
|
||||
@@ -23,6 +23,10 @@ Matcher Matcher::op(const GenericOpMatcher& op, const std::vector<Matcher>& args
|
||||
return m;
|
||||
}
|
||||
|
||||
Matcher Matcher::op_fixed(FixedOperatorKind op, const std::vector<Matcher>& args) {
|
||||
return Matcher::op(GenericOpMatcher::fixed(op), args);
|
||||
}
|
||||
|
||||
Matcher Matcher::op_with_rest(const GenericOpMatcher& op, const std::vector<Matcher>& args) {
|
||||
Matcher m;
|
||||
m.m_kind = Kind::GENERIC_OP_WITH_REST;
|
||||
|
||||
@@ -27,6 +27,7 @@ class Matcher {
|
||||
static Matcher any_reg(int match_id = -1);
|
||||
static Matcher any_label(int match_id = -1);
|
||||
static Matcher op(const GenericOpMatcher& op, const std::vector<Matcher>& args);
|
||||
static Matcher op_fixed(FixedOperatorKind op, const std::vector<Matcher>& args);
|
||||
static Matcher op_with_rest(const GenericOpMatcher& op, const std::vector<Matcher>& args);
|
||||
static Matcher set(const Matcher& dst, const Matcher& src); // form-form
|
||||
static Matcher set_var(const Matcher& src, int dst_match_id); // var-form
|
||||
|
||||
@@ -160,6 +160,10 @@ enum class FixedOperatorKind {
|
||||
VECTOR_FLOAT_PRODUCT,
|
||||
L32_NOT_FALSE_CBOOL,
|
||||
VECTOR_3_DOT,
|
||||
PROCESS_TO_PPOINTER,
|
||||
PPOINTER_TO_HANDLE,
|
||||
PROCESS_TO_HANDLE,
|
||||
PPOINTER_TO_PROCESS,
|
||||
INVALID
|
||||
};
|
||||
|
||||
|
||||
@@ -145,6 +145,9 @@ class BitfieldStaticDefElement : public FormElement {
|
||||
result->push_back(this);
|
||||
}
|
||||
|
||||
const TypeSpec& bitfield_type() const { return m_type; }
|
||||
const std::vector<BitFieldDef>& defs() const { return m_field_defs; }
|
||||
|
||||
private:
|
||||
TypeSpec m_type;
|
||||
std::vector<BitFieldDef> m_field_defs;
|
||||
|
||||
@@ -160,7 +160,6 @@ bool convert_to_expressions(
|
||||
f.guessed_name.to_string());
|
||||
f.warnings.expression_build_warning(warn);
|
||||
lg::warn(warn);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,15 @@
|
||||
namespace decompiler {
|
||||
|
||||
namespace {
|
||||
|
||||
bool kind_for_lambda(FunctionName::FunctionKind k) {
|
||||
if (k == FunctionName::FunctionKind::UNIDENTIFIED || k == FunctionName::FunctionKind::NV_STATE ||
|
||||
k == FunctionName::FunctionKind::V_STATE) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool try_convert_lambda(const Function& parent_function,
|
||||
FormPool& pool,
|
||||
Form* f,
|
||||
@@ -17,23 +26,31 @@ bool try_convert_lambda(const Function& parent_function,
|
||||
auto& env = parent_function.ir2.env;
|
||||
auto label_kv = env.label_types().find(lab.name);
|
||||
if (label_kv != env.label_types().end()) {
|
||||
if (label_kv->second.type_name == "_lambda_") {
|
||||
auto& file = env.file;
|
||||
auto other_func = file->try_get_function_at_label(atom->label());
|
||||
if (other_func) {
|
||||
goos::Object result;
|
||||
if (defstate_behavior) {
|
||||
result = final_output_defstate_anonymous_behavior(*other_func);
|
||||
} else {
|
||||
result = final_output_lambda(*other_func);
|
||||
}
|
||||
|
||||
f->clear();
|
||||
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
|
||||
return true;
|
||||
}
|
||||
if (label_kv->second.type_name != "_lambda_") {
|
||||
lg::error(
|
||||
"Label {} wasn't marked as a lambda, but it is. Marking lambdas is no longer required.",
|
||||
lab.name);
|
||||
}
|
||||
}
|
||||
|
||||
auto& file = env.file;
|
||||
auto other_func = file->try_get_function_at_label(atom->label());
|
||||
if (other_func && kind_for_lambda(other_func->guessed_name.kind)) {
|
||||
if (!other_func->ir2.env.has_local_vars()) {
|
||||
// don't bother if we don't even have vars.
|
||||
return false;
|
||||
}
|
||||
goos::Object result;
|
||||
if (defstate_behavior) {
|
||||
result = final_output_defstate_anonymous_behavior(*other_func);
|
||||
} else {
|
||||
result = final_output_lambda(*other_func);
|
||||
}
|
||||
|
||||
f->clear();
|
||||
f->push_back(pool.alloc_element<LambdaDefinitionElement>(result));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
+110
-77
@@ -812,6 +812,9 @@
|
||||
(sound-options #x129)
|
||||
|
||||
(hidden-power-cell #x12f) ;; why is this here??
|
||||
|
||||
(saving-data #x136)
|
||||
(do-not-remove-mem-card #x138)
|
||||
|
||||
(continue-without-saving #x13f)
|
||||
(back #x13e)
|
||||
@@ -2199,7 +2202,7 @@
|
||||
(rotv vector :inline :offset-assert 80)
|
||||
(scalev vector :inline :offset-assert 96)
|
||||
(dir-targ quaternion :inline :offset-assert 112)
|
||||
(angle-change-time uint64 :offset-assert 128)
|
||||
(angle-change-time int64 :offset-assert 128)
|
||||
(old-y-angle-diff float :offset-assert 136)
|
||||
)
|
||||
:method-count-assert 28
|
||||
@@ -2849,9 +2852,9 @@
|
||||
(playing-id sound-id :offset-assert 8)
|
||||
(trans vector :inline :offset-assert 16)
|
||||
(name sound-name :offset-assert 32)
|
||||
(play-time uint64 :offset-assert 48)
|
||||
(time-base uint64 :offset-assert 56)
|
||||
(time-random uint64 :offset-assert 64)
|
||||
(play-time int64 :offset-assert 48)
|
||||
(time-base int64 :offset-assert 56)
|
||||
(time-random int64 :offset-assert 64)
|
||||
(volume int32 :offset-assert 72)
|
||||
(pitch int32 :offset-assert 76)
|
||||
(falloff-near int32 :offset-assert 80)
|
||||
@@ -3552,10 +3555,10 @@
|
||||
(align uint8 6 :offset-assert 88)
|
||||
(direct uint8 6 :offset-assert 94)
|
||||
(buzz-val uint8 2 :offset-assert 100)
|
||||
(buzz-time uint64 2 :offset-assert 104)
|
||||
(buzz-time int64 2 :offset-assert 104)
|
||||
(buzz basic :offset-assert 120)
|
||||
(buzz-act int32 :offset-assert 124)
|
||||
(change-time uint64 :offset-assert 128)
|
||||
(change-time int64 :offset-assert 128)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
@@ -3580,8 +3583,8 @@
|
||||
|
||||
(define-extern cpad-set-buzz! (function cpad-info int int int none))
|
||||
(define-extern cpad-get-data (function cpad-info cpad-info))
|
||||
(define-extern get-current-time (function uint))
|
||||
(define-extern get-integral-current-time (function uint))
|
||||
(define-extern get-current-time (function int))
|
||||
(define-extern get-integral-current-time (function int))
|
||||
(define-extern cpad-invalid! (function cpad-info cpad-info))
|
||||
;; in the kernel.
|
||||
(define-extern cpad-open (function cpad-info int cpad-info))
|
||||
@@ -4323,22 +4326,22 @@
|
||||
(last-screen int32 :offset-assert 564)
|
||||
(frames virtual-frame 6 :inline :offset-assert 568)
|
||||
(bg-clear-color rgba 4 :offset-assert 760)
|
||||
(real-frame-counter uint64 :offset-assert 776)
|
||||
(base-frame-counter uint64 :offset-assert 784)
|
||||
(game-frame-counter uint64 :offset-assert 792)
|
||||
(integral-frame-counter uint64 :offset-assert 800)
|
||||
(real-integral-frame-counter uint64 :offset-assert 808)
|
||||
(actual-frame-counter uint64 :offset-assert 816)
|
||||
(real-actual-frame-counter uint64 :offset-assert 824)
|
||||
(part-frame-counter uint64 :offset-assert 832)
|
||||
(old-real-frame-counter uint64 :offset-assert 840)
|
||||
(old-base-frame-counter uint64 :offset-assert 848)
|
||||
(old-game-frame-counter uint64 :offset-assert 856)
|
||||
(old-integral-frame-counter uint64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter uint64 :offset-assert 872)
|
||||
(old-actual-frame-counter uint64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter uint64 :offset-assert 888)
|
||||
(old-part-frame-counter uint64 :offset-assert 896)
|
||||
(real-frame-counter int64 :offset-assert 776)
|
||||
(base-frame-counter int64 :offset-assert 784);; todo, change to signed?
|
||||
(game-frame-counter int64 :offset-assert 792)
|
||||
(integral-frame-counter int64 :offset-assert 800)
|
||||
(real-integral-frame-counter int64 :offset-assert 808)
|
||||
(actual-frame-counter int64 :offset-assert 816)
|
||||
(real-actual-frame-counter int64 :offset-assert 824)
|
||||
(part-frame-counter int64 :offset-assert 832)
|
||||
(old-real-frame-counter int64 :offset-assert 840)
|
||||
(old-base-frame-counter int64 :offset-assert 848)
|
||||
(old-game-frame-counter int64 :offset-assert 856)
|
||||
(old-integral-frame-counter int64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter int64 :offset-assert 872)
|
||||
(old-actual-frame-counter int64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter int64 :offset-assert 888)
|
||||
(old-part-frame-counter int64 :offset-assert 896)
|
||||
(time-ratio float :offset-assert 904)
|
||||
(seconds-per-frame float :offset-assert 908)
|
||||
(frames-per-second float :offset-assert 912)
|
||||
@@ -5463,7 +5466,7 @@
|
||||
((name basic :offset-assert 4)
|
||||
(length int16 :offset-assert 8) ;; in use elts of the data array
|
||||
(allocated-length int16 :offset-assert 10) ;; size of the data array
|
||||
(engine-time uint64 :offset-assert 16) ;; frame that we last executed
|
||||
(engine-time int64 :offset-assert 16) ;; frame that we last executed
|
||||
;; terminating nodes for the next0/prev0 linked lists
|
||||
(alive-list connectable :inline :offset-assert 32)
|
||||
(alive-list-end connectable :inline :offset-assert 48)
|
||||
@@ -6243,8 +6246,8 @@
|
||||
(num-success-before-killing int8 :offset-assert 13)
|
||||
(num-attempts int8 :offset-assert 14)
|
||||
(num-success int8 :offset-assert 15)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(last-time-called uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(last-time-called int64 :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
@@ -8879,7 +8882,7 @@
|
||||
|
||||
;; - Functions
|
||||
|
||||
(define-extern mc-get-slot-info (function int mc-slot-info))
|
||||
(define-extern mc-get-slot-info (function int mc-slot-info none))
|
||||
(define-extern mc-run (function none))
|
||||
(define-extern mc-check-result (function int))
|
||||
(define-extern mc-sync (function int))
|
||||
@@ -8983,6 +8986,29 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defenum mc-status-code
|
||||
:type uint32
|
||||
(busy 0)
|
||||
(ok 1)
|
||||
(bad-handle 2)
|
||||
(format-failed 3)
|
||||
(internal-error 4)
|
||||
(write-error 5)
|
||||
(read-error 6)
|
||||
(new-game 7)
|
||||
(no-memory 8)
|
||||
(no-card 9)
|
||||
(no-last 10)
|
||||
(no-format 11)
|
||||
(no-file 12)
|
||||
(no-save 13)
|
||||
(no-space 14)
|
||||
(bad-version 15)
|
||||
(no-process 16)
|
||||
(no-auto-save 17)
|
||||
)
|
||||
|
||||
|
||||
(declare-type entity-perm structure)
|
||||
(declare-type game-save basic)
|
||||
(declare-type entity-perm-array basic)
|
||||
@@ -9023,7 +9049,7 @@
|
||||
(death-movie-tick int32 :offset-assert 264)
|
||||
(want-auto-save symbol :offset-assert 268)
|
||||
(auto-save-proc handle :offset-assert 272)
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-status mc-status-code :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
@@ -9052,7 +9078,7 @@
|
||||
(seen-text? (_type_ game-text-id) symbol 21)
|
||||
(mark-text-as-seen (_type_ game-text-id) none 22)
|
||||
(got-buzzer? (_type_ game-task int) symbol 23)
|
||||
(dummy-24 () none 24)
|
||||
(save-game! (_type_ game-save string) none 24)
|
||||
(load-game! (_type_ game-save) game-save 25)
|
||||
(clear-text-seen! (_type_ game-text-id) none 26)
|
||||
(get-death-count (_type_ symbol) int 27)
|
||||
@@ -9767,8 +9793,9 @@
|
||||
:flag-assert #x90000004c
|
||||
)
|
||||
|
||||
(declare-type process-drawable process)
|
||||
(deftype fact-info (basic)
|
||||
((process process :offset-assert 4)
|
||||
((process process-drawable :offset-assert 4)
|
||||
(pickup-type pickup-type :offset-assert 8)
|
||||
(pickup-amount float :offset-assert 12)
|
||||
(pickup-spawn-amount float :offset-assert 16)
|
||||
@@ -9779,10 +9806,10 @@
|
||||
:size-assert #x28
|
||||
:flag-assert #xc00000028
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
(TODO-RENAME-9 (_type_ symbol process-tree fact-info int) uint 9) ;; See nav-enemy::process-drawable-death-event-handler
|
||||
(reset! (_type_ symbol) none 10)
|
||||
(dummy-11 (_type_) float 11)
|
||||
(pickup-collectable! (_type_ pickup-type float handle) float 11)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9798,7 +9825,7 @@
|
||||
(eco-pill float :offset-assert 80)
|
||||
(eco-pill-max float :offset-assert 84)
|
||||
(health-pickup-time uint64 :offset-assert 88)
|
||||
(eco-source uint64 :offset-assert 96)
|
||||
(eco-source handle :offset-assert 96)
|
||||
(eco-source-time uint64 :offset-assert 104)
|
||||
(money-pickup-time uint64 :offset-assert 112)
|
||||
(buzzer-pickup-time uint64 :offset-assert 120)
|
||||
@@ -9809,7 +9836,7 @@
|
||||
:size-assert #x90
|
||||
:flag-assert #xc00000090
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -9826,7 +9853,7 @@
|
||||
:size-assert #x44
|
||||
:flag-assert #xc00000044
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -10292,7 +10319,7 @@
|
||||
(max-time int32 :offset-assert 4)
|
||||
(max-val float :offset-assert 8)
|
||||
(timer int32 :offset-assert 12)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(value float :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 11
|
||||
@@ -10345,7 +10372,7 @@
|
||||
(xz-max float :offset-assert 8)
|
||||
(y-max float :offset-assert 12)
|
||||
(timer int32 :offset-assert 16)
|
||||
(start-time uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 24)
|
||||
(value vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 13
|
||||
@@ -10386,7 +10413,7 @@
|
||||
;; - Types
|
||||
|
||||
(deftype smush-control (structure)
|
||||
((start-time uint64 :offset-assert 0)
|
||||
((start-time int64 :offset-assert 0)
|
||||
(period float :offset-assert 8)
|
||||
(duration float :offset-assert 12)
|
||||
(amp float :offset-assert 16)
|
||||
@@ -10493,7 +10520,7 @@
|
||||
(trans vector :inline :offset-assert 64)
|
||||
(quat quaternion :inline :offset-assert 80)
|
||||
(scale vector :inline :offset-assert 96)
|
||||
(notice-time uint64 :offset-assert 112)
|
||||
(notice-time int64 :offset-assert 112)
|
||||
(flex-blend float :offset-assert 120)
|
||||
(blend float :offset-assert 124)
|
||||
(max-dist meters :offset-assert 128)
|
||||
@@ -11020,7 +11047,7 @@
|
||||
(transv-out vector :inline :offset-assert 48)
|
||||
(local-normal vector :inline :offset-assert 64)
|
||||
(surface-normal vector :inline :offset-assert 80)
|
||||
(time uint64 :offset-assert 96)
|
||||
(time int64 :offset-assert 96)
|
||||
(status uint64 :offset-assert 104)
|
||||
(pat pat-surface :offset-assert 112)
|
||||
(reaction-flag uint32 :offset-assert 116)
|
||||
@@ -13315,14 +13342,14 @@
|
||||
(linger-duration uint16 :offset-assert 8)
|
||||
(flags uint16 :offset-assert 10)
|
||||
(name basic :offset-assert 12)
|
||||
(launcher uint32 :offset-assert 16)
|
||||
(launcher sparticle-group-item :offset-assert 16)
|
||||
(bounds sphere :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x30
|
||||
:flag-assert #xa00000030
|
||||
(:methods
|
||||
(dummy-9 (_type_ process) _type_ 9)
|
||||
(create-launch-control (_type_ process) sparticle-launch-control 9)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -13345,8 +13372,8 @@
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-11 (_type_ vector) none 11)
|
||||
(deactivate (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
)
|
||||
)
|
||||
@@ -14594,7 +14621,7 @@
|
||||
|
||||
(define-extern *dgo-name* string)
|
||||
(define-extern *load-dgo-rpc* rpc-buffer-pair)
|
||||
(define-extern *dgo-time* uint)
|
||||
(define-extern *dgo-time* int)
|
||||
(define-extern *play-str-rpc* rpc-buffer-pair)
|
||||
(define-extern *que-str-lock* symbol)
|
||||
(define-extern *load-str-lock* symbol)
|
||||
@@ -16606,12 +16633,12 @@
|
||||
(which int32 :offset-assert 120)
|
||||
(buffer kheap :offset-assert 124)
|
||||
(mode basic :offset-assert 128)
|
||||
(result uint32 :offset-assert 132)
|
||||
(save basic :offset-assert 136)
|
||||
(result mc-status-code :offset-assert 132)
|
||||
(save game-save :offset-assert 136)
|
||||
(info mc-slot-info :inline :offset-assert 140)
|
||||
(notify uint64 :offset-assert 440)
|
||||
(notify handle :offset-assert 440)
|
||||
(state-time uint64 :offset-assert 448)
|
||||
(part basic :offset-assert 456)
|
||||
(part sparticle-launch-control :offset-assert 456)
|
||||
)
|
||||
:heap-base #x160
|
||||
:method-count-assert 23
|
||||
@@ -16619,37 +16646,43 @@
|
||||
:flag-assert #x17016001cc
|
||||
;; inherited inspect of process
|
||||
(:methods
|
||||
(dummy-14 () none 14)
|
||||
(dummy-15 () none 15)
|
||||
(dummy-16 () none 16)
|
||||
(dummy-17 () none 17)
|
||||
(dummy-18 () none 18)
|
||||
(dummy-19 () none 19)
|
||||
(dummy-20 () none 20)
|
||||
(dummy-21 () none 21)
|
||||
(dummy-22 () none 22)
|
||||
(get-heap () _type_ :state 14)
|
||||
(get-card () _type_ :state 15)
|
||||
(format-card () _type_ :state 16)
|
||||
(create-file () _type_ :state 17)
|
||||
(save () _type_ :state 18)
|
||||
(restore () _type_ :state 19)
|
||||
(error (mc-status-code) _type_ :state 20)
|
||||
(done () _type_ :state 21)
|
||||
(unformat-card () _type_ :state 22)
|
||||
)
|
||||
)
|
||||
|
||||
;; - Functions
|
||||
|
||||
(define-extern auto-save-command (function symbol int int process-tree none)) ;; TODO - not confirmed
|
||||
(define-extern auto-save-init-by-other function)
|
||||
(define-extern auto-save-init-by-other (function symbol process-tree int int none :behavior auto-save))
|
||||
(define-extern progress-allowed? (function symbol))
|
||||
(define-extern print-game-text (function string font-context symbol int int float)) ; TODO decomp error, this seems correct though
|
||||
(define-extern get-aspect-ratio (function symbol))
|
||||
(define-extern get-task-status (function game-task task-status))
|
||||
(define-extern lookup-level-info (function symbol level-load-info))
|
||||
(define-extern calculate-completion function)
|
||||
(define-extern calculate-completion (function symbol float))
|
||||
(define-extern game-save-elt->string (function game-save-elt string))
|
||||
(define-extern progress-level-index->string (function int string))
|
||||
(define-extern auto-save-post function)
|
||||
(define-extern auto-save-post (function none :behavior auto-save))
|
||||
(define-extern auto-save-check (function none))
|
||||
|
||||
(define-extern mc-format (function int mc-status-code))
|
||||
(define-extern mc-unformat (function int mc-status-code))
|
||||
(define-extern mc-create-file (function int uint mc-status-code))
|
||||
(define-extern mc-save (function int int pointer int mc-status-code))
|
||||
(define-extern mc-load (function int int pointer mc-status-code))
|
||||
|
||||
;; - Unknowns
|
||||
|
||||
(define-extern *auto-save-info* mc-slot-info) ;; unknown type
|
||||
;;(define-extern scf-get-time object) ;; unknown type
|
||||
(define-extern *auto-save-info* mc-slot-info)
|
||||
(define-extern scf-get-time (function scf-time none))
|
||||
;; ;; unknown type
|
||||
|
||||
|
||||
@@ -19601,7 +19634,7 @@
|
||||
(define-extern pause-allowed? (function symbol))
|
||||
(define-extern menu-respond-to-pause (function symbol))
|
||||
(define-extern hide-progress-screen (function int))
|
||||
(define-extern set-letterbox-frames (function uint uint))
|
||||
(define-extern set-letterbox-frames (function int int))
|
||||
(define-extern letterbox (function none))
|
||||
(define-extern blackout (function none))
|
||||
(define-extern main-cheats (function int))
|
||||
@@ -21959,7 +21992,7 @@
|
||||
(sim-time-remaining float :offset-assert 688)
|
||||
(float-height-offset float :offset-assert 692)
|
||||
(player-attack-id int32 :offset-assert 696)
|
||||
(player-bonk-timeout uint64 :offset-assert 704)
|
||||
(player-bonk-timeout int64 :offset-assert 704)
|
||||
(water-anim water-anim :offset-assert 712)
|
||||
(player-contact basic :offset-assert 716) ; not a basic
|
||||
(player-impulse collide-shape-prim-mesh :offset-assert 720)
|
||||
@@ -22080,15 +22113,15 @@
|
||||
(momentum-speed float :offset-assert 296)
|
||||
(acceleration float :offset-assert 300)
|
||||
(rotate-speed float :offset-assert 304)
|
||||
(turn-time uint64 :offset-assert 312)
|
||||
(frustration-time uint64 :offset-assert 320)
|
||||
(turn-time int64 :offset-assert 312)
|
||||
(frustration-time int64 :offset-assert 320)
|
||||
(speed-scale float :offset-assert 328)
|
||||
(neck joint-mod :offset-assert 332) ; this is what `neck` is on the pelican
|
||||
(reaction-time uint64 :offset-assert 336)
|
||||
(notice-time uint64 :offset-assert 344)
|
||||
(state-timeout uint64 :offset-assert 352)
|
||||
(free-time uint64 :offset-assert 360)
|
||||
(touch-time uint64 :offset-assert 368)
|
||||
(reaction-time int64 :offset-assert 336)
|
||||
(notice-time int64 :offset-assert 344)
|
||||
(state-timeout int64 :offset-assert 352)
|
||||
(free-time int64 :offset-assert 360)
|
||||
(touch-time int64 :offset-assert 368)
|
||||
(nav-enemy-flags uint32 :offset-assert 376)
|
||||
(incomming-attack-id handle :offset-assert 384)
|
||||
(jump-return-state (state process) :offset-assert 392)
|
||||
@@ -22879,10 +22912,10 @@
|
||||
;; - Types
|
||||
|
||||
(deftype ticky (structure)
|
||||
((delay-til-ramp uint64 :offset-assert 0)
|
||||
(delay-til-timeout uint64 :offset-assert 8)
|
||||
(starting-time uint64 :offset-assert 16)
|
||||
(last-tick-time uint64 :offset-assert 24)
|
||||
((delay-til-ramp int64 :offset-assert 0)
|
||||
(delay-til-timeout int64 :offset-assert 8)
|
||||
(starting-time int64 :offset-assert 16)
|
||||
(last-tick-time int64 :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #x20
|
||||
|
||||
@@ -505,7 +505,12 @@
|
||||
[496, "(function task-control symbol)"]
|
||||
],
|
||||
|
||||
"game-info": [[17, "(function symbol symbol continue-point symbol none)"]],
|
||||
"game-info": [
|
||||
[17, "(function symbol symbol continue-point symbol none)"],
|
||||
[6, "(function process-drawable none)"],
|
||||
[7, "(function none :behavior process-drawable)"],
|
||||
[8, "(function object)"]
|
||||
],
|
||||
|
||||
"default-menu": [
|
||||
[3, "(function none)"],
|
||||
|
||||
@@ -222,17 +222,6 @@
|
||||
"sp-process-block-2d",
|
||||
"sp-get-particle",
|
||||
|
||||
// game-info BUG
|
||||
"(method 11 fact-info-target)",
|
||||
|
||||
// game-save BUG
|
||||
"(anon-function 5 game-save)", // BUG:
|
||||
"(anon-function 6 game-save)", // BUG:
|
||||
"(anon-function 7 game-save)", // BUG:
|
||||
"(anon-function 8 game-save)", // BUG:
|
||||
"(anon-function 9 game-save)", // BUG:
|
||||
"(anon-function 10 game-save)",
|
||||
|
||||
// mood BUG
|
||||
"update-mood-lava", // BUG:
|
||||
"update-mood-lightning",
|
||||
@@ -379,12 +368,6 @@
|
||||
"(anon-function 10 ice-cube)",
|
||||
"(anon-function 15 ice-cube)",
|
||||
"(anon-function 45 lavatube-energy)",
|
||||
"(anon-function 5 game-save)",
|
||||
"(anon-function 6 game-save)",
|
||||
"(anon-function 7 game-save)",
|
||||
"(anon-function 8 game-save)",
|
||||
"(anon-function 9 game-save)",
|
||||
"(anon-function 10 game-save)",
|
||||
"mistycannon-find-best-solution",
|
||||
"target-flut-falling-anim-trans",
|
||||
"kermit-check-to-hit-player?",
|
||||
@@ -517,7 +500,8 @@
|
||||
"unpack-comp-rle":[1, 3, 5, 6],
|
||||
"(method 16 level)":[ 1, 5, 13, 14, 15, 19, 26, 53],
|
||||
"unpack-comp-huf":[2, 4, 5, 6, 7, 8, 9],
|
||||
"blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33]
|
||||
|
||||
"blerc-execute":[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33],
|
||||
"(method 11 fact-info-target)":[42],
|
||||
"(code format-card auto-save)":[3, 4, 5, 6, 7, 8]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,6 +191,34 @@
|
||||
["L3", "game-info", true]
|
||||
],
|
||||
|
||||
"game-save": [
|
||||
["L321", "float", true],
|
||||
["L316", "float", true],
|
||||
["L317", "float", true],
|
||||
["L9", "_lambda_", true],
|
||||
["L20", "_lambda_", true],
|
||||
["L50", "_lambda_", true],
|
||||
["L53", "_lambda_", true],
|
||||
["L67", "_lambda_", true],
|
||||
["L79", "_lambda_", true],
|
||||
["L91", "_lambda_", true],
|
||||
["L98", "_lambda_", true],
|
||||
["L107", "_lambda_", true],
|
||||
["L123", "_lambda_", true],
|
||||
["L271", "_auto_", true],
|
||||
["L272", "_auto_", true],
|
||||
["L300", "_auto_", true],
|
||||
["L293", "_auto_", true],
|
||||
["L294", "_auto_", true],
|
||||
["L296", "_auto_", true],
|
||||
["L297", "_auto_", true],
|
||||
["L298", "_auto_", true],
|
||||
["L304", "sparticle-launch-group", true],
|
||||
["L299", "_auto_", true],
|
||||
["L302", "_auto_", true]
|
||||
|
||||
],
|
||||
|
||||
"wind-h": [["L3", "_auto_", true]],
|
||||
|
||||
"dynamics-h": [["L6", "_auto_", true]],
|
||||
|
||||
@@ -1145,5 +1145,38 @@
|
||||
[16, "vector"]
|
||||
],
|
||||
|
||||
"(method 11 fact-info-target)": [
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"(anon-function 6 game-info)": [
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"(anon-function 8 game-info)": [
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"(method 24 game-info)": [
|
||||
[16, "scf-time"]
|
||||
],
|
||||
|
||||
"auto-save-post": [
|
||||
[16, "font-context"],
|
||||
[112, "font-context"]
|
||||
],
|
||||
|
||||
"auto-save-init-by-other":[
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"(code error auto-save)": [
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"(code done auto-save)": [
|
||||
[16, "event-message-block"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below!": []
|
||||
}
|
||||
|
||||
@@ -2234,7 +2234,7 @@
|
||||
],
|
||||
|
||||
"(method 32 warrior)": [
|
||||
[75, "v1", "handle"]
|
||||
[76, "v1", "handle"]
|
||||
],
|
||||
|
||||
"(method 43 warrior)": [
|
||||
@@ -2250,5 +2250,55 @@
|
||||
[19, "v1", "float"]
|
||||
],
|
||||
|
||||
"(method 11 fact-info-target)": [
|
||||
[135, "v1", "target"],
|
||||
[148, "v1", "collide-shape"],
|
||||
[258, "v1", "target"],
|
||||
[272, "v1", "target"],
|
||||
[287, "v1", "target"],
|
||||
[298, "v1", "target"],
|
||||
[556, "t9", "(function process function vector meters int none)"],
|
||||
[635, "t9", "(function cpu-thread function process-drawable none)"]
|
||||
],
|
||||
|
||||
"(method 7 process)": [
|
||||
[[120, 124], "a0", "basic"],
|
||||
[[127, 130], "a0", "basic"],
|
||||
[47, "v1", "connection"],
|
||||
[57, "v1", "connection"],
|
||||
[[47, 88], "v1", "connection"]
|
||||
],
|
||||
|
||||
"(anon-function 7 game-info)": [
|
||||
[2, "v1", "collide-shape"]
|
||||
],
|
||||
|
||||
"(method 24 game-info)": [
|
||||
[112, "s3", "pointer"],
|
||||
[[113, 165], "a0", "game-save-tag"],
|
||||
[[148, 166], "s2", "game-save-tag"],
|
||||
[[148, 168], "s4", "game-save-tag"],
|
||||
[[171, 222], "a0", "game-save-tag"],
|
||||
[[234, 241], "a0", "game-save-tag"],
|
||||
[[253, 276], "a0", "game-save-tag"],
|
||||
[[283, 302], "a0", "game-save-tag"],
|
||||
[[319, 325], "a1", "game-save-tag"],
|
||||
[[342, 348], "a1", "game-save-tag"],
|
||||
[[395, 468], "a0", "game-save-tag"],
|
||||
[[480, 488], "a0", "game-save-tag"],
|
||||
[[500, 506], "a0", "game-save-tag"],
|
||||
[[521, 528], "a0", "game-save-tag"],
|
||||
[[543, 650], "a0", "game-save-tag"],
|
||||
// [329, "a0", "pointer"],
|
||||
// [338, "a0", "pointer"],
|
||||
// [[173, 230], "a0", "game-save-tag"],
|
||||
[252, "a0", "(pointer int32)"],
|
||||
[654, "a0", "pointer"]
|
||||
],
|
||||
|
||||
"auto-save-post":[
|
||||
[138, "t9", "(function object string object none)"]
|
||||
],
|
||||
|
||||
"placeholder-do-not-add-below": []
|
||||
}
|
||||
|
||||
@@ -3228,5 +3228,14 @@
|
||||
"s4-0":"dma-buf"
|
||||
}
|
||||
},
|
||||
|
||||
"(method 11 fact-info-target)": {
|
||||
"args":["obj", "kind", "amount", "source-handle"],
|
||||
"vars":{"f0-29":"buzz-count","f30-0":"eco-lev"}
|
||||
},
|
||||
|
||||
"auto-save-init-by-other": {
|
||||
"args":["desired-mode", "notify-proc", "card-idx", "file-idx"]
|
||||
},
|
||||
"aaaaaaaaaaaaaaaaaaaaaaa": {}
|
||||
}
|
||||
|
||||
@@ -190,4 +190,7 @@
|
||||
- Added `get-enum-vals` which returns a list of pairs. Each pair is the name (symbol) and value (int) for each value in the enum
|
||||
- It is now possible to set a 64-bit memory location from a float, if you insert a cast. It will zero-extend the float, just like any other float -> 64-bit conversion.
|
||||
- Added `:state` option to `:methods`.
|
||||
- Accessing the `enter` field of `state` will now magically give you a function with the right type.
|
||||
- Accessing the `enter` field of `state` will now magically give you a function with the right type.
|
||||
- It is possible to access fields of the parent of a forward declared type
|
||||
- Fixed a bug where casting a value to seconds, then setting a field of type seconds would incorrectly fail type-check
|
||||
- Fixed a bug where nested rlet's didn't properly share register constraints, leading to inefficient register allocation, and some rare cases a regalloc constraint error
|
||||
@@ -5,9 +5,6 @@
|
||||
* Types used for the RamDisk Remote Procedure Call between the EE and the IOP
|
||||
*/
|
||||
|
||||
#ifndef JAK1_RAMDISK_RPC_TYPES_H
|
||||
#define JAK1_RAMDISK_RPC_TYPES_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
constexpr int RAMDISK_RPC_ID = 0xdeb3;
|
||||
@@ -17,11 +14,9 @@ constexpr int RAMDISK_RESET_AND_LOAD_FNO = 1;
|
||||
constexpr int RAMDISK_BYPASS_LOAD_FILE = 4;
|
||||
|
||||
struct RPC_Ramdisk_LoadCmd {
|
||||
char pad[4];
|
||||
uint32_t file_id_or_ee_addr;
|
||||
uint32_t offset_into_file;
|
||||
uint32_t size;
|
||||
u32 pad;
|
||||
u32 file_id_or_ee_addr;
|
||||
u32 offset_into_file;
|
||||
u32 size;
|
||||
char name[16]; // guess on length?
|
||||
};
|
||||
|
||||
#endif // JAK1_RAMDISK_RPC_TYPES_H
|
||||
|
||||
+7
-4
@@ -6,9 +6,6 @@
|
||||
* DONE!
|
||||
*/
|
||||
|
||||
#ifndef JAK_V2_KDGO_H
|
||||
#define JAK_V2_KDGO_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
#include "Ptr.h"
|
||||
#include "kmalloc.h"
|
||||
@@ -20,6 +17,12 @@ void load_and_link_dgo(u64 name_gstr, u64 heap_info, u64 flag, u64 buffer_size);
|
||||
void StopIOP();
|
||||
|
||||
u64 RpcCall_wrapper(void* args);
|
||||
s32 RpcCall(s32 rpcChannel,
|
||||
u32 fno,
|
||||
bool async,
|
||||
void* sendBuff,
|
||||
s32 sendSize,
|
||||
void* recvBuff,
|
||||
s32 recvSize);
|
||||
u32 RpcBusy(s32 channel);
|
||||
void LoadDGOTest();
|
||||
#endif // JAK_V2_KDGO_H
|
||||
|
||||
+617
-190
@@ -7,66 +7,218 @@
|
||||
//#include "ps2/SCE_FS.h"
|
||||
//#include "ps2/common_types.h"
|
||||
//#include "kernel/kmachine.h"
|
||||
#include "game/sce/sif_ee.h"
|
||||
#include "kmemcard.h"
|
||||
#include "game/kernel/kdgo.h"
|
||||
#include "game/common/ramdisk_rpc_types.h"
|
||||
#include "game/kernel/fileio.h"
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
// static s32 next;
|
||||
using McCallbackFunc = void (*)(s32);
|
||||
|
||||
McCallbackFunc callback;
|
||||
|
||||
static s32 next;
|
||||
static s32 language;
|
||||
// static MemoryCardOperation op;
|
||||
// static mc_info mc[2];
|
||||
static MemoryCardOperation op;
|
||||
static MemoryCard mc[2];
|
||||
static RPC_Ramdisk_LoadCmd ramdisk_cmd;
|
||||
|
||||
// these are the return value for sceMcGetInfo.
|
||||
static s32 p1, p2, p3, p4;
|
||||
using namespace ee;
|
||||
|
||||
void cb_reprobe_format(s32);
|
||||
void cb_format_complete(s32);
|
||||
void cb_unformat(s32);
|
||||
void cb_reprobe_createfile(s32);
|
||||
void cb_wait_for_ramdisk(s32);
|
||||
void cb_wait_for_ramdisk_load(s32);
|
||||
void cb_createfile_erasing(s32);
|
||||
void cb_createdir(s32);
|
||||
void cb_createdfile(s32);
|
||||
void cb_writtenfile(s32);
|
||||
void cb_closedfile(s32);
|
||||
void cb_reprobe_save(s32);
|
||||
|
||||
const char* filename[12] = {
|
||||
"/BASCUS-97124AYBABTU!", "/BASCUS-97124AYBABTU!/icon.sys",
|
||||
"/BASCUS-97124AYBABTU!/icon.ico", "/BASCUS-97124AYBABTU!/BASCUS-97124AYBABTU!",
|
||||
"/BASCUS-97124AYBABTU!/bank0.bin", "/BASCUS-97124AYBABTU!/bank1.bin",
|
||||
"/BASCUS-97124AYBABTU!/bank2.bin", "/BASCUS-97124AYBABTU!/bank3.bin",
|
||||
"/BASCUS-97124AYBABTU!/bank4.bin", "/BASCUS-97124AYBABTU!/bank5.bin",
|
||||
"/BASCUS-97124AYBABTU!/bank6.bin", "/BASCUS-97124AYBABTU!/bank7.bin"};
|
||||
|
||||
void kmemcard_init_globals() {
|
||||
// next = 0;
|
||||
next = 0;
|
||||
language = 0;
|
||||
op = {};
|
||||
mc[0] = {};
|
||||
mc[1] = {};
|
||||
callback = nullptr;
|
||||
p1 = 0;
|
||||
p2 = 0;
|
||||
p3 = 0;
|
||||
p4 = 0;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get a new memory card handle.
|
||||
* Will never return 0.
|
||||
*/
|
||||
s32 new_mc_handle() {
|
||||
s32 handle = next++;
|
||||
|
||||
// if you wrap around, it avoid the zero handle.
|
||||
// it doesn't seem like you will need billions of memory card handles
|
||||
if (handle == 0) {
|
||||
handle = next++;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
/*!
|
||||
* A questionable checksum.
|
||||
*/
|
||||
u32 mc_checksum(Ptr<u8> data, s32 size) {
|
||||
if (size < 0) {
|
||||
size += 3;
|
||||
}
|
||||
|
||||
u32 result = 0;
|
||||
u32* data_u32 = (u32*)data.c();
|
||||
for (s32 i = 0; i < size / 4; i++) {
|
||||
result = result << 1 ^ (s32)result >> 0x1f ^ data_u32[i] ^ 0x12345678;
|
||||
}
|
||||
|
||||
return result ^ 0xedd1e666;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get the slot for a handle. The card must be in the given state.
|
||||
* Return -1 if it fails.
|
||||
*/
|
||||
s32 handle_to_slot(u32 handle, MemoryCardState state) {
|
||||
if (mc[0].state == state && mc[0].handle == handle) {
|
||||
return 0;
|
||||
}
|
||||
if (mc[1].state == state && mc[0].handle == handle) {
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Run the Memory Card state machine.
|
||||
* This waits for in-progress ops to finish.
|
||||
* If it is done, it starts a new op, if there is one pending.
|
||||
*/
|
||||
void MC_run() {
|
||||
// if we have an in-progress operation, wait for it to complete.
|
||||
if (callback) {
|
||||
s32 sony_cmd, sony_status;
|
||||
s32 status = sceMcSync(1, &sony_cmd, &sony_status);
|
||||
McCallbackFunc callback_for_sync = callback;
|
||||
if (status == sceMcExecRun) {
|
||||
// busy, return.
|
||||
return;
|
||||
}
|
||||
|
||||
if (status == sceMcExecFinish) {
|
||||
// sony function is done. do the callback
|
||||
callback = nullptr;
|
||||
(*callback_for_sync)(sony_status);
|
||||
} else {
|
||||
// sony function is done, but failed.
|
||||
assert(false);
|
||||
callback = nullptr;
|
||||
(*callback_for_sync)(0);
|
||||
}
|
||||
|
||||
if (callback) {
|
||||
// if we got another callback, it means there's another op started by the prev callback.
|
||||
// and this case, we're done.
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// if we got here, there is no in-progress operation. So start the next one.
|
||||
if (op.operation == MemoryCardOperationKind::FORMAT) {
|
||||
// grab the slot. should be open, but not formatted
|
||||
p1 = handle_to_slot(op.param, MemoryCardState::OPEN);
|
||||
if (p1 == -1) {
|
||||
// no slot in the right state.
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
} else {
|
||||
// do a getInfo
|
||||
s32 info_result = sceMcGetInfo(p1, 0, &p2, &p3, &p4);
|
||||
if (info_result == sceMcResSucceed) {
|
||||
callback = cb_reprobe_format;
|
||||
}
|
||||
// allow some number of errors.
|
||||
op.counter--;
|
||||
if (op.counter == 0) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
} else if (op.operation == MemoryCardOperationKind::UNFORMAT) {
|
||||
p1 = handle_to_slot(op.param, MemoryCardState::FORMATTED);
|
||||
if (p1 == -1) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
} else {
|
||||
s32 rv = sceMcUnformat(p1, 0);
|
||||
if (rv == sceMcResSucceed) {
|
||||
callback = cb_unformat;
|
||||
}
|
||||
op.counter--;
|
||||
if (op.counter == 0) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
} else if (op.operation == MemoryCardOperationKind::CREATE_FILE) {
|
||||
p1 = handle_to_slot(op.param, MemoryCardState::FORMATTED);
|
||||
if (p1 == -1) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
} else {
|
||||
s32 info_result = sceMcGetInfo(p1, 0, &p2, &p3, &p4);
|
||||
if (info_result == sceMcResSucceed) {
|
||||
callback = cb_reprobe_createfile;
|
||||
}
|
||||
// allow some number of errors.
|
||||
op.counter--;
|
||||
if (op.counter == 0) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
} else if (op.operation == MemoryCardOperationKind::SAVE) {
|
||||
p1 = handle_to_slot(op.param, MemoryCardState::FORMATTED);
|
||||
if (p1 == -1) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
} else {
|
||||
s32 info_result = sceMcGetInfo(p1, 0, &p2, &p3, &p4);
|
||||
if (info_result == sceMcResSucceed) {
|
||||
callback = cb_reprobe_save;
|
||||
}
|
||||
// allow some number of errors.
|
||||
op.counter--;
|
||||
if (op.counter == 0) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: the rest.
|
||||
}
|
||||
|
||||
///*!
|
||||
// * Get a new memory card handle.
|
||||
// * Will never return 0.
|
||||
// */
|
||||
// s32 new_mc_handle() {
|
||||
// s32 handle = next++;
|
||||
//
|
||||
// // if you wrap around, it avoid the zero handle.
|
||||
// // it doesn't seem like you will need billions of memory card handles
|
||||
// if(handle == 0) {
|
||||
// handle = next++;
|
||||
// }
|
||||
// return handle;
|
||||
//}
|
||||
//
|
||||
///*!
|
||||
// * A questionable checksum.
|
||||
// */
|
||||
// u32 mc_checksum(Ptr<u8> data, s32 size) {
|
||||
// if(size < 0) {
|
||||
// size += 3;
|
||||
// }
|
||||
//
|
||||
// u32 result = 0;
|
||||
// u32* data_u32 = (u32*)data.c();
|
||||
// for(s32 i = 0; i < size / 4; i++) {
|
||||
// result = result << 1 ^ result >> 0x1f ^ data_u32[i*4] ^ 0x12345678;
|
||||
// }
|
||||
//
|
||||
// return result ^ 0xedd1e666;
|
||||
//}
|
||||
//
|
||||
// u32 handle_to_slot(s32 handle, s32 p2) {
|
||||
// if(mc[0].p0 == p2 && mc[0].handle == handle) {
|
||||
// return 0;
|
||||
// }
|
||||
// if(mc[1].p0 == p2 && mc[0].handle == handle) {
|
||||
// return 1;
|
||||
// } else {
|
||||
// return -1;
|
||||
// }
|
||||
//}
|
||||
//
|
||||
// void MC_run() {
|
||||
//
|
||||
//}
|
||||
//
|
||||
/*!
|
||||
* Set the language or something.
|
||||
*/
|
||||
@@ -75,142 +227,417 @@ void MC_set_language(s32 l) {
|
||||
language = l;
|
||||
}
|
||||
|
||||
// u64 MC_format(s32 param) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
// op.operation = FORMAT;
|
||||
// op.result = 0;
|
||||
// op.f_10 = 100;
|
||||
// op.param = param;
|
||||
// }
|
||||
// return can_add;
|
||||
//}
|
||||
//
|
||||
//
|
||||
// u64 MC_unformat(s32 param) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
// op.operation = UNFORMAT;
|
||||
// op.result = 0;
|
||||
// op.f_10 = 100;
|
||||
// op.param = param;
|
||||
// }
|
||||
// return can_add;
|
||||
//}
|
||||
//
|
||||
// u64 MC_createfile(s32 param, Ptr<u8> data) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
// op.operation = CREATE_FILE;
|
||||
// op.result = 0;
|
||||
// op.f_10 = 100;
|
||||
// op.param = param;
|
||||
// op.data_ptr = data;
|
||||
// }
|
||||
// return can_add;
|
||||
//}
|
||||
//
|
||||
// u64 MC_save(s32 param, s32 param2, Ptr<u8> data, Ptr<u8> data2) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
// op.operation = SAVE;
|
||||
// op.result = 0;
|
||||
// op.f_10 = 100;
|
||||
// op.param = param;
|
||||
// op.param2 = param2;
|
||||
// op.data_ptr = data;
|
||||
// op.data_ptr2 = data2;
|
||||
// }
|
||||
// return can_add;
|
||||
//}
|
||||
//
|
||||
// u64 MC_load(s32 param, s32 param2, Ptr<u8> data) {
|
||||
// u64 can_add = op.operation == NO_OP;
|
||||
// if(can_add) {
|
||||
// op.operation = LOAD;
|
||||
// op.result = 0;
|
||||
// op.f_10 = 100;
|
||||
// op.param = param;
|
||||
// op.param2 = param2;
|
||||
// op.data_ptr = data;
|
||||
// }
|
||||
// return can_add;
|
||||
//}
|
||||
//
|
||||
///*!
|
||||
// * Some sort of test function for memory card stuff.
|
||||
// */
|
||||
// void MC_makefile(s32 port, s32 size) {
|
||||
// sceMcMkdir(port, 0, "/BASCUS-00000XXXXXXXX");
|
||||
// // wait for operation to complete
|
||||
// s32 cmd, result, fd;
|
||||
// sceMcSync(0, &cmd, &result);
|
||||
//
|
||||
// if(result == sceMcResSucceed || result == sceMcResNoEntry) {
|
||||
// // it worked, or the folder already exists...
|
||||
//
|
||||
// // open file
|
||||
// sceMcOpen(port, 0, "/BASCUS-00000XXXXXXXX/BASCUS-00000XXXXXXXX", SCE_CREAT | SCE_WRONLY);
|
||||
// sceMcSync(0, &cmd, &fd);
|
||||
//
|
||||
// if(result < 0) {
|
||||
// printf("Can\'t open file on memcard [%d]\n", result);
|
||||
// } else {
|
||||
// // write some random crap into the memory card.
|
||||
// sceMcWrite(fd, Ptr<u8>(0x1000000).c(), size);
|
||||
// sceMcSync(0, &cmd, &result);
|
||||
// if(result != size) {
|
||||
// printf("Only written %d bytes\n", result);
|
||||
// }
|
||||
// sceMcClose(fd);
|
||||
// sceMcSync(0, &cmd, &result);
|
||||
// }
|
||||
// } else {
|
||||
// printf("Can\'t create garbage folder [%d]\n", result);
|
||||
// }
|
||||
//}
|
||||
//
|
||||
// u32 MC_check_result() {
|
||||
// return op.result;
|
||||
//}
|
||||
//
|
||||
// void MC_get_status(s32 slot, Ptr<mc_slot_info> info) {
|
||||
// info->handle = 0;
|
||||
// info->known = 0;
|
||||
// info->formatted = 0;
|
||||
// info->initted = 0;
|
||||
// for(s32 i = 0; i < 4; i++) {
|
||||
// info->files[i].present = 0;
|
||||
// }
|
||||
// info->last_file = 0xffffffff;
|
||||
// info->mem_required = SAVE_SIZE;
|
||||
// info->mem_actual = 0;
|
||||
//
|
||||
// switch(mc[slot].p0) {
|
||||
// case 1:
|
||||
// info->known = 1;
|
||||
// break;
|
||||
// case 2:
|
||||
// info->known = 1;
|
||||
// info->handle = mc[slot].handle;
|
||||
// break;
|
||||
// case 3:
|
||||
// info->known = 1;
|
||||
// info->handle = mc[slot].handle;
|
||||
// info->formatted = 1;
|
||||
// if(mc[slot].inited == 0) {
|
||||
// info->mem_actual = mc[slot].mem_actual;
|
||||
// } else {
|
||||
// info->initted = 1;
|
||||
// for(s32 file = 0; file < 4; file++) {
|
||||
// info->files[file].present = mc[slot].files[file].present;
|
||||
// for(s32 i = 0; i < 64; i++) { // actually a loop over u32's
|
||||
// info->files[file].data[i] = mc[slot].files[file].data[i];
|
||||
// }
|
||||
// }
|
||||
// info->last_file = mc[slot].last_file;
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
/*!
|
||||
* Set the current memory card operation to FORMAT the given card.
|
||||
*/
|
||||
u64 MC_format(s32 card_idx) {
|
||||
u64 can_add = op.operation == MemoryCardOperationKind::NO_OP;
|
||||
if (can_add) {
|
||||
op.operation = MemoryCardOperationKind::FORMAT;
|
||||
op.result = McStatusCode::BUSY;
|
||||
op.counter = 100;
|
||||
op.param = card_idx;
|
||||
}
|
||||
return can_add;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set the current memory card operation to UNFORMAT the given card.
|
||||
*/
|
||||
u64 MC_unformat(s32 card_idx) {
|
||||
u64 can_add = op.operation == MemoryCardOperationKind::NO_OP;
|
||||
if (can_add) {
|
||||
op.operation = MemoryCardOperationKind::UNFORMAT;
|
||||
op.result = McStatusCode::BUSY;
|
||||
op.counter = 100;
|
||||
op.param = card_idx;
|
||||
}
|
||||
return can_add;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set the current memory card operation to create the save file.
|
||||
* The data I believe is just an empty buffer.
|
||||
*/
|
||||
u64 MC_createfile(s32 param, Ptr<u8> data) {
|
||||
u64 can_add = op.operation == MemoryCardOperationKind::NO_OP;
|
||||
if (can_add) {
|
||||
op.operation = MemoryCardOperationKind::CREATE_FILE;
|
||||
op.result = McStatusCode::BUSY;
|
||||
op.counter = 100;
|
||||
op.param = param;
|
||||
op.data_ptr = data;
|
||||
}
|
||||
return can_add;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set the current operation to SAVE.
|
||||
*/
|
||||
u64 MC_save(s32 card_idx, s32 file_idx, Ptr<u8> save_data, Ptr<u8> save_summary_data) {
|
||||
u64 can_add = op.operation == MemoryCardOperationKind::NO_OP;
|
||||
if (can_add) {
|
||||
op.operation = MemoryCardOperationKind::SAVE;
|
||||
op.result = McStatusCode::BUSY;
|
||||
op.counter = 100;
|
||||
op.param = card_idx;
|
||||
op.param2 = file_idx;
|
||||
op.data_ptr = save_data;
|
||||
op.data_ptr2 = save_summary_data;
|
||||
}
|
||||
return can_add;
|
||||
}
|
||||
|
||||
u64 MC_load(s32 card_idx, s32 file_idx, Ptr<u8> data) {
|
||||
u64 can_add = op.operation == MemoryCardOperationKind::NO_OP;
|
||||
if (can_add) {
|
||||
op.operation = MemoryCardOperationKind::LOAD;
|
||||
op.result = McStatusCode::BUSY;
|
||||
op.counter = 100;
|
||||
op.param = card_idx;
|
||||
op.param2 = file_idx;
|
||||
op.data_ptr = data;
|
||||
}
|
||||
return can_add;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Some sort of test function for memory card stuff.
|
||||
* This is exported as a GOAL function, but nothing calls it.
|
||||
*/
|
||||
void MC_makefile(s32 port, s32 size) {
|
||||
sceMcMkdir(port, 0, "/BASCUS-00000XXXXXXXX");
|
||||
// wait for operation to complete
|
||||
s32 cmd, result, fd;
|
||||
sceMcSync(0, &cmd, &result);
|
||||
|
||||
if (result == sceMcResSucceed || result == sceMcResNoEntry) {
|
||||
// it worked, or the folder already exists...
|
||||
|
||||
// open file
|
||||
sceMcOpen(port, 0, "/BASCUS-00000XXXXXXXX/BASCUS-00000XXXXXXXX", SCE_CREAT | SCE_WRONLY);
|
||||
sceMcSync(0, &cmd, &fd);
|
||||
|
||||
if (result < 0) {
|
||||
printf("Can\'t open file on memcard [%d]\n", result);
|
||||
} else {
|
||||
// write some random crap into the memory card.
|
||||
sceMcWrite(fd, Ptr<u8>(0x1000000).c(), size);
|
||||
sceMcSync(0, &cmd, &result);
|
||||
if (result != size) {
|
||||
printf("Only written %d bytes\n", result);
|
||||
}
|
||||
sceMcClose(fd);
|
||||
sceMcSync(0, &cmd, &result);
|
||||
}
|
||||
} else {
|
||||
printf("Can\'t create garbage folder [%d]\n", result);
|
||||
}
|
||||
}
|
||||
|
||||
u32 MC_check_result() {
|
||||
return (u32)op.result;
|
||||
}
|
||||
|
||||
void MC_get_status(s32 slot, Ptr<mc_slot_info> info) {
|
||||
info->handle = 0;
|
||||
info->known = 0;
|
||||
info->formatted = 0;
|
||||
info->initted = 0;
|
||||
for (s32 i = 0; i < 4; i++) {
|
||||
info->files[i].present = 0;
|
||||
}
|
||||
info->last_file = 0xffffffff;
|
||||
info->mem_required = SAVE_SIZE;
|
||||
info->mem_actual = 0;
|
||||
|
||||
switch (mc[slot].state) {
|
||||
case MemoryCardState::KNOWN:
|
||||
info->known = 1;
|
||||
break;
|
||||
case MemoryCardState::OPEN:
|
||||
info->known = 1;
|
||||
info->handle = mc[slot].handle;
|
||||
break;
|
||||
case MemoryCardState::FORMATTED:
|
||||
info->known = 1;
|
||||
info->handle = mc[slot].handle;
|
||||
info->formatted = 1;
|
||||
if (mc[slot].inited == 0) {
|
||||
info->mem_actual = mc[slot].mem_size;
|
||||
} else {
|
||||
info->initted = 1;
|
||||
for (s32 file = 0; file < 4; file++) {
|
||||
info->files[file].present = mc[slot].files[file].present;
|
||||
for (s32 i = 0; i < 64; i++) { // actually a loop over u32's
|
||||
info->files[file].data[i] = mc[slot].files[file].data[i];
|
||||
}
|
||||
}
|
||||
info->last_file = mc[slot].last_file;
|
||||
}
|
||||
case MemoryCardState::UNKNOWN:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Check for an error. Returns true if there is an error and sets op.result as needed
|
||||
*/
|
||||
u64 cb_check(s32 sony_error, McStatusCode goal_error) {
|
||||
if (sony_error < 0) {
|
||||
// sony thing failed.
|
||||
if (sony_error < -9) {
|
||||
// memory card gone. reset state
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
// kill in progress op
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
return 1;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = goal_error;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// cb check open
|
||||
// cb check read
|
||||
// cb check close
|
||||
// cb reprobe
|
||||
|
||||
void cb_reprobe_format(s32 sync_result) {
|
||||
if (sync_result == sceMcResSucceed) {
|
||||
// get info succeeded. we can format.
|
||||
s32 format_result = sceMcFormat(p1, 0);
|
||||
if (format_result == sceMcResSucceed) {
|
||||
callback = cb_format_complete;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
// get info failed. Revert the state to unknown, this will restart everything.
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void cb_format_complete(s32 sync_result) {
|
||||
if (sync_result == sceMcResSucceed) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::OK;
|
||||
mc[p1].state = MemoryCardState::FORMATTED;
|
||||
mc[p1].formatted = 100;
|
||||
mc[p1].inited = 0;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mc[p1].files[i].present = 0;
|
||||
}
|
||||
mc[p1].last_file = -1;
|
||||
mc[p1].mem_size = 8000;
|
||||
} else {
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::FORMAT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
void cb_unformat(s32 sync_result) {
|
||||
if (sync_result == sceMcResSucceed) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::OK;
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
} else {
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::FORMAT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
void cb_reprobe_createfile(s32 sync_result) {
|
||||
if (sync_result == sceMcResSucceed) {
|
||||
// if the ramdisk is ready, just jump directly to its callback
|
||||
if (!RpcBusy(RAMDISK_RPC_CHANNEL)) {
|
||||
cb_wait_for_ramdisk(0);
|
||||
} else {
|
||||
// otherwise, don't.
|
||||
callback = cb_wait_for_ramdisk;
|
||||
}
|
||||
} else {
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
}
|
||||
}
|
||||
|
||||
void cb_wait_for_ramdisk(s32) {
|
||||
RPC_Ramdisk_LoadCmd cmd;
|
||||
cmd.pad = 0;
|
||||
cmd.file_id_or_ee_addr = op.data_ptr.offset;
|
||||
cmd.offset_into_file = 0;
|
||||
cmd.size = 0x1e800;
|
||||
memcpy(cmd.name, "SAVEGAME.ICO", 13); // was 16.
|
||||
RpcCall(RAMDISK_RPC_CHANNEL, RAMDISK_BYPASS_LOAD_FILE, 1, &ramdisk_cmd, 0x20, nullptr, 0);
|
||||
callback = cb_wait_for_ramdisk_load;
|
||||
}
|
||||
|
||||
void cb_wait_for_ramdisk_load(s32) {
|
||||
if (RpcBusy(RAMDISK_RPC_CHANNEL) == 0) {
|
||||
p2 = 11; // filenames left to delete
|
||||
if (sceMcDelete(p1, 0, filename[11]) == sceMcResSucceed) {
|
||||
callback = cb_createfile_erasing;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
callback = cb_wait_for_ramdisk_load;
|
||||
}
|
||||
}
|
||||
|
||||
void cb_createfile_erasing(s32 sync_result) {
|
||||
if (sync_result == sceMcResSucceed || sync_result == sceMcResNoEntry ||
|
||||
sync_result == sceMcResNotEmpty) {
|
||||
mc[p1].inited = 0;
|
||||
// delete didn't fail.
|
||||
if (p2 < 1) {
|
||||
// on the last one. which is the directory to create.
|
||||
if (sceMcMkdir(p1, 0, filename[0]) == sceMcResSucceed) {
|
||||
callback = cb_createdir;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
p2--;
|
||||
if (sceMcDelete(p1, 0, filename[p2]) == sceMcResSucceed) {
|
||||
callback = cb_createfile_erasing;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (sync_result == sceMcResDeniedPermit) {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
} else {
|
||||
mc[p1].state = MemoryCardState::UNKNOWN;
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::BAD_HANDLE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cb_createdir(s32 sync_result) {
|
||||
if (!cb_check(sync_result, McStatusCode::WRITE_ERROR)) {
|
||||
// this sets up some stuff for the icon file that we will ignore.
|
||||
// memset(&iconsys,0,0x3c4);
|
||||
// kstrcpy(&iconsys,&DAT_00137000);
|
||||
// if (language == Language::Japanese) {
|
||||
// kstrcpy(&DAT_00137560,titles[5]);
|
||||
// } else {
|
||||
// // non japanese need to convert to shift-JIS format.
|
||||
// ASCII2SJIS(&DAT_00137560,titles[language]);
|
||||
// }
|
||||
// DAT_001374a6 = 0x20;
|
||||
// DAT_001374ac = 0;
|
||||
// memcpy(&DAT_001374b0,bgcolor.610,0x40);
|
||||
// memcpy(&DAT_001374f0,lightdir.611,0x30);
|
||||
// memcpy(&DAT_00137520,lightcol.612,0x30);
|
||||
// memcpy(&DAT_00137550,ambient.613,0x10);
|
||||
// kstrcpy(&DAT_001375a4,"icon.ico");
|
||||
// kstrcpy(&DAT_001375e4,"icon.ico");
|
||||
// kstrcpy(&DAT_00137624,"icon.ico");
|
||||
|
||||
p2 = 1;
|
||||
if (sceMcOpen(p1, 0, filename[1], 0x203) == 0) {
|
||||
callback = cb_createdfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cb_createdfile(s32 sync_result) {
|
||||
if (!cb_check(sync_result, McStatusCode::WRITE_ERROR)) {
|
||||
if (p2 == 1) {
|
||||
p3 = sync_result; // the fd of the icon file.
|
||||
// actually would write the icon sys file.
|
||||
if (sceMcWrite(sync_result, nullptr, 0) == sceMcResSucceed) {
|
||||
callback = cb_writtenfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else if (p2 == 2) {
|
||||
p3 = sync_result;
|
||||
// would write the icon data (ramdisk loaded into the temp buffer)
|
||||
if (sceMcWrite(sync_result, nullptr, 0) == sceMcResSucceed) {
|
||||
callback = cb_writtenfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else if (p2 == 3) {
|
||||
p3 = sync_result;
|
||||
kstrcpy(op.data_ptr.cast<char>().c(), "Nope, the save game data isn\'t in this file!\n");
|
||||
if (sceMcWrite(p3, op.data_ptr.c(), strlen((const char*)op.data_ptr.c())) ==
|
||||
sceMcResSucceed) {
|
||||
callback = cb_writtenfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
p3 = sync_result;
|
||||
memset(op.data_ptr.c(), 0, 0x11800);
|
||||
if (sceMcWrite(p3, op.data_ptr.c(), 0x11800)) {
|
||||
callback = cb_writtenfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cb_writtenfile(s32 sync_result) {
|
||||
if (!cb_check(sync_result, McStatusCode::WRITE_ERROR)) {
|
||||
if (sceMcClose(p3) == sceMcResSucceed) {
|
||||
callback = cb_closedfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cb_closedfile(s32 sync_result) {
|
||||
if (!cb_check(sync_result, McStatusCode::WRITE_ERROR)) {
|
||||
p2++;
|
||||
if (p2 < 0xc) {
|
||||
if (sceMcOpen(p1, 0, filename[p2], 0x203) == sceMcResSucceed) {
|
||||
callback = cb_createdfile;
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::INTERNAL_ERROR;
|
||||
}
|
||||
} else {
|
||||
op.operation = MemoryCardOperationKind::NO_OP;
|
||||
op.result = McStatusCode::OK;
|
||||
mc[p1].inited = 1;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
mc[p1].files[i].present = 0;
|
||||
}
|
||||
mc[p1].last_file = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cb_reprobe_save(s32) {
|
||||
assert(false);
|
||||
}
|
||||
+56
-33
@@ -12,21 +12,63 @@ void kmemcard_init_globals();
|
||||
|
||||
constexpr s32 SAVE_SIZE = 0x2b3; // likely different by versions!
|
||||
|
||||
enum MemoryCardOperationKind {
|
||||
enum class MemoryCardState : u32 { UNKNOWN = 0, KNOWN = 1, OPEN = 2, FORMATTED = 3 };
|
||||
|
||||
// cached in ee memory so we can preview.
|
||||
struct MemoryCardFile {
|
||||
u32 present;
|
||||
u32 pad1;
|
||||
u32 pad2;
|
||||
u8 data[64];
|
||||
};
|
||||
|
||||
// type of the mc field.
|
||||
struct MemoryCard {
|
||||
MemoryCardState state;
|
||||
u32 handle;
|
||||
u32 formatted;
|
||||
u32 inited;
|
||||
u32 last_file;
|
||||
u32 mem_size;
|
||||
MemoryCardFile files[4];
|
||||
};
|
||||
|
||||
enum class MemoryCardOperationKind : u32 {
|
||||
NO_OP = 0,
|
||||
FORMAT = 1,
|
||||
UNFORMAT = 2,
|
||||
CREATE_FILE = 3,
|
||||
FORMAT = 1, // (handle, unused), (slot, type, free, format)
|
||||
UNFORMAT = 2, // (handle, unused), (slot)
|
||||
CREATE_FILE = 3, // (handle, unused)
|
||||
SAVE = 4,
|
||||
LOAD = 5,
|
||||
};
|
||||
|
||||
enum class McStatusCode : u32 {
|
||||
BUSY = 0,
|
||||
OK = 1,
|
||||
BAD_HANDLE = 2,
|
||||
FORMAT_FAILED = 3,
|
||||
INTERNAL_ERROR = 4,
|
||||
WRITE_ERROR = 5,
|
||||
READ_ERROR = 6,
|
||||
NEW_GAME = 7,
|
||||
NO_MEMORY = 8,
|
||||
NO_CARD = 9,
|
||||
NO_LAST = 10,
|
||||
NO_FORMAT = 11,
|
||||
NO_FILE = 12,
|
||||
NO_SAVE = 13,
|
||||
NO_SPACE = 14,
|
||||
BAD_VERSION = 15,
|
||||
NO_PROCESS = 16,
|
||||
NO_AUTO_SAVE = 17
|
||||
};
|
||||
|
||||
struct MemoryCardOperation {
|
||||
uint32_t operation;
|
||||
MemoryCardOperationKind operation;
|
||||
uint32_t param;
|
||||
uint32_t param2;
|
||||
uint32_t result;
|
||||
uint32_t f_10;
|
||||
McStatusCode result;
|
||||
uint32_t counter;
|
||||
Ptr<u8> data_ptr;
|
||||
Ptr<u8> data_ptr2;
|
||||
};
|
||||
@@ -36,43 +78,24 @@ struct mc_file_info {
|
||||
u8 data[64];
|
||||
};
|
||||
|
||||
struct mc_file_info_2 {
|
||||
u32 present;
|
||||
u32 pad1;
|
||||
u32 pad2;
|
||||
u8 data[64];
|
||||
};
|
||||
|
||||
struct mc_slot_info {
|
||||
u32 handle;
|
||||
u32 known;
|
||||
u32 formatted;
|
||||
u32 initted;
|
||||
u32 last_file;
|
||||
s32 last_file;
|
||||
u32 mem_required;
|
||||
u32 mem_actual;
|
||||
mc_file_info files[4];
|
||||
};
|
||||
|
||||
struct mc_info {
|
||||
s32 p0;
|
||||
s32 handle;
|
||||
s32 inited;
|
||||
s32 mem_actual;
|
||||
s32 last_file;
|
||||
mc_file_info_2 files[4];
|
||||
};
|
||||
|
||||
s32 new_mc_handle();
|
||||
u32 mc_checksum(Ptr<u8> data, s32 size);
|
||||
u32 handle_to_slot(s32 p1, s32 p2);
|
||||
void MC_run();
|
||||
void MC_set_language(s32 lang);
|
||||
u64 MC_format(s32 param);
|
||||
u64 MC_unformat(s32 param);
|
||||
void MC_run();
|
||||
u64 MC_format(s32 card_idx);
|
||||
u64 MC_unformat(s32 card_idx);
|
||||
u64 MC_createfile(s32 param, Ptr<u8> data);
|
||||
u64 MC_save(s32 param, s32 param2, Ptr<u8> data, Ptr<u8> data2);
|
||||
u64 MC_load(s32 param, s32 param2, Ptr<u8> data);
|
||||
u64 MC_save(s32 card_idx, s32 file_idx, Ptr<u8> save_data, Ptr<u8> save_summary_data);
|
||||
u64 MC_load(s32 card_idx, s32 file_idx, Ptr<u8> data);
|
||||
void MC_makefile(s32 port, s32 size);
|
||||
u32 MC_check_result();
|
||||
void MC_get_status(s32 slot, Ptr<mc_slot_info> info);
|
||||
u32 MC_check_result();
|
||||
@@ -1937,15 +1937,15 @@ s32 InitHeapAndSymbol() {
|
||||
// game stuff
|
||||
make_stack_arg_function_symbol_from_c("link-begin", (void*)link_begin);
|
||||
make_function_symbol_from_c("link-resume", (void*)link_resume);
|
||||
// make_function_symbol_from_c("mc-run", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-format", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-unformat", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-create-file", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-save", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-load", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-check-result", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-get-slot-info", &CKernel::not_yet_implemented);
|
||||
// make_function_symbol_from_c("mc-makefile", &CKernel::not_yet_implemented);
|
||||
make_function_symbol_from_c("mc-run", (void*)MC_run);
|
||||
make_function_symbol_from_c("mc-format", (void*)MC_format);
|
||||
make_function_symbol_from_c("mc-unformat", (void*)MC_unformat);
|
||||
make_function_symbol_from_c("mc-create-file", (void*)MC_createfile);
|
||||
make_function_symbol_from_c("mc-save", (void*)MC_save);
|
||||
make_function_symbol_from_c("mc-load", (void*)MC_load);
|
||||
make_function_symbol_from_c("mc-check-result", (void*)MC_check_result);
|
||||
make_function_symbol_from_c("mc-get-slot-info", (void*)MC_get_status);
|
||||
make_function_symbol_from_c("mc-makefile", (void*)MC_makefile);
|
||||
make_function_symbol_from_c("kset-language", (void*)MC_set_language);
|
||||
|
||||
// set *debug-segment*
|
||||
|
||||
+181
-4
@@ -68,10 +68,6 @@ int sceSifLoadModule(const char* name, int arg_size, const char* args) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sceMcInit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 sceSifCallRpc(sceSifClientData* bd,
|
||||
u32 fno,
|
||||
u32 mode,
|
||||
@@ -178,4 +174,185 @@ s32 sceLseek(s32 fd, s32 offset, s32 where) {
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* The actual data stored on the memory card.
|
||||
*/
|
||||
struct CardData {
|
||||
// each file has a name and data.
|
||||
struct File {
|
||||
std::string name;
|
||||
std::vector<u8> data;
|
||||
};
|
||||
// can be formatted or unformatted card.
|
||||
u32 is_formatted = 0;
|
||||
std::unordered_map<std::string, File> files;
|
||||
};
|
||||
|
||||
/*!
|
||||
* The actual memory card library state + current data.
|
||||
*/
|
||||
struct McState {
|
||||
s32 current_function = -1; // -1 = nothing
|
||||
s32 current_function_result = 0;
|
||||
|
||||
struct McFileHandle {
|
||||
std::string name;
|
||||
u32 fd = 0;
|
||||
s32 mode = 0;
|
||||
};
|
||||
|
||||
std::unordered_map<int, McFileHandle> handles;
|
||||
|
||||
// TODO: we should load this data at startup from a memory card file, and save it at each write.
|
||||
CardData data;
|
||||
int next_fd = 1;
|
||||
} g_mc_state;
|
||||
|
||||
int sceMcInit() {
|
||||
g_mc_state = McState();
|
||||
return 1;
|
||||
}
|
||||
|
||||
s32 sceMcMkdir(s32 port, s32 slot, const char* name) {
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
// TODO name
|
||||
(void)name;
|
||||
return sceMcResSucceed;
|
||||
}
|
||||
|
||||
s32 sceMcSync(s32 mode, s32* cmd, s32* result) {
|
||||
// don't care about the mode, all memory card ops are instant.
|
||||
assert(mode == 1 || mode == 0);
|
||||
if (g_mc_state.current_function == -1) {
|
||||
return sceMcExecIdle;
|
||||
} else {
|
||||
*cmd = g_mc_state.current_function;
|
||||
*result = g_mc_state.current_function_result;
|
||||
g_mc_state.current_function = -1;
|
||||
return sceMcExecFinish;
|
||||
}
|
||||
}
|
||||
|
||||
s32 sceMcOpen(s32 port, s32 slot, const char* name, s32 mode) {
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
assert(g_mc_state.current_function == -1);
|
||||
|
||||
// add existing file, if it does not exist.
|
||||
auto existing_file = g_mc_state.data.files.find(name);
|
||||
if (existing_file == g_mc_state.data.files.end()) {
|
||||
assert(mode & SCE_CREAT);
|
||||
g_mc_state.data.files[name] = {};
|
||||
}
|
||||
|
||||
// create a handle.
|
||||
g_mc_state.current_function = sceMcFuncNoOpen;
|
||||
s32 fd = g_mc_state.next_fd++;
|
||||
McState::McFileHandle handle;
|
||||
handle.name = name;
|
||||
handle.fd = fd;
|
||||
handle.mode = mode;
|
||||
g_mc_state.handles[fd] = handle;
|
||||
|
||||
g_mc_state.current_function_result = fd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcWrite(s32 fd, const void* buff, s32 size) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
|
||||
assert(size >= 0 && size < (1024 * 1024 * 1024));
|
||||
auto hand = g_mc_state.handles.find(fd);
|
||||
assert(hand != g_mc_state.handles.end()); // make sure fd is valid
|
||||
assert(hand->second.mode & SCE_WRONLY); // make sure we're allowed to write
|
||||
|
||||
const auto& file = g_mc_state.data.files.find(hand->second.name);
|
||||
assert(file != g_mc_state.data.files.end());
|
||||
|
||||
file->second.data.resize(size);
|
||||
memcpy(file->second.data.data(), buff, size);
|
||||
|
||||
// TODO: save memcard data to a file.
|
||||
|
||||
g_mc_state.current_function = sceMcFuncNoWrite;
|
||||
g_mc_state.current_function_result = size;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcClose(s32 fd) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
auto hand = g_mc_state.handles.find(fd);
|
||||
assert(hand != g_mc_state.handles.end()); // make sure fd is valid
|
||||
g_mc_state.handles.erase(fd);
|
||||
g_mc_state.current_function = sceMcFuncNoClose;
|
||||
g_mc_state.current_function_result = sceMcResSucceed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcGetInfo(s32 port, s32 slot, s32* type, s32* free, s32* format) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
if (type) {
|
||||
*type = sceMcTypePS2;
|
||||
}
|
||||
|
||||
if (free) {
|
||||
*free = 2 * 1024; // number of free 1 kB clusters
|
||||
}
|
||||
|
||||
if (format) {
|
||||
*format = g_mc_state.data.is_formatted;
|
||||
}
|
||||
|
||||
g_mc_state.current_function = sceMcFuncNoCardInfo;
|
||||
|
||||
// technically this should return something else the first time you call this function after
|
||||
// changing cards.
|
||||
g_mc_state.current_function_result = sceMcResSucceed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcFormat(s32 port, s32 slot) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
g_mc_state.data.is_formatted = true;
|
||||
g_mc_state.current_function_result = sceMcResSucceed;
|
||||
g_mc_state.current_function = sceMcFuncNoFormat;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcUnformat(s32 port, s32 slot) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
g_mc_state.data.is_formatted = false;
|
||||
g_mc_state.current_function_result = sceMcResSucceed;
|
||||
g_mc_state.current_function = sceMcFuncNoUnformat;
|
||||
return 0;
|
||||
}
|
||||
|
||||
s32 sceMcDelete(s32 port, s32 slot, const char* name) {
|
||||
assert(g_mc_state.current_function == -1);
|
||||
assert(port == 0);
|
||||
assert(slot == 0);
|
||||
g_mc_state.current_function = sceMcFuncNoDelete;
|
||||
|
||||
if (!g_mc_state.data.is_formatted) {
|
||||
g_mc_state.current_function_result = sceMcResNoFormat;
|
||||
} else {
|
||||
auto it = g_mc_state.data.files.find(name);
|
||||
if (it == g_mc_state.data.files.end()) {
|
||||
g_mc_state.current_function_result = sceMcResNoEntry;
|
||||
} else {
|
||||
// sometimes should be sceMcResNotEmpty, but doesn't matter.
|
||||
g_mc_state.current_function_result = sceMcResSucceed;
|
||||
g_mc_state.data.files.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
} // namespace ee
|
||||
+31
-4
@@ -1,8 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#ifndef JAK1_SIF_EE_H
|
||||
#define JAK1_SIF_EE_H
|
||||
|
||||
#include "common/common_types.h"
|
||||
|
||||
class IOP;
|
||||
@@ -70,11 +67,41 @@ s32 sceSifBindRpc(sceSifClientData* bd, u32 request, u32 mode);
|
||||
#define SCE_NOBUF 0x4000
|
||||
#define SCE_NOWAIT 0x8000
|
||||
|
||||
#define sceMcExecIdle (-1)
|
||||
#define sceMcExecRun 0
|
||||
#define sceMcExecFinish 1
|
||||
|
||||
#define sceMcResSucceed 0
|
||||
#define sceMcResNoFormat (-2)
|
||||
#define sceMcResNoEntry (-4)
|
||||
#define sceMcResDeniedPermit (-5)
|
||||
#define sceMcResNotEmpty (-6)
|
||||
|
||||
#define sceMcFuncNoCardInfo 1
|
||||
#define sceMcFuncNoOpen 2
|
||||
#define sceMcFuncNoClose 3
|
||||
#define sceMcFuncNoWrite 6
|
||||
#define sceMcFuncNoFormat 16
|
||||
#define sceMcFuncNoDelete 15
|
||||
#define sceMcFuncNoUnformat 17
|
||||
|
||||
#define sceMcTypePS2 2
|
||||
|
||||
s32 sceOpen(const char* filename, s32 flag);
|
||||
s32 sceClose(s32 fd);
|
||||
s32 sceRead(s32 fd, void* buf, s32 nbyte);
|
||||
s32 sceWrite(s32 fd, const void* buf, s32 nbyte);
|
||||
s32 sceLseek(s32 fd, s32 offset, s32 where);
|
||||
|
||||
s32 sceMcMkdir(s32 port, s32 slot, const char* name);
|
||||
s32 sceMcSync(s32 mode, s32* cmd, s32* result);
|
||||
s32 sceMcOpen(s32 port, s32 slot, const char* name, s32 mode);
|
||||
s32 sceMcWrite(s32 fd, const void* buff, s32 size);
|
||||
s32 sceMcClose(s32 fd);
|
||||
|
||||
s32 sceMcGetInfo(s32 port, s32 slot, s32* type, s32* free, s32* format);
|
||||
s32 sceMcFormat(s32 port, s32 slot);
|
||||
s32 sceMcUnformat(s32 port, s32 slot);
|
||||
s32 sceMcDelete(s32 port, s32 slot, const char* name);
|
||||
|
||||
} // namespace ee
|
||||
#endif // JAK1_SIF_EE_H
|
||||
|
||||
@@ -343,10 +343,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
|
||||
(the-as uint (* s5-0 32))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -366,17 +363,11 @@
|
||||
(-> arg0 current-sun env-color)
|
||||
(the-as
|
||||
vector
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
|
||||
(the-as uint (* s5-0 32))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s5-0 32))
|
||||
)
|
||||
(the-as
|
||||
vector
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
|
||||
(the-as uint (* s4-0 32))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* s4-0 32))
|
||||
)
|
||||
f30-0
|
||||
)
|
||||
@@ -438,10 +429,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-fog-table data 0 fog-dists))
|
||||
(the-as uint (* 48 arg1))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-fog-table data 0 fog-dists)) (* 48 arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -450,10 +438,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-fog-table data 0 erase-color))
|
||||
(the-as uint (* 48 arg1))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-fog-table data 0 erase-color)) (* 48 arg1))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -462,10 +447,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-lights-table data 0 prt-color))
|
||||
(the-as uint (* 80 arg3))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-lights-table data 0 prt-color)) (* 80 arg3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -478,10 +460,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-sun-table data 0 env-color))
|
||||
(the-as uint (* arg2 32))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-sun-table data 0 env-color)) (* arg2 32))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -490,10 +469,7 @@
|
||||
(->
|
||||
(the-as
|
||||
(pointer uint128)
|
||||
(+
|
||||
(the-as uint (-> arg0 mood-lights-table data 0 shadow))
|
||||
(the-as uint (* 80 arg3))
|
||||
)
|
||||
(+ (the-as uint (-> arg0 mood-lights-table data 0 shadow)) (* 80 arg3))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -723,7 +699,7 @@
|
||||
(arg6 float)
|
||||
)
|
||||
(let* ((s5-0 (&-> arg0 state arg3))
|
||||
(s4-0 (+ (-> s5-0 0) (the-as uint arg1)))
|
||||
(s4-0 (+ (-> s5-0 0) arg1))
|
||||
(a0-1 (-> s5-0 1))
|
||||
(v1-2 (-> s5-0 2))
|
||||
(s0-0 (-> s5-0 3))
|
||||
@@ -1028,6 +1004,7 @@
|
||||
|
||||
;; definition for function update-mood-lightning
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(define-extern update-mood-lightning (function mood-context int int int int float symbol none))
|
||||
|
||||
;; definition of type light-time-state
|
||||
(deftype light-time-state (structure)
|
||||
@@ -1077,12 +1054,7 @@
|
||||
(arg7 int)
|
||||
)
|
||||
(let* ((gp-0 (&-> arg0 state arg2))
|
||||
(f0-1
|
||||
(the
|
||||
float
|
||||
(* (logand (+ (-> arg0 state arg3) (the-as uint arg7)) 255) 512)
|
||||
)
|
||||
)
|
||||
(f0-1 (the float (* (logand (+ (-> arg0 state arg3) arg7) 255) 512)))
|
||||
(f0-4 (+ arg4 (* (cos f0-1) arg5)))
|
||||
(f30-1 (* 0.003921569 (the float (-> gp-0 0))))
|
||||
)
|
||||
@@ -1153,6 +1125,7 @@
|
||||
|
||||
;; definition for function update-mood-lava
|
||||
;; ERROR: function was not converted to expressions. Cannot decompile.
|
||||
(define-extern update-mood-lava (function mood-context float int symbol none))
|
||||
|
||||
;; definition for function update-mood-caustics
|
||||
(defun update-mood-caustics ((arg0 mood-context) (arg1 int) (arg2 int))
|
||||
@@ -1161,9 +1134,9 @@
|
||||
(f0-1 (* 0.125 (the float (logand a2-1 7))))
|
||||
)
|
||||
(let ((a2-4 (logand (+ v1-2 -1) 3)))
|
||||
(set! (-> arg0 times (+ arg1 (the-as int a2-4)) w) (- 1.0 f0-1))
|
||||
(set! (-> arg0 times (+ arg1 a2-4) w) (- 1.0 f0-1))
|
||||
)
|
||||
(set! (-> arg0 times (+ arg1 (the-as int v1-2)) w) f0-1)
|
||||
(set! (-> arg0 times (+ arg1 v1-2) w) f0-1)
|
||||
f0-1
|
||||
)
|
||||
)
|
||||
@@ -1282,7 +1255,7 @@
|
||||
(update-mood-palette arg0 arg1 arg2)
|
||||
(when *time-of-day-effects*
|
||||
(update-mood-flames arg0 4 4 0 0.333 0.001953125 1.0)
|
||||
; TODO (update-mood-lightning arg0 2 2 4 2 0.5 #f)
|
||||
(update-mood-lightning arg0 2 2 4 2 0.5 #f)
|
||||
)
|
||||
(let ((a0-7 (-> arg0 light-group 1)))
|
||||
(update-light-kit a0-7 (-> arg0 light-group 0 ambi) 0.9)
|
||||
@@ -1404,7 +1377,7 @@
|
||||
(update-mood-palette arg0 arg1 arg2)
|
||||
(when *time-of-day-effects*
|
||||
(update-mood-flames arg0 4 4 0 0.333 0.001953125 1.0)
|
||||
; TODO (update-mood-lightning arg0 2 2 4 2 0.5 #f)
|
||||
(update-mood-lightning arg0 2 2 4 2 0.5 #f)
|
||||
)
|
||||
(let ((f30-0 (fmax 0.0 (-> *math-camera* camera-rot vector 1 z))))
|
||||
(let ((a2-4 (new 'stack-no-clear 'vector)))
|
||||
@@ -1986,10 +1959,7 @@
|
||||
(*
|
||||
0.0625
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 4000 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
(the float (* 4000 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -2000,12 +1970,7 @@
|
||||
)
|
||||
(*
|
||||
0.125
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 1500 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
(cos (the float (* 1500 (-> *display* integral-frame-counter))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -2145,7 +2110,7 @@
|
||||
(if (not (paused?))
|
||||
(+! (-> arg0 state 4) 1)
|
||||
)
|
||||
; TODO (update-mood-lightning arg0 2 2 5 2 0.5 #t)
|
||||
(update-mood-lightning arg0 2 2 5 2 0.5 #t)
|
||||
)
|
||||
(let ((a0-10 (-> arg0 light-group 1)))
|
||||
(update-light-kit a0-10 (-> arg0 light-group 0 ambi) 1.0)
|
||||
@@ -2242,10 +2207,7 @@
|
||||
(let
|
||||
((f0-19
|
||||
(vector-vector-distance
|
||||
(the-as
|
||||
vector
|
||||
(+ (the-as uint *rolling-spheres-light2*) (the-as uint (* s4-4 16)))
|
||||
)
|
||||
(the-as vector (+ (the-as uint *rolling-spheres-light2*) (* s4-4 16)))
|
||||
s5-3
|
||||
)
|
||||
)
|
||||
@@ -2343,9 +2305,9 @@
|
||||
(update-mood-sky-texture arg0 arg1)
|
||||
(clear-mood-times arg0)
|
||||
(update-mood-palette arg0 arg1 arg2)
|
||||
; (if *time-of-day-effects*
|
||||
; ;; TODO (update-mood-lava arg0 (the-as float 4) 0 #t)
|
||||
; )
|
||||
(if *time-of-day-effects*
|
||||
(update-mood-lava arg0 (the-as float 4) 0 #t)
|
||||
)
|
||||
(update-mood-itimes arg0)
|
||||
0
|
||||
(none)
|
||||
@@ -2948,7 +2910,7 @@
|
||||
(if (not (paused?))
|
||||
(+! (-> arg0 some-byte) 1)
|
||||
)
|
||||
;; TODO - (update-mood-lava arg0 (the-as float 4) 0 #t)
|
||||
(update-mood-lava arg0 (the-as float 4) 0 #t)
|
||||
)
|
||||
(update-mood-quick arg0 0 0 0 arg2)
|
||||
(update-mood-itimes arg0)
|
||||
@@ -3005,9 +2967,9 @@
|
||||
(rand-vu-float-range 64.0 2048.0)
|
||||
)
|
||||
)
|
||||
; (if (not (movie?))
|
||||
; ; TODO (update-mood-lightning arg0 2 2 18 4 0.5 #f)
|
||||
; )
|
||||
(if (not (movie?))
|
||||
(update-mood-lightning arg0 2 2 18 4 0.5 #f)
|
||||
)
|
||||
(cond
|
||||
((or (nonzero? *lightning-time2*) (movie?))
|
||||
(if (not (paused?))
|
||||
@@ -3334,11 +3296,11 @@
|
||||
(when (and *target* (= (-> *target* next-state name) 'target-continue))
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
(the-as int (+ (-> *display* base-frame-counter) -10000))
|
||||
(+ (-> *display* base-frame-counter) -10000)
|
||||
)
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
(the-as int (+ (-> *display* base-frame-counter) -10000))
|
||||
(+ (-> *display* base-frame-counter) -10000)
|
||||
)
|
||||
)
|
||||
(update-mood-fog arg0 arg1)
|
||||
@@ -3412,7 +3374,7 @@
|
||||
float
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as uint (-> (the-as (pointer int64) s4-0) 1))
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3455,7 +3417,7 @@
|
||||
(else
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(-> *display* base-frame-counter)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3467,7 +3429,7 @@
|
||||
float
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as uint (-> (the-as (pointer int64) s4-0) 0))
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3501,7 +3463,7 @@
|
||||
(set! (-> *time-of-day-proc* 0 frame) 0)
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(-> *display* base-frame-counter)
|
||||
)
|
||||
(dotimes (v1-72 8)
|
||||
(set! (-> arg0 sky-times v1-72) 0.0)
|
||||
@@ -3701,13 +3663,7 @@
|
||||
(*
|
||||
0.125
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(*
|
||||
4000
|
||||
(the-as int (-> *display* integral-frame-counter))
|
||||
)
|
||||
)
|
||||
(the float (* 4000 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3721,10 +3677,7 @@
|
||||
(*
|
||||
0.25
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 1500 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
(the float (* 1500 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3812,4 +3765,4 @@
|
||||
)
|
||||
(update-mood-itimes arg0)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
@@ -17,7 +17,7 @@
|
||||
(transv-out vector :inline :offset-assert 48)
|
||||
(local-normal vector :inline :offset-assert 64)
|
||||
(surface-normal vector :inline :offset-assert 80)
|
||||
(time uint64 :offset-assert 96)
|
||||
(time int64 :offset-assert 96)
|
||||
(status uint64 :offset-assert 104)
|
||||
(pat pat-surface :offset-assert 112)
|
||||
(reaction-flag uint32 :offset-assert 116)
|
||||
|
||||
@@ -86,7 +86,7 @@
|
||||
((name basic :offset-assert 4)
|
||||
(length int16 :offset-assert 8) ;; in use elts of the data array
|
||||
(allocated-length int16 :offset-assert 10) ;; size of the data array
|
||||
(engine-time uint64 :offset-assert 16) ;; frame that we last executed
|
||||
(engine-time int64 :offset-assert 16) ;; frame that we last executed
|
||||
|
||||
;; terminating nodes for the next0/prev0 linked lists
|
||||
(alive-list connectable :inline :offset-assert 32)
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
;; amounts or timings
|
||||
;; The fact-info class stores data that is common to all fact-infos.
|
||||
(deftype fact-info (basic)
|
||||
((process process :offset-assert 4) ;; the process that this info is for
|
||||
((process process-drawable :offset-assert 4) ;; the process that this info is for
|
||||
(pickup-type pickup-type :offset-assert 8)
|
||||
(pickup-amount float :offset-assert 12) ;; eco increment on pickup
|
||||
(pickup-spawn-amount float :offset-assert 16)
|
||||
@@ -81,10 +81,10 @@
|
||||
:size-assert #x28
|
||||
:flag-assert #xc00000028
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
(TODO-RENAME-9 (_type_ symbol process-tree fact-info int) uint 9) ;; See nav-enemy::process-drawable-death-event-handler
|
||||
(reset! (_type_ symbol) none 10)
|
||||
(dummy-11 (_type_) float 11)
|
||||
(pickup-collectable! (_type_ pickup-type float handle) float 11)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
(eco-pill float :offset-assert 80)
|
||||
(eco-pill-max float :offset-assert 84)
|
||||
(health-pickup-time uint64 :offset-assert 88)
|
||||
(eco-source uint64 :offset-assert 96)
|
||||
(eco-source handle :offset-assert 96)
|
||||
(eco-source-time uint64 :offset-assert 104)
|
||||
(money-pickup-time uint64 :offset-assert 112)
|
||||
(buzzer-pickup-time uint64 :offset-assert 120)
|
||||
@@ -111,7 +111,7 @@
|
||||
:size-assert #x90
|
||||
:flag-assert #xc00000090
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -128,11 +128,13 @@
|
||||
:size-assert #x44
|
||||
:flag-assert #xc00000044
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process) (pkup-type pickup-type) (pkup-amount float))
|
||||
(declare-type process-drawable process)
|
||||
|
||||
(defmethod new fact-info ((allocation symbol) (type-to-make type) (proc process-drawable) (pkup-type pickup-type) (pkup-amount float))
|
||||
"Create information about a pickup. This should be called from a process which is a pickup. This will read settings from
|
||||
the entity of the process automatically. Will attempt to read pickup-type and amount from the entity, but if this
|
||||
fails will use the values in the arguments"
|
||||
@@ -190,11 +192,11 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod dummy-11 fact-info ((obj fact-info))
|
||||
(defmethod pickup-collectable! fact-info ((obj fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle))
|
||||
0.0
|
||||
)
|
||||
|
||||
(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (proc process) (kind pickup-type) (amount float))
|
||||
(defmethod new fact-info-enemy ((allocation symbol) (type-to-make type) (proc process-drawable) (kind pickup-type) (amount float))
|
||||
"Create information about an enemy. Possibly includes what the enemy will drop when it is killed?"
|
||||
;; base class ctor
|
||||
(let ((obj (the-as fact-info-enemy ((method-of-type fact-info new) allocation type-to-make proc kind amount))))
|
||||
@@ -212,10 +214,10 @@
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod new fact-info-target ((allocation symbol) (type-to-make type) (arg0 process) (arg1 pickup-type) (arg2 float))
|
||||
(defmethod new fact-info-target ((allocation symbol) (type-to-make type) (arg0 process-drawable) (arg1 pickup-type) (arg2 float))
|
||||
"Create information about target. Not sure why this has stuff like pickup-type."
|
||||
(let ((obj (the-as fact-info-target ((method-of-type fact-info new) allocation type-to-make arg0 arg1 arg2))))
|
||||
(set! (-> obj eco-source) (the-as uint #f))
|
||||
(set! (-> obj eco-source) (the-as handle #f))
|
||||
(reset! obj #f)
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -271,7 +271,7 @@
|
||||
(death-movie-tick int32 :offset-assert 264)
|
||||
(want-auto-save symbol :offset-assert 268)
|
||||
(auto-save-proc handle :offset-assert 272)
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-status mc-status-code :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
@@ -299,7 +299,7 @@
|
||||
(seen-text? (_type_ game-text-id) symbol 21)
|
||||
(mark-text-as-seen (_type_ game-text-id) none 22)
|
||||
(got-buzzer? (_type_ game-task int) symbol 23)
|
||||
(dummy-24 () none 24)
|
||||
(save-game! (_type_ game-save string) none 24)
|
||||
(load-game! (_type_ game-save) game-save 25)
|
||||
(clear-text-seen! (_type_ game-text-id) none 26)
|
||||
(get-death-count (_type_ symbol) int 27)
|
||||
|
||||
@@ -5,6 +5,18 @@
|
||||
;; name in dgo: game-info
|
||||
;; dgos: GAME, ENGINE
|
||||
|
||||
;; The game-info is the logic for pickups/lives/eco/tasks/collectables/check points/saved data
|
||||
;; The *game-info* object constains the "game state", like how many lives you have etc.
|
||||
|
||||
;; The "perm" data is saved to the memory card.
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
;; border plane
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; This border-plane seems to be unused. This is separate from load boundaries.
|
||||
|
||||
(defmethod debug-draw! border-plane ((obj border-plane))
|
||||
"Debug draw a border plane with a vector and text."
|
||||
(let* ((v1-0 (-> obj action))
|
||||
@@ -35,7 +47,7 @@
|
||||
|
||||
(defmethod task-complete? game-info ((obj game-info) (arg0 game-task))
|
||||
"Likely closed, or in the process of closing"
|
||||
(nonzero? (logand (-> obj task-perm-list data arg0 status) (entity-perm-status real-complete)))
|
||||
(logtest? (-> obj task-perm-list data arg0 status) (entity-perm-status real-complete))
|
||||
)
|
||||
|
||||
;; set up a static continue point that can be used as a temporary continue point.
|
||||
@@ -549,7 +561,379 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; todo method 11
|
||||
(declare-type vent process-drawable)
|
||||
(define-extern touch-tracker-init function)
|
||||
|
||||
(defmethod pickup-collectable! fact-info-target ((obj fact-info-target) (kind pickup-type) (amount float) (source-handle handle))
|
||||
"Pickup a thing!"
|
||||
(with-pp
|
||||
(case kind
|
||||
(((pickup-type eco-green))
|
||||
;; big green eco. This counts toward the health (up to 3), and if that's full, maxes out the little green ecos to 50.
|
||||
(cond
|
||||
((>= amount 0.0)
|
||||
;; got a positive or 0 amount.
|
||||
(when (< 0.0 amount)
|
||||
;; when we get a different source, OR we it's been more than 0.5 seconds since we last got eco
|
||||
;; from this source.
|
||||
(if (or (!= (handle->process source-handle) (handle->process (-> obj eco-source)))
|
||||
(>= (the-as int (- (-> *display* base-frame-counter) (-> obj eco-source-time))) 150)
|
||||
)
|
||||
|
||||
;; play the sound!
|
||||
(sound-play-by-name (static-sound-name "get-green-eco")
|
||||
(new-sound-id)
|
||||
1024
|
||||
0
|
||||
0
|
||||
(the-as uint 1)
|
||||
(the-as vector #t)
|
||||
)
|
||||
)
|
||||
|
||||
;; remember the source.
|
||||
(when (handle->process source-handle)
|
||||
(set! (-> obj eco-source) source-handle)
|
||||
(set! (-> obj eco-source-time) (-> *display* base-frame-counter))
|
||||
)
|
||||
)
|
||||
|
||||
;; if we are at max health (3), and collect additional an additional big green eco,
|
||||
;; then max out the little green ecos.
|
||||
(if (= (-> obj health) (-> obj health-max))
|
||||
(pickup-collectable!
|
||||
obj
|
||||
(pickup-type eco-pill)
|
||||
(-> *FACT-bank* eco-pill-max-default)
|
||||
(process->handle (-> obj process))
|
||||
)
|
||||
)
|
||||
|
||||
;; remember when
|
||||
(set! (-> obj health-pickup-time) (-> *display* base-frame-counter))
|
||||
;; increase the health!
|
||||
(set! (-> obj health) (seek (-> obj health) (-> obj health-max) amount))
|
||||
)
|
||||
(else
|
||||
;; negative health. Subtract.
|
||||
(set! (-> obj health) (seek (-> obj health) 0.0 (- amount)))
|
||||
|
||||
;; not sure why we do this. But this will set the eco pill collection time.
|
||||
(if (>= amount -10.0)
|
||||
(pickup-collectable! obj (pickup-type eco-pill) 0.0 source-handle)
|
||||
)
|
||||
|
||||
;; subtract lives.
|
||||
(if (= (-> obj health) 0.0)
|
||||
(adjust
|
||||
(-> (the-as target (-> obj process)) game)
|
||||
'life
|
||||
(- (-> *GAME-bank* life-single-inc))
|
||||
source-handle
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; some sort of hack for eco vents.
|
||||
(b! (and (logtest? (-> (the-as collide-shape (-> obj process root)) root-prim prim-core action) 512)
|
||||
(type-type? (-> (handle->process source-handle) type) vent)
|
||||
)
|
||||
cfg-80)
|
||||
(-> obj health)
|
||||
)
|
||||
|
||||
(((pickup-type eco-pill))
|
||||
;; collect small green eco
|
||||
(when (>= amount 0.0)
|
||||
;; update small eco count
|
||||
(set! (-> obj eco-pill-pickup-time) (-> *display* base-frame-counter))
|
||||
(set! (-> obj eco-pill) (seek (-> obj eco-pill) (-> obj eco-pill-max) amount))
|
||||
|
||||
;; increment big health if needed
|
||||
(when (and (>= (-> obj eco-pill) (-> *FACT-bank* eco-pill-max-default)) ;; have enough smalls
|
||||
(< (-> obj health) (-> obj health-max)) ;; and enough room for another health
|
||||
)
|
||||
;; decrease eco pills
|
||||
(set! (-> obj eco-pill)
|
||||
(- (-> obj eco-pill) (-> *FACT-bank* eco-pill-max-default))
|
||||
)
|
||||
;; get a big health.
|
||||
(pickup-collectable!
|
||||
obj
|
||||
(pickup-type eco-green)
|
||||
(-> *FACT-bank* health-small-inc)
|
||||
(process->handle (-> obj process))
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> obj eco-pill)
|
||||
)
|
||||
|
||||
(((pickup-type money))
|
||||
;; get money.
|
||||
(when (< 0.0 amount)
|
||||
;; play sound.
|
||||
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj money-pickup-time))) 15)
|
||||
(sound-play-by-name (static-sound-name "money-pickup")
|
||||
(new-sound-id)
|
||||
1024
|
||||
0
|
||||
0
|
||||
(the-as uint 1)
|
||||
(the-as vector #t)
|
||||
)
|
||||
)
|
||||
(set! (-> obj money-pickup-time) (-> *display* base-frame-counter))
|
||||
)
|
||||
(adjust (-> (the-as target (-> obj process)) game)
|
||||
'money
|
||||
amount
|
||||
source-handle
|
||||
)
|
||||
)
|
||||
(((pickup-type fuel-cell))
|
||||
;; the amount is actually the index of the task.
|
||||
(let ((s4-2 (the int amount)))
|
||||
(if (not (or (task-complete? (-> (the-as target (-> obj process)) game) (the-as game-task s4-2) )
|
||||
(>= (the-as uint 1) (the-as uint s4-2))
|
||||
)
|
||||
)
|
||||
(set! (-> obj fuel-cell-pickup-time) (-> *display* base-frame-counter))
|
||||
)
|
||||
)
|
||||
(adjust
|
||||
(-> (the-as target (-> obj process)) game)
|
||||
'fuel-cell
|
||||
amount
|
||||
source-handle
|
||||
)
|
||||
)
|
||||
(((pickup-type buzzer))
|
||||
;; scout fly.
|
||||
(let ((buzz-count (adjust
|
||||
(-> (the-as target (-> obj process)) game)
|
||||
'buzzer
|
||||
amount
|
||||
source-handle
|
||||
)
|
||||
)
|
||||
)
|
||||
(if (!= buzz-count (-> obj buzzer))
|
||||
(set! (-> obj buzzer-pickup-time) (-> *display* base-frame-counter))
|
||||
)
|
||||
(set! (-> obj buzzer) buzz-count)
|
||||
)
|
||||
(-> obj buzzer)
|
||||
)
|
||||
(((pickup-type eco-red) (pickup-type eco-blue) (pickup-type eco-yellow))
|
||||
;; the green vent jumps here.
|
||||
(label cfg-80)
|
||||
|
||||
;; if the amount is zero, we just want to know how much eco there is.
|
||||
(if (= amount 0.0)
|
||||
(return (if (= (-> obj eco-type) kind)
|
||||
(-> obj eco-level)
|
||||
0.0 ;; we don't have this kind of eco.
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; new type of eco. Reset and use the new type.
|
||||
(when (!= (-> obj eco-type) kind)
|
||||
;; as far as I can tell, the eco-level isn't really used other than just 1 or 0.
|
||||
(set! (-> obj eco-level) 0.0)
|
||||
(set! (-> obj eco-timeout) (the-as seconds 0))
|
||||
0
|
||||
)
|
||||
(set! (-> obj eco-type) (the-as int kind))
|
||||
|
||||
|
||||
(let ((eco-lev (-> obj eco-level)))
|
||||
(set! (-> obj eco-level) 1.0) ;; just set to 1.
|
||||
|
||||
;; this check now doesn't make much sense...
|
||||
(when (and (= eco-lev 0.0) (< 0.0 (-> obj eco-level)))
|
||||
;; didn't have eco and now we do, remember when
|
||||
(set! (-> obj eco-pickup-time) (-> *display* game-frame-counter))
|
||||
|
||||
;; send a reset-collide message. Not sure why we do this.
|
||||
(let ((a1-24 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-24 from) pp)
|
||||
(set! (-> a1-24 num-params) 0)
|
||||
(set! (-> a1-24 message) 'reset-collide)
|
||||
(send-event-function (-> obj process) a1-24)
|
||||
)
|
||||
)
|
||||
|
||||
;; this logic prevents eco from respawning before you are out.
|
||||
;; the time until respawn is min(full_eco_time, old_time + single_timeout)
|
||||
(set! (-> obj eco-timeout)
|
||||
(the-as seconds
|
||||
(min (the-as int (+ (-> obj eco-timeout) (* (the-as int (-> *FACT-bank* eco-single-timeout)) (the int amount))))
|
||||
(the-as int (+ (-> *FACT-bank* eco-full-timeout) (- (-> *display* game-frame-counter) (-> obj eco-pickup-time))))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; if you max out the eco, this should trigger
|
||||
(if (>= (the-as int (- (-> obj eco-timeout) (the-as uint (- (-> *display* game-frame-counter) (-> obj eco-pickup-time)))))
|
||||
(the-as int (-> *FACT-bank* eco-full-timeout))
|
||||
)
|
||||
(set! (-> obj eco-level) 2.0)
|
||||
)
|
||||
|
||||
|
||||
;; sound and controller vibration.
|
||||
(when (not (and (= (handle->process source-handle) (handle->process (-> obj eco-source)))
|
||||
(< (the-as int (- (-> *display* base-frame-counter) (-> obj eco-source-time))) 150)
|
||||
)
|
||||
)
|
||||
(cpad-set-buzz! (-> *cpad-list* cpads 0) 1 127 60)
|
||||
(cpad-set-buzz! (-> *cpad-list* cpads 0) 0 17 60)
|
||||
(case kind
|
||||
(((pickup-type eco-blue))
|
||||
(sound-play-by-name (static-sound-name "get-blue-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
|
||||
)
|
||||
(((pickup-type eco-green))
|
||||
(sound-play-by-name (static-sound-name "get-green-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
|
||||
)
|
||||
(((pickup-type eco-yellow))
|
||||
(sound-play-by-name (static-sound-name "get-yellow-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
|
||||
)
|
||||
(((pickup-type eco-red))
|
||||
(sound-play-by-name (static-sound-name "get-red-eco") (new-sound-id) 1024 0 0 (the-as uint 1) (the-as vector #t))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(set! (-> obj eco-source) source-handle)
|
||||
(set! (-> obj eco-source-time) (-> *display* base-frame-counter))
|
||||
|
||||
;; special case for blue eco magnet effect
|
||||
(when (= kind (pickup-type eco-blue))
|
||||
(when (= eco-lev 0.0) ;; old level was 0, we just got our first piece of eco
|
||||
(let ((s5-1 (-> obj process)))
|
||||
(let* ((s3-5 (get-process *default-dead-pool* touch-tracker #x4000))
|
||||
(s4-3 (when s3-5
|
||||
;; interestingly, this uses the activate method of touch-tracker, not process.
|
||||
(let ((t9-28 (method-of-type touch-tracker activate)))
|
||||
(t9-28 (the-as touch-tracker s3-5) s5-1 'touch-tracker (the-as pointer #x70004000))
|
||||
)
|
||||
(run-next-time-in-process s3-5 touch-tracker-init (-> s5-1 root trans) (-> *FACT-bank* suck-bounce-dist) 300)
|
||||
(-> s3-5 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; send the touch tracker the target
|
||||
(let ((a1-44 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-44 from) pp)
|
||||
(set! (-> a1-44 num-params) 1)
|
||||
(set! (-> a1-44 message) 'target)
|
||||
(set! (-> a1-44 param 0) (the-as uint s5-1))
|
||||
(send-event-function (ppointer->process s4-3) a1-44)
|
||||
)
|
||||
;; tell it we have blue eco.
|
||||
(let ((a1-45 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-45 from) pp)
|
||||
(set! (-> a1-45 num-params) 1)
|
||||
(set! (-> a1-45 message) 'event)
|
||||
(set! (-> a1-45 param 0) (the-as uint 'eco-blue))
|
||||
(send-event-function (ppointer->process s4-3) a1-45)
|
||||
)
|
||||
;; give it a function to call to see if it's time to exit
|
||||
(let ((a1-46 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-46 from) pp)
|
||||
(set! (-> a1-46 num-params) 1)
|
||||
(set! (-> a1-46 message) 'exit)
|
||||
(set! (-> a1-46 param 0)
|
||||
(the-as uint (lambda ()
|
||||
;; check to see if target has powerup 3.
|
||||
(with-pp
|
||||
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-0 from) pp)
|
||||
(set! (-> a1-0 num-params) 2)
|
||||
(set! (-> a1-0 message) 'query)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'powerup))
|
||||
(set! (-> a1-0 param 1) (the-as uint 3))
|
||||
(send-event-function *target* a1-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event-function (ppointer->process s4-3) a1-46)
|
||||
)
|
||||
;; set up some collision thing.
|
||||
(let ((a1-47 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-47 from) pp)
|
||||
(set! (-> a1-47 num-params) 1)
|
||||
(set! (-> a1-47 message) 'eval)
|
||||
(set! (-> a1-47 param 0)
|
||||
(the-as uint
|
||||
(lambda :behavior process-drawable ()
|
||||
(set! (-> (the-as collide-shape (-> self root)) root-prim collide-with)
|
||||
(the-as uint #x800e)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
)
|
||||
(send-event-function (ppointer->process s4-3) a1-47)
|
||||
)
|
||||
)
|
||||
|
||||
;; create a process that just keeps sending 'effect 'eco-blue
|
||||
(let ((s4-4 (get-process *4k-dead-pool* process #x4000)))
|
||||
(when s4-4
|
||||
(let ((t9-35 (method-of-type process activate)))
|
||||
(t9-35 s4-4 s5-1 'process (the-as pointer #x70004000))
|
||||
)
|
||||
((the-as
|
||||
(function cpu-thread function process-drawable none)
|
||||
set-to-run
|
||||
)
|
||||
(-> s4-4 main-thread)
|
||||
(lambda ((arg0 process-drawable))
|
||||
(with-pp
|
||||
(let ((start-time (-> *display* base-frame-counter)))
|
||||
(until (>= (the-as int (- (-> *display* base-frame-counter) start-time)) 180)
|
||||
(let ((a1-0 (new 'stack-no-clear 'event-message-block)))
|
||||
(set! (-> a1-0 from) pp)
|
||||
(set! (-> a1-0 num-params) 1)
|
||||
(set! (-> a1-0 message) 'effect)
|
||||
(set! (-> a1-0 param 0) (the-as uint 'eco-blue))
|
||||
(send-event-function arg0 a1-0)
|
||||
)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
s5-1
|
||||
)
|
||||
(-> s4-4 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(-> obj eco-level)
|
||||
)
|
||||
(else
|
||||
((method-of-type fact-info pickup-collectable!)
|
||||
obj
|
||||
kind
|
||||
amount
|
||||
source-handle
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod lookup-entity-perm-by-aid game-info ((obj game-info) (aid actor-id))
|
||||
(let ((v1-0 (-> obj perm-list)))
|
||||
@@ -776,7 +1160,7 @@
|
||||
)
|
||||
(set! (-> gp-0 want-auto-save) #f)
|
||||
(set! (-> gp-0 auto-save-proc) (the-as handle #f))
|
||||
(set! (-> gp-0 auto-save-status) (the-as uint 1))
|
||||
(set! (-> gp-0 auto-save-status) (mc-status-code ok))
|
||||
(set! (-> gp-0 auto-save-card) 0)
|
||||
(set! (-> gp-0 auto-save-which) -1)
|
||||
(set! (-> gp-0 pov-camera-handle) (the-as handle #f))
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
;; Letterbox and blackout
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defun set-letterbox-frames ((arg0 uint))
|
||||
(defun set-letterbox-frames ((arg0 int))
|
||||
"Set the letterbox frame counter for arg0 frames in the future"
|
||||
(let ((v0-0 (+ (-> *display* base-frame-counter) arg0)))
|
||||
(set! (-> *game-info* letterbox-time) v0-0)
|
||||
@@ -1275,7 +1275,7 @@
|
||||
)
|
||||
(set! *run* #t)
|
||||
(let ((new-dproc (make-function-process *4k-dead-pool* *display-pool* process display-loop :name 'display)))
|
||||
(set! *dproc* (the process (as-process new-dproc)))
|
||||
(set! *dproc* (the process (ppointer->process new-dproc)))
|
||||
)
|
||||
(cond
|
||||
((or (level-get-with-status *level* 'loaded)
|
||||
|
||||
@@ -83,11 +83,11 @@
|
||||
(format #t "~Tscreeny: ~D~%" (-> obj screeny))
|
||||
(format #t "~Tvibration: ~A~%" (-> obj vibration))
|
||||
(format #t "~Tplay-hints: ~A~%" (-> obj play-hints))
|
||||
(format #t "~Tmovie: ~A~%" (as-process (-> obj movie)))
|
||||
(format #t "~Ttalking: ~A~%" (as-process (-> obj talking)))
|
||||
(format #t "~Tspooling: ~A~%" (as-process (-> obj spooling)))
|
||||
(format #t "~Thint: ~A~%" (as-process (-> obj hint)))
|
||||
(format #t "~Tambient: ~A~%" (as-process (-> obj ambient)))
|
||||
(format #t "~Tmovie: ~A~%" (ppointer->process (-> obj movie)))
|
||||
(format #t "~Ttalking: ~A~%" (ppointer->process (-> obj talking)))
|
||||
(format #t "~Tspooling: ~A~%" (ppointer->process (-> obj spooling)))
|
||||
(format #t "~Thint: ~A~%" (ppointer->process (-> obj hint)))
|
||||
(format #t "~Tambient: ~A~%" (ppointer->process (-> obj ambient)))
|
||||
(format #t "~Tvideo-mode: ~A~%" (-> obj video-mode))
|
||||
(format #t "~Taspect-ratio: ~A~%" (-> obj aspect-ratio))
|
||||
(format #t "~Tsound-flava: ~D~%" (-> obj sound-flava))
|
||||
|
||||
@@ -41,14 +41,7 @@
|
||||
)
|
||||
(('sfx-volume)
|
||||
(when (or (zero? (logand (-> *kernel-context* prevent-from-run) (process-mask progress)))
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(= (get-process conn) (ppointer->process *progress-process*))
|
||||
)
|
||||
(let ((v1-20 (the-as symbol (-> conn param1))))
|
||||
(if (= v1-20 'rel)
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
(num-success-before-killing int8 :offset-assert 13)
|
||||
(num-attempts int8 :offset-assert 14)
|
||||
(num-success int8 :offset-assert 15)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(last-time-called uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(last-time-called int64 :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
|
||||
@@ -476,8 +476,8 @@
|
||||
(let ((v1-2 (length (-> *game-info* hint-control))))
|
||||
(dotimes (a0-1 v1-2)
|
||||
(let ((a1-2 (-> *game-info* hint-control a0-1)))
|
||||
(set! (-> a1-2 start-time) (the-as uint 0))
|
||||
(set! (-> a1-2 last-time-called) (the-as uint 0))
|
||||
(set! (-> a1-2 start-time) 0)
|
||||
(set! (-> a1-2 last-time-called) 0)
|
||||
(set! (-> a1-2 num-attempts) 0)
|
||||
(set! (-> a1-2 num-success) 0)
|
||||
)
|
||||
|
||||
@@ -141,25 +141,25 @@
|
||||
(frames virtual-frame 6 :inline :offset-assert 568)
|
||||
(bg-clear-color rgba 4 :offset-assert 760)
|
||||
;; counters (why are there so many???)
|
||||
(real-frame-counter uint64 :offset-assert 776)
|
||||
(base-frame-counter uint64 :offset-assert 784)
|
||||
(game-frame-counter uint64 :offset-assert 792)
|
||||
(integral-frame-counter uint64 :offset-assert 800)
|
||||
(real-integral-frame-counter uint64 :offset-assert 808)
|
||||
(actual-frame-counter uint64 :offset-assert 816)
|
||||
(real-actual-frame-counter uint64 :offset-assert 824)
|
||||
(part-frame-counter uint64 :offset-assert 832)
|
||||
(real-frame-counter int64 :offset-assert 776)
|
||||
(base-frame-counter int64 :offset-assert 784)
|
||||
(game-frame-counter int64 :offset-assert 792)
|
||||
(integral-frame-counter int64 :offset-assert 800)
|
||||
(real-integral-frame-counter int64 :offset-assert 808)
|
||||
(actual-frame-counter int64 :offset-assert 816)
|
||||
(real-actual-frame-counter int64 :offset-assert 824)
|
||||
(part-frame-counter int64 :offset-assert 832)
|
||||
|
||||
;; the "old" counters are the values from the previous tick.
|
||||
;; the counters above may jump during a load.
|
||||
(old-real-frame-counter uint64 :offset-assert 840)
|
||||
(old-base-frame-counter uint64 :offset-assert 848)
|
||||
(old-game-frame-counter uint64 :offset-assert 856)
|
||||
(old-integral-frame-counter uint64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter uint64 :offset-assert 872)
|
||||
(old-actual-frame-counter uint64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter uint64 :offset-assert 888)
|
||||
(old-part-frame-counter uint64 :offset-assert 896)
|
||||
(old-real-frame-counter int64 :offset-assert 840)
|
||||
(old-base-frame-counter int64 :offset-assert 848)
|
||||
(old-game-frame-counter int64 :offset-assert 856)
|
||||
(old-integral-frame-counter int64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter int64 :offset-assert 872)
|
||||
(old-actual-frame-counter int64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter int64 :offset-assert 888)
|
||||
(old-part-frame-counter int64 :offset-assert 896)
|
||||
|
||||
;; timing stats for how fast the engine is currently running.
|
||||
(time-ratio float :offset-assert 904) ;; engine speed, 1.0 = full speed
|
||||
@@ -242,3 +242,6 @@
|
||||
(defmacro integral-current-time ()
|
||||
`(-> *display* integral-frame-counter)
|
||||
)
|
||||
|
||||
(define-extern get-current-time (function int))
|
||||
(define-extern get-integral-current-time (function int))
|
||||
@@ -230,12 +230,12 @@
|
||||
(set-draw-env (-> disp draw1) psm w h ztest zpsm 320)
|
||||
|
||||
;; initialize a bunch of counters
|
||||
(set! (-> disp base-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp game-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp real-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp part-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp integral-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp real-integral-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp base-frame-counter) #x493e0)
|
||||
(set! (-> disp game-frame-counter) #x493e0)
|
||||
(set! (-> disp real-frame-counter) #x493e0)
|
||||
(set! (-> disp part-frame-counter) #x493e0)
|
||||
(set! (-> disp integral-frame-counter) #x493e0)
|
||||
(set! (-> disp real-integral-frame-counter) #x493e0)
|
||||
|
||||
;; and the "old" version, which I think was their value on the last... frame?
|
||||
(set! (-> disp old-base-frame-counter) (+ (-> disp base-frame-counter) -1))
|
||||
@@ -403,7 +403,7 @@
|
||||
(>= end-time (the-as int (-> worst-time-cache (/ bar-pos 10))))
|
||||
)
|
||||
(set! (-> worst-time-cache (/ bar-pos 10)) (the-as uint end-time))
|
||||
(set! (-> obj cache-time) (-> *display* real-frame-counter))
|
||||
(set! (-> obj cache-time) (the uint (-> *display* real-frame-counter)))
|
||||
)
|
||||
|
||||
;; draw the time, either in ticks or percent.
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
)
|
||||
|
||||
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
|
||||
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (-> arg0 frame-save)))))
|
||||
(let ((f0-1 (the float (- (-> *display* integral-frame-counter) (the int (-> arg0 frame-save))))))
|
||||
(when (!= f0-1 0.0)
|
||||
(dotimes (v1-4 (-> arg0 count))
|
||||
(let ((a1-4 (-> arg0 wave v1-4)))
|
||||
@@ -60,7 +60,7 @@
|
||||
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 frame-save) (-> *display* integral-frame-counter))
|
||||
(set! (-> arg0 frame-save) (the uint (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
(none)
|
||||
|
||||
@@ -405,3 +405,4 @@
|
||||
)
|
||||
|
||||
(define-extern *level-load-list* pair)
|
||||
(define-extern lookup-level-info (function symbol level-load-info))
|
||||
@@ -265,7 +265,7 @@ struct DgoHeader {
|
||||
;; DGO LOAD and LINK
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define *dgo-time* (the-as uint 0))
|
||||
(define *dgo-time* 0)
|
||||
|
||||
(defun dgo-load-begin ((name string) (buffer1 pointer) (buffer2 pointer) (buffer-top pointer))
|
||||
"Send a DGO load RPC!"
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
(rotv vector :inline :offset-assert 80)
|
||||
(scalev vector :inline :offset-assert 96)
|
||||
(dir-targ quaternion :inline :offset-assert 112)
|
||||
(angle-change-time uint64 :offset-assert 128)
|
||||
(angle-change-time int64 :offset-assert 128)
|
||||
(old-y-angle-diff float :offset-assert 136)
|
||||
)
|
||||
:method-count-assert 28
|
||||
|
||||
@@ -51,15 +51,15 @@
|
||||
|
||||
(defmethod seek-toward-heading-vec! trsqv ((obj trsqv) (dir vector) (vel float) (frame-count int))
|
||||
"Adjust the orientation to point along dir, only changing our yaw.
|
||||
The vel is a maximum velocity limit.
|
||||
The frame count is the time constant (first order).
|
||||
There's some logic to avoid rapidly changing directions"
|
||||
The vel is a maximum velocity limit.
|
||||
The frame count is the time constant (first order).
|
||||
There's some logic to avoid rapidly changing directions"
|
||||
(let* ((yaw-error (deg-diff (quaternion-y-angle (-> obj quat)) (vector-y-angle dir)))
|
||||
;; limit both on a max velocity, and a proportional to error term.
|
||||
(yaw-limit (fmin (* vel (-> *display* seconds-per-frame))
|
||||
(/ (* 5.0 (fabs yaw-error)) (the float frame-count))
|
||||
)
|
||||
)
|
||||
)
|
||||
;; saturate the yaw error
|
||||
(saturated-yaw (fmax (fmin yaw-error yaw-limit) (- yaw-limit)))
|
||||
)
|
||||
@@ -71,10 +71,9 @@
|
||||
((or (= old-diff 0.0)
|
||||
(and (< 0.0 saturated-yaw) (< 0.0 old-diff))
|
||||
(or (and (< saturated-yaw 0.0) (< old-diff 0.0))
|
||||
(>= (the-as int (- (-> *display* base-frame-counter)
|
||||
(-> obj angle-change-time)
|
||||
)
|
||||
)
|
||||
(>= (- (-> *display* base-frame-counter)
|
||||
(-> obj angle-change-time)
|
||||
)
|
||||
60
|
||||
)
|
||||
)
|
||||
@@ -83,9 +82,9 @@
|
||||
saturated-yaw
|
||||
)
|
||||
(else
|
||||
;; not sure why this isn't 0.
|
||||
(* 0.000000001 saturated-yaw)
|
||||
)
|
||||
;; not sure why this isn't 0.
|
||||
(* 0.000000001 saturated-yaw)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
"Print mc info to the screen."
|
||||
(let ((info (new 'stack-no-clear 'mc-slot-info)))
|
||||
(dotimes (slot-idx 2)
|
||||
(mc-get-slot-info slot-idx)
|
||||
(mc-get-slot-info slot-idx info)
|
||||
(cond
|
||||
((zero? (-> info known))
|
||||
(format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" slot-idx)
|
||||
|
||||
+11
-15
@@ -10,6 +10,10 @@
|
||||
;; Use the service-cpads functions once per frame to update the data and vibration control
|
||||
;; The cpad-set-buzz! function can be used for vibration.
|
||||
|
||||
;; in display, but we haven't gotten to display-h.gc yet.
|
||||
(define-extern get-current-time (function int))
|
||||
(define-extern get-integral-current-time (function int))
|
||||
|
||||
(defenum pad-buttons
|
||||
:bitfield #t
|
||||
:type uint32
|
||||
@@ -39,10 +43,6 @@
|
||||
(namco-gun 6)
|
||||
)
|
||||
|
||||
;; these forward declarations should probably go somewhere else...
|
||||
(define-extern get-current-time (function uint))
|
||||
(define-extern get-integral-current-time (function uint))
|
||||
|
||||
;; this gets set to #f later on.
|
||||
(define *cheat-mode* #t)
|
||||
|
||||
@@ -86,10 +86,10 @@
|
||||
(align uint8 6 :offset-assert 88) ;; hardware control of buzzing.
|
||||
(direct uint8 6 :offset-assert 94) ;; hardware control of buzzing.
|
||||
(buzz-val uint8 2 :offset-assert 100) ;; intensity for buzzing
|
||||
(buzz-time uint64 2 :offset-assert 104) ;; when to stop buzzing
|
||||
(buzz-time int64 2 :offset-assert 104) ;; when to stop buzzing
|
||||
(buzz basic :offset-assert 120) ;; is vibration enabled?
|
||||
(buzz-act int32 :offset-assert 124)
|
||||
(change-time uint64 :offset-assert 128)
|
||||
(change-time int64 :offset-assert 128)
|
||||
)
|
||||
(:methods
|
||||
(new (symbol type int) _type_ 0)
|
||||
@@ -132,7 +132,7 @@
|
||||
;; probably a bug here, this should use v1-17 as the index.
|
||||
(dotimes (v1-17 2)
|
||||
(set! (-> pad buzz-val 0) (the-as uint 0))
|
||||
(set! (-> pad buzz-time 0) (the-as uint 0))
|
||||
(set! (-> pad buzz-time 0) 0)
|
||||
)
|
||||
pad
|
||||
)
|
||||
@@ -211,16 +211,14 @@
|
||||
;; we are already buzzing at this intensity.
|
||||
;; buzz for max (old_buzz, new_buzz) duration
|
||||
(set! (-> pad buzz-time buzz-idx)
|
||||
(max (the-as int (-> pad buzz-time buzz-idx))
|
||||
(the-as int (+ (get-current-time) (the-as uint duration)))
|
||||
)
|
||||
(max (-> pad buzz-time buzz-idx) (+ (get-current-time) duration))
|
||||
)
|
||||
)
|
||||
((< (-> pad buzz-val buzz-idx) (the-as uint buzz-amount))
|
||||
;; buzz harder than the older value, overwrite the old buzz.
|
||||
(set! (-> pad buzz-val buzz-idx) buzz-amount)
|
||||
(set! (-> pad buzz-time buzz-idx)
|
||||
(+ (get-current-time) (the-as uint duration))
|
||||
(+ (get-current-time) duration)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -247,9 +245,7 @@
|
||||
(cond
|
||||
;; check if okay to buzz:
|
||||
((and (-> pad buzz)
|
||||
(< (the-as int (get-current-time))
|
||||
(the-as int (-> pad buzz-time buzz-idx))
|
||||
)
|
||||
(< (get-current-time) (-> pad buzz-time buzz-idx))
|
||||
(= *master-mode* 'game)
|
||||
)
|
||||
(let ((v1-10 buzz-idx))
|
||||
@@ -259,7 +255,7 @@
|
||||
;; an analog control
|
||||
(set! (-> pad direct buzz-idx)
|
||||
(logand (ash (-> pad buzz-val buzz-idx)
|
||||
(- (the-as int (logand (get-integral-current-time) 7)))
|
||||
(- (logand (get-integral-current-time) 7))
|
||||
)
|
||||
1
|
||||
)
|
||||
|
||||
@@ -381,9 +381,9 @@
|
||||
(playing-id sound-id :offset-assert 8)
|
||||
(trans vector :inline :offset-assert 16)
|
||||
(name sound-name :offset-assert 32)
|
||||
(play-time uint64 :offset-assert 48)
|
||||
(time-base uint64 :offset-assert 56)
|
||||
(time-random uint64 :offset-assert 64)
|
||||
(play-time int64 :offset-assert 48)
|
||||
(time-base int64 :offset-assert 56)
|
||||
(time-random int64 :offset-assert 64)
|
||||
(volume int32 :offset-assert 72)
|
||||
(pitch int32 :offset-assert 76)
|
||||
(falloff-near int32 :offset-assert 80)
|
||||
|
||||
@@ -563,11 +563,11 @@
|
||||
)
|
||||
(cond
|
||||
(sound-times
|
||||
(set! (-> obj time-base) (the-as uint (the int (* 300.0 (-> sound-times 0)))))
|
||||
(set! (-> obj time-random) (the-as uint (the int (* 300.0 (-> sound-times 1)))))
|
||||
(set! (-> obj time-base) (the int (* 300.0 (-> sound-times 0))))
|
||||
(set! (-> obj time-random) (the int (* 300.0 (-> sound-times 1))))
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-base) (the-as uint -1))
|
||||
(set! (-> obj time-base) -1)
|
||||
)
|
||||
)
|
||||
(set! (-> obj trans quad) (-> sound-trans quad))
|
||||
@@ -592,14 +592,13 @@
|
||||
)
|
||||
(cond
|
||||
((-> obj spec)
|
||||
(when (or (< (the-as int (-> obj time-base)) 0)
|
||||
(>= (the-as int (-> *display* base-frame-counter))
|
||||
(the-as int (-> obj play-time)))
|
||||
(when (or (< (-> obj time-base) 0)
|
||||
(>= (-> *display* base-frame-counter) (-> obj play-time))
|
||||
)
|
||||
(when (>= (the-as int (-> obj time-base)) 0)
|
||||
(when (>= (-> obj time-base) 0)
|
||||
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
|
||||
(-> obj time-base)
|
||||
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
|
||||
(rand-vu-int-count (-> obj time-random))
|
||||
))
|
||||
(set! (-> obj playing-id) (new-sound-id))
|
||||
)
|
||||
@@ -620,7 +619,7 @@
|
||||
(vector-vector-distance (ear-trans) (-> obj trans))))
|
||||
(return 0)
|
||||
)
|
||||
(when (and *debug-effect-control* (>= (the-as int (-> obj time-base)) 0))
|
||||
(when (and *debug-effect-control* (>= (-> obj time-base) 0))
|
||||
(with-pp
|
||||
(format #t "(~5D) effect sound ~A ~G "
|
||||
(-> *display* base-frame-counter)
|
||||
@@ -641,7 +640,7 @@
|
||||
)
|
||||
(else
|
||||
(cond
|
||||
((< (the-as int (-> obj time-base)) 0)
|
||||
((< (-> obj time-base) 0)
|
||||
(set! (-> obj playing-id) (sound-play-by-name
|
||||
(-> obj name)
|
||||
(-> obj playing-id)
|
||||
@@ -652,8 +651,7 @@
|
||||
(-> obj trans)))
|
||||
)
|
||||
(else
|
||||
(when (>= (the-as int (-> *display* base-frame-counter))
|
||||
(the-as int (-> obj play-time)))
|
||||
(when (>= (-> *display* base-frame-counter) (-> obj play-time))
|
||||
(set! (-> obj playing-id) (sound-play-by-name
|
||||
(-> obj name)
|
||||
(new-sound-id)
|
||||
@@ -664,7 +662,7 @@
|
||||
(-> obj trans)))
|
||||
(set! (-> obj play-time) (+ (-> *display* base-frame-counter)
|
||||
(-> obj time-base)
|
||||
(the-as uint (rand-vu-int-count (the-as int (-> obj time-random))))
|
||||
(rand-vu-int-count (-> obj time-random))
|
||||
))
|
||||
)
|
||||
)
|
||||
|
||||
@@ -78,14 +78,14 @@
|
||||
(linger-duration uint16 :offset-assert 8)
|
||||
(flags uint16 :offset-assert 10)
|
||||
(name basic :offset-assert 12)
|
||||
(launcher uint32 :offset-assert 16)
|
||||
(launcher sparticle-group-item :offset-assert 16)
|
||||
(bounds sphere :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x30
|
||||
:flag-assert #xa00000030
|
||||
(:methods
|
||||
(dummy-9 (_type_ process) _type_ 9)
|
||||
(create-launch-control (_type_ process) sparticle-launch-control 9)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -106,8 +106,8 @@
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-11 (_type_ vector) none 11)
|
||||
(deactivate (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
(trans vector :inline :offset-assert 64)
|
||||
(quat quaternion :inline :offset-assert 80)
|
||||
(scale vector :inline :offset-assert 96)
|
||||
(notice-time uint64 :offset-assert 112)
|
||||
(notice-time int64 :offset-assert 112)
|
||||
(flex-blend float :offset-assert 120)
|
||||
(blend float :offset-assert 124)
|
||||
(max-dist meters :offset-assert 128)
|
||||
@@ -225,15 +225,15 @@
|
||||
|
||||
(defmethod look-at-enemy! joint-mod ((obj joint-mod) (target-trans vector) (option symbol) (proc process))
|
||||
"Set up animation for Jak looking at an enemy. If option is 'attacking, remember when this happened.
|
||||
Will only override an existing look-at if this one is closer, or option is 'force.
|
||||
"
|
||||
Will only override an existing look-at if this one is closer, or option is 'force.
|
||||
"
|
||||
(when (= option 'attacking)
|
||||
;; make sure we got a process-drawable
|
||||
(let* ((s3-0 proc)
|
||||
(proc-drawable
|
||||
(if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable))
|
||||
(the-as process-drawable s3-0)
|
||||
)
|
||||
(if (and (nonzero? s3-0) (type-type? (-> s3-0 type) process-drawable))
|
||||
(the-as process-drawable s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when proc-drawable
|
||||
@@ -243,7 +243,7 @@
|
||||
(the-as fact-info-enemy s0-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
;; check that we have enemy facts, and that we are within the notice distance
|
||||
(when (and enemy-facts (< (vector-vector-distance (-> obj process root trans) (-> proc-drawable root trans))
|
||||
@@ -253,16 +253,7 @@
|
||||
;; success! we consider this a noticed and remember when
|
||||
(set! (-> obj notice-time) (-> *display* base-frame-counter))
|
||||
;; and update the look at data
|
||||
(let ((v1-12 (if proc
|
||||
(-> proc ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> last-try-to-look-at-data who)
|
||||
(new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid))
|
||||
)
|
||||
)
|
||||
(set! (-> last-try-to-look-at-data who) (process->handle proc))
|
||||
;; not sure what these are yet.
|
||||
(if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
|
||||
(set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
|
||||
@@ -275,21 +266,21 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
;; in all cases,
|
||||
(let ((dist (vector-vector-distance (-> obj process root trans) target-trans)))
|
||||
(when (and
|
||||
;; done with previous
|
||||
(or (= (-> obj blend) 0.0)
|
||||
;; closer than previous.
|
||||
(or (< dist (vector-vector-distance (-> obj process root trans) (-> obj target)))
|
||||
;; force
|
||||
(= option 'force)
|
||||
)
|
||||
)
|
||||
;; and in range
|
||||
(< dist (-> obj max-dist))
|
||||
)
|
||||
;; done with previous
|
||||
(or (= (-> obj blend) 0.0)
|
||||
;; closer than previous.
|
||||
(or (< dist (vector-vector-distance (-> obj process root trans) (-> obj target)))
|
||||
;; force
|
||||
(= option 'force)
|
||||
)
|
||||
)
|
||||
;; and in range
|
||||
(< dist (-> obj max-dist))
|
||||
)
|
||||
;; set mode, if we aren't in one
|
||||
(if (= (-> obj mode) (joint-mod-handler-mode reset))
|
||||
(set-mode! obj (joint-mod-handler-mode look-at))
|
||||
|
||||
@@ -183,4 +183,5 @@
|
||||
(define-extern activate-orb-all (function int int)) ;; maybe in hud?
|
||||
(define-extern progress-allowed? (function symbol))
|
||||
(define-extern pause-allowed? (function symbol))
|
||||
(define-extern deactivate-progress (function none))
|
||||
(define-extern deactivate-progress (function none))
|
||||
(define-extern calculate-completion (function symbol float))
|
||||
@@ -35,6 +35,9 @@
|
||||
|
||||
(hidden-power-cell #x12f) ;; why is this here??
|
||||
|
||||
(saving-data #x136)
|
||||
(do-not-remove-mem-card #x138)
|
||||
|
||||
(continue-without-saving #x13f)
|
||||
(back #x13e)
|
||||
(load-game #x14b)
|
||||
@@ -45,7 +48,7 @@
|
||||
(exit-demo #x15f)
|
||||
(press-start #x16e)
|
||||
(quit-game #x16f)
|
||||
|
||||
|
||||
(village1-mayor-money #x200)
|
||||
(vollage1-uncle-money #x201)
|
||||
(village1-yakow-herd #x202)
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
;; - the amplitude is additionally linearly scaled to go to zero over the duration.
|
||||
|
||||
(deftype smush-control (structure)
|
||||
((start-time uint64 :offset-assert 0)
|
||||
(period float :offset-assert 8)
|
||||
(duration float :offset-assert 12)
|
||||
(amp float :offset-assert 16)
|
||||
(damp-amp float :offset-assert 20)
|
||||
(damp-period float :offset-assert 24) ;; set a negative value here to flag as die on next update
|
||||
(ticks float :offset-assert 28)
|
||||
((start-time int64 :offset-assert 0)
|
||||
(period float :offset-assert 8)
|
||||
(duration float :offset-assert 12)
|
||||
(amp float :offset-assert 16)
|
||||
(damp-amp float :offset-assert 20)
|
||||
(damp-period float :offset-assert 24) ;; set a negative value here to flag as die on next update
|
||||
(ticks float :offset-assert 28)
|
||||
)
|
||||
:method-count-assert 15
|
||||
:size-assert #x20
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
(max-time int32 :offset-assert 4)
|
||||
(max-val float :offset-assert 8)
|
||||
(timer int32 :offset-assert 12)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(value float :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 11
|
||||
@@ -117,7 +117,7 @@
|
||||
(xz-max float :offset-assert 8)
|
||||
(y-max float :offset-assert 12)
|
||||
(timer int32 :offset-assert 16)
|
||||
(start-time uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 24)
|
||||
(value vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 13
|
||||
|
||||
@@ -233,7 +233,7 @@
|
||||
(period-float (the float period))
|
||||
;; now + offset
|
||||
(current-time
|
||||
(+ (the float (mod (-> *display* base-frame-counter) period))
|
||||
(+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period))
|
||||
(-> obj offset)
|
||||
)
|
||||
)
|
||||
@@ -265,7 +265,7 @@
|
||||
)
|
||||
;; with the current offset, what is the time (0, period)?
|
||||
(current-time
|
||||
(+ (the float (mod (-> *display* base-frame-counter) period))
|
||||
(+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period))
|
||||
(-> obj offset)
|
||||
)
|
||||
)
|
||||
@@ -299,7 +299,7 @@
|
||||
"Get the current phase."
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
)
|
||||
;; don't need to wrap this again.
|
||||
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
@@ -314,7 +314,7 @@
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(max-phase 1.0)
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
)
|
||||
(fmin max-phase
|
||||
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
@@ -328,7 +328,7 @@
|
||||
"This is just get-current-phase multiplied by max-val"
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
)
|
||||
(* (/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
period-float
|
||||
@@ -348,7 +348,7 @@
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(max-val 2.0)
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
(phase-out-of-2
|
||||
(* max-val
|
||||
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
@@ -371,7 +371,7 @@
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(max-val 2.0)
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
(current-val
|
||||
(* max-val
|
||||
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
@@ -424,7 +424,7 @@
|
||||
;; max val
|
||||
(f0-1 2.0)
|
||||
;; current-time
|
||||
(f2-2 (+ (the float (mod (-> *display* base-frame-counter) v1-0)) (-> obj offset)))
|
||||
(f2-2 (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) v1-0)) (-> obj offset)))
|
||||
;; phase
|
||||
(f0-2 (* f0-1 (/ (- f2-2 (* (the float (the int (/ f2-2 f1-0))) f1-0)) f1-0)))
|
||||
;; offset for pause
|
||||
@@ -456,7 +456,7 @@
|
||||
(let* ((period (-> obj period))
|
||||
(period-float (the float period))
|
||||
(max-val 2.0)
|
||||
(current-time (+ (the float (mod (-> *display* base-frame-counter) period)) (-> obj offset)))
|
||||
(current-time (+ (the float (mod (the-as uint (-> *display* base-frame-counter)) period)) (-> obj offset)))
|
||||
(current-val
|
||||
(* max-val
|
||||
(/ (- current-time (* (the float (the int (/ current-time period-float))) period-float))
|
||||
@@ -490,7 +490,7 @@
|
||||
(set! (-> obj min-time) min-tim)
|
||||
(set! (-> obj max-time) max-time)
|
||||
(set! (-> obj max-val) (* 0.5 max-times-two))
|
||||
(set! (-> obj start-time) (the-as uint 0))
|
||||
(set! (-> obj start-time) 0)
|
||||
(set! (-> obj timer) 0)
|
||||
(set! (-> obj value) 0.0)
|
||||
(-> obj value)
|
||||
@@ -498,7 +498,7 @@
|
||||
|
||||
(defmethod update! delayed-rand-float ((obj delayed-rand-float))
|
||||
"Get the value."
|
||||
(when (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
|
||||
(when (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
|
||||
;; only update if enough time has passed.
|
||||
(set! (-> obj start-time) (-> *display* base-frame-counter))
|
||||
;; come up with a random end time.
|
||||
@@ -609,7 +609,7 @@
|
||||
(set! (-> obj max-time) max-time)
|
||||
(set! (-> obj xz-max) (* 0.5 xz-range))
|
||||
(set! (-> obj y-max) (* 0.5 y-range))
|
||||
(set! (-> obj start-time) (the-as uint 0))
|
||||
(set! (-> obj start-time) 0)
|
||||
(set! (-> obj timer) 0)
|
||||
(vector-reset! (-> obj value))
|
||||
(-> obj value)
|
||||
@@ -627,7 +627,7 @@
|
||||
|
||||
(defmethod update-with-delay! delayed-rand-vector ((obj delayed-rand-vector))
|
||||
"Update, if enough time has passed"
|
||||
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
|
||||
(if (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
|
||||
(update-now! obj)
|
||||
)
|
||||
(-> obj value)
|
||||
@@ -635,7 +635,7 @@
|
||||
|
||||
(defmethod update-with-delay-or-reset! delayed-rand-vector ((obj delayed-rand-vector))
|
||||
"Update, if enough time has passed. Otherwise reset to zero."
|
||||
(if (>= (the-as int (- (-> *display* base-frame-counter) (-> obj start-time))) (-> obj timer))
|
||||
(if (>= (- (-> *display* base-frame-counter) (-> obj start-time)) (-> obj timer))
|
||||
(update-now! obj)
|
||||
(vector-reset! (-> obj value))
|
||||
)
|
||||
|
||||
+31
-7
@@ -101,15 +101,38 @@
|
||||
(define-extern dgo-load (function string kheap int int none))
|
||||
(define-extern link-begin (function pointer (pointer uint8) int kheap link-flag int))
|
||||
(define-extern link-resume (function int))
|
||||
|
||||
(defenum mc-status-code
|
||||
:type uint32
|
||||
(busy 0)
|
||||
(ok 1)
|
||||
(bad-handle 2)
|
||||
(format-failed 3)
|
||||
(internal-error 4)
|
||||
(write-error 5)
|
||||
(read-error 6)
|
||||
(new-game 7)
|
||||
(no-memory 8)
|
||||
(no-card 9)
|
||||
(no-last 10)
|
||||
(no-format 11)
|
||||
(no-file 12)
|
||||
(no-save 13)
|
||||
(no-space 14)
|
||||
(bad-version 15)
|
||||
(no-process 16)
|
||||
(no-auto-save 17)
|
||||
)
|
||||
|
||||
(define-extern mc-run (function none))
|
||||
;; mc-format
|
||||
;; mc-unformat
|
||||
;; mc-create-file
|
||||
;; mc-save
|
||||
;; mc-load
|
||||
(define-extern mc-format (function int mc-status-code))
|
||||
(define-extern mc-unformat (function int mc-status-code))
|
||||
(define-extern mc-create-file (function int uint mc-status-code))
|
||||
(define-extern mc-save (function int int pointer int mc-status-code))
|
||||
(define-extern mc-load (function int int pointer mc-status-code))
|
||||
(declare-type mc-slot-info structure)
|
||||
(define-extern mc-sync (function int))
|
||||
(define-extern mc-get-slot-info (function int mc-slot-info))
|
||||
(define-extern mc-get-slot-info (function int mc-slot-info none))
|
||||
|
||||
(define-extern mc-check-result (function int))
|
||||
;; mc-makefile
|
||||
@@ -160,7 +183,8 @@
|
||||
(define-extern file-stream-read (function file-stream pointer int int))
|
||||
(define-extern file-stream-write (function file-stream pointer uint uint))
|
||||
(define-extern scf-get-language (function uint))
|
||||
;; scf-get-time
|
||||
(declare-type scf-time structure)
|
||||
(define-extern scf-get-time (function scf-time none))
|
||||
(define-extern scf-get-aspect (function uint))
|
||||
(define-extern scf-get-volume (function int))
|
||||
(define-extern scf-get-territory (function int))
|
||||
|
||||
@@ -401,17 +401,32 @@
|
||||
(defmacro handle->process (handle)
|
||||
;; the actual implementation is more clever than this.
|
||||
;; Checks PID.
|
||||
`(if (-> ,handle process)
|
||||
(let ((proc (-> (-> ,handle process))))
|
||||
(if (= (-> ,handle pid) (-> proc pid))
|
||||
proc
|
||||
)
|
||||
`(let ((the-handle ,handle))
|
||||
(if (-> the-handle process)
|
||||
(let ((proc (-> (-> the-handle process))))
|
||||
(if (= (-> the-handle pid) (-> proc pid))
|
||||
proc
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro ppointer->process (ppointer)
|
||||
;; convert a (pointer process) to a process.
|
||||
;; this uses the self field, which seems to always just get set to the object.
|
||||
;; perhaps when deleting a process you could have it set self to #f?
|
||||
;; I don't see this happen anywhere though, so it's not clear.
|
||||
`(let ((the-pp ,ppointer))
|
||||
(the process (if the-pp (-> the-pp 0 self)))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro process->ppointer (proc)
|
||||
`(if ,proc (the (pointer process) (-> ,proc ppointer)))
|
||||
;"safely get a (pointer process) from a process, returning #f if invalid."
|
||||
`(let ((the-proc ,proc))
|
||||
(if the-proc (-> the-proc ppointer))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro ppointer->handle (pproc)
|
||||
@@ -440,7 +455,7 @@
|
||||
(deftype state (protect-frame)
|
||||
((code function :offset-assert 16)
|
||||
(trans (function none) :offset-assert 20)
|
||||
(post (function none) :offset-assert 24)
|
||||
(post (function none) :offset-assert 24)
|
||||
(enter function :offset-assert 28)
|
||||
(event (function process int symbol event-message-block object) :offset-assert 32)
|
||||
)
|
||||
@@ -471,23 +486,6 @@
|
||||
:flag-assert #x900000048
|
||||
)
|
||||
|
||||
(defmacro as-process (ppointer)
|
||||
;; convert a (pointer process) to a process.
|
||||
;; this uses the self field, which seems to always just get set to the object.
|
||||
;; perhaps when deleting a process you could have it set self to #f?
|
||||
;; I don't see this happen anywhere though, so it's not clear.
|
||||
`(if ,ppointer
|
||||
(-> (-> ,ppointer) self)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro as-ppointer (proc)
|
||||
;"safely get a (pointer process) from a process, returning #f if invalid."
|
||||
`(if ,proc
|
||||
(-> ,proc ppointer)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro process-stack-used (proc)
|
||||
;; get how much stack the top thread of a process has used.
|
||||
`(- (the int (-> ,proc top-thread stack-top))
|
||||
|
||||
+12
-12
@@ -308,9 +308,9 @@
|
||||
(format #t "[~8x] ~A~%" obj (-> obj type))
|
||||
(format #t "~Tname: ~S~%" (-> obj name))
|
||||
(format #t "~Tmask: #x~X~%" (-> obj mask))
|
||||
(format #t "~Tparent: ~A~%" (as-process (-> obj parent)))
|
||||
(format #t "~Tbrother: ~A~%" (as-process (-> obj brother)))
|
||||
(format #t "~Tchild: ~A~%" (as-process (-> obj child)))
|
||||
(format #t "~Tparent: ~A~%" (ppointer->process (-> obj parent)))
|
||||
(format #t "~Tbrother: ~A~%" (ppointer->process (-> obj brother)))
|
||||
(format #t "~Tchild: ~A~%" (ppointer->process (-> obj child)))
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -394,9 +394,9 @@
|
||||
(format #t "~Ttrans-hook: ~A~%" (-> obj trans-hook))
|
||||
(format #t "~Tpost-hook: ~A~%" (-> obj post-hook))
|
||||
(format #t "~Tevent-hook: ~A~%" (-> obj event-hook))
|
||||
(format #t "~Tparent: ~A~%" (as-process (-> obj parent)))
|
||||
(format #t "~Tbrother: ~A~%" (as-process (-> obj brother)))
|
||||
(format #t "~Tchild: ~A~%" (as-process (-> obj child)))
|
||||
(format #t "~Tparent: ~A~%" (ppointer->process (-> obj parent)))
|
||||
(format #t "~Tbrother: ~A~%" (ppointer->process (-> obj brother)))
|
||||
(format #t "~Tchild: ~A~%" (ppointer->process (-> obj child)))
|
||||
(format #t "~Tconnection-list: ~`connectable`P~%" (-> obj connection-list))
|
||||
(format #t "~Tstack-frame-top: ~A~%" (-> obj stack-frame-top))
|
||||
(format #t "~Theap-base: #x~X~%" (-> obj heap-base))
|
||||
@@ -845,8 +845,8 @@
|
||||
;; create each process
|
||||
(let ((old-bro (-> obj child))
|
||||
(next ((method-of-type process new) allocation process 'dead stack-size)))
|
||||
(set! (-> obj child) (as-ppointer next))
|
||||
(set! (-> next parent) (as-ppointer obj))
|
||||
(set! (-> obj child) (process->ppointer next))
|
||||
(set! (-> next parent) (process->ppointer obj))
|
||||
(set! (-> next pool) obj)
|
||||
(set! (-> next brother) old-bro)
|
||||
)
|
||||
@@ -865,7 +865,7 @@
|
||||
(set! proc (the (pointer process-tree) (get-process *debug-dead-pool* type-to-make stack-size)))
|
||||
(when proc
|
||||
(format 0 "WARNING: ~A ~A had to be allocated from the debug pool, because ~A was empty.~%"
|
||||
type-to-make (as-process proc) (-> obj name))
|
||||
type-to-make (ppointer->process proc) (-> obj name))
|
||||
)
|
||||
;; there's a bug here. proc is a process here, but will be used as a process pointer.
|
||||
;; let's just kill the program here.
|
||||
@@ -881,7 +881,7 @@
|
||||
)
|
||||
(else
|
||||
(format 0 "WARNING: ~A ~A could not be allocated, because ~A was empty.~%"
|
||||
type-to-make (as-process proc) (-> obj name))
|
||||
type-to-make (ppointer->process proc) (-> obj name))
|
||||
(the process #f)
|
||||
)
|
||||
)
|
||||
@@ -2007,12 +2007,12 @@
|
||||
;; need to remove obj from its current parent
|
||||
(when parent
|
||||
(let ((proc (-> (-> parent) child)))
|
||||
(if (eq? (as-process proc) obj)
|
||||
(if (eq? (ppointer->process proc) obj)
|
||||
;; case where we're the first child is easy!
|
||||
(set! (-> (-> parent) child) (-> obj brother))
|
||||
;; otherwise, look through brothers to find us.
|
||||
(begin
|
||||
(while (not (eq? (as-process (-> (-> proc) brother)) obj))
|
||||
(while (not (eq? (ppointer->process (-> (-> proc) brother)) obj))
|
||||
(set! proc (-> (-> proc) brother))
|
||||
)
|
||||
;; ok, got us, splice out of list.
|
||||
|
||||
@@ -70,34 +70,37 @@
|
||||
(the-as game-task (current-task (-> obj tasks)))
|
||||
)
|
||||
(close-current! (-> obj tasks))
|
||||
(let* ((s5-1 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-8 (when s5-1
|
||||
(let ((t9-4 (method-of-type manipy activate)))
|
||||
(t9-4
|
||||
(the-as manipy s5-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-1
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*flutflut-naked-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj flutflut)
|
||||
(new 'static 'handle :process v1-8 :pid (-> v1-8 0 pid))
|
||||
(let ((s5-1 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj flutflut) (ppointer->handle (when s5-1
|
||||
(let
|
||||
((t9-4
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-4
|
||||
(the-as manipy s5-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-1
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*flutflut-naked-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-4 (new 'stack-no-clear 'event-message-block)))
|
||||
@@ -114,34 +117,37 @@
|
||||
(set! (-> a1-5 param 0) (the-as uint #t))
|
||||
(send-event-function (handle->process (-> obj flutflut)) a1-5)
|
||||
)
|
||||
(let* ((s5-2 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-28 (when s5-2
|
||||
(let ((t9-9 (method-of-type manipy activate)))
|
||||
(t9-9
|
||||
(the-as manipy s5-2)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-2
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*flutflutegg-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj egg)
|
||||
(new 'static 'handle :process v1-28 :pid (-> v1-28 0 pid))
|
||||
(let ((s5-2 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj egg) (ppointer->handle (when s5-2
|
||||
(let
|
||||
((t9-9
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-9
|
||||
(the-as manipy s5-2)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-2
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*flutflutegg-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
||||
@@ -220,4 +226,4 @@
|
||||
(set! (-> obj sound-flava) (the-as uint 7))
|
||||
(dummy-42 obj)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
@@ -111,7 +111,7 @@
|
||||
((and
|
||||
(-> obj draw shadow)
|
||||
(zero? (-> obj draw cur-lod))
|
||||
(nonzero? (logand (-> obj draw status) 8))
|
||||
(logtest? (-> obj draw status) 8)
|
||||
)
|
||||
(let ((v1-9 (-> obj draw shadow-ctrl)))
|
||||
(set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags)))
|
||||
@@ -132,34 +132,47 @@
|
||||
;; definition for function muse-to-idle
|
||||
(defbehavior muse-to-idle sculptor ((arg0 muse))
|
||||
(when (not (handle->process (-> arg0 incomming-attack-id)))
|
||||
(let* ((s5-0 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-5 (when s5-0
|
||||
(let ((t9-1 (method-of-type manipy activate)))
|
||||
(t9-1
|
||||
(the-as manipy s5-0)
|
||||
arg0
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-0
|
||||
manipy-init
|
||||
(-> arg0 collide-info trans)
|
||||
(-> arg0 entity)
|
||||
*sculptor-muse-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-0 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> arg0 incomming-attack-id)
|
||||
(new 'static 'handle :process v1-5 :pid (-> v1-5 0 pid))
|
||||
(let ((s5-0 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> arg0 incomming-attack-id) (ppointer->handle (when s5-0
|
||||
(let
|
||||
((t9-1
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-1
|
||||
(the-as
|
||||
manipy
|
||||
s5-0
|
||||
)
|
||||
arg0
|
||||
'manipy
|
||||
(the-as
|
||||
pointer
|
||||
#x70004000
|
||||
)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-0
|
||||
manipy-init
|
||||
(->
|
||||
arg0
|
||||
collide-info
|
||||
trans
|
||||
)
|
||||
(-> arg0 entity)
|
||||
*sculptor-muse-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-0 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -308,34 +321,37 @@
|
||||
(the-as game-task (current-task (-> obj tasks)))
|
||||
)
|
||||
(close-current! (-> obj tasks))
|
||||
(let* ((s5-1 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-12 (when s5-1
|
||||
(let ((t9-5 (method-of-type manipy activate)))
|
||||
(t9-5
|
||||
(the-as manipy s5-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-1
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*sculptor-muse-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj muse)
|
||||
(new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid))
|
||||
(let ((s5-1 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj muse) (ppointer->handle (when s5-1
|
||||
(let
|
||||
((t9-5
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-5
|
||||
(the-as manipy s5-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-1
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*sculptor-muse-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-18 (handle->process (-> obj muse))))
|
||||
@@ -1229,4 +1245,4 @@
|
||||
(set! (-> obj draw light-index) (the-as uint 3))
|
||||
(dummy-42 obj)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
@@ -77,15 +77,15 @@
|
||||
(momentum-speed float :offset-assert 296)
|
||||
(acceleration float :offset-assert 300)
|
||||
(rotate-speed float :offset-assert 304)
|
||||
(turn-time uint64 :offset-assert 312)
|
||||
(frustration-time uint64 :offset-assert 320)
|
||||
(turn-time int64 :offset-assert 312)
|
||||
(frustration-time int64 :offset-assert 320)
|
||||
(speed-scale float :offset-assert 328)
|
||||
(neck joint-mod :offset-assert 332) ; this is what `neck` is on the pelican
|
||||
(reaction-time uint64 :offset-assert 336)
|
||||
(notice-time uint64 :offset-assert 344)
|
||||
(state-timeout uint64 :offset-assert 352)
|
||||
(free-time uint64 :offset-assert 360)
|
||||
(touch-time uint64 :offset-assert 368)
|
||||
(reaction-time int64 :offset-assert 336)
|
||||
(notice-time int64 :offset-assert 344)
|
||||
(state-timeout int64 :offset-assert 352)
|
||||
(free-time int64 :offset-assert 360)
|
||||
(touch-time int64 :offset-assert 368)
|
||||
(nav-enemy-flags uint32 :offset-assert 376)
|
||||
(incomming-attack-id handle :offset-assert 384)
|
||||
(jump-return-state (state process) :offset-assert 392)
|
||||
|
||||
+160
-188
@@ -107,46 +107,43 @@
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defmethod TODO-RENAME-39 nav-enemy ((obj nav-enemy))
|
||||
(when
|
||||
(and
|
||||
(logtest? (-> obj nav-enemy-flags) 256)
|
||||
(or
|
||||
(not *target*)
|
||||
(and
|
||||
(zero? (logand (-> *target* state-flags) #x80f8))
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) (-> obj touch-time)))
|
||||
15
|
||||
)
|
||||
)
|
||||
)
|
||||
(and
|
||||
(logtest? (-> obj nav-enemy-flags) 256)
|
||||
(or
|
||||
(not *target*)
|
||||
(and
|
||||
(zero? (logand (-> *target* state-flags) #x80f8))
|
||||
(>= (- (-> *display* base-frame-counter) (-> obj touch-time)) 15)
|
||||
)
|
||||
(dummy-54 (-> obj collide-info) 2 1)
|
||||
(set! (-> obj nav-enemy-flags) (logand -257 (-> obj nav-enemy-flags)))
|
||||
)
|
||||
)
|
||||
(dummy-54 (-> obj collide-info) 2 1)
|
||||
(set! (-> obj nav-enemy-flags) (logand -257 (-> obj nav-enemy-flags)))
|
||||
)
|
||||
((method-of-object (-> obj draw shadow-ctrl) dummy-14))
|
||||
(when *target*
|
||||
(if *target*
|
||||
(look-at-enemy!
|
||||
(-> *target* neck)
|
||||
(the-as vector (-> obj collide-info root-prim prim-core))
|
||||
(if (logtest? (-> obj nav-enemy-flags) 4)
|
||||
'attacking
|
||||
)
|
||||
obj
|
||||
)
|
||||
)
|
||||
(if (and (nonzero? (-> obj neck)) (logtest? (-> obj nav-enemy-flags) #x4000))
|
||||
(set-target!
|
||||
(-> obj neck)
|
||||
(target-pos (-> obj nav-info player-look-at-joint))
|
||||
)
|
||||
)
|
||||
(if *target*
|
||||
(look-at-enemy!
|
||||
(-> *target* neck)
|
||||
(the-as vector (-> obj collide-info root-prim prim-core))
|
||||
(if (logtest? (-> obj nav-enemy-flags) 4)
|
||||
'attacking
|
||||
)
|
||||
obj
|
||||
)
|
||||
)
|
||||
(if (and (nonzero? (-> obj neck)) (logtest? (-> obj nav-enemy-flags) #x4000))
|
||||
(set-target!
|
||||
(-> obj neck)
|
||||
(target-pos (-> obj nav-info player-look-at-joint))
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (-> obj nav-info debug-draw-neck)
|
||||
(if (nonzero? (-> obj neck))
|
||||
(joint-mod-debug-draw (-> obj neck))
|
||||
)
|
||||
(if (nonzero? (-> obj neck))
|
||||
(joint-mod-debug-draw (-> obj neck))
|
||||
)
|
||||
)
|
||||
(ja-post)
|
||||
0
|
||||
(none)
|
||||
@@ -259,10 +256,11 @@
|
||||
(set! (-> a1-1 mode) arg2)
|
||||
(set! (-> v1-0 param 1) (the-as uint a1-1))
|
||||
)
|
||||
(when (send-event-function arg0 v1-0)
|
||||
(dummy-54 (-> self collide-info) 2 0)
|
||||
(logior! (-> self nav-enemy-flags) 256)
|
||||
#t
|
||||
(the-as object (when (send-event-function arg0 v1-0)
|
||||
(dummy-54 (-> self collide-info) 2 0)
|
||||
(logior! (-> self nav-enemy-flags) 256)
|
||||
#t
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -456,19 +454,19 @@ nav-enemy-default-event-handler
|
||||
(if
|
||||
(or
|
||||
(logtest? (-> obj nav-enemy-flags) 128)
|
||||
(nonzero? (logand #x80000 (-> obj nav flags)))
|
||||
(logtest? #x80000 (-> obj nav flags))
|
||||
)
|
||||
(seek-to-point-toward-point!
|
||||
(-> obj collide-info)
|
||||
(-> obj nav target-pos)
|
||||
(-> obj rotate-speed)
|
||||
(the-as int (-> obj turn-time))
|
||||
(-> obj turn-time)
|
||||
)
|
||||
(seek-toward-heading-vec!
|
||||
(-> obj collide-info)
|
||||
(-> obj nav travel)
|
||||
(-> obj rotate-speed)
|
||||
(the-as int (-> obj turn-time))
|
||||
(-> obj turn-time)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -487,7 +485,7 @@ nav-enemy-default-event-handler
|
||||
8192.0
|
||||
#f
|
||||
(-> obj nav-info hover-if-no-ground)
|
||||
(nonzero? (logand (-> obj nav-enemy-flags) #x8000))
|
||||
(logtest? (-> obj nav-enemy-flags) #x8000)
|
||||
)
|
||||
(dummy-58 (-> obj collide-info) (-> obj collide-info transv))
|
||||
)
|
||||
@@ -600,12 +598,12 @@ nav-enemy-default-event-handler
|
||||
;; definition for function nav-enemy-face-player-post
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defbehavior nav-enemy-face-player-post nav-enemy ()
|
||||
(if (and *target* (nonzero? (logand (-> self nav-enemy-flags) 16)))
|
||||
(if (and *target* (logtest? (-> self nav-enemy-flags) 16))
|
||||
(seek-to-point-toward-point!
|
||||
(-> self collide-info)
|
||||
(target-pos 0)
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
)
|
||||
(nav-enemy-simple-post)
|
||||
@@ -660,10 +658,7 @@ nav-enemy-default-event-handler
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defbehavior nav-enemy-neck-control-inactive nav-enemy ()
|
||||
(when
|
||||
(and
|
||||
(nonzero? (-> self neck))
|
||||
(nonzero? (logand (-> self nav-enemy-flags) #x4000))
|
||||
)
|
||||
(and (nonzero? (-> self neck)) (logtest? (-> self nav-enemy-flags) #x4000))
|
||||
(set! (-> self nav-enemy-flags) (logand -16385 (-> self nav-enemy-flags)))
|
||||
(shut-down! (-> self neck))
|
||||
)
|
||||
@@ -705,8 +700,8 @@ nav-enemy-default-event-handler
|
||||
((logtest? (-> self nav-enemy-flags) 1)
|
||||
(when
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) (-> self notice-time)))
|
||||
(the-as int (-> self reaction-time))
|
||||
(- (-> *display* base-frame-counter) (-> self notice-time))
|
||||
(-> self reaction-time)
|
||||
)
|
||||
(set! gp-0 #t)
|
||||
(set! (-> self nav-enemy-flags) (logand -2 (-> self nav-enemy-flags)))
|
||||
@@ -937,7 +932,10 @@ nav-enemy-default-event-handler
|
||||
(set! (-> v1-14 num-func) num-func-identity)
|
||||
(set! (-> v1-14 frame-num) 0.0)
|
||||
)
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(set!
|
||||
(-> self collide-info status)
|
||||
(logand -8 (-> self collide-info status))
|
||||
@@ -1019,7 +1017,7 @@ nav-enemy-default-event-handler
|
||||
(-> self collide-info)
|
||||
arg0
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
(suspend)
|
||||
(let ((a0-8 (-> self skel root-channel 0)))
|
||||
@@ -1033,7 +1031,7 @@ nav-enemy-default-event-handler
|
||||
(set!
|
||||
v1-16
|
||||
(or
|
||||
(>= (the-as int (- (-> *display* base-frame-counter) s4-0)) 3000)
|
||||
(>= (- (-> *display* base-frame-counter) s4-0) 3000)
|
||||
(nav-enemy-facing-direction? arg0 arg1)
|
||||
)
|
||||
)
|
||||
@@ -1087,7 +1085,7 @@ nav-enemy-default-event-handler
|
||||
(nonzero? (-> obj skel))
|
||||
(!= (-> obj skel root-channel 0) (-> obj skel channel))
|
||||
)
|
||||
(and (nonzero? (-> obj draw)) (nonzero? (logand (-> obj draw status) 16)))
|
||||
(and (nonzero? (-> obj draw)) (logtest? (-> obj draw status) 16))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1103,7 +1101,10 @@ nav-enemy-default-event-handler
|
||||
:enter
|
||||
(behavior ()
|
||||
(nav-enemy-neck-control-inactive)
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(if (-> self nav-info move-to-ground)
|
||||
(dummy-60
|
||||
(-> self collide-info)
|
||||
@@ -1114,7 +1115,7 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
)
|
||||
(set! (-> self nav-enemy-flags) (logand -7 (-> self nav-enemy-flags)))
|
||||
(set! (-> self state-timeout) (the-as uint 300))
|
||||
(set! (-> self state-timeout) 300)
|
||||
(none)
|
||||
)
|
||||
:trans
|
||||
@@ -1132,14 +1133,11 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
)
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self state-timeout))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self state-timeout)
|
||||
)
|
||||
(nonzero? (-> self draw))
|
||||
(nonzero? (logand (-> self draw status) 8))
|
||||
(logtest? (-> self draw status) 8)
|
||||
)
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
@@ -1190,18 +1188,21 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(set!
|
||||
(-> self nav flags)
|
||||
(the-as nav-control-flags (the-as int (logior #x80000 (-> self nav flags))))
|
||||
)
|
||||
(set! (-> self nav-enemy-flags) (logand -5 (-> self nav-enemy-flags)))
|
||||
(logior! (-> self nav-enemy-flags) 8)
|
||||
(set! (-> self state-timeout) (the-as uint 300))
|
||||
(set! (-> self state-timeout) 300)
|
||||
(set! (-> self target-speed) (-> self nav-info walk-travel-speed))
|
||||
(set! (-> self acceleration) (-> self nav-info walk-acceleration))
|
||||
(set! (-> self rotate-speed) (-> self nav-info walk-rotate-speed))
|
||||
(set! (-> self turn-time) (the-as uint (-> self nav-info walk-turn-time)))
|
||||
(set! (-> self turn-time) (the-as int (-> self nav-info walk-turn-time)))
|
||||
(none)
|
||||
)
|
||||
:exit
|
||||
@@ -1213,25 +1214,15 @@ nav-enemy-default-event-handler
|
||||
(behavior ()
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
30
|
||||
)
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self state-timeout))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self state-timeout)
|
||||
)
|
||||
(if
|
||||
(and
|
||||
(nonzero? (-> self draw))
|
||||
(nonzero? (logand (-> self draw status) 8))
|
||||
)
|
||||
(if (and (nonzero? (-> self draw)) (logtest? (-> self draw status) 8))
|
||||
(set! (-> self free-time) (-> *display* base-frame-counter))
|
||||
)
|
||||
(if
|
||||
@@ -1246,10 +1237,7 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
)
|
||||
)
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) (-> self free-time)))
|
||||
600
|
||||
)
|
||||
(>= (- (-> *display* base-frame-counter) (-> self free-time)) 600)
|
||||
)
|
||||
(go-virtual nav-enemy-idle)
|
||||
)
|
||||
@@ -1556,7 +1544,7 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
(dummy-11 (-> self nav) (-> self nav target-pos))
|
||||
(set! (-> self rotate-speed) (-> self nav-info run-rotate-speed))
|
||||
(set! (-> self turn-time) (the-as uint (-> self nav-info run-turn-time)))
|
||||
(set! (-> self turn-time) (the-as int (-> self nav-info run-turn-time)))
|
||||
(none)
|
||||
)
|
||||
:code
|
||||
@@ -1605,7 +1593,7 @@ nav-enemy-default-event-handler
|
||||
(-> self collide-info)
|
||||
(-> self nav travel)
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
(suspend)
|
||||
(let ((a0-4 (-> self skel root-channel 0)))
|
||||
@@ -1648,18 +1636,18 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self reaction-time))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self reaction-time)
|
||||
)
|
||||
(if
|
||||
(or
|
||||
@@ -1851,13 +1839,16 @@ nav-enemy-default-event-handler
|
||||
:enter
|
||||
(behavior ()
|
||||
(nav-enemy-neck-control-look-at)
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(set! (-> self free-time) (-> *display* base-frame-counter))
|
||||
(logior! (-> self nav-enemy-flags) 4)
|
||||
(set! (-> self target-speed) (-> self nav-info run-travel-speed))
|
||||
(set! (-> self acceleration) (-> self nav-info run-acceleration))
|
||||
(set! (-> self rotate-speed) (-> self nav-info run-rotate-speed))
|
||||
(set! (-> self turn-time) (the-as uint (-> self nav-info run-turn-time)))
|
||||
(set! (-> self turn-time) (the-as int (-> self nav-info run-turn-time)))
|
||||
(nav-enemy-reset-frustration)
|
||||
(none)
|
||||
)
|
||||
@@ -1881,39 +1872,26 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self reaction-time))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self reaction-time)
|
||||
)
|
||||
(if
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> self frustration-time))
|
||||
)
|
||||
(the-as
|
||||
int
|
||||
(+ (-> self reaction-time) (-> self nav-info frustration-time))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (-> self frustration-time))
|
||||
(+ (-> self reaction-time) (-> self nav-info frustration-time))
|
||||
)
|
||||
(logior! (-> self nav-enemy-flags) 8192)
|
||||
)
|
||||
(if
|
||||
(or
|
||||
(not (TODO-RENAME-46 self (-> self nav-info stop-chase-distance)))
|
||||
(nonzero? (logand (-> self nav-enemy-flags) 8192))
|
||||
(logtest? (-> self nav-enemy-flags) 8192)
|
||||
)
|
||||
(go-virtual nav-enemy-stop-chase)
|
||||
)
|
||||
(cond
|
||||
((logtest? #x20000 (-> self nav flags))
|
||||
(if
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) (-> self free-time)))
|
||||
300
|
||||
)
|
||||
(if (>= (- (-> *display* base-frame-counter) (-> self free-time)) 300)
|
||||
(go-virtual nav-enemy-patrol)
|
||||
)
|
||||
)
|
||||
@@ -1969,7 +1947,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(let*
|
||||
((f30-0
|
||||
(vector-vector-distance (-> self collide-info trans) (target-pos 0))
|
||||
@@ -1987,22 +1968,19 @@ nav-enemy-default-event-handler
|
||||
(if (< f30-0 40960.0)
|
||||
(go-virtual nav-enemy-stare)
|
||||
)
|
||||
(set! (-> self state-timeout) (the-as uint gp-1))
|
||||
(set! (-> self state-timeout) gp-1)
|
||||
)
|
||||
(set! (-> self target-speed) (-> self nav-info walk-travel-speed))
|
||||
(set! (-> self acceleration) (-> self nav-info walk-acceleration))
|
||||
(set! (-> self rotate-speed) (-> self nav-info walk-rotate-speed))
|
||||
(set! (-> self turn-time) (the-as uint (-> self nav-info walk-turn-time)))
|
||||
(set! (-> self turn-time) (the-as int (-> self nav-info walk-turn-time)))
|
||||
(none)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
30
|
||||
)
|
||||
(if (logtest? (-> *target* state-flags) 128)
|
||||
@@ -2029,11 +2007,8 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
(logtest? #x20000 (-> self nav flags))
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self state-timeout))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self state-timeout)
|
||||
)
|
||||
)
|
||||
(go-virtual nav-enemy-stare)
|
||||
@@ -2086,27 +2061,27 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(set! (-> self nav-enemy-flags) (logand -17 (-> self nav-enemy-flags)))
|
||||
(let
|
||||
((f0-0 (vector-vector-distance (-> self collide-info trans) (target-pos 0)))
|
||||
)
|
||||
(set!
|
||||
(-> self state-timeout)
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(+
|
||||
(lerp-scale 3000.0 0.0 f0-0 12288.0 122880.0)
|
||||
(nav-enemy-rnd-float-range 0.0 900.0)
|
||||
)
|
||||
(the
|
||||
int
|
||||
(+
|
||||
(lerp-scale 3000.0 0.0 f0-0 12288.0 122880.0)
|
||||
(nav-enemy-rnd-float-range 0.0 900.0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> self rotate-speed) (-> self nav-info run-rotate-speed))
|
||||
(set! (-> self turn-time) (the-as uint (-> self nav-info run-turn-time)))
|
||||
(set! (-> self turn-time) (the-as int (-> self nav-info run-turn-time)))
|
||||
(set! (-> self collide-info transv quad) (-> *null-vector* quad))
|
||||
(none)
|
||||
)
|
||||
@@ -2119,10 +2094,7 @@ nav-enemy-default-event-handler
|
||||
(behavior ()
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
30
|
||||
)
|
||||
(if (logtest? (-> *target* state-flags) 128)
|
||||
@@ -2133,11 +2105,8 @@ nav-enemy-default-event-handler
|
||||
(if
|
||||
(and
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> self notice-time))
|
||||
)
|
||||
(the-as int (-> self reaction-time))
|
||||
(- (-> *display* base-frame-counter) (-> self notice-time))
|
||||
(-> self reaction-time)
|
||||
)
|
||||
(not (nav-enemy-frustrated?))
|
||||
)
|
||||
@@ -2177,11 +2146,8 @@ nav-enemy-default-event-handler
|
||||
(set! (-> self nav-enemy-flags) (logand -5 (-> self nav-enemy-flags)))
|
||||
(if
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(the-as int (-> self state-timeout))
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
(-> self state-timeout)
|
||||
)
|
||||
(go-virtual nav-enemy-give-up)
|
||||
)
|
||||
@@ -2198,7 +2164,7 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
)
|
||||
)
|
||||
(nonzero? (logand #x20000 (-> self nav flags)))
|
||||
(logtest? #x20000 (-> self nav flags))
|
||||
)
|
||||
(go-virtual nav-enemy-give-up)
|
||||
)
|
||||
@@ -2224,7 +2190,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(nav-enemy-neck-control-inactive)
|
||||
(set! (-> self nav-enemy-flags) (logand -5 (-> self nav-enemy-flags)))
|
||||
(none)
|
||||
@@ -2233,10 +2202,7 @@ nav-enemy-default-event-handler
|
||||
(behavior ()
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
30
|
||||
)
|
||||
(if (TODO-RENAME-46 self (-> self nav-info notice-distance))
|
||||
@@ -2362,16 +2328,7 @@ nav-enemy-default-event-handler
|
||||
(set! (-> a1-0 from) self)
|
||||
(set! (-> a1-0 num-params) 0)
|
||||
(set! (-> a1-0 message) 'child-die)
|
||||
(let ((t9-0 send-event-function)
|
||||
(v1-1 (-> self parent))
|
||||
)
|
||||
(t9-0 (the-as process (if v1-1
|
||||
(-> v1-1 0 self)
|
||||
)
|
||||
)
|
||||
a1-0
|
||||
)
|
||||
)
|
||||
(send-event-function (ppointer->process (-> self parent)) a1-0)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
@@ -2455,13 +2412,16 @@ nav-enemy-default-event-handler
|
||||
(-> self collide-info)
|
||||
(-> self jump-dest)
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
)
|
||||
(when (logtest? (-> self nav-enemy-flags) 8)
|
||||
(let
|
||||
((f30-0
|
||||
(the float (- (-> *display* base-frame-counter) (-> self jump-time)))
|
||||
(the
|
||||
float
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self jump-time)))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let
|
||||
@@ -2529,7 +2489,7 @@ nav-enemy-default-event-handler
|
||||
(logior! (-> self nav-enemy-flags) 1024)
|
||||
)
|
||||
)
|
||||
(when (and arg1 (nonzero? (logand (-> self nav-enemy-flags) 1024)))
|
||||
(when (and arg1 (logtest? (-> self nav-enemy-flags) 1024))
|
||||
(set! (-> self nav-enemy-flags) (logand -513 (-> self nav-enemy-flags)))
|
||||
(set! f30-0 2048.0)
|
||||
)
|
||||
@@ -2608,7 +2568,7 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
)
|
||||
(set! (-> self collide-info status) (logand -8 (-> self collide-info status)))
|
||||
(set! (-> self jump-time) (-> *display* base-frame-counter))
|
||||
(set! (-> self jump-time) (the-as uint (-> *display* base-frame-counter)))
|
||||
(logior! (-> self nav-enemy-flags) 8)
|
||||
(cond
|
||||
((logtest? (-> self nav-enemy-flags) 1024)
|
||||
@@ -2669,7 +2629,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
(while
|
||||
(<
|
||||
(the float (- (-> *display* base-frame-counter) (-> self jump-time)))
|
||||
(the
|
||||
float
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self jump-time)))
|
||||
)
|
||||
(-> self jump-trajectory time)
|
||||
)
|
||||
(suspend)
|
||||
@@ -2785,7 +2748,10 @@ nav-enemy-default-event-handler
|
||||
nav-enemy-jump-event-handler
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(if
|
||||
(and
|
||||
(-> self nav-info use-jump-blocked)
|
||||
@@ -2850,19 +2816,19 @@ nav-enemy-default-event-handler
|
||||
(if
|
||||
(or
|
||||
(logtest? (-> self nav-enemy-flags) 128)
|
||||
(nonzero? (logand #x80000 (-> self nav flags)))
|
||||
(logtest? #x80000 (-> self nav flags))
|
||||
)
|
||||
(seek-to-point-toward-point!
|
||||
(-> self collide-info)
|
||||
(-> self nav target-pos)
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
(seek-toward-heading-vec!
|
||||
(-> self collide-info)
|
||||
(-> self nav travel)
|
||||
(-> self rotate-speed)
|
||||
(the-as int (-> self turn-time))
|
||||
(-> self turn-time)
|
||||
)
|
||||
)
|
||||
(vector-v++!
|
||||
@@ -2892,7 +2858,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(logclear! (-> self nav flags) (nav-control-flags bit19))
|
||||
(let ((gp-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> gp-0 quad) (-> self collide-info transv quad))
|
||||
@@ -2909,13 +2878,10 @@ nav-enemy-default-event-handler
|
||||
(if
|
||||
(or
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
150
|
||||
)
|
||||
(nonzero? (logand #x80000 (-> self nav flags)))
|
||||
(logtest? #x80000 (-> self nav flags))
|
||||
)
|
||||
(go-virtual nav-enemy-chase)
|
||||
)
|
||||
@@ -2941,17 +2907,17 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:enter
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(none)
|
||||
)
|
||||
:trans
|
||||
(behavior ()
|
||||
(if
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (the-as uint (-> self state-time)))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (the-as int (-> self state-time)))
|
||||
150
|
||||
)
|
||||
(go (-> self jump-return-state))
|
||||
@@ -3023,7 +2989,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(logior! (-> self nav-enemy-flags) 2048)
|
||||
(ja-channel-push! 1 30)
|
||||
(let ((f30-0 (nav-enemy-rnd-float-range 0.8 1.2)))
|
||||
@@ -3056,7 +3025,7 @@ nav-enemy-default-event-handler
|
||||
(let ((gp-0 (nav-enemy-rnd-int-range 0 150))
|
||||
(s5-0 (-> *display* base-frame-counter))
|
||||
)
|
||||
(until (>= (the-as int (- (-> *display* base-frame-counter) s5-0)) gp-0)
|
||||
(until (>= (- (-> *display* base-frame-counter) s5-0) gp-0)
|
||||
(let ((a0-12 (-> self skel root-channel 0)))
|
||||
(set! (-> a0-12 param 0) f30-0)
|
||||
(joint-control-channel-group-eval!
|
||||
@@ -3093,7 +3062,10 @@ nav-enemy-default-event-handler
|
||||
)
|
||||
:code
|
||||
(behavior ()
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(nav-enemy-initialize-jump (-> self event-param-point))
|
||||
(nav-enemy-neck-control-look-at)
|
||||
(logior! (-> self nav-enemy-flags) 16)
|
||||
@@ -3183,7 +3155,7 @@ nav-enemy-default-event-handler
|
||||
(-> *FACT-bank* default-pill-inc)
|
||||
)
|
||||
)
|
||||
(set! (-> obj reaction-time) (the-as uint (nav-enemy-rnd-int-range 30 240)))
|
||||
(set! (-> obj reaction-time) (nav-enemy-rnd-int-range 30 240))
|
||||
(set! (-> obj speed-scale) 1.0)
|
||||
(logior! (-> obj nav-enemy-flags) 4216)
|
||||
0
|
||||
@@ -3194,7 +3166,7 @@ nav-enemy-default-event-handler
|
||||
(defmethod TODO-RENAME-49 nav-enemy ((obj nav-enemy) (arg0 nav-enemy-info))
|
||||
(set! (-> obj nav-info) arg0)
|
||||
(set! (-> obj rotate-speed) (-> obj nav-info walk-rotate-speed))
|
||||
(set! (-> obj turn-time) (the-as uint (-> obj nav-info walk-turn-time)))
|
||||
(set! (-> obj turn-time) (the-as int (-> obj nav-info walk-turn-time)))
|
||||
(when (and (!= (-> obj nav-info neck-joint) -1) (zero? (-> obj neck)))
|
||||
(set!
|
||||
(-> obj neck)
|
||||
|
||||
@@ -454,7 +454,7 @@
|
||||
(sim-time-remaining float :offset-assert 688)
|
||||
(float-height-offset float :offset-assert 692)
|
||||
(player-attack-id int32 :offset-assert 696)
|
||||
(player-bonk-timeout uint64 :offset-assert 704)
|
||||
(player-bonk-timeout int64 :offset-assert 704)
|
||||
(water-anim water-anim :offset-assert 712)
|
||||
(player-contact basic :offset-assert 716)
|
||||
(player-impulse collide-shape-prim-mesh :offset-assert 720)
|
||||
@@ -739,10 +739,7 @@
|
||||
(('bonk)
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> self player-bonk-timeout))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (-> self player-bonk-timeout))
|
||||
(the-as int (-> self info player-force-timeout))
|
||||
)
|
||||
(set! (-> self player-bonk-timeout) (-> *display* base-frame-counter))
|
||||
@@ -791,12 +788,9 @@
|
||||
((= (-> arg3 param 1) 'flop)
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(-> self player-bonk-timeout)
|
||||
)
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(-> self player-bonk-timeout)
|
||||
)
|
||||
(the-as int (-> self info player-force-timeout))
|
||||
)
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
;; definition of type ticky
|
||||
(deftype ticky (structure)
|
||||
((delay-til-ramp uint64 :offset-assert 0)
|
||||
(delay-til-timeout uint64 :offset-assert 8)
|
||||
(starting-time uint64 :offset-assert 16)
|
||||
(last-tick-time uint64 :offset-assert 24)
|
||||
((delay-til-ramp int64 :offset-assert 0)
|
||||
(delay-til-timeout int64 :offset-assert 8)
|
||||
(starting-time int64 :offset-assert 16)
|
||||
(last-tick-time int64 :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #x20
|
||||
@@ -21,14 +21,16 @@
|
||||
(completed? (_type_) symbol 11)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 9 of type ticky
|
||||
;; INFO: Return type mismatch int vs none.
|
||||
(defmethod sleep ticky ((obj ticky) (arg0 uint))
|
||||
(set! (-> obj starting-time) (-> *display* base-frame-counter))
|
||||
(set! (-> obj delay-til-timeout) arg0)
|
||||
(set! (-> obj delay-til-ramp) (max 0 (the-as int (+ arg0 -1200))))
|
||||
(set! (-> obj last-tick-time) (the-as uint 0))
|
||||
(set! (-> obj delay-til-timeout) (the-as int arg0))
|
||||
(set!
|
||||
(-> obj delay-til-ramp)
|
||||
(the-as int (max 0 (the-as int (+ arg0 -1200))))
|
||||
)
|
||||
(set! (-> obj last-tick-time) 0)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
@@ -38,7 +40,7 @@
|
||||
(let ((gp-0 #f))
|
||||
(let ((v1-2 (- (-> *display* base-frame-counter) (-> obj starting-time))))
|
||||
(cond
|
||||
((>= (the-as int v1-2) (the-as int (-> obj delay-til-timeout)))
|
||||
((>= v1-2 (-> obj delay-til-timeout))
|
||||
(set! gp-0 #t)
|
||||
)
|
||||
(else
|
||||
@@ -47,7 +49,7 @@
|
||||
(fmin
|
||||
1.0
|
||||
(/
|
||||
(the float (max 0 (the-as int (- v1-2 (-> obj delay-til-ramp)))))
|
||||
(the float (max 0 (- v1-2 (-> obj delay-til-ramp))))
|
||||
(the float (- (-> obj delay-til-timeout) (-> obj delay-til-ramp)))
|
||||
)
|
||||
)
|
||||
@@ -55,13 +57,7 @@
|
||||
(v1-7 (the int (lerp 105.0 41.0 f0-1)))
|
||||
)
|
||||
(when
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> obj last-tick-time))
|
||||
)
|
||||
v1-7
|
||||
)
|
||||
(>= (- (-> *display* base-frame-counter) (-> obj last-tick-time)) v1-7)
|
||||
(set! (-> obj last-tick-time) (-> *display* base-frame-counter))
|
||||
(sound-play-by-name
|
||||
(static-sound-name "stopwatch")
|
||||
@@ -84,7 +80,7 @@
|
||||
;; definition for method 10 of type ticky
|
||||
(defmethod reached-delay? ticky ((obj ticky) (arg0 uint))
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) (-> obj starting-time)))
|
||||
(- (-> *display* base-frame-counter) (-> obj starting-time))
|
||||
(the-as int arg0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -104,11 +104,7 @@
|
||||
)
|
||||
(camera-change-to "camera-160" 150 #f)
|
||||
(let ((gp-0 (-> *display* base-frame-counter)))
|
||||
(until
|
||||
(>=
|
||||
(the-as int (- (-> *display* base-frame-counter) gp-0))
|
||||
900
|
||||
)
|
||||
(until (>= (- (-> *display* base-frame-counter) gp-0) 900)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
@@ -144,9 +140,12 @@
|
||||
)
|
||||
(save-reminder gp-0 (logior v1-1 2) 0)
|
||||
)
|
||||
(set! (-> self state-time) (-> *display* base-frame-counter))
|
||||
(set!
|
||||
(-> self state-time)
|
||||
(the-as seconds (-> *display* base-frame-counter))
|
||||
)
|
||||
(let ((gp-1 (-> *display* base-frame-counter)))
|
||||
(until (>= (the-as int (- (-> *display* base-frame-counter) gp-1)) 300)
|
||||
(until (>= (- (-> *display* base-frame-counter) gp-1) 300)
|
||||
(suspend)
|
||||
)
|
||||
)
|
||||
@@ -286,9 +285,7 @@
|
||||
(if
|
||||
(and
|
||||
(-> obj entity)
|
||||
(nonzero?
|
||||
(logand (-> obj entity extra perm status) (entity-perm-status complete))
|
||||
)
|
||||
(logtest? (-> obj entity extra perm status) (entity-perm-status complete))
|
||||
)
|
||||
(go silostep-rise #t)
|
||||
(go silostep-idle)
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
((and
|
||||
(-> obj draw shadow)
|
||||
(zero? (-> obj draw cur-lod))
|
||||
(nonzero? (logand (-> obj draw status) 8))
|
||||
(logtest? (-> obj draw status) 8)
|
||||
)
|
||||
(let ((v1-9 (-> obj draw shadow-ctrl)))
|
||||
(set! (-> v1-9 settings flags) (logand -33 (-> v1-9 settings flags)))
|
||||
@@ -432,20 +432,14 @@
|
||||
(v1-69 (the-as number (logior #x3f800000 v1-68)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-0
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(* f30-1 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-69)))))
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-0
|
||||
(the
|
||||
int
|
||||
(* f30-1 (+ f28-0 (* f26-0 (+ -1.0 (the-as float v1-69)))))
|
||||
)
|
||||
)
|
||||
(the-as int gp-1)
|
||||
gp-1
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -512,23 +506,17 @@
|
||||
(v1-105 (the-as number (logior #x3f800000 v1-104)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-1
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-2
|
||||
(+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-105))))
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-1
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-2
|
||||
(+ f28-1 (* f26-1 (+ -1.0 (the-as float v1-105))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as int gp-2)
|
||||
gp-2
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -642,23 +630,17 @@
|
||||
(v1-165 (the-as number (logior #x3f800000 v1-164)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-2
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-3
|
||||
(+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-165))))
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-2
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-3
|
||||
(+ f28-2 (* f26-2 (+ -1.0 (the-as float v1-165))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as int gp-3)
|
||||
gp-3
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -806,23 +788,14 @@
|
||||
(v1-238 (the-as number (logior #x3f800000 v1-237)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-3
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-4
|
||||
(+ f28-3 (* f26-3 (+ -1.0 (the-as float v1-238))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-3
|
||||
(the
|
||||
int
|
||||
(* f30-4 (+ f28-3 (* f26-3 (+ -1.0 (the-as float v1-238)))))
|
||||
)
|
||||
)
|
||||
(the-as int gp-4)
|
||||
gp-4
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -882,23 +855,14 @@
|
||||
(v1-269 (the-as number (logior #x3f800000 v1-268)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-4
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-5
|
||||
(+ f28-4 (* f26-4 (+ -1.0 (the-as float v1-269))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-4
|
||||
(the
|
||||
int
|
||||
(* f30-5 (+ f28-4 (* f26-4 (+ -1.0 (the-as float v1-269)))))
|
||||
)
|
||||
)
|
||||
(the-as int gp-5)
|
||||
gp-5
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -955,23 +919,14 @@
|
||||
(v1-302 (the-as number (logior #x3f800000 v1-301)))
|
||||
)
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
s5-5
|
||||
(the-as
|
||||
uint
|
||||
(the
|
||||
int
|
||||
(*
|
||||
f30-6
|
||||
(+ f28-5 (* f26-5 (+ -1.0 (the-as float v1-302))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(-
|
||||
s5-5
|
||||
(the
|
||||
int
|
||||
(* f30-6 (+ f28-5 (* f26-5 (+ -1.0 (the-as float v1-302)))))
|
||||
)
|
||||
)
|
||||
(the-as int gp-6)
|
||||
gp-6
|
||||
)
|
||||
)
|
||||
(suspend)
|
||||
@@ -1036,4 +991,4 @@
|
||||
(set! (-> obj draw light-index) (the-as uint 5))
|
||||
(dummy-42 obj)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
@@ -626,34 +626,37 @@
|
||||
(set-setting! *setting-control* pp 'music-volume-movie 'abs 0.0 0)
|
||||
(copy-settings-from-target! *setting-control*)
|
||||
(close-status! (-> obj tasks) (task-status need-reward-speech))
|
||||
(let* ((s5-2 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-41 (when s5-2
|
||||
(let ((t9-15 (method-of-type manipy activate)))
|
||||
(t9-15
|
||||
(the-as manipy s5-2)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-2
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*assistant-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj assistant)
|
||||
(new 'static 'handle :process v1-41 :pid (-> v1-41 0 pid))
|
||||
(let ((s5-2 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj assistant) (ppointer->handle (when s5-2
|
||||
(let
|
||||
((t9-15
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-15
|
||||
(the-as manipy s5-2)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s5-2
|
||||
manipy-init
|
||||
(-> obj root trans)
|
||||
(-> obj entity)
|
||||
*assistant-sg*
|
||||
#f
|
||||
)
|
||||
(-> s5-2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-16 (new 'stack-no-clear 'event-message-block)))
|
||||
@@ -1390,4 +1393,4 @@
|
||||
(set! (-> obj draw light-index) (the-as uint 1))
|
||||
(dummy-42 obj)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
@@ -659,17 +659,24 @@
|
||||
gp-0
|
||||
)
|
||||
)
|
||||
(a1-1 (if v1-1
|
||||
(->
|
||||
(the-as
|
||||
collide-shape
|
||||
v1-1
|
||||
)
|
||||
root-prim
|
||||
prim-core
|
||||
)
|
||||
(-> self root trans)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-1
|
||||
(->
|
||||
(the-as collide-shape v1-1)
|
||||
root-prim
|
||||
prim-core
|
||||
)
|
||||
(-> self root trans)
|
||||
(dummy-11
|
||||
(-> self part)
|
||||
(the-as vector a1-1)
|
||||
)
|
||||
)
|
||||
((method-of-object (-> self part) dummy-11))
|
||||
0
|
||||
(none)
|
||||
)
|
||||
@@ -684,34 +691,42 @@
|
||||
)
|
||||
)
|
||||
(vector<-cspace! s4-0 (-> obj node-list data 5))
|
||||
(let* ((s3-0 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-13 (when s3-0
|
||||
(let ((t9-8 (method-of-type manipy activate)))
|
||||
(t9-8
|
||||
(the-as manipy s3-0)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s3-0
|
||||
manipy-init
|
||||
s4-0
|
||||
(-> obj entity)
|
||||
*fuel-cell-sg*
|
||||
(new 'static 'vector :w 4915.2)
|
||||
)
|
||||
(-> s3-0 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj right-eye-cell)
|
||||
(new 'static 'handle :process v1-13 :pid (-> v1-13 0 pid))
|
||||
(let ((s3-0 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj right-eye-cell) (ppointer->handle (when s3-0
|
||||
(let
|
||||
((t9-8
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-8
|
||||
(the-as manipy s3-0)
|
||||
obj
|
||||
'manipy
|
||||
(the-as
|
||||
pointer
|
||||
#x70004000
|
||||
)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s3-0
|
||||
manipy-init
|
||||
s4-0
|
||||
(-> obj entity)
|
||||
*fuel-cell-sg*
|
||||
(new 'static 'vector
|
||||
:w 4915.2
|
||||
)
|
||||
)
|
||||
(-> s3-0 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-9 (new 'stack-no-clear 'event-message-block)))
|
||||
@@ -724,8 +739,8 @@
|
||||
uint
|
||||
(lambda :behavior oracle
|
||||
()
|
||||
(let ((v0-0 (dummy-9 (-> *part-group-id-table* 63) self)))
|
||||
(set! (-> self part) (the-as sparticle-launch-control v0-0))
|
||||
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 63) self)))
|
||||
(set! (-> self part) v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
@@ -749,34 +764,42 @@
|
||||
)
|
||||
)
|
||||
(vector<-cspace! s4-0 (-> obj node-list data 6))
|
||||
(let* ((s3-1 (get-process *default-dead-pool* manipy #x4000))
|
||||
(v1-33 (when s3-1
|
||||
(let ((t9-15 (method-of-type manipy activate)))
|
||||
(t9-15
|
||||
(the-as manipy s3-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s3-1
|
||||
manipy-init
|
||||
s4-0
|
||||
(-> obj entity)
|
||||
*fuel-cell-sg*
|
||||
(new 'static 'vector :w 4915.2)
|
||||
)
|
||||
(-> s3-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> obj left-eye-cell)
|
||||
(new 'static 'handle :process v1-33 :pid (-> v1-33 0 pid))
|
||||
(let ((s3-1 (get-process *default-dead-pool* manipy #x4000)))
|
||||
(set! (-> obj left-eye-cell) (ppointer->handle (when s3-1
|
||||
(let
|
||||
((t9-15
|
||||
(method-of-type
|
||||
manipy
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-15
|
||||
(the-as manipy s3-1)
|
||||
obj
|
||||
'manipy
|
||||
(the-as
|
||||
pointer
|
||||
#x70004000
|
||||
)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process function object object object object object)
|
||||
run-function-in-process
|
||||
)
|
||||
s3-1
|
||||
manipy-init
|
||||
s4-0
|
||||
(-> obj entity)
|
||||
*fuel-cell-sg*
|
||||
(new 'static 'vector
|
||||
:w 4915.2
|
||||
)
|
||||
)
|
||||
(-> s3-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((a1-16 (new 'stack-no-clear 'event-message-block)))
|
||||
@@ -789,8 +812,8 @@
|
||||
uint
|
||||
(lambda :behavior oracle
|
||||
()
|
||||
(let ((v0-0 (dummy-9 (-> *part-group-id-table* 63) self)))
|
||||
(set! (-> self part) (the-as sparticle-launch-control v0-0))
|
||||
(let ((v0-0 (create-launch-control (-> *part-group-id-table* 63) self)))
|
||||
(set! (-> self part) v0-0)
|
||||
v0-0
|
||||
)
|
||||
)
|
||||
@@ -810,4 +833,4 @@
|
||||
(dummy-42 obj)
|
||||
(none)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -126,6 +126,10 @@ Val* Compiler::compile_rlet(const goos::Object& form, const goos::Object& rest,
|
||||
lenv->emit_ir<IR_ValueReset>(reset_regs);
|
||||
}
|
||||
|
||||
for (auto c : constraints) {
|
||||
fenv->constrain(c);
|
||||
}
|
||||
|
||||
Val* result = get_none();
|
||||
for (u64 i = 1; i < args.unnamed.size(); i++) {
|
||||
auto& o = args.unnamed.at(i);
|
||||
@@ -135,10 +139,6 @@ Val* Compiler::compile_rlet(const goos::Object& form, const goos::Object& rest,
|
||||
}
|
||||
}
|
||||
|
||||
for (auto c : constraints) {
|
||||
fenv->constrain(c);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -685,7 +685,7 @@ Val* Compiler::compile_deref(const goos::Object& form, const goos::Object& _rest
|
||||
while (!rest->is_empty_list()) {
|
||||
auto field_obj = pair_car(*rest);
|
||||
rest = &pair_cdr(*rest);
|
||||
auto type_info = m_ts.lookup_type(result->type());
|
||||
auto type_info = m_ts.lookup_type_allow_partial_def(result->type());
|
||||
|
||||
// attempt to treat it as a field. May not succeed if we're actually an array.
|
||||
if (field_obj.is_symbol()) {
|
||||
|
||||
+36
-6
@@ -94,15 +94,45 @@
|
||||
(defmacro handle->process (handle)
|
||||
;; the actual implementation is more clever than this.
|
||||
;; Checks PID.
|
||||
`(if (-> ,handle process)
|
||||
(let ((proc (-> (-> ,handle process))))
|
||||
(if (= (-> ,handle pid) (-> proc pid))
|
||||
proc
|
||||
)
|
||||
`(let ((the-handle ,handle))
|
||||
(if (-> the-handle process)
|
||||
(let ((proc (-> (-> the-handle process))))
|
||||
(if (= (-> the-handle pid) (-> proc pid))
|
||||
proc
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro ppointer->process (ppointer)
|
||||
;; convert a (pointer process) to a process.
|
||||
;; this uses the self field, which seems to always just get set to the object.
|
||||
;; perhaps when deleting a process you could have it set self to #f?
|
||||
;; I don't see this happen anywhere though, so it's not clear.
|
||||
`(let ((the-pp ,ppointer))
|
||||
(the process (if the-pp (-> the-pp 0 self)))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro process->ppointer (proc)
|
||||
;"safely get a (pointer process) from a process, returning #f if invalid."
|
||||
`(let ((the-proc ,proc))
|
||||
(if the-proc (-> the-proc ppointer))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro ppointer->handle (pproc)
|
||||
`(let ((the-process ,pproc))
|
||||
(new 'static 'handle :process the-process :pid (-> the-process 0 pid))
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro process->handle (proc)
|
||||
`(ppointer->handle (process->ppointer ,proc))
|
||||
)
|
||||
|
||||
|
||||
(defmacro defbehavior (name process-type bindings &rest body)
|
||||
(if (and
|
||||
(> (length body) 1) ;; more than one thing in function
|
||||
|
||||
+10
-27
@@ -1953,10 +1953,7 @@
|
||||
(*
|
||||
0.0625
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 4000 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
(the float (* 4000 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -1967,12 +1964,7 @@
|
||||
)
|
||||
(*
|
||||
0.125
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 1500 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
(cos (the float (* 1500 (-> *display* integral-frame-counter))))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3298,11 +3290,11 @@
|
||||
(when (and *target* (= (-> *target* next-state name) 'target-continue))
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
(the-as int (+ (-> *display* base-frame-counter) -10000))
|
||||
(+ (-> *display* base-frame-counter) -10000)
|
||||
)
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
(the-as int (+ (-> *display* base-frame-counter) -10000))
|
||||
(+ (-> *display* base-frame-counter) -10000)
|
||||
)
|
||||
)
|
||||
(update-mood-fog arg0 arg1)
|
||||
@@ -3376,7 +3368,7 @@
|
||||
float
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as uint (-> (the-as (pointer int64) s4-0) 1))
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3419,7 +3411,7 @@
|
||||
(else
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 1)
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(-> *display* base-frame-counter)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3431,7 +3423,7 @@
|
||||
float
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as uint (-> (the-as (pointer int64) s4-0) 0))
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3465,7 +3457,7 @@
|
||||
(set! (-> *time-of-day-proc* 0 frame) 0)
|
||||
(set!
|
||||
(-> (the-as (pointer int64) s4-0) 0)
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(-> *display* base-frame-counter)
|
||||
)
|
||||
(dotimes (v1-72 8)
|
||||
(set! (-> arg0 sky-times v1-72) 0.0)
|
||||
@@ -3665,13 +3657,7 @@
|
||||
(*
|
||||
0.125
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(*
|
||||
4000
|
||||
(the-as int (-> *display* integral-frame-counter))
|
||||
)
|
||||
)
|
||||
(the float (* 4000 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -3685,10 +3671,7 @@
|
||||
(*
|
||||
0.25
|
||||
(cos
|
||||
(the
|
||||
float
|
||||
(* 1500 (the-as int (-> *display* integral-frame-counter)))
|
||||
)
|
||||
(the float (* 1500 (-> *display* integral-frame-counter)))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+38
-24
@@ -35,26 +35,44 @@
|
||||
(-> s5-0 ppointer)
|
||||
)
|
||||
)
|
||||
(let* ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000))
|
||||
(v1-5 (when s5-1
|
||||
(let ((t9-5 (method-of-type camera-master activate)))
|
||||
(t9-5
|
||||
(the-as camera-master s5-1)
|
||||
*camera-pool*
|
||||
'camera-master
|
||||
(the-as pointer #x70004000)
|
||||
)
|
||||
)
|
||||
((the-as (function process object function) set-to-run)
|
||||
(the-as process (-> s5-1 main-thread))
|
||||
cam-master-init
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! *camera* (the-as camera-master (if v1-5
|
||||
(-> v1-5 0 self)
|
||||
(let ((s5-1 (get-process *camera-master-dead-pool* camera-master #x4000)))
|
||||
(set! *camera* (the-as camera-master (ppointer->process (when s5-1
|
||||
(let
|
||||
((t9-5
|
||||
(method-of-type
|
||||
camera-master
|
||||
activate
|
||||
)
|
||||
)
|
||||
)
|
||||
(t9-5
|
||||
(the-as
|
||||
camera-master
|
||||
s5-1
|
||||
)
|
||||
*camera-pool*
|
||||
'camera-master
|
||||
(the-as
|
||||
pointer
|
||||
#x70004000
|
||||
)
|
||||
)
|
||||
)
|
||||
((the-as
|
||||
(function process object function)
|
||||
set-to-run
|
||||
)
|
||||
(the-as
|
||||
process
|
||||
(->
|
||||
s5-1
|
||||
main-thread
|
||||
)
|
||||
)
|
||||
cam-master-init
|
||||
)
|
||||
(-> s5-1 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
@@ -68,7 +86,3 @@
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(cam-start #f)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
(transv-out vector :inline :offset-assert 48)
|
||||
(local-normal vector :inline :offset-assert 64)
|
||||
(surface-normal vector :inline :offset-assert 80)
|
||||
(time uint64 :offset-assert 96)
|
||||
(time int64 :offset-assert 96)
|
||||
(status uint64 :offset-assert 104)
|
||||
(pat pat-surface :offset-assert 112)
|
||||
(reaction-flag uint32 :offset-assert 116)
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@
|
||||
((name basic :offset-assert 4)
|
||||
(length int16 :offset-assert 8)
|
||||
(allocated-length int16 :offset-assert 10)
|
||||
(engine-time uint64 :offset-assert 16)
|
||||
(engine-time int64 :offset-assert 16)
|
||||
(alive-list connectable :inline :offset-assert 32)
|
||||
(alive-list-end connectable :inline :offset-assert 48)
|
||||
(dead-list connectable :inline :offset-assert 64)
|
||||
|
||||
+19
-16
@@ -107,21 +107,21 @@
|
||||
|
||||
;; definition of type fact-info
|
||||
(deftype fact-info (basic)
|
||||
((process process :offset-assert 4)
|
||||
(pickup-type pickup-type :offset-assert 8)
|
||||
(pickup-amount float :offset-assert 12)
|
||||
(pickup-spawn-amount float :offset-assert 16)
|
||||
(options uint64 :offset-assert 24)
|
||||
(fade-time uint64 :offset-assert 32)
|
||||
((process process-drawable :offset-assert 4)
|
||||
(pickup-type pickup-type :offset-assert 8)
|
||||
(pickup-amount float :offset-assert 12)
|
||||
(pickup-spawn-amount float :offset-assert 16)
|
||||
(options uint64 :offset-assert 24)
|
||||
(fade-time uint64 :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 12
|
||||
:size-assert #x28
|
||||
:flag-assert #xc00000028
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
(TODO-RENAME-9 (_type_ symbol process-tree fact-info int) uint 9)
|
||||
(reset! (_type_ symbol) none 10)
|
||||
(dummy-11 (_type_) float 11)
|
||||
(pickup-collectable! (_type_ pickup-type float handle) float 11)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -150,7 +150,7 @@
|
||||
(eco-pill float :offset-assert 80)
|
||||
(eco-pill-max float :offset-assert 84)
|
||||
(health-pickup-time uint64 :offset-assert 88)
|
||||
(eco-source uint64 :offset-assert 96)
|
||||
(eco-source handle :offset-assert 96)
|
||||
(eco-source-time uint64 :offset-assert 104)
|
||||
(money-pickup-time uint64 :offset-assert 112)
|
||||
(buzzer-pickup-time uint64 :offset-assert 120)
|
||||
@@ -161,7 +161,7 @@
|
||||
:size-assert #x90
|
||||
:flag-assert #xc00000090
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
:size-assert #x44
|
||||
:flag-assert #xc00000044
|
||||
(:methods
|
||||
(new (symbol type process pickup-type float) _type_ 0)
|
||||
(new (symbol type process-drawable pickup-type float) _type_ 0)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -238,7 +238,7 @@
|
||||
fact-info
|
||||
((allocation symbol)
|
||||
(type-to-make type)
|
||||
(proc process)
|
||||
(proc process-drawable)
|
||||
(pkup-type pickup-type)
|
||||
(pkup-amount float)
|
||||
)
|
||||
@@ -343,7 +343,10 @@
|
||||
)
|
||||
|
||||
;; definition for method 11 of type fact-info
|
||||
(defmethod dummy-11 fact-info ((obj fact-info))
|
||||
(defmethod
|
||||
pickup-collectable!
|
||||
fact-info
|
||||
((obj fact-info) (arg0 pickup-type) (arg1 float) (arg2 handle))
|
||||
0.0
|
||||
)
|
||||
|
||||
@@ -353,7 +356,7 @@
|
||||
fact-info-enemy
|
||||
((allocation symbol)
|
||||
(type-to-make type)
|
||||
(arg0 process)
|
||||
(arg0 process-drawable)
|
||||
(arg1 pickup-type)
|
||||
(arg2 float)
|
||||
)
|
||||
@@ -482,7 +485,7 @@
|
||||
fact-info-target
|
||||
((allocation symbol)
|
||||
(type-to-make type)
|
||||
(arg0 process)
|
||||
(arg0 process-drawable)
|
||||
(arg1 pickup-type)
|
||||
(arg2 float)
|
||||
)
|
||||
@@ -494,7 +497,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> obj eco-source) (the-as uint #f))
|
||||
(set! (-> obj eco-source) (the-as handle #f))
|
||||
(reset! obj #f)
|
||||
obj
|
||||
)
|
||||
|
||||
@@ -197,7 +197,7 @@
|
||||
(death-movie-tick int32 :offset-assert 264)
|
||||
(want-auto-save symbol :offset-assert 268)
|
||||
(auto-save-proc handle :offset-assert 272)
|
||||
(auto-save-status uint32 :offset-assert 280)
|
||||
(auto-save-status mc-status-code :offset-assert 280)
|
||||
(auto-save-card int32 :offset-assert 284)
|
||||
(auto-save-which int32 :offset-assert 288)
|
||||
(pov-camera-handle handle :offset-assert 296)
|
||||
@@ -225,7 +225,7 @@
|
||||
(seen-text? (_type_ game-text-id) symbol 21)
|
||||
(mark-text-as-seen (_type_ game-text-id) none 22)
|
||||
(got-buzzer? (_type_ game-task int) symbol 23)
|
||||
(dummy-24 () none 24)
|
||||
(save-game! (_type_ game-save string) none 24)
|
||||
(load-game! (_type_ game-save) game-save 25)
|
||||
(clear-text-seen! (_type_ game-text-id) none 26)
|
||||
(get-death-count (_type_ symbol) int 27)
|
||||
|
||||
+1718
File diff suppressed because it is too large
Load Diff
+5
-50
@@ -64,56 +64,11 @@
|
||||
(format #t "~Tscreeny: ~D~%" (-> obj screeny))
|
||||
(format #t "~Tvibration: ~A~%" (-> obj vibration))
|
||||
(format #t "~Tplay-hints: ~A~%" (-> obj play-hints))
|
||||
(let ((t9-12 format)
|
||||
(a0-13 #t)
|
||||
(a1-12 "~Tmovie: ~A~%")
|
||||
(v1-0 (-> obj movie))
|
||||
)
|
||||
(t9-12 a0-13 a1-12 (if v1-0
|
||||
(-> v1-0 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t9-13 format)
|
||||
(a0-14 #t)
|
||||
(a1-13 "~Ttalking: ~A~%")
|
||||
(v1-2 (-> obj talking))
|
||||
)
|
||||
(t9-13 a0-14 a1-13 (if v1-2
|
||||
(-> v1-2 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t9-14 format)
|
||||
(a0-15 #t)
|
||||
(a1-14 "~Tspooling: ~A~%")
|
||||
(v1-4 (-> obj spooling))
|
||||
)
|
||||
(t9-14 a0-15 a1-14 (if v1-4
|
||||
(-> v1-4 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t9-15 format)
|
||||
(a0-16 #t)
|
||||
(a1-15 "~Thint: ~A~%")
|
||||
(v1-6 (-> obj hint))
|
||||
)
|
||||
(t9-15 a0-16 a1-15 (if v1-6
|
||||
(-> v1-6 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((t9-16 format)
|
||||
(a0-17 #t)
|
||||
(a1-16 "~Tambient: ~A~%")
|
||||
(v1-8 (-> obj ambient))
|
||||
)
|
||||
(t9-16 a0-17 a1-16 (if v1-8
|
||||
(-> v1-8 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(format #t "~Tmovie: ~A~%" (ppointer->process (-> obj movie)))
|
||||
(format #t "~Ttalking: ~A~%" (ppointer->process (-> obj talking)))
|
||||
(format #t "~Tspooling: ~A~%" (ppointer->process (-> obj spooling)))
|
||||
(format #t "~Thint: ~A~%" (ppointer->process (-> obj hint)))
|
||||
(format #t "~Tambient: ~A~%" (ppointer->process (-> obj ambient)))
|
||||
(format #t "~Tvideo-mode: ~A~%" (-> obj video-mode))
|
||||
(format #t "~Taspect-ratio: ~A~%" (-> obj aspect-ratio))
|
||||
(format #t "~Tsound-flava: ~D~%" (-> obj sound-flava))
|
||||
|
||||
+1
-8
@@ -42,14 +42,7 @@
|
||||
(zero?
|
||||
(logand (-> *kernel-context* prevent-from-run) (process-mask progress))
|
||||
)
|
||||
(let ((v1-18 (get-process conn))
|
||||
(a0-22 *progress-process*)
|
||||
)
|
||||
(= v1-18 (if a0-22
|
||||
(-> a0-22 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
(= (get-process conn) (ppointer->process *progress-process*))
|
||||
)
|
||||
(case (the-as symbol (-> conn param1))
|
||||
(('rel)
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
(num-success-before-killing int8 :offset-assert 13)
|
||||
(num-attempts int8 :offset-assert 14)
|
||||
(num-success int8 :offset-assert 15)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(last-time-called uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(last-time-called int64 :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x20
|
||||
|
||||
+12
-23
@@ -344,13 +344,9 @@
|
||||
)
|
||||
(when v1-0
|
||||
(when *hint-semaphore*
|
||||
(let ((v1-3 *hint-semaphore*))
|
||||
(set! v1-0 (dummy-15 (the-as level-hint (if v1-3
|
||||
(-> v1-3 0 self)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
v1-0
|
||||
(dummy-15 (the-as level-hint (ppointer->process *hint-semaphore*)))
|
||||
)
|
||||
0
|
||||
)
|
||||
@@ -358,9 +354,9 @@
|
||||
(and
|
||||
v1-0
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> *game-info* hint-play-time))
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as int (-> *game-info* hint-play-time))
|
||||
)
|
||||
30
|
||||
)
|
||||
@@ -377,7 +373,7 @@
|
||||
(not (-> *setting-control* current hint))
|
||||
(not (-> *setting-control* current ambient))
|
||||
(>=
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(-> *display* base-frame-counter)
|
||||
(the-as int (-> *game-info* blackout-time))
|
||||
)
|
||||
)
|
||||
@@ -401,11 +397,7 @@
|
||||
)
|
||||
(v1-21 #t)
|
||||
)
|
||||
(if
|
||||
(and
|
||||
(= (-> gp-1 num-attempts-before-playing) 1)
|
||||
(< (the-as int a0-24) 30)
|
||||
)
|
||||
(if (and (= (-> gp-1 num-attempts-before-playing) 1) (< a0-24 30))
|
||||
(+! (-> gp-1 start-time) a0-24)
|
||||
)
|
||||
(cond
|
||||
@@ -413,10 +405,7 @@
|
||||
(!= (-> gp-1 num-attempts-before-playing) 1)
|
||||
(nonzero? (-> gp-1 last-time-called))
|
||||
(<
|
||||
(the-as
|
||||
int
|
||||
(- (-> *display* base-frame-counter) (-> gp-1 last-time-called))
|
||||
)
|
||||
(- (-> *display* base-frame-counter) (-> gp-1 last-time-called))
|
||||
150
|
||||
)
|
||||
)
|
||||
@@ -428,7 +417,7 @@
|
||||
(when (nonzero? (-> gp-1 delay-before-playing))
|
||||
(if
|
||||
(<
|
||||
(the-as int (-> gp-1 start-time))
|
||||
(-> gp-1 start-time)
|
||||
(the-as int (-> gp-1 delay-before-playing))
|
||||
)
|
||||
(set! v1-21 #f)
|
||||
@@ -470,8 +459,8 @@
|
||||
(let ((v1-2 (length (-> *game-info* hint-control))))
|
||||
(dotimes (a0-1 v1-2)
|
||||
(let ((a1-2 (-> *game-info* hint-control a0-1)))
|
||||
(set! (-> a1-2 start-time) (the-as uint 0))
|
||||
(set! (-> a1-2 last-time-called) (the-as uint 0))
|
||||
(set! (-> a1-2 start-time) 0)
|
||||
(set! (-> a1-2 last-time-called) 0)
|
||||
(set! (-> a1-2 num-attempts) 0)
|
||||
(set! (-> a1-2 num-success) 0)
|
||||
)
|
||||
|
||||
+16
-16
@@ -173,22 +173,22 @@
|
||||
(last-screen int32 :offset-assert 564)
|
||||
(frames virtual-frame 6 :inline :offset-assert 568)
|
||||
(bg-clear-color rgba 4 :offset-assert 760)
|
||||
(real-frame-counter uint64 :offset-assert 776)
|
||||
(base-frame-counter uint64 :offset-assert 784)
|
||||
(game-frame-counter uint64 :offset-assert 792)
|
||||
(integral-frame-counter uint64 :offset-assert 800)
|
||||
(real-integral-frame-counter uint64 :offset-assert 808)
|
||||
(actual-frame-counter uint64 :offset-assert 816)
|
||||
(real-actual-frame-counter uint64 :offset-assert 824)
|
||||
(part-frame-counter uint64 :offset-assert 832)
|
||||
(old-real-frame-counter uint64 :offset-assert 840)
|
||||
(old-base-frame-counter uint64 :offset-assert 848)
|
||||
(old-game-frame-counter uint64 :offset-assert 856)
|
||||
(old-integral-frame-counter uint64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter uint64 :offset-assert 872)
|
||||
(old-actual-frame-counter uint64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter uint64 :offset-assert 888)
|
||||
(old-part-frame-counter uint64 :offset-assert 896)
|
||||
(real-frame-counter int64 :offset-assert 776)
|
||||
(base-frame-counter int64 :offset-assert 784)
|
||||
(game-frame-counter int64 :offset-assert 792)
|
||||
(integral-frame-counter int64 :offset-assert 800)
|
||||
(real-integral-frame-counter int64 :offset-assert 808)
|
||||
(actual-frame-counter int64 :offset-assert 816)
|
||||
(real-actual-frame-counter int64 :offset-assert 824)
|
||||
(part-frame-counter int64 :offset-assert 832)
|
||||
(old-real-frame-counter int64 :offset-assert 840)
|
||||
(old-base-frame-counter int64 :offset-assert 848)
|
||||
(old-game-frame-counter int64 :offset-assert 856)
|
||||
(old-integral-frame-counter int64 :offset-assert 864)
|
||||
(old-real-integral-frame-counter int64 :offset-assert 872)
|
||||
(old-actual-frame-counter int64 :offset-assert 880)
|
||||
(old-real-actual-frame-counter int64 :offset-assert 888)
|
||||
(old-part-frame-counter int64 :offset-assert 896)
|
||||
(time-ratio float :offset-assert 904)
|
||||
(seconds-per-frame float :offset-assert 908)
|
||||
(frames-per-second float :offset-assert 912)
|
||||
|
||||
+8
-8
@@ -185,12 +185,12 @@
|
||||
)
|
||||
(set-draw-env (-> disp draw0) psm w h ztest zpsm 384)
|
||||
(set-draw-env (-> disp draw1) psm w h ztest zpsm 320)
|
||||
(set! (-> disp base-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp game-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp real-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp part-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp integral-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp real-integral-frame-counter) (the-as uint #x493e0))
|
||||
(set! (-> disp base-frame-counter) #x493e0)
|
||||
(set! (-> disp game-frame-counter) #x493e0)
|
||||
(set! (-> disp real-frame-counter) #x493e0)
|
||||
(set! (-> disp part-frame-counter) #x493e0)
|
||||
(set! (-> disp integral-frame-counter) #x493e0)
|
||||
(set! (-> disp real-integral-frame-counter) #x493e0)
|
||||
(set! (-> disp old-base-frame-counter) (+ (-> disp base-frame-counter) -1))
|
||||
(set! (-> disp old-game-frame-counter) (+ (-> disp game-frame-counter) -1))
|
||||
(set! (-> disp old-real-frame-counter) (+ (-> disp real-frame-counter) -1))
|
||||
@@ -455,12 +455,12 @@
|
||||
(or
|
||||
(<
|
||||
75
|
||||
(the-as int (- (-> *display* real-frame-counter) (-> obj cache-time)))
|
||||
(- (-> *display* real-frame-counter) (the-as int (-> obj cache-time)))
|
||||
)
|
||||
(>= end-time (the-as int (-> worst-time-cache (/ bar-pos 10))))
|
||||
)
|
||||
(set! (-> worst-time-cache (/ bar-pos 10)) (the-as uint end-time))
|
||||
(set! (-> obj cache-time) (-> *display* real-frame-counter))
|
||||
(set! (-> obj cache-time) (the-as uint (-> *display* real-frame-counter)))
|
||||
)
|
||||
(cond
|
||||
(*profile-ticks*
|
||||
|
||||
+11
-2
@@ -70,7 +70,13 @@
|
||||
(defun ripple-update-waveform-offs ((arg0 ripple-wave-set))
|
||||
(let
|
||||
((f0-1
|
||||
(the float (- (-> *display* integral-frame-counter) (-> arg0 frame-save)))
|
||||
(the
|
||||
float
|
||||
(-
|
||||
(-> *display* integral-frame-counter)
|
||||
(the-as int (-> arg0 frame-save))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (!= f0-1 0.0)
|
||||
@@ -80,7 +86,10 @@
|
||||
(set! (-> a1-4 offs) (the float (logand (the int (-> a1-4 offs)) #xffff)))
|
||||
)
|
||||
)
|
||||
(set! (-> arg0 frame-save) (-> *display* integral-frame-counter))
|
||||
(set!
|
||||
(-> arg0 frame-save)
|
||||
(the-as uint (-> *display* integral-frame-counter))
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
|
||||
+10
-10
@@ -141,19 +141,19 @@
|
||||
|
||||
;; definition of type sparticle-launch-group
|
||||
(deftype sparticle-launch-group (basic)
|
||||
((length int16 :offset-assert 4)
|
||||
(duration uint16 :offset-assert 6)
|
||||
(linger-duration uint16 :offset-assert 8)
|
||||
(flags uint16 :offset-assert 10)
|
||||
(name basic :offset-assert 12)
|
||||
(launcher uint32 :offset-assert 16)
|
||||
(bounds sphere :inline :offset-assert 32)
|
||||
((length int16 :offset-assert 4)
|
||||
(duration uint16 :offset-assert 6)
|
||||
(linger-duration uint16 :offset-assert 8)
|
||||
(flags uint16 :offset-assert 10)
|
||||
(name basic :offset-assert 12)
|
||||
(launcher sparticle-group-item :offset-assert 16)
|
||||
(bounds sphere :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 10
|
||||
:size-assert #x30
|
||||
:flag-assert #xa00000030
|
||||
(:methods
|
||||
(dummy-9 (_type_ process) _type_ 9)
|
||||
(create-launch-control (_type_ process) sparticle-launch-control 9)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -188,8 +188,8 @@
|
||||
(:methods
|
||||
(dummy-9 () none 9)
|
||||
(dummy-10 () none 10)
|
||||
(dummy-11 () none 11)
|
||||
(dummy-12 () none 12)
|
||||
(dummy-11 (_type_ vector) none 11)
|
||||
(deactivate (_type_) none 12)
|
||||
(dummy-13 () none 13)
|
||||
)
|
||||
)
|
||||
|
||||
+2
-2
@@ -226,8 +226,8 @@
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for symbol *dgo-time*, type uint
|
||||
(define *dgo-time* (the-as uint 0))
|
||||
;; definition for symbol *dgo-time*, type int
|
||||
(define *dgo-time* 0)
|
||||
|
||||
;; definition for function dgo-load-begin
|
||||
;; Used lq/sq
|
||||
|
||||
+17
-44
@@ -939,11 +939,7 @@
|
||||
(set! (-> obj preload-stream name) arg0)
|
||||
(set! (-> obj preload-stream parts) arg1)
|
||||
(set! (-> obj preload-stream priority) arg3)
|
||||
(let ((v1-8 (if arg2
|
||||
(-> arg2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-8 (process->ppointer arg2)))
|
||||
(set!
|
||||
(-> obj preload-stream owner)
|
||||
(new 'static 'handle
|
||||
@@ -1010,11 +1006,7 @@
|
||||
(set! (-> obj rec 0 name) arg0)
|
||||
(set! (-> obj rec 0 parts) arg1)
|
||||
(set! (-> obj rec 0 priority) arg3)
|
||||
(let ((v1-34 (if arg2
|
||||
(-> arg2 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-34 (process->ppointer arg2)))
|
||||
(set!
|
||||
(-> obj rec 0 owner)
|
||||
(new 'static 'handle
|
||||
@@ -1029,12 +1021,7 @@
|
||||
(set! (-> obj rec 1 name) arg0)
|
||||
(set! (-> obj rec 1 parts) arg1)
|
||||
(set! (-> obj rec 1 priority) arg3)
|
||||
(let* ((a0-18 arg2)
|
||||
(v1-40 (if a0-18
|
||||
(-> a0-18 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-40 (process->ppointer arg2)))
|
||||
(set!
|
||||
(-> obj rec 1 owner)
|
||||
(new 'static 'handle
|
||||
@@ -1048,12 +1035,7 @@
|
||||
(set! (-> obj rec 2 name) arg0)
|
||||
(set! (-> obj rec 2 parts) arg1)
|
||||
(set! (-> obj rec 2 priority) arg3)
|
||||
(let* ((a0-22 arg2)
|
||||
(v1-44 (if a0-22
|
||||
(-> a0-22 ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-44 (process->ppointer arg2)))
|
||||
(set!
|
||||
(-> obj rec 2 owner)
|
||||
(new 'static 'handle
|
||||
@@ -1101,18 +1083,13 @@
|
||||
(set! sv-56 0)
|
||||
(set! spool-sound (new-sound-id))
|
||||
(dummy-17 *load-state* (-> arg0 command-list))
|
||||
(let* ((a0-2 *setting-control*)
|
||||
(t9-2 (method-of-object a0-2 set-setting!))
|
||||
(a1-2 self)
|
||||
(a2-1 'spooling)
|
||||
(v1-6 self)
|
||||
)
|
||||
(t9-2 a0-2 a1-2 a2-1 (the-as symbol (if v1-6
|
||||
(-> v1-6 ppointer)
|
||||
)
|
||||
)
|
||||
0.0 0
|
||||
)
|
||||
(set-setting!
|
||||
*setting-control*
|
||||
self
|
||||
'spooling
|
||||
(the-as symbol (process->ppointer self))
|
||||
0.0
|
||||
0
|
||||
)
|
||||
(logior! (-> self skel status) 7)
|
||||
(kill-current-level-hint '() '() 'die)
|
||||
@@ -1168,11 +1145,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-46 (if self
|
||||
(-> self ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-46 (process->ppointer self)))
|
||||
(set!
|
||||
(-> *art-control* spool-lock)
|
||||
(new 'static 'handle
|
||||
@@ -1181,7 +1154,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! sv-48 (the-as int (-> *display* base-frame-counter)))
|
||||
(set! sv-48 (-> *display* base-frame-counter))
|
||||
(while (< spool-part (-> arg0 parts))
|
||||
(let* ((a0-27 *art-control*)
|
||||
(t9-13 (method-of-object a0-27 spool-push))
|
||||
@@ -1286,7 +1259,7 @@
|
||||
)
|
||||
)
|
||||
(set! sv-72 (current-str-pos spool-sound))
|
||||
(set! sv-40 (the-as int (-> *display* base-frame-counter)))
|
||||
(set! sv-40 (-> *display* base-frame-counter))
|
||||
(until (>= (the float v0-39) f28-0)
|
||||
(if (= (-> self skel root-channel 0) (-> self skel channel))
|
||||
(logior! (-> self skel status) 32)
|
||||
@@ -1296,7 +1269,7 @@
|
||||
(arg3 self)
|
||||
(and
|
||||
(<= sv-72 0)
|
||||
(>= (the-as int (- (-> *display* base-frame-counter) sv-40)) 1200)
|
||||
(>= (- (-> *display* base-frame-counter) sv-40) 1200)
|
||||
)
|
||||
(and (< 300 sv-56) (<= sv-72 0))
|
||||
)
|
||||
@@ -1338,14 +1311,14 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! sv-40 (the-as int (-> *display* base-frame-counter)))
|
||||
(set! sv-40 (-> *display* base-frame-counter))
|
||||
)
|
||||
(else
|
||||
0
|
||||
)
|
||||
)
|
||||
(set! sv-32 sv-72)
|
||||
(set! sv-48 (the-as int (-> *display* base-frame-counter)))
|
||||
(set! sv-48 (-> *display* base-frame-counter))
|
||||
(suspend)
|
||||
(let
|
||||
((f0-14 (* (- (the float (current-str-pos spool-sound)) sv-24) f30-0))
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
(rotv vector :inline :offset-assert 80)
|
||||
(scalev vector :inline :offset-assert 96)
|
||||
(dir-targ quaternion :inline :offset-assert 112)
|
||||
(angle-change-time uint64 :offset-assert 128)
|
||||
(angle-change-time int64 :offset-assert 128)
|
||||
(old-y-angle-diff float :offset-assert 136)
|
||||
)
|
||||
:method-count-assert 28
|
||||
|
||||
+3
-6
@@ -76,12 +76,9 @@
|
||||
(or
|
||||
(and (< saturated-yaw 0.0) (< old-diff 0.0))
|
||||
(>=
|
||||
(the-as
|
||||
int
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(-> obj angle-change-time)
|
||||
)
|
||||
(-
|
||||
(-> *display* base-frame-counter)
|
||||
(-> obj angle-change-time)
|
||||
)
|
||||
60
|
||||
)
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@
|
||||
(defun show-mc-info ((dma-buf dma-buffer))
|
||||
(let ((info (new 'stack-no-clear 'mc-slot-info)))
|
||||
(dotimes (slot-idx 2)
|
||||
(mc-get-slot-info slot-idx)
|
||||
(mc-get-slot-info slot-idx info)
|
||||
(cond
|
||||
((zero? (-> info known))
|
||||
(format (clear *temp-string*) "SLOT ~D: EXAMINING SLOT~%" slot-idx)
|
||||
|
||||
+6
-12
@@ -50,10 +50,10 @@
|
||||
(align uint8 6 :offset-assert 88)
|
||||
(direct uint8 6 :offset-assert 94)
|
||||
(buzz-val uint8 2 :offset-assert 100)
|
||||
(buzz-time uint64 2 :offset-assert 104)
|
||||
(buzz-time int64 2 :offset-assert 104)
|
||||
(buzz basic :offset-assert 120)
|
||||
(buzz-act int32 :offset-assert 124)
|
||||
(change-time uint64 :offset-assert 128)
|
||||
(change-time int64 :offset-assert 128)
|
||||
)
|
||||
:method-count-assert 9
|
||||
:size-assert #x88
|
||||
@@ -122,7 +122,7 @@
|
||||
)
|
||||
(dotimes (v1-17 2)
|
||||
(set! (-> pad buzz-val 0) (the-as uint 0))
|
||||
(set! (-> pad buzz-time 0) (the-as uint 0))
|
||||
(set! (-> pad buzz-time 0) 0)
|
||||
)
|
||||
pad
|
||||
)
|
||||
@@ -214,10 +214,7 @@
|
||||
((= buzz-amount (-> pad buzz-val buzz-idx))
|
||||
(set!
|
||||
(-> pad buzz-time buzz-idx)
|
||||
(max
|
||||
(the-as int (-> pad buzz-time buzz-idx))
|
||||
(the-as int (+ (get-current-time) duration))
|
||||
)
|
||||
(max (-> pad buzz-time buzz-idx) (+ (get-current-time) duration))
|
||||
)
|
||||
)
|
||||
((< (-> pad buzz-val buzz-idx) (the-as uint buzz-amount))
|
||||
@@ -247,10 +244,7 @@
|
||||
(cond
|
||||
((and
|
||||
(-> pad buzz)
|
||||
(<
|
||||
(the-as int (get-current-time))
|
||||
(the-as int (-> pad buzz-time buzz-idx))
|
||||
)
|
||||
(< (get-current-time) (-> pad buzz-time buzz-idx))
|
||||
(= *master-mode* 'game)
|
||||
)
|
||||
(let ((v1-10 buzz-idx))
|
||||
@@ -261,7 +255,7 @@
|
||||
(logand
|
||||
(ash
|
||||
(-> pad buzz-val buzz-idx)
|
||||
(- (the-as int (logand (get-integral-current-time) 7)))
|
||||
(- (logand (get-integral-current-time) 7))
|
||||
)
|
||||
1
|
||||
)
|
||||
|
||||
+3
-3
@@ -764,9 +764,9 @@
|
||||
(playing-id sound-id :offset-assert 8)
|
||||
(trans vector :inline :offset-assert 16)
|
||||
(name sound-name :offset-assert 32)
|
||||
(play-time uint64 :offset-assert 48)
|
||||
(time-base uint64 :offset-assert 56)
|
||||
(time-random uint64 :offset-assert 64)
|
||||
(play-time int64 :offset-assert 48)
|
||||
(time-base int64 :offset-assert 56)
|
||||
(time-random int64 :offset-assert 64)
|
||||
(volume int32 :offset-assert 72)
|
||||
(pitch int32 :offset-assert 76)
|
||||
(falloff-near int32 :offset-assert 80)
|
||||
|
||||
+11
-18
@@ -797,15 +797,15 @@
|
||||
(sv-48
|
||||
(set!
|
||||
(-> obj time-base)
|
||||
(the-as uint (the int (* 300.0 (-> sv-48 0))))
|
||||
(the int (* 300.0 (-> sv-48 0)))
|
||||
)
|
||||
(set!
|
||||
(-> obj time-random)
|
||||
(the-as uint (the int (* 300.0 (-> sv-48 1))))
|
||||
(the int (* 300.0 (-> sv-48 1)))
|
||||
)
|
||||
)
|
||||
(else
|
||||
(set! (-> obj time-base) (the-as uint -1))
|
||||
(set! (-> obj time-base) -1)
|
||||
)
|
||||
)
|
||||
(set! (-> obj trans quad) (-> arg1 quad))
|
||||
@@ -830,19 +830,16 @@
|
||||
((-> obj spec)
|
||||
(when
|
||||
(or
|
||||
(< (the-as int (-> obj time-base)) 0)
|
||||
(>=
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(the-as int (-> obj play-time))
|
||||
)
|
||||
(< (-> obj time-base) 0)
|
||||
(>= (-> *display* base-frame-counter) (-> obj play-time))
|
||||
)
|
||||
(when (>= (the-as int (-> obj time-base)) 0)
|
||||
(when (>= (-> obj time-base) 0)
|
||||
(set!
|
||||
(-> obj play-time)
|
||||
(+
|
||||
(-> *display* base-frame-counter)
|
||||
(-> obj time-base)
|
||||
(rand-vu-int-count (the-as int (-> obj time-random)))
|
||||
(rand-vu-int-count (-> obj time-random))
|
||||
)
|
||||
)
|
||||
(set! (-> obj playing-id) (new-sound-id))
|
||||
@@ -869,7 +866,7 @@
|
||||
)
|
||||
(return 0)
|
||||
)
|
||||
(when (and *debug-effect-control* (>= (the-as int (-> obj time-base)) 0))
|
||||
(when (and *debug-effect-control* (>= (-> obj time-base) 0))
|
||||
(format
|
||||
#t
|
||||
"(~5D) effect sound ~A ~G "
|
||||
@@ -895,7 +892,7 @@
|
||||
)
|
||||
)
|
||||
)
|
||||
((< (the-as int (-> obj time-base)) 0)
|
||||
((< (-> obj time-base) 0)
|
||||
(set!
|
||||
(-> obj playing-id)
|
||||
(sound-play-by-name
|
||||
@@ -910,11 +907,7 @@
|
||||
)
|
||||
)
|
||||
(else
|
||||
(when
|
||||
(>=
|
||||
(the-as int (-> *display* base-frame-counter))
|
||||
(the-as int (-> obj play-time))
|
||||
)
|
||||
(when (>= (-> *display* base-frame-counter) (-> obj play-time))
|
||||
(set!
|
||||
(-> obj playing-id)
|
||||
(sound-play-by-name
|
||||
@@ -932,7 +925,7 @@
|
||||
(+
|
||||
(-> *display* base-frame-counter)
|
||||
(-> obj time-base)
|
||||
(rand-vu-int-count (the-as int (-> obj time-random)))
|
||||
(rand-vu-int-count (-> obj time-random))
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
+2
-11
@@ -12,7 +12,7 @@
|
||||
(trans vector :inline :offset-assert 64)
|
||||
(quat quaternion :inline :offset-assert 80)
|
||||
(scale vector :inline :offset-assert 96)
|
||||
(notice-time uint64 :offset-assert 112)
|
||||
(notice-time int64 :offset-assert 112)
|
||||
(flex-blend float :offset-assert 120)
|
||||
(blend float :offset-assert 124)
|
||||
(max-dist meters :offset-assert 128)
|
||||
@@ -295,16 +295,7 @@
|
||||
)
|
||||
)
|
||||
(set! (-> obj notice-time) (-> *display* base-frame-counter))
|
||||
(let ((v1-12 (if proc
|
||||
(-> proc ppointer)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set!
|
||||
(-> last-try-to-look-at-data who)
|
||||
(new 'static 'handle :process v1-12 :pid (-> v1-12 0 pid))
|
||||
)
|
||||
)
|
||||
(set! (-> last-try-to-look-at-data who) (process->handle proc))
|
||||
(if (< (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
|
||||
(set! (-> last-try-to-look-at-data vert) (-> enemy-facts cam-vert))
|
||||
)
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
|
||||
;; definition of type smush-control
|
||||
(deftype smush-control (structure)
|
||||
((start-time uint64 :offset-assert 0)
|
||||
(period float :offset-assert 8)
|
||||
(duration float :offset-assert 12)
|
||||
(amp float :offset-assert 16)
|
||||
(damp-amp float :offset-assert 20)
|
||||
(damp-period float :offset-assert 24)
|
||||
(ticks float :offset-assert 28)
|
||||
((start-time int64 :offset-assert 0)
|
||||
(period float :offset-assert 8)
|
||||
(duration float :offset-assert 12)
|
||||
(amp float :offset-assert 16)
|
||||
(damp-amp float :offset-assert 20)
|
||||
(damp-period float :offset-assert 24)
|
||||
(ticks float :offset-assert 28)
|
||||
)
|
||||
:method-count-assert 15
|
||||
:size-assert #x20
|
||||
|
||||
+7
-11
@@ -78,12 +78,12 @@
|
||||
|
||||
;; definition of type delayed-rand-float
|
||||
(deftype delayed-rand-float (structure)
|
||||
((min-time int32 :offset-assert 0)
|
||||
(max-time int32 :offset-assert 4)
|
||||
(max-val float :offset-assert 8)
|
||||
(timer int32 :offset-assert 12)
|
||||
(start-time uint64 :offset-assert 16)
|
||||
(value float :offset-assert 24)
|
||||
((min-time int32 :offset-assert 0)
|
||||
(max-time int32 :offset-assert 4)
|
||||
(max-val float :offset-assert 8)
|
||||
(timer int32 :offset-assert 12)
|
||||
(start-time int64 :offset-assert 16)
|
||||
(value float :offset-assert 24)
|
||||
)
|
||||
:method-count-assert 11
|
||||
:size-assert #x1c
|
||||
@@ -173,7 +173,7 @@
|
||||
(xz-max float :offset-assert 8)
|
||||
(y-max float :offset-assert 12)
|
||||
(timer int32 :offset-assert 16)
|
||||
(start-time uint64 :offset-assert 24)
|
||||
(start-time int64 :offset-assert 24)
|
||||
(value vector :inline :offset-assert 32)
|
||||
)
|
||||
:method-count-assert 13
|
||||
@@ -232,7 +232,3 @@
|
||||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user