decompiler: detect light-trail-tracker-spawn macro (#4317)

This commit is contained in:
Hat Kid
2026-06-17 18:57:59 +02:00
committed by GitHub
parent 0b799821ed
commit 0f9beb4610
33 changed files with 729 additions and 706 deletions
+6 -1
View File
@@ -82,12 +82,14 @@ struct LetRewriteStats {
int call_parent_state_handler = 0;
int suspend_for = 0;
int font_method = 0;
int light_trail_tracker_spawn = 0;
int total() const {
return dotimes + countdown + abs + abs2 + unused + ja + case_no_else + case_with_else +
set_vector + set_vector2 + send_event + font_context_meth + proc_new + attack_info +
vector_dot + rand_float_gen + set_let + with_dma_buf_add_bucket + dma_buffer_add_gs_set +
launch_particles + call_parent_state_handler + suspend_for + font_method;
launch_particles + call_parent_state_handler + suspend_for + font_method +
light_trail_tracker_spawn;
}
std::string print() const {
@@ -117,6 +119,7 @@ struct LetRewriteStats {
out += fmt::format(" call_parent_state_handler: {}\n", call_parent_state_handler);
out += fmt::format(" suspend_for: {}\n", suspend_for);
out += fmt::format(" font_method: {}\n", font_method);
out += fmt::format(" light_trail_tracker_spawn: {}\n", light_trail_tracker_spawn);
return out;
}
@@ -143,6 +146,7 @@ struct LetRewriteStats {
result.launch_particles = launch_particles + other.launch_particles;
result.call_parent_state_handler = call_parent_state_handler + other.call_parent_state_handler;
result.suspend_for = suspend_for + other.suspend_for;
result.light_trail_tracker_spawn = light_trail_tracker_spawn + other.light_trail_tracker_spawn;
return result;
}
@@ -168,6 +172,7 @@ struct LetRewriteStats {
launch_particles += other.launch_particles;
call_parent_state_handler += other.call_parent_state_handler;
suspend_for += other.suspend_for;
light_trail_tracker_spawn += other.light_trail_tracker_spawn;
return *this;
}
};
+308
View File
@@ -1810,6 +1810,308 @@ FormElement* rewrite_part_tracker_new_jak2(const std::string& type,
->try_as_single_element();
}
FormElement* rewrite_light_trail_tracker_spawn(LetElement* in, const Env& env, FormPool& pool) {
// (let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
// (set! (-> s5-0 tracked-obj) (process->handle this))
// (set! (-> s5-0 appearance) *blue-shot-trail*)
// (set! (-> s5-0 max-num-crumbs) (the int (* 0.2 (the float (-> s5-0 appearance max-age)))))
// (set! (-> s5-0 track-immediately?) #t)
// (let* ((v1-30 (estimate-light-trail-mem-usage
// (the-as uint (-> s5-0 max-num-crumbs))
// (the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips)))))
// (s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1)))
// (when s4-0
// (let ((t9-4 (method-of-type process activate)))
// (t9-4 s4-0 this "light-trail" (the-as pointer #x70004000)))
// (run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
// (-> s4-0 ppointer))))
// ->
// (light-trail-tracker-spawn light-trail-tracker-blue-3 :to this
// :params ((tracked-obj (process->handle this))
// (appearance *blue-shot-trail*)
// (max-num-crumbs (the int (* 0.2 (the float (-> *blue-shot-trail* max-age)))))
// (track-immediately? #t)))
if (env.version < GameVersion::Jak3) {
return nullptr;
}
if (in->entries().size() != 1) {
return nullptr;
}
auto params_var = in->entries().at(0).dest;
const auto& params_reg = params_var.reg();
auto params_src = in->entries().at(0).src->try_as_element<StackStructureDefElement>();
if (!params_src) {
return nullptr;
}
const auto& params_type = params_src->entry().ref_type;
if (!env.dts->ts.tc(TypeSpec("light-trail-tracker-spawn-params"), params_type)) {
return nullptr;
}
if (params_src->entry().hint.container_type != StackStructureHint::ContainerType::NONE) {
return nullptr;
}
auto body = in->body();
if (body->size() < 2) {
return nullptr;
}
// grab all the field setters
std::vector<std::pair<std::string, Form*>> fields;
std::unordered_map<std::string, Form*> field_values;
for (size_t idx = 0; idx + 1 < body->size(); ++idx) {
auto set_mr = match(Matcher::set(Matcher::deref(Matcher::reg(params_reg), false,
{DerefTokenMatcher::any_string(0)}),
Matcher::any(1)),
body->at(idx));
if (!set_mr.matched) {
return nullptr;
}
const auto& field_name = set_mr.maps.strings.at(0);
auto field_val = set_mr.maps.forms.at(1);
fields.emplace_back(field_name, field_val);
field_values[field_name] = field_val;
}
// (let ((v1-30 (estimate...))) (let ((s4-0 (get-process...))) (when s4-0 ...)))
auto mem_let = dynamic_cast<LetElement*>(body->at(body->size() - 1));
if (!mem_let || mem_let->entries().size() != 1 || mem_let->body()->size() != 1) {
return nullptr;
}
// (v1-30 (estimate-light-trail-mem-usage ...))
auto mem_var = mem_let->entries().at(0).dest;
auto est = mem_let->entries().at(0).src->try_as_element<GenericElement>();
if (!est || est->op().kind() != GenericOperator::Kind::FUNCTION_EXPR || !est->op().func() ||
!est->op().func()->to_form(env).is_symbol("estimate-light-trail-mem-usage")) {
return nullptr;
}
auto proc_let = dynamic_cast<LetElement*>(mem_let->body()->at(0));
if (!proc_let || proc_let->entries().size() != 1 || proc_let->body()->size() != 1) {
return nullptr;
}
// (s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1))
auto proc_var = proc_let->entries().at(0).dest;
const auto& proc_reg = proc_var.reg();
auto gp_mr = match(Matcher::func("get-process", {Matcher::any(0), Matcher::any_symbol(1),
Matcher::any(2), Matcher::any_integer(3)}),
proc_let->entries().at(0).src);
if (!gp_mr.matched) {
return nullptr;
}
const auto& proc_type = gp_mr.maps.strings.at(1);
if (!env.dts->ts.tc(TypeSpec("light-trail-tracker"), TypeSpec(proc_type))) {
return nullptr;
}
auto from_form = gp_mr.maps.forms.at(0);
auto unk = gp_mr.maps.ints.at(3);
// stack size is always (+ <estimated-mem> 8192)
if (!match(Matcher::op(GenericOpMatcher::or_match(
{GenericOpMatcher::fixed(FixedOperatorKind::ADDITION),
GenericOpMatcher::fixed(FixedOperatorKind::ADDITION_PTR)}),
{Matcher::reg(mem_var.reg()), Matcher::integer(8192)}),
gp_mr.maps.forms.at(2))
.matched) {
return nullptr;
}
// check the when
auto cast_type = TypeSpec("pointer", {TypeSpec(proc_type)});
auto when_matcher = Matcher::if_no_else(
Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY),
{Matcher::reg(proc_reg)}),
Matcher::begin({Matcher::any(0),
Matcher::func_with_rest(Matcher::constant_token("run-now-in-process"),
{Matcher::reg(proc_reg), Matcher::any(1)}),
Matcher::any(2)}));
auto mr_with_shell = rewrite_shelled_return_form(
when_matcher, proc_let->body()->at(0), env, pool,
[&](FormElement* s_in, const MatchResult& /*mr*/, const Env& env_, FormPool& pool_) -> Form* {
auto as_when = dynamic_cast<CondNoElseElement*>(s_in);
if (!as_when) {
return nullptr;
}
const auto& when_body = as_when->entries.front().body->elts();
if (when_body.size() != 3) {
return nullptr;
}
// (let ((t9-4 (method-of-type process activate)))
// (t9-4 s4-0 this "light-trail" (the-as pointer #x70004000)))
auto activate_let = dynamic_cast<LetElement*>(when_body.at(0));
if (!activate_let || activate_let->entries().size() != 1 ||
activate_let->body()->size() != 1) {
return nullptr;
}
if (!match(Matcher::op_fixed(
FixedOperatorKind::METHOD_OF_TYPE,
{Matcher::symbol("process"), Matcher::constant_token("activate")}),
activate_let->entries().at(0).src)
.matched) {
return nullptr;
}
auto act_fn_reg = activate_let->entries().at(0).dest;
auto act_call_mr = match(
Matcher::func(Matcher::reg(act_fn_reg.reg()), {Matcher::reg(proc_reg), Matcher::any(0),
Matcher::any(1), Matcher::any(2)}),
activate_let->body()->at(0));
if (!act_call_mr.matched) {
return nullptr;
}
auto to_form = act_call_mr.maps.forms.at(0);
auto name_form = act_call_mr.maps.forms.at(1);
auto stack_form = act_call_mr.maps.forms.at(2);
// (run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
auto run_gen = dynamic_cast<GenericElement*>(when_body.at(1));
if (!run_gen || !run_gen->op().func() ||
!run_gen->op().func()->to_form(env_).is_symbol("run-now-in-process")) {
return nullptr;
}
if (run_gen->elts().size() != 3) {
return nullptr;
}
auto init_form = run_gen->elts().at(1);
if (!match(Matcher::reg(params_reg), run_gen->elts().at(2)).matched) {
return nullptr;
}
// (-> s4-0 ppointer)
auto pptr_matcher =
Matcher::deref(Matcher::reg(proc_reg), false, {DerefTokenMatcher::string("ppointer")});
auto pptr_let = dynamic_cast<LetElement*>(when_body.at(2));
if (pptr_let) {
auto new_pptr = rewrite_empty_let(pptr_let, env, pool);
if (!new_pptr || !match(pptr_matcher, new_pptr).matched) {
return nullptr;
}
} else if (!match(pptr_matcher, when_body.at(2)).matched) {
return nullptr;
}
auto is_simple_base = [](Form* f) {
auto single = f->try_as_single_element();
if (!single) {
return false;
}
return dynamic_cast<DerefElement*>(single) || dynamic_cast<SimpleAtomElement*>(single) ||
dynamic_cast<SimpleExpressionElement*>(single) ||
dynamic_cast<ConstantTokenElement*>(single);
};
// dry run to check we can substitute all the derefs
for (auto& field : fields) {
Form* fval = field.second;
RegAccessSet uses;
fval->collect_vars(uses, true);
int var_uses = 0;
for (const auto& u : uses) {
if (u.reg() == params_reg) {
var_uses++;
}
}
if (var_uses == 0) {
continue;
}
int subst_derefs = 0;
bool bad = false;
fval->apply_form([&](Form* f) {
for (auto* e : f->elts()) {
auto deref = dynamic_cast<DerefElement*>(e);
if (!deref || !match(Matcher::reg(params_reg), deref->base()).matched) {
continue;
}
subst_derefs++;
if (deref->tokens().empty() ||
deref->tokens().at(0).kind() != DerefToken::Kind::FIELD_NAME) {
bad = true;
continue;
}
auto it = field_values.find(deref->tokens().at(0).field_name());
if (it == field_values.end() || !is_simple_base(it->second)) {
bad = true;
}
}
});
if (bad || subst_derefs != var_uses) {
return nullptr;
}
}
// do the inlining
for (auto& field : fields) {
Form* fval = field.second;
fval->apply_form([&](Form* f) {
for (auto*& e : f->elts()) {
auto deref = dynamic_cast<DerefElement*>(e);
if (!deref || !match(Matcher::reg(params_reg), deref->base()).matched) {
continue;
}
auto repl_base = field_values.at(deref->tokens().at(0).field_name());
std::vector rest(deref->tokens().begin() + 1, deref->tokens().end());
if (rest.empty()) {
e = repl_base->try_as_single_element();
} else {
e = pool_.alloc_element<DerefElement>(repl_base, deref->is_addr_of(), rest);
}
}
});
}
std::vector<Form*> args;
args.push_back(pool_.form<ConstantTokenElement>(proc_type));
if (!init_form->to_form(env_).is_symbol("light-trail-tracker-init-by-other")) {
ja_push_form_to_args(pool_, args, init_form, "init");
}
if (params_type != TypeSpec("light-trail-tracker-spawn-params")) {
args.push_back(pool_.form<ConstantTokenElement>(":params-type"));
args.push_back(pool_.form<ConstantTokenElement>(params_type.base_type()));
}
if (!from_form->to_form(env_).is_symbol("*default-dead-pool*")) {
ja_push_form_to_args(pool_, args, from_form, "from");
}
ja_push_form_to_args(pool_, args, to_form, "to");
auto name_str = dynamic_cast<StringConstantElement*>(name_form->try_as_single_element());
if (!name_str || name_str->value() != "light-trail") {
ja_push_form_to_args(pool_, args, name_form, "name");
}
if (stack_form->to_string(env_) != "(the-as pointer #x70004000)") {
ja_push_form_to_args(pool_, args, stack_form, "stack");
}
if (unk != 1) {
args.push_back(pool_.form<ConstantTokenElement>(":unk"));
args.push_back(pool_.form<ConstantTokenElement>(fmt::format("{}", unk)));
}
std::vector<Form*> param_pairs;
for (auto& [fname, fval] : fields) {
param_pairs.push_back(pool_.form<GenericElement>(
GenericOperator::make_function(pool_.form<ConstantTokenElement>(fname)), fval));
}
args.push_back(pool_.form<ConstantTokenElement>(":param-list"));
auto params_head = GenericOperator::make_function(param_pairs.at(0));
std::vector params_rest(param_pairs.begin() + 1, param_pairs.end());
args.push_back(pool_.form<GenericElement>(params_head, params_rest));
return pool_.form<GenericElement>(
GenericOperator::make_function(
pool_.form<ConstantTokenElement>("light-trail-tracker-spawn")),
args);
},
&cast_type);
if (!std::get<0>(mr_with_shell).matched) {
return nullptr;
}
return std::get<1>(mr_with_shell)->try_as_single_element();
}
FormElement* rewrite_call_parent_state_handler(LetElement* in, const Env& env, FormPool& pool) {
// (let ((t9-3 (-> (find-parent-state) code)))
// (if t9-3
@@ -2501,6 +2803,12 @@ FormElement* rewrite_let(LetElement* in, const Env& env, FormPool& pool, LetRewr
return as_abs;
}
auto as_light_trail_tracker_spawn = rewrite_light_trail_tracker_spawn(in, env, pool);
if (as_light_trail_tracker_spawn) {
stats.light_trail_tracker_spawn++;
return as_light_trail_tracker_spawn;
}
auto as_proc_new = rewrite_proc_new(in, env, pool);
if (as_proc_new) {
stats.proc_new++;
@@ -2346,7 +2346,7 @@
[213, "s0", "continue-point"],
[222, "s0", "continue-point"]
],
"master-choose-entity": [[162, "s0", "(pointer camera-slave)"]],
"master-choose-entity": [["_stack_", 96, "res-tag"], [162, "s0", "(pointer camera-slave)"]],
"bones-mtx-calc-execute": [
[[126, 154], "a0", "pris-mtx"],
[[126, 154], "a1", "pris-mtx"],
+52 -61
View File
@@ -359,7 +359,6 @@
)
(defbehavior master-choose-entity camera-master ((arg0 cam-setting-data))
(local-vars (r0-0 uint128) (v1-44 uint128))
(let ((s5-0 (entity-by-name (-> arg0 entity-name))))
(set! (-> arg0 real-entity-name) #f)
(when s5-0
@@ -376,8 +375,8 @@
(format 0 "ERROR <GMJ>: camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure))
)
)
(let* ((sv-96 0)
(s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96))))
(let* ((sv-96 (new 'static 'res-tag))
(s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96)))
)
(when s4-1
(let ((s3-1 (process-spawn
@@ -395,79 +394,71 @@
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s3-1)))
(format 0 "ERROR <GMJ>: primary region activate failed~%")
)
(let ((s2-1 0))
(while (begin
(let ((v1-43 (the-as uint128 sv-96)))
(.pcpyud v1-44 v1-43 r0-0)
)
(< s2-1 (shr (* (the-as int v1-44) 2) 49))
)
(let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))))
(cond
(sv-128
(let ((s1-2 (cam-state-from-entity sv-128)))
(cond
(s1-2
(let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1))
(s0-0 (when sv-112
((method-of-type camera-slave activate)
(the-as camera-slave sv-112)
*camera*
"camera-slave"
(the-as pointer #x70004000)
)
(run-now-in-process sv-112 cam-slave-init s1-2 sv-128)
(-> sv-112 ppointer)
)
(dotimes (s2-1 (the-as int (-> sv-96 elt-count)))
(let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))))
(cond
(sv-128
(let ((s1-2 (cam-state-from-entity sv-128)))
(cond
(s1-2
(let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1))
(s0-0 (when sv-112
((method-of-type camera-slave activate)
(the-as camera-slave sv-112)
*camera*
"camera-slave"
(the-as pointer #x70004000)
)
(run-now-in-process sv-112 cam-slave-init s1-2 sv-128)
(-> sv-112 ppointer)
)
)
(cond
(s0-0
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0)))
(cond
((master-is-hopeful-better?
(the-as camera-slave (ppointer->process s3-1))
(the-as camera-slave (ppointer->process s0-0))
)
(if s3-1
(deactivate (-> s3-1 0))
)
(set! s3-1 (the-as (pointer camera-slave) s0-0))
(set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))
(set! (-> arg0 cam-mode) (the-as symbol s1-2))
)
(cond
(s0-0
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0)))
(cond
((master-is-hopeful-better?
(the-as camera-slave (ppointer->process s3-1))
(the-as camera-slave (ppointer->process s0-0))
)
(else
(deactivate (-> s0-0 0))
)
(if s3-1
(deactivate (-> s3-1 0))
)
(set! s3-1 (the-as (pointer camera-slave) s0-0))
(set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))
(set! (-> arg0 cam-mode) (the-as symbol s1-2))
)
(else
(deactivate (-> s0-0 0))
)
)
(else
(format 0 "ERROR <GMJ>: alternate region activate failed~%")
)
)
(else
(format 0 "ERROR <GMJ>: alternate region activate failed~%")
)
)
)
(else
(format
0
"ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%"
(res-lump-struct sv-128 'name structure)
)
)
(else
(format
0
"ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%"
(res-lump-struct sv-128 'name structure)
)
)
)
)
(else
(format
0
"ERROR <GMJ>: alternate '~S' not found for '~S'~%"
(-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))
(res-lump-struct s5-0 'name structure)
)
)
(else
(format
0
"ERROR <GMJ>: alternate '~S' not found for '~S'~%"
(-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))
(res-lump-struct s5-0 'name structure)
)
)
)
(+! s2-1 1)
)
)
(if s3-1
+13 -26
View File
@@ -183,34 +183,21 @@
(set! (-> *water-wake-trail* frame-stagger) (the-as uint 1))
(defmethod water-control-method-17 ((this water-control))
(when (and (not (handle->process (-> this ripple)))
(>= (+ (current-time) (seconds -0.1)) (-> this enter-water-time))
)
(let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-0 tracked-obj) (process->handle (-> this process)))
(set! (-> s5-0 appearance) *water-wake-trail*)
(set! (-> s5-0 max-num-crumbs) (the int (* 0.25 (the float (-> s5-0 appearance max-age)))))
(let* ((v1-18
(estimate-light-trail-mem-usage
(the-as uint (-> s5-0 max-num-crumbs))
(the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-0 (get-process *default-dead-pool* light-trail-tracker-water (+ v1-18 8192) 1))
)
(set! (-> this ripple)
(ppointer->handle (when s4-0
(let ((t9-2 (method-of-type process activate)))
(t9-2 s4-0 (-> this process) "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
(-> s4-0 ppointer)
)
(if (and (not (handle->process (-> this ripple)))
(>= (+ (current-time) (seconds -0.1)) (-> this enter-water-time))
)
(set! (-> this ripple)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-water
:to (-> this process)
:param-list ((tracked-obj (process->handle (-> this process)))
(appearance *water-wake-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *water-wake-trail* max-age)))))
)
)
)
)
)
)
)
)
0
(none)
)
@@ -20,6 +20,29 @@
(reset 2)
)
(defmacro light-trail-tracker-spawn (type
&key (init light-trail-tracker-init-by-other)
&key (params-type light-trail-tracker-spawn-params)
&key (from *default-dead-pool*)
&key (to self)
&key (name "light-trail")
&key (stack *scratch-memory-top*)
&key (unk 1)
&key (param-list ()))
"Specialized `process-spawn` macro for [[light-trail-tracker]]s.
Returns a pointer to the new process, or `#f` (or is it 0?) if something goes wrong."
(with-gensyms (params mem proc)
`(let ((,params (new 'stack-no-clear ',params-type)))
,@(apply (lambda (x) `(set! (-> ,params ,(car x)) ,(cadr x))) param-list)
(let* ((,mem (estimate-light-trail-mem-usage
(the uint (-> ,params max-num-crumbs))
(the uint (= (-> ,params appearance lie-mode) (lie-mode use-two-strips)))))
(,proc (get-process ,from ,type (+ ,mem 8192) ,unk)))
(when ,proc
((method-of-type process activate) ,proc ,to ,name ,stack)
(run-now-in-process ,proc ,init ,params)
(-> ,proc ppointer))))))
;; DECOMP BEGINS
(deftype color-array (inline-array-class)
@@ -385,26 +385,14 @@
)
(set! (-> this random-travel-distance) (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-17)))))
)
(let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-0 tracked-obj) (process->handle this))
(set! (-> s5-0 appearance) *blue-shot-trail*)
(set! (-> s5-0 max-num-crumbs) (the int (* 0.2 (the float (-> s5-0 appearance max-age)))))
(set! (-> s5-0 track-immediately?) #t)
(let* ((v1-30 (estimate-light-trail-mem-usage
(the-as uint (-> s5-0 max-num-crumbs))
(the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1))
)
(when s4-0
(let ((t9-4 (method-of-type process activate)))
(t9-4 s4-0 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
(-> s4-0 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-blue-3
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *blue-shot-trail*)
(max-num-crumbs (the int (* 0.2 (the float (-> *blue-shot-trail* max-age)))))
(track-immediately? #t)
)
)
0
(none)
@@ -143,26 +143,14 @@
(vector-copy! (-> this root scale) v1-15)
)
(set! (-> this immediate-detonation?) #f)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *red-shot-3-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-28 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1))
)
(when s4-2
(let ((t9-9 (method-of-type process activate)))
(t9-9 s4-2 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-2)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *red-shot-3-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *red-shot-3-trail* max-age)))))
(track-immediately? #t)
)
)
0
(none)
@@ -1631,26 +1631,14 @@
)
(set! (-> this muzzle-flash-part) (-> *part-id-table* 274))
(sound-play "yellow2-shot" :pitch 1)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *yellow-shot-2-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.25 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-34 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(gp-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-34 8192) 1))
)
(when gp-1
(let ((t9-9 (method-of-type process activate)))
(t9-9 gp-1 *target* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process gp-1 light-trail-tracker-init-by-other s5-1)
(-> gp-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *target*
:param-list ((tracked-obj (process->handle this))
(appearance *yellow-shot-2-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *yellow-shot-2-trail* max-age)))))
(track-immediately? #t)
)
)
(none)
)
@@ -1507,26 +1507,14 @@
(set! (-> (the-as particle-local-space-info s3-0) flags) (part-local-space-flags))
(s4-1 s5-1 (the-as particle-local-space-info s3-0))
)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *torpedo-wake-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-34 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-torpedo (+ v1-34 8192) 1))
)
(when s4-2
(let ((t9-15 (method-of-type process activate)))
(t9-15 s4-2 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-2)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-torpedo
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *torpedo-wake-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *torpedo-wake-trail* max-age)))))
(track-immediately? #t)
)
)
(none)
)
@@ -420,26 +420,14 @@
(set! (-> this desired-target) (-> *vehicle-info* handle-by-vehicle-type 14))
(set! (-> this blast-damage) (the-as basic #t))
(set! (-> this vehicle-damage-factor) 0.333)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *beast-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-28 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1))
)
(when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *beast-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *beast-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(set-vector! (-> this root scale) 16.0 16.0 16.0 1.0)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
+8 -20
View File
@@ -937,26 +937,14 @@
(set! (-> this blast-radius) 40960.0)
(set! (-> this max-speed) 90112.0)
(set! (-> this timeout) (seconds 4))
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *beast-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-22 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-22 8192) 1))
)
(when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *beast-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *beast-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(let ((v1-26 (new 'stack-no-clear 'vector)))
(set! (-> v1-26 x) 8.0)
+8 -20
View File
@@ -443,26 +443,14 @@
)
)
)
(let ((s5-5 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-5 tracked-obj) (process->handle this))
(set! (-> s5-5 appearance) *mh-flyer-missile-trail*)
(set! (-> s5-5 max-num-crumbs) (the int (* 0.5 (the float (-> s5-5 appearance max-age)))))
(set! (-> s5-5 track-immediately?) #t)
(let* ((v0-8 (estimate-light-trail-mem-usage
(the-as uint (-> s5-5 max-num-crumbs))
(the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-8 8192) 1))
)
(when s4-2
(let ((t9-10 (method-of-type process activate)))
(t9-10 s4-2 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-5)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *mh-flyer-missile-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *mh-flyer-missile-trail* max-age)))))
(track-immediately? #t)
)
)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
(quaternion-copy! (-> this turn-quat) *unity-quaternion*)
@@ -472,31 +472,18 @@
(set! (-> v1-13 w) 1.0)
(vector-copy! (-> this root scale) v1-13)
)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *toad-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-26
(estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-26 8192) 1))
)
(set! (-> this trail-tracker)
(ppointer->handle (when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
)
)
)
(set! (-> this trail-tracker)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *toad-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *toad-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
0
(none)
)
+12 -25
View File
@@ -963,31 +963,18 @@
(set! (-> self draw light-index) (the-as uint 10))
(logclear! (-> self mask) (process-mask actor-pause))
(process-entity-status! self (entity-perm-status no-kill) #t)
(let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> gp-1 tracked-obj) (process->handle self))
(set! (-> gp-1 appearance) *factory-fighter-trail*)
(set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age)))))
(set! (-> gp-1 track-immediately?) #t)
(let* ((v1-38
(estimate-light-trail-mem-usage
(the-as uint (-> gp-1 max-num-crumbs))
(the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s5-1 (get-process *default-dead-pool* light-trail-tracker-vehicle (+ v1-38 8192) 1))
)
(set! (-> self light-trail)
(ppointer->handle (when s5-1
(let ((t9-13 (method-of-type process activate)))
(t9-13 s5-1 self "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s5-1 light-trail-tracker-init-by-other gp-1)
(-> s5-1 ppointer)
)
)
)
)
)
(set! (-> self light-trail)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-vehicle
:to self
:param-list ((tracked-obj (process->handle self))
(appearance *factory-fighter-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *factory-fighter-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
(go-virtual idle)
)
+8 -20
View File
@@ -542,26 +542,14 @@
)
)
)
(let ((s5-5 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-5 tracked-obj) (process->handle this))
(set! (-> s5-5 appearance) *dm-flyer-missile-trail*)
(set! (-> s5-5 max-num-crumbs) (the int (* 0.5 (the float (-> s5-5 appearance max-age)))))
(set! (-> s5-5 track-immediately?) #t)
(let* ((v0-12 (estimate-light-trail-mem-usage
(the-as uint (-> s5-5 max-num-crumbs))
(the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-12 8192) 1))
)
(when s4-2
(let ((t9-14 (method-of-type process activate)))
(t9-14 s4-2 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-5)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *dm-flyer-missile-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *dm-flyer-missile-trail* max-age)))))
(track-immediately? #t)
)
)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
(quaternion-copy! (-> this turn-quat) *unity-quaternion*)
@@ -861,26 +861,14 @@
(set! (-> this max-speed) 450560.0)
(set! (-> this timeout) (seconds 12))
(set! (-> this gravity) 40960.0)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *maker-grenade-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-32 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-32 8192) 1))
)
(when s4-1
(let ((t9-11 (method-of-type process activate)))
(t9-11 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-2)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *maker-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *maker-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(set-vector! (-> this root scale) 16.0 16.0 16.0 1.0)
(set! (-> this minimap) #f)
+23 -35
View File
@@ -2172,16 +2172,17 @@
(set! *maker-num-alive* (+ *maker-num-alive* 1))
(set! *maker-num-visible* (+ *maker-num-visible* 1))
(if (-> self draw shadow)
(set! (-> self draw shadow-ctrl) (new
'process
'shadow-control
-81920.0
163840.0
573440.0
(the-as vector #f)
(shadow-flags shdf00 shdf04)
4096000.0
)
(set! (-> self draw shadow-ctrl)
(new
'process
'shadow-control
-81920.0
163840.0
573440.0
(the-as vector #f)
(shadow-flags shdf00 shdf04)
4096000.0
)
)
(set! (-> self draw shadow-ctrl) *enemy-dummy-shadow-control*)
)
@@ -2269,31 +2270,18 @@
(set! (-> self draw lod-set lod 0 dist) 14336000.0)
(logclear! (-> self mask) (process-mask actor-pause))
(logior! (-> self mask) (process-mask no-kill))
(let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> gp-1 tracked-obj) (process->handle self))
(set! (-> gp-1 appearance) *maker-entry-trail*)
(set! (-> gp-1 max-num-crumbs) (the int (* 0.5 (the float (-> gp-1 appearance max-age)))))
(set! (-> gp-1 track-immediately?) #t)
(let* ((v1-104
(estimate-light-trail-mem-usage
(the-as uint (-> gp-1 max-num-crumbs))
(the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-104 8192) 1))
)
(set! (-> self trail-handle)
(ppointer->handle (when s5-1
(let ((t9-22 (method-of-type process activate)))
(t9-22 s5-1 self "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s5-1 light-trail-tracker-init-by-other gp-1)
(-> s5-1 ppointer)
)
)
)
)
)
(set! (-> self trail-handle)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-projectile
:to self
:param-list ((tracked-obj (process->handle self))
(appearance *maker-entry-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *maker-entry-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
(go-virtual flying)
)
+23
View File
@@ -1762,5 +1762,28 @@
`(* ,x ,x)
)
(defmacro light-trail-tracker-spawn (type
&key (init light-trail-tracker-init-by-other)
&key (params-type light-trail-tracker-spawn-params)
&key (from *default-dead-pool*)
&key (to self)
&key (name "light-trail")
&key (stack *scratch-memory-top*)
&key (unk 1)
&key (param-list ()))
"Specialized `process-spawn` macro for [[light-trail-tracker]]s.
Returns a pointer to the new process, or `#f` (or is it 0?) if something goes wrong."
(with-gensyms (params mem proc)
`(let ((,params (new 'stack-no-clear ',params-type)))
,@(apply (lambda (x) `(set! (-> ,params ,(car x)) ,(cadr x))) param-list)
(let* ((,mem (estimate-light-trail-mem-usage
(the uint (-> ,params max-num-crumbs))
(the uint (= (-> ,params appearance lie-mode) (lie-mode use-two-strips)))))
(,proc (get-process ,from ,type (+ ,mem 8192) ,unk)))
(when ,proc
((method-of-type process activate) ,proc ,to ,name ,stack)
(run-now-in-process ,proc ,init ,params)
(-> ,proc ppointer))))))
(import "goal_src/jak3/engine/data/tpages.gc")
(import "goal_src/jak3/engine/data/textures.gc")
+52 -61
View File
@@ -364,7 +364,6 @@
;; definition for function master-choose-entity
;; INFO: Used lq/sq
(defbehavior master-choose-entity camera-master ((arg0 cam-setting-data))
(local-vars (r0-0 uint128) (v1-44 uint128))
(let ((s5-0 (entity-by-name (-> arg0 entity-name))))
(set! (-> arg0 real-entity-name) #f)
(when s5-0
@@ -381,8 +380,8 @@
(format 0 "ERROR <GMJ>: camera entity '~S' didn't produce a state~%" (res-lump-struct s5-0 'name structure))
)
)
(let* ((sv-96 0)
(s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (the-as (pointer res-tag) (& sv-96))))
(let* ((sv-96 (new 'static 'res-tag))
(s4-1 (res-lump-data s5-0 'alternates pointer :tag-ptr (& sv-96)))
)
(when s4-1
(let ((s3-1 (process-spawn
@@ -400,79 +399,71 @@
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s3-1)))
(format 0 "ERROR <GMJ>: primary region activate failed~%")
)
(let ((s2-1 0))
(while (begin
(let ((v1-43 (the-as uint128 sv-96)))
(.pcpyud v1-44 v1-43 r0-0)
)
(< s2-1 (shr (* (the-as int v1-44) 2) 49))
)
(let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))))
(cond
(sv-128
(let ((s1-2 (cam-state-from-entity sv-128)))
(cond
(s1-2
(let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1))
(s0-0 (when sv-112
((method-of-type camera-slave activate)
(the-as camera-slave sv-112)
*camera*
"camera-slave"
(the-as pointer #x70004000)
)
(run-now-in-process sv-112 cam-slave-init s1-2 sv-128)
(-> sv-112 ppointer)
)
(dotimes (s2-1 (the-as int (-> sv-96 elt-count)))
(let ((sv-128 (entity-by-name (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))))
(cond
(sv-128
(let ((s1-2 (cam-state-from-entity sv-128)))
(cond
(s1-2
(let* ((sv-112 (get-process *camera-dead-pool* camera-slave #x4000 1))
(s0-0 (when sv-112
((method-of-type camera-slave activate)
(the-as camera-slave sv-112)
*camera*
"camera-slave"
(the-as pointer #x70004000)
)
(run-now-in-process sv-112 cam-slave-init s1-2 sv-128)
(-> sv-112 ppointer)
)
)
(cond
(s0-0
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0)))
(cond
((master-is-hopeful-better?
(the-as camera-slave (ppointer->process s3-1))
(the-as camera-slave (ppointer->process s0-0))
)
(if s3-1
(deactivate (-> s3-1 0))
)
(set! s3-1 (the-as (pointer camera-slave) s0-0))
(set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))
(set! (-> arg0 cam-mode) (the-as symbol s1-2))
)
(cond
(s0-0
(setup-slave-for-hopefull (the-as camera-slave (ppointer->process s0-0)))
(cond
((master-is-hopeful-better?
(the-as camera-slave (ppointer->process s3-1))
(the-as camera-slave (ppointer->process s0-0))
)
(else
(deactivate (-> s0-0 0))
)
(if s3-1
(deactivate (-> s3-1 0))
)
(set! s3-1 (the-as (pointer camera-slave) s0-0))
(set! (-> arg0 real-entity-name) (the-as string (-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))))
(set! (-> arg0 cam-mode) (the-as symbol s1-2))
)
(else
(deactivate (-> s0-0 0))
)
)
(else
(format 0 "ERROR <GMJ>: alternate region activate failed~%")
)
)
(else
(format 0 "ERROR <GMJ>: alternate region activate failed~%")
)
)
)
(else
(format
0
"ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%"
(res-lump-struct sv-128 'name structure)
)
)
(else
(format
0
"ERROR <GMJ>: alternate camera region '~S' didn't produce a state~%"
(res-lump-struct sv-128 'name structure)
)
)
)
)
(else
(format
0
"ERROR <GMJ>: alternate '~S' not found for '~S'~%"
(-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))
(res-lump-struct s5-0 'name structure)
)
)
(else
(format
0
"ERROR <GMJ>: alternate '~S' not found for '~S'~%"
(-> (the-as (pointer uint32) (&+ s4-1 (* s2-1 4))))
(res-lump-struct s5-0 'name structure)
)
)
)
(+! s2-1 1)
)
)
(if s3-1
+13 -26
View File
@@ -231,34 +231,21 @@
;; definition for method 17 of type water-control
;; WARN: Return type mismatch int vs none.
(defmethod water-control-method-17 ((this water-control))
(when (and (not (handle->process (-> this ripple)))
(>= (+ (current-time) (seconds -0.1)) (-> this enter-water-time))
)
(let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-0 tracked-obj) (process->handle (-> this process)))
(set! (-> s5-0 appearance) *water-wake-trail*)
(set! (-> s5-0 max-num-crumbs) (the int (* 0.25 (the float (-> s5-0 appearance max-age)))))
(let* ((v1-18
(estimate-light-trail-mem-usage
(the-as uint (-> s5-0 max-num-crumbs))
(the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-0 (get-process *default-dead-pool* light-trail-tracker-water (+ v1-18 8192) 1))
)
(set! (-> this ripple)
(ppointer->handle (when s4-0
(let ((t9-2 (method-of-type process activate)))
(t9-2 s4-0 (-> this process) "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
(-> s4-0 ppointer)
)
(if (and (not (handle->process (-> this ripple)))
(>= (+ (current-time) (seconds -0.1)) (-> this enter-water-time))
)
(set! (-> this ripple)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-water
:to (-> this process)
:param-list ((tracked-obj (process->handle (-> this process)))
(appearance *water-wake-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *water-wake-trail* max-age)))))
)
)
)
)
)
)
)
)
0
(none)
)
+8 -20
View File
@@ -442,26 +442,14 @@
)
(set! (-> this random-travel-distance) (+ f30-0 (* f28-0 (+ -1.0 (the-as float v1-17)))))
)
(let ((s5-0 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-0 tracked-obj) (process->handle this))
(set! (-> s5-0 appearance) *blue-shot-trail*)
(set! (-> s5-0 max-num-crumbs) (the int (* 0.2 (the float (-> s5-0 appearance max-age)))))
(set! (-> s5-0 track-immediately?) #t)
(let* ((v1-30 (estimate-light-trail-mem-usage
(the-as uint (-> s5-0 max-num-crumbs))
(the-as uint (= (-> s5-0 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-0 (get-process *default-dead-pool* light-trail-tracker-blue-3 (+ v1-30 8192) 1))
)
(when s4-0
(let ((t9-4 (method-of-type process activate)))
(t9-4 s4-0 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-0 light-trail-tracker-init-by-other s5-0)
(-> s4-0 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-blue-3
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *blue-shot-trail*)
(max-num-crumbs (the int (* 0.2 (the float (-> *blue-shot-trail* max-age)))))
(track-immediately? #t)
)
)
0
(none)
+8 -20
View File
@@ -180,26 +180,14 @@
(vector-copy! (-> this root scale) v1-15)
)
(set! (-> this immediate-detonation?) #f)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *red-shot-3-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-28 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1))
)
(when s4-2
(let ((t9-9 (method-of-type process activate)))
(t9-9 s4-2 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-2)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *red-shot-3-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *red-shot-3-trail* max-age)))))
(track-immediately? #t)
)
)
0
(none)
+8 -20
View File
@@ -1862,26 +1862,14 @@
)
(set! (-> this muzzle-flash-part) (-> *part-id-table* 274))
(sound-play "yellow2-shot" :pitch 1)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *yellow-shot-2-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.25 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-34 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(gp-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-34 8192) 1))
)
(when gp-1
(let ((t9-9 (method-of-type process activate)))
(t9-9 gp-1 *target* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process gp-1 light-trail-tracker-init-by-other s5-1)
(-> gp-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *target*
:param-list ((tracked-obj (process->handle this))
(appearance *yellow-shot-2-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *yellow-shot-2-trail* max-age)))))
(track-immediately? #t)
)
)
(none)
)
+8 -20
View File
@@ -1664,26 +1664,14 @@
(set! (-> (the-as particle-local-space-info s3-0) flags) (part-local-space-flags))
(s4-1 s5-1 (the-as particle-local-space-info s3-0))
)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *torpedo-wake-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-34 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-torpedo (+ v1-34 8192) 1))
)
(when s4-2
(let ((t9-15 (method-of-type process activate)))
(t9-15 s4-2 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-2)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-torpedo
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *torpedo-wake-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *torpedo-wake-trail* max-age)))))
(track-immediately? #t)
)
)
(none)
)
+8 -20
View File
@@ -464,26 +464,14 @@
(set! (-> this desired-target) (-> *vehicle-info* handle-by-vehicle-type 14))
(set! (-> this blast-damage) (the-as basic #t))
(set! (-> this vehicle-damage-factor) 0.333)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *beast-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-28 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-28 8192) 1))
)
(when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *beast-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *beast-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(set-vector! (-> this root scale) 16.0 16.0 16.0 1.0)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
+8 -20
View File
@@ -1031,26 +1031,14 @@
(set! (-> this blast-radius) 40960.0)
(set! (-> this max-speed) 90112.0)
(set! (-> this timeout) (seconds 4))
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *beast-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-22 (estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-22 8192) 1))
)
(when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *beast-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *beast-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(let ((v1-26 (new 'stack-no-clear 'vector)))
(set! (-> v1-26 x) 8.0)
+8 -20
View File
@@ -508,26 +508,14 @@
)
)
)
(let ((s5-5 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-5 tracked-obj) (process->handle this))
(set! (-> s5-5 appearance) *mh-flyer-missile-trail*)
(set! (-> s5-5 max-num-crumbs) (the int (* 0.5 (the float (-> s5-5 appearance max-age)))))
(set! (-> s5-5 track-immediately?) #t)
(let* ((v0-8 (estimate-light-trail-mem-usage
(the-as uint (-> s5-5 max-num-crumbs))
(the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-8 8192) 1))
)
(when s4-2
(let ((t9-10 (method-of-type process activate)))
(t9-10 s4-2 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-5)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *mh-flyer-missile-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *mh-flyer-missile-trail* max-age)))))
(track-immediately? #t)
)
)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
(quaternion-copy! (-> this turn-quat) *unity-quaternion*)
@@ -565,31 +565,18 @@
(set! (-> v1-13 w) 1.0)
(vector-copy! (-> this root scale) v1-13)
)
(let ((s5-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-1 tracked-obj) (process->handle this))
(set! (-> s5-1 appearance) *toad-grenade-trail*)
(set! (-> s5-1 max-num-crumbs) (the int (* 0.5 (the float (-> s5-1 appearance max-age)))))
(set! (-> s5-1 track-immediately?) #t)
(let* ((v1-26
(estimate-light-trail-mem-usage
(the-as uint (-> s5-1 max-num-crumbs))
(the-as uint (= (-> s5-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-26 8192) 1))
)
(set! (-> this trail-tracker)
(ppointer->handle (when s4-1
(let ((t9-6 (method-of-type process activate)))
(t9-6 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-1)
(-> s4-1 ppointer)
)
)
)
)
)
(set! (-> this trail-tracker)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *toad-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *toad-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
0
(none)
)
+12 -25
View File
@@ -1083,31 +1083,18 @@
(set! (-> self draw light-index) (the-as uint 10))
(logclear! (-> self mask) (process-mask actor-pause))
(process-entity-status! self (entity-perm-status no-kill) #t)
(let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> gp-1 tracked-obj) (process->handle self))
(set! (-> gp-1 appearance) *factory-fighter-trail*)
(set! (-> gp-1 max-num-crumbs) (the int (* 0.25 (the float (-> gp-1 appearance max-age)))))
(set! (-> gp-1 track-immediately?) #t)
(let* ((v1-38
(estimate-light-trail-mem-usage
(the-as uint (-> gp-1 max-num-crumbs))
(the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s5-1 (get-process *default-dead-pool* light-trail-tracker-vehicle (+ v1-38 8192) 1))
)
(set! (-> self light-trail)
(ppointer->handle (when s5-1
(let ((t9-13 (method-of-type process activate)))
(t9-13 s5-1 self "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s5-1 light-trail-tracker-init-by-other gp-1)
(-> s5-1 ppointer)
)
)
)
)
)
(set! (-> self light-trail)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-vehicle
:to self
:param-list ((tracked-obj (process->handle self))
(appearance *factory-fighter-trail*)
(max-num-crumbs (the int (* 0.25 (the float (-> *factory-fighter-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
(go-virtual idle)
)
+8 -20
View File
@@ -610,26 +610,14 @@
)
)
)
(let ((s5-5 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-5 tracked-obj) (process->handle this))
(set! (-> s5-5 appearance) *dm-flyer-missile-trail*)
(set! (-> s5-5 max-num-crumbs) (the int (* 0.5 (the float (-> s5-5 appearance max-age)))))
(set! (-> s5-5 track-immediately?) #t)
(let* ((v0-12 (estimate-light-trail-mem-usage
(the-as uint (-> s5-5 max-num-crumbs))
(the-as uint (= (-> s5-5 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-2 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v0-12 8192) 1))
)
(when s4-2
(let ((t9-14 (method-of-type process activate)))
(t9-14 s4-2 *entity-pool* "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-2 light-trail-tracker-init-by-other s5-5)
(-> s4-2 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to *entity-pool*
:param-list ((tracked-obj (process->handle this))
(appearance *dm-flyer-missile-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *dm-flyer-missile-trail* max-age)))))
(track-immediately? #t)
)
)
(set! (-> this minimap) (add-icon! *minimap* this (the-as uint 135) (the-as int #f) (the-as vector #t) 0))
(quaternion-copy! (-> this turn-quat) *unity-quaternion*)
+8 -20
View File
@@ -935,26 +935,14 @@
(set! (-> this max-speed) 450560.0)
(set! (-> this timeout) (seconds 12))
(set! (-> this gravity) 40960.0)
(let ((s5-2 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> s5-2 tracked-obj) (process->handle this))
(set! (-> s5-2 appearance) *maker-grenade-trail*)
(set! (-> s5-2 max-num-crumbs) (the int (* 0.5 (the float (-> s5-2 appearance max-age)))))
(set! (-> s5-2 track-immediately?) #t)
(let* ((v1-32 (estimate-light-trail-mem-usage
(the-as uint (-> s5-2 max-num-crumbs))
(the-as uint (= (-> s5-2 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s4-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-32 8192) 1))
)
(when s4-1
(let ((t9-11 (method-of-type process activate)))
(t9-11 s4-1 this "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s4-1 light-trail-tracker-init-by-other s5-2)
(-> s4-1 ppointer)
)
)
(light-trail-tracker-spawn
light-trail-tracker-projectile
:to this
:param-list ((tracked-obj (process->handle this))
(appearance *maker-grenade-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *maker-grenade-trail* max-age)))))
(track-immediately? #t)
)
)
(set-vector! (-> this root scale) 16.0 16.0 16.0 1.0)
(set! (-> this minimap) #f)
+23 -35
View File
@@ -2375,16 +2375,17 @@
(set! *maker-num-alive* (+ *maker-num-alive* 1))
(set! *maker-num-visible* (+ *maker-num-visible* 1))
(if (-> self draw shadow)
(set! (-> self draw shadow-ctrl) (new
'process
'shadow-control
-81920.0
163840.0
573440.0
(the-as vector #f)
(shadow-flags shdf00 shdf04)
4096000.0
)
(set! (-> self draw shadow-ctrl)
(new
'process
'shadow-control
-81920.0
163840.0
573440.0
(the-as vector #f)
(shadow-flags shdf00 shdf04)
4096000.0
)
)
(set! (-> self draw shadow-ctrl) *enemy-dummy-shadow-control*)
)
@@ -2471,31 +2472,18 @@
(set! (-> self draw lod-set lod 0 dist) 14336000.0)
(logclear! (-> self mask) (process-mask actor-pause))
(logior! (-> self mask) (process-mask no-kill))
(let ((gp-1 (new 'stack-no-clear 'light-trail-tracker-spawn-params)))
(set! (-> gp-1 tracked-obj) (process->handle self))
(set! (-> gp-1 appearance) *maker-entry-trail*)
(set! (-> gp-1 max-num-crumbs) (the int (* 0.5 (the float (-> gp-1 appearance max-age)))))
(set! (-> gp-1 track-immediately?) #t)
(let* ((v1-104
(estimate-light-trail-mem-usage
(the-as uint (-> gp-1 max-num-crumbs))
(the-as uint (= (-> gp-1 appearance lie-mode) (lie-mode use-two-strips)))
)
)
(s5-1 (get-process *default-dead-pool* light-trail-tracker-projectile (+ v1-104 8192) 1))
)
(set! (-> self trail-handle)
(ppointer->handle (when s5-1
(let ((t9-22 (method-of-type process activate)))
(t9-22 s5-1 self "light-trail" (the-as pointer #x70004000))
)
(run-now-in-process s5-1 light-trail-tracker-init-by-other gp-1)
(-> s5-1 ppointer)
)
)
)
)
)
(set! (-> self trail-handle)
(ppointer->handle (light-trail-tracker-spawn
light-trail-tracker-projectile
:to self
:param-list ((tracked-obj (process->handle self))
(appearance *maker-entry-trail*)
(max-num-crumbs (the int (* 0.5 (the float (-> *maker-entry-trail* max-age)))))
(track-immediately? #t)
)
)
)
)
(go-virtual flying)
)