mirror of
https://github.com/open-goal/jak-project
synced 2026-09-06 19:21:00 -04:00
decomp: support part-tracker-spawn in jak2, part group constants (#4082)
This commit is contained in:
@@ -4364,6 +4364,28 @@ ConstantTokenElement* DerefElement::try_as_art_const(const Env& env, FormPool& p
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ConstantTokenElement* DerefElement::try_as_part_group_const(const Env& env, FormPool& pool) {
|
||||
auto mr = match(Matcher::deref(Matcher::symbol("*part-group-id-table*"), false,
|
||||
{DerefTokenMatcher::any_integer(0)}),
|
||||
this);
|
||||
|
||||
if (mr.matched) {
|
||||
auto group_name = env.get_part_group_name(mr.maps.ints.at(0));
|
||||
// already defined in all games
|
||||
if (group_name == "group-rain-screend-drop-real") {
|
||||
return nullptr;
|
||||
}
|
||||
if (group_name) {
|
||||
return pool.alloc_element<ConstantTokenElement>(*group_name);
|
||||
} else {
|
||||
lg::error("function `{}`: did not find part group name for id {}", env.func->name(),
|
||||
mr.maps.ints.at(0));
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GenericElement* DerefElement::try_as_joint_node_index(const Env& env, FormPool& pool) {
|
||||
auto mr =
|
||||
match(Matcher::deref(Matcher::s6(), false,
|
||||
@@ -4461,6 +4483,12 @@ void DerefElement::update_from_stack(const Env& env,
|
||||
return;
|
||||
}
|
||||
|
||||
auto as_part_group = try_as_part_group_const(env, pool);
|
||||
if (as_part_group) {
|
||||
result->push_back(as_part_group);
|
||||
return;
|
||||
}
|
||||
|
||||
auto as_jnode = try_as_joint_node_index(env, pool);
|
||||
if (as_jnode) {
|
||||
result->push_back(as_jnode);
|
||||
|
||||
Reference in New Issue
Block a user