mirror of
https://github.com/open-goal/jak-project.git
synced 2024-10-20 00:57:44 -04:00
decompiler: defskelgroup
macro detection for jak 3, fix art group dumping for jak 3 and some more decomp work (#3370)
- `transformq` - `wind-work` - `progress-static` - `merc-vu1` - `emerc-vu1` - `merc` - `emerc` - `cloth-h` - Most of `cloth`, not added to gsrc yet Art group dumps were incorrect for Jak 3 because the master art group fields were at different offsets.
This commit is contained in:
parent
18903f0561
commit
a4e629ebf9
|
@ -12,6 +12,8 @@
|
|||
#include "decompiler/util/data_decompile.h"
|
||||
#include "decompiler/util/sparticle_decompile.h"
|
||||
|
||||
#include "third-party/fmt/ranges.h"
|
||||
|
||||
namespace decompiler {
|
||||
|
||||
///////////////////
|
||||
|
@ -3065,6 +3067,120 @@ void DefskelgroupElement::get_modified_regs(RegSet& regs) const {
|
|||
m_info.jgeo->get_modified_regs(regs);
|
||||
}
|
||||
|
||||
goos::Object DefskelgroupElement::ClothParams::to_list(const std::string& ag_name,
|
||||
const Env& env) const {
|
||||
std::vector<goos::Object> result;
|
||||
if (mesh != 0) {
|
||||
// TODO use art element name for mesh
|
||||
(void)ag_name;
|
||||
// const auto& art = env.dts->art_group_info;
|
||||
// if (art.find(ag_name) != art.end() && art.at(ag_name).find(mesh) != art.at(ag_name).end()) {
|
||||
// auto name = art.at(ag_name).at(mesh);
|
||||
// result.push_back(pretty_print::build_list(
|
||||
// {pretty_print::to_symbol("mesh"), pretty_print::to_symbol(name)}));
|
||||
// } else {
|
||||
// result.push_back(pretty_print::build_list(
|
||||
// {pretty_print::to_symbol("mesh"), pretty_print::to_symbol(std::to_string(mesh))}));
|
||||
// }
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("mesh"), pretty_print::to_symbol(std::to_string(mesh))}));
|
||||
}
|
||||
if (gravity != 0.0f) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("gravity-constant"),
|
||||
pretty_print::to_symbol(fmt::format("(meters {})", meters_to_string(gravity)))}));
|
||||
}
|
||||
if (wind != 0.0f) {
|
||||
result.push_back(pretty_print::build_list({pretty_print::to_symbol("wind-constant"),
|
||||
pretty_print::to_symbol(float_to_string(wind))}));
|
||||
}
|
||||
if (width != 0) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("cloth-width"), pretty_print::to_symbol(std::to_string(width))}));
|
||||
}
|
||||
if (sphere_constraints != 0) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("num-sphere-constraints"),
|
||||
pretty_print::to_symbol(std::to_string(sphere_constraints))}));
|
||||
}
|
||||
if (disc_constraints != 0) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("num-disc-constraints"),
|
||||
pretty_print::to_symbol(std::to_string(disc_constraints))}));
|
||||
}
|
||||
if (anchor_points != 0) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("num-anchor-points"),
|
||||
pretty_print::to_symbol(std::to_string(anchor_points))}));
|
||||
}
|
||||
if (flags != 0) {
|
||||
auto bits = decompile_bitfield_enum_from_int(TypeSpec("cloth-flag"), env.dts->ts, flags);
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("flags"),
|
||||
pretty_print::to_symbol(fmt::format("(cloth-flag {})", fmt::join(bits, " ")))}));
|
||||
}
|
||||
if (!tex_name.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("tex-name"), pretty_print::new_string(tex_name)}));
|
||||
}
|
||||
if (!tex_name2.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("tex-name2"), pretty_print::new_string(tex_name2)}));
|
||||
}
|
||||
if (!tex_name3.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("tex-name3"), pretty_print::new_string(tex_name3)}));
|
||||
}
|
||||
if (!alt_tex_name.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("alt-tex-name"), pretty_print::new_string(alt_tex_name)}));
|
||||
}
|
||||
if (!alt_tex_name2.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("alt-tex-name2"), pretty_print::new_string(alt_tex_name2)}));
|
||||
}
|
||||
if (!alt_tex_name3.empty()) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("alt-tex-name3"), pretty_print::new_string(alt_tex_name3)}));
|
||||
}
|
||||
if (thickness != 0.0f) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("cloth-thickness"),
|
||||
pretty_print::to_symbol(float_to_string(thickness))}));
|
||||
}
|
||||
if (xform != 0) {
|
||||
result.push_back(pretty_print::build_list({pretty_print::to_symbol("initial-xform"),
|
||||
pretty_print::to_symbol(std::to_string(xform))}));
|
||||
}
|
||||
if (drag != 0.0f) {
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("drag"), pretty_print::to_symbol(float_to_string(drag))}));
|
||||
}
|
||||
if (ball_collision_radius != 0.0f) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("ball-collision-radius"),
|
||||
pretty_print::to_symbol(fmt::format(
|
||||
"(meters {})", meters_to_string(ball_collision_radius)))}));
|
||||
}
|
||||
if (iterations != 0) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("num-iterations"),
|
||||
pretty_print::to_symbol(std::to_string(iterations))}));
|
||||
}
|
||||
if (timestep_freq != 0) {
|
||||
result.push_back(
|
||||
pretty_print::build_list({pretty_print::to_symbol("timestep-frequency"),
|
||||
pretty_print::to_symbol(std::to_string(timestep_freq))}));
|
||||
}
|
||||
if (secret != 0) {
|
||||
auto bits = decompile_bitfield_enum_from_int(TypeSpec("game-secrets"), env.dts->ts, flags);
|
||||
result.push_back(pretty_print::build_list(
|
||||
{pretty_print::to_symbol("secret-disable"),
|
||||
pretty_print::to_symbol(fmt::format("(game-secrets {})", fmt::join(bits, " ")))}));
|
||||
}
|
||||
return pretty_print::build_list(result);
|
||||
}
|
||||
|
||||
goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
|
||||
std::vector<goos::Object> forms;
|
||||
forms.push_back(pretty_print::to_symbol("defskelgroup"));
|
||||
|
@ -3124,15 +3240,21 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
|
|||
if (m_static_info.sort != 0) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":sort {}", m_static_info.sort)));
|
||||
}
|
||||
// jak 2 skelgroups seem to be using version 7
|
||||
if (env.version != GameVersion::Jak1) {
|
||||
if (m_static_info.version != 7) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version)));
|
||||
}
|
||||
} else {
|
||||
if (m_static_info.version != 6) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version)));
|
||||
}
|
||||
switch (env.version) {
|
||||
case GameVersion::Jak1:
|
||||
if (m_static_info.version != 6) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version)));
|
||||
}
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
if (m_static_info.version != 7) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version)));
|
||||
}
|
||||
break;
|
||||
case GameVersion::Jak3:
|
||||
if (m_static_info.version != 8) {
|
||||
forms.push_back(pretty_print::to_symbol(fmt::format(":version {}", m_static_info.version)));
|
||||
}
|
||||
}
|
||||
if (env.version != GameVersion::Jak1) {
|
||||
if (m_static_info.origin_joint_index != 0) {
|
||||
|
@ -3147,6 +3269,19 @@ goos::Object DefskelgroupElement::to_form_internal(const Env& env) const {
|
|||
forms.push_back(
|
||||
pretty_print::to_symbol(fmt::format(":light-index {}", m_static_info.light_index)));
|
||||
}
|
||||
if (m_static_info.global_effects != 0) {
|
||||
forms.push_back(
|
||||
pretty_print::to_symbol(fmt::format(":global-effects {}", m_static_info.global_effects)));
|
||||
}
|
||||
if (!m_static_info.clothing.empty()) {
|
||||
std::vector<goos::Object> cloth_list;
|
||||
forms.push_back(pretty_print::to_symbol(":clothing"));
|
||||
for (const auto& p : m_static_info.clothing) {
|
||||
auto macro = p.to_list(m_static_info.art_group_name + "-ag", env);
|
||||
cloth_list.push_back(macro);
|
||||
}
|
||||
forms.push_back(pretty_print::build_list(cloth_list));
|
||||
}
|
||||
}
|
||||
|
||||
return pretty_print::build_list(forms);
|
||||
|
|
|
@ -1687,8 +1687,33 @@ class DefstateElement : public FormElement {
|
|||
|
||||
class DefskelgroupElement : public FormElement {
|
||||
public:
|
||||
struct ClothParams {
|
||||
u16 mesh;
|
||||
float gravity;
|
||||
float wind;
|
||||
u16 width;
|
||||
u16 sphere_constraints;
|
||||
u16 disc_constraints;
|
||||
u16 anchor_points;
|
||||
u64 flags;
|
||||
std::string tex_name;
|
||||
std::string tex_name2;
|
||||
std::string tex_name3;
|
||||
std::string alt_tex_name;
|
||||
std::string alt_tex_name2;
|
||||
std::string alt_tex_name3;
|
||||
float thickness;
|
||||
u16 xform;
|
||||
float drag;
|
||||
float ball_collision_radius;
|
||||
u8 iterations;
|
||||
u8 timestep_freq;
|
||||
u64 secret;
|
||||
|
||||
goos::Object to_list(const std::string& ag_name, const Env& env) const;
|
||||
};
|
||||
struct StaticInfo {
|
||||
std::string name; // jak 2
|
||||
std::string name; // jak 2/3
|
||||
std::string art_group_name;
|
||||
math::Vector4f bounds;
|
||||
int max_lod;
|
||||
|
@ -1700,6 +1725,9 @@ class DefskelgroupElement : public FormElement {
|
|||
s8 origin_joint_index;
|
||||
s8 shadow_joint_index;
|
||||
s8 light_index;
|
||||
// jak 3
|
||||
s8 global_effects;
|
||||
std::vector<ClothParams> clothing;
|
||||
};
|
||||
struct Entry {
|
||||
Form* mgeo = nullptr;
|
||||
|
|
|
@ -902,7 +902,8 @@ void get_joint_info(ObjectFileDB& db, ObjectFileData& obj, JointGeo jg) {
|
|||
}
|
||||
|
||||
void get_art_info(ObjectFileDB& db, ObjectFileData& obj) {
|
||||
if (obj.obj_version == 4 || (obj.obj_version == 5 && obj.linked_data.segments == 1)) {
|
||||
// jak 1/2
|
||||
if (obj.obj_version == 4) {
|
||||
const auto& words = obj.linked_data.words_by_seg.at(MAIN_SEGMENT);
|
||||
if (words.at(0).kind() == LinkedWord::Kind::TYPE_PTR &&
|
||||
words.at(0).symbol_name() == "art-group") {
|
||||
|
@ -961,6 +962,68 @@ void get_art_info(ObjectFileDB& db, ObjectFileData& obj) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// jak 3
|
||||
if (obj.obj_version == 5 && obj.linked_data.segments == 1) {
|
||||
const auto& words = obj.linked_data.words_by_seg.at(MAIN_SEGMENT);
|
||||
if (words.at(0).kind() == LinkedWord::Kind::TYPE_PTR &&
|
||||
words.at(0).symbol_name() == "art-group") {
|
||||
auto obj_unique_name = obj.to_unique_name();
|
||||
|
||||
// lg::print("art-group {}:\n", obj.to_unique_name());
|
||||
auto name = obj.linked_data.get_goal_string_by_label(words.at(2).label_id());
|
||||
int length = words.at(3).data;
|
||||
// lg::print(" length: {}\n", length);
|
||||
for (int i = 0; i < length; ++i) {
|
||||
const auto& word = words.at(8 + i);
|
||||
if (word.kind() == LinkedWord::Kind::SYM_PTR && word.symbol_name() == "#f") {
|
||||
continue;
|
||||
}
|
||||
const auto& label = obj.linked_data.labels.at(word.label_id());
|
||||
auto elt_name =
|
||||
obj.linked_data.get_goal_string_by_label(words.at(label.offset / 4 + 1).label_id());
|
||||
auto unique_name = elt_name;
|
||||
|
||||
auto ag_name = obj_unique_name;
|
||||
int elt_index = i;
|
||||
std::string elt_type = words.at(label.offset / 4 - 1).symbol_name();
|
||||
auto& word_master_ag = words.at(label.offset / 4 + 4);
|
||||
auto& word_master_idx = words.at(label.offset / 4 + 5);
|
||||
if (word_master_ag.kind() == LinkedWord::Kind::PTR &&
|
||||
word_master_idx.kind() == LinkedWord::Kind::PLAIN_DATA) {
|
||||
ag_name = obj.linked_data.get_goal_string_by_label(word_master_ag.label_id()) + "-ag";
|
||||
if (elt_type != "art-cloth-geo") {
|
||||
elt_index = word_master_idx.data;
|
||||
}
|
||||
}
|
||||
|
||||
if (elt_type == "art-joint-geo") {
|
||||
// the skeleton!
|
||||
unique_name += "-jg";
|
||||
JointGeo jg;
|
||||
jg.offset = label.offset;
|
||||
jg.name = unique_name;
|
||||
jg.length = words.at(label.offset / 4 + 2).data;
|
||||
get_joint_info(db, obj, jg);
|
||||
} else if (elt_type == "merc-ctrl" || elt_type == "shadow-geo") {
|
||||
// (maybe mesh-geo as well but that doesnt exist)
|
||||
// the skin!
|
||||
unique_name += "-mg";
|
||||
} else if (elt_type == "art-joint-anim") {
|
||||
// the animations!
|
||||
unique_name += "-ja";
|
||||
} else if (elt_type == "art-cloth-geo") {
|
||||
// cloth geometry (jak 3)
|
||||
unique_name += "-cg";
|
||||
} else {
|
||||
// the something idk!
|
||||
throw std::runtime_error(
|
||||
fmt::format("unknown art elt type {} in {}", elt_type, obj.to_unique_name()));
|
||||
}
|
||||
// lg::print(" {}: {} ({}) -> {} @ {}\n", i, elt_name, elt_type, unique_name, elt_index);
|
||||
db.dts.add_art_group_elt(ag_name, unique_name, elt_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@ std::string get_skelgroup_name(FormElement* skel_set, const Env& env) {
|
|||
return atom->get_str();
|
||||
}
|
||||
|
||||
static const std::vector<int> empty_words = {1, 2, 7, 8, 10, 11, 12, 13, 16};
|
||||
DefskelgroupElement::StaticInfo inspect_skel_group_data(DecompiledDataElement* skel,
|
||||
const Env& env) {
|
||||
static const std::vector<int> empty_words_jak1 = {1, 2, 7, 8, 10, 11, 12, 13, 16};
|
||||
DefskelgroupElement::StaticInfo inspect_skel_group_data_jak1(DecompiledDataElement* skel,
|
||||
const Env& env) {
|
||||
DefskelgroupElement::StaticInfo result;
|
||||
|
||||
auto lab = skel->label();
|
||||
|
@ -96,7 +96,7 @@ DefskelgroupElement::StaticInfo inspect_skel_group_data(DecompiledDataElement* s
|
|||
result.shadow = other_word.get_byte(2);
|
||||
result.sort = other_word.get_byte(3);
|
||||
|
||||
for (auto i : empty_words) {
|
||||
for (auto i : empty_words_jak1) {
|
||||
auto& word = words.at(start_word_idx + i);
|
||||
if (word.data != LinkedWord::PLAIN_DATA || word.data != 0) {
|
||||
env.func->warnings.error_and_throw(fmt::format("Reference to skelgroup bad: set word {}", i));
|
||||
|
@ -209,6 +209,120 @@ DefskelgroupElement::StaticInfo inspect_skel_group_data_jak2(DecompiledDataEleme
|
|||
return result;
|
||||
}
|
||||
|
||||
static const std::vector<int> empty_words_jak3 = {2, 4, 5, 6, 8, 9, 10, 15, 16,
|
||||
17, 19, 20, 21, 22, 23, 24, 30};
|
||||
DefskelgroupElement::StaticInfo inspect_skel_group_data_jak3(DecompiledDataElement* skel,
|
||||
const Env& env) {
|
||||
DefskelgroupElement::StaticInfo result;
|
||||
|
||||
auto lab = skel->label();
|
||||
// example from target-util
|
||||
/*
|
||||
.type skeleton-group
|
||||
L460:
|
||||
.symbol #f // info // 4
|
||||
.word L462 // name (string) // 8
|
||||
.word 0x0 // length // 12
|
||||
.symbol #f // extra // 16
|
||||
.word 0x0 // ? (word 4) // 20
|
||||
.word 0x0 // ? (word 5) // 24
|
||||
.word 0x0 // ? (word 6) // 28
|
||||
.word L461 // art-group-name (string) // 32
|
||||
.word 0x0 // jgeo // 36
|
||||
.word 0x0 // janim // 40
|
||||
.word 0x0 // ? (word 10) // 44
|
||||
.word 0x0 // bounds x // 48
|
||||
.word 0x0 // bounds y // 52
|
||||
.word 0x0 // bounds z // 56
|
||||
.word 0x464ccccd // bounds w/radius // 60
|
||||
.word 0x0 // mgeo 0/1 // 64
|
||||
.word 0x0 // mgeo 2/3 // 68
|
||||
.word 0x0 // mgeo 4/5 // 72
|
||||
.word 0x0 // max-lod // 76
|
||||
.word 0x0 // lod-dist 0 // 80
|
||||
.word 0x0 // lod-dist 1 // 84
|
||||
.word 0x0 // lod-dist 2 // 88
|
||||
.word 0x0 // lod-dist 3 // 92
|
||||
.word 0x0 // lod-dist 4 // 96
|
||||
.word 0x0 // lod-dist 5 // 100
|
||||
.word 0x45800000 // longest-edge // 104
|
||||
.word 0x80a // texture-level/version/shadow/sort // 108
|
||||
.word 0x10303 // origin-joint-index/shadow-joint-index/light-index/pad // 112
|
||||
.symbol #f // clothing // 116
|
||||
.word 0x0 // global-effects // 120
|
||||
.word 0x0 // pad
|
||||
*/
|
||||
|
||||
int start_word_idx = lab.offset / 4;
|
||||
auto& words = env.file->words_by_seg.at(lab.target_segment);
|
||||
|
||||
auto& type_word = words.at(start_word_idx - 1);
|
||||
if (type_word.kind() != LinkedWord::TYPE_PTR || type_word.symbol_name() != "skeleton-group") {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid type pointer");
|
||||
}
|
||||
auto& name_word = words.at(start_word_idx + 1);
|
||||
if (name_word.kind() != LinkedWord::PTR) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid name label");
|
||||
}
|
||||
result.name = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(name_word.label_id())));
|
||||
auto& art_name_word = words.at(start_word_idx + 7);
|
||||
if (art_name_word.kind() != LinkedWord::PTR) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid art-group-name label");
|
||||
}
|
||||
result.art_group_name = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(art_name_word.label_id())));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
auto& word = words.at(start_word_idx + 11 + i);
|
||||
if (word.kind() != LinkedWord::PLAIN_DATA) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid bounds");
|
||||
}
|
||||
result.bounds[i] = *reinterpret_cast<float*>(&word.data);
|
||||
}
|
||||
auto& lod_word = words.at(start_word_idx + 18);
|
||||
if (lod_word.kind() != LinkedWord::PLAIN_DATA) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid max-lod");
|
||||
}
|
||||
result.max_lod = lod_word.data;
|
||||
auto& edge_word = words.at(start_word_idx + 25);
|
||||
if (edge_word.kind() != LinkedWord::PLAIN_DATA) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid longest-edge");
|
||||
}
|
||||
result.longest_edge = *reinterpret_cast<float*>(&edge_word.data);
|
||||
auto& other_word = words.at(start_word_idx + 26);
|
||||
if (other_word.kind() != LinkedWord::PLAIN_DATA) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid other data");
|
||||
}
|
||||
result.tex_level = other_word.get_byte(0);
|
||||
result.version = other_word.get_byte(1);
|
||||
result.shadow = other_word.get_byte(2);
|
||||
result.sort = other_word.get_byte(3);
|
||||
auto& index_word = words.at(start_word_idx + 27);
|
||||
if (index_word.kind() != LinkedWord::PLAIN_DATA) {
|
||||
env.func->warnings.error_and_throw("Reference to skelgroup bad: invalid index data");
|
||||
}
|
||||
result.origin_joint_index = index_word.get_byte(0);
|
||||
result.shadow_joint_index = index_word.get_byte(1);
|
||||
result.light_index = index_word.get_byte(2);
|
||||
|
||||
auto& clothing = words.at(start_word_idx + 28);
|
||||
if (clothing.kind() != LinkedWord::SYM_PTR && clothing.symbol_name() != "#f") {
|
||||
env.func->warnings.error_and_throw(
|
||||
"Reference to skelgroup bad: invalid clothing (should be #f)");
|
||||
}
|
||||
|
||||
result.global_effects = words.at(start_word_idx + 29).get_byte(0);
|
||||
|
||||
for (auto i : empty_words_jak3) {
|
||||
auto& word = words.at(start_word_idx + i);
|
||||
if (word.data != LinkedWord::PLAIN_DATA || word.data != 0) {
|
||||
env.func->warnings.error_and_throw(fmt::format("Reference to skelgroup bad: set word {}", i));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
DefskelgroupElement::Info get_defskelgroup_entries(Form* body,
|
||||
const Env& env,
|
||||
const RegisterAccess& let_dest_var) {
|
||||
|
@ -264,6 +378,62 @@ DefskelgroupElement::Info get_defskelgroup_entries(Form* body,
|
|||
return out_info;
|
||||
}
|
||||
|
||||
DefskelgroupElement::Info get_defskelgroup_entries_jak3(Form* body,
|
||||
const Env& env,
|
||||
const RegisterAccess& let_dest_var) {
|
||||
DefskelgroupElement::Info out_info;
|
||||
|
||||
// next, all the handlers
|
||||
for (int i = 1; i < body->size() - 1; ++i) {
|
||||
auto matcher =
|
||||
i < 3 ? Matcher::set(
|
||||
Matcher::deref(Matcher::any_reg(0), false, {DerefTokenMatcher::any_string(1)}),
|
||||
Matcher::any(2))
|
||||
: Matcher::set(Matcher::deref(Matcher::any_reg(0), false,
|
||||
{DerefTokenMatcher::any_string(1),
|
||||
DerefTokenMatcher::integer((i - 1) / 2 - 1)}),
|
||||
Matcher::any(3));
|
||||
Form temp;
|
||||
temp.elts().push_back(body->at(i));
|
||||
auto mr = match(matcher, &temp);
|
||||
|
||||
if (!mr.matched) {
|
||||
env.func->warnings.error_and_throw("defskelgroup set no match");
|
||||
}
|
||||
|
||||
auto& var = mr.maps.regs.at(0);
|
||||
auto& name = mr.maps.strings.at(1);
|
||||
auto val = i < 3 ? mr.maps.forms.at(2) : mr.maps.forms.at(3);
|
||||
|
||||
while (val->try_as_element<CastElement>()) {
|
||||
val = val->try_as_element<CastElement>()->source();
|
||||
}
|
||||
|
||||
if (!var || env.get_variable_name(*var) != env.get_variable_name(let_dest_var)) {
|
||||
if (var) {
|
||||
env.func->warnings.error_and_throw("Messed up defskelgroup. It is in {}, but we set {}",
|
||||
env.get_variable_name(let_dest_var),
|
||||
env.get_variable_name(*var));
|
||||
} else {
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (name == "jgeo") {
|
||||
out_info.jgeo = val;
|
||||
} else if (name == "janim") {
|
||||
out_info.janim = val;
|
||||
} else if (name == "mgeo") {
|
||||
auto& this_entry = out_info.lods.emplace_back();
|
||||
this_entry.mgeo = val;
|
||||
} else if (name == "lod-dist") {
|
||||
auto& this_entry = out_info.lods.back();
|
||||
this_entry.lod_dist = val;
|
||||
}
|
||||
}
|
||||
return out_info;
|
||||
}
|
||||
|
||||
FormElement* rewrite_defskelgroup(LetElement* elt,
|
||||
const Env& env,
|
||||
DefskelgroupElement::StaticInfo& skelgroup_info,
|
||||
|
@ -272,13 +442,16 @@ FormElement* rewrite_defskelgroup(LetElement* elt,
|
|||
// (set! *hopper-sg* v1-1)
|
||||
ASSERT(elt->body()->size() > 0);
|
||||
|
||||
int last_lod = (elt->body()->size() - 3) / 2 - 1;
|
||||
int last_lod = env.version == GameVersion::Jak3 ? (elt->body()->size() - 4) / 2 - 1
|
||||
: (elt->body()->size() - 3) / 2 - 1;
|
||||
if (last_lod > skelgroup_info.max_lod) {
|
||||
env.func->warnings.error_and_throw("defskelgroup exceeds max-lod of {} ({})",
|
||||
skelgroup_info.max_lod, last_lod);
|
||||
}
|
||||
|
||||
auto rest_info = get_defskelgroup_entries(elt->body(), env, elt->entries().at(0).dest);
|
||||
auto rest_info = env.version == GameVersion::Jak3
|
||||
? get_defskelgroup_entries_jak3(elt->body(), env, elt->entries().at(0).dest)
|
||||
: get_defskelgroup_entries(elt->body(), env, elt->entries().at(0).dest);
|
||||
|
||||
if (env.version != GameVersion::Jak1) {
|
||||
return pool.alloc_element<DefskelgroupElement>(skelgroup_info.name, rest_info, skelgroup_info);
|
||||
|
@ -289,6 +462,129 @@ FormElement* rewrite_defskelgroup(LetElement* elt,
|
|||
}
|
||||
} // namespace
|
||||
|
||||
DefskelgroupElement::ClothParams get_cloth_params(const DecompilerLabel& label, Env& env) {
|
||||
/*
|
||||
L446:
|
||||
.word 0xb
|
||||
.word 0x48000000
|
||||
.word 0x3f400000
|
||||
.word 0x6
|
||||
.word 0x0
|
||||
.word 0x0
|
||||
.word 0xa
|
||||
.word 0x0
|
||||
.word L449
|
||||
.word L449
|
||||
.word L449
|
||||
.word L448
|
||||
.word L448
|
||||
.word L448
|
||||
.word 0x3f800000
|
||||
.word 0x3
|
||||
.word 0x3e808312
|
||||
.word 0x434ccccd
|
||||
.word 0x1
|
||||
.word 0x0
|
||||
.word 0x0
|
||||
.word 0x0
|
||||
.word 0x0
|
||||
.word 0x0
|
||||
*/
|
||||
DefskelgroupElement::ClothParams params;
|
||||
int start_word_idx = label.offset / 4;
|
||||
auto& words = env.file->words_by_seg.at(label.target_segment);
|
||||
params.mesh = words.at(start_word_idx).data;
|
||||
params.gravity = *reinterpret_cast<float*>(&words.at(start_word_idx + 1).data);
|
||||
params.wind = *reinterpret_cast<float*>(&words.at(start_word_idx + 2).data);
|
||||
auto word3 = words.at(start_word_idx + 3).data;
|
||||
params.width = word3 & 0xffff;
|
||||
params.sphere_constraints = (word3 >> 16) & 0xffff;
|
||||
auto word4 = words.at(start_word_idx + 4).data;
|
||||
auto disc = word4 & 0xffff;
|
||||
auto anchor = (word4 >> 16) & 0xffff;
|
||||
params.disc_constraints = disc;
|
||||
params.anchor_points = anchor;
|
||||
auto flags_hi = words.at(start_word_idx + 5).data;
|
||||
auto flags_lo = words.at(start_word_idx + 6).data;
|
||||
params.flags = static_cast<u64>(flags_hi) << 32 | flags_lo;
|
||||
// these can be #f
|
||||
auto& tex_name_word = words.at(start_word_idx + 8);
|
||||
if (tex_name_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.tex_name = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(tex_name_word.label_id())));
|
||||
}
|
||||
auto& tex_name2_word = words.at(start_word_idx + 9);
|
||||
if (tex_name2_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.tex_name2 = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(tex_name2_word.label_id())));
|
||||
}
|
||||
auto& tex_name3_word = words.at(start_word_idx + 10);
|
||||
if (tex_name3_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.tex_name3 = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(tex_name3_word.label_id())));
|
||||
}
|
||||
auto& alt_tex_name_word = words.at(start_word_idx + 11);
|
||||
if (alt_tex_name_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.alt_tex_name = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(alt_tex_name_word.label_id())));
|
||||
}
|
||||
auto& alt_tex_name2_word = words.at(start_word_idx + 12);
|
||||
if (alt_tex_name2_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.alt_tex_name2 = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(alt_tex_name2_word.label_id())));
|
||||
}
|
||||
auto& alt_tex_name3_word = words.at(start_word_idx + 13);
|
||||
if (alt_tex_name3_word.kind() != LinkedWord::SYM_PTR) {
|
||||
params.alt_tex_name3 = env.file->get_goal_string_by_label(
|
||||
env.file->get_label_by_name(env.file->get_label_name(alt_tex_name3_word.label_id())));
|
||||
}
|
||||
params.thickness = *reinterpret_cast<float*>(&words.at(start_word_idx + 14).data);
|
||||
params.xform = words.at(start_word_idx + 15).data;
|
||||
params.drag = *reinterpret_cast<float*>(&words.at(start_word_idx + 16).data);
|
||||
params.ball_collision_radius = *reinterpret_cast<float*>(&words.at(start_word_idx + 17).data);
|
||||
params.iterations = words.at(start_word_idx + 18).get_byte(0);
|
||||
params.timestep_freq = words.at(start_word_idx + 18).get_byte(1);
|
||||
auto secret_hi = words.at(start_word_idx + 21).data;
|
||||
auto secret_lo = words.at(start_word_idx + 20).data;
|
||||
params.secret = static_cast<u64>(secret_hi) << 32 | secret_lo;
|
||||
return params;
|
||||
}
|
||||
|
||||
void inspect_cloth_data_jak3(LetElement* let, DefskelgroupElement::StaticInfo& info, Env& env) {
|
||||
auto body = let->body();
|
||||
auto when = dynamic_cast<CondNoElseElement*>(body->at(0));
|
||||
if (when) {
|
||||
auto cond = when->entries.at(0).condition;
|
||||
if (cond) {
|
||||
auto matcher = Matcher::op(GenericOpMatcher::condition(IR2_Condition::Kind::TRUTHY),
|
||||
{Matcher::symbol("#f")});
|
||||
auto mr = match(matcher, cond);
|
||||
if (mr.matched) {
|
||||
// no cloth data
|
||||
return;
|
||||
} else {
|
||||
// get the cloth array
|
||||
auto when_body = when->entries.at(0).body;
|
||||
auto array_set = dynamic_cast<SetFormFormElement*>(when_body->at(0));
|
||||
if (array_set) {
|
||||
// get elements
|
||||
auto elts = when_body->elts().size() - 2;
|
||||
for (int i = 0; i < elts; i++) {
|
||||
auto parms_form = dynamic_cast<SetFormFormElement*>(when_body->at(i + 1));
|
||||
if (parms_form) {
|
||||
auto parms_data = dynamic_cast<DecompiledDataElement*>(parms_form->src()->at(0));
|
||||
if (parms_data) {
|
||||
info.clothing.push_back(get_cloth_params(parms_data->label(), env));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void run_defskelgroups(Function& top_level_func) {
|
||||
auto& env = top_level_func.ir2.env;
|
||||
auto& pool = *top_level_func.ir2.form_pool;
|
||||
|
@ -318,10 +614,17 @@ void run_defskelgroups(Function& top_level_func) {
|
|||
if (src_as_label && env.get_variable_type(as_let->entries().at(0).dest, false) ==
|
||||
TypeSpec("skeleton-group")) {
|
||||
DefskelgroupElement::StaticInfo sg;
|
||||
if (env.version != GameVersion::Jak1) {
|
||||
sg = inspect_skel_group_data_jak2(src_as_label, env);
|
||||
} else {
|
||||
sg = inspect_skel_group_data(src_as_label, env);
|
||||
switch (env.version) {
|
||||
case GameVersion::Jak1:
|
||||
sg = inspect_skel_group_data_jak1(src_as_label, env);
|
||||
break;
|
||||
case GameVersion::Jak2:
|
||||
sg = inspect_skel_group_data_jak2(src_as_label, env);
|
||||
break;
|
||||
case GameVersion::Jak3:
|
||||
sg = inspect_skel_group_data_jak3(src_as_label, env);
|
||||
inspect_cloth_data_jak3(as_let, sg, env);
|
||||
break;
|
||||
}
|
||||
auto rewritten = rewrite_defskelgroup(as_let, env, sg, pool);
|
||||
if (rewritten) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because one or more lines are too long
|
@ -386,7 +386,8 @@
|
|||
"generic-warp-dest-proc",
|
||||
"generic-warp-dest",
|
||||
"generic-warp-envmap-dest",
|
||||
"generic-no-light-proc"
|
||||
"generic-no-light-proc",
|
||||
"(method 21 cloth-system)"
|
||||
],
|
||||
|
||||
"mips2c_jump_table_functions": {},
|
||||
|
|
|
@ -43,5 +43,27 @@
|
|||
"capture": [["L4", "gs-store-image-packet"]],
|
||||
"pat-h": [["L1", "(inline-array pat-mode-info)", 4]],
|
||||
"ambient-h": [["L1", "(inline-array talker-speech-class)", 365]],
|
||||
"lights": [["L51", "light-hash-work"]]
|
||||
"lights": [["L51", "light-hash-work"]],
|
||||
"target-util": [
|
||||
["L447", "cloth-params"],
|
||||
["L446", "cloth-params"],
|
||||
["L443", "cloth-params"],
|
||||
["L427", "cloth-params"],
|
||||
["L426", "cloth-params"],
|
||||
["L425", "cloth-params"]
|
||||
],
|
||||
"scene-actor": [
|
||||
["L370", "cloth-params"],
|
||||
["L369", "cloth-params"],
|
||||
["L367", "cloth-params"],
|
||||
["L356", "cloth-params"],
|
||||
["L355", "cloth-params"],
|
||||
["L343", "cloth-params"],
|
||||
["L308", "cloth-params"],
|
||||
["L307", "cloth-params"],
|
||||
["L305", "cloth-params"],
|
||||
["L304", "cloth-params"],
|
||||
["L303", "cloth-params"],
|
||||
["L296", "cloth-params"]
|
||||
]
|
||||
}
|
||||
|
|
|
@ -32,5 +32,27 @@
|
|||
[16, "bounding-box"],
|
||||
[48, "vector"],
|
||||
[64, "vector"]
|
||||
]
|
||||
],
|
||||
"(method 19 cloth-system)": [
|
||||
[16, "vector"],
|
||||
[32, "vector"]
|
||||
],
|
||||
"(method 35 cloth-on-skeleton)": [[16, "vector"]],
|
||||
"(method 22 cloth-system)": [
|
||||
[80, "vector"],
|
||||
[144, "vector"]
|
||||
],
|
||||
"(method 14 cloth-on-skeleton)": [[16, "matrix"]],
|
||||
"(method 36 cloth-on-skeleton)": [[16, "matrix"]],
|
||||
"(method 24 cloth-system)": [[48, "current-position-info"]],
|
||||
"(method 28 cloth-system)": [
|
||||
[64, "vector"],
|
||||
[64, "vector"]
|
||||
],
|
||||
"(method 23 cloth-system)": [
|
||||
[16, "matrix"],
|
||||
[128, "vector"],
|
||||
[192, "vector"]
|
||||
],
|
||||
"matrix<-parented-transformq!": [[16, "vector"]]
|
||||
}
|
||||
|
|
|
@ -322,9 +322,6 @@
|
|||
[15, "gp", "collide-shape-moving"],
|
||||
[35, "gp", "collide-shape-moving"]
|
||||
],
|
||||
"joint-mod-rotate-world-callback": [
|
||||
[[0, 24], "s3", "joint-mod-rotate-world"]
|
||||
],
|
||||
"joint-mod-set-local-callback": [[[1, 24], "v1", "joint-mod-set-local"]],
|
||||
"joint-mod-add-local-callback": [[[1, 37], "s4", "joint-mod-add-local"]],
|
||||
"joint-mod-set-world-callback": [[[1, 4], "v1", "joint-mod-set-local"]],
|
||||
|
@ -426,10 +423,106 @@
|
|||
],
|
||||
"ear-trans": [[32, "s5", "process-focusable"]],
|
||||
"loader-test-command": [[[5, 10], "v1", "sound-rpc-test-cmd"]],
|
||||
"(method 11 connection)": [[5, "a1", "pointer"]],
|
||||
"update-light-hash": [
|
||||
[[234, 239], "a1", "light-hash-bucket"],
|
||||
[[207, 211], "a0", "light-hash-bucket"]
|
||||
],
|
||||
"desaturate-mood-colors": [[[20, 90], "a0", "(inline-array mood-color)"]]
|
||||
"desaturate-mood-colors": [[[20, 90], "a0", "(inline-array mood-color)"]],
|
||||
"(method 9 cloth-on-skeleton)": [
|
||||
[58, "a0", "process-focusable"],
|
||||
[80, "s5", "process-focusable"],
|
||||
[84, "s5", "process-focusable"],
|
||||
[95, "s5", "process-focusable"],
|
||||
[98, "s5", "process-focusable"],
|
||||
[123, "s5", "process-focusable"]
|
||||
],
|
||||
"(method 13 cloth-system)": [
|
||||
[143, "a1", "vector"],
|
||||
[144, "a3", "vector"],
|
||||
[147, "a1", "vector"],
|
||||
[148, "a1", "vector"]
|
||||
],
|
||||
"(method 37 cloth-system)": [
|
||||
[27, "s3", "pair"],
|
||||
[32, "s3", "pair"],
|
||||
[33, "s3", "pair"],
|
||||
[69, "v1", "pair"]
|
||||
],
|
||||
"(method 11 cloth-on-skeleton)": [[17, "a1", "process-drawable"]],
|
||||
"(method 25 cloth-on-skeleton)": [
|
||||
[22, "v1", "process-drawable"],
|
||||
[25, "v1", "process-focusable"]
|
||||
],
|
||||
"(method 16 cloth-system)": [[21, "v1", "int"]],
|
||||
"(method 33 cloth-on-skeleton)": [[11, "v1", "process-focusable"]],
|
||||
"(method 18 cloth-on-skeleton)": [[15, "a1", "process-focusable"]],
|
||||
"(method 35 cloth-on-skeleton)": [
|
||||
[27, "s5", "process-focusable"],
|
||||
[113, "s5", "process-focusable"],
|
||||
[193, "s5", "process-focusable"],
|
||||
[217, "s5", "process-focusable"]
|
||||
],
|
||||
"(method 14 cloth-on-skeleton)": [
|
||||
[18, "s4", "process-focusable"],
|
||||
[39, "s4", "process-focusable"],
|
||||
[35, "s4", "process-focusable"]
|
||||
],
|
||||
"(method 36 cloth-on-skeleton)": [
|
||||
[18, "s4", "process-focusable"],
|
||||
[35, "s4", "process-focusable"],
|
||||
[39, "s4", "process-focusable"]
|
||||
],
|
||||
"(method 23 cloth-system)": [
|
||||
[120, "f1", "float"],
|
||||
["_stack_", 152, "float"],
|
||||
["_stack_", 156, "float"],
|
||||
["_stack_", 164, "float"],
|
||||
["_stack_", 168, "float"],
|
||||
["_stack_", 212, "float"]
|
||||
],
|
||||
"(method 22 cloth-system)": [
|
||||
["_stack_", 104, "float"],
|
||||
["_stack_", 108, "float"],
|
||||
["_stack_", 116, "float"],
|
||||
["_stack_", 120, "float"],
|
||||
["_stack_", 160, "float"],
|
||||
["_stack_", 164, "float"]
|
||||
],
|
||||
"(method 10 cloth-on-skeleton)": [
|
||||
[30, "s4", "process-focusable"],
|
||||
[153, "s4", "process-focusable"],
|
||||
[160, "v0", "joint"],
|
||||
[122, "s4", "process-focusable"],
|
||||
[129, "v0", "joint"],
|
||||
[92, "s4", "process-focusable"],
|
||||
[99, "v0", "joint"]
|
||||
],
|
||||
"emerc-vu1-init-buffer": [[[82, 84], "v1", "dma-packet"]],
|
||||
"emerc-vu1-initialize-chain": [
|
||||
[[19, 59], "s5", "emerc-vu1-low-mem"],
|
||||
[80, "gp", "(inline-array dma-packet)"],
|
||||
[[12, 18], "gp", "(pointer vif-tag)"]
|
||||
],
|
||||
"merc-edge-stats": [[31, "v1", "merc-ctrl"]],
|
||||
"(method 8 merc-ctrl)": [
|
||||
[46, "s2", "pointer"], // was merc-fragment-control
|
||||
[[22, 45], "s2", "merc-fragment-control"],
|
||||
[[89, 93], "a1", "merc-blend-ctrl"],
|
||||
[103, "a1", "pointer"]
|
||||
],
|
||||
"merc-vu1-initialize-chain": [
|
||||
[[13, 19], "gp", "(pointer vif-tag)"],
|
||||
[[19, 116], "s5", "merc-vu1-low-mem"],
|
||||
[127, "gp", "(inline-array dma-packet)"]
|
||||
],
|
||||
"(method 9 merc-fragment)": [[[13, 265], "s1", "adgif-shader"]],
|
||||
"(method 9 merc-effect)": [
|
||||
[38, "v1", "merc-eye-ctrl"],
|
||||
[63, "s4", "pointer"],
|
||||
[64, "s5", "pointer"]
|
||||
],
|
||||
"merc-vu1-init-buffer": [[[90, 92], "v1", "dma-packet"]],
|
||||
"texture-usage-init": [[27, "a1", "vector"]],
|
||||
"(method 9 art)": [[9, "v1", "pointer"]],
|
||||
"(code pov-camera-start-playing pov-camera)": [[24, "v0", "joint"]]
|
||||
}
|
||||
|
|
|
@ -1174,5 +1174,63 @@
|
|||
"vars": {
|
||||
"v0-0": ["this", "align-control"]
|
||||
}
|
||||
},
|
||||
"(method 37 cloth-system)": {
|
||||
"args": ["this", "command"],
|
||||
"vars": {
|
||||
"s5-0": "msg",
|
||||
"s4-0": "flags"
|
||||
}
|
||||
},
|
||||
"(method 11 cloth-on-skeleton)": {
|
||||
"vars": {
|
||||
"a1-0": "proc"
|
||||
}
|
||||
},
|
||||
"(method 25 cloth-on-skeleton)": {
|
||||
"vars": {
|
||||
"v1-1": "proc",
|
||||
"a1-3": "draw-ctrl",
|
||||
"v1-4": "fade"
|
||||
}
|
||||
},
|
||||
"(method 33 cloth-on-skeleton)": {
|
||||
"vars": {
|
||||
"v1-3": "draw-ctrl"
|
||||
},
|
||||
"args": ["this", "lights"]
|
||||
},
|
||||
"(method 33 cloth-system)": {
|
||||
"args": ["this", "lights"]
|
||||
},
|
||||
"emerc-vu1-init-buffer": {
|
||||
"args": ["bucket", "arg1", "arg2"],
|
||||
"vars": {
|
||||
"v1-0": "disp",
|
||||
"a1-6": "block-len",
|
||||
"a3-0": "dma-buf",
|
||||
"s5-0": "dma-bucket",
|
||||
"s3-0": "buf",
|
||||
"s4-3": "base",
|
||||
"v1-17": "packet"
|
||||
}
|
||||
},
|
||||
"emerc-vu1-initialize-chain": {
|
||||
"args": ["gif-packet"]
|
||||
},
|
||||
"(method 9 merc-effect)": {
|
||||
"vars": {
|
||||
"v1-0": "tex-login",
|
||||
"s5-0": "tex-idx",
|
||||
"v1-1": "extra",
|
||||
"s4-0": "eye-ctrl",
|
||||
"a0-12": "ctrl-header",
|
||||
"a0-10": "shader",
|
||||
"s5-1": "fragment",
|
||||
"s4-1": "geo",
|
||||
"s3-0": "frag-idx",
|
||||
"s2-0": "sizeof-frag",
|
||||
"s1-0": "sizeof-geo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
(notify-of-abort 0)
|
||||
(allow-abort 1)
|
||||
(inherit-orientation 2)
|
||||
(pcf3 3)
|
||||
)
|
||||
;; ---pov-camera-flags
|
||||
|
||||
|
|
|
@ -5,6 +5,37 @@
|
|||
;; name in dgo: cloth-art-h
|
||||
;; dgos: GAME
|
||||
|
||||
;; +++cloth-flag
|
||||
(defenum cloth-flag
|
||||
:type uint64
|
||||
:bitfield #t
|
||||
(no-gravity 0)
|
||||
(use-wind 1)
|
||||
(need-reset 2)
|
||||
(double-sided 3)
|
||||
(suppress-mesh-failure 4)
|
||||
(active 5)
|
||||
(check-ground 6)
|
||||
(flip-normals 7)
|
||||
(wraps 8)
|
||||
(inited 9)
|
||||
(no-draw 10)
|
||||
(need-setup 11)
|
||||
(use-global-wind 12)
|
||||
(autogen-uvs 13)
|
||||
(use-momentum 14)
|
||||
(use-parent-momentum 15)
|
||||
(riding 16)
|
||||
(hidden 17)
|
||||
(local-space 18)
|
||||
(local-space-xyz 19)
|
||||
(local-space-y 20)
|
||||
(use-old-resets 21)
|
||||
(using-alt-tex 22)
|
||||
)
|
||||
;; ---cloth-flag
|
||||
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype cloth-pt (structure)
|
||||
|
@ -17,7 +48,7 @@
|
|||
|
||||
(deftype anchor-transform (structure)
|
||||
((offset vector :inline)
|
||||
(joint-name basic)
|
||||
(joint-name string)
|
||||
(joint int16)
|
||||
(constraint-index int16)
|
||||
)
|
||||
|
@ -26,7 +57,7 @@
|
|||
|
||||
(deftype sphere-transform (structure)
|
||||
((offset vector :inline)
|
||||
(joint-name basic)
|
||||
(joint-name string)
|
||||
(radius float)
|
||||
(joint int16)
|
||||
)
|
||||
|
@ -79,34 +110,40 @@
|
|||
|
||||
(deftype cloth-params (structure)
|
||||
((mesh int16)
|
||||
(gravity-constant float)
|
||||
(gravity-constant meters)
|
||||
(wind-constant float)
|
||||
(cloth-width uint16)
|
||||
(num-sphere-constraints uint16)
|
||||
(num-disc-constraints uint16)
|
||||
(num-anchor-points uint16)
|
||||
(flags uint64)
|
||||
(tex-name basic)
|
||||
(tex-name2 basic)
|
||||
(tex-name3 basic)
|
||||
(alt-tex-name basic)
|
||||
(alt-tex-name2 basic)
|
||||
(alt-tex-name3 basic)
|
||||
(flags cloth-flag)
|
||||
(tex-name string)
|
||||
(tex-name2 string)
|
||||
(tex-name3 string)
|
||||
(alt-tex-name string)
|
||||
(alt-tex-name2 string)
|
||||
(alt-tex-name3 string)
|
||||
(cloth-thickness float)
|
||||
(initial-xform int16)
|
||||
(drag float)
|
||||
(ball-collision-radius float)
|
||||
(ball-collision-radius meters)
|
||||
(num-iterations int8)
|
||||
(timestep-frequency int8)
|
||||
(secret-disable uint64)
|
||||
(secret-disable game-secrets)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro static-cloth-params (args)
|
||||
`(let ((parms (new 'static 'cloth-params)))
|
||||
,@(apply (lambda (x) `(set! (-> parms ,(car x)) ,(cadr x))) args)
|
||||
parms
|
||||
)
|
||||
)
|
||||
|
||||
(deftype cloth-base (basic)
|
||||
()
|
||||
(:methods
|
||||
(cloth-base-method-9 () none)
|
||||
(cloth-base-method-10 () none)
|
||||
(init! (_type_) int)
|
||||
(cloth-base-method-10 (_type_ cloth-params handle) int)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -49,10 +49,10 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
(allocated-num-verts uint16)
|
||||
(tex-id texture-id)
|
||||
(adnops gs-adcmd 2 :inline)
|
||||
(data0 uint64 :overlay-at (-> adnops 0 word 0))
|
||||
(reg0 uint64 :overlay-at (-> adnops 0 word 2))
|
||||
(data1 uint64 :offset 48)
|
||||
(reg1 uint64 :offset 56)
|
||||
(data0 gs-test :overlay-at (-> adnops 0 word 0))
|
||||
(reg0 gs-reg64 :overlay-at (-> adnops 0 word 2))
|
||||
(data1 gs-test :offset 48)
|
||||
(reg1 gs-reg64 :offset 56)
|
||||
(clamp gs-clamp)
|
||||
(alpha gs-alpha)
|
||||
(bucket bucket-id)
|
||||
|
@ -63,7 +63,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
)
|
||||
(:methods
|
||||
(new (symbol type int texture-id string) _type_)
|
||||
(prim-strip-method-10 () none)
|
||||
(prim-strip-method-10 (_type_ draw-control) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -79,9 +79,9 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
(set! (-> s5-0 flags) (prim-flags pf0 pf1))
|
||||
(set! (-> s5-0 num-verts) (the-as uint num-vertices))
|
||||
(set! (-> s5-0 allocated-num-verts) (the-as uint num-vertices))
|
||||
(set! (-> s5-0 data0) (the-as uint 0))
|
||||
(set! (-> s5-0 data0) (new 'static 'gs-test))
|
||||
(set! (-> s5-0 adnops 0 cmds) (gs-reg64 hack))
|
||||
(set! (-> s5-0 data1) (the-as uint 0))
|
||||
(set! (-> s5-0 data1) (new 'static 'gs-test))
|
||||
(set! (-> s5-0 adnops 1 cmds) (gs-reg64 hack))
|
||||
(set! (-> s5-0 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
|
||||
(set! (-> s5-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -156,18 +156,18 @@ This can be either an art container containing more arts, or an actual art thing
|
|||
(extra res-lump)
|
||||
)
|
||||
(:methods
|
||||
(art-method-9 () none)
|
||||
(art-method-10 () none)
|
||||
(art-method-11 () none)
|
||||
(art-method-12 () none)
|
||||
(art-method-13 () none)
|
||||
(login (_type_) _type_)
|
||||
(art-method-10 (_type_) _type_)
|
||||
(get-art-by-name-method (_type_ string type) basic)
|
||||
(get-art-idx-by-name-method (_type_ string type) int)
|
||||
(needs-link? (_type_) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype art-element (art)
|
||||
"Base class Art which is not a container of more art."
|
||||
((master-art-group-name basic)
|
||||
((master-art-group-name string)
|
||||
(master-art-group-index int32)
|
||||
(pad uint8 20)
|
||||
)
|
||||
|
@ -198,7 +198,8 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
|
|||
(data art-element :dynamic :offset 32)
|
||||
)
|
||||
(:methods
|
||||
(unknown-0 () none)
|
||||
(relocate (_type_ kheap (pointer uint8)) _type_ :replace)
|
||||
(link-art! (_type_) art-group)
|
||||
(unknown-1 () none)
|
||||
)
|
||||
)
|
||||
|
@ -210,17 +211,18 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
|
|||
|
||||
(deftype art-joint-geo (art-element)
|
||||
"Collection of joints for an actor."
|
||||
()
|
||||
((data joint :dynamic :offset 48)
|
||||
)
|
||||
)
|
||||
|
||||
(deftype art-cloth-geo (art-element)
|
||||
((anchor-transforms basic)
|
||||
(sphere-transforms basic)
|
||||
(disc-transforms basic)
|
||||
(cloth-thickness basic)
|
||||
((anchor-transforms anchor-transform-array)
|
||||
(sphere-transforms sphere-transform-array)
|
||||
(disc-transforms disc-transform-array)
|
||||
(cloth-thickness cloth-thickness-array)
|
||||
(thickness-scalar float)
|
||||
(num-points int32 :overlay-at length)
|
||||
(mesh object :dynamic :offset 80)
|
||||
(num-points int32 :overlay-at length)
|
||||
(mesh cloth-pt :inline :dynamic :offset 80)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -295,7 +297,7 @@ This stores settings like the name of the art-group, shadow/level-of-detail sett
|
|||
(global-effects uint8)
|
||||
)
|
||||
(:methods
|
||||
(skeleton-group-method-16 () none)
|
||||
(add-to-loading-level (_type_) skeleton-group)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -381,3 +383,83 @@ Each process-drawable has a draw-control."
|
|||
(defmethod get-skeleton-origin ((this draw-control))
|
||||
(-> this skeleton bones 0 transform trans)
|
||||
)
|
||||
|
||||
;; og:preserve-this
|
||||
;; look up the index of an art element in an art group.
|
||||
(desfun art-elt-index (ag-name elt-name)
|
||||
(if (number? elt-name)
|
||||
elt-name
|
||||
(let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name))))
|
||||
(if (not (car ag-info))
|
||||
(error (symbol->string ag-name))
|
||||
(let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name))))
|
||||
(if (not (car elt-info))
|
||||
(error (symbol->string ag-name))
|
||||
(cadr (cdr elt-info)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro defskelgroup (name ag-name joint-geom joint-anim lods
|
||||
&key (shadow 0)
|
||||
&key bounds
|
||||
&key (longest-edge 0.0)
|
||||
&key (texture-level 0)
|
||||
&key (sort 0)
|
||||
&key (version ART_GROUP_FILE_VERSION) ;; do NOT use this!
|
||||
&key (origin-joint-index 0)
|
||||
&key (shadow-joint-index 0)
|
||||
&key (light-index 0)
|
||||
&key (global-effects 0)
|
||||
&key (clothing ())
|
||||
)
|
||||
"Define a new static skeleton-group."
|
||||
`(let ((skel (new 'static 'skeleton-group
|
||||
:name ,(symbol->string name)
|
||||
:extra #f
|
||||
:info #f
|
||||
:art-group-name ,(symbol->string ag-name)
|
||||
:bounds ,bounds
|
||||
:longest-edge ,longest-edge
|
||||
:texture-level ,texture-level
|
||||
:version ,version
|
||||
:shadow ,(art-elt-index (string->symbol-format "{}-ag" ag-name) shadow)
|
||||
:shadow-joint-index ,shadow-joint-index
|
||||
:origin-joint-index ,origin-joint-index
|
||||
:max-lod ,(- (length lods) 1)
|
||||
:sort ,sort
|
||||
:light-index ,light-index
|
||||
:global-effects ,global-effects
|
||||
:clothing #f
|
||||
)))
|
||||
|
||||
;; set cloth params array if present
|
||||
(when ,(neq? clothing '())
|
||||
(set! (-> skel clothing) (new 'static 'boxed-array :type cloth-params :length 0 :allocated-length ,(length clothing)))
|
||||
,@(apply-i (lambda (x i) `(set! (-> skel clothing ,i) (static-cloth-params ,x))) clothing)
|
||||
(set! (-> skel clothing length) ,(length clothing))
|
||||
)
|
||||
|
||||
;; set joint geometry and joint bones
|
||||
(set! (-> skel jgeo) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) joint-geom))
|
||||
(set! (-> skel janim) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) joint-anim))
|
||||
|
||||
;; set lods
|
||||
,@(apply-i (lambda (x i)
|
||||
`(begin
|
||||
(set! (-> skel mgeo ,i) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) (car x)))
|
||||
(set! (-> skel lod-dist ,i) ,(cadr x))
|
||||
)
|
||||
) lods)
|
||||
|
||||
;; define skel group
|
||||
(define ,name skel)
|
||||
;; add to level
|
||||
(add-to-loading-level ,name)
|
||||
)
|
||||
)
|
||||
|
||||
(import "goal_src/jak3/engine/data/art-elts.gc")
|
||||
;; (import "goal_src/jak3/engine/data/joint-nodes.gc")
|
|
@ -339,6 +339,8 @@
|
|||
(letterbox-speed float)
|
||||
(borrow-city-count uint32 :offset 620)
|
||||
(borrow-city pair 3)
|
||||
(wind-vec vector :offset 736)
|
||||
(wind float :offset 740)
|
||||
(audio-language language-enum :offset 748)
|
||||
(ear-handle handle :offset 784)
|
||||
(special-volume float :offset 796)
|
||||
|
|
|
@ -7,3 +7,10 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define *wind-work*
|
||||
(new 'static 'wind-work :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0))
|
||||
)
|
||||
|
||||
(set! (-> *wind-work* to-ptrs 0) (the-as uint (&+ *fake-scratchpad-data* 8192)))
|
||||
(set! (-> *wind-work* to-ptrs 1) (the-as uint (&+ *fake-scratchpad-data* 4096)))
|
||||
(set! (-> *wind-work* to-ptrs 2) (the-as uint *fake-scratchpad-data*))
|
||||
|
|
|
@ -5,6 +5,10 @@
|
|||
;; name in dgo: eye-h
|
||||
;; dgos: GAME
|
||||
|
||||
(define-extern get-eye-block (function int int int))
|
||||
(define-extern find-free-eye-index (function int string int int))
|
||||
(define-extern free-eye-index (function int int))
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype eye (structure)
|
||||
|
|
|
@ -5,5 +5,18 @@
|
|||
;; name in dgo: foreground
|
||||
;; dgos: GAME
|
||||
|
||||
;; +++merc-mode
|
||||
(defenum merc-mode
|
||||
:type int32
|
||||
(merc 0)
|
||||
(emerc 1)
|
||||
(mercneric 2)
|
||||
(eye 3)
|
||||
(mm4 4)
|
||||
(mm5 5)
|
||||
)
|
||||
;; ---merc-mode
|
||||
|
||||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define emerc-vu1-block (new 'static 'vu-function #|:length #x56b :qlength #x2b6|#))
|
||||
|
|
|
@ -7,3 +7,142 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defun emerc-vu1-initialize-chain ((gif-packet dma-gif-packet))
|
||||
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (the-as dma-packet gif-packet) emerc-vu1-block 1))))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xb :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x9 :cmd (vif-cmd unpack-v4-32)))
|
||||
(let ((s5-0 (the-as emerc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32))))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
|
||||
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> s5-0 hvdf-offset quad) (-> *math-camera* hvdf-off quad))
|
||||
(quad-copy! (the-as pointer (-> s5-0 perspective)) (the-as pointer (-> *math-camera* perspective)) 4)
|
||||
(set-vector! (-> s5-0 fog) (-> *math-camera* pfog0) (-> *math-camera* fog-min) (-> *math-camera* fog-max) 0.0)
|
||||
(set-vector!
|
||||
(-> s5-0 unperspect)
|
||||
(/ 1.0 (-> *math-camera* perspective rvec x))
|
||||
(/ 1.0 (-> *math-camera* perspective uvec y))
|
||||
0.5
|
||||
(/ 1.0 (-> *math-camera* perspective fvec w))
|
||||
)
|
||||
)
|
||||
(let ((v1-21 (-> (the-as (inline-array dma-packet) gp-0) 11)))
|
||||
(set! (-> v1-21 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> v1-21 vif0) (new 'static 'vif-tag))
|
||||
(set! (-> v1-21 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
|
||||
(&+ v1-21 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun emerc-vu1-init-buffer ((bucket bucket-id) (arg1 gs-test) (arg2 int))
|
||||
(let ((disp *display*)
|
||||
(block-len (+ (* (+ (/ (-> emerc-vu1-block qlength) 127) 1) 16) 256))
|
||||
)
|
||||
(+! (-> disp mem-reserve-size) block-len)
|
||||
(when (not (-> disp dma-buffer-overflow))
|
||||
(let ((dma-buf (-> disp frames (-> disp on-screen) global-buf)))
|
||||
(if (< (-> dma-buf real-buffer-end) (the-as int (&+ (-> dma-buf base) block-len)))
|
||||
(set! (-> disp dma-buffer-overflow) #t)
|
||||
)
|
||||
)
|
||||
(when (not (-> disp dma-buffer-overflow))
|
||||
(let ((dma-bucket (-> *display* frames (-> *display* on-screen) bucket-group bucket)))
|
||||
(when (!= dma-bucket (-> dma-bucket last))
|
||||
(let* ((buf (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(base (-> buf base))
|
||||
)
|
||||
(set! (-> buf base) (the-as pointer (emerc-vu1-initialize-chain (the-as dma-gif-packet (-> buf base)))))
|
||||
(dma-buffer-add-gs-set buf (test-1 arg1))
|
||||
(let ((packet (the-as object (-> buf base))))
|
||||
(set! (-> (the-as (pointer uint64) packet)) (logior #x20000000 (shr (shl (-> dma-bucket next) 33) 1)))
|
||||
(set! (-> (the-as dma-packet packet) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet packet) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> buf base) (&+ (the-as pointer packet) 16))
|
||||
)
|
||||
(set! (-> dma-bucket next) (the-as uint base))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun emerc-vu1-init-buffers ()
|
||||
(when (logtest? (vu1-renderer-mask emerc) (-> *display* vu1-enable-user))
|
||||
(emerc-vu1-init-buffer (bucket-id bucket18) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket30) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket42) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket54) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket66) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket78) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket90) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket102) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket114) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket126) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket342) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket353) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket358) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket363) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket368) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket373) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket378) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket383) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket388) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket393) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket398) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket403) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket137) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket147) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket157) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket167) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket177) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket187) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket197) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket207) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket217) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket227) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket347) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket235) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket246) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket257) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket268) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket279) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket290) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket301) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket312) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket323) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket334) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket408) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket413) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket418) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket423) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket428) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket433) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket438) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket443) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket448) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket453) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket458) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
(lump-four-count uint8)
|
||||
(fp-qwc uint8)
|
||||
(mat-xfer-count uint8)
|
||||
(mat-dest-data merc-mat-dest :dynamic)
|
||||
(mat-dest-data merc-mat-dest :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -311,7 +311,7 @@ Consists of a header and a list of [[merc-effect]]s."
|
|||
((num-joints int32 :overlay-at length)
|
||||
(seg-table (array uint64) :overlay-at (-> pad 0))
|
||||
(header merc-ctrl-header :inline)
|
||||
(effect merc-effect :dynamic)
|
||||
(effect merc-effect :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define merc-vu1-block (new 'static 'vu-function #|:length #x7e5 :qlength #x3f3|#))
|
||||
|
|
|
@ -7,3 +7,627 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(define *texture-login-data* (new 'static 'texture-login-data))
|
||||
|
||||
(defmethod login ((this art-joint-geo))
|
||||
(let ((s5-0 *texture-login-data*))
|
||||
(set! (-> s5-0 default-texture-index)
|
||||
(res-lump-value (-> this extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
(defun texture-usage-init ((arg0 merc-ctrl))
|
||||
(let ((gp-0 *texture-login-data*))
|
||||
(if (zero? (-> arg0 header texture-usage-group))
|
||||
(set! (-> arg0 header texture-usage-group) (new 'loading-level 'texture-usage-group))
|
||||
)
|
||||
(set! (-> gp-0 texture-usage-group) (-> arg0 header texture-usage-group))
|
||||
(set! (-> gp-0 merc-ctrl-header) (-> arg0 header))
|
||||
(set! (-> gp-0 name) (-> arg0 name))
|
||||
(dotimes (v1-7 7)
|
||||
(dotimes (a0-2 3)
|
||||
(set! (-> (the-as vector (+ (the-as uint (-> gp-0 texture-usage-group)) (* 48 v1-7) (* a0-2 16))) quad)
|
||||
(the-as uint128 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
(defun texture-usage-update ((arg0 texture))
|
||||
(local-vars (a3-3 uint128))
|
||||
(let* ((v1-0 *texture-login-data*)
|
||||
(a1-0 (-> v1-0 current-texture-index))
|
||||
(v1-2 (-> v1-0 texture-usage-group data a1-0))
|
||||
)
|
||||
(dotimes (a1-3 3)
|
||||
(let* ((a2-3 (-> v1-2 data a1-3))
|
||||
(t1-0 (-> arg0 masks data a1-3))
|
||||
(a3-2 (-> a2-3 mask quad))
|
||||
(t0-0 (-> t1-0 mask quad))
|
||||
(f0-0 (-> a2-3 dist))
|
||||
(f1-0 (-> t1-0 dist))
|
||||
)
|
||||
(.por a3-3 a3-2 t0-0)
|
||||
(let ((f0-1 (fmax f0-0 f1-0)))
|
||||
(set! (-> a2-3 mask quad) a3-3)
|
||||
(set! (-> a2-3 dist) f0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of ((this merc-fragment))
|
||||
(the-as int (* (-> this header mm-quadword-size) 16))
|
||||
)
|
||||
|
||||
(defmethod login-adgifs ((this merc-fragment))
|
||||
(local-vars (v0-5 symbol) (sv-16 uint) (sv-32 int))
|
||||
(let* ((s5-0 (merc-fragment-fp-data this))
|
||||
(v1-1 (-> *texture-login-data* merc-ctrl-header))
|
||||
(s4-0 (if (nonzero? (-> v1-1 eye-ctrl))
|
||||
(-> v1-1 eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
(s3-0 #x300200)
|
||||
(s2-0 #x300300)
|
||||
(s1-0 (the-as adgif-shader (&+ s5-0 16)))
|
||||
)
|
||||
(dotimes (s0-0 (the-as int (-> s5-0 shader-cnt)))
|
||||
(let ((v1-2 (-> s4-0 eye-ctrl-index))
|
||||
(a0-4 (logand (the-as texture-id -256) (-> s1-0 texture-id)))
|
||||
)
|
||||
(set! v0-5
|
||||
(cond
|
||||
((and s4-0 (!= v1-2 -1) (or (= a0-4 s3-0) (= a0-4 s2-0)))
|
||||
(let ((v1-5 (-> *eye-control-array* data v1-2)))
|
||||
(set! sv-16 (-> v1-5 eye-slot))
|
||||
(if (= a0-4 s2-0)
|
||||
(set! sv-32 1)
|
||||
(set! sv-32 0)
|
||||
)
|
||||
(let ((a0-10 (-> v1-5 eyes sv-32)))
|
||||
(set! (-> a0-10 shader (-> a0-10 shader-count)) s1-0)
|
||||
(+! (-> a0-10 shader-count) 1)
|
||||
)
|
||||
(cond
|
||||
((-> v1-5 high-res?)
|
||||
(adgif-shader-login s1-0)
|
||||
(let ((v1-9 (+ (-> *eyes-texture-base* vram-block) (* (+ (* sv-16 4) sv-32) 32))))
|
||||
(set! (-> s1-0 tex0 tbp0) v1-9)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tw) 6)
|
||||
(set! (-> s1-0 tex0 th) 6)
|
||||
(set! (-> s1-0 tex0 tbw) 2)
|
||||
(set! (-> s1-0 clamp)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(adgif-shader-login s1-0)
|
||||
(let ((v0-3 (get-eye-block (the-as int sv-16) sv-32)))
|
||||
(set! (-> s1-0 tex0 tbp0) v0-3)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tw) 5)
|
||||
(set! (-> s1-0 tex0 th) 5)
|
||||
(set! (-> s1-0 tex0 tbw) 1)
|
||||
(set! (-> s1-0 clamp)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tcc) 1)
|
||||
(set! (-> s1-0 tex0 psm) 0)
|
||||
(set! (-> s1-0 tex1 mxl) 0)
|
||||
v0-5
|
||||
)
|
||||
(else
|
||||
(let ((a0-39 (adgif-shader-login s1-0)))
|
||||
(if a0-39
|
||||
(texture-usage-update a0-39)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! s1-0 80)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of ((this merc-fragment-control))
|
||||
(the-as int (+ (* (-> this mat-xfer-count) 2) 4))
|
||||
)
|
||||
|
||||
|
||||
;; WARN: Return type mismatch merc-effect vs none.
|
||||
(defmethod login-adgifs ((this merc-effect))
|
||||
(let* ((tex-login *texture-login-data*)
|
||||
(tex-idx (-> tex-login default-texture-index))
|
||||
)
|
||||
(when (= (-> this merc-effect-version) 1)
|
||||
(if (!= (-> this texture-index) 255)
|
||||
(set! tex-idx (the-as int (-> this texture-index)))
|
||||
)
|
||||
)
|
||||
(set! (-> tex-login current-texture-index) tex-idx)
|
||||
(set! (-> this texture-index) (the-as uint tex-idx))
|
||||
(let ((extra (-> this extra-info)))
|
||||
(when (nonzero? extra)
|
||||
(when (nonzero? (-> extra shader-offset))
|
||||
(let ((shader (adgif-shader-login (the-as adgif-shader (+ (the-as uint extra) (* (-> extra shader-offset) 16))))))
|
||||
(if shader
|
||||
(texture-usage-update shader)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((v1-3 (the-as structure (-> *kernel-context* login-object)))
|
||||
(ctrl-header (-> *texture-login-data* merc-ctrl-header))
|
||||
(eye-ctrl (if (nonzero? (-> ctrl-header eye-ctrl))
|
||||
(-> ctrl-header eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if eye-ctrl
|
||||
(set! (-> eye-ctrl eye-ctrl-index)
|
||||
(find-free-eye-index
|
||||
tex-idx
|
||||
(the-as string (-> (the-as merc-eye-ctrl v1-3) left-iris-shader quad 0 data 0))
|
||||
(-> eye-ctrl eye-slot)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((fragment (the-as object (-> this frag-ctrl)))
|
||||
(geo (the-as object (-> this frag-geo)))
|
||||
)
|
||||
(dotimes (frag-idx (the-as int (-> this frag-count)))
|
||||
(let ((sizeof-frag ((method-of-type merc-fragment-control asize-of) (the-as merc-fragment-control fragment))))
|
||||
(let ((sizeof-geo ((method-of-type merc-fragment asize-of) (the-as merc-fragment geo))))
|
||||
((method-of-type merc-fragment login-adgifs) (the-as merc-fragment geo))
|
||||
(set! geo (&+ (the-as pointer geo) sizeof-geo))
|
||||
)
|
||||
(set! fragment (&+ (the-as pointer fragment) sizeof-frag))
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
(defmethod mem-usage ((this merc-ctrl) (usage memory-usage-block) (flags int))
|
||||
(if (-> this extra)
|
||||
(mem-usage (-> this extra) usage flags)
|
||||
)
|
||||
(let ((s4-0 (+ 48 128 (* (-> this header effect-count) 32))))
|
||||
(dotimes (s3-0 (the-as int (-> this header effect-count)))
|
||||
(let ((s2-0 (the-as object (-> this effect s3-0 frag-ctrl))))
|
||||
(dotimes (s1-0 (the-as int (-> this effect s3-0 frag-count)))
|
||||
(set! s4-0 (+ s4-0
|
||||
(* (shr (+ (-> (the-as merc-fragment-control s2-0) unsigned-four-count) 3) 2) 16)
|
||||
(* (shr (+ (-> (the-as merc-fragment-control s2-0) lump-four-count) 3) 2) 16)
|
||||
(* (-> (the-as merc-fragment-control s2-0) fp-qwc) 16)
|
||||
(asize-of (the-as merc-fragment-control s2-0))
|
||||
)
|
||||
)
|
||||
(set! s2-0 (&+ (the-as pointer s2-0) (asize-of (the-as merc-fragment-control s2-0))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> usage length) (max 80 (-> usage length)))
|
||||
(set! (-> usage data 79 name) "merc-ctrl")
|
||||
(+! (-> usage data 79 count) 1)
|
||||
(+! (-> usage data 79 used) s4-0)
|
||||
(+! (-> usage data 79 total) (logand -16 (+ s4-0 15)))
|
||||
)
|
||||
(let ((v1-35 0))
|
||||
(dotimes (a0-15 (the-as int (-> this header effect-count)))
|
||||
(when (nonzero? (-> this effect a0-15 blend-frag-count))
|
||||
(let ((a1-9 (the-as object (-> this effect a0-15 blend-ctrl))))
|
||||
(dotimes (a2-1 (the-as int (-> this effect a0-15 blend-frag-count)))
|
||||
(let ((v1-36
|
||||
(+ v1-35
|
||||
(* (+ (-> (the-as merc-blend-ctrl a1-9) nonzero-index-count) 1)
|
||||
(the-as uint (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl a1-9) blend-vtx-count)) 15) #xfff0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! v1-35 (the-as int (+ (-> this header blend-target-count) 2 v1-36)))
|
||||
)
|
||||
(set! a1-9 (&+ (the-as pointer a1-9) (+ (-> this header blend-target-count) 2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (nonzero? v1-35)
|
||||
(set! (-> usage length) (max 82 (-> usage length)))
|
||||
(set! (-> usage data 81 name) "blend-shape")
|
||||
(+! (-> usage data 81 count) 1)
|
||||
(+! (-> usage data 81 used) v1-35)
|
||||
(+! (-> usage data 81 total) (logand -16 (+ v1-35 15)))
|
||||
)
|
||||
)
|
||||
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
|
||||
(let ((a0-29 (-> this header eye-ctrl)))
|
||||
(set! (-> usage length) (max 113 (-> usage length)))
|
||||
(set! (-> usage data 112 name) "eye-anim")
|
||||
(+! (-> usage data 112 count) 1)
|
||||
(let ((v1-49 (asize-of a0-29)))
|
||||
(+! (-> usage data 112 used) v1-49)
|
||||
(+! (-> usage data 112 total) (logand -16 (+ v1-49 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
(defmethod login ((this merc-ctrl))
|
||||
(set! (-> *kernel-context* login-object) this)
|
||||
(texture-usage-init this)
|
||||
(dotimes (s5-0 (the-as int (-> this header effect-count)))
|
||||
(login-adgifs (-> this effect s5-0))
|
||||
)
|
||||
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
|
||||
(let ((s5-1 (-> this header eye-ctrl)))
|
||||
(dotimes (s4-0 (-> s5-1 shader-count))
|
||||
(let ((a0-5 (adgif-shader-login (-> s5-1 shader s4-0))))
|
||||
(if a0-5
|
||||
(texture-usage-update a0-5)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> *kernel-context* login-object) #f)
|
||||
this
|
||||
)
|
||||
|
||||
(defmethod art-method-10 ((this merc-ctrl))
|
||||
(let* ((v1-0 (-> this header))
|
||||
(v1-1 (if (nonzero? (-> v1-0 eye-ctrl))
|
||||
(-> v1-0 eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-1
|
||||
(free-eye-index (-> v1-1 eye-ctrl-index))
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; WARN: Return type mismatch symbol vs none.
|
||||
(defun-debug merc-stats-display ((arg0 merc-ctrl))
|
||||
(format #t "~30s:" (-> arg0 name))
|
||||
(let ((s5-0 (-> arg0 header st-int-scale))
|
||||
(s4-0 (ash 1 (- 12 (the-as int (-> arg0 header st-int-scale)))))
|
||||
)
|
||||
(format #t " ST ~3D, " s4-0)
|
||||
(cond
|
||||
((>= s5-0 (the-as uint 5))
|
||||
(format #t "RANGE ~D+," (/ 128 s4-0))
|
||||
)
|
||||
((= s5-0 4)
|
||||
(format #t "RANGE 0.5+,")
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (s5-1 (the-as int (-> arg0 header effect-count)))
|
||||
(let ((s3-0 (-> arg0 effect s5-1)))
|
||||
(if (nonzero? s5-1)
|
||||
(format #t "~48s " " ")
|
||||
)
|
||||
(let ((a2-4 (-> s3-0 frag-count))
|
||||
(s4-1 (-> s3-0 tri-count))
|
||||
(f30-0 (the float (-> s3-0 frag-count)))
|
||||
(f28-0 (the float (-> s3-0 dvert-count)))
|
||||
(f26-0 (the float (-> s3-0 tri-count)))
|
||||
)
|
||||
(if (>= (/ (+ 50.0 f28-0) f30-0) 50.0)
|
||||
(format #t "~3D frags, ~2,,1f dverts/frag " a2-4 (/ f28-0 f30-0))
|
||||
(format #t "~3D frags, ~2,,1f ******/**** " a2-4 (/ f28-0 f30-0))
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"(~4D tris, striplen ~2,,2f, ~2,,1f tris/frag)~%"
|
||||
s4-1
|
||||
(/ (* 2.0 f26-0) (- f28-0 f26-0))
|
||||
(/ f26-0 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun-debug merc-stats ()
|
||||
(dotimes (gp-0 11)
|
||||
(let ((s5-0 (-> *level* level gp-0 art-group)))
|
||||
(when (nonzero? s5-0)
|
||||
(dotimes (s4-0 (-> s5-0 art-group-array length))
|
||||
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
|
||||
(dotimes (s2-0 (-> s3-0 length))
|
||||
(let* ((s1-0 (-> s3-0 data s2-0))
|
||||
(a0-3 (if (type? s1-0 merc-ctrl)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(if a0-3
|
||||
(merc-stats-display (the-as merc-ctrl a0-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
(defun-debug merc-edge-stats ()
|
||||
(dotimes (gp-0 11)
|
||||
(let ((s5-0 (-> *level* level gp-0 art-group)))
|
||||
(when (nonzero? s5-0)
|
||||
(dotimes (s4-0 (-> s5-0 art-group-array length))
|
||||
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
|
||||
(dotimes (s2-0 (-> s3-0 length))
|
||||
(let* ((s1-0 (-> s3-0 data s2-0))
|
||||
(v1-9 (if (type? s1-0 merc-ctrl)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-9
|
||||
(format #t "~30s: ~f~%" (-> v1-9 name) (-> (the-as merc-ctrl v1-9) header longest-edge))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; WARN: Return type mismatch dma-packet vs dma-gif-packet.
|
||||
(defun merc-vu1-add-vu-function ((arg0 dma-packet) (arg1 vu-function) (arg2 int))
|
||||
(let ((v1-0 (the-as object (+ (the-as uint arg1) 16)))
|
||||
(a3-0 (-> arg1 qlength))
|
||||
(a1-1 (-> arg1 origin))
|
||||
)
|
||||
(while (> a3-0 0)
|
||||
(let ((t0-1 (min 127 a3-0)))
|
||||
(set! (-> arg0 dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc t0-1 :addr (the-as int v1-0)))
|
||||
(set! (-> arg0 vif0) (new 'static 'vif-tag :cmd (if (zero? arg2) 16 19)))
|
||||
(set! (-> arg0 vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1))
|
||||
(&+! arg0 16)
|
||||
(set! v1-0 (+ (the-as uint v1-0) (* t0-1 16)))
|
||||
(set! a3-0 (- a3-0 t0-1))
|
||||
(+! a1-1 (* t0-1 2))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as dma-gif-packet arg0)
|
||||
)
|
||||
|
||||
(defun merc-vu1-initialize-chain ((arg0 dma-gif-packet) (arg1 int))
|
||||
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (the-as dma-packet arg0) merc-vu1-block 1))))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x8 :cmd (vif-cmd unpack-v4-32)))
|
||||
(let ((s5-0 (the-as merc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32))))
|
||||
(case *subdivide-foreground-draw-mode*
|
||||
(((subdivide-setting textured))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting outline))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting gouraud))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x30364000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting hack))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> s5-0 hvdf-offset quad) (-> *math-camera* hvdf-off quad))
|
||||
(quad-copy! (-> s5-0 perspective) (the-as pointer (-> *math-camera* perspective)) 4)
|
||||
(set-vector! (-> s5-0 fog) (-> *math-camera* pfog0) (-> *math-camera* fog-min) (-> *math-camera* fog-max) 0.0)
|
||||
)
|
||||
(let ((v1-50 (-> (the-as (inline-array dma-packet) gp-0) 10)))
|
||||
(set! (-> v1-50 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> v1-50 vif0) (new 'static 'vif-tag))
|
||||
(set! (-> v1-50 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
|
||||
(&+ v1-50 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defun merc-vu1-init-buffer ((arg0 bucket-id) (arg1 int) (arg2 symbol))
|
||||
(let ((v1-0 *display*)
|
||||
(a2-6 (+ (* (+ (/ (-> merc-vu1-block qlength) 127) 1) 16) 224))
|
||||
)
|
||||
(+! (-> v1-0 mem-reserve-size) a2-6)
|
||||
(when (not (-> v1-0 dma-buffer-overflow))
|
||||
(let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
|
||||
(if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-6)))
|
||||
(set! (-> v1-0 dma-buffer-overflow) #t)
|
||||
)
|
||||
)
|
||||
(when (not (-> v1-0 dma-buffer-overflow))
|
||||
(let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
||||
(when (!= s5-0 (-> s5-0 last))
|
||||
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(s4-3 (-> s3-0 base))
|
||||
)
|
||||
(set! (-> s3-0 base) (the-as pointer (merc-vu1-initialize-chain (the-as dma-gif-packet (-> s3-0 base)) arg1)))
|
||||
(dma-buffer-add-gs-set s3-0
|
||||
(test-1 (new 'static 'gs-test
|
||||
:ate #x1
|
||||
:atst (gs-atest greater-equal)
|
||||
:aref #x26
|
||||
:zte #x1
|
||||
:ztst (gs-ztest greater-equal)
|
||||
)
|
||||
)
|
||||
(zbuf-1 (if arg2
|
||||
#x1000130
|
||||
(the-as int (the-as uint #x101000130))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-17 (the-as object (-> s3-0 base))))
|
||||
(set! (-> (the-as (pointer uint64) v1-17)) (logior #x20000000 (shr (shl (-> s5-0 next) 33) 1)))
|
||||
(set! (-> (the-as dma-packet v1-17) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet v1-17) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> s3-0 base) (&+ (the-as pointer v1-17) 16))
|
||||
)
|
||||
(set! (-> s5-0 next) (the-as uint s4-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
(defun merc-vu1-init-buffers ()
|
||||
(when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask merc))
|
||||
(merc-vu1-init-buffer (bucket-id bucket17) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket29) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket41) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket53) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket65) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket77) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket89) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket101) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket113) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket125) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket341) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket352) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket357) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket362) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket367) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket372) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket377) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket382) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket387) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket392) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket397) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket402) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket136) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket146) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket156) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket166) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket176) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket186) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket196) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket206) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket216) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket226) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket346) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket234) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket245) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket256) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket267) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket278) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket289) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket300) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket311) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket322) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket333) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket407) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket412) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket417) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket422) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket427) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket432) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket437) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket442) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket447) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket452) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket457) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket464) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket474) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket484) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket494) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket504) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket514) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket524) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket534) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket544) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket554) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket564) 1 #f)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
|
|
@ -633,10 +633,10 @@
|
|||
(tie-envmap-scissor)
|
||||
(tie-vanish)
|
||||
(generic)
|
||||
(merc)
|
||||
(emerc)
|
||||
(shrubbery)
|
||||
(shrub-near)
|
||||
(merc)
|
||||
(emerc)
|
||||
(billboard)
|
||||
(shrubbery-vanish)
|
||||
(tfrag-trans)
|
||||
|
|
|
@ -360,7 +360,7 @@
|
|||
(:methods
|
||||
(level-group-method-9 () none)
|
||||
(level-group-method-10 () none)
|
||||
(level-group-method-11 () none)
|
||||
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level)
|
||||
(level-group-method-12 () none)
|
||||
(level-group-method-13 () none)
|
||||
(level-group-method-14 () none)
|
||||
|
|
|
@ -41,7 +41,7 @@ NOTE: this is a special type in three ways:
|
|||
(defconstant SCE_SEEK_END 2)
|
||||
|
||||
(defconstant LEVEL_BT_FILE_VERSION 36)
|
||||
(defconstant ART_GROUP_FILE_VERSION 8)
|
||||
(defglobalconstant ART_GROUP_FILE_VERSION 8)
|
||||
(defconstant TPAGE_FILE_VERSION 8) ;; also used for dir
|
||||
(defconstant LEVEL_VS_FILE_VERSION 30)
|
||||
(defconstant TX_FILE_VERSION 1)
|
||||
|
|
|
@ -7,3 +7,468 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(defmethod print ((this transformq))
|
||||
(format #t "#<transformq @ #x~X~%" this)
|
||||
(format #t "~T~Ttrans:~F ~F ~F ~F ~%" (-> this trans x) (-> this trans y) (-> this trans z) (-> this trans w))
|
||||
(format #t "~T~Tquat: ~F ~F ~F ~F ~%" (-> this quat x) (-> this quat y) (-> this quat z) (-> this quat w))
|
||||
(format #t "~T~Tscale:~F ~F ~F ~F>" (-> this scale x) (-> this scale y) (-> this scale z) (-> this scale w))
|
||||
this
|
||||
)
|
||||
|
||||
(defmethod get-quaternion ((this trsqv))
|
||||
"Get the quat for this [[trsqv]]."
|
||||
(-> this quat)
|
||||
)
|
||||
|
||||
(defmethod set-quaternion! ((this trsqv) (arg0 quaternion))
|
||||
"Set this [[trsqv]]'s quaternion."
|
||||
(quaternion-copy! (get-quaternion this) arg0)
|
||||
)
|
||||
|
||||
(defmethod rot->dir-targ! ((this trsqv))
|
||||
"Set the target direction for this [[trsqv]] to its quaternion."
|
||||
(quaternion-copy! (-> this dir-targ) (get-quaternion this))
|
||||
)
|
||||
|
||||
(defmethod y-angle ((this trsqv))
|
||||
"Get the y angle for this [[trsqv]]'s quaternion."
|
||||
(quaternion-y-angle (get-quaternion this))
|
||||
)
|
||||
|
||||
(defmethod seek-toward-heading-vec! ((this trsqv) (arg0 vector) (arg1 float) (arg2 time-frame))
|
||||
"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"
|
||||
(let* ((f0-0 (deg-diff (quaternion-y-angle (-> this quat)) (vector-y-angle arg0)))
|
||||
(f1-2 (fmin (* arg1 (seconds-per-frame)) (/ (* 5.0 (fabs f0-0)) (the float arg2))))
|
||||
(f30-0 (fmax (fmin f0-0 f1-2) (- f1-2)))
|
||||
)
|
||||
(let ((f0-2 (-> this old-y-angle-diff)))
|
||||
(set! f30-0
|
||||
(cond
|
||||
((or (= f0-2 0.0)
|
||||
(and (< 0.0 f30-0) (< 0.0 f0-2))
|
||||
(or (and (< f30-0 0.0) (< f0-2 0.0)) (time-elapsed? (-> this angle-change-time) (seconds 0.2)))
|
||||
)
|
||||
(set-time! (-> this angle-change-time))
|
||||
f30-0
|
||||
)
|
||||
(else
|
||||
(* 0.000000001 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> this old-y-angle-diff) f30-0)
|
||||
(let ((a1-2 (get-quaternion this)))
|
||||
(quaternion-rotate-y! a1-2 a1-2 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-heading-vec! ((this trsqv) (arg0 vector))
|
||||
"Makes us look in the arg0 direction immediately. Pitch will be unchanged."
|
||||
(let ((s3-0 (get-quaternion this)))
|
||||
(forward-up-nopitch->quaternion
|
||||
s3-0
|
||||
(vector-normalize-copy! (new 'stack-no-clear 'vector) arg0 1.0)
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod seek-to-point-toward-point! ((this trsqv) (arg0 vector) (arg1 float) (arg2 time-frame))
|
||||
"Seek toward pointing toward arg0 from our current location."
|
||||
(seek-toward-heading-vec! this (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) arg1 arg2)
|
||||
)
|
||||
|
||||
(defmethod point-toward-point! ((this trsqv) (arg0 vector))
|
||||
"Immediately point toward arg0."
|
||||
(let ((s3-0 (get-quaternion this)))
|
||||
(forward-up-nopitch->quaternion
|
||||
s3-0
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) 1.0)
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod seek-toward-yaw-angle! ((this trsqv) (arg0 float) (arg1 float) (arg2 time-frame))
|
||||
"Seek toward the given yaw angle."
|
||||
(let ((s3-0 (method-of-object this seek-toward-heading-vec!))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> s2-0 x) (sin arg0))
|
||||
(set! (-> s2-0 y) 0.0)
|
||||
(set! (-> s2-0 z) (cos arg0))
|
||||
(set! (-> s2-0 w) 1.0)
|
||||
(s3-0 this s2-0 arg1 arg2)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-yaw-angle-clear-roll-pitch! ((this trsqv) (arg0 float))
|
||||
"Immediately clear our roll and pitch and set yaw to the given angle."
|
||||
(let ((s5-0 (method-of-object this set-heading-vec-clear-roll-pitch!))
|
||||
(s4-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> s4-0 x) (sin arg0))
|
||||
(set! (-> s4-0 y) 0.0)
|
||||
(set! (-> s4-0 z) (cos arg0))
|
||||
(set! (-> s4-0 w) 1.0)
|
||||
(s5-0 this s4-0)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-roll-to-grav! ((this trsqv) (arg0 float))
|
||||
"Set our roll so that our local down aligns with standard gravity."
|
||||
(set-roll-to-grav-2! this arg0)
|
||||
)
|
||||
|
||||
(defmethod set-roll-to-grav-2! ((this trsqv) (arg0 float))
|
||||
"Set our roll so that our local down aligns with standard gravity."
|
||||
(let* ((s5-0 (get-quaternion this))
|
||||
(s1-0 (-> *standard-dynamics* gravity-normal))
|
||||
(s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) s5-0))
|
||||
)
|
||||
(let ((s4-0 (-> s3-0 fvec)))
|
||||
(vector-normalize! (vector-flatten! (-> s3-0 uvec) s1-0 s4-0) 1.0)
|
||||
(vector-cross! (-> s3-0 rvec) (-> s3-0 uvec) s4-0)
|
||||
)
|
||||
(let ((a1-5 (matrix-rotate-z! (new 'stack-no-clear 'matrix) arg0)))
|
||||
(matrix*! s3-0 a1-5 s3-0)
|
||||
)
|
||||
(matrix->quaternion s5-0 s3-0)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod roll-relative-to-gravity ((this trsqv))
|
||||
"Get our roll, relative to 'down' from gravity."
|
||||
(let* ((s5-0 (get-quaternion this))
|
||||
(gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(s5-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(a1-2 (-> *standard-dynamics* gravity-normal))
|
||||
(v1-2 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) a1-2 gp-0) 1.0))
|
||||
(f0-1 (vector-dot v1-2 s5-1))
|
||||
)
|
||||
(if (< (vector-dot (vector-cross! (new 'stack-no-clear 'vector) v1-2 s5-1) gp-0) 0.0)
|
||||
(- (acos f0-1))
|
||||
(acos f0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
|
||||
(defmethod rotate-toward-orientation! ((this trsqv) (arg0 quaternion) (arg1 float) (arg2 float) (arg3 int) (arg4 int) (arg5 float))
|
||||
"Adjust our orientation toward target, subject to some rate limits.
|
||||
For Jak 1, I said:
|
||||
I don't think this is a very robust function and probably doesn't work right in cases
|
||||
where an axis flips by 180 degrees.
|
||||
But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job.
|
||||
This additionally uses the fancy logic of matrix-from-two-vectors-smooth."
|
||||
(local-vars
|
||||
(f0-4 float)
|
||||
(sv-192 (function quaternion vector vector float int quaternion))
|
||||
(sv-208 quaternion)
|
||||
(sv-224 vector)
|
||||
(sv-240 int)
|
||||
(sv-256 vector)
|
||||
(sv-272 vector)
|
||||
)
|
||||
(set! sv-240 arg4)
|
||||
(let ((s2-0 arg5)
|
||||
(s5-0 (get-quaternion this))
|
||||
)
|
||||
(let ((gp-0 (new 'stack-no-clear 'quaternion)))
|
||||
(when (< 0.0 arg2)
|
||||
(set! sv-192 quaternion-from-two-vectors-smooth!)
|
||||
(set! sv-208 gp-0)
|
||||
(set! sv-224 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0)))
|
||||
(sv-192 sv-208 sv-224 a2-1 arg2 sv-240)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
(when (< 0.0 arg1)
|
||||
(set! sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)))
|
||||
(set! sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))
|
||||
(let ((s0-1 (new 'stack-no-clear 'matrix)))
|
||||
(vector-flatten! s1-2 s1-2 sv-256)
|
||||
(vector-flatten! sv-272 sv-272 sv-256)
|
||||
(vector-normalize! s1-2 1.0)
|
||||
(vector-normalize! sv-272 1.0)
|
||||
(cond
|
||||
((!= s2-0 0.0)
|
||||
(let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272))
|
||||
;; og:preserve-this inlined vector-dot
|
||||
; (f0-3 (-> sv-256 x))
|
||||
; (f1-3 (-> sv-256 y))
|
||||
; (f2-0 (-> sv-256 z))
|
||||
; (f3-0 (-> v1-5 x))
|
||||
; (f4-0 (-> v1-5 y))
|
||||
; (f5-0 (-> v1-5 z))
|
||||
)
|
||||
(set! f0-4 (vector-dot sv-256 v1-5))
|
||||
; (.mula.s f0-3 f3-0)
|
||||
; (.madda.s f1-3 f4-0)
|
||||
; (.madd.s f0-4 f2-0 f5-0)
|
||||
)
|
||||
(if (< (* f0-4 s2-0) 0.0)
|
||||
(matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(matrix->quaternion gp-0 s0-1)
|
||||
)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod set-heading-vec-clear-roll-pitch! ((this trsqv) (arg0 vector))
|
||||
"Set our rotation to point along the given heading, with no roll or pitch."
|
||||
(forward-up->quaternion
|
||||
(get-quaternion this)
|
||||
(vector-normalize-copy! (new 'stack-no-clear 'vector) arg0 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
|
||||
(defmethod point-toward-point-clear-roll-pitch! ((this trsqv) (arg0 vector))
|
||||
"Set our orientation to point toward arg0, clearing roll and pitch."
|
||||
(forward-up->quaternion
|
||||
(get-quaternion this)
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
|
||||
(defun transformq-copy! ((arg0 transformq) (arg1 transformq))
|
||||
"Set arg0 = arg1."
|
||||
(let ((v1-0 (-> arg1 trans quad))
|
||||
(a2-0 (-> arg1 quat quad))
|
||||
(a1-1 (-> arg1 scale quad))
|
||||
)
|
||||
(set! (-> arg0 trans quad) v1-0)
|
||||
(set! (-> arg0 quat quad) a2-0)
|
||||
(set! (-> arg0 scale quad) a1-1)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
(defun matrix<-transformq! ((arg0 matrix) (arg1 transformq))
|
||||
"Convert to 4x4 affine transform."
|
||||
(local-vars (v1-1 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(cond
|
||||
(#f
|
||||
(set! (-> arg0 trans quad) (-> arg1 trans quad))
|
||||
)
|
||||
(else
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
(.mov v1-1 vf5)
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix<-no-trans-transformq! ((arg0 matrix) (arg1 transformq))
|
||||
"Create 4x4 affine transform with no translation."
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix<-transformq+trans! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Convert to affine transform with an additional translation (in the local frame)."
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.mul.x.vf acc vf3 vf6)
|
||||
(.add.mul.y.vf acc vf4 vf6 acc)
|
||||
(.add.mul.z.vf acc vf5 vf6 acc)
|
||||
(.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix<-transformq+world-trans! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Convert to affine transform with an additional translation in the world frame (not rotated)."
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.add.vf vf2 vf2 vf6 :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix<-parented-transformq! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Unused. Seems like the parented thing means there's an inverse scale in arg2."
|
||||
(local-vars (v1-1 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> v1-0 x) (/ 1.0 (-> arg2 x)))
|
||||
(set! (-> v1-0 y) (/ 1.0 (-> arg2 y)))
|
||||
(set! (-> v1-0 z) (/ 1.0 (-> arg2 z)))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.lvf vf4 (&-> arg0 rvec quad))
|
||||
(.lvf vf5 (&-> arg0 uvec quad))
|
||||
(.lvf vf6 (&-> arg0 fvec quad))
|
||||
(.mul.x.vf vf4 vf4 vf1)
|
||||
(.mul.y.vf vf5 vf5 vf1)
|
||||
(.mul.z.vf vf6 vf6 vf1)
|
||||
(.lvf vf3 (&-> v1-0 quad))
|
||||
)
|
||||
(.mul.vf vf4 vf4 vf3)
|
||||
(.mul.vf vf5 vf5 vf3)
|
||||
(.mul.vf vf6 vf6 vf3)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf4)
|
||||
(.svf (&-> arg0 uvec quad) vf5)
|
||||
(.svf (&-> arg0 fvec quad) vf6)
|
||||
(.mov v1-1 vf6)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
(defun matrix<-transformq+rot-offset! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Affine transform for a point offset in the destination frame of the transformq (rather than just
|
||||
adding an offset at the end)."
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.mul.x.vf acc vf3 vf6)
|
||||
(.add.mul.y.vf acc vf4 vf6 acc)
|
||||
(.add.mul.z.vf acc vf5 vf6 acc)
|
||||
(.sub.mul.w.vf acc vf6 vf0 acc)
|
||||
(.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
|
|
@ -7,3 +7,199 @@
|
|||
|
||||
;; DECOMP BEGINS
|
||||
|
||||
(deftype stick-constraint (structure)
|
||||
((constraint-length-half float)
|
||||
(one-over-two-times-constraint-length float)
|
||||
(constraint-length-sqd float)
|
||||
(particle0 uint16)
|
||||
(particle1 uint16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype verlet-particle (structure)
|
||||
((pos vector :inline)
|
||||
(prev-pos vector :inline)
|
||||
(mass-scale float)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype disc-constraint (structure)
|
||||
((normal vector :inline)
|
||||
(origin vector :inline)
|
||||
(radius float)
|
||||
(start-particle-index int16)
|
||||
(end-particle-index int16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype cylinder-constraint (structure)
|
||||
((c0 vector :inline)
|
||||
(norm vector :inline)
|
||||
(length float)
|
||||
(radius float)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype particle-anchor-point (structure)
|
||||
((anchor-pos vector :inline)
|
||||
(particle-index uint16)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype particle-array (inline-array-class)
|
||||
((data verlet-particle :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> particle-array heap-base) (the-as uint 48))
|
||||
|
||||
(deftype float-array (inline-array-class)
|
||||
((data float :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> float-array heap-base) (the-as uint 4))
|
||||
|
||||
(deftype stick-constraint-array (inline-array-class)
|
||||
((data stick-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> stick-constraint-array heap-base) (the-as uint 16))
|
||||
|
||||
(deftype collision-sphere-array (inline-array-class)
|
||||
((data sphere :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> collision-sphere-array heap-base) (the-as uint 16))
|
||||
|
||||
(deftype collision-disc-array (inline-array-class)
|
||||
((data disc-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> collision-disc-array heap-base) (the-as uint 48))
|
||||
|
||||
(deftype collision-cylinder-array (inline-array-class)
|
||||
((data cylinder-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> collision-cylinder-array heap-base) (the-as uint 48))
|
||||
|
||||
(deftype anchor-point-array (inline-array-class)
|
||||
((data particle-anchor-point :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(set! (-> anchor-point-array heap-base) (the-as uint 32))
|
||||
|
||||
(deftype verlet-particle-system (cloth-base)
|
||||
((particles particle-array)
|
||||
(drag float)
|
||||
(accum-force vector :inline)
|
||||
(timestep-frequency int8)
|
||||
(last-simulate-remaining int8)
|
||||
(momentum vector :inline)
|
||||
)
|
||||
(:methods
|
||||
(calculate-wind! (_type_) none)
|
||||
(verlet-particle-system-method-12 (_type_ float) none)
|
||||
(verlet-particle-system-method-13 (_type_) none)
|
||||
(verlet-particle-system-method-14 (_type_) none)
|
||||
(debug-draw (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype current-position-info (structure)
|
||||
((current-vert-index uint16)
|
||||
(last-2-x-index uint16)
|
||||
(last-2-y-index uint16)
|
||||
(last-x-index uint16)
|
||||
(last-y-index uint16)
|
||||
(lights vu-lights :inline)
|
||||
(scale vector :inline)
|
||||
(clamp-col vector :inline)
|
||||
(last-normal vector :inline)
|
||||
(face-normal-needs-flip? symbol)
|
||||
(cross-index0 int8)
|
||||
(cross-index1 int8)
|
||||
(backside-normal vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype cloth-system (verlet-particle-system)
|
||||
((ground-constraint float)
|
||||
(disc-collision-constraints collision-disc-array)
|
||||
(collision-constraints collision-sphere-array)
|
||||
(stick-constraints stick-constraint-array)
|
||||
(anchor-points anchor-point-array)
|
||||
(constraint-strengths int32 3)
|
||||
(num-xy-constraints int16)
|
||||
(num-diagonal-constraints int16)
|
||||
(cloth-width int32)
|
||||
(cloth-height int32)
|
||||
(strip prim-strip)
|
||||
(strip2 prim-strip)
|
||||
(strip3 prim-strip)
|
||||
(mesh art-cloth-geo)
|
||||
(gravity-constant float)
|
||||
(wind-constant float)
|
||||
(flags cloth-flag)
|
||||
(thickness-scalar float)
|
||||
(ball-collision-radius float)
|
||||
(face-normal-scalar float)
|
||||
(reset-count int8)
|
||||
(num-iterations int8)
|
||||
(secret-disable game-secrets)
|
||||
(params cloth-params)
|
||||
)
|
||||
(:methods
|
||||
(initialize-cloth-system! (_type_ cloth-params) none)
|
||||
(debug-draw-spheres (_type_) none)
|
||||
(cloth-system-method-18 (_type_) int)
|
||||
(cloth-system-method-19 (_type_) none)
|
||||
(cloth-system-method-20 (_type_) none)
|
||||
(cloth-system-method-21 (_type_) none)
|
||||
(cloth-system-method-22 (_type_) none)
|
||||
(cloth-system-method-23 (_type_) none)
|
||||
(cloth-system-method-24 (_type_) int)
|
||||
(cloth-system-method-25 (_type_) int)
|
||||
(cloth-system-method-26 (_type_) none)
|
||||
(cloth-system-method-27 (_type_ vector int int current-position-info) vector)
|
||||
(cloth-system-method-28 (_type_ int int current-position-info) none)
|
||||
(cloth-system-method-29 (_type_ int int current-position-info int) uint)
|
||||
(cloth-system-method-30 (_type_ int int current-position-info int) none)
|
||||
(cloth-system-method-31 (_type_ current-position-info) none)
|
||||
(cloth-system-method-32 (_type_ vector int int current-position-info) none)
|
||||
(cloth-system-method-33 (_type_ vu-lights) none)
|
||||
(cloth-system-method-34 (_type_) none)
|
||||
(cloth-system-method-35 (_type_) none)
|
||||
(cloth-system-method-36 (_type_) none)
|
||||
(cloth-system-cmd-handler (_type_ pair) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
(deftype cloth-on-skeleton (cloth-system)
|
||||
((base-transform-index int16)
|
||||
(owner handle)
|
||||
(last-owner-pos vector :inline)
|
||||
(last-owner-mat matrix :inline)
|
||||
)
|
||||
)
|
||||
|
|
File diff suppressed because it is too large
Load diff
93
test/decompiler/reference/jak3/decompiler-macros.gc
generated
vendored
93
test/decompiler/reference/jak3/decompiler-macros.gc
generated
vendored
|
@ -872,6 +872,10 @@
|
|||
`(>= (- (current-time) ,time) ,duration)
|
||||
)
|
||||
|
||||
(defmacro set-time! (time)
|
||||
`(set! ,time (current-time))
|
||||
)
|
||||
|
||||
(defconstant *scratch-memory-top* (the pointer #x70004000))
|
||||
(defconstant DPROCESS_STACK_SIZE #x8000)
|
||||
|
||||
|
@ -888,4 +892,93 @@
|
|||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; og:preserve-this
|
||||
;; look up the index of an art element in an art group.
|
||||
(desfun art-elt-index (ag-name elt-name)
|
||||
(if (number? elt-name)
|
||||
elt-name
|
||||
(let ((ag-info (hash-table-try-ref *art-info* (symbol->string ag-name))))
|
||||
(if (not (car ag-info))
|
||||
(error (symbol->string ag-name))
|
||||
(let ((elt-info (hash-table-try-ref (cdr ag-info) (symbol->string elt-name))))
|
||||
(if (not (car elt-info))
|
||||
(error (symbol->string ag-name))
|
||||
(cadr (cdr elt-info)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro static-spherem (x y z r)
|
||||
"creates a static vector using meters where the w component is used as sphere radius. for a 'real' sphere use static-bspherem."
|
||||
`(new 'static 'vector :x (meters ,x) :y (meters ,y) :z (meters ,z) :w (meters ,r))
|
||||
)
|
||||
|
||||
(defglobalconstant ART_GROUP_FILE_VERSION 8)
|
||||
|
||||
(defmacro defskelgroup (name ag-name joint-geom joint-anim lods
|
||||
&key (shadow 0)
|
||||
&key bounds
|
||||
&key (longest-edge 0.0)
|
||||
&key (texture-level 0)
|
||||
&key (sort 0)
|
||||
&key (version ART_GROUP_FILE_VERSION) ;; do NOT use this!
|
||||
&key (origin-joint-index 0)
|
||||
&key (shadow-joint-index 0)
|
||||
&key (light-index 0)
|
||||
&key (global-effects 0)
|
||||
&key (clothing ())
|
||||
)
|
||||
"Define a new static skeleton-group."
|
||||
`(let ((skel (new 'static 'skeleton-group
|
||||
:name ,(symbol->string name)
|
||||
:extra #f
|
||||
:info #f
|
||||
:art-group-name ,(symbol->string ag-name)
|
||||
:bounds ,bounds
|
||||
:longest-edge ,longest-edge
|
||||
:texture-level ,texture-level
|
||||
:version ,version
|
||||
:shadow ,(art-elt-index (string->symbol-format "{}-ag" ag-name) shadow)
|
||||
:shadow-joint-index ,shadow-joint-index
|
||||
:origin-joint-index ,origin-joint-index
|
||||
:max-lod ,(- (length lods) 1)
|
||||
:sort ,sort
|
||||
:light-index ,light-index
|
||||
:global-effects ,global-effects
|
||||
:clothing #f
|
||||
)))
|
||||
|
||||
;; set cloth params array if present
|
||||
(when ,(neq? clothing '())
|
||||
(set! (-> skel clothing) (new 'static 'boxed-array :type cloth-params :length 0 :allocated-length ,(length clothing)))
|
||||
,@(apply-i (lambda (x i) `(set! (-> skel clothing ,i) (static-cloth-params ,x))) clothing)
|
||||
(set! (-> skel clothing length) ,(length clothing))
|
||||
)
|
||||
|
||||
;; set joint geometry and joint bones
|
||||
(set! (-> skel jgeo) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) joint-geom))
|
||||
(set! (-> skel janim) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) joint-anim))
|
||||
|
||||
;; set lods
|
||||
,@(apply-i (lambda (x i)
|
||||
`(begin
|
||||
(set! (-> skel mgeo ,i) ,(art-elt-index (string->symbol-format "{}-ag" ag-name) (car x)))
|
||||
(set! (-> skel lod-dist ,i) ,(cadr x))
|
||||
)
|
||||
) lods)
|
||||
|
||||
;; define skel group
|
||||
(define ,name skel)
|
||||
;; add to level
|
||||
(add-to-loading-level ,name)
|
||||
)
|
||||
)
|
||||
|
||||
(defmacro get-art-by-name (this name type)
|
||||
"Helper macro for casting the result of get-art-by-name-method. Generated by decompiler."
|
||||
`(the-as ,type (get-art-by-name-method ,this ,name ,type))
|
||||
)
|
28
test/decompiler/reference/jak3/engine/common-obs/cloth-art-h_REF.gc
generated
vendored
28
test/decompiler/reference/jak3/engine/common-obs/cloth-art-h_REF.gc
generated
vendored
|
@ -26,7 +26,7 @@
|
|||
;; definition of type anchor-transform
|
||||
(deftype anchor-transform (structure)
|
||||
((offset vector :inline)
|
||||
(joint-name basic)
|
||||
(joint-name string)
|
||||
(joint int16)
|
||||
(constraint-index int16)
|
||||
)
|
||||
|
@ -50,7 +50,7 @@
|
|||
;; definition of type sphere-transform
|
||||
(deftype sphere-transform (structure)
|
||||
((offset vector :inline)
|
||||
(joint-name basic)
|
||||
(joint-name string)
|
||||
(radius float)
|
||||
(joint int16)
|
||||
)
|
||||
|
@ -196,26 +196,26 @@
|
|||
;; definition of type cloth-params
|
||||
(deftype cloth-params (structure)
|
||||
((mesh int16)
|
||||
(gravity-constant float)
|
||||
(gravity-constant meters)
|
||||
(wind-constant float)
|
||||
(cloth-width uint16)
|
||||
(num-sphere-constraints uint16)
|
||||
(num-disc-constraints uint16)
|
||||
(num-anchor-points uint16)
|
||||
(flags uint64)
|
||||
(tex-name basic)
|
||||
(tex-name2 basic)
|
||||
(tex-name3 basic)
|
||||
(alt-tex-name basic)
|
||||
(alt-tex-name2 basic)
|
||||
(alt-tex-name3 basic)
|
||||
(flags cloth-flag)
|
||||
(tex-name string)
|
||||
(tex-name2 string)
|
||||
(tex-name3 string)
|
||||
(alt-tex-name string)
|
||||
(alt-tex-name2 string)
|
||||
(alt-tex-name3 string)
|
||||
(cloth-thickness float)
|
||||
(initial-xform int16)
|
||||
(drag float)
|
||||
(ball-collision-radius float)
|
||||
(ball-collision-radius meters)
|
||||
(num-iterations int8)
|
||||
(timestep-frequency int8)
|
||||
(secret-disable uint64)
|
||||
(secret-disable game-secrets)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -255,8 +255,8 @@
|
|||
(deftype cloth-base (basic)
|
||||
()
|
||||
(:methods
|
||||
(cloth-base-method-9 () none)
|
||||
(cloth-base-method-10 () none)
|
||||
(init! (_type_) int)
|
||||
(cloth-base-method-10 (_type_ cloth-params handle) int)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
18
test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc
generated
vendored
18
test/decompiler/reference/jak3/engine/common-obs/prim-h_REF.gc
generated
vendored
|
@ -57,10 +57,10 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
(allocated-num-verts uint16)
|
||||
(tex-id texture-id)
|
||||
(adnops gs-adcmd 2 :inline)
|
||||
(data0 uint64 :overlay-at (-> adnops 0 word 0))
|
||||
(reg0 uint64 :overlay-at (-> adnops 0 word 2))
|
||||
(data1 uint64 :offset 48)
|
||||
(reg1 uint64 :offset 56)
|
||||
(data0 gs-test :overlay-at (-> adnops 0 word 0))
|
||||
(reg0 gs-reg64 :overlay-at (-> adnops 0 word 2))
|
||||
(data1 gs-test :offset 48)
|
||||
(reg1 gs-reg64 :offset 56)
|
||||
(clamp gs-clamp)
|
||||
(alpha gs-alpha)
|
||||
(bucket bucket-id)
|
||||
|
@ -71,7 +71,7 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
)
|
||||
(:methods
|
||||
(new (symbol type int texture-id string) _type_)
|
||||
(prim-strip-method-10 () none)
|
||||
(prim-strip-method-10 (_type_ draw-control) none)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -115,9 +115,9 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
(set! (-> s5-0 flags) (prim-flags pf0 pf1))
|
||||
(set! (-> s5-0 num-verts) (the-as uint num-vertices))
|
||||
(set! (-> s5-0 allocated-num-verts) (the-as uint num-vertices))
|
||||
(set! (-> s5-0 data0) (the-as uint 0))
|
||||
(set! (-> s5-0 data0) (new 'static 'gs-test))
|
||||
(set! (-> s5-0 adnops 0 cmds) (gs-reg64 hack))
|
||||
(set! (-> s5-0 data1) (the-as uint 0))
|
||||
(set! (-> s5-0 data1) (new 'static 'gs-test))
|
||||
(set! (-> s5-0 adnops 1 cmds) (gs-reg64 hack))
|
||||
(set! (-> s5-0 clamp) (new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp)))
|
||||
(set! (-> s5-0 alpha) (new 'static 'gs-alpha :b #x1 :d #x1))
|
||||
|
@ -230,7 +230,3 @@ These are owned by the thing submitting to prim, not the prim renderer itself."
|
|||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
36
test/decompiler/reference/jak3/engine/data/art-h_REF.gc
generated
vendored
36
test/decompiler/reference/jak3/engine/data/art-h_REF.gc
generated
vendored
|
@ -230,11 +230,11 @@ This can be either an art container containing more arts, or an actual art thing
|
|||
(extra res-lump)
|
||||
)
|
||||
(:methods
|
||||
(art-method-9 () none)
|
||||
(art-method-10 () none)
|
||||
(art-method-11 () none)
|
||||
(art-method-12 () none)
|
||||
(art-method-13 () none)
|
||||
(login (_type_) _type_)
|
||||
(art-method-10 (_type_) _type_)
|
||||
(get-art-by-name-method (_type_ string type) basic)
|
||||
(get-art-idx-by-name-method (_type_ string type) int)
|
||||
(needs-link? (_type_) symbol)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -255,7 +255,7 @@ This can be either an art container containing more arts, or an actual art thing
|
|||
;; definition of type art-element
|
||||
(deftype art-element (art)
|
||||
"Base class Art which is not a container of more art."
|
||||
((master-art-group-name basic)
|
||||
((master-art-group-name string)
|
||||
(master-art-group-index int32)
|
||||
(pad uint8 20)
|
||||
)
|
||||
|
@ -325,7 +325,8 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
|
|||
(data art-element :dynamic :offset 32)
|
||||
)
|
||||
(:methods
|
||||
(unknown-0 () none)
|
||||
(relocate (_type_ kheap (pointer uint8)) _type_ :replace)
|
||||
(link-art! (_type_) art-group)
|
||||
(unknown-1 () none)
|
||||
)
|
||||
)
|
||||
|
@ -339,18 +340,19 @@ actor, like the mesh, animations, shadow mesh, skeleton, etc."
|
|||
;; definition of type art-joint-geo
|
||||
(deftype art-joint-geo (art-element)
|
||||
"Collection of joints for an actor."
|
||||
()
|
||||
((data joint :dynamic :offset 48)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition of type art-cloth-geo
|
||||
(deftype art-cloth-geo (art-element)
|
||||
((anchor-transforms basic)
|
||||
(sphere-transforms basic)
|
||||
(disc-transforms basic)
|
||||
(cloth-thickness basic)
|
||||
((anchor-transforms anchor-transform-array)
|
||||
(sphere-transforms sphere-transform-array)
|
||||
(disc-transforms disc-transform-array)
|
||||
(cloth-thickness cloth-thickness-array)
|
||||
(thickness-scalar float)
|
||||
(num-points int32 :overlay-at length)
|
||||
(mesh object :dynamic :offset 80)
|
||||
(num-points int32 :overlay-at length)
|
||||
(mesh cloth-pt :inline :dynamic :offset 80)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -481,7 +483,7 @@ This stores settings like the name of the art-group, shadow/level-of-detail sett
|
|||
(global-effects uint8)
|
||||
)
|
||||
(:methods
|
||||
(skeleton-group-method-16 () none)
|
||||
(add-to-loading-level (_type_) skeleton-group)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -779,7 +781,3 @@ Each process-drawable has a draw-control."
|
|||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
2
test/decompiler/reference/jak3/engine/game/settings-h_REF.gc
generated
vendored
2
test/decompiler/reference/jak3/engine/game/settings-h_REF.gc
generated
vendored
|
@ -110,6 +110,8 @@
|
|||
(letterbox-speed float)
|
||||
(borrow-city-count uint32 :offset 620)
|
||||
(borrow-city pair 3)
|
||||
(wind-vec vector :offset 736)
|
||||
(wind float :offset 740)
|
||||
(audio-language language-enum :offset 748)
|
||||
(ear-handle handle :offset 784)
|
||||
(special-volume float :offset 796)
|
||||
|
|
20
test/decompiler/reference/jak3/engine/gfx/background/wind-work_REF.gc
generated
vendored
Normal file
20
test/decompiler/reference/jak3/engine/gfx/background/wind-work_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol *wind-work*, type wind-work
|
||||
(define *wind-work*
|
||||
(new 'static 'wind-work :wind-const (new 'static 'vector :x 0.5 :y 100.0 :z 0.0166 :w -1.0))
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> *wind-work* to-ptrs 0) (the-as uint (+ 8192 #x70000000)))
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> *wind-work* to-ptrs 1) (the-as uint (+ 4096 #x70000000)))
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> *wind-work* to-ptrs 2) (the-as uint (+ #x70000000 0)))
|
||||
|
||||
|
||||
|
||||
|
9
test/decompiler/reference/jak3/engine/gfx/foreground/merc/emerc-vu1_REF.gc
generated
vendored
Normal file
9
test/decompiler/reference/jak3/engine/gfx/foreground/merc/emerc-vu1_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol emerc-vu1-block, type vu-function
|
||||
(define emerc-vu1-block (new 'static 'vu-function :length #x56b :qlength #x2b6))
|
||||
|
||||
|
||||
|
||||
|
152
test/decompiler/reference/jak3/engine/gfx/foreground/merc/emerc_REF.gc
generated
vendored
Normal file
152
test/decompiler/reference/jak3/engine/gfx/foreground/merc/emerc_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for function emerc-vu1-initialize-chain
|
||||
;; INFO: Used lq/sq
|
||||
(defun emerc-vu1-initialize-chain ((gif-packet dma-gif-packet))
|
||||
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (the-as dma-packet gif-packet) emerc-vu1-block 1))))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xb :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x9 :cmd (vif-cmd unpack-v4-32)))
|
||||
(let ((s5-0 (the-as emerc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32))))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1)
|
||||
:nreg #x3
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
|
||||
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> s5-0 hvdf-offset quad) (-> *math-camera* hvdf-off quad))
|
||||
(quad-copy! (the-as pointer (-> s5-0 perspective)) (the-as pointer (-> *math-camera* perspective)) 4)
|
||||
(set-vector! (-> s5-0 fog) (-> *math-camera* pfog0) (-> *math-camera* fog-min) (-> *math-camera* fog-max) 0.0)
|
||||
(set-vector!
|
||||
(-> s5-0 unperspect)
|
||||
(/ 1.0 (-> *math-camera* perspective rvec x))
|
||||
(/ 1.0 (-> *math-camera* perspective uvec y))
|
||||
0.5
|
||||
(/ 1.0 (-> *math-camera* perspective fvec w))
|
||||
)
|
||||
)
|
||||
(let ((v1-21 (-> (the-as (inline-array dma-packet) gp-0) 11)))
|
||||
(set! (-> v1-21 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> v1-21 vif0) (new 'static 'vif-tag))
|
||||
(set! (-> v1-21 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
|
||||
(&+ v1-21 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function emerc-vu1-init-buffer
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun emerc-vu1-init-buffer ((bucket bucket-id) (arg1 gs-test) (arg2 int))
|
||||
(let ((disp *display*)
|
||||
(block-len (+ (* (+ (/ (-> emerc-vu1-block qlength) 127) 1) 16) 256))
|
||||
)
|
||||
(+! (-> disp mem-reserve-size) block-len)
|
||||
(when (not (-> disp dma-buffer-overflow))
|
||||
(let ((dma-buf (-> disp frames (-> disp on-screen) global-buf)))
|
||||
(if (< (-> dma-buf real-buffer-end) (the-as int (&+ (-> dma-buf base) block-len)))
|
||||
(set! (-> disp dma-buffer-overflow) #t)
|
||||
)
|
||||
)
|
||||
(when (not (-> disp dma-buffer-overflow))
|
||||
(let ((dma-bucket (-> *display* frames (-> *display* on-screen) bucket-group bucket)))
|
||||
(when (!= dma-bucket (-> dma-bucket last))
|
||||
(let* ((buf (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(base (-> buf base))
|
||||
)
|
||||
(set! (-> buf base) (the-as pointer (emerc-vu1-initialize-chain (the-as dma-gif-packet (-> buf base)))))
|
||||
(dma-buffer-add-gs-set buf (test-1 arg1))
|
||||
(let ((packet (the-as object (-> buf base))))
|
||||
(set! (-> (the-as (pointer uint64) packet)) (logior #x20000000 (shr (shl (-> dma-bucket next) 33) 1)))
|
||||
(set! (-> (the-as dma-packet packet) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet packet) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> buf base) (&+ (the-as pointer packet) 16))
|
||||
)
|
||||
(set! (-> dma-bucket next) (the-as uint base))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function emerc-vu1-init-buffers
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun emerc-vu1-init-buffers ()
|
||||
(when (logtest? (vu1-renderer-mask emerc) (-> *display* vu1-enable-user))
|
||||
(emerc-vu1-init-buffer (bucket-id bucket18) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket30) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket42) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket54) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket66) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket78) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket90) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket102) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket114) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket126) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket342) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket353) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket358) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket363) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket368) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket373) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket378) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket383) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket388) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket393) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket398) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket403) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket137) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket147) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket157) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket167) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket177) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket187) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket197) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket207) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket217) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket227) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket347) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket235) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket246) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket257) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket268) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket279) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket290) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket301) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket312) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket323) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket334) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket408) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket413) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket418) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket423) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket428) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket433) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket438) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket443) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket448) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket453) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
(emerc-vu1-init-buffer (bucket-id bucket458) (new 'static 'gs-test :zte #x1 :ztst (gs-ztest greater-equal)) 0)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
8
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-h_REF.gc
generated
vendored
8
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-h_REF.gc
generated
vendored
|
@ -210,7 +210,7 @@
|
|||
(lump-four-count uint8)
|
||||
(fp-qwc uint8)
|
||||
(mat-xfer-count uint8)
|
||||
(mat-dest-data merc-mat-dest :dynamic)
|
||||
(mat-dest-data merc-mat-dest :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -655,7 +655,7 @@ Consists of a header and a list of [[merc-effect]]s."
|
|||
((num-joints int32 :overlay-at length)
|
||||
(seg-table (array uint64) :overlay-at (-> pad 0))
|
||||
(header merc-ctrl-header :inline)
|
||||
(effect merc-effect :dynamic)
|
||||
(effect merc-effect :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -899,7 +899,3 @@ Consists of a header and a list of [[merc-effect]]s."
|
|||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
9
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-vu1_REF.gc
generated
vendored
Normal file
9
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc-vu1_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol merc-vu1-block, type vu-function
|
||||
(define merc-vu1-block (new 'static 'vu-function :length #x7e5 :qlength #x3f3))
|
||||
|
||||
|
||||
|
||||
|
681
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc
generated
vendored
Normal file
681
test/decompiler/reference/jak3/engine/gfx/foreground/merc/merc_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,681 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for symbol *texture-login-data*, type texture-login-data
|
||||
(define *texture-login-data* (new 'static 'texture-login-data))
|
||||
|
||||
;; definition for method 9 of type art-joint-geo
|
||||
(defmethod login ((this art-joint-geo))
|
||||
(let ((s5-0 *texture-login-data*))
|
||||
(set! (-> s5-0 default-texture-index)
|
||||
(res-lump-value (-> this extra) 'texture-bucket int :default (the-as uint128 1) :time -1000000000.0)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for function texture-usage-init
|
||||
;; INFO: Used lq/sq
|
||||
(defun texture-usage-init ((arg0 merc-ctrl))
|
||||
(let ((gp-0 *texture-login-data*))
|
||||
(if (zero? (-> arg0 header texture-usage-group))
|
||||
(set! (-> arg0 header texture-usage-group) (new 'loading-level 'texture-usage-group))
|
||||
)
|
||||
(set! (-> gp-0 texture-usage-group) (-> arg0 header texture-usage-group))
|
||||
(set! (-> gp-0 merc-ctrl-header) (-> arg0 header))
|
||||
(set! (-> gp-0 name) (-> arg0 name))
|
||||
(dotimes (v1-7 7)
|
||||
(dotimes (a0-2 3)
|
||||
(set! (-> (the-as vector (+ (the-as uint (-> gp-0 texture-usage-group)) (* 48 v1-7) (* a0-2 16))) quad)
|
||||
(the-as uint128 0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
;; definition for function texture-usage-update
|
||||
;; INFO: Used lq/sq
|
||||
(defun texture-usage-update ((arg0 texture))
|
||||
(local-vars (a3-3 uint128))
|
||||
(let* ((v1-0 *texture-login-data*)
|
||||
(a1-0 (-> v1-0 current-texture-index))
|
||||
(v1-2 (-> v1-0 texture-usage-group data a1-0))
|
||||
)
|
||||
(dotimes (a1-3 3)
|
||||
(let* ((a2-3 (-> v1-2 data a1-3))
|
||||
(t1-0 (-> arg0 masks data a1-3))
|
||||
(a3-2 (-> a2-3 mask quad))
|
||||
(t0-0 (-> t1-0 mask quad))
|
||||
(f0-0 (-> a2-3 dist))
|
||||
(f1-0 (-> t1-0 dist))
|
||||
)
|
||||
(.por a3-3 a3-2 t0-0)
|
||||
(let ((f0-1 (fmax f0-0 f1-0)))
|
||||
(set! (-> a2-3 mask quad) a3-3)
|
||||
(set! (-> a2-3 dist) f0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
#f
|
||||
)
|
||||
|
||||
;; definition for method 5 of type merc-fragment
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of ((this merc-fragment))
|
||||
(the-as int (* (-> this header mm-quadword-size) 16))
|
||||
)
|
||||
|
||||
;; definition for method 9 of type merc-fragment
|
||||
;; INFO: Used lq/sq
|
||||
(defmethod login-adgifs ((this merc-fragment))
|
||||
(local-vars (v0-5 symbol) (sv-16 uint) (sv-32 int))
|
||||
(let* ((s5-0 (merc-fragment-fp-data this))
|
||||
(v1-1 (-> *texture-login-data* merc-ctrl-header))
|
||||
(s4-0 (if (nonzero? (-> v1-1 eye-ctrl))
|
||||
(-> v1-1 eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
(s3-0 #x300200)
|
||||
(s2-0 #x300300)
|
||||
(s1-0 (the-as adgif-shader (&+ s5-0 16)))
|
||||
)
|
||||
(dotimes (s0-0 (the-as int (-> s5-0 shader-cnt)))
|
||||
(let ((v1-2 (-> s4-0 eye-ctrl-index))
|
||||
(a0-4 (logand (the-as texture-id -256) (-> s1-0 texture-id)))
|
||||
)
|
||||
(set! v0-5
|
||||
(cond
|
||||
((and s4-0 (!= v1-2 -1) (or (= a0-4 s3-0) (= a0-4 s2-0)))
|
||||
(let ((v1-5 (-> *eye-control-array* data v1-2)))
|
||||
(set! sv-16 (-> v1-5 eye-slot))
|
||||
(if (= a0-4 s2-0)
|
||||
(set! sv-32 1)
|
||||
(set! sv-32 0)
|
||||
)
|
||||
(let ((a0-10 (-> v1-5 eyes sv-32)))
|
||||
(set! (-> a0-10 shader (-> a0-10 shader-count)) s1-0)
|
||||
(+! (-> a0-10 shader-count) 1)
|
||||
)
|
||||
(cond
|
||||
((-> v1-5 high-res?)
|
||||
(adgif-shader-login s1-0)
|
||||
(let ((v1-9 (+ (-> *eyes-texture-base* vram-block) (* (+ (* sv-16 4) sv-32) 32))))
|
||||
(set! (-> s1-0 tex0 tbp0) v1-9)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tw) 6)
|
||||
(set! (-> s1-0 tex0 th) 6)
|
||||
(set! (-> s1-0 tex0 tbw) 2)
|
||||
(set! (-> s1-0 clamp)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x3f :maxv #x3f)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(adgif-shader-login s1-0)
|
||||
(let ((v0-3 (get-eye-block (the-as int sv-16) sv-32)))
|
||||
(set! (-> s1-0 tex0 tbp0) v0-3)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tw) 5)
|
||||
(set! (-> s1-0 tex0 th) 5)
|
||||
(set! (-> s1-0 tex0 tbw) 1)
|
||||
(set! (-> s1-0 clamp)
|
||||
(new 'static 'gs-clamp :wms (gs-tex-wrap-mode clamp) :wmt (gs-tex-wrap-mode clamp) :maxu #x1f :maxv #x1f)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> s1-0 tex0 tcc) 1)
|
||||
(set! (-> s1-0 tex0 psm) 0)
|
||||
(set! (-> s1-0 tex1 mxl) 0)
|
||||
v0-5
|
||||
)
|
||||
(else
|
||||
(let ((a0-39 (adgif-shader-login s1-0)))
|
||||
(if a0-39
|
||||
(texture-usage-update a0-39)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(&+! s1-0 80)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 5 of type merc-fragment-control
|
||||
;; WARN: Return type mismatch uint vs int.
|
||||
(defmethod asize-of ((this merc-fragment-control))
|
||||
(the-as int (+ (* (-> this mat-xfer-count) 2) 4))
|
||||
)
|
||||
|
||||
;; definition for method 3 of type merc-fragment-control
|
||||
(defmethod inspect ((this merc-fragment-control))
|
||||
(format #t "[~8x] ~A~%" this 'merc-fragment-control)
|
||||
(format #t "~Tunsigned-four-count: ~D~%" (-> this unsigned-four-count))
|
||||
(format #t "~Tlump-four-count: ~D~%" (-> this lump-four-count))
|
||||
(format #t "~Tfp-qwc: ~D~%" (-> this fp-qwc))
|
||||
(format #t "~Tmat-xfer-count: ~D~%" (-> this mat-xfer-count))
|
||||
(dotimes (s5-0 (the-as int (-> this mat-xfer-count)))
|
||||
(format #t "~Tmat-dest-data[~d]:~%" s5-0)
|
||||
(format #t "~T~Tmatrix-number: ~D~%" (-> this mat-dest-data s5-0 matrix-number))
|
||||
(format #t "~T~Tmatrix-dest: ~D~%" (-> this mat-dest-data s5-0 matrix-dest))
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 9 of type merc-effect
|
||||
;; WARN: Return type mismatch merc-effect vs none.
|
||||
(defmethod login-adgifs ((this merc-effect))
|
||||
(let* ((tex-login *texture-login-data*)
|
||||
(tex-idx (-> tex-login default-texture-index))
|
||||
)
|
||||
(when (= (-> this merc-effect-version) 1)
|
||||
(if (!= (-> this texture-index) 255)
|
||||
(set! tex-idx (the-as int (-> this texture-index)))
|
||||
)
|
||||
)
|
||||
(set! (-> tex-login current-texture-index) tex-idx)
|
||||
(set! (-> this texture-index) (the-as uint tex-idx))
|
||||
(let ((extra (-> this extra-info)))
|
||||
(when (nonzero? extra)
|
||||
(when (nonzero? (-> extra shader-offset))
|
||||
(let ((shader (adgif-shader-login (the-as adgif-shader (+ (the-as uint extra) (* (-> extra shader-offset) 16))))))
|
||||
(if shader
|
||||
(texture-usage-update shader)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let* ((v1-3 (the-as structure (-> *kernel-context* login-object)))
|
||||
(ctrl-header (-> *texture-login-data* merc-ctrl-header))
|
||||
(eye-ctrl (if (nonzero? (-> ctrl-header eye-ctrl))
|
||||
(-> ctrl-header eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if eye-ctrl
|
||||
(set! (-> eye-ctrl eye-ctrl-index)
|
||||
(find-free-eye-index
|
||||
tex-idx
|
||||
(the-as string (-> (the-as merc-eye-ctrl v1-3) left-iris-shader quad 0 data 0))
|
||||
(-> eye-ctrl eye-slot)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((fragment (the-as object (-> this frag-ctrl)))
|
||||
(geo (the-as object (-> this frag-geo)))
|
||||
)
|
||||
(dotimes (frag-idx (the-as int (-> this frag-count)))
|
||||
(let ((sizeof-frag ((method-of-type merc-fragment-control asize-of) (the-as merc-fragment-control fragment))))
|
||||
(let ((sizeof-geo ((method-of-type merc-fragment asize-of) (the-as merc-fragment geo))))
|
||||
((method-of-type merc-fragment login-adgifs) (the-as merc-fragment geo))
|
||||
(set! geo (&+ (the-as pointer geo) sizeof-geo))
|
||||
)
|
||||
(set! fragment (&+ (the-as pointer fragment) sizeof-frag))
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type merc-ctrl
|
||||
(defmethod inspect ((this merc-ctrl))
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~Tname: ~A~%" (-> this name))
|
||||
(format #t "~Tnum-joints: ~D~%" (-> this length))
|
||||
(format #t "~Textra: ~A~%" (-> this extra))
|
||||
(format #t "~Tmaster-art-group-name: ~A~%" (-> this master-art-group-name))
|
||||
(format #t "~Tmaster-art-group-index: ~D~%" (-> this master-art-group-index))
|
||||
(format #t "~Tseg-table: ~A~%" (-> this seg-table))
|
||||
(inspect (-> this header))
|
||||
(dotimes (s5-0 (the-as int (-> this header effect-count)))
|
||||
(inspect (-> this effect s5-0))
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 8 of type merc-ctrl
|
||||
(defmethod mem-usage ((this merc-ctrl) (usage memory-usage-block) (flags int))
|
||||
(if (-> this extra)
|
||||
(mem-usage (-> this extra) usage flags)
|
||||
)
|
||||
(let ((s4-0 (+ 48 128 (* (-> this header effect-count) 32))))
|
||||
(dotimes (s3-0 (the-as int (-> this header effect-count)))
|
||||
(let ((s2-0 (the-as object (-> this effect s3-0 frag-ctrl))))
|
||||
(dotimes (s1-0 (the-as int (-> this effect s3-0 frag-count)))
|
||||
(set! s4-0 (+ s4-0
|
||||
(* (shr (+ (-> (the-as merc-fragment-control s2-0) unsigned-four-count) 3) 2) 16)
|
||||
(* (shr (+ (-> (the-as merc-fragment-control s2-0) lump-four-count) 3) 2) 16)
|
||||
(* (-> (the-as merc-fragment-control s2-0) fp-qwc) 16)
|
||||
(asize-of (the-as merc-fragment-control s2-0))
|
||||
)
|
||||
)
|
||||
(set! s2-0 (&+ (the-as pointer s2-0) (asize-of (the-as merc-fragment-control s2-0))))
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> usage length) (max 80 (-> usage length)))
|
||||
(set! (-> usage data 79 name) "merc-ctrl")
|
||||
(+! (-> usage data 79 count) 1)
|
||||
(+! (-> usage data 79 used) s4-0)
|
||||
(+! (-> usage data 79 total) (logand -16 (+ s4-0 15)))
|
||||
)
|
||||
(let ((v1-35 0))
|
||||
(dotimes (a0-15 (the-as int (-> this header effect-count)))
|
||||
(when (nonzero? (-> this effect a0-15 blend-frag-count))
|
||||
(let ((a1-9 (the-as object (-> this effect a0-15 blend-ctrl))))
|
||||
(dotimes (a2-1 (the-as int (-> this effect a0-15 blend-frag-count)))
|
||||
(let ((v1-36
|
||||
(+ v1-35
|
||||
(* (+ (-> (the-as merc-blend-ctrl a1-9) nonzero-index-count) 1)
|
||||
(the-as uint (logand (+ (* (the-as uint 6) (-> (the-as merc-blend-ctrl a1-9) blend-vtx-count)) 15) #xfff0))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! v1-35 (the-as int (+ (-> this header blend-target-count) 2 v1-36)))
|
||||
)
|
||||
(set! a1-9 (&+ (the-as pointer a1-9) (+ (-> this header blend-target-count) 2)))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(when (nonzero? v1-35)
|
||||
(set! (-> usage length) (max 82 (-> usage length)))
|
||||
(set! (-> usage data 81 name) "blend-shape")
|
||||
(+! (-> usage data 81 count) 1)
|
||||
(+! (-> usage data 81 used) v1-35)
|
||||
(+! (-> usage data 81 total) (logand -16 (+ v1-35 15)))
|
||||
)
|
||||
)
|
||||
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
|
||||
(let ((a0-29 (-> this header eye-ctrl)))
|
||||
(set! (-> usage length) (max 113 (-> usage length)))
|
||||
(set! (-> usage data 112 name) "eye-anim")
|
||||
(+! (-> usage data 112 count) 1)
|
||||
(let ((v1-49 (asize-of a0-29)))
|
||||
(+! (-> usage data 112 used) v1-49)
|
||||
(+! (-> usage data 112 total) (logand -16 (+ v1-49 15)))
|
||||
)
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 9 of type merc-ctrl
|
||||
(defmethod login ((this merc-ctrl))
|
||||
(set! (-> *kernel-context* login-object) this)
|
||||
(texture-usage-init this)
|
||||
(dotimes (s5-0 (the-as int (-> this header effect-count)))
|
||||
(login-adgifs (-> this effect s5-0))
|
||||
)
|
||||
(when (and (-> this header eye-ctrl) (nonzero? (-> this header eye-ctrl)))
|
||||
(let ((s5-1 (-> this header eye-ctrl)))
|
||||
(dotimes (s4-0 (-> s5-1 shader-count))
|
||||
(let ((a0-5 (adgif-shader-login (-> s5-1 shader s4-0))))
|
||||
(if a0-5
|
||||
(texture-usage-update a0-5)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> *kernel-context* login-object) #f)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 10 of type merc-ctrl
|
||||
(defmethod art-method-10 ((this merc-ctrl))
|
||||
(let* ((v1-0 (-> this header))
|
||||
(v1-1 (if (nonzero? (-> v1-0 eye-ctrl))
|
||||
(-> v1-0 eye-ctrl)
|
||||
(the-as merc-eye-ctrl #f)
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-1
|
||||
(free-eye-index (-> v1-1 eye-ctrl-index))
|
||||
)
|
||||
)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition (debug) for function merc-stats-display
|
||||
;; WARN: Return type mismatch symbol vs none.
|
||||
(defun-debug merc-stats-display ((arg0 merc-ctrl))
|
||||
(format #t "~30s:" (-> arg0 name))
|
||||
(let ((s5-0 (-> arg0 header st-int-scale))
|
||||
(s4-0 (ash 1 (- 12 (the-as int (-> arg0 header st-int-scale)))))
|
||||
)
|
||||
(format #t " ST ~3D, " s4-0)
|
||||
(cond
|
||||
((>= s5-0 (the-as uint 5))
|
||||
(format #t "RANGE ~D+," (/ 128 s4-0))
|
||||
)
|
||||
((= s5-0 4)
|
||||
(format #t "RANGE 0.5+,")
|
||||
)
|
||||
)
|
||||
)
|
||||
(dotimes (s5-1 (the-as int (-> arg0 header effect-count)))
|
||||
(let ((s3-0 (-> arg0 effect s5-1)))
|
||||
(if (nonzero? s5-1)
|
||||
(format #t "~48s " " ")
|
||||
)
|
||||
(let ((a2-4 (-> s3-0 frag-count))
|
||||
(s4-1 (-> s3-0 tri-count))
|
||||
(f30-0 (the float (-> s3-0 frag-count)))
|
||||
(f28-0 (the float (-> s3-0 dvert-count)))
|
||||
(f26-0 (the float (-> s3-0 tri-count)))
|
||||
)
|
||||
(if (>= (/ (+ 50.0 f28-0) f30-0) 50.0)
|
||||
(format #t "~3D frags, ~2,,1f dverts/frag " a2-4 (/ f28-0 f30-0))
|
||||
(format #t "~3D frags, ~2,,1f ******/**** " a2-4 (/ f28-0 f30-0))
|
||||
)
|
||||
(format
|
||||
#t
|
||||
"(~4D tris, striplen ~2,,2f, ~2,,1f tris/frag)~%"
|
||||
s4-1
|
||||
(/ (* 2.0 f26-0) (- f28-0 f26-0))
|
||||
(/ f26-0 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition (debug) for function merc-stats
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun-debug merc-stats ()
|
||||
(dotimes (gp-0 11)
|
||||
(let ((s5-0 (-> *level* level gp-0 art-group)))
|
||||
(when (nonzero? s5-0)
|
||||
(dotimes (s4-0 (-> s5-0 art-group-array length))
|
||||
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
|
||||
(dotimes (s2-0 (-> s3-0 length))
|
||||
(let* ((s1-0 (-> s3-0 data s2-0))
|
||||
(a0-3 (if (type? s1-0 merc-ctrl)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(if a0-3
|
||||
(merc-stats-display (the-as merc-ctrl a0-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition (debug) for function merc-edge-stats
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun-debug merc-edge-stats ()
|
||||
(dotimes (gp-0 11)
|
||||
(let ((s5-0 (-> *level* level gp-0 art-group)))
|
||||
(when (nonzero? s5-0)
|
||||
(dotimes (s4-0 (-> s5-0 art-group-array length))
|
||||
(let ((s3-0 (-> s5-0 art-group-array s4-0)))
|
||||
(dotimes (s2-0 (-> s3-0 length))
|
||||
(let* ((s1-0 (-> s3-0 data s2-0))
|
||||
(v1-9 (if (type? s1-0 merc-ctrl)
|
||||
s1-0
|
||||
)
|
||||
)
|
||||
)
|
||||
(if v1-9
|
||||
(format #t "~30s: ~f~%" (-> v1-9 name) (-> (the-as merc-ctrl v1-9) header longest-edge))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
||||
|
||||
;; definition for function merc-vu1-add-vu-function
|
||||
;; WARN: Return type mismatch dma-packet vs dma-gif-packet.
|
||||
(defun merc-vu1-add-vu-function ((arg0 dma-packet) (arg1 vu-function) (arg2 int))
|
||||
(let ((v1-0 (the-as object (+ (the-as uint arg1) 16)))
|
||||
(a3-0 (-> arg1 qlength))
|
||||
(a1-1 (-> arg1 origin))
|
||||
)
|
||||
(while (> a3-0 0)
|
||||
(let ((t0-1 (min 127 a3-0)))
|
||||
(set! (-> arg0 dma) (new 'static 'dma-tag :id (dma-tag-id ref) :qwc t0-1 :addr (the-as int v1-0)))
|
||||
(set! (-> arg0 vif0) (new 'static 'vif-tag :cmd (if (zero? arg2) 16 19)))
|
||||
(set! (-> arg0 vif1) (new 'static 'vif-tag :cmd (vif-cmd mpg) :num (* t0-1 2) :imm a1-1))
|
||||
(&+! arg0 16)
|
||||
(set! v1-0 (+ (the-as uint v1-0) (* t0-1 16)))
|
||||
(set! a3-0 (- a3-0 t0-1))
|
||||
(+! a1-1 (* t0-1 2))
|
||||
)
|
||||
)
|
||||
)
|
||||
(the-as dma-gif-packet arg0)
|
||||
)
|
||||
|
||||
;; definition for function merc-vu1-initialize-chain
|
||||
;; INFO: Used lq/sq
|
||||
(defun merc-vu1-initialize-chain ((arg0 dma-gif-packet) (arg1 int))
|
||||
(let ((gp-0 (the-as object (merc-vu1-add-vu-function (the-as dma-packet arg0) merc-vu1-block 1))))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif dma) (new 'static 'dma-tag :qwc #xa :id (dma-tag-id cnt)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif0) (new 'static 'vif-tag :imm #x404 :cmd (vif-cmd stcycl)))
|
||||
(set! (-> (the-as dma-gif-packet gp-0) dma-vif vif1) (new 'static 'vif-tag :cmd (vif-cmd stmod)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 4) (new 'static 'vif-tag :imm #x1ba :cmd (vif-cmd base)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 5) (new 'static 'vif-tag :imm #xfe46 :cmd (vif-cmd offset)))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 6) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as (pointer vif-tag) gp-0) 7) (new 'static 'vif-tag :num #x8 :cmd (vif-cmd unpack-v4-32)))
|
||||
(let ((s5-0 (the-as merc-vu1-low-mem (&+ (the-as dma-gif-packet gp-0) 32))))
|
||||
(case *subdivide-foreground-draw-mode*
|
||||
(((subdivide-setting textured))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303e4000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting outline))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting gouraud))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type tri-strip) :iip #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x30364000 32)) 32))
|
||||
)
|
||||
(((subdivide-setting hack))
|
||||
(set! (-> s5-0 tri-strip-gif tag)
|
||||
(new 'static 'gif-tag64
|
||||
:pre #x1
|
||||
:nreg #x3
|
||||
:prim (new 'static 'gs-prim :prim (gs-prim-type line-strip) :iip #x1 :tme #x1 :fge #x1 :abe arg1)
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif regs)
|
||||
(new 'static 'gif-tag-regs :regs0 (gif-reg-id st) :regs1 (gif-reg-id rgbaq) :regs2 (gif-reg-id xyzf2))
|
||||
)
|
||||
(set! (-> s5-0 tri-strip-gif word 3) (shr (make-u128 0 (shl #x303d4000 32)) 32))
|
||||
)
|
||||
)
|
||||
(set! (-> s5-0 ad-gif tag) (new 'static 'gif-tag64 :nloop #x5 :nreg #x1))
|
||||
(set! (-> s5-0 ad-gif regs) (new 'static 'gif-tag-regs :regs0 (gif-reg-id a+d)))
|
||||
(set! (-> s5-0 hvdf-offset quad) (-> *math-camera* hvdf-off quad))
|
||||
(quad-copy! (-> s5-0 perspective) (the-as pointer (-> *math-camera* perspective)) 4)
|
||||
(set-vector! (-> s5-0 fog) (-> *math-camera* pfog0) (-> *math-camera* fog-min) (-> *math-camera* fog-max) 0.0)
|
||||
)
|
||||
(let ((v1-50 (-> (the-as (inline-array dma-packet) gp-0) 10)))
|
||||
(set! (-> v1-50 dma) (new 'static 'dma-tag :id (dma-tag-id cnt)))
|
||||
(set! (-> v1-50 vif0) (new 'static 'vif-tag))
|
||||
(set! (-> v1-50 vif1) (new 'static 'vif-tag :cmd (vif-cmd mscal) :msk #x1 :imm #x0))
|
||||
(&+ v1-50 16)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function merc-vu1-init-buffer
|
||||
(defun merc-vu1-init-buffer ((arg0 bucket-id) (arg1 int) (arg2 symbol))
|
||||
(let ((v1-0 *display*)
|
||||
(a2-6 (+ (* (+ (/ (-> merc-vu1-block qlength) 127) 1) 16) 224))
|
||||
)
|
||||
(+! (-> v1-0 mem-reserve-size) a2-6)
|
||||
(when (not (-> v1-0 dma-buffer-overflow))
|
||||
(let ((t0-0 (-> v1-0 frames (-> v1-0 on-screen) global-buf)))
|
||||
(if (< (-> t0-0 real-buffer-end) (the-as int (&+ (-> t0-0 base) a2-6)))
|
||||
(set! (-> v1-0 dma-buffer-overflow) #t)
|
||||
)
|
||||
)
|
||||
(when (not (-> v1-0 dma-buffer-overflow))
|
||||
(let ((s5-0 (-> *display* frames (-> *display* on-screen) bucket-group arg0)))
|
||||
(when (!= s5-0 (-> s5-0 last))
|
||||
(let* ((s3-0 (-> *display* frames (-> *display* on-screen) global-buf))
|
||||
(s4-3 (-> s3-0 base))
|
||||
)
|
||||
(set! (-> s3-0 base) (the-as pointer (merc-vu1-initialize-chain (the-as dma-gif-packet (-> s3-0 base)) arg1)))
|
||||
(dma-buffer-add-gs-set s3-0
|
||||
(test-1 (new 'static 'gs-test
|
||||
:ate #x1
|
||||
:atst (gs-atest greater-equal)
|
||||
:aref #x26
|
||||
:zte #x1
|
||||
:ztst (gs-ztest greater-equal)
|
||||
)
|
||||
)
|
||||
(zbuf-1 (if arg2
|
||||
#x1000130
|
||||
(the-as int (the-as uint #x101000130))
|
||||
)
|
||||
)
|
||||
)
|
||||
(let ((v1-17 (the-as object (-> s3-0 base))))
|
||||
(set! (-> (the-as (pointer uint64) v1-17)) (logior #x20000000 (shr (shl (-> s5-0 next) 33) 1)))
|
||||
(set! (-> (the-as dma-packet v1-17) vif0) (new 'static 'vif-tag))
|
||||
(set! (-> (the-as dma-packet v1-17) vif1) (new 'static 'vif-tag))
|
||||
(set! (-> s3-0 base) (&+ (the-as pointer v1-17) 16))
|
||||
)
|
||||
(set! (-> s5-0 next) (the-as uint s4-3))
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
0
|
||||
)
|
||||
|
||||
;; definition for function merc-vu1-init-buffers
|
||||
;; WARN: Return type mismatch int vs none.
|
||||
(defun merc-vu1-init-buffers ()
|
||||
(when (logtest? (-> *display* vu1-enable-user) (vu1-renderer-mask merc))
|
||||
(merc-vu1-init-buffer (bucket-id bucket17) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket29) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket41) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket53) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket65) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket77) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket89) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket101) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket113) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket125) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket341) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket352) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket357) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket362) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket367) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket372) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket377) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket382) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket387) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket392) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket397) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket402) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket136) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket146) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket156) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket166) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket176) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket186) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket196) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket206) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket216) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket226) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket346) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket234) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket245) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket256) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket267) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket278) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket289) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket300) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket311) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket322) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket333) 1 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket407) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket412) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket417) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket422) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket427) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket432) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket437) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket442) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket447) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket452) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket457) 0 #t)
|
||||
(merc-vu1-init-buffer (bucket-id bucket464) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket474) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket484) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket494) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket504) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket514) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket524) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket534) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket544) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket554) 1 #f)
|
||||
(merc-vu1-init-buffer (bucket-id bucket564) 1 #f)
|
||||
)
|
||||
0
|
||||
(none)
|
||||
)
|
12
test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc
generated
vendored
12
test/decompiler/reference/jak3/engine/gfx/hw/display-h_REF.gc
generated
vendored
|
@ -167,10 +167,10 @@
|
|||
tie-envmap-scissor
|
||||
tie-vanish
|
||||
generic
|
||||
merc
|
||||
emerc
|
||||
shrubbery
|
||||
shrub-near
|
||||
merc
|
||||
emerc
|
||||
billboard
|
||||
shrubbery-vanish
|
||||
tfrag-trans
|
||||
|
@ -203,10 +203,10 @@
|
|||
tie-envmap-scissor
|
||||
tie-vanish
|
||||
generic
|
||||
merc
|
||||
emerc
|
||||
shrubbery
|
||||
shrub-near
|
||||
merc
|
||||
emerc
|
||||
billboard
|
||||
shrubbery-vanish
|
||||
tfrag-trans
|
||||
|
@ -240,7 +240,3 @@
|
|||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
2
test/decompiler/reference/jak3/engine/level/level-h_REF.gc
generated
vendored
2
test/decompiler/reference/jak3/engine/level/level-h_REF.gc
generated
vendored
|
@ -657,7 +657,7 @@
|
|||
(:methods
|
||||
(level-group-method-9 () none)
|
||||
(level-group-method-10 () none)
|
||||
(level-group-method-11 () none)
|
||||
(get-level-by-heap-ptr-and-status (_type_ pointer symbol) level)
|
||||
(level-group-method-12 () none)
|
||||
(level-group-method-13 () none)
|
||||
(level-group-method-14 () none)
|
||||
|
|
497
test/decompiler/reference/jak3/engine/math/transformq_REF.gc
generated
vendored
Normal file
497
test/decompiler/reference/jak3/engine/math/transformq_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,497 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition for method 2 of type transformq
|
||||
(defmethod print ((this transformq))
|
||||
(format #t "#<transformq @ #x~X~%" this)
|
||||
(format #t "~T~Ttrans:~F ~F ~F ~F ~%" (-> this trans x) (-> this trans y) (-> this trans z) (-> this trans w))
|
||||
(format #t "~T~Tquat: ~F ~F ~F ~F ~%" (-> this quat x) (-> this quat y) (-> this quat z) (-> this quat w))
|
||||
(format #t "~T~Tscale:~F ~F ~F ~F>" (-> this scale x) (-> this scale y) (-> this scale z) (-> this scale w))
|
||||
this
|
||||
)
|
||||
|
||||
;; definition for method 27 of type trsqv
|
||||
(defmethod get-quaternion ((this trsqv))
|
||||
"Get the quat for this [[trsqv]]."
|
||||
(-> this quat)
|
||||
)
|
||||
|
||||
;; definition for method 18 of type trsqv
|
||||
(defmethod set-quaternion! ((this trsqv) (arg0 quaternion))
|
||||
"Set this [[trsqv]]'s quaternion."
|
||||
(quaternion-copy! (get-quaternion this) arg0)
|
||||
)
|
||||
|
||||
;; definition for method 21 of type trsqv
|
||||
(defmethod rot->dir-targ! ((this trsqv))
|
||||
"Set the target direction for this [[trsqv]] to its quaternion."
|
||||
(quaternion-copy! (-> this dir-targ) (get-quaternion this))
|
||||
)
|
||||
|
||||
;; definition for method 22 of type trsqv
|
||||
(defmethod y-angle ((this trsqv))
|
||||
"Get the y angle for this [[trsqv]]'s quaternion."
|
||||
(quaternion-y-angle (get-quaternion this))
|
||||
)
|
||||
|
||||
;; definition for method 9 of type trsqv
|
||||
(defmethod seek-toward-heading-vec! ((this trsqv) (arg0 vector) (arg1 float) (arg2 time-frame))
|
||||
"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"
|
||||
(let* ((f0-0 (deg-diff (quaternion-y-angle (-> this quat)) (vector-y-angle arg0)))
|
||||
(f1-2 (fmin (* arg1 (seconds-per-frame)) (/ (* 5.0 (fabs f0-0)) (the float arg2))))
|
||||
(f30-0 (fmax (fmin f0-0 f1-2) (- f1-2)))
|
||||
)
|
||||
(let ((f0-2 (-> this old-y-angle-diff)))
|
||||
(set! f30-0
|
||||
(cond
|
||||
((or (= f0-2 0.0)
|
||||
(and (< 0.0 f30-0) (< 0.0 f0-2))
|
||||
(or (and (< f30-0 0.0) (< f0-2 0.0)) (time-elapsed? (-> this angle-change-time) (seconds 0.2)))
|
||||
)
|
||||
(set-time! (-> this angle-change-time))
|
||||
f30-0
|
||||
)
|
||||
(else
|
||||
(* 0.000000001 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(set! (-> this old-y-angle-diff) f30-0)
|
||||
(let ((a1-2 (get-quaternion this)))
|
||||
(quaternion-rotate-y! a1-2 a1-2 f30-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 10 of type trsqv
|
||||
(defmethod set-heading-vec! ((this trsqv) (arg0 vector))
|
||||
"Makes us look in the arg0 direction immediately. Pitch will be unchanged."
|
||||
(let ((s3-0 (get-quaternion this)))
|
||||
(forward-up-nopitch->quaternion
|
||||
s3-0
|
||||
(vector-normalize-copy! (new 'stack-no-clear 'vector) arg0 1.0)
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 11 of type trsqv
|
||||
(defmethod seek-to-point-toward-point! ((this trsqv) (arg0 vector) (arg1 float) (arg2 time-frame))
|
||||
"Seek toward pointing toward arg0 from our current location."
|
||||
(seek-toward-heading-vec! this (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) arg1 arg2)
|
||||
)
|
||||
|
||||
;; definition for method 12 of type trsqv
|
||||
(defmethod point-toward-point! ((this trsqv) (arg0 vector))
|
||||
"Immediately point toward arg0."
|
||||
(let ((s3-0 (get-quaternion this)))
|
||||
(forward-up-nopitch->quaternion
|
||||
s3-0
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) 1.0)
|
||||
(vector-y-quaternion! (new 'stack-no-clear 'vector) s3-0)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 13 of type trsqv
|
||||
(defmethod seek-toward-yaw-angle! ((this trsqv) (arg0 float) (arg1 float) (arg2 time-frame))
|
||||
"Seek toward the given yaw angle."
|
||||
(let ((s3-0 (method-of-object this seek-toward-heading-vec!))
|
||||
(s2-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> s2-0 x) (sin arg0))
|
||||
(set! (-> s2-0 y) 0.0)
|
||||
(set! (-> s2-0 z) (cos arg0))
|
||||
(set! (-> s2-0 w) 1.0)
|
||||
(s3-0 this s2-0 arg1 arg2)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 14 of type trsqv
|
||||
(defmethod set-yaw-angle-clear-roll-pitch! ((this trsqv) (arg0 float))
|
||||
"Immediately clear our roll and pitch and set yaw to the given angle."
|
||||
(let ((s5-0 (method-of-object this set-heading-vec-clear-roll-pitch!))
|
||||
(s4-0 (new 'stack-no-clear 'vector))
|
||||
)
|
||||
(set! (-> s4-0 x) (sin arg0))
|
||||
(set! (-> s4-0 y) 0.0)
|
||||
(set! (-> s4-0 z) (cos arg0))
|
||||
(set! (-> s4-0 w) 1.0)
|
||||
(s5-0 this s4-0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 15 of type trsqv
|
||||
(defmethod set-roll-to-grav! ((this trsqv) (arg0 float))
|
||||
"Set our roll so that our local down aligns with standard gravity."
|
||||
(set-roll-to-grav-2! this arg0)
|
||||
)
|
||||
|
||||
;; definition for method 16 of type trsqv
|
||||
(defmethod set-roll-to-grav-2! ((this trsqv) (arg0 float))
|
||||
"Set our roll so that our local down aligns with standard gravity."
|
||||
(let* ((s5-0 (get-quaternion this))
|
||||
(s1-0 (-> *standard-dynamics* gravity-normal))
|
||||
(s3-0 (quaternion->matrix (new 'stack-no-clear 'matrix) s5-0))
|
||||
)
|
||||
(let ((s4-0 (-> s3-0 fvec)))
|
||||
(vector-normalize! (vector-flatten! (-> s3-0 uvec) s1-0 s4-0) 1.0)
|
||||
(vector-cross! (-> s3-0 rvec) (-> s3-0 uvec) s4-0)
|
||||
)
|
||||
(let ((a1-5 (matrix-rotate-z! (new 'stack-no-clear 'matrix) arg0)))
|
||||
(matrix*! s3-0 a1-5 s3-0)
|
||||
)
|
||||
(matrix->quaternion s5-0 s3-0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 25 of type trsqv
|
||||
(defmethod roll-relative-to-gravity ((this trsqv))
|
||||
"Get our roll, relative to 'down' from gravity."
|
||||
(let* ((s5-0 (get-quaternion this))
|
||||
(gp-0 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(s5-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(a1-2 (-> *standard-dynamics* gravity-normal))
|
||||
(v1-2 (vector-normalize! (vector-flatten! (new 'stack-no-clear 'vector) a1-2 gp-0) 1.0))
|
||||
(f0-1 (vector-dot v1-2 s5-1))
|
||||
)
|
||||
(if (< (vector-dot (vector-cross! (new 'stack-no-clear 'vector) v1-2 s5-1) gp-0) 0.0)
|
||||
(- (acos f0-1))
|
||||
(acos f0-1)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 17 of type trsqv
|
||||
;; INFO: Used lq/sq
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [mula.s f0, f3]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madda.s f1, f4]
|
||||
;; ERROR: Unsupported inline assembly instruction kind - [madd.s f0, f2, f5]
|
||||
(defmethod rotate-toward-orientation! ((this trsqv) (arg0 quaternion) (arg1 float) (arg2 float) (arg3 int) (arg4 int) (arg5 float))
|
||||
"Adjust our orientation toward target, subject to some rate limits.
|
||||
For Jak 1, I said:
|
||||
I don't think this is a very robust function and probably doesn't work right in cases
|
||||
where an axis flips by 180 degrees.
|
||||
But now they use matrix-from-two-vectors-the-long-way-smooth to fix it! Good job.
|
||||
This additionally uses the fancy logic of matrix-from-two-vectors-smooth."
|
||||
(local-vars
|
||||
(f0-4 float)
|
||||
(sv-192 (function quaternion vector vector float int quaternion))
|
||||
(sv-208 quaternion)
|
||||
(sv-224 vector)
|
||||
(sv-240 int)
|
||||
(sv-256 vector)
|
||||
(sv-272 vector)
|
||||
)
|
||||
(set! sv-240 arg4)
|
||||
(let ((s2-0 arg5)
|
||||
(s5-0 (get-quaternion this))
|
||||
)
|
||||
(let ((gp-0 (new 'stack-no-clear 'quaternion)))
|
||||
(when (< 0.0 arg2)
|
||||
(set! sv-192 quaternion-from-two-vectors-smooth!)
|
||||
(set! sv-208 gp-0)
|
||||
(set! sv-224 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((a2-1 (vector-y-quaternion! (new 'stack-no-clear 'vector) arg0)))
|
||||
(sv-192 sv-208 sv-224 a2-1 arg2 sv-240)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
(when (< 0.0 arg1)
|
||||
(set! sv-256 (vector-y-quaternion! (new 'stack-no-clear 'vector) s5-0))
|
||||
(let ((s1-2 (vector-z-quaternion! (new 'stack-no-clear 'vector) s5-0)))
|
||||
(set! sv-272 (vector-z-quaternion! (new 'stack-no-clear 'vector) arg0))
|
||||
(let ((s0-1 (new 'stack-no-clear 'matrix)))
|
||||
(vector-flatten! s1-2 s1-2 sv-256)
|
||||
(vector-flatten! sv-272 sv-272 sv-256)
|
||||
(vector-normalize! s1-2 1.0)
|
||||
(vector-normalize! sv-272 1.0)
|
||||
(cond
|
||||
((!= s2-0 0.0)
|
||||
(let* ((v1-5 (vector-cross! (new 'stack-no-clear 'vector) s1-2 sv-272))
|
||||
(f0-3 (-> sv-256 x))
|
||||
(f1-3 (-> sv-256 y))
|
||||
(f2-0 (-> sv-256 z))
|
||||
(f3-0 (-> v1-5 x))
|
||||
(f4-0 (-> v1-5 y))
|
||||
(f5-0 (-> v1-5 z))
|
||||
)
|
||||
(.mula.s f0-3 f3-0)
|
||||
(.madda.s f1-3 f4-0)
|
||||
(.madd.s f0-4 f2-0 f5-0)
|
||||
)
|
||||
(if (< (* f0-4 s2-0) 0.0)
|
||||
(matrix-from-two-vectors-the-long-way-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(else
|
||||
(matrix-from-two-vectors-smooth! s0-1 s1-2 sv-272 arg1 arg3)
|
||||
)
|
||||
)
|
||||
(matrix->quaternion gp-0 s0-1)
|
||||
)
|
||||
)
|
||||
(quaternion-normalize! (quaternion*! s5-0 gp-0 s5-0))
|
||||
)
|
||||
)
|
||||
s5-0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 19 of type trsqv
|
||||
(defmethod set-heading-vec-clear-roll-pitch! ((this trsqv) (arg0 vector))
|
||||
"Set our rotation to point along the given heading, with no roll or pitch."
|
||||
(forward-up->quaternion
|
||||
(get-quaternion this)
|
||||
(vector-normalize-copy! (new 'stack-no-clear 'vector) arg0 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 20 of type trsqv
|
||||
(defmethod point-toward-point-clear-roll-pitch! ((this trsqv) (arg0 vector))
|
||||
"Set our orientation to point toward arg0, clearing roll and pitch."
|
||||
(forward-up->quaternion
|
||||
(get-quaternion this)
|
||||
(vector-normalize! (vector-! (new 'stack-no-clear 'vector) arg0 (-> this trans)) 1.0)
|
||||
(new 'static 'vector :y 1.0 :w 1.0)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function transformq-copy!
|
||||
;; INFO: Used lq/sq
|
||||
(defun transformq-copy! ((arg0 transformq) (arg1 transformq))
|
||||
"Set arg0 = arg1."
|
||||
(let ((v1-0 (-> arg1 trans quad))
|
||||
(a2-0 (-> arg1 quat quad))
|
||||
(a1-1 (-> arg1 scale quad))
|
||||
)
|
||||
(set! (-> arg0 trans quad) v1-0)
|
||||
(set! (-> arg0 quat quad) a2-0)
|
||||
(set! (-> arg0 scale quad) a1-1)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
|
||||
;; definition for function matrix<-transformq!
|
||||
;; INFO: Used lq/sq
|
||||
(defun matrix<-transformq! ((arg0 matrix) (arg1 transformq))
|
||||
"Convert to 4x4 affine transform."
|
||||
(local-vars (v1-1 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(cond
|
||||
(#f
|
||||
(set! (-> arg0 trans quad) (-> arg1 trans quad))
|
||||
)
|
||||
(else
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
(.mov v1-1 vf5)
|
||||
)
|
||||
)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function matrix<-no-trans-transformq!
|
||||
(defun matrix<-no-trans-transformq! ((arg0 matrix) (arg1 transformq))
|
||||
"Create 4x4 affine transform with no translation."
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function matrix<-transformq+trans!
|
||||
(defun matrix<-transformq+trans! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Convert to affine transform with an additional translation (in the local frame)."
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.mul.x.vf acc vf3 vf6)
|
||||
(.add.mul.y.vf acc vf4 vf6 acc)
|
||||
(.add.mul.z.vf acc vf5 vf6 acc)
|
||||
(.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function matrix<-transformq+world-trans!
|
||||
(defun matrix<-transformq+world-trans! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Convert to affine transform with an additional translation in the world frame (not rotated)."
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.add.vf vf2 vf2 vf6 :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function matrix<-parented-transformq!
|
||||
(defun matrix<-parented-transformq! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Unused. Seems like the parented thing means there's an inverse scale in arg2."
|
||||
(local-vars (v1-1 float))
|
||||
(rlet ((vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(let ((v1-0 (new 'stack-no-clear 'vector)))
|
||||
(set! (-> v1-0 x) (/ 1.0 (-> arg2 x)))
|
||||
(set! (-> v1-0 y) (/ 1.0 (-> arg2 y)))
|
||||
(set! (-> v1-0 z) (/ 1.0 (-> arg2 z)))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.lvf vf4 (&-> arg0 rvec quad))
|
||||
(.lvf vf5 (&-> arg0 uvec quad))
|
||||
(.lvf vf6 (&-> arg0 fvec quad))
|
||||
(.mul.x.vf vf4 vf4 vf1)
|
||||
(.mul.y.vf vf5 vf5 vf1)
|
||||
(.mul.z.vf vf6 vf6 vf1)
|
||||
(.lvf vf3 (&-> v1-0 quad))
|
||||
)
|
||||
(.mul.vf vf4 vf4 vf3)
|
||||
(.mul.vf vf5 vf5 vf3)
|
||||
(.mul.vf vf6 vf6 vf3)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf4)
|
||||
(.svf (&-> arg0 uvec quad) vf5)
|
||||
(.svf (&-> arg0 fvec quad) vf6)
|
||||
(.mov v1-1 vf6)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for function matrix<-transformq+rot-offset!
|
||||
(defun matrix<-transformq+rot-offset! ((arg0 matrix) (arg1 transformq) (arg2 vector))
|
||||
"Affine transform for a point offset in the destination frame of the transformq (rather than just
|
||||
adding an offset at the end)."
|
||||
(rlet ((acc :class vf)
|
||||
(vf0 :class vf)
|
||||
(vf1 :class vf)
|
||||
(vf2 :class vf)
|
||||
(vf3 :class vf)
|
||||
(vf4 :class vf)
|
||||
(vf5 :class vf)
|
||||
(vf6 :class vf)
|
||||
)
|
||||
(init-vf0-vector)
|
||||
(quaternion->matrix arg0 (-> arg1 quat))
|
||||
(.lvf vf1 (&-> arg1 scale quad))
|
||||
(.lvf vf2 (&-> arg1 trans quad))
|
||||
(.lvf vf6 (&-> arg2 quad))
|
||||
(.lvf vf3 (&-> arg0 rvec quad))
|
||||
(.lvf vf4 (&-> arg0 uvec quad))
|
||||
(.lvf vf5 (&-> arg0 fvec quad))
|
||||
(.mov.vf vf2 vf0 :mask #b1000)
|
||||
(.mul.x.vf vf3 vf3 vf1)
|
||||
(.mul.y.vf vf4 vf4 vf1)
|
||||
(.mul.z.vf vf5 vf5 vf1)
|
||||
(.mul.x.vf acc vf3 vf6)
|
||||
(.add.mul.y.vf acc vf4 vf6 acc)
|
||||
(.add.mul.z.vf acc vf5 vf6 acc)
|
||||
(.sub.mul.w.vf acc vf6 vf0 acc)
|
||||
(.add.mul.w.vf vf2 vf2 vf0 acc :mask #b111)
|
||||
(.svf (&-> arg0 trans quad) vf2)
|
||||
(.svf (&-> arg0 rvec quad) vf3)
|
||||
(.svf (&-> arg0 uvec quad) vf4)
|
||||
(.svf (&-> arg0 fvec quad) vf5)
|
||||
arg0
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
657
test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc
generated
vendored
Normal file
657
test/decompiler/reference/jak3/engine/physics/cloth-h_REF.gc
generated
vendored
Normal file
|
@ -0,0 +1,657 @@
|
|||
;;-*-Lisp-*-
|
||||
(in-package goal)
|
||||
|
||||
;; definition of type stick-constraint
|
||||
(deftype stick-constraint (structure)
|
||||
((constraint-length-half float)
|
||||
(one-over-two-times-constraint-length float)
|
||||
(constraint-length-sqd float)
|
||||
(particle0 uint16)
|
||||
(particle1 uint16)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type stick-constraint
|
||||
(defmethod inspect ((this stick-constraint))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'stick-constraint)
|
||||
(format #t "~1Tconstraint-length-half: ~f~%" (-> this constraint-length-half))
|
||||
(format #t "~1Tone-over-two-times-constraint-length: ~f~%" (-> this one-over-two-times-constraint-length))
|
||||
(format #t "~1Tconstraint-length-sqd: ~f~%" (-> this constraint-length-sqd))
|
||||
(format #t "~1Tparticle0: ~D~%" (-> this particle0))
|
||||
(format #t "~1Tparticle1: ~D~%" (-> this particle1))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type verlet-particle
|
||||
(deftype verlet-particle (structure)
|
||||
((pos vector :inline)
|
||||
(prev-pos vector :inline)
|
||||
(mass-scale float)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type verlet-particle
|
||||
(defmethod inspect ((this verlet-particle))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'verlet-particle)
|
||||
(format #t "~1Tpos: #<vector @ #x~X>~%" (-> this pos))
|
||||
(format #t "~1Tprev-pos: #<vector @ #x~X>~%" (-> this prev-pos))
|
||||
(format #t "~1Tmass-scale: ~f~%" (-> this mass-scale))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type disc-constraint
|
||||
(deftype disc-constraint (structure)
|
||||
((normal vector :inline)
|
||||
(origin vector :inline)
|
||||
(radius float)
|
||||
(start-particle-index int16)
|
||||
(end-particle-index int16)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type disc-constraint
|
||||
(defmethod inspect ((this disc-constraint))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'disc-constraint)
|
||||
(format #t "~1Tnormal: #<vector @ #x~X>~%" (-> this normal))
|
||||
(format #t "~1Torigin: #<vector @ #x~X>~%" (-> this origin))
|
||||
(format #t "~1Tradius: ~f~%" (-> this radius))
|
||||
(format #t "~1Tstart-particle-index: ~D~%" (-> this start-particle-index))
|
||||
(format #t "~1Tend-particle-index: ~D~%" (-> this end-particle-index))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type cylinder-constraint
|
||||
(deftype cylinder-constraint (structure)
|
||||
((c0 vector :inline)
|
||||
(norm vector :inline)
|
||||
(length float)
|
||||
(radius float)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cylinder-constraint
|
||||
(defmethod inspect ((this cylinder-constraint))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'cylinder-constraint)
|
||||
(format #t "~1Tc0: #<vector @ #x~X>~%" (-> this c0))
|
||||
(format #t "~1Tnorm: #<vector @ #x~X>~%" (-> this norm))
|
||||
(format #t "~1Tlength: ~f~%" (-> this length))
|
||||
(format #t "~1Tradius: ~f~%" (-> this radius))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type particle-anchor-point
|
||||
(deftype particle-anchor-point (structure)
|
||||
((anchor-pos vector :inline)
|
||||
(particle-index uint16)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type particle-anchor-point
|
||||
(defmethod inspect ((this particle-anchor-point))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'particle-anchor-point)
|
||||
(format #t "~1Tanchor-pos: #<vector @ #x~X>~%" (-> this anchor-pos))
|
||||
(format #t "~1Tparticle-index: ~D~%" (-> this particle-index))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type particle-array
|
||||
(deftype particle-array (inline-array-class)
|
||||
((data verlet-particle :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type particle-array
|
||||
(defmethod inspect ((this particle-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> particle-array heap-base) (the-as uint 48))
|
||||
|
||||
;; definition of type float-array
|
||||
(deftype float-array (inline-array-class)
|
||||
((data float :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type float-array
|
||||
(defmethod inspect ((this float-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> float-array heap-base) (the-as uint 4))
|
||||
|
||||
;; definition of type stick-constraint-array
|
||||
(deftype stick-constraint-array (inline-array-class)
|
||||
((data stick-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type stick-constraint-array
|
||||
(defmethod inspect ((this stick-constraint-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> stick-constraint-array heap-base) (the-as uint 16))
|
||||
|
||||
;; definition of type collision-sphere-array
|
||||
(deftype collision-sphere-array (inline-array-class)
|
||||
((data sphere :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collision-sphere-array
|
||||
(defmethod inspect ((this collision-sphere-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> collision-sphere-array heap-base) (the-as uint 16))
|
||||
|
||||
;; definition of type collision-disc-array
|
||||
(deftype collision-disc-array (inline-array-class)
|
||||
((data disc-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collision-disc-array
|
||||
(defmethod inspect ((this collision-disc-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> collision-disc-array heap-base) (the-as uint 48))
|
||||
|
||||
;; definition of type collision-cylinder-array
|
||||
(deftype collision-cylinder-array (inline-array-class)
|
||||
((data cylinder-constraint :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type collision-cylinder-array
|
||||
(defmethod inspect ((this collision-cylinder-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> collision-cylinder-array heap-base) (the-as uint 48))
|
||||
|
||||
;; definition of type anchor-point-array
|
||||
(deftype anchor-point-array (inline-array-class)
|
||||
((data particle-anchor-point :inline :dynamic)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type anchor-point-array
|
||||
(defmethod inspect ((this anchor-point-array))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tlength: ~D~%" (-> this length))
|
||||
(format #t "~1Tallocated-length: ~D~%" (-> this allocated-length))
|
||||
(format #t "~1Tdata[0] @ #x~X~%" (-> this data))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
(set! (-> anchor-point-array heap-base) (the-as uint 32))
|
||||
|
||||
;; definition of type verlet-particle-system
|
||||
(deftype verlet-particle-system (cloth-base)
|
||||
((particles particle-array)
|
||||
(drag float)
|
||||
(accum-force vector :inline)
|
||||
(timestep-frequency int8)
|
||||
(last-simulate-remaining int8)
|
||||
(momentum vector :inline)
|
||||
)
|
||||
(:methods
|
||||
(calculate-wind! (_type_) none)
|
||||
(verlet-particle-system-method-12 (_type_ float) none)
|
||||
(verlet-particle-system-method-13 (_type_) none)
|
||||
(verlet-particle-system-method-14 (_type_) none)
|
||||
(debug-draw (_type_) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type verlet-particle-system
|
||||
(defmethod inspect ((this verlet-particle-system))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tparticles: ~A~%" (-> this particles))
|
||||
(format #t "~1Tdrag: ~f~%" (-> this drag))
|
||||
(format #t "~1Taccum-force: #<vector @ #x~X>~%" (-> this accum-force))
|
||||
(format #t "~1Ttimestep-frequency: ~D~%" (-> this timestep-frequency))
|
||||
(format #t "~1Tlast-simulate-remaining: ~D~%" (-> this last-simulate-remaining))
|
||||
(format #t "~1Tmomentum: #<vector @ #x~X>~%" (-> this momentum))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type current-position-info
|
||||
(deftype current-position-info (structure)
|
||||
((current-vert-index uint16)
|
||||
(last-2-x-index uint16)
|
||||
(last-2-y-index uint16)
|
||||
(last-x-index uint16)
|
||||
(last-y-index uint16)
|
||||
(lights vu-lights :inline)
|
||||
(scale vector :inline)
|
||||
(clamp-col vector :inline)
|
||||
(last-normal vector :inline)
|
||||
(face-normal-needs-flip? symbol)
|
||||
(cross-index0 int8)
|
||||
(cross-index1 int8)
|
||||
(backside-normal vector :inline)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type current-position-info
|
||||
(defmethod inspect ((this current-position-info))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-4)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this 'current-position-info)
|
||||
(format #t "~1Tcurrent-vert-index: ~D~%" (-> this current-vert-index))
|
||||
(format #t "~1Tlast-2-x-index: ~D~%" (-> this last-2-x-index))
|
||||
(format #t "~1Tlast-2-y-index: ~D~%" (-> this last-2-y-index))
|
||||
(format #t "~1Tlast-x-index: ~D~%" (-> this last-x-index))
|
||||
(format #t "~1Tlast-y-index: ~D~%" (-> this last-y-index))
|
||||
(format #t "~1Tlights: #<vu-lights @ #x~X>~%" (-> this lights))
|
||||
(format #t "~1Tscale: #<vector @ #x~X>~%" (-> this scale))
|
||||
(format #t "~1Tclamp-col: #<vector @ #x~X>~%" (-> this clamp-col))
|
||||
(format #t "~1Tlast-normal: #<vector @ #x~X>~%" (-> this last-normal))
|
||||
(format #t "~1Tface-normal-needs-flip?: ~A~%" (-> this face-normal-needs-flip?))
|
||||
(format #t "~1Tcross-index0: ~D~%" (-> this cross-index0))
|
||||
(format #t "~1Tcross-index1: ~D~%" (-> this cross-index1))
|
||||
(format #t "~1Tbackside-normal: #<vector @ #x~X>~%" (-> this backside-normal))
|
||||
(label cfg-4)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type cloth-system
|
||||
(deftype cloth-system (verlet-particle-system)
|
||||
((ground-constraint float)
|
||||
(disc-collision-constraints collision-disc-array)
|
||||
(collision-constraints collision-sphere-array)
|
||||
(stick-constraints stick-constraint-array)
|
||||
(anchor-points anchor-point-array)
|
||||
(constraint-strengths int32 3)
|
||||
(num-xy-constraints int16)
|
||||
(num-diagonal-constraints int16)
|
||||
(cloth-width int32)
|
||||
(cloth-height int32)
|
||||
(strip prim-strip)
|
||||
(strip2 prim-strip)
|
||||
(strip3 prim-strip)
|
||||
(mesh art-cloth-geo)
|
||||
(gravity-constant float)
|
||||
(wind-constant float)
|
||||
(flags cloth-flag)
|
||||
(thickness-scalar float)
|
||||
(ball-collision-radius float)
|
||||
(face-normal-scalar float)
|
||||
(reset-count int8)
|
||||
(num-iterations int8)
|
||||
(secret-disable game-secrets)
|
||||
(params cloth-params)
|
||||
)
|
||||
(:methods
|
||||
(initialize-cloth-system! (_type_ cloth-params) none)
|
||||
(debug-draw-spheres (_type_) none)
|
||||
(cloth-system-method-18 (_type_) int)
|
||||
(cloth-system-method-19 (_type_) none)
|
||||
(cloth-system-method-20 (_type_) none)
|
||||
(cloth-system-method-21 (_type_) none)
|
||||
(cloth-system-method-22 (_type_) none)
|
||||
(cloth-system-method-23 (_type_) none)
|
||||
(cloth-system-method-24 (_type_) int)
|
||||
(cloth-system-method-25 (_type_) int)
|
||||
(cloth-system-method-26 (_type_) none)
|
||||
(cloth-system-method-27 (_type_ vector int int current-position-info) vector)
|
||||
(cloth-system-method-28 (_type_ int int current-position-info) none)
|
||||
(cloth-system-method-29 (_type_ int int current-position-info int) uint)
|
||||
(cloth-system-method-30 (_type_ int int current-position-info int) none)
|
||||
(cloth-system-method-31 (_type_ current-position-info) none)
|
||||
(cloth-system-method-32 (_type_ vector int int current-position-info) none)
|
||||
(cloth-system-method-33 (_type_ vu-lights) none)
|
||||
(cloth-system-method-34 (_type_) none)
|
||||
(cloth-system-method-35 (_type_) none)
|
||||
(cloth-system-method-36 (_type_) none)
|
||||
(cloth-system-cmd-handler (_type_ pair) none)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cloth-system
|
||||
(defmethod inspect ((this cloth-system))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-50)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tparticles: ~A~%" (-> this particles))
|
||||
(format #t "~1Tdrag: ~f~%" (-> this drag))
|
||||
(format #t "~1Taccum-force: #<vector @ #x~X>~%" (-> this accum-force))
|
||||
(format #t "~1Ttimestep-frequency: ~D~%" (-> this timestep-frequency))
|
||||
(format #t "~1Tlast-simulate-remaining: ~D~%" (-> this last-simulate-remaining))
|
||||
(format #t "~1Tmomentum: #<vector @ #x~X>~%" (-> this momentum))
|
||||
(format #t "~1Tground-constraint: ~f~%" (-> this ground-constraint))
|
||||
(format #t "~1Tdisc-collision-constraints: ~A~%" (-> this disc-collision-constraints))
|
||||
(format #t "~1Tcollision-constraints: ~A~%" (-> this collision-constraints))
|
||||
(format #t "~1Tstick-constraints: ~A~%" (-> this stick-constraints))
|
||||
(format #t "~1Tanchor-points: ~A~%" (-> this anchor-points))
|
||||
(format #t "~1Tconstraint-strengths[3] @ #x~X~%" (-> this constraint-strengths))
|
||||
(format #t "~1Tnum-xy-constraints: ~D~%" (-> this num-xy-constraints))
|
||||
(format #t "~1Tnum-diagonal-constraints: ~D~%" (-> this num-diagonal-constraints))
|
||||
(format #t "~1Tcloth-width: ~D~%" (-> this cloth-width))
|
||||
(format #t "~1Tcloth-height: ~D~%" (-> this cloth-height))
|
||||
(format #t "~1Tstrip: ~A~%" (-> this strip))
|
||||
(format #t "~1Tstrip2: ~A~%" (-> this strip2))
|
||||
(format #t "~1Tstrip3: ~A~%" (-> this strip3))
|
||||
(format #t "~1Tmesh: ~A~%" (-> this mesh))
|
||||
(format #t "~1Tgravity-constant: ~f~%" (-> this gravity-constant))
|
||||
(format #t "~1Twind-constant: ~f~%" (-> this wind-constant))
|
||||
(format #t "~1Tflags: #x~X : (cloth-flag " (-> this flags))
|
||||
(let ((s5-0 (-> this flags)))
|
||||
(if (= (logand s5-0 (cloth-flag active)) (cloth-flag active))
|
||||
(format #t "active ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag suppress-mesh-failure)) (cloth-flag suppress-mesh-failure))
|
||||
(format #t "suppress-mesh-failure ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag need-setup)) (cloth-flag need-setup))
|
||||
(format #t "need-setup ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag double-sided)) (cloth-flag double-sided))
|
||||
(format #t "double-sided ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag flip-normals)) (cloth-flag flip-normals))
|
||||
(format #t "flip-normals ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-global-wind)) (cloth-flag use-global-wind))
|
||||
(format #t "use-global-wind ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag inited)) (cloth-flag inited))
|
||||
(format #t "inited ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-wind)) (cloth-flag use-wind))
|
||||
(format #t "use-wind ")
|
||||
)
|
||||
(if (= (logand (cloth-flag using-alt-tex) s5-0) (cloth-flag using-alt-tex))
|
||||
(format #t "using-alt-tex ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag check-ground)) (cloth-flag check-ground))
|
||||
(format #t "check-ground ")
|
||||
)
|
||||
(if (= (logand (cloth-flag use-old-resets) s5-0) (cloth-flag use-old-resets))
|
||||
(format #t "use-old-resets ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space) s5-0) (cloth-flag local-space))
|
||||
(format #t "local-space ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-parent-momentum)) (cloth-flag use-parent-momentum))
|
||||
(format #t "use-parent-momentum ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag wraps)) (cloth-flag wraps))
|
||||
(format #t "wraps ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space-xyz) s5-0) (cloth-flag local-space-xyz))
|
||||
(format #t "local-space-xyz ")
|
||||
)
|
||||
(if (= (logand (cloth-flag riding) s5-0) (cloth-flag riding))
|
||||
(format #t "riding ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag need-reset)) (cloth-flag need-reset))
|
||||
(format #t "need-reset ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-momentum)) (cloth-flag use-momentum))
|
||||
(format #t "use-momentum ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag no-draw)) (cloth-flag no-draw))
|
||||
(format #t "no-draw ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space-y) s5-0) (cloth-flag local-space-y))
|
||||
(format #t "local-space-y ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag no-gravity)) (cloth-flag no-gravity))
|
||||
(format #t "no-gravity ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag autogen-uvs)) (cloth-flag autogen-uvs))
|
||||
(format #t "autogen-uvs ")
|
||||
)
|
||||
(if (= (logand (cloth-flag hidden) s5-0) (cloth-flag hidden))
|
||||
(format #t "hidden ")
|
||||
)
|
||||
)
|
||||
(format #t ")~%")
|
||||
(format #t "~1Tthickness-scalar: ~f~%" (-> this thickness-scalar))
|
||||
(format #t "~1Tball-collision-radius: ~f~%" (-> this ball-collision-radius))
|
||||
(format #t "~1Tface-normal-scalar: ~f~%" (-> this face-normal-scalar))
|
||||
(format #t "~1Treset-count: ~D~%" (-> this reset-count))
|
||||
(format #t "~1Tnum-iterations: ~D~%" (-> this num-iterations))
|
||||
(format #t "~1Tsecret-disable: ~D~%" (-> this secret-disable))
|
||||
(format #t "~1Tparams: #<cloth-params @ #x~X>~%" (-> this params))
|
||||
(label cfg-50)
|
||||
this
|
||||
)
|
||||
|
||||
;; definition of type cloth-on-skeleton
|
||||
(deftype cloth-on-skeleton (cloth-system)
|
||||
((base-transform-index int16)
|
||||
(owner handle)
|
||||
(last-owner-pos vector :inline)
|
||||
(last-owner-mat matrix :inline)
|
||||
)
|
||||
)
|
||||
|
||||
;; definition for method 3 of type cloth-on-skeleton
|
||||
(defmethod inspect ((this cloth-on-skeleton))
|
||||
(when (not this)
|
||||
(set! this this)
|
||||
(goto cfg-50)
|
||||
)
|
||||
(format #t "[~8x] ~A~%" this (-> this type))
|
||||
(format #t "~1Tparticles: ~A~%" (-> this particles))
|
||||
(format #t "~1Tdrag: ~f~%" (-> this drag))
|
||||
(format #t "~1Taccum-force: #<vector @ #x~X>~%" (-> this accum-force))
|
||||
(format #t "~1Ttimestep-frequency: ~D~%" (-> this timestep-frequency))
|
||||
(format #t "~1Tlast-simulate-remaining: ~D~%" (-> this last-simulate-remaining))
|
||||
(format #t "~1Tmomentum: #<vector @ #x~X>~%" (-> this momentum))
|
||||
(format #t "~1Tground-constraint: ~f~%" (-> this ground-constraint))
|
||||
(format #t "~1Tdisc-collision-constraints: ~A~%" (-> this disc-collision-constraints))
|
||||
(format #t "~1Tcollision-constraints: ~A~%" (-> this collision-constraints))
|
||||
(format #t "~1Tstick-constraints: ~A~%" (-> this stick-constraints))
|
||||
(format #t "~1Tanchor-points: ~A~%" (-> this anchor-points))
|
||||
(format #t "~1Tconstraint-strengths[3] @ #x~X~%" (-> this constraint-strengths))
|
||||
(format #t "~1Tnum-xy-constraints: ~D~%" (-> this num-xy-constraints))
|
||||
(format #t "~1Tnum-diagonal-constraints: ~D~%" (-> this num-diagonal-constraints))
|
||||
(format #t "~1Tcloth-width: ~D~%" (-> this cloth-width))
|
||||
(format #t "~1Tcloth-height: ~D~%" (-> this cloth-height))
|
||||
(format #t "~1Tstrip: ~A~%" (-> this strip))
|
||||
(format #t "~1Tstrip2: ~A~%" (-> this strip2))
|
||||
(format #t "~1Tstrip3: ~A~%" (-> this strip3))
|
||||
(format #t "~1Tmesh: ~A~%" (-> this mesh))
|
||||
(format #t "~1Tgravity-constant: ~f~%" (-> this gravity-constant))
|
||||
(format #t "~1Twind-constant: ~f~%" (-> this wind-constant))
|
||||
(format #t "~1Tflags: #x~X : (cloth-flag " (-> this flags))
|
||||
(let ((s5-0 (-> this flags)))
|
||||
(if (= (logand s5-0 (cloth-flag active)) (cloth-flag active))
|
||||
(format #t "active ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag suppress-mesh-failure)) (cloth-flag suppress-mesh-failure))
|
||||
(format #t "suppress-mesh-failure ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag need-setup)) (cloth-flag need-setup))
|
||||
(format #t "need-setup ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag double-sided)) (cloth-flag double-sided))
|
||||
(format #t "double-sided ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag flip-normals)) (cloth-flag flip-normals))
|
||||
(format #t "flip-normals ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-global-wind)) (cloth-flag use-global-wind))
|
||||
(format #t "use-global-wind ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag inited)) (cloth-flag inited))
|
||||
(format #t "inited ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-wind)) (cloth-flag use-wind))
|
||||
(format #t "use-wind ")
|
||||
)
|
||||
(if (= (logand (cloth-flag using-alt-tex) s5-0) (cloth-flag using-alt-tex))
|
||||
(format #t "using-alt-tex ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag check-ground)) (cloth-flag check-ground))
|
||||
(format #t "check-ground ")
|
||||
)
|
||||
(if (= (logand (cloth-flag use-old-resets) s5-0) (cloth-flag use-old-resets))
|
||||
(format #t "use-old-resets ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space) s5-0) (cloth-flag local-space))
|
||||
(format #t "local-space ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-parent-momentum)) (cloth-flag use-parent-momentum))
|
||||
(format #t "use-parent-momentum ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag wraps)) (cloth-flag wraps))
|
||||
(format #t "wraps ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space-xyz) s5-0) (cloth-flag local-space-xyz))
|
||||
(format #t "local-space-xyz ")
|
||||
)
|
||||
(if (= (logand (cloth-flag riding) s5-0) (cloth-flag riding))
|
||||
(format #t "riding ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag need-reset)) (cloth-flag need-reset))
|
||||
(format #t "need-reset ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag use-momentum)) (cloth-flag use-momentum))
|
||||
(format #t "use-momentum ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag no-draw)) (cloth-flag no-draw))
|
||||
(format #t "no-draw ")
|
||||
)
|
||||
(if (= (logand (cloth-flag local-space-y) s5-0) (cloth-flag local-space-y))
|
||||
(format #t "local-space-y ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag no-gravity)) (cloth-flag no-gravity))
|
||||
(format #t "no-gravity ")
|
||||
)
|
||||
(if (= (logand s5-0 (cloth-flag autogen-uvs)) (cloth-flag autogen-uvs))
|
||||
(format #t "autogen-uvs ")
|
||||
)
|
||||
(if (= (logand (cloth-flag hidden) s5-0) (cloth-flag hidden))
|
||||
(format #t "hidden ")
|
||||
)
|
||||
)
|
||||
(format #t ")~%")
|
||||
(format #t "~1Tthickness-scalar: ~f~%" (-> this thickness-scalar))
|
||||
(format #t "~1Tball-collision-radius: ~f~%" (-> this ball-collision-radius))
|
||||
(format #t "~1Tface-normal-scalar: ~f~%" (-> this face-normal-scalar))
|
||||
(format #t "~1Treset-count: ~D~%" (-> this reset-count))
|
||||
(format #t "~1Tnum-iterations: ~D~%" (-> this num-iterations))
|
||||
(format #t "~1Tsecret-disable: ~D~%" (-> this secret-disable))
|
||||
(format #t "~1Tparams: #<cloth-params @ #x~X>~%" (-> this params))
|
||||
(format #t "~1Tbase-transform-index: ~D~%" (-> this base-transform-index))
|
||||
(format #t "~1Towner: ~D~%" (-> this owner))
|
||||
(format #t "~1Tlast-owner-pos: #<vector @ #x~X>~%" (-> this last-owner-pos))
|
||||
(format #t "~1Tlast-owner-mat: #<matrix @ #x~X>~%" (-> this last-owner-mat))
|
||||
(label cfg-50)
|
||||
this
|
||||
)
|
||||
|
||||
;; failed to figure out what this is:
|
||||
0
|
||||
|
||||
|
||||
|
||||
|
3530
test/decompiler/reference/jak3/engine/ui/progress/progress-static_REF.gc
generated
vendored
Normal file
3530
test/decompiler/reference/jak3/engine/ui/progress/progress-static_REF.gc
generated
vendored
Normal file
File diff suppressed because it is too large
Load diff
|
@ -64,7 +64,9 @@
|
|||
"(method 3 hfrag-poly4)",
|
||||
"(method 3 hfrag-poly9)",
|
||||
"(method 3 hfrag-poly25)",
|
||||
"(method 3 hfrag-mip-packet)"
|
||||
"(method 3 hfrag-mip-packet)",
|
||||
// transformq
|
||||
"(method 17 trsqv)"
|
||||
|
||||
],
|
||||
|
||||
|
|
Loading…
Reference in a new issue