mirror of
https://github.com/open-goal/jak-project
synced 2026-09-08 20:02:39 -04:00
[decomp] better handling of animation code and art files (#1352)
* update refs * [decompiler] read and process art groups * finish decompiler art group selection & detect in `ja-group?` * make art stuff work on offline tests! * [decompiler] detect `ja-group!` (primitive) * corrections. * more * use new feature on skel groups! * find `loop!` as well * fully fledged `ja` macro & decomp + `loop` detect * fancy fixed point printing! * update source * `:num! max` (i knew i should've done this) * Update jak1_ntsc_black_label.jsonc * hi imports * make compiling the game work * fix `defskelgroup` * clang * update refs * fix chan * fix seek and finalboss * fix tests * delete unused function * track let rewrite stats * reorder `rewrite_let` * Update .gitattributes * fix bug with `:num! max` * Update robotboss-part.gc * Update goal-lib.gc * document `ja` * get rid of pc fixes thing * use std::abs
This commit is contained in:
+42
-10
@@ -1180,8 +1180,13 @@ void WhileElement::apply(const std::function<void(FormElement*)>& f) {
|
||||
|
||||
goos::Object WhileElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> list;
|
||||
list.push_back(pretty_print::to_symbol("while"));
|
||||
list.push_back(condition->to_form_as_condition(env));
|
||||
auto cond = condition->to_form_as_condition(env);
|
||||
if (cond == pretty_print::to_symbol("#t")) {
|
||||
list.push_back(pretty_print::to_symbol("loop"));
|
||||
} else {
|
||||
list.push_back(pretty_print::to_symbol("while"));
|
||||
list.push_back(condition->to_form_as_condition(env));
|
||||
}
|
||||
body->inline_forms(list, env);
|
||||
return pretty_print::build_list(list);
|
||||
}
|
||||
@@ -2984,16 +2989,35 @@ void DefskelgroupElement::get_modified_regs(RegSet& regs) const {
|
||||
|
||||
goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> forms;
|
||||
forms.push_back(
|
||||
pretty_print::to_symbol(fmt::format("defskelgroup {} {}", m_name, m_static_info.art_name)));
|
||||
forms.push_back(m_info.jgeo->to_form(env));
|
||||
forms.push_back(m_info.janim->to_form(env));
|
||||
forms.push_back(pretty_print::to_symbol("defskelgroup"));
|
||||
forms.push_back(pretty_print::to_symbol(m_name));
|
||||
forms.push_back(pretty_print::to_symbol(m_static_info.art_name));
|
||||
const auto& art = env.dts->art_group_info.find(m_static_info.art_name + "-ag");
|
||||
bool has_art = art != env.dts->art_group_info.end();
|
||||
auto jg = m_info.jgeo->to_form(env);
|
||||
if (jg.is_int() && has_art && art->second.count(jg.as_int())) {
|
||||
forms.push_back(pretty_print::to_symbol(art->second.at(jg.as_int())));
|
||||
} else {
|
||||
forms.push_back(jg);
|
||||
}
|
||||
auto ja = m_info.janim->to_form(env);
|
||||
if (ja.is_int() && has_art && art->second.count(ja.as_int())) {
|
||||
forms.push_back(pretty_print::to_symbol(art->second.at(ja.as_int())));
|
||||
} else {
|
||||
forms.push_back(ja);
|
||||
}
|
||||
|
||||
std::vector<goos::Object> lod_forms;
|
||||
for (const auto& e : m_info.lods) {
|
||||
auto f_dist = pretty_print::to_symbol(
|
||||
fmt::format("(meters {})", meters_to_string(e.lod_dist->to_form(env).as_float())));
|
||||
lod_forms.push_back(pretty_print::build_list(e.mgeo->to_form(env), f_dist));
|
||||
auto mg = e.mgeo->to_form(env);
|
||||
if (mg.is_int() && has_art && art->second.count(mg.as_int())) {
|
||||
lod_forms.push_back(
|
||||
pretty_print::build_list(pretty_print::to_symbol(art->second.at(mg.as_int())), f_dist));
|
||||
} else {
|
||||
lod_forms.push_back(pretty_print::build_list(mg, f_dist));
|
||||
}
|
||||
}
|
||||
forms.push_back(pretty_print::build_list(lod_forms));
|
||||
|
||||
@@ -3001,11 +3025,19 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
|
||||
":bounds (static-spherem {} {} {} {})", meters_to_string(m_static_info.bounds.x()),
|
||||
meters_to_string(m_static_info.bounds.y()), meters_to_string(m_static_info.bounds.z()),
|
||||
meters_to_string(m_static_info.bounds.w()))));
|
||||
forms.push_back(pretty_print::to_symbol(
|
||||
fmt::format(":longest-edge (meters {})", meters_to_string(m_static_info.longest_edge))));
|
||||
|
||||
if (m_static_info.longest_edge != 0) {
|
||||
forms.push_back(pretty_print::to_symbol(
|
||||
fmt::format(":longest-edge (meters {})", meters_to_string(m_static_info.longest_edge))));
|
||||
}
|
||||
|
||||
if (m_static_info.shadow != 0) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":shadow {}", m_static_info.shadow)));
|
||||
if (has_art && art->second.count(m_static_info.shadow)) {
|
||||
forms.push_back(
|
||||
pretty_print::to_symbol(fmt::format(":shadow {}", art->second.at(m_static_info.shadow))));
|
||||
} else {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":shadow {}", m_static_info.shadow)));
|
||||
}
|
||||
}
|
||||
if (m_static_info.tex_level != 0) {
|
||||
forms.push_back(
|
||||
|
||||
Reference in New Issue
Block a user