2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 15:44:56 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:30:43 -10:00
parent 41ae32be31
commit 636c82a568
1451 changed files with 171430 additions and 203303 deletions

View File

@@ -1,127 +1,104 @@
#include "AFSM.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
template <>
void AFSM::State::Transition::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
triggerCount = r.readUint32Big();
int i = 0;
r.enumerate<Trigger>(triggers, triggerCount,
[&](athena::io::IStreamReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
void AFSM::State::Transition::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
triggerCount = r.readUint32Big();
int i = 0;
r.enumerate<Trigger>(triggers, triggerCount, [&](athena::io::IStreamReader& in, Trigger& tr) {
tr.first = i == 0;
tr.read(in);
i++;
});
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
w.writeInt32Big(triggerCount);
w.enumerate(triggers);
void AFSM::State::Transition::Enumerate<BigDNA::Write>(typename Write::StreamT& w) {
w.writeInt32Big(triggerCount);
w.enumerate(triggers);
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
int i = 0;
/* triggers */
triggerCount = r.enumerate<Trigger>("triggers", triggers,
[&](athena::io::YAMLDocReader& in, Trigger& tr){
tr.first = i == 0;
tr.read(in);
i++;
});
void AFSM::State::Transition::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r) {
int i = 0;
/* triggers */
triggerCount = r.enumerate<Trigger>("triggers", triggers, [&](athena::io::YAMLDocReader& in, Trigger& tr) {
tr.first = i == 0;
tr.read(in);
i++;
});
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
/* triggers */
w.enumerate("triggers", triggers);
void AFSM::State::Transition::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w) {
/* triggers */
w.enumerate("triggers", triggers);
}
template <>
void AFSM::State::Transition::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 4;
for (const Trigger& trig : triggers)
trig.binarySize(s);
void AFSM::State::Transition::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s) {
s += 4;
for (const Trigger& trig : triggers)
trig.binarySize(s);
}
const char* AFSM::State::Transition::DNAType()
{
return "urde::DNAMP1::AFSM::Transition";
const char* AFSM::State::Transition::DNAType() { return "urde::DNAMP1::AFSM::Transition"; }
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader) {
/* name */
name = __dna_reader.readString(-1);
/* parameter */
parameter = __dna_reader.readFloatBig();
if (first) {
/* targetState */
targetState = __dna_reader.readUint32Big();
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Read>(athena::io::IStreamReader& __dna_reader)
{
/* name */
name = __dna_reader.readString(-1);
/* parameter */
parameter = __dna_reader.readFloatBig();
if (first)
{
/* targetState */
targetState = __dna_reader.readUint32Big();
}
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer) {
/* name */
__dna_writer.writeString(name, -1);
/* parameter */
__dna_writer.writeFloatBig(parameter);
if (first) {
/* targetState */
__dna_writer.writeUint32Big(targetState);
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& __dna_writer)
{
/* name */
__dna_writer.writeString(name, -1);
/* parameter */
__dna_writer.writeFloatBig(parameter);
if (first)
{
/* targetState */
__dna_writer.writeUint32Big(targetState);
}
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& __dna_docin) {
/* name */
name = __dna_docin.readString("name");
/* parameter */
parameter = __dna_docin.readFloat("parameter");
if (first) {
/* targetState */
targetState = __dna_docin.readUint32("targetState");
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& __dna_docin)
{
/* name */
name = __dna_docin.readString("name");
/* parameter */
parameter = __dna_docin.readFloat("parameter");
if (first)
{
/* targetState */
targetState = __dna_docin.readUint32("targetState");
}
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& __dna_docout) {
/* name */
__dna_docout.writeString("name", name);
/* parameter */
__dna_docout.writeFloat("parameter", parameter);
if (first) {
/* targetState */
__dna_docout.writeUint32("targetState", targetState);
}
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& __dna_docout)
{
/* name */
__dna_docout.writeString("name", name);
/* parameter */
__dna_docout.writeFloat("parameter", parameter);
if (first)
{
/* targetState */
__dna_docout.writeUint32("targetState", targetState);
}
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::BinarySize>(size_t& __isz) {
__isz += name.size() + 1;
__isz += (first ? 8 : 4);
}
template <>
void AFSM::State::Transition::Trigger::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{
__isz += name.size() + 1;
__isz += (first ? 8 : 4);
}
const char* AFSM::State::Transition::Trigger::DNAType() { return "urde::DNAMP1::AFSM::State::Transition::Trigger"; }
const char* AFSM::State::Transition::Trigger::DNAType()
{
return "urde::DNAMP1::AFSM::State::Transition::Trigger";
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,56 +4,48 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct AFSM : public BigDNA
{
namespace DataSpec::DNAMP1 {
struct AFSM : public BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> stateCount;
Vector<String<-1>, AT_DNA_COUNT(stateCount)> stateNames;
Value<atUint32> triggerCount;
struct State : public BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> stateCount;
Vector<String<-1>, AT_DNA_COUNT(stateCount)> stateNames;
Value<atUint32> triggerCount;
Value<atUint32> transitionCount;
struct Transition : public BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> triggerCount;
struct State : public BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> transitionCount;
struct Transition : public BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> triggerCount;
struct Trigger : public BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
bool first = false;
String<-1> name;
Value<float> parameter;
Value<atUint32> targetState;
};
Vector<Trigger, AT_DNA_COUNT(triggerCount)> triggers;
};
Vector<Transition, AT_DNA_COUNT(transitionCount)> transitions;
struct Trigger : public BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
bool first = false;
String<-1> name;
Value<float> parameter;
Value<atUint32> targetState;
};
Vector<Trigger, AT_DNA_COUNT(triggerCount)> triggers;
};
Vector<State, AT_DNA_COUNT(stateCount)> states;
Vector<Transition, AT_DNA_COUNT(transitionCount)> transitions;
};
Vector<State, AT_DNA_COUNT(stateCount)> states;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
AFSM afsm;
afsm.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(afsm, writer);
return true;
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
AFSM afsm;
afsm.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(afsm, writer);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
AFSM afsm;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(afsm, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
afsm.write(ws);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
AFSM afsm;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(afsm, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
afsm.write(ws);
return true;
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -74,176 +74,170 @@ extern "C" const uint8_t Zoomer_H[];
extern "C" const uint8_t lumigek_H[];
extern "C" const uint8_t test_H[];
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
using namespace std::literals;
static const std::pair<std::string_view, const uint8_t*> Headers[] =
{
{"Atomic"sv, Atomic_H},
{"BetaBeetle"sv, BetaBeetle_H},
{"Bird"sv, Bird_H},
{"BloodFlower"sv, BloodFlower_H},
{"Burrower"sv, Burrower_H},
{"ChozoGhost"sv, ChozoGhost_H},
{"ChubbWeed"sv, ChubbWeed_H},
{"CineBoots"sv, CineBoots_H},
{"CineGeneral"sv, CineGeneral_H},
{"CineGun"sv, CineGun_H},
{"CineMorphball"sv, CineMorphball_H},
{"CineSuit"sv, CineSuit_H},
{"CineVisor"sv, CineVisor_H},
{"Crater"sv, Crater_H},
{"Crystallite"sv, Crystallite_H},
{"Drones"sv, Drones_H},
{"EliteSpacePirate"sv, EliteSpacePirate_H},
{"FireFlea"sv, FireFlea_H},
{"Flaaghra"sv, Flaaghra_H},
{"FlickerBat"sv, FlickerBat_H},
{"FlyingPirate"sv, FlyingPirate_H},
{"FrontEnd"sv, FrontEnd_H},
{"GagantuanBeatle"sv, GagantuanBeatle_H},
{"Gnats"sv, Gnats_H},
{"Gryzbee"sv, Gryzbee_H},
{"IceCrack"sv, IceCrack_H},
{"IceWorld"sv, IceWorld_H},
{"InjuredPirates"sv, InjuredPirates_H},
{"IntroBoss"sv, IntroBoss_H},
{"IntroWorld"sv, IntroWorld_H},
{"JellyZap"sv, JellyZap_H},
{"LavaWorld"sv, LavaWorld_H},
{"Magdolite"sv, Magdolite_H},
{"Metaree"sv, Metaree_H},
{"MetroidPrime"sv, MetroidPrime_H},
{"Metroid"sv, Metroid_H},
{"MinesWorld"sv, MinesWorld_H},
{"MiscSamus"sv, MiscSamus_H},
{"Misc"sv, Misc_H},
{"OmegaPirate"sv, OmegaPirate_H},
{"OverWorld"sv, OverWorld_H},
{"Parasite"sv, Parasite_H},
{"PhazonGun"sv, PhazonGun_H},
{"Phazon"sv, Phazon_H},
{"PuddleSpore"sv, PuddleSpore_H},
{"PuddleToad"sv, PuddleToad_H},
{"Puffer"sv, Puffer_H},
{"ReactorDoor"sv, ReactorDoor_H},
{"Ridley"sv, Ridley_H},
{"Ripper"sv, Ripper_H},
{"RuinsWorld"sv, RuinsWorld_H},
{"SamusShip"sv, SamusShip_H},
{"Scarab"sv, Scarab_H},
{"Seedling"sv, Seedling_H},
{"SheeGoth"sv, SheeGoth_H},
{"SnakeWeed"sv, SnakeWeed_H},
{"Sova"sv, Sova_H},
{"SpacePirate"sv, SpacePirate_H},
{"SpankWeed"sv, SpankWeed_H},
{"Thardus"sv, Thardus_H},
{"TheEnd"sv, TheEnd_H},
{"Torobyte"sv, Torobyte_H},
{"Triclops"sv, Triclops_H},
{"Turret"sv, Turret_H},
{"UI"sv, UI_H},
{"WarWasp"sv, WarWasp_H},
{"Weapons"sv, Weapons_H},
{"ZZZ"sv, ZZZ_H},
{"Zoomer"sv, Zoomer_H},
{"lumigek"sv, lumigek_H},
{"test"sv, test_H}
};
static const std::pair<std::string_view, const uint8_t*> Headers[] = {{"Atomic"sv, Atomic_H},
{"BetaBeetle"sv, BetaBeetle_H},
{"Bird"sv, Bird_H},
{"BloodFlower"sv, BloodFlower_H},
{"Burrower"sv, Burrower_H},
{"ChozoGhost"sv, ChozoGhost_H},
{"ChubbWeed"sv, ChubbWeed_H},
{"CineBoots"sv, CineBoots_H},
{"CineGeneral"sv, CineGeneral_H},
{"CineGun"sv, CineGun_H},
{"CineMorphball"sv, CineMorphball_H},
{"CineSuit"sv, CineSuit_H},
{"CineVisor"sv, CineVisor_H},
{"Crater"sv, Crater_H},
{"Crystallite"sv, Crystallite_H},
{"Drones"sv, Drones_H},
{"EliteSpacePirate"sv, EliteSpacePirate_H},
{"FireFlea"sv, FireFlea_H},
{"Flaaghra"sv, Flaaghra_H},
{"FlickerBat"sv, FlickerBat_H},
{"FlyingPirate"sv, FlyingPirate_H},
{"FrontEnd"sv, FrontEnd_H},
{"GagantuanBeatle"sv, GagantuanBeatle_H},
{"Gnats"sv, Gnats_H},
{"Gryzbee"sv, Gryzbee_H},
{"IceCrack"sv, IceCrack_H},
{"IceWorld"sv, IceWorld_H},
{"InjuredPirates"sv, InjuredPirates_H},
{"IntroBoss"sv, IntroBoss_H},
{"IntroWorld"sv, IntroWorld_H},
{"JellyZap"sv, JellyZap_H},
{"LavaWorld"sv, LavaWorld_H},
{"Magdolite"sv, Magdolite_H},
{"Metaree"sv, Metaree_H},
{"MetroidPrime"sv, MetroidPrime_H},
{"Metroid"sv, Metroid_H},
{"MinesWorld"sv, MinesWorld_H},
{"MiscSamus"sv, MiscSamus_H},
{"Misc"sv, Misc_H},
{"OmegaPirate"sv, OmegaPirate_H},
{"OverWorld"sv, OverWorld_H},
{"Parasite"sv, Parasite_H},
{"PhazonGun"sv, PhazonGun_H},
{"Phazon"sv, Phazon_H},
{"PuddleSpore"sv, PuddleSpore_H},
{"PuddleToad"sv, PuddleToad_H},
{"Puffer"sv, Puffer_H},
{"ReactorDoor"sv, ReactorDoor_H},
{"Ridley"sv, Ridley_H},
{"Ripper"sv, Ripper_H},
{"RuinsWorld"sv, RuinsWorld_H},
{"SamusShip"sv, SamusShip_H},
{"Scarab"sv, Scarab_H},
{"Seedling"sv, Seedling_H},
{"SheeGoth"sv, SheeGoth_H},
{"SnakeWeed"sv, SnakeWeed_H},
{"Sova"sv, Sova_H},
{"SpacePirate"sv, SpacePirate_H},
{"SpankWeed"sv, SpankWeed_H},
{"Thardus"sv, Thardus_H},
{"TheEnd"sv, TheEnd_H},
{"Torobyte"sv, Torobyte_H},
{"Triclops"sv, Triclops_H},
{"Turret"sv, Turret_H},
{"UI"sv, UI_H},
{"WarWasp"sv, WarWasp_H},
{"Weapons"sv, Weapons_H},
{"ZZZ"sv, ZZZ_H},
{"Zoomer"sv, Zoomer_H},
{"lumigek"sv, lumigek_H},
{"test"sv, test_H}};
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir)
{
dir.makeDirChain(true);
bool AGSC::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& dir) {
dir.makeDirChain(true);
Header head;
head.read(rs);
Header head;
head.read(rs);
uint32_t poolLen = rs.readUint32Big();
auto pool = rs.readUBytes(poolLen);
uint32_t poolLen = rs.readUint32Big();
auto pool = rs.readUBytes(poolLen);
uint32_t projLen = rs.readUint32Big();
auto proj = rs.readUBytes(projLen);
uint32_t projLen = rs.readUint32Big();
auto proj = rs.readUBytes(projLen);
uint32_t sampLen = rs.readUint32Big();
auto samp = rs.readUBytes(sampLen);
uint32_t sampLen = rs.readUint32Big();
auto samp = rs.readUBytes(sampLen);
uint32_t sdirLen = rs.readUint32Big();
auto sdir = rs.readUBytes(sdirLen);
uint32_t sdirLen = rs.readUint32Big();
auto sdir = rs.readUBytes(sdirLen);
amuse::AudioGroupData data(proj.get(), projLen, pool.get(), poolLen,
sdir.get(), sdirLen, samp.get(), sampLen, amuse::GCNDataTag{});
amuse::AudioGroupData data(proj.get(), projLen, pool.get(), poolLen, sdir.get(), sdirLen, samp.get(), sampLen,
amuse::GCNDataTag{});
/* Load into amuse representation */
amuse::ProjectDatabase projDb;
projDb.setIdDatabases();
amuse::AudioGroupDatabase group(data);
group.setGroupPath(dir.getAbsolutePath());
/* Load into amuse representation */
amuse::ProjectDatabase projDb;
projDb.setIdDatabases();
amuse::AudioGroupDatabase group(data);
group.setGroupPath(dir.getAbsolutePath());
/* Extract samples */
group.getSdir().extractAllCompressed(dir.getAbsolutePath(), data.getSamp());
/* Extract samples */
group.getSdir().extractAllCompressed(dir.getAbsolutePath(), data.getSamp());
/* Import C headers */
auto lastComp = dir.getLastComponentUTF8();
auto search = std::lower_bound(std::cbegin(Headers), std::cend(Headers), lastComp,
[](const auto& a, const auto& b) { return a.first < b; });
if (search != std::cend(Headers) && search->first == lastComp)
group.importCHeader((char*)search->second);
/* Import C headers */
auto lastComp = dir.getLastComponentUTF8();
auto search = std::lower_bound(std::cbegin(Headers), std::cend(Headers), lastComp,
[](const auto& a, const auto& b) { return a.first < b; });
if (search != std::cend(Headers) && search->first == lastComp)
group.importCHeader((char*)search->second);
/* Write out project/pool */
{
auto projd = group.getProj().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!project.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(projd.data(), projd.size());
}
/* Write out project/pool */
{
auto projd = group.getProj().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!project.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(projd.data(), projd.size());
}
{
auto poold = group.getPool().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!pool.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(poold.data(), poold.size());
}
{
auto poold = group.getPool().toYAML();
athena::io::FileWriter fo(hecl::ProjectPath(dir, _SYS_STR("!pool.yaml")).getAbsolutePath());
if (fo.hasError())
return false;
fo.writeUBytes(poold.data(), poold.size());
}
return true;
return true;
}
bool AGSC::Cook(const hecl::ProjectPath& dir, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
bool AGSC::Cook(const hecl::ProjectPath& dir, const hecl::ProjectPath& outPath) {
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
Header head;
head.audioDir = "Audio/"sv;
head.groupName = dir.getLastComponentUTF8();
head.write(w);
Header head;
head.audioDir = "Audio/"sv;
head.groupName = dir.getLastComponentUTF8();
head.write(w);
amuse::ProjectDatabase projDb;
projDb.setIdDatabases();
amuse::AudioGroupDatabase group(dir.getAbsolutePath());
amuse::ProjectDatabase projDb;
projDb.setIdDatabases();
amuse::AudioGroupDatabase group(dir.getAbsolutePath());
auto proj = group.getProj().toGCNData(group.getPool(), group.getSdir());
auto pool = group.getPool().toData<athena::Big>();
auto sdirSamp = group.getSdir().toGCNData(group);
auto proj = group.getProj().toGCNData(group.getPool(), group.getSdir());
auto pool = group.getPool().toData<athena::Big>();
auto sdirSamp = group.getSdir().toGCNData(group);
w.writeUint32Big(pool.size());
w.writeUBytes(pool.data(), pool.size());
w.writeUint32Big(pool.size());
w.writeUBytes(pool.data(), pool.size());
w.writeUint32Big(proj.size());
w.writeUBytes(proj.data(), proj.size());
w.writeUint32Big(proj.size());
w.writeUBytes(proj.data(), proj.size());
w.writeUint32Big(sdirSamp.second.size());
w.writeUBytes(sdirSamp.second.data(), sdirSamp.second.size());
w.writeUint32Big(sdirSamp.second.size());
w.writeUBytes(sdirSamp.second.data(), sdirSamp.second.size());
w.writeUint32Big(sdirSamp.first.size());
w.writeUBytes(sdirSamp.first.data(), sdirSamp.first.size());
w.writeUint32Big(sdirSamp.first.size());
w.writeUBytes(sdirSamp.first.data(), sdirSamp.first.size());
return true;
return true;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,21 +3,17 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
class AGSC
{
class AGSC {
public:
struct Header : BigDNA
{
AT_DECL_DNA
String<-1> audioDir;
String<-1> groupName;
};
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
struct Header : BigDNA {
AT_DECL_DNA
String<-1> audioDir;
String<-1> groupName;
};
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -10,510 +10,419 @@
#include "EVNT.hpp"
#include "athena/FileReader.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct ANCS : BigDNA
{
using CINFType = CINF;
using CSKRType = CSKR;
using ANIMType = ANIM;
struct ANCS : BigDNA {
using CINFType = CINF;
using CSKRType = CSKR;
using ANIMType = ANIM;
AT_DECL_DNA_YAML
Value<atUint16> version;
struct CharacterSet : BigDNA {
AT_DECL_DNA_YAML
Value<atUint16> version;
Value<atUint32> characterCount;
struct CharacterInfo : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
struct CharacterSet : BigDNA
{
atUint32 idx;
std::string name;
UniqueID32 cmdl;
UniqueID32 cskr;
UniqueID32 cinf;
struct Animation : BigDNA {
AT_DECL_DNA_YAML
Value<atUint16> version;
Value<atUint32> characterCount;
struct CharacterInfo : BigDNA
{
AT_DECL_DNA_YAML
Delete expl;
Value<atUint32> animIdx;
String<-1> strA;
String<-1> strB;
};
std::vector<Animation> animations;
atUint32 idx;
std::string name;
UniqueID32 cmdl;
UniqueID32 cskr;
UniqueID32 cinf;
struct Animation : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> animIdx;
String<-1> strA;
String<-1> strB;
};
std::vector<Animation> animations;
struct PASDatabase : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> magic;
Value<atUint32> animStateCount;
Value<atUint32> defaultState;
struct AnimState : BigDNA
{
AT_DECL_DNA_YAML
Delete expl;
atUint32 id;
struct ParmInfo : BigDNA
{
AT_DECL_DNA_YAML
Delete expl;
enum class DataType
{
Int32 = 0,
UInt32 = 1,
Float = 2,
Bool = 3,
Enum = 4
};
union Parm
{
atInt32 int32;
atUint32 uint32;
float float32;
bool bool1;
Parm() : int32(0) {}
Parm(atInt32 val) : int32(val) {}
Parm(atUint32 val) : uint32(val) {}
Parm(float val) : float32(val) {}
Parm(bool val) : bool1(val) {}
};
atUint32 parmType;
atUint32 weightFunction;
float weight;
Parm range[2];
};
std::vector<ParmInfo> parmInfos;
struct AnimInfo
{
atUint32 id;
std::vector<ParmInfo::Parm> parmVals;
};
std::vector<AnimInfo> animInfos;
};
Vector<AnimState, AT_DNA_COUNT(animStateCount)> animStates;
} pasDatabase;
struct ParticleResData
{
std::vector<UniqueID32> part;
std::vector<UniqueID32> swhc;
std::vector<UniqueID32> unk;
std::vector<UniqueID32> elsc;
} partResData;
atUint32 unk1 = 0;
struct ActionAABB : BigDNA
{
AT_DECL_DNA_YAML
String<-1> name;
Value<atVec3f> aabb[2];
};
std::vector<ActionAABB> animAABBs;
struct Effect : BigDNA
{
AT_DECL_DNA_YAML
String<-1> name;
Value<atUint32> compCount;
struct EffectComponent : BigDNA
{
AT_DECL_DNA_YAML
String<-1> name;
DNAFourCC type;
UniqueID32 id;
String<-1> locator;
Value<float> scale;
Value<atUint32> parentMode;
Value<atUint32> flags;
};
Vector<EffectComponent, AT_DNA_COUNT(compCount)> comps;
};
std::vector<Effect> effects;
UniqueID32Zero cmdlIce;
UniqueID32Zero cskrIce;
std::vector<atUint32> animIdxs;
};
Vector<CharacterInfo, AT_DNA_COUNT(characterCount)> characters;
} characterSet;
struct AnimationSet : BigDNA
{
struct PASDatabase : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
Value<atUint32> magic;
Value<atUint32> animStateCount;
Value<atUint32> defaultState;
struct AnimState : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
atUint32 id;
struct MetaAnimPrimitive;
struct IMetaAnim : BigDNAVYaml
{
struct ParmInfo : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
enum class Type
{
Primitive = 0,
Blend = 1,
PhaseBlend = 2,
Random = 3,
Sequence = 4
} m_type;
const char* m_typeStr;
IMetaAnim(Type type, const char* typeStr)
: m_type(type), m_typeStr(typeStr) {}
virtual void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)=0;
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)=0;
};
struct MetaAnimFactory : BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
std::unique_ptr<IMetaAnim> m_anim;
};
struct MetaAnimPrimitive : IMetaAnim
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimPrimitive() : IMetaAnim(Type::Primitive, "Primitive") {}
UniqueID32 animId;
Value<atUint32> animIdx;
String<-1> animName;
Value<float> unk1;
Value<atUint32> unk2;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out);
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
return func(*this);
}
};
struct MetaAnimBlend : IMetaAnim
{
MetaAnimBlend()
: IMetaAnim(Type::Blend, "Blend") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA;
MetaAnimFactory animB;
Value<float> unkFloat;
Value<atUint8> unk;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{
animA.m_anim->gatherPrimitives(pakRouter, out);
animB.m_anim->gatherPrimitives(pakRouter, out);
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
if (!animA.m_anim->enumeratePrimitives(func))
return false;
if (!animB.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct MetaAnimPhaseBlend : IMetaAnim
{
MetaAnimPhaseBlend()
: IMetaAnim(Type::PhaseBlend, "PhaseBlend") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA;
MetaAnimFactory animB;
Value<float> unkFloat;
Value<atUint8> unk;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{
animA.m_anim->gatherPrimitives(pakRouter, out);
animB.m_anim->gatherPrimitives(pakRouter, out);
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
if (!animA.m_anim->enumeratePrimitives(func))
return false;
if (!animB.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct MetaAnimRandom : IMetaAnim
{
MetaAnimRandom() : IMetaAnim(Type::Random, "Random") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount;
struct Child : BigDNA
{
AT_DECL_DNA
MetaAnimFactory anim;
Value<atUint32> probability;
enum class DataType { Int32 = 0, UInt32 = 1, Float = 2, Bool = 3, Enum = 4 };
union Parm {
atInt32 int32;
atUint32 uint32;
float float32;
bool bool1;
Parm() : int32(0) {}
Parm(atInt32 val) : int32(val) {}
Parm(atUint32 val) : uint32(val) {}
Parm(float val) : float32(val) {}
Parm(bool val) : bool1(val) {}
};
Vector<Child, AT_DNA_COUNT(animCount)> children;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{
for (const auto& child : children)
child.anim.m_anim->gatherPrimitives(pakRouter, out);
}
atUint32 parmType;
atUint32 weightFunction;
float weight;
Parm range[2];
};
std::vector<ParmInfo> parmInfos;
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
for (auto& child : children)
if (!child.anim.m_anim->enumeratePrimitives(func))
return false;
return true;
}
struct AnimInfo {
atUint32 id;
std::vector<ParmInfo::Parm> parmVals;
};
std::vector<AnimInfo> animInfos;
};
struct MetaAnimSequence : IMetaAnim
{
MetaAnimSequence() : IMetaAnim(Type::Sequence, "Sequence") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount;
Vector<MetaAnimFactory, AT_DNA_COUNT(animCount)> children;
Vector<AnimState, AT_DNA_COUNT(animStateCount)> animStates;
} pasDatabase;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{
for (const auto& child : children)
child.m_anim->gatherPrimitives(pakRouter, out);
}
struct ParticleResData {
std::vector<UniqueID32> part;
std::vector<UniqueID32> swhc;
std::vector<UniqueID32> unk;
std::vector<UniqueID32> elsc;
} partResData;
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
for (auto& child : children)
if (!child.m_anim->enumeratePrimitives(func))
return false;
return true;
}
atUint32 unk1 = 0;
struct ActionAABB : BigDNA {
AT_DECL_DNA_YAML
String<-1> name;
Value<atVec3f> aabb[2];
};
std::vector<ActionAABB> animAABBs;
struct Effect : BigDNA {
AT_DECL_DNA_YAML
String<-1> name;
Value<atUint32> compCount;
struct EffectComponent : BigDNA {
AT_DECL_DNA_YAML
String<-1> name;
DNAFourCC type;
UniqueID32 id;
String<-1> locator;
Value<float> scale;
Value<atUint32> parentMode;
Value<atUint32> flags;
};
Vector<EffectComponent, AT_DNA_COUNT(compCount)> comps;
};
std::vector<Effect> effects;
struct Animation : BigDNA
{
AT_DECL_DNA_YAML
String<-1> name;
MetaAnimFactory metaAnim;
};
std::vector<Animation> animations;
UniqueID32Zero cmdlIce;
UniqueID32Zero cskrIce;
struct IMetaTrans : BigDNAVYaml
{
Delete expl;
enum class Type
{
MetaAnim = 0,
Trans = 1,
PhaseTrans = 2,
NoTrans = 3,
} m_type;
const char* m_typeStr;
IMetaTrans(Type type, const char* typeStr)
: m_type(type), m_typeStr(typeStr) {}
virtual void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {}
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {return true;}
};
struct MetaTransFactory : BigDNA
{
AT_DECL_DNA_YAML
Delete expl;
std::unique_ptr<IMetaTrans> m_trans;
};
struct MetaTransMetaAnim : IMetaTrans
{
MetaTransMetaAnim()
: IMetaTrans(Type::MetaAnim, "MetaAnim") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory anim;
std::vector<atUint32> animIdxs;
};
Vector<CharacterInfo, AT_DNA_COUNT(characterCount)> characters;
} characterSet;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out)
{
anim.m_anim->gatherPrimitives(pakRouter, out);
}
struct AnimationSet : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func)
{
return anim.m_anim->enumeratePrimitives(func);
}
};
struct MetaTransTrans : IMetaTrans
{
MetaTransTrans()
: IMetaTrans(Type::Trans, "Trans") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime;
Value<atUint32> transDurTimeMode;
Value<bool> unk2;
Value<bool> runA;
Value<atUint32> flags;
};
struct MetaTransPhaseTrans : IMetaTrans
{
MetaTransPhaseTrans()
: IMetaTrans(Type::PhaseTrans, "PhaseTrans") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime;
Value<atUint32> transDurTimeMode;
Value<bool> unk2;
Value<bool> runA;
Value<atUint32> flags;
};
struct MetaAnimPrimitive;
struct IMetaAnim : BigDNAVYaml {
Delete expl;
enum class Type { Primitive = 0, Blend = 1, PhaseBlend = 2, Random = 3, Sequence = 4 } m_type;
const char* m_typeStr;
IMetaAnim(Type type, const char* typeStr) : m_type(type), m_typeStr(typeStr) {}
virtual void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) = 0;
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) = 0;
};
struct MetaAnimFactory : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
std::unique_ptr<IMetaAnim> m_anim;
};
struct MetaAnimPrimitive : IMetaAnim {
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimPrimitive() : IMetaAnim(Type::Primitive, "Primitive") {}
struct Transition : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> unk;
Value<atUint32> animIdxA;
Value<atUint32> animIdxB;
MetaTransFactory metaTrans;
};
std::vector<Transition> transitions;
MetaTransFactory defaultTransition;
UniqueID32 animId;
Value<atUint32> animIdx;
String<-1> animName;
Value<float> unk1;
Value<atUint32> unk2;
struct AdditiveAnimationInfo : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> animIdx;
Value<float> unk1;
Value<float> unk2;
};
std::vector<AdditiveAnimationInfo> additiveAnims;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out);
float floatA = 0.0;
float floatB = 0.0;
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) { return func(*this); }
};
struct MetaAnimBlend : IMetaAnim {
MetaAnimBlend() : IMetaAnim(Type::Blend, "Blend") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA;
MetaAnimFactory animB;
Value<float> unkFloat;
Value<atUint8> unk;
struct HalfTransition : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> animIdx;
MetaTransFactory metaTrans;
};
std::vector<HalfTransition> halfTransitions;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {
animA.m_anim->gatherPrimitives(pakRouter, out);
animB.m_anim->gatherPrimitives(pakRouter, out);
}
struct AnimationResources : BigDNA
{
AT_DECL_DNA_YAML
UniqueID32 animId;
UniqueID32 evntId;
};
std::vector<AnimationResources> animResources;
} animationSet;
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {
if (!animA.m_anim->enumeratePrimitives(func))
return false;
if (!animB.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct MetaAnimPhaseBlend : IMetaAnim {
MetaAnimPhaseBlend() : IMetaAnim(Type::PhaseBlend, "PhaseBlend") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory animA;
MetaAnimFactory animB;
Value<float> unkFloat;
Value<atUint8> unk;
void getCharacterResInfo(std::vector<DNAANCS::CharacterResInfo<UniqueID32>>& out) const
{
out.clear();
out.reserve(characterSet.characters.size());
for (const CharacterSet::CharacterInfo& ci : characterSet.characters)
{
out.emplace_back();
DNAANCS::CharacterResInfo<UniqueID32>& chOut = out.back();
chOut.name = ci.name;
chOut.cmdl = ci.cmdl;
chOut.cskr = ci.cskr;
chOut.cinf = ci.cinf;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {
animA.m_anim->gatherPrimitives(pakRouter, out);
animB.m_anim->gatherPrimitives(pakRouter, out);
}
if (ci.cmdlIce)
chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce));
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {
if (!animA.m_anim->enumeratePrimitives(func))
return false;
if (!animB.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct MetaAnimRandom : IMetaAnim {
MetaAnimRandom() : IMetaAnim(Type::Random, "Random") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount;
struct Child : BigDNA {
AT_DECL_DNA
MetaAnimFactory anim;
Value<atUint32> probability;
};
Vector<Child, AT_DNA_COUNT(animCount)> children;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {
for (const auto& child : children)
child.anim.m_anim->gatherPrimitives(pakRouter, out);
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {
for (auto& child : children)
if (!child.anim.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct MetaAnimSequence : IMetaAnim {
MetaAnimSequence() : IMetaAnim(Type::Sequence, "Sequence") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<atUint32> animCount;
Vector<MetaAnimFactory, AT_DNA_COUNT(animCount)> children;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {
for (const auto& child : children)
child.m_anim->gatherPrimitives(pakRouter, out);
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {
for (auto& child : children)
if (!child.m_anim->enumeratePrimitives(func))
return false;
return true;
}
};
struct Animation : BigDNA {
AT_DECL_DNA_YAML
String<-1> name;
MetaAnimFactory metaAnim;
};
std::vector<Animation> animations;
struct IMetaTrans : BigDNAVYaml {
Delete expl;
enum class Type {
MetaAnim = 0,
Trans = 1,
PhaseTrans = 2,
NoTrans = 3,
} m_type;
const char* m_typeStr;
IMetaTrans(Type type, const char* typeStr) : m_type(type), m_typeStr(typeStr) {}
virtual void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {}
virtual bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) { return true; }
};
struct MetaTransFactory : BigDNA {
AT_DECL_DNA_YAML
Delete expl;
std::unique_ptr<IMetaTrans> m_trans;
};
struct MetaTransMetaAnim : IMetaTrans {
MetaTransMetaAnim() : IMetaTrans(Type::MetaAnim, "MetaAnim") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
MetaAnimFactory anim;
void gatherPrimitives(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) {
anim.m_anim->gatherPrimitives(pakRouter, out);
}
bool enumeratePrimitives(const std::function<bool(MetaAnimPrimitive& prim)>& func) {
return anim.m_anim->enumeratePrimitives(func);
}
};
struct MetaTransTrans : IMetaTrans {
MetaTransTrans() : IMetaTrans(Type::Trans, "Trans") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime;
Value<atUint32> transDurTimeMode;
Value<bool> unk2;
Value<bool> runA;
Value<atUint32> flags;
};
struct MetaTransPhaseTrans : IMetaTrans {
MetaTransPhaseTrans() : IMetaTrans(Type::PhaseTrans, "PhaseTrans") {}
AT_DECL_DNA_YAML
AT_DECL_DNAV
Value<float> transDurTime;
Value<atUint32> transDurTimeMode;
Value<bool> unk2;
Value<bool> runA;
Value<atUint32> flags;
};
struct Transition : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> unk;
Value<atUint32> animIdxA;
Value<atUint32> animIdxB;
MetaTransFactory metaTrans;
};
std::vector<Transition> transitions;
MetaTransFactory defaultTransition;
struct AdditiveAnimationInfo : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> animIdx;
Value<float> unk1;
Value<float> unk2;
};
std::vector<AdditiveAnimationInfo> additiveAnims;
float floatA = 0.0;
float floatB = 0.0;
struct HalfTransition : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> animIdx;
MetaTransFactory metaTrans;
};
std::vector<HalfTransition> halfTransitions;
struct AnimationResources : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 animId;
UniqueID32 evntId;
};
std::vector<AnimationResources> animResources;
} animationSet;
void getCharacterResInfo(std::vector<DNAANCS::CharacterResInfo<UniqueID32>>& out) const {
out.clear();
out.reserve(characterSet.characters.size());
for (const CharacterSet::CharacterInfo& ci : characterSet.characters) {
out.emplace_back();
DNAANCS::CharacterResInfo<UniqueID32>& chOut = out.back();
chOut.name = ci.name;
chOut.cmdl = ci.cmdl;
chOut.cskr = ci.cskr;
chOut.cinf = ci.cinf;
if (ci.cmdlIce)
chOut.overlays.emplace_back("ICE", std::make_pair(ci.cmdlIce, ci.cskrIce));
}
}
void getAnimationResInfo(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) const
{
out.clear();
for (const AnimationSet::Animation& ai : animationSet.animations)
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->gatherPrimitives(pakRouter, out);
for (const AnimationSet::Transition& ti : animationSet.transitions)
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->gatherPrimitives(pakRouter, out);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->gatherPrimitives(pakRouter, out);
}
void getAnimationResInfo(PAKRouter<PAKBridge>* pakRouter,
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>>& out) const {
out.clear();
for (const AnimationSet::Animation& ai : animationSet.animations)
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->gatherPrimitives(pakRouter, out);
for (const AnimationSet::Transition& ti : animationSet.transitions)
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->gatherPrimitives(pakRouter, out);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->gatherPrimitives(pakRouter, out);
}
void enumeratePrimitives(const std::function<bool(AnimationSet::MetaAnimPrimitive& prim)>& func)
{
for (const AnimationSet::Animation& ai : animationSet.animations)
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->enumeratePrimitives(func);
for (const AnimationSet::Transition& ti : animationSet.transitions)
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->enumeratePrimitives(func);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->enumeratePrimitives(func);
}
void enumeratePrimitives(const std::function<bool(AnimationSet::MetaAnimPrimitive& prim)>& func) {
for (const AnimationSet::Animation& ai : animationSet.animations)
if (AnimationSet::IMetaAnim* anim = ai.metaAnim.m_anim.get())
anim->enumeratePrimitives(func);
for (const AnimationSet::Transition& ti : animationSet.transitions)
if (AnimationSet::IMetaTrans* trans = ti.metaTrans.m_trans.get())
trans->enumeratePrimitives(func);
if (AnimationSet::IMetaTrans* trans = animationSet.defaultTransition.m_trans.get())
trans->enumeratePrimitives(func);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, int charIdx) const
{
auto doCi = [&](const CharacterSet::CharacterInfo& ci)
{
for (const auto& id : ci.partResData.part)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.swhc)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.unk)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.elsc)
g_curSpec->flattenDependencies(id, pathsOut);
};
if (charIdx < 0)
for (const CharacterSet::CharacterInfo& ci : characterSet.characters)
doCi(ci);
else if (charIdx < characterSet.characters.size())
doCi(characterSet.characters[charIdx]);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, int charIdx) const {
auto doCi = [&](const CharacterSet::CharacterInfo& ci) {
for (const auto& id : ci.partResData.part)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.swhc)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.unk)
g_curSpec->flattenDependencies(id, pathsOut);
for (const auto& id : ci.partResData.elsc)
g_curSpec->flattenDependencies(id, pathsOut);
};
if (charIdx < 0)
for (const CharacterSet::CharacterInfo& ci : characterSet.characters)
doCi(ci);
else if (charIdx < characterSet.characters.size())
doCi(characterSet.characters[charIdx]);
}
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor);
static bool Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor);
static bool CookCINF(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor);
static bool CookCINF(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor);
static bool CookCSKR(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor,
static bool CookCSKR(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor,
const std::function<bool(const hecl::ProjectPath& modelPath)>& modelCookFunc);
static bool CookCSKRPC(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor,
const std::function<bool(const hecl::ProjectPath& modelPath)>& modelCookFunc);
static bool CookCSKRPC(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor,
const std::function<bool(const hecl::ProjectPath& modelPath)>& modelCookFunc);
static bool CookANIM(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNAANCS::Actor& actor,
hecl::blender::DataStream& ds,
bool pc);
static bool CookANIM(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNAANCS::Actor& actor,
hecl::blender::DataStream& ds, bool pc);
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -7,240 +7,211 @@
#include "EVNT.hpp"
#include "DataSpec/DNACommon/ANCS.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct ANIM : BigDNA
{
struct ANIM : BigDNA {
AT_DECL_EXPLICIT_DNA
static UniqueID32 GetEVNTId(athena::io::IStreamReader& r);
struct IANIM : BigDNAV {
Delete expl;
atUint32 m_version;
IANIM(atUint32 version) : m_version(version) {}
std::vector<std::pair<atUint32, bool>> bones;
std::vector<atUint32> frames;
std::vector<DNAANIM::Channel> channels;
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
UniqueID32Zero evnt;
bool looping = false;
void sendANIMToBlender(hecl::blender::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig) const;
};
struct ANIM0 : IANIM {
AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM0() : IANIM(0) {}
static UniqueID32 GetEVNTId(athena::io::IStreamReader& r);
struct Header : BigDNA {
AT_DECL_DNA
Value<float> duration;
Value<atUint32> unk0;
Value<float> interval;
Value<atUint32> unk1;
Value<atUint32> keyCount;
Value<atUint32> unk2;
Value<atUint32> boneSlotCount;
};
};
struct IANIM : BigDNAV
{
Delete expl;
atUint32 m_version;
IANIM(atUint32 version) : m_version(version) {}
struct ANIM2 : IANIM {
AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM2(bool pc) : IANIM(pc ? 3 : 2) {}
std::vector<std::pair<atUint32, bool>> bones;
std::vector<atUint32> frames;
std::vector<DNAANIM::Channel> channels;
std::vector<std::vector<DNAANIM::Value>> chanKeys;
float mainInterval = 0.0;
UniqueID32Zero evnt;
bool looping = false;
void sendANIMToBlender(hecl::blender::PyOutStream&, const DNAANIM::RigInverter<CINF>& rig) const;
struct Header : BigDNA {
AT_DECL_DNA
Value<atUint32> scratchSize;
UniqueID32Zero evnt;
Value<atUint32> unk0 = 1;
Value<float> duration;
Value<float> interval;
Value<atUint32> rootBoneId = 3;
Value<atUint32> looping = 0;
Value<atUint32> rotDiv;
Value<float> translationMult;
Value<atUint32> boneChannelCount;
Value<atUint32> unk3;
Value<atUint32> keyBitmapBitCount;
};
struct ANIM0 : IANIM
{
AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM0() : IANIM(0) {}
struct ChannelDesc : BigDNA {
Delete expl;
Value<atUint32> id = 0;
Value<atUint16> keyCount1 = 0;
Value<atInt16> initRX = 0;
Value<atUint8> qRX = 0;
Value<atInt16> initRY = 0;
Value<atUint8> qRY = 0;
Value<atInt16> initRZ = 0;
Value<atUint8> qRZ = 0;
Value<atUint16> keyCount2 = 0;
Value<atInt16> initTX = 0;
Value<atUint8> qTX = 0;
Value<atInt16> initTY = 0;
Value<atUint8> qTY = 0;
Value<atInt16> initTZ = 0;
Value<atUint8> qTZ = 0;
struct Header : BigDNA
{
AT_DECL_DNA
Value<float> duration;
Value<atUint32> unk0;
Value<float> interval;
Value<atUint32> unk1;
Value<atUint32> keyCount;
Value<atUint32> unk2;
Value<atUint32> boneSlotCount;
};
};
struct ANIM2 : IANIM
{
AT_DECL_EXPLICIT_DNA
AT_DECL_DNAV
ANIM2(bool pc) : IANIM(pc ? 3 : 2) {}
struct Header : BigDNA
{
AT_DECL_DNA
Value<atUint32> scratchSize;
UniqueID32Zero evnt;
Value<atUint32> unk0 = 1;
Value<float> duration;
Value<float> interval;
Value<atUint32> rootBoneId = 3;
Value<atUint32> looping = 0;
Value<atUint32> rotDiv;
Value<float> translationMult;
Value<atUint32> boneChannelCount;
Value<atUint32> unk3;
Value<atUint32> keyBitmapBitCount;
};
struct ChannelDesc : BigDNA
{
Delete expl;
Value<atUint32> id = 0;
Value<atUint16> keyCount1 = 0;
Value<atInt16> initRX = 0;
Value<atUint8> qRX = 0;
Value<atInt16> initRY = 0;
Value<atUint8> qRY = 0;
Value<atInt16> initRZ = 0;
Value<atUint8> qRZ = 0;
Value<atUint16> keyCount2 = 0;
Value<atInt16> initTX = 0;
Value<atUint8> qTX = 0;
Value<atInt16> initTY = 0;
Value<atUint8> qTY = 0;
Value<atInt16> initTZ = 0;
Value<atUint8> qTZ = 0;
void read(athena::io::IStreamReader& reader)
{
id = reader.readUint32Big();
keyCount1 = reader.readUint16Big();
initRX = reader.readInt16Big();
qRX = reader.readUByte();
initRY = reader.readInt16Big();
qRY = reader.readUByte();
initRZ = reader.readInt16Big();
qRZ = reader.readUByte();
keyCount2 = reader.readUint16Big();
if (keyCount2)
{
initTX = reader.readInt16Big();
qTX = reader.readUByte();
initTY = reader.readInt16Big();
qTY = reader.readUByte();
initTZ = reader.readInt16Big();
qTZ = reader.readUByte();
}
}
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(id);
writer.writeUint16Big(keyCount1);
writer.writeInt16Big(initRX);
writer.writeUByte(qRX);
writer.writeInt16Big(initRY);
writer.writeUByte(qRY);
writer.writeInt16Big(initRZ);
writer.writeUByte(qRZ);
writer.writeUint16Big(keyCount2);
if (keyCount2)
{
writer.writeInt16Big(initTX);
writer.writeUByte(qTX);
writer.writeInt16Big(initTY);
writer.writeUByte(qTY);
writer.writeInt16Big(initTZ);
writer.writeUByte(qTZ);
}
}
void binarySize(size_t& __isz) const
{
__isz += 17;
if (keyCount2)
__isz += 9;
}
};
struct ChannelDescPC : BigDNA
{
Delete expl;
Value<atUint32> id = 0;
Value<atUint32> keyCount1 = 0;
Value<atUint32> QinitRX = 0;
Value<atUint32> QinitRY = 0;
Value<atUint32> QinitRZ = 0;
Value<atUint32> keyCount2 = 0;
Value<atUint32> QinitTX = 0;
Value<atUint32> QinitTY = 0;
Value<atUint32> QinitTZ = 0;
void read(athena::io::IStreamReader& reader)
{
id = reader.readUint32Big();
keyCount1 = reader.readUint32Big();
QinitRX = reader.readUint32Big();
QinitRY = reader.readUint32Big();
QinitRZ = reader.readUint32Big();
keyCount2 = reader.readUint32Big();
if (keyCount2)
{
QinitTX = reader.readUint32Big();
QinitTY = reader.readUint32Big();
QinitTZ = reader.readUint32Big();
}
}
void write(athena::io::IStreamWriter& writer) const
{
writer.writeUint32Big(id);
writer.writeUint32Big(keyCount1);
writer.writeUint32Big(QinitRX);
writer.writeUint32Big(QinitRY);
writer.writeUint32Big(QinitRZ);
writer.writeUint32Big(keyCount2);
if (keyCount2)
{
writer.writeUint32Big(QinitTX);
writer.writeUint32Big(QinitTY);
writer.writeUint32Big(QinitTZ);
}
}
void binarySize(size_t& __isz) const
{
__isz += 24;
if (keyCount2)
__isz += 12;
}
};
};
std::unique_ptr<IANIM> m_anim;
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const
{
m_anim->sendANIMToBlender(os, rig);
}
bool isLooping() const
{
if (!m_anim)
return false;
return m_anim->looping;
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID32>& animInfo,
const hecl::ProjectPath& outPath, PAKRouter<PAKBridge>& pakRouter, bool force) const
{
if (m_anim->evnt)
{
hecl::SystemStringConv sysStr(animInfo.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension((hecl::SystemString(_SYS_STR(".")) +
sysStr.c_str() +
_SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None)
{
EVNT evnt;
if (pakRouter.lookupAndReadDNA(m_anim->evnt, evnt, true))
{
athena::io::FileWriter writer(evntYamlPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
}
}
void read(athena::io::IStreamReader& reader) {
id = reader.readUint32Big();
keyCount1 = reader.readUint16Big();
initRX = reader.readInt16Big();
qRX = reader.readUByte();
initRY = reader.readInt16Big();
qRY = reader.readUByte();
initRZ = reader.readInt16Big();
qRZ = reader.readUByte();
keyCount2 = reader.readUint16Big();
if (keyCount2) {
initTX = reader.readInt16Big();
qTX = reader.readUByte();
initTY = reader.readInt16Big();
qTY = reader.readUByte();
initTZ = reader.readInt16Big();
qTZ = reader.readUByte();
}
}
void write(athena::io::IStreamWriter& writer) const {
writer.writeUint32Big(id);
writer.writeUint16Big(keyCount1);
writer.writeInt16Big(initRX);
writer.writeUByte(qRX);
writer.writeInt16Big(initRY);
writer.writeUByte(qRY);
writer.writeInt16Big(initRZ);
writer.writeUByte(qRZ);
writer.writeUint16Big(keyCount2);
if (keyCount2) {
writer.writeInt16Big(initTX);
writer.writeUByte(qTX);
writer.writeInt16Big(initTY);
writer.writeUByte(qTY);
writer.writeInt16Big(initTZ);
writer.writeUByte(qTZ);
}
}
void binarySize(size_t& __isz) const {
__isz += 17;
if (keyCount2)
__isz += 9;
}
};
struct ChannelDescPC : BigDNA {
Delete expl;
Value<atUint32> id = 0;
Value<atUint32> keyCount1 = 0;
Value<atUint32> QinitRX = 0;
Value<atUint32> QinitRY = 0;
Value<atUint32> QinitRZ = 0;
Value<atUint32> keyCount2 = 0;
Value<atUint32> QinitTX = 0;
Value<atUint32> QinitTY = 0;
Value<atUint32> QinitTZ = 0;
void read(athena::io::IStreamReader& reader) {
id = reader.readUint32Big();
keyCount1 = reader.readUint32Big();
QinitRX = reader.readUint32Big();
QinitRY = reader.readUint32Big();
QinitRZ = reader.readUint32Big();
keyCount2 = reader.readUint32Big();
if (keyCount2) {
QinitTX = reader.readUint32Big();
QinitTY = reader.readUint32Big();
QinitTZ = reader.readUint32Big();
}
}
void write(athena::io::IStreamWriter& writer) const {
writer.writeUint32Big(id);
writer.writeUint32Big(keyCount1);
writer.writeUint32Big(QinitRX);
writer.writeUint32Big(QinitRY);
writer.writeUint32Big(QinitRZ);
writer.writeUint32Big(keyCount2);
if (keyCount2) {
writer.writeUint32Big(QinitTX);
writer.writeUint32Big(QinitTY);
writer.writeUint32Big(QinitTZ);
}
}
void binarySize(size_t& __isz) const {
__isz += 24;
if (keyCount2)
__isz += 12;
}
};
};
std::unique_ptr<IANIM> m_anim;
void sendANIMToBlender(hecl::blender::PyOutStream& os, const DNAANIM::RigInverter<CINF>& rig, bool) const {
m_anim->sendANIMToBlender(os, rig);
}
bool isLooping() const {
if (!m_anim)
return false;
return m_anim->looping;
}
void extractEVNT(const DNAANCS::AnimationResInfo<UniqueID32>& animInfo, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, bool force) const {
if (m_anim->evnt) {
hecl::SystemStringConv sysStr(animInfo.name);
hecl::ProjectPath evntYamlPath = outPath.getWithExtension(
(hecl::SystemString(_SYS_STR(".")) + sysStr.c_str() + _SYS_STR(".evnt.yaml")).c_str(), true);
hecl::ProjectPath::Type evntYamlType = evntYamlPath.getPathType();
if (force || evntYamlType == hecl::ProjectPath::Type::None) {
EVNT evnt;
if (pakRouter.lookupAndReadDNA(m_anim->evnt, evnt, true)) {
athena::io::FileWriter writer(evntYamlPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
}
}
}
}
using BlenderAction = hecl::blender::Action;
using BlenderAction = hecl::blender::Action;
ANIM() = default;
ANIM(const BlenderAction& act,
const std::unordered_map<std::string, atInt32>& idMap,
const DNAANIM::RigInverter<CINF>& rig,
bool pc);
ANIM() = default;
ANIM(const BlenderAction& act, const std::unordered_map<std::string, atInt32>& idMap,
const DNAANIM::RigInverter<CINF>& rig, bool pc);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,184 +1,160 @@
#include "CINF.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
atUint32 CINF::getInternalBoneIdxFromId(atUint32 id) const
{
atUint32 idx = 0;
for (const Bone& b : bones)
{
if (b.id == id)
return idx;
++idx;
atUint32 CINF::getInternalBoneIdxFromId(atUint32 id) const {
atUint32 idx = 0;
for (const Bone& b : bones) {
if (b.id == id)
return idx;
++idx;
}
return -1;
}
atUint32 CINF::getBoneIdxFromId(atUint32 id) const {
atUint32 idx = 0;
for (atUint32 bid : boneIds) {
if (bid == id)
return idx;
++idx;
}
return 0;
}
const std::string* CINF::getBoneNameFromId(atUint32 id) const {
for (const Name& name : names)
if (id == name.boneId)
return &name.name;
return nullptr;
}
void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const {
for (atUint32 bid : boneIds) {
for (const Name& name : names) {
if (name.boneId == bid) {
os.format("obj.vertex_groups.new('%s')\n", name.name.c_str());
break;
}
}
return -1;
}
}
atUint32 CINF::getBoneIdxFromId(atUint32 id) const
{
atUint32 idx = 0;
for (atUint32 bid : boneIds)
{
if (bid == id)
return idx;
++idx;
}
return 0;
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const {
DNAANIM::RigInverter<CINF> inverter(*this);
os.format(
"arm = bpy.data.armatures.new('CINF_%08X')\n"
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
"bpy.context.scene.objects.link(arm_obj)\n"
"bpy.context.scene.objects.active = arm_obj\n"
"bpy.ops.object.mode_set(mode='EDIT')\n"
"arm_bone_table = {}\n",
cinfId.toUint32());
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones()) {
zeus::simd_floats originF(bone.m_origBone.origin.simd);
zeus::simd_floats tailF(bone.m_tail.mSimd);
os.format(
"bone = arm.edit_bones.new('%s')\n"
"bone.head = (%f,%f,%f)\n"
"bone.tail = (%f,%f,%f)\n"
"bone.use_inherit_scale = False\n"
"arm_bone_table[%u] = bone\n",
getBoneNameFromId(bone.m_origBone.id)->c_str(), originF[0], originF[1], originF[2], tailF[0], tailF[1],
tailF[2], bone.m_origBone.id);
}
for (const Bone& bone : bones)
if (bone.parentId != 2)
os.format("arm_bone_table[%u].parent = arm_bone_table[%u]\n", bone.id, bone.parentId);
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
const char* rotMode = os.getConnection().hasSLERP() ? "QUATERNION_SLERP" : "QUATERNION";
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
os.format("arm_obj.pose.bones['%s'].rotation_mode = '%s'\n", getBoneNameFromId(bone.m_origBone.id)->c_str(),
rotMode);
}
const std::string* CINF::getBoneNameFromId(atUint32 id) const
{
for (const Name& name : names)
if (id == name.boneId)
return &name.name;
return nullptr;
}
void CINF::sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const
{
for (atUint32 bid : boneIds)
{
for (const Name& name : names)
{
if (name.boneId == bid)
{
os.format("obj.vertex_groups.new('%s')\n", name.name.c_str());
break;
}
}
}
}
void CINF::sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const
{
DNAANIM::RigInverter<CINF> inverter(*this);
os.format("arm = bpy.data.armatures.new('CINF_%08X')\n"
"arm_obj = bpy.data.objects.new(arm.name, arm)\n"
"bpy.context.scene.objects.link(arm_obj)\n"
"bpy.context.scene.objects.active = arm_obj\n"
"bpy.ops.object.mode_set(mode='EDIT')\n"
"arm_bone_table = {}\n",
cinfId.toUint32());
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
{
zeus::simd_floats originF(bone.m_origBone.origin.simd);
zeus::simd_floats tailF(bone.m_tail.mSimd);
os.format("bone = arm.edit_bones.new('%s')\n"
"bone.head = (%f,%f,%f)\n"
"bone.tail = (%f,%f,%f)\n"
"bone.use_inherit_scale = False\n"
"arm_bone_table[%u] = bone\n",
getBoneNameFromId(bone.m_origBone.id)->c_str(),
originF[0], originF[1], originF[2],
tailF[0], tailF[1], tailF[2],
bone.m_origBone.id);
}
for (const Bone& bone : bones)
if (bone.parentId != 2)
os.format("arm_bone_table[%u].parent = arm_bone_table[%u]\n", bone.id, bone.parentId);
os << "bpy.ops.object.mode_set(mode='OBJECT')\n";
const char* rotMode = os.getConnection().hasSLERP() ? "QUATERNION_SLERP" : "QUATERNION";
for (const DNAANIM::RigInverter<CINF>::Bone& bone : inverter.getBones())
os.format("arm_obj.pose.bones['%s'].rotation_mode = '%s'\n",
getBoneNameFromId(bone.m_origBone.id)->c_str(), rotMode);
}
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId)
{
return hecl::Format("CINF_%08X", cinfId.toUint32());
}
std::string CINF::GetCINFArmatureName(const UniqueID32& cinfId) { return hecl::Format("CINF_%08X", cinfId.toUint32()); }
int CINF::RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap)
{
int selId;
auto search = idMap.find(bone->name);
if (search == idMap.end())
{
selId = curId++;
idMap.emplace(std::make_pair(bone->name, selId));
std::unordered_map<std::string, atInt32>& idMap,
std::map<std::string, int>& nameMap) {
int selId;
auto search = idMap.find(bone->name);
if (search == idMap.end()) {
selId = curId++;
idMap.emplace(std::make_pair(bone->name, selId));
} else
selId = search->second;
bones.emplace_back();
Bone& boneOut = bones.back();
nameMap[bone->name] = selId;
boneOut.id = selId;
boneOut.parentId = parent;
boneOut.origin = bone->origin;
boneOut.linkedCount = bone->children.size() + 1;
boneOut.linked.reserve(boneOut.linkedCount);
const BlenderBone* child;
boneOut.linked.push_back(parent);
for (size_t i = 0; (child = armature.getChild(bone, i)); ++i)
boneOut.linked.push_back(RecursiveAddArmatureBone(armature, child, boneOut.id, curId, idMap, nameMap));
return boneOut.id;
}
CINF::CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap) {
idMap.reserve(armature.bones.size());
bones.reserve(armature.bones.size());
std::map<std::string, int> nameMap;
const BlenderBone* bone = armature.getRoot();
if (bone) {
if (bone->children.size()) {
int curId = 4;
const BlenderBone* child;
for (size_t i = 0; (child = armature.getChild(bone, i)); ++i)
RecursiveAddArmatureBone(armature, child, 3, curId, idMap, nameMap);
}
else
selId = search->second;
bones.emplace_back();
Bone& boneOut = bones.back();
nameMap[bone->name] = selId;
boneOut.id = selId;
boneOut.parentId = parent;
nameMap[bone->name] = 3;
boneOut.id = 3;
boneOut.parentId = 2;
boneOut.origin = bone->origin;
boneOut.linkedCount = bone->children.size() + 1;
boneOut.linked.reserve(boneOut.linkedCount);
idMap.emplace(std::make_pair(bone->name, 3));
const BlenderBone* child;
boneOut.linked.push_back(parent);
for (size_t i=0 ; (child = armature.getChild(bone, i)) ; ++i)
boneOut.linked.push_back(RecursiveAddArmatureBone(armature, child, boneOut.id, curId, idMap, nameMap));
return boneOut.id;
}
CINF::CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap)
{
idMap.reserve(armature.bones.size());
bones.reserve(armature.bones.size());
std::map<std::string, int> nameMap;
const BlenderBone* bone = armature.getRoot();
if (bone)
{
if (bone->children.size())
{
int curId = 4;
const BlenderBone* child;
for (size_t i=0 ; (child = armature.getChild(bone, i)) ; ++i)
RecursiveAddArmatureBone(armature, child, 3, curId, idMap, nameMap);
}
bones.emplace_back();
Bone& boneOut = bones.back();
nameMap[bone->name] = 3;
boneOut.id = 3;
boneOut.parentId = 2;
boneOut.origin = bone->origin;
idMap.emplace(std::make_pair(bone->name, 3));
if (bone->children.size())
{
boneOut.linkedCount = 2;
boneOut.linked = {2, 4};
}
else
{
boneOut.linkedCount = 1;
boneOut.linked = {2};
}
if (bone->children.size()) {
boneOut.linkedCount = 2;
boneOut.linked = {2, 4};
} else {
boneOut.linkedCount = 1;
boneOut.linked = {2};
}
}
boneCount = bones.size();
boneCount = bones.size();
names.reserve(nameMap.size());
nameCount = nameMap.size();
for (const auto& name : nameMap)
{
names.emplace_back();
Name& nameOut = names.back();
nameOut.name = name.first;
nameOut.boneId = name.second;
}
names.reserve(nameMap.size());
nameCount = nameMap.size();
for (const auto& name : nameMap) {
names.emplace_back();
Name& nameOut = names.back();
nameOut.name = name.first;
nameOut.boneId = name.second;
}
boneIdCount = boneCount;
boneIds.reserve(boneIdCount);
for (auto it=bones.crbegin() ; it != bones.crend() ; ++it)
boneIds.push_back(it->id);
boneIdCount = boneCount;
boneIds.reserve(boneIdCount);
for (auto it = bones.crbegin(); it != bones.crend(); ++it)
boneIds.push_back(it->id);
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,52 +3,47 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/RigInverter.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct CINF : BigDNA
{
struct CINF : BigDNA {
AT_DECL_DNA
Value<atUint32> boneCount;
struct Bone : BigDNA {
AT_DECL_DNA
Value<atUint32> boneCount;
struct Bone : BigDNA
{
AT_DECL_DNA
Value<atUint32> id;
Value<atUint32> parentId;
Value<atVec3f> origin;
Value<atUint32> linkedCount;
Vector<atUint32, AT_DNA_COUNT(linkedCount)> linked;
};
Vector<Bone, AT_DNA_COUNT(boneCount)> bones;
Value<atUint32> id;
Value<atUint32> parentId;
Value<atVec3f> origin;
Value<atUint32> linkedCount;
Vector<atUint32, AT_DNA_COUNT(linkedCount)> linked;
};
Vector<Bone, AT_DNA_COUNT(boneCount)> bones;
Value<atUint32> boneIdCount;
Vector<atUint32, AT_DNA_COUNT(boneIdCount)> boneIds;
Value<atUint32> boneIdCount;
Vector<atUint32, AT_DNA_COUNT(boneIdCount)> boneIds;
Value<atUint32> nameCount;
struct Name : BigDNA
{
AT_DECL_DNA
String<-1> name;
Value<atUint32> boneId;
};
Vector<Name, AT_DNA_COUNT(nameCount)> names;
Value<atUint32> nameCount;
struct Name : BigDNA {
AT_DECL_DNA
String<-1> name;
Value<atUint32> boneId;
};
Vector<Name, AT_DNA_COUNT(nameCount)> names;
atUint32 getInternalBoneIdxFromId(atUint32 id) const;
atUint32 getBoneIdxFromId(atUint32 id) const;
const std::string* getBoneNameFromId(atUint32 id) const;
void sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const;
void sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const;
static std::string GetCINFArmatureName(const UniqueID32& cinfId);
atUint32 getInternalBoneIdxFromId(atUint32 id) const;
atUint32 getBoneIdxFromId(atUint32 id) const;
const std::string* getBoneNameFromId(atUint32 id) const;
void sendVertexGroupsToBlender(hecl::blender::PyOutStream& os) const;
void sendCINFToBlender(hecl::blender::PyOutStream& os, const UniqueID32& cinfId) const;
static std::string GetCINFArmatureName(const UniqueID32& cinfId);
CINF() = default;
using Armature = hecl::blender::Armature;
using BlenderBone = hecl::blender::Bone;
CINF() = default;
using Armature = hecl::blender::Armature;
using BlenderBone = hecl::blender::Bone;
int RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap);
int RecursiveAddArmatureBone(const Armature& armature, const BlenderBone* bone, int parent, int& curId,
std::unordered_map<std::string, atInt32>& idMap, std::map<std::string, int>& nameMap);
CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap);
CINF(const Armature& armature, std::unordered_map<std::string, atInt32>& idMap);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,38 +1,30 @@
#include "CMDL.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
bool CMDL::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
/* Check for RigPair */
const typename CharacterAssociations<UniqueID32>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
CINF cinf;
CSKR cskr;
std::pair<CSKR*,CINF*> loadRp(nullptr, nullptr);
if (rp)
{
pakRouter.lookupAndReadDNA(rp->first, cskr);
pakRouter.lookupAndReadDNA(rp->second, cinf);
loadRp.first = &cskr;
loadRp.second = &cinf;
}
bool CMDL::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) {
/* Check for RigPair */
const typename CharacterAssociations<UniqueID32>::RigPair* rp = pakRouter.lookupCMDLRigPair(entry.id);
CINF cinf;
CSKR cskr;
std::pair<CSKR*, CINF*> loadRp(nullptr, nullptr);
if (rp) {
pakRouter.lookupAndReadDNA(rp->first, cskr);
pakRouter.lookupAndReadDNA(rp->second, cinf);
loadRp.first = &cskr;
loadRp.second = &cinf;
}
/* Do extract */
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*,CINF*>, DNACMDL::SurfaceHeader_1, 2>
(conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend();
/* Do extract */
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::Mesh))
return false;
DNACMDL::ReadCMDLToBlender<PAKRouter<PAKBridge>, MaterialSet, std::pair<CSKR*, CINF*>, DNACMDL::SurfaceHeader_1, 2>(
conn, rs, pakRouter, entry, dataSpec, loadRp);
conn.saveBlend();
#if 0
/* Cook and re-extract test */
@@ -50,98 +42,82 @@ bool CMDL::Extract(const SpecBase& dataSpec,
(conn, reader, pakRouter, entry, dataSpec, loadRp);
return conn.saveBlend();
#elif 0
/* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
/* HMDL cook test */
hecl::ProjectPath tempOut = outPath.getWithExtension(_SYS_STR(".recook"), true);
hecl::blender::Connection::DataStream ds = conn.beginData();
DNACMDL::Mesh mesh = ds.compileMesh(hecl::HMDLTopology::TriStrips, 16);
ds.close();
DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_1, 2>(tempOut, outPath, mesh);
#endif
return true;
return true;
}
bool CMDL::Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
if (!mesh.skins.empty())
{
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, skinMesh))
return false;
bool CMDL::Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNACMDL::Mesh& mesh) {
if (!mesh.skins.empty()) {
DNACMDL::Mesh skinMesh = mesh.getContiguousSkinningVersion();
if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, skinMesh))
return false;
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName);
/* Output skinning intermediate */
auto vertCountIt = skinMesh.contiguousSkinVertCounts.cbegin();
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(skinMesh.boneNames.size());
for (const std::string& boneName : skinMesh.boneNames)
writer.writeString(boneName);
writer.writeUint32Big(skinMesh.skins.size());
for (const std::vector<DNACMDL::Mesh::SkinBind> skin : skinMesh.skins)
{
writer.writeUint32Big(skin.size());
for (const DNACMDL::Mesh::SkinBind& bind : skin)
{
writer.writeUint32Big(bind.boneIdx);
writer.writeFloatBig(bind.weight);
}
writer.writeUint32Big(*vertCountIt++);
}
writer.writeUint32Big(skinMesh.pos.size());
writer.writeUint32Big(skinMesh.norm.size());
writer.writeUint32Big(skinMesh.skins.size());
for (const std::vector<DNACMDL::Mesh::SkinBind> skin : skinMesh.skins) {
writer.writeUint32Big(skin.size());
for (const DNACMDL::Mesh::SkinBind& bind : skin) {
writer.writeUint32Big(bind.boneIdx);
writer.writeFloatBig(bind.weight);
}
writer.writeUint32Big(*vertCountIt++);
}
else if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, mesh))
return false;
return true;
writer.writeUint32Big(skinMesh.pos.size());
writer.writeUint32Big(skinMesh.norm.size());
} else if (!DNACMDL::WriteCMDL<MaterialSet, DNACMDL::SurfaceHeader_1, 2>(outPath, inPath, mesh))
return false;
return true;
}
bool CMDL::HMDLCook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh)
{
hecl::blender::PoolSkinIndex poolSkinIndex;
if (mesh.skins.size())
{
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
bool CMDL::HMDLCook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNACMDL::Mesh& mesh) {
hecl::blender::PoolSkinIndex poolSkinIndex;
if (mesh.skins.size()) {
if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(outPath, inPath, mesh, poolSkinIndex))
return false;
/* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks)
{
writer.writeUint32Big(sb.m_boneIdxs.size());
for (uint32_t bind : sb.m_boneIdxs)
writer.writeUint32Big(bind);
}
writer.writeUint32Big(mesh.boneNames.size());
for (const std::string& boneName : mesh.boneNames)
writer.writeString(boneName);
/* CVirtualBone structure just like original (for CPU skinning) */
writer.writeUint32Big(mesh.skins.size());
for (auto& s : mesh.skins)
{
writer.writeUint32Big(s.size());
for (auto& b : s)
{
writer.writeUint32Big(b.boneIdx);
writer.writeFloatBig(b.weight);
}
}
/* Write indirection table mapping pool verts to CVirtualBones */
writer.writeUint32Big(poolSkinIndex.m_poolSz);
for (uint32_t i=0 ; i<poolSkinIndex.m_poolSz ; ++i)
writer.writeUint32Big(poolSkinIndex.m_poolToSkinIndex[i]);
/* Output skinning intermediate */
athena::io::FileWriter writer(outPath.getWithExtension(_SYS_STR(".skinint")).getAbsolutePath());
writer.writeUint32Big(mesh.skinBanks.banks.size());
for (const DNACMDL::Mesh::SkinBanks::Bank& sb : mesh.skinBanks.banks) {
writer.writeUint32Big(sb.m_boneIdxs.size());
for (uint32_t bind : sb.m_boneIdxs)
writer.writeUint32Big(bind);
}
else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(
outPath, inPath, mesh, poolSkinIndex))
return false;
return true;
writer.writeUint32Big(mesh.boneNames.size());
for (const std::string& boneName : mesh.boneNames)
writer.writeString(boneName);
/* CVirtualBone structure just like original (for CPU skinning) */
writer.writeUint32Big(mesh.skins.size());
for (auto& s : mesh.skins) {
writer.writeUint32Big(s.size());
for (auto& b : s) {
writer.writeUint32Big(b.boneIdx);
writer.writeFloatBig(b.weight);
}
}
/* Write indirection table mapping pool verts to CVirtualBones */
writer.writeUint32Big(poolSkinIndex.m_poolSz);
for (uint32_t i = 0; i < poolSkinIndex.m_poolSz; ++i)
writer.writeUint32Big(poolSkinIndex.m_poolToSkinIndex[i]);
} else if (!DNACMDL::WriteHMDLCMDL<HMDLMaterialSet, DNACMDL::SurfaceHeader_2, 2>(outPath, inPath, mesh,
poolSkinIndex))
return false;
return true;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -9,36 +9,21 @@
#include <athena/FileReader.hpp>
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct CMDL
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
struct CMDL {
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry)
{
DNACMDL::NameCMDL<PAKRouter<PAKBridge>, MaterialSet>(rs, pakRouter, entry, dataSpec);
}
static void Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry) {
DNACMDL::NameCMDL<PAKRouter<PAKBridge>, MaterialSet>(rs, pakRouter, entry, dataSpec);
}
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh);
static bool Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNACMDL::Mesh& mesh);
static bool HMDLCook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const DNACMDL::Mesh& mesh);
static bool HMDLCook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const DNACMDL::Mesh& mesh);
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -5,411 +5,551 @@
#include "DataSpec/DNACommon/CMDL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct MaterialSet : BigDNA
{
static constexpr bool OneSection() {return false;}
struct MaterialSet : BigDNA {
static constexpr bool OneSection() { return false; }
AT_DECL_DNA
struct MaterialSetHead : BigDNA {
AT_DECL_DNA
struct MaterialSetHead : BigDNA
{
AT_DECL_DNA
Value<atUint32> textureCount = 0;
Vector<UniqueID32, AT_DNA_COUNT(textureCount)> textureIDs;
Value<atUint32> materialCount = 0;
Vector<atUint32, AT_DNA_COUNT(materialCount)> materialEndOffs;
Value<atUint32> textureCount = 0;
Vector<UniqueID32, AT_DNA_COUNT(textureCount)> textureIDs;
Value<atUint32> materialCount = 0;
Vector<atUint32, AT_DNA_COUNT(materialCount)> materialEndOffs;
void addTexture(const UniqueID32& id) {textureIDs.push_back(id); ++textureCount;}
void addMaterialEndOff(atUint32 off) {materialEndOffs.push_back(off); ++materialCount;}
void addTexture(const UniqueID32& id) {
textureIDs.push_back(id);
++textureCount;
}
void addMaterialEndOff(atUint32 off) {
materialEndOffs.push_back(off);
++materialCount;
}
template <class PAKBRIDGE>
void ensureTexturesExtracted(PAKRouter<PAKBRIDGE>& pakRouter) const
{
for (const auto& id : textureIDs)
{
const nod::Node* node;
const PAK::Entry* texEntry = pakRouter.lookupEntry(id, &node);
if (!texEntry)
continue;
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.isNone())
{
txtrPath.makeDirChain(false);
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);
}
}
template <class PAKBRIDGE>
void ensureTexturesExtracted(PAKRouter<PAKBRIDGE>& pakRouter) const {
for (const auto& id : textureIDs) {
const nod::Node* node;
const PAK::Entry* texEntry = pakRouter.lookupEntry(id, &node);
if (!texEntry)
continue;
hecl::ProjectPath txtrPath = pakRouter.getWorking(texEntry);
if (txtrPath.isNone()) {
txtrPath.makeDirChain(false);
PAKEntryReadStream rs = texEntry->beginReadStream(*node);
TXTR::Extract(rs, txtrPath);
}
} head;
}
}
} head;
struct Material : BigDNA
{
AT_DECL_DNA
struct Flags : BigDNA
{
AT_DECL_DNA
Value<atUint32> flags = 0;
bool konstValuesEnabled() const {return (flags & 0x8) != 0;}
void setKonstValuesEnabled(bool enabled) {flags &= ~0x8; flags |= atUint32(enabled) << 3;}
bool depthSorting() const {return (flags & 0x10) != 0;}
void setDepthSorting(bool enabled) {flags &= ~0x10; flags |= atUint32(enabled) << 4;}
bool alphaTest() const {return (flags & 0x20) != 0;}
void setPunchthroughAlpha(bool enabled) {flags &= ~0x20; flags |= atUint32(enabled) << 5;}
bool samusReflection() const {return (flags & 0x40) != 0;}
void setSamusReflection(bool enabled) {flags &= ~0x40; flags |= atUint32(enabled) << 6;}
bool depthWrite() const {return (flags & 0x80) != 0;}
void setDepthWrite(bool enabled) {flags &= ~0x80; flags |= atUint32(enabled) << 7;}
bool samusReflectionSurfaceEye() const {return (flags & 0x100) != 0;}
void setSamusReflectionSurfaceEye(bool enabled) {flags &= ~0x100; flags |= atUint32(enabled) << 8;}
bool shadowOccluderMesh() const {return (flags & 0x200) != 0;}
void setShadowOccluderMesh(bool enabled) {flags &= ~0x200; flags |= atUint32(enabled) << 9;}
bool samusReflectionIndirectTexture() const {return (flags & 0x400) != 0;}
void setSamusReflectionIndirectTexture(bool enabled) {flags &= ~0x400; flags |= atUint32(enabled) << 10;}
bool lightmap() const {return (flags & 0x800) != 0;}
void setLightmap(bool enabled) {flags &= ~0x800; flags |= atUint32(enabled) << 11;}
bool lightmapUVArray() const {return (flags & 0x2000) != 0;}
void setLightmapUVArray(bool enabled) {flags &= ~0x2000; flags |= atUint32(enabled) << 13;}
atUint16 textureSlots() const {return (flags >> 16) != 0;}
void setTextureSlots(atUint16 texslots) {flags &= ~0xffff0000; flags |= atUint32(texslots) << 16;}
} flags;
const Flags& getFlags() const {return flags;}
struct Material : BigDNA {
AT_DECL_DNA
struct Flags : BigDNA {
AT_DECL_DNA
Value<atUint32> flags = 0;
bool konstValuesEnabled() const { return (flags & 0x8) != 0; }
void setKonstValuesEnabled(bool enabled) {
flags &= ~0x8;
flags |= atUint32(enabled) << 3;
}
bool depthSorting() const { return (flags & 0x10) != 0; }
void setDepthSorting(bool enabled) {
flags &= ~0x10;
flags |= atUint32(enabled) << 4;
}
bool alphaTest() const { return (flags & 0x20) != 0; }
void setPunchthroughAlpha(bool enabled) {
flags &= ~0x20;
flags |= atUint32(enabled) << 5;
}
bool samusReflection() const { return (flags & 0x40) != 0; }
void setSamusReflection(bool enabled) {
flags &= ~0x40;
flags |= atUint32(enabled) << 6;
}
bool depthWrite() const { return (flags & 0x80) != 0; }
void setDepthWrite(bool enabled) {
flags &= ~0x80;
flags |= atUint32(enabled) << 7;
}
bool samusReflectionSurfaceEye() const { return (flags & 0x100) != 0; }
void setSamusReflectionSurfaceEye(bool enabled) {
flags &= ~0x100;
flags |= atUint32(enabled) << 8;
}
bool shadowOccluderMesh() const { return (flags & 0x200) != 0; }
void setShadowOccluderMesh(bool enabled) {
flags &= ~0x200;
flags |= atUint32(enabled) << 9;
}
bool samusReflectionIndirectTexture() const { return (flags & 0x400) != 0; }
void setSamusReflectionIndirectTexture(bool enabled) {
flags &= ~0x400;
flags |= atUint32(enabled) << 10;
}
bool lightmap() const { return (flags & 0x800) != 0; }
void setLightmap(bool enabled) {
flags &= ~0x800;
flags |= atUint32(enabled) << 11;
}
bool lightmapUVArray() const { return (flags & 0x2000) != 0; }
void setLightmapUVArray(bool enabled) {
flags &= ~0x2000;
flags |= atUint32(enabled) << 13;
}
atUint16 textureSlots() const { return (flags >> 16) != 0; }
void setTextureSlots(atUint16 texslots) {
flags &= ~0xffff0000;
flags |= atUint32(texslots) << 16;
}
} flags;
const Flags& getFlags() const { return flags; }
Value<atUint32> textureCount = 0;
Vector<atUint32, AT_DNA_COUNT(textureCount)> textureIdxs;
struct VAFlags : BigDNA
{
AT_DECL_DNA
Value<atUint32> vaFlags = 0;
GX::AttrType position() const {return GX::AttrType(vaFlags & 0x3);}
void setPosition(GX::AttrType val) {vaFlags &= ~0x3; vaFlags |= atUint32(val);}
GX::AttrType normal() const {return GX::AttrType(vaFlags >> 2 & 0x3);}
void setNormal(GX::AttrType val) {vaFlags &= ~0xC; vaFlags |= atUint32(val) << 2;}
GX::AttrType color0() const {return GX::AttrType(vaFlags >> 4 & 0x3);}
void setColor0(GX::AttrType val) {vaFlags &= ~0x30; vaFlags |= atUint32(val) << 4;}
GX::AttrType color1() const {return GX::AttrType(vaFlags >> 6 & 0x3);}
void setColor1(GX::AttrType val) {vaFlags &= ~0xC0; vaFlags |= atUint32(val) << 6;}
GX::AttrType tex0() const {return GX::AttrType(vaFlags >> 8 & 0x3);}
void setTex0(GX::AttrType val) {vaFlags &= ~0x300; vaFlags |= atUint32(val) << 8;}
GX::AttrType tex1() const {return GX::AttrType(vaFlags >> 10 & 0x3);}
void setTex1(GX::AttrType val) {vaFlags &= ~0xC00; vaFlags |= atUint32(val) << 10;}
GX::AttrType tex2() const {return GX::AttrType(vaFlags >> 12 & 0x3);}
void setTex2(GX::AttrType val) {vaFlags &= ~0x3000; vaFlags |= atUint32(val) << 12;}
GX::AttrType tex3() const {return GX::AttrType(vaFlags >> 14 & 0x3);}
void setTex3(GX::AttrType val) {vaFlags &= ~0xC000; vaFlags |= atUint32(val) << 14;}
GX::AttrType tex4() const {return GX::AttrType(vaFlags >> 16 & 0x3);}
void setTex4(GX::AttrType val) {vaFlags &= ~0x30000; vaFlags |= atUint32(val) << 16;}
GX::AttrType tex5() const {return GX::AttrType(vaFlags >> 18 & 0x3);}
void setTex5(GX::AttrType val) {vaFlags &= ~0xC0000; vaFlags |= atUint32(val) << 18;}
GX::AttrType tex6() const {return GX::AttrType(vaFlags >> 20 & 0x3);}
void setTex6(GX::AttrType val) {vaFlags &= ~0x300000; vaFlags |= atUint32(val) << 20;}
GX::AttrType pnMatIdx() const {return GX::AttrType(vaFlags >> 24 & 0x1);}
void setPnMatIdx(GX::AttrType val) {vaFlags &= ~0x1000000; vaFlags |= atUint32(val & 0x1) << 24;}
GX::AttrType tex0MatIdx() const {return GX::AttrType(vaFlags >> 25 & 0x1);}
void setTex0MatIdx(GX::AttrType val) {vaFlags &= ~0x2000000; vaFlags |= atUint32(val & 0x1) << 25;}
GX::AttrType tex1MatIdx() const {return GX::AttrType(vaFlags >> 26 & 0x1);}
void setTex1MatIdx(GX::AttrType val) {vaFlags &= ~0x4000000; vaFlags |= atUint32(val & 0x1) << 26;}
GX::AttrType tex2MatIdx() const {return GX::AttrType(vaFlags >> 27 & 0x1);}
void setTex2MatIdx(GX::AttrType val) {vaFlags &= ~0x8000000; vaFlags |= atUint32(val & 0x1) << 27;}
GX::AttrType tex3MatIdx() const {return GX::AttrType(vaFlags >> 28 & 0x1);}
void setTex3MatIdx(GX::AttrType val) {vaFlags &= ~0x10000000; vaFlags |= atUint32(val & 0x1) << 28;}
GX::AttrType tex4MatIdx() const {return GX::AttrType(vaFlags >> 29 & 0x1);}
void setTex4MatIdx(GX::AttrType val) {vaFlags &= ~0x20000000; vaFlags |= atUint32(val & 0x1) << 29;}
GX::AttrType tex5MatIdx() const {return GX::AttrType(vaFlags >> 30 & 0x1);}
void setTex5MatIdx(GX::AttrType val) {vaFlags &= ~0x40000000; vaFlags |= atUint32(val & 0x1) << 30;}
GX::AttrType tex6MatIdx() const {return GX::AttrType(vaFlags >> 31 & 0x1);}
void setTex6MatIdx(GX::AttrType val) {vaFlags &= ~0x80000000; vaFlags |= atUint32(val & 0x1) << 31;}
Value<atUint32> textureCount = 0;
Vector<atUint32, AT_DNA_COUNT(textureCount)> textureIdxs;
struct VAFlags : BigDNA {
AT_DECL_DNA
Value<atUint32> vaFlags = 0;
GX::AttrType position() const { return GX::AttrType(vaFlags & 0x3); }
void setPosition(GX::AttrType val) {
vaFlags &= ~0x3;
vaFlags |= atUint32(val);
}
GX::AttrType normal() const { return GX::AttrType(vaFlags >> 2 & 0x3); }
void setNormal(GX::AttrType val) {
vaFlags &= ~0xC;
vaFlags |= atUint32(val) << 2;
}
GX::AttrType color0() const { return GX::AttrType(vaFlags >> 4 & 0x3); }
void setColor0(GX::AttrType val) {
vaFlags &= ~0x30;
vaFlags |= atUint32(val) << 4;
}
GX::AttrType color1() const { return GX::AttrType(vaFlags >> 6 & 0x3); }
void setColor1(GX::AttrType val) {
vaFlags &= ~0xC0;
vaFlags |= atUint32(val) << 6;
}
GX::AttrType tex0() const { return GX::AttrType(vaFlags >> 8 & 0x3); }
void setTex0(GX::AttrType val) {
vaFlags &= ~0x300;
vaFlags |= atUint32(val) << 8;
}
GX::AttrType tex1() const { return GX::AttrType(vaFlags >> 10 & 0x3); }
void setTex1(GX::AttrType val) {
vaFlags &= ~0xC00;
vaFlags |= atUint32(val) << 10;
}
GX::AttrType tex2() const { return GX::AttrType(vaFlags >> 12 & 0x3); }
void setTex2(GX::AttrType val) {
vaFlags &= ~0x3000;
vaFlags |= atUint32(val) << 12;
}
GX::AttrType tex3() const { return GX::AttrType(vaFlags >> 14 & 0x3); }
void setTex3(GX::AttrType val) {
vaFlags &= ~0xC000;
vaFlags |= atUint32(val) << 14;
}
GX::AttrType tex4() const { return GX::AttrType(vaFlags >> 16 & 0x3); }
void setTex4(GX::AttrType val) {
vaFlags &= ~0x30000;
vaFlags |= atUint32(val) << 16;
}
GX::AttrType tex5() const { return GX::AttrType(vaFlags >> 18 & 0x3); }
void setTex5(GX::AttrType val) {
vaFlags &= ~0xC0000;
vaFlags |= atUint32(val) << 18;
}
GX::AttrType tex6() const { return GX::AttrType(vaFlags >> 20 & 0x3); }
void setTex6(GX::AttrType val) {
vaFlags &= ~0x300000;
vaFlags |= atUint32(val) << 20;
}
GX::AttrType pnMatIdx() const { return GX::AttrType(vaFlags >> 24 & 0x1); }
void setPnMatIdx(GX::AttrType val) {
vaFlags &= ~0x1000000;
vaFlags |= atUint32(val & 0x1) << 24;
}
GX::AttrType tex0MatIdx() const { return GX::AttrType(vaFlags >> 25 & 0x1); }
void setTex0MatIdx(GX::AttrType val) {
vaFlags &= ~0x2000000;
vaFlags |= atUint32(val & 0x1) << 25;
}
GX::AttrType tex1MatIdx() const { return GX::AttrType(vaFlags >> 26 & 0x1); }
void setTex1MatIdx(GX::AttrType val) {
vaFlags &= ~0x4000000;
vaFlags |= atUint32(val & 0x1) << 26;
}
GX::AttrType tex2MatIdx() const { return GX::AttrType(vaFlags >> 27 & 0x1); }
void setTex2MatIdx(GX::AttrType val) {
vaFlags &= ~0x8000000;
vaFlags |= atUint32(val & 0x1) << 27;
}
GX::AttrType tex3MatIdx() const { return GX::AttrType(vaFlags >> 28 & 0x1); }
void setTex3MatIdx(GX::AttrType val) {
vaFlags &= ~0x10000000;
vaFlags |= atUint32(val & 0x1) << 28;
}
GX::AttrType tex4MatIdx() const { return GX::AttrType(vaFlags >> 29 & 0x1); }
void setTex4MatIdx(GX::AttrType val) {
vaFlags &= ~0x20000000;
vaFlags |= atUint32(val & 0x1) << 29;
}
GX::AttrType tex5MatIdx() const { return GX::AttrType(vaFlags >> 30 & 0x1); }
void setTex5MatIdx(GX::AttrType val) {
vaFlags &= ~0x40000000;
vaFlags |= atUint32(val & 0x1) << 30;
}
GX::AttrType tex6MatIdx() const { return GX::AttrType(vaFlags >> 31 & 0x1); }
void setTex6MatIdx(GX::AttrType val) {
vaFlags &= ~0x80000000;
vaFlags |= atUint32(val & 0x1) << 31;
}
size_t vertDLSize() const
{
static size_t ATTR_SZ[] = {0,1,1,2};
size_t ret = 0;
ret += ATTR_SZ[position()];
ret += ATTR_SZ[normal()];
ret += ATTR_SZ[color0()];
ret += ATTR_SZ[color1()];
ret += ATTR_SZ[tex0()];
ret += ATTR_SZ[tex1()];
ret += ATTR_SZ[tex2()];
ret += ATTR_SZ[tex3()];
ret += ATTR_SZ[tex4()];
ret += ATTR_SZ[tex5()];
ret += ATTR_SZ[tex6()];
ret += ATTR_SZ[pnMatIdx()];
ret += ATTR_SZ[tex0MatIdx()];
ret += ATTR_SZ[tex1MatIdx()];
ret += ATTR_SZ[tex2MatIdx()];
ret += ATTR_SZ[tex3MatIdx()];
ret += ATTR_SZ[tex4MatIdx()];
ret += ATTR_SZ[tex5MatIdx()];
ret += ATTR_SZ[tex6MatIdx()];
return ret;
}
} vaFlags;
const VAFlags& getVAFlags() const {return vaFlags;}
Value<atUint32> uniqueIdx;
size_t vertDLSize() const {
static size_t ATTR_SZ[] = {0, 1, 1, 2};
size_t ret = 0;
ret += ATTR_SZ[position()];
ret += ATTR_SZ[normal()];
ret += ATTR_SZ[color0()];
ret += ATTR_SZ[color1()];
ret += ATTR_SZ[tex0()];
ret += ATTR_SZ[tex1()];
ret += ATTR_SZ[tex2()];
ret += ATTR_SZ[tex3()];
ret += ATTR_SZ[tex4()];
ret += ATTR_SZ[tex5()];
ret += ATTR_SZ[tex6()];
ret += ATTR_SZ[pnMatIdx()];
ret += ATTR_SZ[tex0MatIdx()];
ret += ATTR_SZ[tex1MatIdx()];
ret += ATTR_SZ[tex2MatIdx()];
ret += ATTR_SZ[tex3MatIdx()];
ret += ATTR_SZ[tex4MatIdx()];
ret += ATTR_SZ[tex5MatIdx()];
ret += ATTR_SZ[tex6MatIdx()];
return ret;
}
} vaFlags;
const VAFlags& getVAFlags() const { return vaFlags; }
Value<atUint32> uniqueIdx;
Vector<atUint32, AT_DNA_COUNT(flags.konstValuesEnabled())> konstCount;
Vector<GX::Color, AT_DNA_COUNT(flags.konstValuesEnabled() ? konstCount[0] : 0)> konstColors;
Vector<atUint32, AT_DNA_COUNT(flags.konstValuesEnabled())> konstCount;
Vector<GX::Color, AT_DNA_COUNT(flags.konstValuesEnabled() ? konstCount[0] : 0)> konstColors;
using BlendFactor = GX::BlendFactor;
Value<BlendFactor> blendDstFac;
Value<BlendFactor> blendSrcFac;
Vector<atUint32, AT_DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
using BlendFactor = GX::BlendFactor;
Value<BlendFactor> blendDstFac;
Value<BlendFactor> blendSrcFac;
Vector<atUint32, AT_DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
Value<atUint32> colorChannelCount = 0;
struct ColorChannel : BigDNA
{
AT_DECL_DNA
Value<atUint32> flags = 0;
bool lighting() const {return (flags & 0x1) != 0;}
void setLighting(bool enabled) {flags &= ~0x1; flags |= atUint32(enabled);}
bool useAmbient() const {return (flags & 0x2) != 0;}
void setUseAmbient(bool enabled) {flags &= ~0x2; flags |= atUint32(enabled) << 1;}
bool useMaterial() const {return (flags & 0x4) != 0;}
void setUseMaterial(bool enabled) {flags &= ~0x4; flags |= atUint32(enabled) << 2;}
atUint8 lightmask() const {return atUint8(flags >> 3 & 0xff);}
void setLightmask(atUint8 mask) {flags &= ~0x7f8; flags |= atUint32(mask) << 3;}
GX::DiffuseFn diffuseFn() const {return GX::DiffuseFn(flags >> 11 & 0x3);}
void setDiffuseFn(GX::DiffuseFn fn) {flags &= ~0x1800; flags |= atUint32(fn) << 11;}
GX::AttnFn attenuationFn() const {return GX::AttnFn(flags >> 13 & 0x3);}
void setAttenuationFn(GX::AttnFn fn) {flags &= ~0x6000; flags |= atUint32(fn) << 13;}
};
Vector<ColorChannel, AT_DNA_COUNT(colorChannelCount)> colorChannels;
Value<atUint32> tevStageCount = 0;
struct TEVStage : BigDNA
{
AT_DECL_DNA
Value<atUint32> ciFlags = 0;
Value<atUint32> aiFlags = 0;
Value<atUint32> ccFlags = 0;
Value<atUint32> acFlags = 0;
Value<atUint8> pad = 0;
Value<atUint8> kaInput = 0;
Value<atUint8> kcInput = 0;
Value<atUint8> rascInput = 0;
GX::TevColorArg colorInA() const {return GX::TevColorArg(ciFlags & 0xf);}
void setColorInA(GX::TevColorArg val) {ciFlags &= ~0x1f; ciFlags |= atUint32(val);}
GX::TevColorArg colorInB() const {return GX::TevColorArg(ciFlags >> 5 & 0xf);}
void setColorInB(GX::TevColorArg val) {ciFlags &= ~0x3e0; ciFlags |= atUint32(val) << 5;}
GX::TevColorArg colorInC() const {return GX::TevColorArg(ciFlags >> 10 & 0xf);}
void setColorInC(GX::TevColorArg val) {ciFlags &= ~0x7c00; ciFlags |= atUint32(val) << 10;}
GX::TevColorArg colorInD() const {return GX::TevColorArg(ciFlags >> 15 & 0xf);}
void setColorInD(GX::TevColorArg val) {ciFlags &= ~0xf8000; ciFlags |= atUint32(val) << 15;}
GX::TevAlphaArg alphaInA() const {return GX::TevAlphaArg(aiFlags & 0x7);}
void setAlphaInA(GX::TevAlphaArg val) {aiFlags &= ~0x1f; aiFlags |= atUint32(val);}
GX::TevAlphaArg alphaInB() const {return GX::TevAlphaArg(aiFlags >> 5 & 0x7);}
void setAlphaInB(GX::TevAlphaArg val) {aiFlags &= ~0x3e0; aiFlags |= atUint32(val) << 5;}
GX::TevAlphaArg alphaInC() const {return GX::TevAlphaArg(aiFlags >> 10 & 0x7);}
void setAlphaInC(GX::TevAlphaArg val) {aiFlags &= ~0x7c00; aiFlags |= atUint32(val) << 10;}
GX::TevAlphaArg alphaInD() const {return GX::TevAlphaArg(aiFlags >> 15 & 0x7);}
void setAlphaInD(GX::TevAlphaArg val) {aiFlags &= ~0xf8000; aiFlags |= atUint32(val) << 15;}
GX::TevOp colorOp() const {return GX::TevOp(ccFlags & 0xf);}
void setColorOp(GX::TevOp val) {ccFlags &= ~0x1; ccFlags |= atUint32(val);}
GX::TevBias colorOpBias() const {return GX::TevBias(ccFlags >> 4 & 0x3);}
void setColorOpBias(GX::TevBias val) {ccFlags &= ~0x30; ccFlags |= atUint32(val) << 4;}
GX::TevScale colorOpScale() const {return GX::TevScale(ccFlags >> 6 & 0x3);}
void setColorOpScale(GX::TevScale val) {ccFlags &= ~0xc0; ccFlags |= atUint32(val) << 6;}
bool colorOpClamp() const {return ccFlags >> 8 & 0x1;}
void setColorOpClamp(bool val) {ccFlags &= ~0x100; ccFlags |= atUint32(val) << 8;}
GX::TevRegID colorOpOutReg() const {return GX::TevRegID(ccFlags >> 9 & 0x3);}
void setColorOpOutReg(GX::TevRegID val) {ccFlags &= ~0x600; ccFlags |= atUint32(val) << 9;}
GX::TevOp alphaOp() const {return GX::TevOp(acFlags & 0xf);}
void setAlphaOp(GX::TevOp val) {acFlags &= ~0x1; acFlags |= atUint32(val);}
GX::TevBias alphaOpBias() const {return GX::TevBias(acFlags >> 4 & 0x3);}
void setAlphaOpBias(GX::TevBias val) {acFlags &= ~0x30; acFlags |= atUint32(val) << 4;}
GX::TevScale alphaOpScale() const {return GX::TevScale(acFlags >> 6 & 0x3);}
void setAlphaOpScale(GX::TevScale val) {acFlags &= ~0xc0; acFlags |= atUint32(val) << 6;}
bool alphaOpClamp() const {return acFlags >> 8 & 0x1;}
void setAlphaOpClamp(bool val) {acFlags &= ~0x100; acFlags |= atUint32(val) << 8;}
GX::TevRegID alphaOpOutReg() const {return GX::TevRegID(acFlags >> 9 & 0x3);}
void setAlphaOpOutReg(GX::TevRegID val) {acFlags &= ~0x600; acFlags |= atUint32(val) << 9;}
GX::TevKColorSel kColorIn() const {return GX::TevKColorSel(kcInput);}
void setKColorIn(GX::TevKColorSel val) {kcInput = val;}
GX::TevKAlphaSel kAlphaIn() const {return GX::TevKAlphaSel(kaInput);}
void setKAlphaIn(GX::TevKAlphaSel val) {kaInput = val;}
GX::ChannelID rasIn() const {return GX::ChannelID(rascInput);}
void setRASIn(GX::ChannelID id) {rascInput = id;}
};
Vector<TEVStage, AT_DNA_COUNT(tevStageCount)> tevStages;
struct TEVStageTexInfo : BigDNA
{
AT_DECL_DNA
Value<atUint16> pad = 0;
Value<atUint8> texSlot = 0xff;
Value<atUint8> tcgSlot = 0xff;
};
Vector<TEVStageTexInfo, AT_DNA_COUNT(tevStageCount)> tevStageTexInfo;
Value<atUint32> tcgCount = 0;
struct TexCoordGen : BigDNA
{
AT_DECL_DNA
Value<atUint32> flags = 0;
GX::TexGenType type() const {return GX::TexGenType(flags & 0xf);}
void setType(GX::TexGenType val) {flags &= ~0xf; flags |= atUint32(val);}
GX::TexGenSrc source() const {return GX::TexGenSrc(flags >> 4 & 0x1f);}
void setSource(GX::TexGenSrc val) {flags &= ~0x1f0; flags |= atUint32(val) << 4;}
GX::TexMtx mtx() const {return GX::TexMtx((flags >> 9 & 0x1f) + 30);}
void setMtx(GX::TexMtx val) {flags &= ~0x3e00; flags |= (atUint32(val)-30) << 9;}
bool normalize() const {return flags >> 14 & 0x1;}
void setNormalize(bool val) {flags &= ~0x4000; flags |= atUint32(val) << 14;}
GX::PTTexMtx postMtx() const {return GX::PTTexMtx((flags >> 15 & 0x3f) + 64);}
void setPostMtx(GX::PTTexMtx val) {flags &= ~0x1f8000; flags |= (atUint32(val)-64) << 15;}
};
Vector<TexCoordGen, AT_DNA_COUNT(tcgCount)> tcgs;
Value<atUint32> uvAnimsSize = 4;
Value<atUint32> uvAnimsCount = 0;
struct UVAnimation : BigDNA
{
AT_DECL_EXPLICIT_DNA
enum class Mode
{
MvInvNoTranslation,
MvInv,
Scroll,
Rotation,
HStrip,
VStrip,
Model,
CylinderEnvironment,
Eight
} mode;
float vals[9];
UVAnimation() = default;
UVAnimation(const std::string& gameFunction,
const std::vector<atVec4f>& gameArgs);
};
Vector<UVAnimation, AT_DNA_COUNT(uvAnimsCount)> uvAnims;
static void AddTexture(hecl::blender::PyOutStream& out,
GX::TexGenSrc type, int mtxIdx, uint32_t texIdx);
static void AddTextureAnim(hecl::blender::PyOutStream& out,
MaterialSet::Material::UVAnimation::Mode type,
unsigned idx, const float* vals);
static void AddKcolor(hecl::blender::PyOutStream& out,
const GX::Color& col, unsigned idx);
static void AddDynamicColor(hecl::blender::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(hecl::blender::PyOutStream& out, unsigned idx);
Material() = default;
Material(const hecl::Backend::GX& gx,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<hecl::ProjectPath>& texPathsIn,
std::vector<hecl::ProjectPath>& texPathsOut,
int colorCount,
bool lightmapUVs,
bool matrixSkinning);
Value<atUint32> colorChannelCount = 0;
struct ColorChannel : BigDNA {
AT_DECL_DNA
Value<atUint32> flags = 0;
bool lighting() const { return (flags & 0x1) != 0; }
void setLighting(bool enabled) {
flags &= ~0x1;
flags |= atUint32(enabled);
}
bool useAmbient() const { return (flags & 0x2) != 0; }
void setUseAmbient(bool enabled) {
flags &= ~0x2;
flags |= atUint32(enabled) << 1;
}
bool useMaterial() const { return (flags & 0x4) != 0; }
void setUseMaterial(bool enabled) {
flags &= ~0x4;
flags |= atUint32(enabled) << 2;
}
atUint8 lightmask() const { return atUint8(flags >> 3 & 0xff); }
void setLightmask(atUint8 mask) {
flags &= ~0x7f8;
flags |= atUint32(mask) << 3;
}
GX::DiffuseFn diffuseFn() const { return GX::DiffuseFn(flags >> 11 & 0x3); }
void setDiffuseFn(GX::DiffuseFn fn) {
flags &= ~0x1800;
flags |= atUint32(fn) << 11;
}
GX::AttnFn attenuationFn() const { return GX::AttnFn(flags >> 13 & 0x3); }
void setAttenuationFn(GX::AttnFn fn) {
flags &= ~0x6000;
flags |= atUint32(fn) << 13;
}
};
Vector<Material, AT_DNA_COUNT(head.materialCount)> materials;
Vector<ColorChannel, AT_DNA_COUNT(colorChannelCount)> colorChannels;
static void RegisterMaterialProps(hecl::blender::PyOutStream& out);
static void ConstructMaterial(hecl::blender::PyOutStream& out,
const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
Value<atUint32> tevStageCount = 0;
struct TEVStage : BigDNA {
AT_DECL_DNA
Value<atUint32> ciFlags = 0;
Value<atUint32> aiFlags = 0;
Value<atUint32> ccFlags = 0;
Value<atUint32> acFlags = 0;
Value<atUint8> pad = 0;
Value<atUint8> kaInput = 0;
Value<atUint8> kcInput = 0;
Value<atUint8> rascInput = 0;
void readToBlender(hecl::blender::PyOutStream& os,
const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry,
unsigned setIdx)
{
DNACMDL::ReadMaterialSetToBlender_1_2(os, *this, pakRouter, entry, setIdx);
}
GX::TevColorArg colorInA() const { return GX::TevColorArg(ciFlags & 0xf); }
void setColorInA(GX::TevColorArg val) {
ciFlags &= ~0x1f;
ciFlags |= atUint32(val);
}
GX::TevColorArg colorInB() const { return GX::TevColorArg(ciFlags >> 5 & 0xf); }
void setColorInB(GX::TevColorArg val) {
ciFlags &= ~0x3e0;
ciFlags |= atUint32(val) << 5;
}
GX::TevColorArg colorInC() const { return GX::TevColorArg(ciFlags >> 10 & 0xf); }
void setColorInC(GX::TevColorArg val) {
ciFlags &= ~0x7c00;
ciFlags |= atUint32(val) << 10;
}
GX::TevColorArg colorInD() const { return GX::TevColorArg(ciFlags >> 15 & 0xf); }
void setColorInD(GX::TevColorArg val) {
ciFlags &= ~0xf8000;
ciFlags |= atUint32(val) << 15;
}
template <class PAKRouter>
void nameTextures(PAKRouter& pakRouter, const char* prefix, int setIdx) const
{
int matIdx = 0;
for (const Material& mat : materials)
{
int stageIdx = 0;
for (const Material::TEVStage& stage : mat.tevStages)
{
(void)stage;
const Material::TEVStageTexInfo& texInfo = mat.tevStageTexInfo[stageIdx];
if (texInfo.texSlot == 0xff)
{
++stageIdx;
continue;
}
const nod::Node* node;
typename PAKRouter::EntryType* texEntry = (typename PAKRouter::EntryType*)
pakRouter.lookupEntry(head.textureIDs[mat.textureIdxs[texInfo.texSlot]], &node);
if (texEntry->name.size())
{
if (texEntry->name.size() < 5 || texEntry->name.compare(0, 5, "mult_"))
texEntry->name = "mult_" + texEntry->name;
++stageIdx;
continue;
}
if (setIdx < 0)
texEntry->name = hecl::Format("%s_%d_%d", prefix, matIdx, stageIdx);
else
texEntry->name = hecl::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
GX::TevAlphaArg alphaInA() const { return GX::TevAlphaArg(aiFlags & 0x7); }
void setAlphaInA(GX::TevAlphaArg val) {
aiFlags &= ~0x1f;
aiFlags |= atUint32(val);
}
GX::TevAlphaArg alphaInB() const { return GX::TevAlphaArg(aiFlags >> 5 & 0x7); }
void setAlphaInB(GX::TevAlphaArg val) {
aiFlags &= ~0x3e0;
aiFlags |= atUint32(val) << 5;
}
GX::TevAlphaArg alphaInC() const { return GX::TevAlphaArg(aiFlags >> 10 & 0x7); }
void setAlphaInC(GX::TevAlphaArg val) {
aiFlags &= ~0x7c00;
aiFlags |= atUint32(val) << 10;
}
GX::TevAlphaArg alphaInD() const { return GX::TevAlphaArg(aiFlags >> 15 & 0x7); }
void setAlphaInD(GX::TevAlphaArg val) {
aiFlags &= ~0xf8000;
aiFlags |= atUint32(val) << 15;
}
if (mat.flags.lightmap() && stageIdx == 0)
{
texEntry->name += "light";
++stageIdx;
continue;
}
GX::TevOp colorOp() const { return GX::TevOp(ccFlags & 0xf); }
void setColorOp(GX::TevOp val) {
ccFlags &= ~0x1;
ccFlags |= atUint32(val);
}
GX::TevBias colorOpBias() const { return GX::TevBias(ccFlags >> 4 & 0x3); }
void setColorOpBias(GX::TevBias val) {
ccFlags &= ~0x30;
ccFlags |= atUint32(val) << 4;
}
GX::TevScale colorOpScale() const { return GX::TevScale(ccFlags >> 6 & 0x3); }
void setColorOpScale(GX::TevScale val) {
ccFlags &= ~0xc0;
ccFlags |= atUint32(val) << 6;
}
bool colorOpClamp() const { return ccFlags >> 8 & 0x1; }
void setColorOpClamp(bool val) {
ccFlags &= ~0x100;
ccFlags |= atUint32(val) << 8;
}
GX::TevRegID colorOpOutReg() const { return GX::TevRegID(ccFlags >> 9 & 0x3); }
void setColorOpOutReg(GX::TevRegID val) {
ccFlags &= ~0x600;
ccFlags |= atUint32(val) << 9;
}
++stageIdx;
}
++matIdx;
GX::TevOp alphaOp() const { return GX::TevOp(acFlags & 0xf); }
void setAlphaOp(GX::TevOp val) {
acFlags &= ~0x1;
acFlags |= atUint32(val);
}
GX::TevBias alphaOpBias() const { return GX::TevBias(acFlags >> 4 & 0x3); }
void setAlphaOpBias(GX::TevBias val) {
acFlags &= ~0x30;
acFlags |= atUint32(val) << 4;
}
GX::TevScale alphaOpScale() const { return GX::TevScale(acFlags >> 6 & 0x3); }
void setAlphaOpScale(GX::TevScale val) {
acFlags &= ~0xc0;
acFlags |= atUint32(val) << 6;
}
bool alphaOpClamp() const { return acFlags >> 8 & 0x1; }
void setAlphaOpClamp(bool val) {
acFlags &= ~0x100;
acFlags |= atUint32(val) << 8;
}
GX::TevRegID alphaOpOutReg() const { return GX::TevRegID(acFlags >> 9 & 0x3); }
void setAlphaOpOutReg(GX::TevRegID val) {
acFlags &= ~0x600;
acFlags |= atUint32(val) << 9;
}
GX::TevKColorSel kColorIn() const { return GX::TevKColorSel(kcInput); }
void setKColorIn(GX::TevKColorSel val) { kcInput = val; }
GX::TevKAlphaSel kAlphaIn() const { return GX::TevKAlphaSel(kaInput); }
void setKAlphaIn(GX::TevKAlphaSel val) { kaInput = val; }
GX::ChannelID rasIn() const { return GX::ChannelID(rascInput); }
void setRASIn(GX::ChannelID id) { rascInput = id; }
};
Vector<TEVStage, AT_DNA_COUNT(tevStageCount)> tevStages;
struct TEVStageTexInfo : BigDNA {
AT_DECL_DNA
Value<atUint16> pad = 0;
Value<atUint8> texSlot = 0xff;
Value<atUint8> tcgSlot = 0xff;
};
Vector<TEVStageTexInfo, AT_DNA_COUNT(tevStageCount)> tevStageTexInfo;
Value<atUint32> tcgCount = 0;
struct TexCoordGen : BigDNA {
AT_DECL_DNA
Value<atUint32> flags = 0;
GX::TexGenType type() const { return GX::TexGenType(flags & 0xf); }
void setType(GX::TexGenType val) {
flags &= ~0xf;
flags |= atUint32(val);
}
GX::TexGenSrc source() const { return GX::TexGenSrc(flags >> 4 & 0x1f); }
void setSource(GX::TexGenSrc val) {
flags &= ~0x1f0;
flags |= atUint32(val) << 4;
}
GX::TexMtx mtx() const { return GX::TexMtx((flags >> 9 & 0x1f) + 30); }
void setMtx(GX::TexMtx val) {
flags &= ~0x3e00;
flags |= (atUint32(val) - 30) << 9;
}
bool normalize() const { return flags >> 14 & 0x1; }
void setNormalize(bool val) {
flags &= ~0x4000;
flags |= atUint32(val) << 14;
}
GX::PTTexMtx postMtx() const { return GX::PTTexMtx((flags >> 15 & 0x3f) + 64); }
void setPostMtx(GX::PTTexMtx val) {
flags &= ~0x1f8000;
flags |= (atUint32(val) - 64) << 15;
}
};
Vector<TexCoordGen, AT_DNA_COUNT(tcgCount)> tcgs;
Value<atUint32> uvAnimsSize = 4;
Value<atUint32> uvAnimsCount = 0;
struct UVAnimation : BigDNA {
AT_DECL_EXPLICIT_DNA
enum class Mode {
MvInvNoTranslation,
MvInv,
Scroll,
Rotation,
HStrip,
VStrip,
Model,
CylinderEnvironment,
Eight
} mode;
float vals[9];
UVAnimation() = default;
UVAnimation(const std::string& gameFunction, const std::vector<atVec4f>& gameArgs);
};
Vector<UVAnimation, AT_DNA_COUNT(uvAnimsCount)> uvAnims;
static void AddTexture(hecl::blender::PyOutStream& out, GX::TexGenSrc type, int mtxIdx, uint32_t texIdx);
static void AddTextureAnim(hecl::blender::PyOutStream& out, MaterialSet::Material::UVAnimation::Mode type,
unsigned idx, const float* vals);
static void AddKcolor(hecl::blender::PyOutStream& out, const GX::Color& col, unsigned idx);
static void AddDynamicColor(hecl::blender::PyOutStream& out, unsigned idx);
static void AddDynamicAlpha(hecl::blender::PyOutStream& out, unsigned idx);
Material() = default;
Material(const hecl::Backend::GX& gx, const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<hecl::ProjectPath>& texPathsIn, std::vector<hecl::ProjectPath>& texPathsOut,
int colorCount, bool lightmapUVs, bool matrixSkinning);
};
Vector<Material, AT_DNA_COUNT(head.materialCount)> materials;
static void RegisterMaterialProps(hecl::blender::PyOutStream& out);
static void ConstructMaterial(hecl::blender::PyOutStream& out, const MaterialSet::Material& material,
unsigned groupIdx, unsigned matIdx);
void readToBlender(hecl::blender::PyOutStream& os, const PAKRouter<PAKBridge>& pakRouter,
const PAKRouter<PAKBridge>::EntryType& entry, unsigned setIdx) {
DNACMDL::ReadMaterialSetToBlender_1_2(os, *this, pakRouter, entry, setIdx);
}
template <class PAKRouter>
void nameTextures(PAKRouter& pakRouter, const char* prefix, int setIdx) const {
int matIdx = 0;
for (const Material& mat : materials) {
int stageIdx = 0;
for (const Material::TEVStage& stage : mat.tevStages) {
(void)stage;
const Material::TEVStageTexInfo& texInfo = mat.tevStageTexInfo[stageIdx];
if (texInfo.texSlot == 0xff) {
++stageIdx;
continue;
}
}
const nod::Node* node;
typename PAKRouter::EntryType* texEntry = (typename PAKRouter::EntryType*)pakRouter.lookupEntry(
head.textureIDs[mat.textureIdxs[texInfo.texSlot]], &node);
if (texEntry->name.size()) {
if (texEntry->name.size() < 5 || texEntry->name.compare(0, 5, "mult_"))
texEntry->name = "mult_" + texEntry->name;
++stageIdx;
continue;
}
if (setIdx < 0)
texEntry->name = hecl::Format("%s_%d_%d", prefix, matIdx, stageIdx);
else
texEntry->name = hecl::Format("%s_%d_%d_%d", prefix, setIdx, matIdx, stageIdx);
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const
{
head.ensureTexturesExtracted(pakRouter);
if (mat.flags.lightmap() && stageIdx == 0) {
texEntry->name += "light";
++stageIdx;
continue;
}
++stageIdx;
}
++matIdx;
}
}
void ensureTexturesExtracted(PAKRouter<PAKBridge>& pakRouter) const { head.ensureTexturesExtracted(pakRouter); }
};
struct HMDLMaterialSet : BigDNA
{
static constexpr bool OneSection() {return false;}
struct HMDLMaterialSet : BigDNA {
static constexpr bool OneSection() { return false; }
AT_DECL_DNA
MaterialSet::MaterialSetHead head;
struct Material : BigDNA {
AT_DECL_DNA
MaterialSet::MaterialSetHead head;
MaterialSet::Material::Flags flags;
struct Material : BigDNA
{
AT_DECL_DNA
MaterialSet::Material::Flags flags;
Value<atUint32> textureCount = 0;
Vector<atUint32, AT_DNA_COUNT(textureCount)> textureIdxs;
Value<atUint32> textureCount = 0;
Vector<atUint32, AT_DNA_COUNT(textureCount)> textureIdxs;
Vector<atUint32, AT_DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
Vector<atUint32, AT_DNA_COUNT(flags.samusReflectionIndirectTexture())> indTexSlot;
Value<atUint32> uvAnimsSize = 4;
Value<atUint32> uvAnimsCount = 0;
Vector<MaterialSet::Material::UVAnimation, AT_DNA_COUNT(uvAnimsCount)> uvAnims;
Value<atUint32> uvAnimsSize = 4;
Value<atUint32> uvAnimsCount = 0;
Vector<MaterialSet::Material::UVAnimation, AT_DNA_COUNT(uvAnimsCount)> uvAnims;
String<-1> heclSource;
hecl::Frontend::IR heclIr;
String<-1> heclSource;
hecl::Frontend::IR heclIr;
Material() = default;
Material(hecl::Frontend::Frontend& FE,
const std::string& diagName,
const hecl::blender::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops,
const std::vector<hecl::ProjectPath>& texPaths);
};
Vector<Material, AT_DNA_COUNT(head.materialCount)> materials;
Material() = default;
Material(hecl::Frontend::Frontend& FE, const std::string& diagName, const hecl::blender::Material& mat,
const std::unordered_map<std::string, int32_t>& iprops, const std::vector<hecl::ProjectPath>& texPaths);
};
Vector<Material, AT_DNA_COUNT(head.materialCount)> materials;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,21 +1,16 @@
#include "CSKR.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const
{
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules)
{
if (idx >= accum && idx < accum + rule.vertCount)
for (const SkinningRule::Weight& weight : rule.weights)
os.format("vert[dvert_lay][%u] = %f\n",
cinf.getBoneIdxFromId(weight.boneId),
weight.weight);
accum += rule.vertCount;
}
void CSKR::weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const {
atUint32 accum = 0;
for (const SkinningRule& rule : skinningRules) {
if (idx >= accum && idx < accum + rule.vertCount)
for (const SkinningRule::Weight& weight : rule.weights)
os.format("vert[dvert_lay][%u] = %f\n", cinf.getBoneIdxFromId(weight.boneId), weight.weight);
accum += rule.vertCount;
}
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,35 +3,27 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "CINF.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct CSKR : BigDNA
{
struct CSKR : BigDNA {
AT_DECL_DNA
Value<atUint32> skinningRuleCount;
struct SkinningRule : BigDNA {
AT_DECL_DNA
Value<atUint32> skinningRuleCount;
struct SkinningRule : BigDNA
{
AT_DECL_DNA
Value<atUint32> weightCount;
struct Weight : BigDNA
{
AT_DECL_DNA
Value<atUint32> boneId;
Value<float> weight;
};
Vector<Weight, AT_DNA_COUNT(weightCount)> weights;
Value<atUint32> vertCount;
Value<atUint32> weightCount;
struct Weight : BigDNA {
AT_DECL_DNA
Value<atUint32> boneId;
Value<float> weight;
};
Vector<SkinningRule, AT_DNA_COUNT(skinningRuleCount)> skinningRules;
Vector<Weight, AT_DNA_COUNT(weightCount)> weights;
Value<atUint32> vertCount;
};
Vector<SkinningRule, AT_DNA_COUNT(skinningRuleCount)> skinningRules;
const atInt16* getMatrixBank(size_t) const
{
return nullptr;
}
const atInt16* getMatrixBank(size_t) const { return nullptr; }
void weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const;
void weightVertex(hecl::blender::PyOutStream& os, const CINF& cinf, atUint32 idx) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,102 +1,99 @@
#include "CSNG.hpp"
#include "amuse/SongConverter.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = outPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
bool CSNG::Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
hecl::ProjectPath midPath = outPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = outPath.getWithExtension(_SYS_STR(".yaml"), true);
Header head;
head.read(rs);
{
athena::io::YAMLDocWriter dw("CSNG");
dw.writeUint32("midiSetupId", head.midiSetupId);
dw.writeUint32("songGroupId", head.songGroupId);
if (auto rec = dw.enterSubRecord("agscId"))
head.agscId.write(dw);
athena::io::FileWriter w(yamlPath.getAbsolutePath());
if (w.hasError())
return false;
dw.finish(&w);
}
{
auto sng = rs.readUBytes(head.sngLength);
int version;
bool isBig;
auto midi = amuse::SongConverter::SongToMIDI(sng.get(), version, isBig);
athena::io::FileWriter w(midPath.getAbsolutePath());
if (w.hasError())
return false;
w.writeUBytes(midi.data(), midi.size());
}
/* Update !songs.yaml for Amuse editor */
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
audGrp.makeDirChain(true);
hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
std::experimental::optional<athena::io::FileReader> r;
if (songsPath.isFile())
r.emplace(songsPath.getAbsolutePath());
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
r = std::experimental::nullopt;
char id[16];
snprintf(id, 16, "%04X", head.midiSetupId);
ydw.writeString(id, hecl::Format("../MidiData/%s", midPath.getLastComponentUTF8().data()));
athena::io::FileWriter w(songsPath.getAbsolutePath());
ydw.finish(&w);
return true;
}
bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
hecl::ProjectPath midPath = inPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
std::vector<uint8_t> sngData;
{
athena::io::FileReader midR(midPath.getAbsolutePath());
if (midR.hasError())
return false;
uint32_t midLen = midR.length();
std::vector<uint8_t> midData;
midData.resize(midLen);
midR.readUBytesToBuf(midData.data(), midLen);
sngData = amuse::SongConverter::MIDIToSong(midData, 1, true);
}
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
{
athena::io::FileReader yamlR(yamlPath.getAbsolutePath());
if (yamlR.hasError())
return false;
athena::io::YAMLDocReader dr;
if (!dr.parse(&yamlR))
return false;
Header head;
head.read(rs);
head.midiSetupId = dr.readUint32("midiSetupId");
head.songGroupId = dr.readUint32("songGroupId");
if (auto rec = dr.enterSubRecord("agscId"))
head.agscId.read(dr);
head.sngLength = sngData.size();
head.write(w);
}
{
athena::io::YAMLDocWriter dw("CSNG");
dw.writeUint32("midiSetupId", head.midiSetupId);
dw.writeUint32("songGroupId", head.songGroupId);
if (auto rec = dw.enterSubRecord("agscId"))
head.agscId.write(dw);
w.writeUBytes(sngData.data(), sngData.size());
athena::io::FileWriter w(yamlPath.getAbsolutePath());
if (w.hasError())
return false;
dw.finish(&w);
}
{
auto sng = rs.readUBytes(head.sngLength);
int version;
bool isBig;
auto midi = amuse::SongConverter::SongToMIDI(sng.get(), version, isBig);
athena::io::FileWriter w(midPath.getAbsolutePath());
if (w.hasError())
return false;
w.writeUBytes(midi.data(), midi.size());
}
/* Update !songs.yaml for Amuse editor */
hecl::ProjectPath audGrp(outPath.getParentPath().getParentPath(), _SYS_STR("AudioGrp"));
audGrp.makeDirChain(true);
hecl::ProjectPath songsPath(audGrp, _SYS_STR("!songs.yaml"));
std::experimental::optional<athena::io::FileReader> r;
if (songsPath.isFile())
r.emplace(songsPath.getAbsolutePath());
athena::io::YAMLDocWriter ydw("amuse::Songs", r ? &*r : nullptr);
r = std::experimental::nullopt;
char id[16];
snprintf(id, 16, "%04X", head.midiSetupId);
ydw.writeString(id, hecl::Format("../MidiData/%s", midPath.getLastComponentUTF8().data()));
athena::io::FileWriter w(songsPath.getAbsolutePath());
ydw.finish(&w);
return true;
return true;
}
bool CSNG::Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
hecl::ProjectPath midPath = inPath.getWithExtension(_SYS_STR(".mid"), true);
hecl::ProjectPath yamlPath = inPath.getWithExtension(_SYS_STR(".yaml"), true);
std::vector<uint8_t> sngData;
{
athena::io::FileReader midR(midPath.getAbsolutePath());
if (midR.hasError())
return false;
uint32_t midLen = midR.length();
std::vector<uint8_t> midData;
midData.resize(midLen);
midR.readUBytesToBuf(midData.data(), midLen);
sngData = amuse::SongConverter::MIDIToSong(midData, 1, true);
}
athena::io::FileWriter w(outPath.getAbsolutePath());
if (w.hasError())
return false;
{
athena::io::FileReader yamlR(yamlPath.getAbsolutePath());
if (yamlR.hasError())
return false;
athena::io::YAMLDocReader dr;
if (!dr.parse(&yamlR))
return false;
Header head;
head.midiSetupId = dr.readUint32("midiSetupId");
head.songGroupId = dr.readUint32("songGroupId");
if (auto rec = dr.enterSubRecord("agscId"))
head.agscId.read(dr);
head.sngLength = sngData.size();
head.write(w);
}
w.writeUBytes(sngData.data(), sngData.size());
return true;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,24 +3,21 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
class CSNG {
struct Header : BigDNA {
AT_DECL_DNA
Value<atUint32> magic = 0x2;
Value<atUint32> midiSetupId;
Value<atUint32> songGroupId;
UniqueID32 agscId;
Value<atUint32> sngLength;
};
class CSNG
{
struct Header : BigDNA
{
AT_DECL_DNA
Value<atUint32> magic = 0x2;
Value<atUint32> midiSetupId;
Value<atUint32> songGroupId;
UniqueID32 agscId;
Value<atUint32> sngLength;
};
public:
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath);
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,138 +1,121 @@
#include "DCLN.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
#if DCLN_DUMP_OBB
void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const
{
os.format("obj = bpy.data.objects.new('%s', None)\n"
"obj.empty_draw_type = 'CUBE'\n"
"bpy.context.scene.objects.link(obj)\n"
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"obj.rotation_mode = 'QUATERNION'\n"
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = (%f,%f,%f)\n", isLeaf ? "leaf" : "branch",
xf[0].vec[0], xf[0].vec[1], xf[0].vec[2], xf[0].vec[3],
xf[1].vec[0], xf[1].vec[1], xf[1].vec[2], xf[1].vec[3],
xf[2].vec[0], xf[2].vec[1], xf[2].vec[2], xf[2].vec[3],
halfExtent.vec[0], halfExtent.vec[1], halfExtent.vec[2]);
if (isLeaf)
os << "obj.show_name = True\n";
if (!isLeaf)
{
left->sendToBlender(os);
right->sendToBlender(os);
}
void DCLN::Collision::Node::sendToBlender(hecl::blender::PyOutStream& os) const {
os.format(
"obj = bpy.data.objects.new('%s', None)\n"
"obj.empty_draw_type = 'CUBE'\n"
"bpy.context.scene.objects.link(obj)\n"
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"obj.rotation_mode = 'QUATERNION'\n"
"obj.location = mtxd[0]\n"
"obj.rotation_quaternion = mtxd[1]\n"
"obj.scale = (%f,%f,%f)\n",
isLeaf ? "leaf" : "branch", xf[0].vec[0], xf[0].vec[1], xf[0].vec[2], xf[0].vec[3], xf[1].vec[0], xf[1].vec[1],
xf[1].vec[2], xf[1].vec[3], xf[2].vec[0], xf[2].vec[1], xf[2].vec[2], xf[2].vec[3], halfExtent.vec[0],
halfExtent.vec[1], halfExtent.vec[2]);
if (isLeaf)
os << "obj.show_name = True\n";
if (!isLeaf) {
left->sendToBlender(os);
right->sendToBlender(os);
}
}
#endif
template <class Op>
void DCLN::Collision::Node::Enumerate(typename Op::StreamT& s)
{
Do<Op>({"xf[0]"}, xf[0], s);
Do<Op>({"xf[1]"}, xf[1], s);
Do<Op>({"xf[2]"}, xf[2], s);
Do<Op>({"halfExtent"}, halfExtent, s);
Do<Op>({"isLeaf"}, isLeaf, s);
if (isLeaf)
{
if (!leafData)
leafData.reset(new LeafData);
Do<Op>({"leafData"}, *leafData, s);
}
else
{
if (!left)
left.reset(new Node);
Do<Op>({"left"}, *left, s);
if (!right)
right.reset(new Node);
Do<Op>({"right"}, *right, s);
}
void DCLN::Collision::Node::Enumerate(typename Op::StreamT& s) {
Do<Op>({"xf[0]"}, xf[0], s);
Do<Op>({"xf[1]"}, xf[1], s);
Do<Op>({"xf[2]"}, xf[2], s);
Do<Op>({"halfExtent"}, halfExtent, s);
Do<Op>({"isLeaf"}, isLeaf, s);
if (isLeaf) {
if (!leafData)
leafData.reset(new LeafData);
Do<Op>({"leafData"}, *leafData, s);
} else {
if (!left)
left.reset(new Node);
Do<Op>({"left"}, *left, s);
if (!right)
right.reset(new Node);
Do<Op>({"right"}, *right, s);
}
}
AT_SPECIALIZE_DNA(DCLN::Collision::Node)
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName)
{
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
entryName.data());
void DCLN::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName) {
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format(
"import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n",
entryName.data());
DeafBabe::BlenderInit(os);
atInt32 idx = 0;
for (const Collision& col : collision)
{
DeafBabeSendToBlender(os, col, true, idx++);
DeafBabe::BlenderInit(os);
atInt32 idx = 0;
for (const Collision& col : collision) {
DeafBabeSendToBlender(os, col, true, idx++);
#if DCLN_DUMP_OBB
col.root.sendToBlender(os);
col.root.sendToBlender(os);
#endif
}
os.centerView();
os.close();
}
os.centerView();
os.close();
}
bool DCLN::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
DCLN dcln;
dcln.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::ColMesh))
return false;
bool DCLN::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) {
DCLN dcln;
dcln.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::ColMesh))
return false;
dcln.sendToBlender(conn, pakRouter.getBestEntryName(entry, false));
return conn.saveBlend();
dcln.sendToBlender(conn, pakRouter.getBestEntryName(entry, false));
return conn.saveBlend();
}
bool DCLN::Cook(const hecl::ProjectPath& outPath,
const std::vector<Mesh>& meshes)
{
DCLN dcln;
dcln.colCount = atUint32(meshes.size());
for (const Mesh& mesh : meshes)
{
dcln.collision.emplace_back();
Collision& colOut = dcln.collision.back();
DeafBabeBuildFromBlender(colOut, mesh);
colOut.root = std::move(*OBBTreeBuilder::buildCol<Collision::Node>(mesh));
colOut.memSize = atUint32(colOut.root.getMemoryUsage());
}
bool DCLN::Cook(const hecl::ProjectPath& outPath, const std::vector<Mesh>& meshes) {
DCLN dcln;
dcln.colCount = atUint32(meshes.size());
for (const Mesh& mesh : meshes) {
dcln.collision.emplace_back();
Collision& colOut = dcln.collision.back();
DeafBabeBuildFromBlender(colOut, mesh);
colOut.root = std::move(*OBBTreeBuilder::buildCol<Collision::Node>(mesh));
colOut.memSize = atUint32(colOut.root.getMemoryUsage());
}
#if DCLN_DUMP_OBB
hecl::blender::Connection& conn = hecl::blender::SharedBlenderToken.getBlenderConnection();
conn.createBlend(outPath.getWithExtension(_SYS_STR(".blend")), hecl::blender::BlendType::ColMesh);
dcln.sendToBlender(conn, "BLAH");
conn.saveBlend();
hecl::blender::Connection& conn = hecl::blender::SharedBlenderToken.getBlenderConnection();
conn.createBlend(outPath.getWithExtension(_SYS_STR(".blend")), hecl::blender::BlendType::ColMesh);
dcln.sendToBlender(conn, "BLAH");
conn.saveBlend();
#endif
athena::io::FileWriter w(outPath.getAbsolutePath());
dcln.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeUByte(0xff);
return true;
athena::io::FileWriter w(outPath.getAbsolutePath());
dcln.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i = 0; i < 32 - rem; ++i)
w.writeUByte(0xff);
return true;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -9,103 +9,86 @@
#define DCLN_DUMP_OBB 0
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct DCLN : BigDNA
{
using Mesh = hecl::blender::ColMesh;
struct DCLN : BigDNA {
using Mesh = hecl::blender::ColMesh;
AT_DECL_DNA
Value<atUint32> colCount;
struct Collision : BigDNA {
using Material = DeafBabe::Material;
using Edge = DeafBabe::Edge;
using Triangle = DeafBabe::Triangle;
AT_DECL_DNA
Value<atUint32> colCount;
struct Collision : BigDNA
{
using Material = DeafBabe::Material;
using Edge = DeafBabe::Edge;
using Triangle = DeafBabe::Triangle;
Value<atUint32> magic;
Value<atUint32> version;
Value<atUint32> memSize;
Value<atUint32> materialCount;
Vector<Material, AT_DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, AT_DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, AT_DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, AT_DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, AT_DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, AT_DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, AT_DNA_COUNT(vertCount)> verts;
struct Node : BigDNA {
AT_DECL_EXPLICIT_DNA
struct LeafData : BigDNA {
AT_DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
Value<atUint32> memSize;
Value<atUint32> materialCount;
Vector<Material, AT_DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, AT_DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, AT_DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, AT_DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, AT_DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, AT_DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, AT_DNA_COUNT(vertCount)> verts;
Value<atUint32> triangleIndexCount;
Vector<atUint16, AT_DNA_COUNT(triangleIndexCount)> triangleIndices;
size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; }
};
struct Node : BigDNA
{
AT_DECL_EXPLICIT_DNA
Value<atVec4f> xf[3];
Value<atVec3f> halfExtent;
Value<bool> isLeaf;
std::unique_ptr<LeafData> leafData;
std::unique_ptr<Node> left;
std::unique_ptr<Node> right;
struct LeafData : BigDNA
{
AT_DECL_DNA
Value<atUint32> triangleIndexCount;
Vector<atUint16, AT_DNA_COUNT(triangleIndexCount)> triangleIndices;
size_t getMemoryUsage() const { return (((triangleIndices.size() * 2) + 16) + 3) & ~3; }
};
Value<atVec4f> xf[3];
Value<atVec3f> halfExtent;
Value<bool> isLeaf;
std::unique_ptr<LeafData> leafData;
std::unique_ptr<Node> left;
std::unique_ptr<Node> right;
size_t getMemoryUsage() const
{
size_t ret = 80;
if (isLeaf)
ret += leafData->getMemoryUsage();
else
{
ret += left->getMemoryUsage();
ret += right->getMemoryUsage();
}
return (ret + 3) & ~3;
}
#if DCLN_DUMP_OBB
void sendToBlender(hecl::blender::PyOutStream& os) const;
#endif
};
Node root;
size_t getMemoryUsage()
{
return root.getMemoryUsage();
size_t getMemoryUsage() const {
size_t ret = 80;
if (isLeaf)
ret += leafData->getMemoryUsage();
else {
ret += left->getMemoryUsage();
ret += right->getMemoryUsage();
}
/* Dummy MP2 member */
void insertNoClimb(hecl::blender::PyOutStream&) const {}
return (ret + 3) & ~3;
}
#if DCLN_DUMP_OBB
void sendToBlender(hecl::blender::PyOutStream& os) const;
#endif
};
Node root;
size_t getMemoryUsage() { return root.getMemoryUsage(); }
/* Dummy MP2 member */
void insertNoClimb(hecl::blender::PyOutStream&) const {}
};
Vector<Collision, AT_DNA_COUNT(colCount)> collision;
Vector<Collision, AT_DNA_COUNT(colCount)> collision;
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName);
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
const std::vector<Mesh>& meshes);
static bool Cook(const hecl::ProjectPath& outPath, const std::vector<Mesh>& meshes);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -47,419 +47,373 @@
#include "MazeSeeds.hpp"
#include "SnowForces.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
logvisor::Module Log("urde::DNAMP1");
static bool GetNoShare(std::string_view name)
{
std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid"))
return false;
return true;
static bool GetNoShare(std::string_view name) {
std::string lowerName(name);
std::transform(lowerName.begin(), lowerName.end(), lowerName.begin(), tolower);
if (!lowerName.compare(0, 7, "metroid"))
return false;
return true;
}
PAKBridge::PAKBridge(const nod::Node& node, bool doExtract)
: m_node(node), m_pak(false, GetNoShare(node.getName())), m_doExtract(doExtract)
{
nod::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
: m_node(node), m_pak(false, GetNoShare(node.getName())), m_doExtract(doExtract) {
nod::AthenaPartReadStream rs(node.beginReadStream());
m_pak.read(rs);
/* Append Level String */
for (auto& ent : m_pak.m_entries)
{
PAK::Entry& entry = ent.second;
if (entry.type == FOURCC('MLVL'))
{
PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl;
mlvl.read(rs);
PAK::Entry* nameEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldNameId);
if (nameEnt)
{
nameEnt->name = entry.name + "_name";
PAKEntryReadStream rs = nameEnt->beginReadStream(m_node);
STRG mlvlName;
mlvlName.read(rs);
if (m_levelString.size())
m_levelString += _SYS_STR(", ");
m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0);
}
}
/* Append Level String */
for (auto& ent : m_pak.m_entries) {
PAK::Entry& entry = ent.second;
if (entry.type == FOURCC('MLVL')) {
PAKEntryReadStream rs = entry.beginReadStream(m_node);
MLVL mlvl;
mlvl.read(rs);
PAK::Entry* nameEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldNameId);
if (nameEnt) {
nameEnt->name = entry.name + "_name";
PAKEntryReadStream rs = nameEnt->beginReadStream(m_node);
STRG mlvlName;
mlvlName.read(rs);
if (m_levelString.size())
m_levelString += _SYS_STR(", ");
m_levelString += mlvlName.getSystemString(FOURCC('ENGL'), 0);
}
}
}
}
static hecl::SystemString LayerName(std::string_view name)
{
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _SYS_STR('-');
return ret;
static hecl::SystemString LayerName(std::string_view name) {
hecl::SystemString ret(hecl::SystemStringConv(name).sys_str());
for (auto& ch : ret)
if (ch == _SYS_STR('/') || ch == _SYS_STR('\\'))
ch = _SYS_STR('-');
return ret;
}
void PAKBridge::build()
{
/* First pass: build per-area/per-layer dependency map */
for (const auto& ent : m_pak.m_entries)
{
const PAK::Entry& entry = ent.second;
if (entry.type == FOURCC('MLVL'))
{
Level& level = m_levelDeps[entry.id];
void PAKBridge::build() {
/* First pass: build per-area/per-layer dependency map */
for (const auto& ent : m_pak.m_entries) {
const PAK::Entry& entry = ent.second;
if (entry.type == FOURCC('MLVL')) {
Level& level = m_levelDeps[entry.id];
MLVL mlvl;
{
PAKEntryReadStream rs = entry.beginReadStream(m_node);
mlvl.read(rs);
}
bool named;
std::string bestName = m_pak.bestEntryName(m_node, entry, named);
level.name = hecl::SystemStringConv(bestName).sys_str();
level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0;
MLVL mlvl;
{
PAKEntryReadStream rs = entry.beginReadStream(m_node);
mlvl.read(rs);
}
bool named;
std::string bestName = m_pak.bestEntryName(m_node, entry, named);
level.name = hecl::SystemStringConv(bestName).sys_str();
level.areas.reserve(mlvl.areaCount);
unsigned layerIdx = 0;
/* Make MAPW available to lookup MAPAs */
PAK::Entry* worldMapEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldMap);
std::vector<UniqueID32> mapw;
if (worldMapEnt)
{
worldMapEnt->name = entry.name + "_mapw";
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, athena::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i=0 ; i<areaCount ; ++i)
mapw.emplace_back(rs);
}
/* Make MAPW available to lookup MAPAs */
PAK::Entry* worldMapEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldMap);
std::vector<UniqueID32> mapw;
if (worldMapEnt) {
worldMapEnt->name = entry.name + "_mapw";
PAKEntryReadStream rs = worldMapEnt->beginReadStream(m_node);
rs.seek(8, athena::Current);
atUint32 areaCount = rs.readUint32Big();
mapw.reserve(areaCount);
for (atUint32 i = 0; i < areaCount; ++i)
mapw.emplace_back(rs);
}
PAK::Entry* savwEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.saveWorldId);
if (savwEnt)
savwEnt->name = entry.name + "_savw";
PAK::Entry* savwEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.saveWorldId);
if (savwEnt)
savwEnt->name = entry.name + "_savw";
PAK::Entry* skyEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldSkyboxId);
if (skyEnt)
skyEnt->name = entry.name + "_skybox";
PAK::Entry* skyEnt = (PAK::Entry*)m_pak.lookupEntry(mlvl.worldSkyboxId);
if (skyEnt)
skyEnt->name = entry.name + "_skybox";
/* Index areas */
unsigned ai = 0;
for (const MLVL::Area& area : mlvl.areas)
{
Level::Area& areaDeps = level.areas[area.areaMREAId];
MLVL::LayerFlags& layerFlags = mlvl.layerFlags[ai];
PAK::Entry* areaNameEnt = (PAK::Entry*)m_pak.lookupEntry(area.areaNameId);
if (areaNameEnt)
{
STRG areaName;
{
PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node);
areaName.read(rs);
}
areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0);
areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name);
}
if (areaDeps.name.empty())
{
std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name;
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
for (char& ch : lowerName)
{
ch = tolower(ch);
if (ch == ' ')
ch = '_';
}
if (areaNameEnt)
areaNameEnt->name = lowerName + "_name";
PAK::Entry* areaEnt = (PAK::Entry*)m_pak.lookupEntry(area.areaMREAId);
if (areaEnt)
areaEnt->name = lowerName;
areaDeps.layers.reserve(area.depLayerCount-1);
unsigned r=0;
for (unsigned l=1 ; l<area.depLayerCount ; ++l)
{
areaDeps.layers.emplace_back();
Level::Area::Layer& layer = areaDeps.layers.back();
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
layer.active = layerFlags.flags >> (l-1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l-1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);
for (; r<area.depLayers[l] ; ++r)
layer.resources.emplace(area.deps[r].id);
}
areaDeps.resources.reserve(area.depCount - r + 2);
for (; r<area.depCount ; ++r)
areaDeps.resources.emplace(area.deps[r].id);
areaDeps.resources.emplace(area.areaMREAId);
if (mapw.size() > ai)
areaDeps.resources.emplace(mapw[ai]);
++ai;
}
/* Index areas */
unsigned ai = 0;
for (const MLVL::Area& area : mlvl.areas) {
Level::Area& areaDeps = level.areas[area.areaMREAId];
MLVL::LayerFlags& layerFlags = mlvl.layerFlags[ai];
PAK::Entry* areaNameEnt = (PAK::Entry*)m_pak.lookupEntry(area.areaNameId);
if (areaNameEnt) {
STRG areaName;
{
PAKEntryReadStream rs = areaNameEnt->beginReadStream(m_node);
areaName.read(rs);
}
areaDeps.name = areaName.getSystemString(FOURCC('ENGL'), 0);
areaDeps.name = hecl::StringUtils::TrimWhitespace(areaDeps.name);
}
}
if (areaDeps.name.empty()) {
std::string idStr = area.areaMREAId.toString();
areaDeps.name = hecl::SystemString(_SYS_STR("MREA_")) + hecl::SystemStringConv(idStr).c_str();
}
hecl::SystemChar num[16];
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), ai);
areaDeps.name = num + areaDeps.name;
/* Second pass: cross-compare uniqueness */
for (auto& entry : m_pak.m_entries)
{
entry.second.unique.checkEntry(*this, entry.second);
std::string lowerName(hecl::SystemUTF8Conv(areaDeps.name).str());
for (char& ch : lowerName) {
ch = tolower(ch);
if (ch == ' ')
ch = '_';
}
if (areaNameEnt)
areaNameEnt->name = lowerName + "_name";
PAK::Entry* areaEnt = (PAK::Entry*)m_pak.lookupEntry(area.areaMREAId);
if (areaEnt)
areaEnt->name = lowerName;
areaDeps.layers.reserve(area.depLayerCount - 1);
unsigned r = 0;
for (unsigned l = 1; l < area.depLayerCount; ++l) {
areaDeps.layers.emplace_back();
Level::Area::Layer& layer = areaDeps.layers.back();
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
layer.active = layerFlags.flags >> (l - 1) & 0x1;
layer.name = hecl::StringUtils::TrimWhitespace(layer.name);
hecl::SNPrintf(num, 16, _SYS_STR("%02u "), l - 1);
layer.name = num + layer.name;
layer.resources.reserve(area.depLayers[l] - r);
for (; r < area.depLayers[l]; ++r)
layer.resources.emplace(area.deps[r].id);
}
areaDeps.resources.reserve(area.depCount - r + 2);
for (; r < area.depCount; ++r)
areaDeps.resources.emplace(area.deps[r].id);
areaDeps.resources.emplace(area.areaMREAId);
if (mapw.size() > ai)
areaDeps.resources.emplace(mapw[ai]);
++ai;
}
}
}
/* Second pass: cross-compare uniqueness */
for (auto& entry : m_pak.m_entries) {
entry.second.unique.checkEntry(*this, entry.second);
}
}
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries)
{
if (entry.second.type == FOURCC('ANCS'))
{
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
ANCS ancs;
ancs.read(rs);
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters)
{
charAssoc.m_cmdlRigs[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
charAssoc.m_cskrCinfToCharacter[ci.cskr] =
std::make_pair(entry.second.id, hecl::Format("%s.CSKR", ci.name.c_str()));
charAssoc.m_cskrCinfToCharacter[ci.cinf] =
std::make_pair(entry.second.id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32()));
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_model", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_skin", entry.first.toUint32(), ci.name.c_str());
cinfEnt->name = hecl::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
if (ci.cmdlIce && ci.cskrIce)
{
charAssoc.m_cmdlRigs[ci.cmdlIce] = std::make_pair(ci.cskrIce, ci.cinf);
charAssoc.m_cskrCinfToCharacter[ci.cskrIce] =
std::make_pair(entry.second.id, hecl::Format("%s.ICE.CSKR", ci.name.c_str()));
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_icemodel", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_iceskin", entry.first.toUint32(), ci.name.c_str());
}
}
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
ancs.getAnimationResInfo(&pakRouter, animInfo);
for (auto& ae : animInfo)
{
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId);
animEnt->name = hecl::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str());
charAssoc.m_cskrCinfToCharacter[ae.second.animId] =
std::make_pair(entry.second.id, hecl::Format("%s.ANIM", ae.second.name.c_str()));
if (ae.second.evntId)
{
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.evntId);
evntEnt->name = hecl::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str());
charAssoc.m_cskrCinfToCharacter[ae.second.evntId] =
std::make_pair(entry.second.id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str()));
}
}
void PAKBridge::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries) {
if (entry.second.type == FOURCC('ANCS')) {
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
ANCS ancs;
ancs.read(rs);
for (const ANCS::CharacterSet::CharacterInfo& ci : ancs.characterSet.characters) {
charAssoc.m_cmdlRigs[ci.cmdl] = std::make_pair(ci.cskr, ci.cinf);
charAssoc.m_cskrCinfToCharacter[ci.cskr] =
std::make_pair(entry.second.id, hecl::Format("%s.CSKR", ci.name.c_str()));
charAssoc.m_cskrCinfToCharacter[ci.cinf] =
std::make_pair(entry.second.id, hecl::Format("CINF_%08X.CINF", ci.cinf.toUint32()));
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdl);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskr);
PAK::Entry* cinfEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cinf);
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_model", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_skin", entry.first.toUint32(), ci.name.c_str());
cinfEnt->name = hecl::Format("ANCS_%08X_%s_skel", entry.first.toUint32(), ci.name.c_str());
if (ci.cmdlIce && ci.cskrIce) {
charAssoc.m_cmdlRigs[ci.cmdlIce] = std::make_pair(ci.cskrIce, ci.cinf);
charAssoc.m_cskrCinfToCharacter[ci.cskrIce] =
std::make_pair(entry.second.id, hecl::Format("%s.ICE.CSKR", ci.name.c_str()));
PAK::Entry* cmdlEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cmdlIce);
PAK::Entry* cskrEnt = (PAK::Entry*)m_pak.lookupEntry(ci.cskrIce);
cmdlEnt->name = hecl::Format("ANCS_%08X_%s_icemodel", entry.first.toUint32(), ci.name.c_str());
cskrEnt->name = hecl::Format("ANCS_%08X_%s_iceskin", entry.first.toUint32(), ci.name.c_str());
}
else if (entry.second.type == FOURCC('MREA'))
{
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
MREA::AddCMDLRigPairs(rs, pakRouter, charAssoc);
}
std::map<atUint32, DNAANCS::AnimationResInfo<UniqueID32>> animInfo;
ancs.getAnimationResInfo(&pakRouter, animInfo);
for (auto& ae : animInfo) {
PAK::Entry* animEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.animId);
animEnt->name = hecl::Format("ANCS_%08X_%s", entry.first.toUint32(), ae.second.name.c_str());
charAssoc.m_cskrCinfToCharacter[ae.second.animId] =
std::make_pair(entry.second.id, hecl::Format("%s.ANIM", ae.second.name.c_str()));
if (ae.second.evntId) {
PAK::Entry* evntEnt = (PAK::Entry*)m_pak.lookupEntry(ae.second.evntId);
evntEnt->name = hecl::Format("ANCS_%08X_%s_evnt", entry.first.toUint32(), ae.second.name.c_str());
charAssoc.m_cskrCinfToCharacter[ae.second.evntId] =
std::make_pair(entry.second.id, hecl::Format("%s.evnt.yaml", ae.second.name.c_str()));
}
}
} else if (entry.second.type == FOURCC('MREA')) {
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
MREA::AddCMDLRigPairs(rs, pakRouter, charAssoc);
}
}
}
void PAKBridge::addPATHToMREA(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const
{
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries)
{
if (entry.second.type == FOURCC('MREA'))
{
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
UniqueID32 pathID = MREA::GetPATHId(rs);
if (pathID)
pathToMrea[pathID] = entry.first;
}
std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const {
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries) {
if (entry.second.type == FOURCC('MREA')) {
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
UniqueID32 pathID = MREA::GetPATHId(rs);
if (pathID)
pathToMrea[pathID] = entry.first;
}
}
}
static const atVec4f BottomRow = {{0.f, 0.f, 0.f, 1.f}};
void PAKBridge::addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
std::unordered_map<UniqueID32, hecl::ProjectPath>& pathOverrides) const
{
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries)
{
if (entry.second.type == FOURCC('MLVL'))
std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
std::unordered_map<UniqueID32, hecl::ProjectPath>& pathOverrides) const {
for (const std::pair<UniqueID32, PAK::Entry>& entry : m_pak.m_entries) {
if (entry.second.type == FOURCC('MLVL')) {
MLVL mlvl;
{
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
mlvl.read(rs);
}
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas) {
{
MLVL mlvl;
{
PAKEntryReadStream rs = entry.second.beginReadStream(m_node);
mlvl.read(rs);
}
hecl::ProjectPath mlvlDirPath = pakRouter.getWorking(&entry.second).getParentPath();
if (mlvl.worldNameId)
pathOverrides[mlvl.worldNameId] = hecl::ProjectPath(mlvlDirPath, _SYS_STR("!name.yaml"));
for (const MLVL::Area& area : mlvl.areas)
{
{
/* Get PATH transform */
const nod::Node* areaNode;
const PAK::Entry* areaEntry = pakRouter.lookupEntry(area.areaMREAId, &areaNode);
PAKEntryReadStream rs = areaEntry->beginReadStream(*areaNode);
UniqueID32 pathId = MREA::GetPATHId(rs);
if (pathId)
addTo[pathId] = zeus::CMatrix4f(
area.transformMtx[0],
area.transformMtx[1],
area.transformMtx[2],
BottomRow).transposed();
}
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
}
if (mlvl.worldMap)
{
const nod::Node* mapNode;
const PAK::Entry* mapEntry = pakRouter.lookupEntry(mlvl.worldMap, &mapNode);
if (mapEntry)
{
PAKEntryReadStream rs = mapEntry->beginReadStream(*mapNode);
u32 magic = rs.readUint32Big();
if (magic == 0xDEADF00D)
{
rs.readUint32Big();
u32 count = rs.readUint32Big();
for (u32 i=0 ; i<count && i<mlvl.areas.size() ; ++i)
{
MLVL::Area& areaData = mlvl.areas[i];
UniqueID32 mapaId;
mapaId.read(rs);
addTo[mapaId] = zeus::CMatrix4f(
areaData.transformMtx[0],
areaData.transformMtx[1],
areaData.transformMtx[2],
BottomRow).transposed();
}
}
}
}
/* Get PATH transform */
const nod::Node* areaNode;
const PAK::Entry* areaEntry = pakRouter.lookupEntry(area.areaMREAId, &areaNode);
PAKEntryReadStream rs = areaEntry->beginReadStream(*areaNode);
UniqueID32 pathId = MREA::GetPATHId(rs);
if (pathId)
addTo[pathId] = zeus::CMatrix4f(area.transformMtx[0], area.transformMtx[1], area.transformMtx[2], BottomRow)
.transposed();
}
}
}
ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry)
{
switch (entry.type)
{
case SBIG('STRG'):
return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('SCAN'):
return {SCAN::Extract, {_SYS_STR(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'):
return {HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, {_SYS_STR(".yaml")}};
case SBIG('FRME'):
return {FRME::Extract, {_SYS_STR(".blend")}, 2};
case SBIG('CMDL'):
return {CMDL::Extract, {_SYS_STR(".blend")}, 1, CMDL::Name};
case SBIG('DCLN'):
return {DCLN::Extract, {_SYS_STR(".blend")}};
case SBIG('ANCS'):
return {ANCS::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_SYS_STR(".blend")}, 4, MREA::Name};
case SBIG('MAPA'):
return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPU'):
return {MAPU::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PATH'):
return {PATH::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PART'):
return {DNAParticle::ExtractGPSM<UniqueID32>, {_SYS_STR(".gpsm.yaml")}};
case SBIG('ELSC'):
return {DNAParticle::ExtractELSM<UniqueID32>, {_SYS_STR(".elsm.yaml")}};
case SBIG('SWHC'):
return {DNAParticle::ExtractSWSH<UniqueID32>, {_SYS_STR(".swsh.yaml")}};
case SBIG('CRSC'):
return {DNAParticle::ExtractCRSM<UniqueID32>, {_SYS_STR(".crsm.yaml")}};
case SBIG('WPSC'):
return {DNAParticle::ExtractWPSM<UniqueID32>, {_SYS_STR(".wpsm.yaml")}};
case SBIG('DPSC'):
return {DNAParticle::ExtractDPSM<UniqueID32>, {_SYS_STR(".dpsm.yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {}};
case SBIG('CSNG'):
return {CSNG::Extract, {_SYS_STR(".mid"), _SYS_STR(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_SYS_STR(".yaml")}};
case SBIG('CTWK'):
case SBIG('DUMB'):
{
bool named;
std::string name = pak.bestEntryName(pakNode, entry, named);
if (named)
{
if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, {_SYS_STR(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, {_SYS_STR(".yaml")}};
if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, {_SYS_STR(".yaml")}};
if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, {_SYS_STR(".yaml")}};
if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, {_SYS_STR(".yaml")}};
if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_SYS_STR(".yaml")}};
if (!name.compare("Targeting"))
return {ExtractTweak<CTweakTargeting>, {_SYS_STR(".yaml")}};
if (!name.compare("Gui"))
return {ExtractTweak<CTweakGui>, {_SYS_STR(".yaml")}};
if (!name.compare("AutoMapper"))
return {ExtractTweak<CTweakAutoMapper>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerControls") || !name.compare("PlayerControls2"))
return {ExtractTweak<CTweakPlayerControl>, {_SYS_STR(".yaml")}};
if (!name.compare("Ball"))
return {ExtractTweak<CTweakBall>, {_SYS_STR(".yaml")}};
if (!name.compare("Particle"))
return {ExtractTweak<CTweakParticle>, {_SYS_STR(".yaml")}};
if (!name.compare("GuiColors"))
return {ExtractTweak<CTweakGuiColors>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerGun"))
return {ExtractTweak<CTweakPlayerGun>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_MazeSeeds"))
return {ExtractTweak<MazeSeeds>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_SnowForces"))
return {ExtractTweak<SnowForces>, {_SYS_STR(".yaml")}};
hecl::ProjectPath areaDirPath = pakRouter.getWorking(area.areaMREAId).getParentPath();
if (area.areaNameId)
pathOverrides[area.areaNameId] = hecl::ProjectPath(areaDirPath, _SYS_STR("!name.yaml"));
}
if (mlvl.worldMap) {
const nod::Node* mapNode;
const PAK::Entry* mapEntry = pakRouter.lookupEntry(mlvl.worldMap, &mapNode);
if (mapEntry) {
PAKEntryReadStream rs = mapEntry->beginReadStream(*mapNode);
u32 magic = rs.readUint32Big();
if (magic == 0xDEADF00D) {
rs.readUint32Big();
u32 count = rs.readUint32Big();
for (u32 i = 0; i < count && i < mlvl.areas.size(); ++i) {
MLVL::Area& areaData = mlvl.areas[i];
UniqueID32 mapaId;
mapaId.read(rs);
addTo[mapaId] = zeus::CMatrix4f(areaData.transformMtx[0], areaData.transformMtx[1],
areaData.transformMtx[2], BottomRow)
.transposed();
}
}
}
break;
}
}
}
return {};
}
}
ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry) {
switch (entry.type) {
case SBIG('STRG'):
return {STRG::Extract, {_SYS_STR(".yaml")}};
case SBIG('SCAN'):
return {SCAN::Extract, {_SYS_STR(".yaml")}, 0, SCAN::Name};
case SBIG('HINT'):
return {HINT::Extract, {_SYS_STR(".yaml")}};
case SBIG('SAVW'):
return {SAVWCommon::ExtractSAVW<SAVW>, {_SYS_STR(".yaml")}};
case SBIG('TXTR'):
return {TXTR::Extract, {_SYS_STR(".png")}};
case SBIG('AFSM'):
return {AFSM::Extract, {_SYS_STR(".yaml")}};
case SBIG('FRME'):
return {FRME::Extract, {_SYS_STR(".blend")}, 2};
case SBIG('CMDL'):
return {CMDL::Extract, {_SYS_STR(".blend")}, 1, CMDL::Name};
case SBIG('DCLN'):
return {DCLN::Extract, {_SYS_STR(".blend")}};
case SBIG('ANCS'):
return {ANCS::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 2};
case SBIG('MLVL'):
return {MLVL::Extract, {_SYS_STR(".yaml"), _SYS_STR(".blend")}, 3};
case SBIG('MREA'):
return {MREA::Extract, {_SYS_STR(".blend")}, 4, MREA::Name};
case SBIG('MAPA'):
return {MAPA::Extract, {_SYS_STR(".blend")}, 4};
case SBIG('MAPU'):
return {MAPU::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PATH'):
return {PATH::Extract, {_SYS_STR(".blend")}, 5};
case SBIG('PART'):
return {DNAParticle::ExtractGPSM<UniqueID32>, {_SYS_STR(".gpsm.yaml")}};
case SBIG('ELSC'):
return {DNAParticle::ExtractELSM<UniqueID32>, {_SYS_STR(".elsm.yaml")}};
case SBIG('SWHC'):
return {DNAParticle::ExtractSWSH<UniqueID32>, {_SYS_STR(".swsh.yaml")}};
case SBIG('CRSC'):
return {DNAParticle::ExtractCRSM<UniqueID32>, {_SYS_STR(".crsm.yaml")}};
case SBIG('WPSC'):
return {DNAParticle::ExtractWPSM<UniqueID32>, {_SYS_STR(".wpsm.yaml")}};
case SBIG('DPSC'):
return {DNAParticle::ExtractDPSM<UniqueID32>, {_SYS_STR(".dpsm.yaml")}};
case SBIG('FONT'):
return {DNAFont::ExtractFONT<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('DGRP'):
return {DNADGRP::ExtractDGRP<UniqueID32>, {_SYS_STR(".yaml")}};
case SBIG('AGSC'):
return {AGSC::Extract, {}};
case SBIG('CSNG'):
return {CSNG::Extract, {_SYS_STR(".mid"), _SYS_STR(".yaml")}};
case SBIG('ATBL'):
return {DNAAudio::ATBL::Extract, {_SYS_STR(".yaml")}};
case SBIG('CTWK'):
case SBIG('DUMB'): {
bool named;
std::string name = pak.bestEntryName(pakNode, entry, named);
if (named) {
if (!name.compare("PlayerRes"))
return {ExtractTweak<CTweakPlayerRes>, {_SYS_STR(".yaml")}};
if (!name.compare("GunRes"))
return {ExtractTweak<CTweakGunRes>, {_SYS_STR(".yaml")}};
if (!name.compare("Player"))
return {ExtractTweak<CTweakPlayer>, {_SYS_STR(".yaml")}};
if (!name.compare("CameraBob"))
return {ExtractTweak<CTweakCameraBob>, {_SYS_STR(".yaml")}};
if (!name.compare("SlideShow"))
return {ExtractTweak<CTweakSlideShow>, {_SYS_STR(".yaml")}};
if (!name.compare("Game"))
return {ExtractTweak<CTweakGame>, {_SYS_STR(".yaml")}};
if (!name.compare("Targeting"))
return {ExtractTweak<CTweakTargeting>, {_SYS_STR(".yaml")}};
if (!name.compare("Gui"))
return {ExtractTweak<CTweakGui>, {_SYS_STR(".yaml")}};
if (!name.compare("AutoMapper"))
return {ExtractTweak<CTweakAutoMapper>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerControls") || !name.compare("PlayerControls2"))
return {ExtractTweak<CTweakPlayerControl>, {_SYS_STR(".yaml")}};
if (!name.compare("Ball"))
return {ExtractTweak<CTweakBall>, {_SYS_STR(".yaml")}};
if (!name.compare("Particle"))
return {ExtractTweak<CTweakParticle>, {_SYS_STR(".yaml")}};
if (!name.compare("GuiColors"))
return {ExtractTweak<CTweakGuiColors>, {_SYS_STR(".yaml")}};
if (!name.compare("PlayerGun"))
return {ExtractTweak<CTweakPlayerGun>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_MazeSeeds"))
return {ExtractTweak<MazeSeeds>, {_SYS_STR(".yaml")}};
if (!name.compare("DUMB_SnowForces"))
return {ExtractTweak<SnowForces>, {_SYS_STR(".yaml")}};
}
break;
}
}
return {};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,40 +4,36 @@
#include "PAK.hpp"
#include "zeus/CMatrix4f.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
extern logvisor::Module Log;
/* MP1-specific, one-shot PAK traversal/extraction class */
class PAKBridge
{
const nod::Node& m_node;
PAK m_pak;
class PAKBridge {
const nod::Node& m_node;
PAK m_pak;
public:
bool m_doExtract;
using Level = DataSpec::Level<UniqueID32>;
std::unordered_map<UniqueID32, Level> m_levelDeps;
hecl::SystemString m_levelString;
bool m_doExtract;
using Level = DataSpec::Level<UniqueID32>;
std::unordered_map<UniqueID32, Level> m_levelDeps;
hecl::SystemString m_levelString;
PAKBridge(const nod::Node& node, bool doExtract=true);
void build();
static ResExtractor<PAKBridge> LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry);
std::string_view getName() const {return m_node.getName();}
hecl::SystemStringView getLevelString() const {return m_levelString;}
using PAKType = PAK;
const PAKType& getPAK() const {return m_pak;}
const nod::Node& getNode() const {return m_node;}
PAKBridge(const nod::Node& node, bool doExtract = true);
void build();
static ResExtractor<PAKBridge> LookupExtractor(const nod::Node& pakNode, const PAK& pak, const PAK::Entry& entry);
std::string_view getName() const { return m_node.getName(); }
hecl::SystemStringView getLevelString() const { return m_levelString; }
using PAKType = PAK;
const PAKType& getPAK() const { return m_pak; }
const nod::Node& getNode() const { return m_node; }
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
void addPATHToMREA(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const;
void addPATHToMREA(PAKRouter<PAKBridge>& pakRouter, std::unordered_map<UniqueID32, UniqueID32>& pathToMrea) const;
void addMAPATransforms(PAKRouter<PAKBridge>& pakRouter,
std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
std::unordered_map<UniqueID32, hecl::ProjectPath>& pathOverrides) const;
void addMAPATransforms(PAKRouter<PAKBridge>& pakRouter, std::unordered_map<UniqueID32, zeus::CMatrix4f>& addTo,
std::unordered_map<UniqueID32, hecl::ProjectPath>& pathOverrides) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,233 +1,232 @@
#include "DeafBabe.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
void DeafBabe::BlenderInit(hecl::blender::PyOutStream& os)
{
os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n"
" 'Stone':(1.0, 0.43, 0.15),\n"
" 'Metal':(0.5, 0.5, 0.5),\n"
" 'Grass':(0.0, 0.42, 0.01),"
" 'Ice':(0.0, 0.1, 0.1),\n"
" 'Metal Grating':(0.09, 0.09, 0.09),\n"
" 'Phazon':(0.24, 0.0, 0.21),\n"
" 'Dirt':(0.1, 0.07, 0.05),\n"
" 'Stone':(0.12, 0.12, 0.12),\n"
" 'Lava':(0.8, 0.15, 0.0),\n"
" 'Stone/Rock':(0.06, 0.05, 0.03),\n"
" 'Snow':(0.9, 1.0, 1.0),\n"
" 'Mud (Slow)':(0.12, 0.06, 0.02),\n"
" 'Mud':(0.12, 0.06, 0.02),\n"
" 'Glass':(0.27, 0.38, 0.9),\n"
" 'Shield':(1.0, 0.6, 0.0),\n"
" 'Sand':(0.53, 0.44, 0.21),\n"
" 'Wood':(0.30, 0.15, 0.03),\n"
" 'Organic':(0.19, 0.45, 0.2)}\n"
"\n"
"# Diffuse Color Maker\n"
"def make_color(index, mat_type, name):\n"
" new_mat = bpy.data.materials.new(name)\n"
" if mat_type in TYPE_COLORS:\n"
" new_mat.diffuse_color = TYPE_COLORS[mat_type]\n"
" else:\n"
" new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n"
" return new_mat\n"
"\n"
"bpy.types.Material.retro_unknown = bpy.props.BoolProperty(name='Retro: Unknown (U)')\n"
"bpy.types.Material.retro_surface_stone = bpy.props.BoolProperty(name='Retro Surface: Stone')\n"
"bpy.types.Material.retro_surface_metal = bpy.props.BoolProperty(name='Retro Surface: Metal')\n"
"bpy.types.Material.retro_surface_grass = bpy.props.BoolProperty(name='Retro Surface: Grass')\n"
"bpy.types.Material.retro_surface_ice = bpy.props.BoolProperty(name='Retro Surface: Ice')\n"
"bpy.types.Material.retro_pillar = bpy.props.BoolProperty(name='Retro Pillar (I)')\n"
"bpy.types.Material.retro_surface_metal_grating = bpy.props.BoolProperty(name='Retro Surface: Metal Grating')\n"
"bpy.types.Material.retro_surface_phazon = bpy.props.BoolProperty(name='Retro Surface: Phazon')\n"
"bpy.types.Material.retro_surface_dirt = bpy.props.BoolProperty(name='Retro Surface: Rock')\n"
"bpy.types.Material.retro_surface_lava = bpy.props.BoolProperty(name='Retro Surface: Lava')\n"
"bpy.types.Material.retro_surface_lava_stone = bpy.props.BoolProperty(name='Retro Surface: Lava Stone')\n"
"bpy.types.Material.retro_surface_snow = bpy.props.BoolProperty(name='Retro Surface: Snow')\n"
"bpy.types.Material.retro_surface_mud_slow = bpy.props.BoolProperty(name='Retro Surface: Mud (Slow)')\n"
"bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe (H)')\n"
"bpy.types.Material.retro_surface_mud = bpy.props.BoolProperty(name='Retro Surface: Mud')\n"
"bpy.types.Material.retro_surface_glass = bpy.props.BoolProperty(name='Retro Surface: Glass')\n"
"bpy.types.Material.retro_surface_shield = bpy.props.BoolProperty(name='Retro Surface: Shield')\n"
"bpy.types.Material.retro_surface_sand = bpy.props.BoolProperty(name='Retro Surface: Sand')\n"
"bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough (P)')\n"
"bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid (K)')\n"
"bpy.types.Material.retro_no_platform_collision = bpy.props.BoolProperty(name='Retro: No Platform Collision')\n"
"bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough (O)')\n"
"bpy.types.Material.retro_surface_wood = bpy.props.BoolProperty(name='Retro Surface: Wood')\n"
"bpy.types.Material.retro_surface_organic = bpy.props.BoolProperty(name='Retro Surface: Organic')\n"
"bpy.types.Material.retro_no_edge_collision = bpy.props.BoolProperty(name='Retro: No Edge Collision')\n"
"bpy.types.Material.retro_see_through = bpy.props.BoolProperty(name='Retro: See Through')\n"
"bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough (S)')\n"
"bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough (A)')\n"
"bpy.types.Material.retro_ceiling = bpy.props.BoolProperty(name='Retro: Ceiling (C)')\n"
"bpy.types.Material.retro_wall = bpy.props.BoolProperty(name='Retro: Wall (W)')\n"
"bpy.types.Material.retro_floor = bpy.props.BoolProperty(name='Retro: Floor (F)')\n"
"\n"
"material_dict = {}\n"
"material_index = []\n"
"def get_type_id(data):\n"
"\n"
" ret = 0\n"
" for i in range(1, 24):\n"
" if i == 5 or i == 13 or i in range(18, 22):\n"
" continue\n"
" if ((data >> i) & 1):\n"
" ret = i\n"
" return ret\n"
"\n"
"def select_material(data):\n"
"\n"
" type_id = get_type_id(data)\n"
" mat_type = str(type_id)\n"
" if type_id == 0:\n"
" mat_type = 'NoSFX'\n"
" if type_id == 1:\n"
" mat_type = 'Stone'\n"
" elif type_id == 2:\n"
" mat_type = 'Metal'\n"
" elif type_id == 3:\n"
" mat_type = 'Grass'\n"
" elif type_id == 4:\n"
" mat_type = 'Ice'\n"
" elif type_id == 6:\n"
" mat_type = 'Metal Grating'\n"
" elif type_id == 7:\n"
" mat_type = 'Phazon'\n"
" elif type_id == 8:\n"
" mat_type = 'Dirt'\n"
" elif type_id == 9:\n"
" mat_type = 'Lava'\n"
" elif type_id == 10:\n"
" mat_type = 'Stone/Rock'\n"
" elif type_id == 11:\n"
" mat_type = 'Snow'\n"
" elif type_id == 12:\n"
" mat_type = 'Mud (Slow)'\n"
" elif type_id == 14:\n"
" mat_type = 'Mud'\n"
" elif type_id == 15:\n"
" mat_type = 'Glass'\n"
" elif type_id == 16:\n"
" mat_type = 'Shield'\n"
" elif type_id == 17:\n"
" mat_type = 'Sand'\n"
" elif type_id == 22:\n"
" mat_type = 'Wood'\n"
" elif type_id == 23:\n"
" mat_type = 'Organic'\n"
"\n"
" mat_flags = ''\n"
" if ((data >> 0) & 1):\n"
" mat_flags += 'U'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 5) & 1):\n"
" mat_flags += 'I'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 13) & 1):\n"
" mat_flags += 'H'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 18) & 1):\n"
" mat_flags += 'P'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 19) & 1):\n"
" mat_flags += 'K'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 20) & 1):\n"
" mat_flags += 'u'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 21) & 1):\n"
" mat_flags += 'O'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 24) & 1):\n"
" mat_flags += 'u'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 26) & 1):\n"
" mat_flags += 'T'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 27) & 1):\n"
" mat_flags += 'S'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 28) & 1):\n"
" mat_flags += 'A'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 29) & 1):\n"
" mat_flags += 'C'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 30) & 1):\n"
" mat_flags += 'W'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 31) & 1):\n"
" mat_flags += 'F'\n"
" else:\n"
" mat_flags += 'x'\n"
"\n"
" if len(mat_flags) > 0:\n"
" mat_flags = ' ' + mat_flags\n"
"\n"
" mat_name = mat_type + mat_flags\n"
"\n"
" if mat_name in material_index:\n"
" return material_index.index(mat_name)\n"
" elif mat_name in material_dict:\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
" else:\n"
" mat = make_color(len(material_dict), mat_type, mat_name)\n"
" mat.diffuse_intensity = 1.0\n"
" mat.specular_intensity = 0.0\n"
" mat.retro_unknown = ((data >> 0) & 1)\n"
" mat.retro_surface_stone = ((data >> 1) & 1)\n"
" mat.retro_surface_metal = ((data >> 2) & 1)\n"
" mat.retro_surface_grass = ((data >> 3) & 1) \n"
" mat.retro_surface_ice = ((data >> 4) & 1)\n"
" mat.retro_pillar = ((data >> 5) & 1)\n"
" mat.retro_surface_metal_grating = ((data >> 6) & 1)\n"
" mat.retro_surface_phazon = ((data >> 7) & 1)\n"
" mat.retro_surface_dirt = ((data >> 8) & 1)\n"
" mat.retro_surface_lava = ((data >> 9) & 1)\n"
" mat.retro_surface_lava_stone = ((data >> 10) & 1)\n"
" mat.retro_surface_snow = ((data >> 11) & 1)\n"
" mat.retro_surface_mud_slow = ((data >> 12) & 1)\n"
" mat.retro_half_pipe = ((data >> 13) & 1)\n"
" mat.retro_surface_mud = ((data >> 14) & 1)\n"
" mat.retro_surface_glass = ((data >> 15) & 1)\n"
" mat.retro_surface_shield = ((data >> 16) & 1)\n"
" mat.retro_surface_sand = ((data >> 17) & 1)\n"
" mat.retro_projectile_passthrough = ((data >> 18) & 1)\n"
" mat.retro_solid = ((data >> 19) & 1)\n"
" mat.retro_no_platform_collision = ((data >> 20) & 1)\n"
" mat.retro_camera_passthrough = ((data >> 21) & 1)\n"
" mat.retro_surface_wood = ((data >> 22) & 1)\n"
" mat.retro_surface_organic = ((data >> 23) & 1)\n"
" mat.retro_no_edge_collision = ((data >> 24) & 1)\n"
" mat.retro_see_through = ((data >> 26) & 1)\n"
" mat.retro_scan_passthrough = ((data >> 27) & 1)\n"
" mat.retro_ai_passthrough = ((data >> 28) & 1)\n"
" mat.retro_ceiling = ((data >> 29) & 1)\n"
" mat.retro_wall= ((data >> 30) & 1)\n"
" mat.retro_floor = ((data >> 31) & 1)\n"
" material_dict[mat_name] = mat\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
"\n"
"\n";
void DeafBabe::BlenderInit(hecl::blender::PyOutStream& os) {
os << "TYPE_COLORS = {'NoSFX':(0.0, 0.0, 0.0),\n"
" 'Stone':(1.0, 0.43, 0.15),\n"
" 'Metal':(0.5, 0.5, 0.5),\n"
" 'Grass':(0.0, 0.42, 0.01),"
" 'Ice':(0.0, 0.1, 0.1),\n"
" 'Metal Grating':(0.09, 0.09, 0.09),\n"
" 'Phazon':(0.24, 0.0, 0.21),\n"
" 'Dirt':(0.1, 0.07, 0.05),\n"
" 'Stone':(0.12, 0.12, 0.12),\n"
" 'Lava':(0.8, 0.15, 0.0),\n"
" 'Stone/Rock':(0.06, 0.05, 0.03),\n"
" 'Snow':(0.9, 1.0, 1.0),\n"
" 'Mud (Slow)':(0.12, 0.06, 0.02),\n"
" 'Mud':(0.12, 0.06, 0.02),\n"
" 'Glass':(0.27, 0.38, 0.9),\n"
" 'Shield':(1.0, 0.6, 0.0),\n"
" 'Sand':(0.53, 0.44, 0.21),\n"
" 'Wood':(0.30, 0.15, 0.03),\n"
" 'Organic':(0.19, 0.45, 0.2)}\n"
"\n"
"# Diffuse Color Maker\n"
"def make_color(index, mat_type, name):\n"
" new_mat = bpy.data.materials.new(name)\n"
" if mat_type in TYPE_COLORS:\n"
" new_mat.diffuse_color = TYPE_COLORS[mat_type]\n"
" else:\n"
" new_mat.diffuse_color.hsv = ((index / 6.0) % 1.0, 1.0-((index // 6) / 6.0), 1)\n"
" return new_mat\n"
"\n"
"bpy.types.Material.retro_unknown = bpy.props.BoolProperty(name='Retro: Unknown (U)')\n"
"bpy.types.Material.retro_surface_stone = bpy.props.BoolProperty(name='Retro Surface: Stone')\n"
"bpy.types.Material.retro_surface_metal = bpy.props.BoolProperty(name='Retro Surface: Metal')\n"
"bpy.types.Material.retro_surface_grass = bpy.props.BoolProperty(name='Retro Surface: Grass')\n"
"bpy.types.Material.retro_surface_ice = bpy.props.BoolProperty(name='Retro Surface: Ice')\n"
"bpy.types.Material.retro_pillar = bpy.props.BoolProperty(name='Retro Pillar (I)')\n"
"bpy.types.Material.retro_surface_metal_grating = bpy.props.BoolProperty(name='Retro Surface: Metal Grating')\n"
"bpy.types.Material.retro_surface_phazon = bpy.props.BoolProperty(name='Retro Surface: Phazon')\n"
"bpy.types.Material.retro_surface_dirt = bpy.props.BoolProperty(name='Retro Surface: Rock')\n"
"bpy.types.Material.retro_surface_lava = bpy.props.BoolProperty(name='Retro Surface: Lava')\n"
"bpy.types.Material.retro_surface_lava_stone = bpy.props.BoolProperty(name='Retro Surface: Lava Stone')\n"
"bpy.types.Material.retro_surface_snow = bpy.props.BoolProperty(name='Retro Surface: Snow')\n"
"bpy.types.Material.retro_surface_mud_slow = bpy.props.BoolProperty(name='Retro Surface: Mud (Slow)')\n"
"bpy.types.Material.retro_half_pipe = bpy.props.BoolProperty(name='Retro: Half Pipe (H)')\n"
"bpy.types.Material.retro_surface_mud = bpy.props.BoolProperty(name='Retro Surface: Mud')\n"
"bpy.types.Material.retro_surface_glass = bpy.props.BoolProperty(name='Retro Surface: Glass')\n"
"bpy.types.Material.retro_surface_shield = bpy.props.BoolProperty(name='Retro Surface: Shield')\n"
"bpy.types.Material.retro_surface_sand = bpy.props.BoolProperty(name='Retro Surface: Sand')\n"
"bpy.types.Material.retro_projectile_passthrough = bpy.props.BoolProperty(name='Retro: Projectile Passthrough "
"(P)')\n"
"bpy.types.Material.retro_solid = bpy.props.BoolProperty(name='Retro: Solid (K)')\n"
"bpy.types.Material.retro_no_platform_collision = bpy.props.BoolProperty(name='Retro: No Platform Collision')\n"
"bpy.types.Material.retro_camera_passthrough = bpy.props.BoolProperty(name='Retro: Camera Passthrough (O)')\n"
"bpy.types.Material.retro_surface_wood = bpy.props.BoolProperty(name='Retro Surface: Wood')\n"
"bpy.types.Material.retro_surface_organic = bpy.props.BoolProperty(name='Retro Surface: Organic')\n"
"bpy.types.Material.retro_no_edge_collision = bpy.props.BoolProperty(name='Retro: No Edge Collision')\n"
"bpy.types.Material.retro_see_through = bpy.props.BoolProperty(name='Retro: See Through')\n"
"bpy.types.Material.retro_scan_passthrough = bpy.props.BoolProperty(name='Retro: Scan Passthrough (S)')\n"
"bpy.types.Material.retro_ai_passthrough = bpy.props.BoolProperty(name='Retro: AI Passthrough (A)')\n"
"bpy.types.Material.retro_ceiling = bpy.props.BoolProperty(name='Retro: Ceiling (C)')\n"
"bpy.types.Material.retro_wall = bpy.props.BoolProperty(name='Retro: Wall (W)')\n"
"bpy.types.Material.retro_floor = bpy.props.BoolProperty(name='Retro: Floor (F)')\n"
"\n"
"material_dict = {}\n"
"material_index = []\n"
"def get_type_id(data):\n"
"\n"
" ret = 0\n"
" for i in range(1, 24):\n"
" if i == 5 or i == 13 or i in range(18, 22):\n"
" continue\n"
" if ((data >> i) & 1):\n"
" ret = i\n"
" return ret\n"
"\n"
"def select_material(data):\n"
"\n"
" type_id = get_type_id(data)\n"
" mat_type = str(type_id)\n"
" if type_id == 0:\n"
" mat_type = 'NoSFX'\n"
" if type_id == 1:\n"
" mat_type = 'Stone'\n"
" elif type_id == 2:\n"
" mat_type = 'Metal'\n"
" elif type_id == 3:\n"
" mat_type = 'Grass'\n"
" elif type_id == 4:\n"
" mat_type = 'Ice'\n"
" elif type_id == 6:\n"
" mat_type = 'Metal Grating'\n"
" elif type_id == 7:\n"
" mat_type = 'Phazon'\n"
" elif type_id == 8:\n"
" mat_type = 'Dirt'\n"
" elif type_id == 9:\n"
" mat_type = 'Lava'\n"
" elif type_id == 10:\n"
" mat_type = 'Stone/Rock'\n"
" elif type_id == 11:\n"
" mat_type = 'Snow'\n"
" elif type_id == 12:\n"
" mat_type = 'Mud (Slow)'\n"
" elif type_id == 14:\n"
" mat_type = 'Mud'\n"
" elif type_id == 15:\n"
" mat_type = 'Glass'\n"
" elif type_id == 16:\n"
" mat_type = 'Shield'\n"
" elif type_id == 17:\n"
" mat_type = 'Sand'\n"
" elif type_id == 22:\n"
" mat_type = 'Wood'\n"
" elif type_id == 23:\n"
" mat_type = 'Organic'\n"
"\n"
" mat_flags = ''\n"
" if ((data >> 0) & 1):\n"
" mat_flags += 'U'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 5) & 1):\n"
" mat_flags += 'I'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 13) & 1):\n"
" mat_flags += 'H'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 18) & 1):\n"
" mat_flags += 'P'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 19) & 1):\n"
" mat_flags += 'K'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 20) & 1):\n"
" mat_flags += 'u'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 21) & 1):\n"
" mat_flags += 'O'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 24) & 1):\n"
" mat_flags += 'u'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 26) & 1):\n"
" mat_flags += 'T'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 27) & 1):\n"
" mat_flags += 'S'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 28) & 1):\n"
" mat_flags += 'A'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 29) & 1):\n"
" mat_flags += 'C'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 30) & 1):\n"
" mat_flags += 'W'\n"
" else:\n"
" mat_flags += 'x'\n"
" if ((data >> 31) & 1):\n"
" mat_flags += 'F'\n"
" else:\n"
" mat_flags += 'x'\n"
"\n"
" if len(mat_flags) > 0:\n"
" mat_flags = ' ' + mat_flags\n"
"\n"
" mat_name = mat_type + mat_flags\n"
"\n"
" if mat_name in material_index:\n"
" return material_index.index(mat_name)\n"
" elif mat_name in material_dict:\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
" else:\n"
" mat = make_color(len(material_dict), mat_type, mat_name)\n"
" mat.diffuse_intensity = 1.0\n"
" mat.specular_intensity = 0.0\n"
" mat.retro_unknown = ((data >> 0) & 1)\n"
" mat.retro_surface_stone = ((data >> 1) & 1)\n"
" mat.retro_surface_metal = ((data >> 2) & 1)\n"
" mat.retro_surface_grass = ((data >> 3) & 1) \n"
" mat.retro_surface_ice = ((data >> 4) & 1)\n"
" mat.retro_pillar = ((data >> 5) & 1)\n"
" mat.retro_surface_metal_grating = ((data >> 6) & 1)\n"
" mat.retro_surface_phazon = ((data >> 7) & 1)\n"
" mat.retro_surface_dirt = ((data >> 8) & 1)\n"
" mat.retro_surface_lava = ((data >> 9) & 1)\n"
" mat.retro_surface_lava_stone = ((data >> 10) & 1)\n"
" mat.retro_surface_snow = ((data >> 11) & 1)\n"
" mat.retro_surface_mud_slow = ((data >> 12) & 1)\n"
" mat.retro_half_pipe = ((data >> 13) & 1)\n"
" mat.retro_surface_mud = ((data >> 14) & 1)\n"
" mat.retro_surface_glass = ((data >> 15) & 1)\n"
" mat.retro_surface_shield = ((data >> 16) & 1)\n"
" mat.retro_surface_sand = ((data >> 17) & 1)\n"
" mat.retro_projectile_passthrough = ((data >> 18) & 1)\n"
" mat.retro_solid = ((data >> 19) & 1)\n"
" mat.retro_no_platform_collision = ((data >> 20) & 1)\n"
" mat.retro_camera_passthrough = ((data >> 21) & 1)\n"
" mat.retro_surface_wood = ((data >> 22) & 1)\n"
" mat.retro_surface_organic = ((data >> 23) & 1)\n"
" mat.retro_no_edge_collision = ((data >> 24) & 1)\n"
" mat.retro_see_through = ((data >> 26) & 1)\n"
" mat.retro_scan_passthrough = ((data >> 27) & 1)\n"
" mat.retro_ai_passthrough = ((data >> 28) & 1)\n"
" mat.retro_ceiling = ((data >> 29) & 1)\n"
" mat.retro_wall= ((data >> 30) & 1)\n"
" mat.retro_floor = ((data >> 31) & 1)\n"
" material_dict[mat_name] = mat\n"
" material_index.append(mat_name)\n"
" return len(material_index)-1\n"
"\n"
"\n";
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -2,152 +2,239 @@
#include "DataSpec/DNACommon/DeafBabe.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct DeafBabe : BigDNA
{
struct DeafBabe : BigDNA {
AT_DECL_DNA
using BspNodeType = DataSpec::BspNodeType;
struct Material : BigDNA {
AT_DECL_DNA
using BspNodeType = DataSpec::BspNodeType;
struct Material : BigDNA
{
AT_DECL_DNA
Value<atUint32> material = 0;
bool unknown() const { return material & 1; }
void setUnknown(bool v) { material &= ~1; material |= int(v); }
bool surfaceStone() const { return (material >> 1) & 1; }
void setSurfaceStone(bool v) { material &= ~(1ull << 1); material |= (v << 1); }
bool surfaceMetal() const { return (material >> 2) & 1; }
void setSurfaceMetal(bool v) { material &= ~(1ull << 2); material |= (v << 2); }
bool surfaceGrass() const { return (material >> 3) & 1; }
void setSurfaceGrass(bool v) { material &= ~(1ull << 3); material |= (v << 3); }
bool surfaceIce() const { return (material >> 4) & 1; }
void setSurfaceIce(bool v) { material &= ~(1ull << 4); material |= (v << 4); }
bool pillar() const { return (material >> 5) & 1; }
void setPillar(bool v) { material &= ~(1ull << 5); material |= (v << 5); }
bool surfaceMetalGrating() const { return (material >> 6) & 1; }
void setSurfaceMetalGrating(bool v) { material &= ~(1ull << 6); material |= (v << 6); }
bool surfacePhazon() const { return (material >> 7) & 1; }
void setSurfacePhazon(bool v) { material &= ~(1ull << 7); material |= (v << 7); }
bool surfaceDirt() const { return (material >> 8) & 1; }
void setSurfaceDirt(bool v) { material &= ~(1ull << 8); material |= (v << 8); }
bool surfaceLava() const {return (material >> 9) & 1; }
void setSurfaceLava(bool v) { material &= ~(1ull << 9); material |= (v << 9); }
bool surfaceStoneRock() const { return (material >> 10) & 1; }
void setSurfaceLavaStone(bool v) { material &= ~(1ull << 10); material |= (v << 10); }
bool surfaceSnow() const { return (material >> 11) & 1; }
void setSurfaceSnow(bool v) { material &= ~(1ull << 11); material |= (v << 11); }
bool surfaceMudSlow() const { return (material >> 12) & 1; }
void setSurfaceMudSlow(bool v) { material &= ~(1ull << 12); material |= (v << 12); }
bool halfPipe() const { return (material >> 13) & 1; }
void setHalfPipe(bool v) { material &= ~(1ull << 13); material |= (v << 13); }
bool surfaceMud() const { return (material >> 14) & 1; }
void setSurfaceMud(bool v) { material &= ~(1ull << 14); material |= (v << 14); }
bool surfaceGlass() const { return (material >> 15) & 1; }
void setSurfaceGlass(bool v) { material &= ~(1ull << 15); material |= (v << 15); }
bool surfaceShield() const { return (material >> 16) & 1; }
void setSurfaceShield(bool v) { material &= ~(1ull << 16); material |= (v << 16); }
bool surfaceSand() const { return (material >> 17) & 1; }
void setSurfaceSand(bool v) { material &= ~(1ull << 17); material |= (v << 17); }
bool projectilePassthrough() const { return (material >> 18) & 1; }
void setProjectilePassthrough(bool v) { material &= ~(1ull << 18); material |= (v << 18); }
bool solid() const { return (material >> 19) & 1; }
void setSolid(bool v) { material &= ~(1ull << 19); material |= (v << 19); }
bool noPlatformCollision() const { return (material >> 20) & 1; }
void setNoPlatformCollision(bool v) { material &= ~(1ull << 20); material |= (v << 20); }
bool cameraPassthrough() const { return (material >> 21) & 1; }
void setCameraPassthrough(bool v) { material &= ~(1ull << 21); material |= (v << 21); }
bool surfaceWood() const { return (material >> 22) & 1; }
void setSurfaceWood(bool v) { material &= ~(1ull << 22); material |= (v << 22); }
bool surfaceOrganic() const { return (material >> 23) & 1; }
void setSurfaceOrganic(bool v) { material &= ~(1ull << 23); material |= (v << 23); }
bool noEdgeCollision() const { return (material >> 24) & 1; }
void setNoEdgeCollision(bool v) { material &= ~(1ull << 24); material |= (v << 24); }
bool flipFace() const { return (material >> 25) & 1; }
void setFlipFace(bool v) { material &= ~(1ull << 25); material |= (v << 25); }
bool seeThrough() const { return (material >> 26) & 1; }
void setSeeThrough(bool v) { material &= ~(1ull << 26); material |= (v << 26); }
bool scanPassthrough() const { return (material >> 27) & 1; }
void setScanPassthrough(bool v) { material &= ~(1ull << 27); material |= (v << 27); }
bool aiPassthrough() const { return (material >> 28) & 1; }
void setAiPassthrough(bool v) { material &= ~(1ull << 28); material |= (v << 28); }
bool ceiling() const { return (material >> 29) & 1; }
void setCeiling(bool v) { material &= ~(1ull << 29); material |= (v << 29); }
bool wall() const { return (material >> 30) & 1; }
void setWall(bool v) { material &= ~(1ull << 30); material |= (v << 30); }
bool floor() const { return (material >> 31) & 1; }
void setFloor(bool v) { material &= ~(1ull << 31); material |= (v << 31); }
/* Dummies for later games */
bool surfaceSPMetal() const { return false; }
void setSurfaceSPMetal(bool v) { }
bool surfaceFabric() const { return false; }
void setSurfaceFabric(bool v) { }
bool surfaceRubber() const { return false; }
void setSurfaceRubber(bool v) { }
bool surfaceMothOrSeedOrganics() const { return false; }
void setSurfaceMothOrSeedOrganics(bool v) { }
bool surfaceWeb() const { return false; }
void setSurfaceWeb(bool v) { }
bool unused3() const { return false; }
void setUnused3(bool v) {}
bool unused4() const { return false; }
void setUnused4(bool v) {}
bool aiBlock() const { return false; }
void setAiBlock(bool v) { }
bool jumpNotAllowed() const { return false; }
void setJumpNotAllowed(bool v) { }
bool spiderBall() const { return false; }
void setSpiderBall(bool v) { }
bool screwAttackWallJump() const { return false; }
void setScrewAttackWallJump(bool v) { }
};
struct Edge : BigDNA
{
AT_DECL_DNA
Value<atUint16> verts[2];
};
struct Triangle : BigDNA
{
AT_DECL_DNA
Value<atUint16> edges[3];
};
Value<atUint32> unk1;
Value<atUint32> length;
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec3f> aabb[2];
Value<BspNodeType> rootNodeType;
Value<atUint32> bspSize;
Buffer<AT_DNA_COUNT(bspSize)> bspTree;
Value<atUint32> materialCount;
Vector<Material, AT_DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, AT_DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, AT_DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, AT_DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, AT_DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, AT_DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, AT_DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
void insertNoClimb(hecl::blender::PyOutStream&) const {}
static void BlenderInit(hecl::blender::PyOutStream& os);
void sendToBlender(hecl::blender::PyOutStream& os) const
{
DeafBabeSendToBlender(os, *this);
Value<atUint32> material = 0;
bool unknown() const { return material & 1; }
void setUnknown(bool v) {
material &= ~1;
material |= int(v);
}
bool surfaceStone() const { return (material >> 1) & 1; }
void setSurfaceStone(bool v) {
material &= ~(1ull << 1);
material |= (v << 1);
}
bool surfaceMetal() const { return (material >> 2) & 1; }
void setSurfaceMetal(bool v) {
material &= ~(1ull << 2);
material |= (v << 2);
}
bool surfaceGrass() const { return (material >> 3) & 1; }
void setSurfaceGrass(bool v) {
material &= ~(1ull << 3);
material |= (v << 3);
}
bool surfaceIce() const { return (material >> 4) & 1; }
void setSurfaceIce(bool v) {
material &= ~(1ull << 4);
material |= (v << 4);
}
bool pillar() const { return (material >> 5) & 1; }
void setPillar(bool v) {
material &= ~(1ull << 5);
material |= (v << 5);
}
bool surfaceMetalGrating() const { return (material >> 6) & 1; }
void setSurfaceMetalGrating(bool v) {
material &= ~(1ull << 6);
material |= (v << 6);
}
bool surfacePhazon() const { return (material >> 7) & 1; }
void setSurfacePhazon(bool v) {
material &= ~(1ull << 7);
material |= (v << 7);
}
bool surfaceDirt() const { return (material >> 8) & 1; }
void setSurfaceDirt(bool v) {
material &= ~(1ull << 8);
material |= (v << 8);
}
bool surfaceLava() const { return (material >> 9) & 1; }
void setSurfaceLava(bool v) {
material &= ~(1ull << 9);
material |= (v << 9);
}
bool surfaceStoneRock() const { return (material >> 10) & 1; }
void setSurfaceLavaStone(bool v) {
material &= ~(1ull << 10);
material |= (v << 10);
}
bool surfaceSnow() const { return (material >> 11) & 1; }
void setSurfaceSnow(bool v) {
material &= ~(1ull << 11);
material |= (v << 11);
}
bool surfaceMudSlow() const { return (material >> 12) & 1; }
void setSurfaceMudSlow(bool v) {
material &= ~(1ull << 12);
material |= (v << 12);
}
bool halfPipe() const { return (material >> 13) & 1; }
void setHalfPipe(bool v) {
material &= ~(1ull << 13);
material |= (v << 13);
}
bool surfaceMud() const { return (material >> 14) & 1; }
void setSurfaceMud(bool v) {
material &= ~(1ull << 14);
material |= (v << 14);
}
bool surfaceGlass() const { return (material >> 15) & 1; }
void setSurfaceGlass(bool v) {
material &= ~(1ull << 15);
material |= (v << 15);
}
bool surfaceShield() const { return (material >> 16) & 1; }
void setSurfaceShield(bool v) {
material &= ~(1ull << 16);
material |= (v << 16);
}
bool surfaceSand() const { return (material >> 17) & 1; }
void setSurfaceSand(bool v) {
material &= ~(1ull << 17);
material |= (v << 17);
}
bool projectilePassthrough() const { return (material >> 18) & 1; }
void setProjectilePassthrough(bool v) {
material &= ~(1ull << 18);
material |= (v << 18);
}
bool solid() const { return (material >> 19) & 1; }
void setSolid(bool v) {
material &= ~(1ull << 19);
material |= (v << 19);
}
bool noPlatformCollision() const { return (material >> 20) & 1; }
void setNoPlatformCollision(bool v) {
material &= ~(1ull << 20);
material |= (v << 20);
}
bool cameraPassthrough() const { return (material >> 21) & 1; }
void setCameraPassthrough(bool v) {
material &= ~(1ull << 21);
material |= (v << 21);
}
bool surfaceWood() const { return (material >> 22) & 1; }
void setSurfaceWood(bool v) {
material &= ~(1ull << 22);
material |= (v << 22);
}
bool surfaceOrganic() const { return (material >> 23) & 1; }
void setSurfaceOrganic(bool v) {
material &= ~(1ull << 23);
material |= (v << 23);
}
bool noEdgeCollision() const { return (material >> 24) & 1; }
void setNoEdgeCollision(bool v) {
material &= ~(1ull << 24);
material |= (v << 24);
}
bool flipFace() const { return (material >> 25) & 1; }
void setFlipFace(bool v) {
material &= ~(1ull << 25);
material |= (v << 25);
}
bool seeThrough() const { return (material >> 26) & 1; }
void setSeeThrough(bool v) {
material &= ~(1ull << 26);
material |= (v << 26);
}
bool scanPassthrough() const { return (material >> 27) & 1; }
void setScanPassthrough(bool v) {
material &= ~(1ull << 27);
material |= (v << 27);
}
bool aiPassthrough() const { return (material >> 28) & 1; }
void setAiPassthrough(bool v) {
material &= ~(1ull << 28);
material |= (v << 28);
}
bool ceiling() const { return (material >> 29) & 1; }
void setCeiling(bool v) {
material &= ~(1ull << 29);
material |= (v << 29);
}
bool wall() const { return (material >> 30) & 1; }
void setWall(bool v) {
material &= ~(1ull << 30);
material |= (v << 30);
}
bool floor() const { return (material >> 31) & 1; }
void setFloor(bool v) {
material &= ~(1ull << 31);
material |= (v << 31);
}
/* Dummies for later games */
bool surfaceSPMetal() const { return false; }
void setSurfaceSPMetal(bool v) {}
bool surfaceFabric() const { return false; }
void setSurfaceFabric(bool v) {}
bool surfaceRubber() const { return false; }
void setSurfaceRubber(bool v) {}
bool surfaceMothOrSeedOrganics() const { return false; }
void setSurfaceMothOrSeedOrganics(bool v) {}
bool surfaceWeb() const { return false; }
void setSurfaceWeb(bool v) {}
bool unused3() const { return false; }
void setUnused3(bool v) {}
bool unused4() const { return false; }
void setUnused4(bool v) {}
bool aiBlock() const { return false; }
void setAiBlock(bool v) {}
bool jumpNotAllowed() const { return false; }
void setJumpNotAllowed(bool v) {}
bool spiderBall() const { return false; }
void setSpiderBall(bool v) {}
bool screwAttackWallJump() const { return false; }
void setScrewAttackWallJump(bool v) {}
};
struct Edge : BigDNA {
AT_DECL_DNA
Value<atUint16> verts[2];
};
struct Triangle : BigDNA {
AT_DECL_DNA
Value<atUint16> edges[3];
};
Value<atUint32> unk1;
Value<atUint32> length;
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec3f> aabb[2];
Value<BspNodeType> rootNodeType;
Value<atUint32> bspSize;
Buffer<AT_DNA_COUNT(bspSize)> bspTree;
Value<atUint32> materialCount;
Vector<Material, AT_DNA_COUNT(materialCount)> materials;
Value<atUint32> vertMatsCount;
Vector<atUint8, AT_DNA_COUNT(vertMatsCount)> vertMats;
Value<atUint32> edgeMatsCount;
Vector<atUint8, AT_DNA_COUNT(edgeMatsCount)> edgeMats;
Value<atUint32> triMatsCount;
Vector<atUint8, AT_DNA_COUNT(triMatsCount)> triMats;
Value<atUint32> edgeVertsCount;
Vector<Edge, AT_DNA_COUNT(edgeVertsCount)> edgeVertConnections;
Value<atUint32> triangleEdgesCount;
Vector<Triangle, AT_DNA_COUNT(triangleEdgesCount / 3)> triangleEdgeConnections;
Value<atUint32> vertCount;
Vector<atVec3f, AT_DNA_COUNT(vertCount)> verts;
/* Dummy MP2 member */
void insertNoClimb(hecl::blender::PyOutStream&) const {}
static void BlenderInit(hecl::blender::PyOutStream& os);
void sendToBlender(hecl::blender::PyOutStream& os) const { DeafBabeSendToBlender(os, *this); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,34 +1,28 @@
#include "EVNT.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
template <class Op>
void EVNT::Enumerate(typename Op::StreamT& s)
{
Do<Op>({"version"}, version, s);
void EVNT::Enumerate(typename Op::StreamT& s) {
Do<Op>({"version"}, version, s);
DoSize<Op>({"boolPOICount"}, boolPOICount, s);
Do<Op>({"boolPOINodes"}, boolPOINodes, boolPOICount, s);
DoSize<Op>({"boolPOICount"}, boolPOICount, s);
Do<Op>({"boolPOINodes"}, boolPOINodes, boolPOICount, s);
DoSize<Op>({"int32POICount"}, int32POICount, s);
Do<Op>({"int32POINodes"}, int32POINodes, int32POICount, s);
DoSize<Op>({"int32POICount"}, int32POICount, s);
Do<Op>({"int32POINodes"}, int32POINodes, int32POICount, s);
DoSize<Op>({"particlePOICount"}, particlePOICount, s);
Do<Op>({"particlePOINodes"}, particlePOINodes, particlePOICount, s);
DoSize<Op>({"particlePOICount"}, particlePOICount, s);
Do<Op>({"particlePOINodes"}, particlePOINodes, particlePOICount, s);
if (version == 2)
{
DoSize<Op>({"soundPOICount"}, soundPOICount, s);
Do<Op>({"soundPOINodes"}, soundPOINodes, soundPOICount, s);
}
if (version == 2) {
DoSize<Op>({"soundPOICount"}, soundPOICount, s);
Do<Op>({"soundPOINodes"}, soundPOINodes, soundPOICount, s);
}
}
AT_SPECIALIZE_DNA_YAML(EVNT)
const char* EVNT::DNAType()
{
return "urde::DNAMP1::EVNT";
}
const char* EVNT::DNAType() { return "urde::DNAMP1::EVNT"; }
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,109 +3,90 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct EVNT : BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> version;
struct EVNT : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint32> version;
struct POINode : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint16> unk0;
String<-1> name;
Value<atUint16> type;
struct CharAnimTime : BigDNA
{
enum class Type : atUint32
{
NonZero,
ZeroIncreasing,
ZeroSteady,
ZeroDecreasing,
Infinity
};
struct POINode : BigDNA {
AT_DECL_DNA_YAML
Value<atUint16> unk0;
String<-1> name;
Value<atUint16> type;
struct CharAnimTime : BigDNA {
enum class Type : atUint32 { NonZero, ZeroIncreasing, ZeroSteady, ZeroDecreasing, Infinity };
AT_DECL_DNA_YAML
Value<float> time;
Value<Type> type;
};
CharAnimTime animTime;
Value<atUint32> idx;
Value<bool> unk2;
Value<float> weight;
Value<atUint32> charIdx;
Value<atUint32> flags;
AT_DECL_DNA_YAML
Value<float> time;
Value<Type> type;
};
struct BoolPOINode : POINode
{
AT_DECL_DNA_YAML
Value<atUint8> value;
};
Value<atUint32> boolPOICount;
Vector<BoolPOINode, AT_DNA_COUNT(boolPOICount)> boolPOINodes;
CharAnimTime animTime;
Value<atUint32> idx;
Value<bool> unk2;
Value<float> weight;
Value<atUint32> charIdx;
Value<atUint32> flags;
};
struct Int32POINode : POINode
{
AT_DECL_DNA_YAML
Value<atUint32> value;
String<-1> locator;
};
Value<atUint32> int32POICount;
Vector<Int32POINode, AT_DNA_COUNT(int32POICount)> int32POINodes;
struct BoolPOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint8> value;
};
Value<atUint32> boolPOICount;
Vector<BoolPOINode, AT_DNA_COUNT(boolPOICount)> boolPOINodes;
struct ParticlePOINode : POINode
{
AT_DECL_DNA_YAML
Value<atUint32> duration;
DNAFourCC ptype;
UniqueID32 id;
String<-1> locator;
Value<float> scale;
Value<atUint32> parentMode;
};
Value<atUint32> particlePOICount;
Vector<ParticlePOINode, AT_DNA_COUNT(particlePOICount)> particlePOINodes;
struct Int32POINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> value;
String<-1> locator;
};
Value<atUint32> int32POICount;
Vector<Int32POINode, AT_DNA_COUNT(int32POICount)> int32POINodes;
struct SoundPOINode : POINode
{
AT_DECL_DNA_YAML
Value<atUint32> soundId;
Value<float> falloff;
Value<float> maxDist;
};
Value<atUint32> soundPOICount;
Vector<SoundPOINode, AT_DNA_COUNT(soundPOICount)> soundPOINodes;
struct ParticlePOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> duration;
DNAFourCC ptype;
UniqueID32 id;
String<-1> locator;
Value<float> scale;
Value<atUint32> parentMode;
};
Value<atUint32> particlePOICount;
Vector<ParticlePOINode, AT_DNA_COUNT(particlePOICount)> particlePOINodes;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
EVNT evnt;
evnt.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
return true;
}
struct SoundPOINode : POINode {
AT_DECL_DNA_YAML
Value<atUint32> soundId;
Value<float> falloff;
Value<float> maxDist;
};
Value<atUint32> soundPOICount;
Vector<SoundPOINode, AT_DNA_COUNT(soundPOICount)> soundPOINodes;
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
EVNT evnt;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(evnt, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
evnt.write(ws);
return true;
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
EVNT evnt;
evnt.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(evnt, writer);
return true;
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{
for (const ParticlePOINode& node : particlePOINodes)
g_curSpec->flattenDependencies(node.id, pathsOut);
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
EVNT evnt;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(evnt, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
evnt.write(ws);
return true;
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
for (const ParticlePOINode& node : particlePOINodes)
g_curSpec->flattenDependencies(node.id, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -5,314 +5,272 @@
#include <athena/FileWriter.hpp>
#include "athena/DNAOp.hpp"
namespace DataSpec::DNAMP1
{
struct FRME : BigDNA
{
namespace DataSpec::DNAMP1 {
struct FRME : BigDNA {
AT_DECL_EXPLICIT_DNA
Value<atUint32> version;
Value<atUint32> unk1;
Value<atUint32> modelCount; // Matches MODL widgets
Value<atUint32> unk3;
Value<atUint32> widgetCount;
struct Widget : BigDNA {
AT_DECL_EXPLICIT_DNA
Value<atUint32> version;
Value<atUint32> unk1;
Value<atUint32> modelCount; // Matches MODL widgets
Value<atUint32> unk3;
Value<atUint32> widgetCount;
FRME* owner;
DNAFourCC type;
struct WidgetHeader : BigDNA {
AT_DECL_DNA
String<-1> name;
String<-1> parent;
Value<bool> useAnimController;
Value<bool> defaultVisible;
Value<bool> defaultActive;
Value<bool> cullFaces;
Value<atVec4f> color;
Value<atUint32> modelDrawFlags;
} header;
struct Widget : BigDNA
{
AT_DECL_EXPLICIT_DNA
FRME* owner;
DNAFourCC type;
struct WidgetHeader : BigDNA
{
AT_DECL_DNA
String<-1> name;
String<-1> parent;
Value<bool> useAnimController;
Value<bool> defaultVisible;
Value<bool> defaultActive;
Value<bool> cullFaces;
Value<atVec4f> color;
Value<atUint32> modelDrawFlags;
} header;
struct IWidgetInfo : BigDNAV
{
Delete _dBase;
virtual FourCC fourcc() const=0;
};
std::unique_ptr<IWidgetInfo> widgetInfo;
Value<bool> isWorker;
Value<atUint16> workerId = 0;
Value<atVec3f> origin;
Value<atVec3f> basis[3];
Value<atVec3f> rotationCenter;
Value<atInt32> unk1;
Value<atInt16> unk2;
struct BWIGInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::BWIG"; }
FourCC fourcc() const { return FOURCC('BWIG'); }
};
struct HWIGInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::HWIG"; }
FourCC fourcc() const { return FOURCC('HWIG'); }
};
struct CAMRInfo : IWidgetInfo
{
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::CAMR"; }
enum class ProjectionType
{
Perspective,
Orthographic
};
Value<ProjectionType> projectionType;
struct IProjection : BigDNAV
{
Delete _d;
const ProjectionType type;
IProjection(ProjectionType t) : type(t) {}
};
struct PerspectiveProjection : IProjection
{
AT_DECL_DNA
AT_DECL_DNAV
PerspectiveProjection() : IProjection(ProjectionType::Perspective) {}
Value<float> fov;
Value<float> aspect;
Value<float> znear;
Value<float> zfar;
};
struct OrthographicProjection : IProjection
{
AT_DECL_DNA
AT_DECL_DNAV
OrthographicProjection() : IProjection(ProjectionType::Orthographic) {}
Value<float> left;
Value<float> right;
Value<float> top;
Value<float> bottom;
Value<float> znear;
Value<float> zfar;
};
std::unique_ptr<IProjection> projection;
FourCC fourcc() const { return FOURCC('CAMR'); }
};
struct MODLInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::MODL"; }
UniqueID32 model;
enum class BlendMode
{
Unknown0,
Unknown1,
Unknown2,
Additive
};
Value<atUint32> blendMode;
Value<atUint32> lightMask;
FourCC fourcc() const { return FOURCC('MODL'); }
};
struct LITEInfo : IWidgetInfo
{
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::LITE"; }
enum class ELightType : atUint32
{
Spot = 0,
Point = 1,
Directional = 2,
LocalAmbient = 3,
Custom = 4,
};
Value<ELightType> type;
Value<float> distC;
Value<float> distL;
Value<float> distQ;
Value<float> angC;
Value<float> angL;
Value<float> angQ;
Value<atUint32> loadedIdx;
Value<float> cutoff; /* Spot only */
FourCC fourcc() const { return FOURCC('LITE'); }
};
struct ENRGInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::ENRG"; }
UniqueID32 texture;
FourCC fourcc() const { return FOURCC('ENRG'); }
};
struct METRInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::METR"; }
Value<bool> unk1;
Value<bool> noRoundUp;
Value<atUint32> maxCapacity;
Value<atUint32> workerCount;
FourCC fourcc() const { return FOURCC('METR'); }
};
struct GRUPInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::GRUP"; }
Value<atInt16> defaultWorker;
Value<bool> unk3;
FourCC fourcc() const { return FOURCC('GRUP'); }
};
struct TBGPInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::TBGP"; }
Value<atUint16> elementCount;
Value<atUint16> unk2;
Value<atUint32> unkEnum;
Value<atUint16> defaultSelection;
Value<atUint16> un4;
Value<bool> selectWraparound;
Value<bool> unk6;
Value<float> unkFloat1;
Value<float> unkFloat2;
Value<bool> unk7;
Value<float> unkFloat3;
Value<atUint16> unk8;
Value<atUint16> unk9;
Value<atUint16> unk10;
Value<atUint16> unk11;
FourCC fourcc() const { return FOURCC('TBGP'); }
};
struct SLGPInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::SLGP"; }
Value<float> min;
Value<float> max;
Value<float> cur;
Value<float> increment;
FourCC fourcc() const { return FOURCC('SLGP'); }
};
struct PANEInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::PANE"; }
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
FourCC fourcc() const { return FOURCC('PANE'); }
};
struct TXPNInfo : IWidgetInfo
{
const char* DNATypeV() const { return "FRME::TXPN"; }
enum class Justification : atUint32
{
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
LeftMono,
CenterMono,
RightMono
};
enum class VerticalJustification : atUint32
{
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
LeftMono,
CenterMono,
RightMono
};
AT_DECL_EXPLICIT_DNA
atUint32 version = 0;
TXPNInfo() {}
TXPNInfo(atUint32 version)
: version(version)
{}
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
UniqueID32 font;
Value<bool> wordWrap;
Value<bool> horizontal;
Value<Justification> justification;
Value<VerticalJustification> verticalJustification;
Value<atVec4f> fillColor;
Value<atVec4f> outlineColor;
Value<atVec2f> blockExtent; /* In points; converted to int by loader */
/* The following is only found in V1 */
UniqueID32 jpnFont;
Value<atInt32> jpnPointScale[2] = {};
FourCC fourcc() const { return FOURCC('TXPN'); }
};
struct IMGPInfo : IWidgetInfo
{
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::IMGP"; }
UniqueID32 texture;
Value<atUint32> unk1;
Value<atUint32> unk2;
Value<atUint32> quadCoordCount;
Vector<atVec3f, AT_DNA_COUNT(quadCoordCount)> quadCoords;
Value<atUint32> uvCoordCount;
Vector<atVec2f, AT_DNA_COUNT(uvCoordCount)> uvCoords;
FourCC fourcc() const { return FOURCC('IMGP'); }
};
struct IWidgetInfo : BigDNAV {
Delete _dBase;
virtual FourCC fourcc() const = 0;
};
Vector<Widget, AT_DNA_COUNT(widgetCount)> widgets;
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
std::unique_ptr<IWidgetInfo> widgetInfo;
Value<bool> isWorker;
Value<atUint16> workerId = 0;
Value<atVec3f> origin;
Value<atVec3f> basis[3];
Value<atVec3f> rotationCenter;
Value<atInt32> unk1;
Value<atInt16> unk2;
struct BWIGInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::BWIG"; }
FourCC fourcc() const { return FOURCC('BWIG'); }
};
struct HWIGInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::HWIG"; }
FourCC fourcc() const { return FOURCC('HWIG'); }
};
struct CAMRInfo : IWidgetInfo {
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::CAMR"; }
enum class ProjectionType { Perspective, Orthographic };
Value<ProjectionType> projectionType;
struct IProjection : BigDNAV {
Delete _d;
const ProjectionType type;
IProjection(ProjectionType t) : type(t) {}
};
struct PerspectiveProjection : IProjection {
AT_DECL_DNA
AT_DECL_DNAV
PerspectiveProjection() : IProjection(ProjectionType::Perspective) {}
Value<float> fov;
Value<float> aspect;
Value<float> znear;
Value<float> zfar;
};
struct OrthographicProjection : IProjection {
AT_DECL_DNA
AT_DECL_DNAV
OrthographicProjection() : IProjection(ProjectionType::Orthographic) {}
Value<float> left;
Value<float> right;
Value<float> top;
Value<float> bottom;
Value<float> znear;
Value<float> zfar;
};
std::unique_ptr<IProjection> projection;
FourCC fourcc() const { return FOURCC('CAMR'); }
};
struct MODLInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::MODL"; }
UniqueID32 model;
enum class BlendMode { Unknown0, Unknown1, Unknown2, Additive };
Value<atUint32> blendMode;
Value<atUint32> lightMask;
FourCC fourcc() const { return FOURCC('MODL'); }
};
struct LITEInfo : IWidgetInfo {
AT_DECL_EXPLICIT_DNA
const char* DNATypeV() const { return "FRME::LITE"; }
enum class ELightType : atUint32 {
Spot = 0,
Point = 1,
Directional = 2,
LocalAmbient = 3,
Custom = 4,
};
Value<ELightType> type;
Value<float> distC;
Value<float> distL;
Value<float> distQ;
Value<float> angC;
Value<float> angL;
Value<float> angQ;
Value<atUint32> loadedIdx;
Value<float> cutoff; /* Spot only */
FourCC fourcc() const { return FOURCC('LITE'); }
};
struct ENRGInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::ENRG"; }
UniqueID32 texture;
FourCC fourcc() const { return FOURCC('ENRG'); }
};
struct METRInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::METR"; }
Value<bool> unk1;
Value<bool> noRoundUp;
Value<atUint32> maxCapacity;
Value<atUint32> workerCount;
FourCC fourcc() const { return FOURCC('METR'); }
};
struct GRUPInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::GRUP"; }
Value<atInt16> defaultWorker;
Value<bool> unk3;
FourCC fourcc() const { return FOURCC('GRUP'); }
};
struct TBGPInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::TBGP"; }
Value<atUint16> elementCount;
Value<atUint16> unk2;
Value<atUint32> unkEnum;
Value<atUint16> defaultSelection;
Value<atUint16> un4;
Value<bool> selectWraparound;
Value<bool> unk6;
Value<float> unkFloat1;
Value<float> unkFloat2;
Value<bool> unk7;
Value<float> unkFloat3;
Value<atUint16> unk8;
Value<atUint16> unk9;
Value<atUint16> unk10;
Value<atUint16> unk11;
FourCC fourcc() const { return FOURCC('TBGP'); }
};
struct SLGPInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::SLGP"; }
Value<float> min;
Value<float> max;
Value<float> cur;
Value<float> increment;
FourCC fourcc() const { return FOURCC('SLGP'); }
};
struct PANEInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::PANE"; }
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
FourCC fourcc() const { return FOURCC('PANE'); }
};
struct TXPNInfo : IWidgetInfo {
const char* DNATypeV() const { return "FRME::TXPN"; }
enum class Justification : atUint32 {
Left = 0,
Center,
Right,
Full,
NLeft,
NCenter,
NRight,
LeftMono,
CenterMono,
RightMono
};
enum class VerticalJustification : atUint32 {
Top = 0,
Center,
Bottom,
Full,
NTop,
NCenter,
NBottom,
LeftMono,
CenterMono,
RightMono
};
AT_DECL_EXPLICIT_DNA
atUint32 version = 0;
TXPNInfo() {}
TXPNInfo(atUint32 version) : version(version) {}
Value<float> xDim;
Value<float> zDim;
Value<atVec3f> scaleCenter;
UniqueID32 font;
Value<bool> wordWrap;
Value<bool> horizontal;
Value<Justification> justification;
Value<VerticalJustification> verticalJustification;
Value<atVec4f> fillColor;
Value<atVec4f> outlineColor;
Value<atVec2f> blockExtent; /* In points; converted to int by loader */
/* The following is only found in V1 */
UniqueID32 jpnFont;
Value<atInt32> jpnPointScale[2] = {};
FourCC fourcc() const { return FOURCC('TXPN'); }
};
struct IMGPInfo : IWidgetInfo {
AT_DECL_DNA
const char* DNATypeV() const { return "FRME::IMGP"; }
UniqueID32 texture;
Value<atUint32> unk1;
Value<atUint32> unk2;
Value<atUint32> quadCoordCount;
Vector<atVec3f, AT_DNA_COUNT(quadCoordCount)> quadCoords;
Value<atUint32> uvCoordCount;
Vector<atVec2f, AT_DNA_COUNT(uvCoordCount)> uvCoords;
FourCC fourcc() const { return FOURCC('IMGP'); }
};
};
Vector<Widget, AT_DNA_COUNT(widgetCount)> widgets;
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,55 +3,48 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP1
{
struct HINT : BigDNA
{
namespace DataSpec::DNAMP1 {
struct HINT : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> magic;
Value<atUint32> version;
struct Hint : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> magic;
Value<atUint32> version;
struct Hint : BigDNA
{
AT_DECL_DNA_YAML
String<-1> name;
Value<float> immediateTime;
Value<float> normalTime;
UniqueID32 stringID;
Value<atUint32> textPageCount;
struct Location : BigDNA
{
AT_DECL_DNA_YAML
UniqueID32 worldAssetID;
UniqueID32 areaAssetID;
Value<atUint32> areaID;
UniqueID32 stringID;
};
Value<atUint32> locationCount;
Vector<Location, AT_DNA_COUNT(locationCount)> locations;
String<-1> name;
Value<float> immediateTime;
Value<float> normalTime;
UniqueID32 stringID;
Value<atUint32> textPageCount;
struct Location : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 worldAssetID;
UniqueID32 areaAssetID;
Value<atUint32> areaID;
UniqueID32 stringID;
};
Value<atUint32> hintCount;
Vector<Hint, AT_DNA_COUNT(hintCount)> hints;
Value<atUint32> locationCount;
Vector<Location, AT_DNA_COUNT(locationCount)> locations;
};
Value<atUint32> hintCount;
Vector<Hint, AT_DNA_COUNT(hintCount)> hints;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
HINT hint;
hint.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(hint, writer);
return true;
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
HINT hint;
hint.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(hint, writer);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
HINT hint;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(hint, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
hint.write(ws);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
HINT hint;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(hint, reader);
athena::io::FileWriter ws(outPath.getAbsolutePath());
hint.write(ws);
return true;
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -6,34 +6,24 @@
#include "DataSpec/DNACommon/MAPA.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct MAPA : DNAMAPA::MAPA
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MAPA mapa;
mapa.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
struct MAPA : DNAMAPA::MAPA {
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) {
MAPA mapa;
mapa.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
static bool Cook(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out)
{
return DNAMAPA::Cook<MAPA>(mapa, out);
}
static bool Cook(const hecl::blender::MapArea& mapa, const hecl::ProjectPath& out) {
return DNAMAPA::Cook<MAPA>(mapa, out);
}
static uint32_t Version() { return 2; }
using Header = DNAMAPA::MAPA::HeaderMP1;
using MappableObject = DNAMAPA::MAPA::MappableObjectMP1_2;
static uint32_t Version() { return 2; }
using Header = DNAMAPA::MAPA::HeaderMP1;
using MappableObject = DNAMAPA::MAPA::MappableObjectMP1_2;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -6,25 +6,16 @@
#include "DataSpec/DNACommon/MAPU.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct MAPU : DNAMAPU::MAPU
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
MAPU mapu;
mapu.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPU::ReadMAPUToBlender(conn, mapu, outPath, pakRouter, entry, force);
}
struct MAPU : DNAMAPU::MAPU {
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) {
MAPU mapu;
mapu.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
return DNAMAPU::ReadMAPUToBlender(conn, mapu, outPath, pakRouter, entry, force);
}
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -4,166 +4,141 @@
#include "DataSpec/DNACommon/MLVL.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct MLVL : BigDNA
{
struct MLVL : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> magic;
Value<atUint32> version;
UniqueID32 worldNameId;
UniqueID32 saveWorldId;
UniqueID32 worldSkyboxId;
Value<atUint32> memRelayLinkCount;
struct MemRelayLink : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> magic;
Value<atUint32> version;
UniqueID32 worldNameId;
UniqueID32 saveWorldId;
UniqueID32 worldSkyboxId;
Value<atUint32> memRelayId;
Value<atUint32> targetId;
Value<atUint16> msg;
Value<bool> active;
};
Vector<MemRelayLink, AT_DNA_COUNT(memRelayLinkCount)> memRelayLinks;
Value<atUint32> memRelayLinkCount;
struct MemRelayLink : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> memRelayId;
Value<atUint32> targetId;
Value<atUint16> msg;
Value<bool> active;
Value<atUint32> areaCount;
Value<atUint32> unknown1;
struct Area : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 areaNameId;
Value<atVec4f> transformMtx[3];
Value<atVec3f> aabb[2];
UniqueID32 areaMREAId;
Value<atUint32> areaId;
Value<atUint32> attachedAreaCount;
Vector<atUint16, AT_DNA_COUNT(attachedAreaCount)> attachedAreas;
struct Dependency : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 id;
DNAFourCC type;
Dependency() = default;
Dependency(const UniqueID32& idin, const hecl::FourCC& fcc) : id(idin), type(fcc) {}
};
Vector<MemRelayLink, AT_DNA_COUNT(memRelayLinkCount)> memRelayLinks;
Value<atUint32> areaCount;
Value<atUint32> unknown1;
struct Area : BigDNA
{
Value<atUint32> lazyDepCount;
Vector<Dependency, AT_DNA_COUNT(lazyDepCount)> lazyDeps;
Value<atUint32> depCount;
Vector<Dependency, AT_DNA_COUNT(depCount)> deps;
Value<atUint32> depLayerCount;
Vector<atUint32, AT_DNA_COUNT(depLayerCount)> depLayers;
Value<atUint32> dockCount;
struct Dock : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> endpointCount;
struct Endpoint : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 areaNameId;
Value<atVec4f> transformMtx[3];
Value<atVec3f> aabb[2];
UniqueID32 areaMREAId;
Value<atUint32> areaId;
Value<atUint32> areaIdx;
Value<atUint32> dockIdx;
};
Vector<Endpoint, AT_DNA_COUNT(endpointCount)> endpoints;
Value<atUint32> attachedAreaCount;
Vector<atUint16, AT_DNA_COUNT(attachedAreaCount)> attachedAreas;
struct Dependency : BigDNA
{
AT_DECL_DNA_YAML
UniqueID32 id;
DNAFourCC type;
Dependency() = default;
Dependency(const UniqueID32& idin, const hecl::FourCC& fcc)
: id(idin), type(fcc) {}
};
Value<atUint32> lazyDepCount;
Vector<Dependency, AT_DNA_COUNT(lazyDepCount)> lazyDeps;
Value<atUint32> depCount;
Vector<Dependency, AT_DNA_COUNT(depCount)> deps;
Value<atUint32> depLayerCount;
Vector<atUint32, AT_DNA_COUNT(depLayerCount)> depLayers;
Value<atUint32> dockCount;
struct Dock : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> endpointCount;
struct Endpoint : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> areaIdx;
Value<atUint32> dockIdx;
};
Vector<Endpoint, AT_DNA_COUNT(endpointCount)> endpoints;
Value<atUint32> planeVertCount;
Vector<atVec3f, AT_DNA_COUNT(planeVertCount)> planeVerts;
};
Vector<Dock, AT_DNA_COUNT(dockCount)> docks;
Value<atUint32> planeVertCount;
Vector<atVec3f, AT_DNA_COUNT(planeVertCount)> planeVerts;
};
Vector<Area, AT_DNA_COUNT(areaCount)> areas;
Vector<Dock, AT_DNA_COUNT(dockCount)> docks;
};
Vector<Area, AT_DNA_COUNT(areaCount)> areas;
void finishLastArea()
{
if (areas.size())
{
MLVL::Area& areaLast = areas.back();
areaLast.attachedAreaCount = areaLast.attachedAreas.size();
areaLast.lazyDepCount = areaLast.lazyDeps.size();
areaLast.depCount = areaLast.deps.size();
areaLast.depLayerCount = areaLast.depLayers.size();
areaLast.dockCount = areaLast.docks.size();
}
void finishLastArea() {
if (areas.size()) {
MLVL::Area& areaLast = areas.back();
areaLast.attachedAreaCount = areaLast.attachedAreas.size();
areaLast.lazyDepCount = areaLast.lazyDeps.size();
areaLast.depCount = areaLast.deps.size();
areaLast.depLayerCount = areaLast.depLayers.size();
areaLast.dockCount = areaLast.docks.size();
}
}
UniqueID32 worldMap;
Value<atUint8> unknown2;
Value<atUint32> unknown3;
UniqueID32 worldMap;
Value<atUint8> unknown2;
Value<atUint32> unknown3;
Value<atUint32> audioGroupCount;
struct AudioGroup : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> groupId;
UniqueID32 agscId;
};
Vector<AudioGroup, AT_DNA_COUNT(audioGroupCount)> audioGroups;
String<-1> unkString;
Value<atUint32> audioGroupCount;
struct AudioGroup : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> groupId;
UniqueID32 agscId;
};
Vector<AudioGroup, AT_DNA_COUNT(audioGroupCount)> audioGroups;
String<-1> unkString;
Value<atUint32> layerFlagCount;
struct LayerFlags : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> layerCount;
Value<atUint64> flags;
};
Vector<LayerFlags, AT_DNA_COUNT(layerFlagCount)> layerFlags;
Value<atUint32> layerFlagCount;
struct LayerFlags : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> layerCount;
Value<atUint64> flags;
};
Vector<LayerFlags, AT_DNA_COUNT(layerFlagCount)> layerFlags;
Value<atUint32> layerNameCount;
Vector<String<-1>, AT_DNA_COUNT(layerNameCount)> layerNames;
Value<atUint32> layerNameCount;
Vector<String<-1>, AT_DNA_COUNT(layerNameCount)> layerNames;
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, AT_DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, AT_DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
void readMeta(athena::io::YAMLDocReader& __dna_docin)
{
/* worldSkyboxId */
__dna_docin.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
audioGroupCount = __dna_docin.enumerate("audioGroups", audioGroups);
}
void readMeta(athena::io::YAMLDocReader& __dna_docin) {
/* worldSkyboxId */
__dna_docin.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
audioGroupCount = __dna_docin.enumerate("audioGroups", audioGroups);
}
void writeMeta(athena::io::YAMLDocWriter& __dna_docout) const
{
/* worldSkyboxId */
__dna_docout.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
__dna_docout.enumerate("audioGroups", audioGroups);
}
void writeMeta(athena::io::YAMLDocWriter& __dna_docout) const {
/* worldSkyboxId */
__dna_docout.enumerate("worldSkyboxId", worldSkyboxId);
/* audioGroupCount squelched */
/* audioGroups */
__dna_docout.enumerate("audioGroups", audioGroups);
}
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
using World = hecl::blender::World;
using World = hecl::blender::World;
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const World& wld,
hecl::blender::Token& btok);
static bool Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath, const World& wld,
hecl::blender::Token& btok);
static bool CookMAPW(const hecl::ProjectPath& outPath,
const World& wld,
hecl::blender::Token& btok);
static bool CookMAPW(const hecl::ProjectPath& outPath, const World& wld, hecl::blender::Token& btok);
static bool CookSAVW(const hecl::ProjectPath& outPath,
const World& wld);
static bool CookSAVW(const hecl::ProjectPath& outPath, const World& wld);
};
}
} // namespace DataSpec::DNAMP1

File diff suppressed because it is too large Load Diff

View File

@@ -4,134 +4,110 @@
#include "CMDLMaterials.hpp"
#include "CSKR.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct MREA
{
struct Header : BigDNA
{
AT_DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec4f> localToWorldMtx[3];
Value<atUint32> meshCount;
Value<atUint32> secCount;
Value<atUint32> geomSecIdx;
Value<atUint32> sclySecIdx;
Value<atUint32> collisionSecIdx;
Value<atUint32> unkSecIdx;
Value<atUint32> lightSecIdx;
Value<atUint32> visiSecIdx;
Value<atUint32> pathSecIdx;
Value<atUint32> arotSecIdx;
Vector<atUint32, AT_DNA_COUNT(secCount)> secSizes;
};
struct MREA {
struct Header : BigDNA {
AT_DECL_DNA
Value<atUint32> magic;
Value<atUint32> version;
Value<atVec4f> localToWorldMtx[3];
Value<atUint32> meshCount;
Value<atUint32> secCount;
Value<atUint32> geomSecIdx;
Value<atUint32> sclySecIdx;
Value<atUint32> collisionSecIdx;
Value<atUint32> unkSecIdx;
Value<atUint32> lightSecIdx;
Value<atUint32> visiSecIdx;
Value<atUint32> pathSecIdx;
Value<atUint32> arotSecIdx;
Vector<atUint32, AT_DNA_COUNT(secCount)> secSizes;
};
struct MeshHeader : BigDNA
{
AT_DECL_DNA
struct VisorFlags : BigDNA
{
AT_DECL_DNA
Value<atUint32> flags;
enum class ThermalLevel
{
Cool,
Hot,
Warm
};
static const char* GetThermalLevelStr(ThermalLevel t)
{
switch (t)
{
case ThermalLevel::Cool: return "COOL";
case ThermalLevel::Hot: return "HOT";
case ThermalLevel::Warm: return "WARM";
default: break;
}
return nullptr;
}
bool disableEnviro() const {return flags >> 1 & 0x1;}
void setDisableEnviro(bool v) {flags &= ~0x2; flags |= v << 1;}
bool disableThermal() const {return flags >> 2 & 0x1;}
void setDisableThermal(bool v) {flags &= ~0x4; flags |= v << 2;}
bool disableXray() const {return flags >> 3 & 0x1;}
void setDisableXray(bool v) {flags &= ~0x8; flags |= v << 3;}
ThermalLevel thermalLevel() const {return ThermalLevel(flags >> 4 & 0x3);}
void setThermalLevel(ThermalLevel v) {flags &= ~0x30; flags |= atUint32(v) << 4;}
const char* thermalLevelStr() const {return GetThermalLevelStr(thermalLevel());}
void setFromBlenderProps(const std::unordered_map<std::string, std::string>& props);
} visorFlags;
Value<atVec4f> xfMtx[3];
Value<atVec3f> aabb[2];
};
struct MeshHeader : BigDNA {
AT_DECL_DNA
struct VisorFlags : BigDNA {
AT_DECL_DNA
Value<atUint32> flags;
enum class ThermalLevel { Cool, Hot, Warm };
static const char* GetThermalLevelStr(ThermalLevel t) {
switch (t) {
case ThermalLevel::Cool:
return "COOL";
case ThermalLevel::Hot:
return "HOT";
case ThermalLevel::Warm:
return "WARM";
default:
break;
}
return nullptr;
}
bool disableEnviro() const { return flags >> 1 & 0x1; }
void setDisableEnviro(bool v) {
flags &= ~0x2;
flags |= v << 1;
}
bool disableThermal() const { return flags >> 2 & 0x1; }
void setDisableThermal(bool v) {
flags &= ~0x4;
flags |= v << 2;
}
bool disableXray() const { return flags >> 3 & 0x1; }
void setDisableXray(bool v) {
flags &= ~0x8;
flags |= v << 3;
}
ThermalLevel thermalLevel() const { return ThermalLevel(flags >> 4 & 0x3); }
void setThermalLevel(ThermalLevel v) {
flags &= ~0x30;
flags |= atUint32(v) << 4;
}
const char* thermalLevelStr() const { return GetThermalLevelStr(thermalLevel()); }
void setFromBlenderProps(const std::unordered_map<std::string, std::string>& props);
} visorFlags;
Value<atVec4f> xfMtx[3];
Value<atVec3f> aabb[2];
};
struct BabeDeadLight : BigDNA
{
AT_DECL_DNA
enum class LightType : atUint32
{
LocalAmbient,
Directional,
Custom,
Spot,
Spot2,
LocalAmbient2
};
enum class Falloff : atUint32
{
Constant,
Linear,
Quadratic
};
Value<LightType> lightType;
Value<atVec3f> color;
Value<atVec3f> position;
Value<atVec3f> direction;
Value<float> q;
Value<float> spotCutoff;
Value<float> unk5;
Value<bool> castShadows;
Value<float> unk7;
Value<Falloff> falloff;
Value<float> unk9;
};
struct BabeDeadLight : BigDNA {
AT_DECL_DNA
enum class LightType : atUint32 { LocalAmbient, Directional, Custom, Spot, Spot2, LocalAmbient2 };
enum class Falloff : atUint32 { Constant, Linear, Quadratic };
Value<LightType> lightType;
Value<atVec3f> color;
Value<atVec3f> position;
Value<atVec3f> direction;
Value<float> q;
Value<float> spotCutoff;
Value<float> unk5;
Value<bool> castShadows;
Value<float> unk7;
Value<Falloff> falloff;
Value<float> unk9;
};
static void ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os,
athena::io::IStreamReader& rs);
static void ReadBabeDeadToBlender_1_2(hecl::blender::PyOutStream& os, athena::io::IStreamReader& rs);
static void AddCMDLRigPairs(PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc);
static void AddCMDLRigPairs(PAKEntryReadStream& rs, PAKRouter<PAKBridge>& pakRouter,
CharacterAssociations<UniqueID32>& charAssoc);
static UniqueID32 GetPATHId(PAKEntryReadStream& rs);
static UniqueID32 GetPATHId(PAKEntryReadStream& rs);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)>);
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)>);
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry);
static void Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry);
using ColMesh = hecl::blender::ColMesh;
using Light = hecl::blender::Light;
using ColMesh = hecl::blender::ColMesh;
using Light = hecl::blender::Light;
static bool Cook(const hecl::ProjectPath& outPath,
const hecl::ProjectPath& inPath,
const std::vector<DNACMDL::Mesh>& meshes,
const ColMesh& cMesh,
const std::vector<Light>& lights,
hecl::blender::Token& btok,
const hecl::blender::Matrix4f* xf,
bool pc);
static bool Cook(const hecl::ProjectPath& outPath, const hecl::ProjectPath& inPath,
const std::vector<DNACMDL::Mesh>& meshes, const ColMesh& cMesh, const std::vector<Light>& lights,
hecl::blender::Token& btok, const hecl::blender::Matrix4f* xf, bool pc);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,12 +4,9 @@
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct MazeSeeds : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> seeds[300];
namespace DataSpec::DNAMP1 {
struct MazeSeeds : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> seeds[300];
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,208 +4,179 @@
#include "PAK.hpp"
#include "AGSC.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
template <>
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{
atUint32 version = reader.readUint32Big();
if (version != 0x00030005)
Log.report(logvisor::Fatal, "unexpected PAK magic");
reader.readUint32Big();
void PAK::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
atUint32 version = reader.readUint32Big();
if (version != 0x00030005)
Log.report(logvisor::Fatal, "unexpected PAK magic");
reader.readUint32Big();
atUint32 nameCount = reader.readUint32Big();
m_nameEntries.clear();
m_nameEntries.reserve(nameCount);
for (atUint32 n=0 ; n<nameCount ; ++n)
{
m_nameEntries.emplace_back();
m_nameEntries.back().read(reader);
atUint32 nameCount = reader.readUint32Big();
m_nameEntries.clear();
m_nameEntries.reserve(nameCount);
for (atUint32 n = 0; n < nameCount; ++n) {
m_nameEntries.emplace_back();
m_nameEntries.back().read(reader);
}
atUint32 count = reader.readUint32Big();
m_entries.clear();
m_entries.reserve(count);
m_firstEntries.clear();
m_firstEntries.reserve(count);
std::vector<Entry> entries;
entries.reserve(count);
for (atUint32 e = 0; e < count; ++e) {
entries.emplace_back();
entries.back().read(reader);
}
for (atUint32 e = 0; e < count; ++e) {
Entry& entry = entries[e];
if (entry.compressed && m_useLzo)
entry.compressed = 2;
auto search = m_entries.find(entry.id);
if (search == m_entries.end()) {
m_firstEntries.push_back(entry.id);
m_entries[entry.id] = std::move(entry);
} else {
/* Find next MREA to record which area has dupes */
for (atUint32 e2 = e + 1; e2 < count; ++e2) {
Entry& entry2 = entries[e2];
if (entry2.type != FOURCC('MREA'))
continue;
m_dupeMREAs.insert(entry2.id);
break;
}
}
}
atUint32 count = reader.readUint32Big();
m_entries.clear();
m_entries.reserve(count);
m_firstEntries.clear();
m_firstEntries.reserve(count);
std::vector<Entry> entries;
entries.reserve(count);
for (atUint32 e=0 ; e<count ; ++e)
{
entries.emplace_back();
entries.back().read(reader);
}
for (atUint32 e=0 ; e<count ; ++e)
{
Entry& entry = entries[e];
if (entry.compressed && m_useLzo)
entry.compressed = 2;
auto search = m_entries.find(entry.id);
if (search == m_entries.end())
{
m_firstEntries.push_back(entry.id);
m_entries[entry.id] = std::move(entry);
}
else
{
/* Find next MREA to record which area has dupes */
for (atUint32 e2=e+1 ; e2<count ; ++e2)
{
Entry& entry2 = entries[e2];
if (entry2.type != FOURCC('MREA'))
continue;
m_dupeMREAs.insert(entry2.id);
break;
}
}
}
m_nameMap.clear();
m_nameMap.reserve(nameCount);
for (NameEntry& entry : m_nameEntries)
m_nameMap[entry.name] = entry.id;
m_nameMap.clear();
m_nameMap.reserve(nameCount);
for (NameEntry& entry : m_nameEntries)
m_nameMap[entry.name] = entry.id;
}
template <>
void PAK::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{
writer.writeUint32Big(0x00030005);
writer.writeUint32Big(0);
void PAK::Enumerate<BigDNA::Write>(typename Write::StreamT& writer) {
writer.writeUint32Big(0x00030005);
writer.writeUint32Big(0);
writer.writeUint32Big((atUint32)m_nameEntries.size());
for (const NameEntry& entry : m_nameEntries)
{
NameEntry copy = entry;
copy.nameLen = copy.name.size();
copy.write(writer);
}
writer.writeUint32Big((atUint32)m_nameEntries.size());
for (const NameEntry& entry : m_nameEntries) {
NameEntry copy = entry;
copy.nameLen = copy.name.size();
copy.write(writer);
}
writer.writeUint32Big(m_entries.size());
for (const auto& entry : m_entries)
{
Entry tmp = entry.second;
if (tmp.compressed)
tmp.compressed = 1;
tmp.write(writer);
}
writer.writeUint32Big(m_entries.size());
for (const auto& entry : m_entries) {
Entry tmp = entry.second;
if (tmp.compressed)
tmp.compressed = 1;
tmp.write(writer);
}
}
template <>
void PAK::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
s += 12;
void PAK::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s) {
s += 12;
for (const NameEntry& entry : m_nameEntries)
s += 12 + entry.name.size();
for (const NameEntry& entry : m_nameEntries)
s += 12 + entry.name.size();
s += m_entries.size() * 20 + 4;
s += m_entries.size() * 20 + 4;
}
std::unique_ptr<atUint8[]>
PAK::Entry::getBuffer(const nod::Node& pak, atUint64& szOut) const
{
if (compressed)
{
std::unique_ptr<nod::IPartReadStream> strm = pak.beginReadStream(offset);
std::unique_ptr<atUint8[]> PAK::Entry::getBuffer(const nod::Node& pak, atUint64& szOut) const {
if (compressed) {
std::unique_ptr<nod::IPartReadStream> strm = pak.beginReadStream(offset);
atUint32 decompSz;
strm->read(&decompSz, 4);
decompSz = hecl::SBig(decompSz);
atUint8* buf = new atUint8[decompSz];
atUint8* bufCur = buf;
atUint32 decompSz;
strm->read(&decompSz, 4);
decompSz = hecl::SBig(decompSz);
atUint8* buf = new atUint8[decompSz];
atUint8* bufCur = buf;
atUint8 compBuf[0x8000];
if (compressed == 1)
{
atUint32 compRem = size - 4;
z_stream zs = {};
inflateInit(&zs);
zs.avail_out = decompSz;
zs.next_out = buf;
while (zs.avail_out)
{
atUint64 readSz = strm->read(compBuf, std::min(compRem, atUint32(0x8000)));
compRem -= readSz;
zs.avail_in = readSz;
zs.next_in = compBuf;
inflate(&zs, Z_FINISH);
}
inflateEnd(&zs);
}
else
{
atUint32 rem = decompSz;
while (rem)
{
atUint16 chunkSz;
strm->read(&chunkSz, 2);
chunkSz = hecl::SBig(chunkSz);
strm->read(compBuf, chunkSz);
lzo_uint dsz = rem;
lzo1x_decompress(compBuf, chunkSz, bufCur, &dsz, nullptr);
bufCur += dsz;
rem -= dsz;
}
}
szOut = decompSz;
return std::unique_ptr<atUint8[]>(buf);
}
else
{
atUint8* buf = new atUint8[size];
pak.beginReadStream(offset)->read(buf, size);
szOut = size;
return std::unique_ptr<atUint8[]>(buf);
}
}
const PAK::Entry* PAK::lookupEntry(const UniqueID32& id) const
{
auto result = m_entries.find(id);
if (result != m_entries.end())
return &result->second;
return nullptr;
}
const PAK::Entry* PAK::lookupEntry(std::string_view name) const
{
auto result = m_nameMap.find(name.data());
if (result != m_nameMap.end())
{
auto result1 = m_entries.find(result->second);
if (result1 != m_entries.end())
return &result1->second;
}
return nullptr;
}
std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, bool& named) const
{
std::unordered_map<UniqueID32, Entry>::const_iterator search;
if (entry.type == FOURCC('AGSC') && (search = m_entries.find(entry.id)) != m_entries.cend())
{
/* Use internal AGSC name for entry */
auto rs = search->second.beginReadStream(pakNode);
AGSC::Header header;
header.read(rs);
named = true;
return header.groupName;
atUint8 compBuf[0x8000];
if (compressed == 1) {
atUint32 compRem = size - 4;
z_stream zs = {};
inflateInit(&zs);
zs.avail_out = decompSz;
zs.next_out = buf;
while (zs.avail_out) {
atUint64 readSz = strm->read(compBuf, std::min(compRem, atUint32(0x8000)));
compRem -= readSz;
zs.avail_in = readSz;
zs.next_in = compBuf;
inflate(&zs, Z_FINISH);
}
inflateEnd(&zs);
} else {
atUint32 rem = decompSz;
while (rem) {
atUint16 chunkSz;
strm->read(&chunkSz, 2);
chunkSz = hecl::SBig(chunkSz);
strm->read(compBuf, chunkSz);
lzo_uint dsz = rem;
lzo1x_decompress(compBuf, chunkSz, bufCur, &dsz, nullptr);
bufCur += dsz;
rem -= dsz;
}
}
/* Prefer named entries first */
for (const NameEntry& nentry : m_nameEntries)
if (nentry.id == entry.id)
{
named = true;
return nentry.name;
}
/* Otherwise return ID format string */
named = false;
return entry.type.toString() + '_' + entry.id.toString();
szOut = decompSz;
return std::unique_ptr<atUint8[]>(buf);
} else {
atUint8* buf = new atUint8[size];
pak.beginReadStream(offset)->read(buf, size);
szOut = size;
return std::unique_ptr<atUint8[]>(buf);
}
}
const PAK::Entry* PAK::lookupEntry(const UniqueID32& id) const {
auto result = m_entries.find(id);
if (result != m_entries.end())
return &result->second;
return nullptr;
}
const PAK::Entry* PAK::lookupEntry(std::string_view name) const {
auto result = m_nameMap.find(name.data());
if (result != m_nameMap.end()) {
auto result1 = m_entries.find(result->second);
if (result1 != m_entries.end())
return &result1->second;
}
return nullptr;
}
std::string PAK::bestEntryName(const nod::Node& pakNode, const Entry& entry, bool& named) const {
std::unordered_map<UniqueID32, Entry>::const_iterator search;
if (entry.type == FOURCC('AGSC') && (search = m_entries.find(entry.id)) != m_entries.cend()) {
/* Use internal AGSC name for entry */
auto rs = search->second.beginReadStream(pakNode);
AGSC::Header header;
header.read(rs);
named = true;
return header.groupName;
}
/* Prefer named entries first */
for (const NameEntry& nentry : m_nameEntries)
if (nentry.id == entry.id) {
named = true;
return nentry.name;
}
/* Otherwise return ID format string */
named = false;
return entry.type.toString() + '_' + entry.id.toString();
}
} // namespace DataSpec::DNAMP1

View File

@@ -5,60 +5,53 @@
#include <nod/DiscBase.hpp>
#include "DataSpec/DNACommon/PAK.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct PAK : BigDNA
{
bool m_useLzo;
bool m_noShare;
PAK(bool useLzo, bool noShare) : m_useLzo(useLzo), m_noShare(noShare) {}
AT_DECL_EXPLICIT_DNA
struct PAK : BigDNA {
bool m_useLzo;
bool m_noShare;
PAK(bool useLzo, bool noShare) : m_useLzo(useLzo), m_noShare(noShare) {}
AT_DECL_EXPLICIT_DNA
struct NameEntry : BigDNA
{
AT_DECL_DNA
DNAFourCC type;
UniqueID32 id;
Value<atUint32> nameLen;
String<AT_DNA_COUNT(nameLen)> name;
};
struct NameEntry : BigDNA {
AT_DECL_DNA
DNAFourCC type;
UniqueID32 id;
Value<atUint32> nameLen;
String<AT_DNA_COUNT(nameLen)> name;
};
struct Entry : BigDNA
{
AT_DECL_DNA
Value<atUint32> compressed;
DNAFourCC type;
UniqueID32 id;
Value<atUint32> size;
Value<atUint32> offset;
UniqueResult unique;
std::string name; /* backreferencing name for RE purposes */
struct Entry : BigDNA {
AT_DECL_DNA
Value<atUint32> compressed;
DNAFourCC type;
UniqueID32 id;
Value<atUint32> size;
Value<atUint32> offset;
UniqueResult unique;
std::string name; /* backreferencing name for RE purposes */
std::unique_ptr<atUint8[]> getBuffer(const nod::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const nod::Node& pak, atUint64 off=0) const
{
atUint64 sz;
std::unique_ptr<atUint8[]> buf = getBuffer(pak, sz);
return PAKEntryReadStream(std::move(buf), sz, off);
}
};
std::unique_ptr<atUint8[]> getBuffer(const nod::Node& pak, atUint64& szOut) const;
inline PAKEntryReadStream beginReadStream(const nod::Node& pak, atUint64 off = 0) const {
atUint64 sz;
std::unique_ptr<atUint8[]> buf = getBuffer(pak, sz);
return PAKEntryReadStream(std::move(buf), sz, off);
}
};
std::vector<NameEntry> m_nameEntries;
std::unordered_map<UniqueID32, Entry> m_entries;
std::vector<UniqueID32> m_firstEntries;
std::unordered_map<std::string, UniqueID32> m_nameMap;
std::unordered_set<UniqueID32> m_dupeMREAs;
std::vector<NameEntry> m_nameEntries;
std::unordered_map<UniqueID32, Entry> m_entries;
std::vector<UniqueID32> m_firstEntries;
std::unordered_map<std::string, UniqueID32> m_nameMap;
std::unordered_set<UniqueID32> m_dupeMREAs;
const Entry* lookupEntry(const UniqueID32& id) const;
const Entry* lookupEntry(std::string_view name) const;
std::string bestEntryName(const nod::Node& pakNode, const Entry& entry, bool& named) const;
const Entry* lookupEntry(const UniqueID32& id) const;
const Entry* lookupEntry(std::string_view name) const;
std::string bestEntryName(const nod::Node& pakNode, const Entry& entry, bool& named) const;
bool mreaHasDupeResources(const UniqueID32& id) const
{ return m_dupeMREAs.find(id) != m_dupeMREAs.cend(); }
bool mreaHasDupeResources(const UniqueID32& id) const { return m_dupeMREAs.find(id) != m_dupeMREAs.cend(); }
using IDType = UniqueID32;
using IDType = UniqueID32;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,88 +3,86 @@
#include "zeus/CAABox.hpp"
#include "DataSpec/DNACommon/AROTBuilder.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName,
const zeus::CMatrix4f* xf)
{
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format("import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.types.Material.retro_path_idx_mask = bpy.props.IntProperty(name='Retro: Path Index Mask')\n"
"bpy.types.Material.retro_path_type_mask = bpy.props.IntProperty(name='Retro: Path Type Mask')\n"
"\n"
"material_dict = {}\n"
"material_index = []\n"
"def make_ground_material(idxMask):\n"
" mat = bpy.data.materials.new('Ground %%X' %% idxMask)\n"
" mat.diffuse_color = (0.8, 0.460, 0.194)\n"
" return mat\n"
"def make_flyer_material(idxMask):\n"
" mat = bpy.data.materials.new('Flyer %%X' %% idxMask)\n"
" mat.diffuse_color = (0.016, 0.8, 0.8)\n"
" return mat\n"
"def make_swimmer_material(idxMask):\n"
" mat = bpy.data.materials.new('Swimmer %%X' %% idxMask)\n"
" mat.diffuse_color = (0.074, 0.293, 0.8)\n"
" return mat\n"
"def select_material(meshIdxMask, meshTypeMask):\n"
" key = (meshIdxMask, meshTypeMask)\n"
" if key in material_index:\n"
" return material_index.index(key)\n"
" elif key in material_dict:\n"
" material_index.append(key)\n"
" return len(material_index)-1\n"
" else:\n"
" if meshTypeMask == 0x2:\n"
" mat = make_flyer_material(meshIdxMask)\n"
" elif meshTypeMask == 0x4:\n"
" mat = make_swimmer_material(meshIdxMask)\n"
" else:\n"
" mat = make_ground_material(meshIdxMask)\n"
" mat.retro_path_idx_mask = meshIdxMask\n"
" mat.retro_path_type_mask = meshTypeMask\n"
" material_dict[key] = mat\n"
" material_index.append(key)\n"
" return len(material_index)-1\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n"
"bm = bmesh.new()\n"
"height_lay = bm.faces.layers.float.new('Height')\n",
entryName.data());
void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entryName, const zeus::CMatrix4f* xf) {
/* Open Py Stream and read sections */
hecl::blender::PyOutStream os = conn.beginPythonOut(true);
os.format(
"import bpy\n"
"import bmesh\n"
"from mathutils import Vector, Matrix\n"
"\n"
"bpy.types.Material.retro_path_idx_mask = bpy.props.IntProperty(name='Retro: Path Index Mask')\n"
"bpy.types.Material.retro_path_type_mask = bpy.props.IntProperty(name='Retro: Path Type Mask')\n"
"\n"
"material_dict = {}\n"
"material_index = []\n"
"def make_ground_material(idxMask):\n"
" mat = bpy.data.materials.new('Ground %%X' %% idxMask)\n"
" mat.diffuse_color = (0.8, 0.460, 0.194)\n"
" return mat\n"
"def make_flyer_material(idxMask):\n"
" mat = bpy.data.materials.new('Flyer %%X' %% idxMask)\n"
" mat.diffuse_color = (0.016, 0.8, 0.8)\n"
" return mat\n"
"def make_swimmer_material(idxMask):\n"
" mat = bpy.data.materials.new('Swimmer %%X' %% idxMask)\n"
" mat.diffuse_color = (0.074, 0.293, 0.8)\n"
" return mat\n"
"def select_material(meshIdxMask, meshTypeMask):\n"
" key = (meshIdxMask, meshTypeMask)\n"
" if key in material_index:\n"
" return material_index.index(key)\n"
" elif key in material_dict:\n"
" material_index.append(key)\n"
" return len(material_index)-1\n"
" else:\n"
" if meshTypeMask == 0x2:\n"
" mat = make_flyer_material(meshIdxMask)\n"
" elif meshTypeMask == 0x4:\n"
" mat = make_swimmer_material(meshIdxMask)\n"
" else:\n"
" mat = make_ground_material(meshIdxMask)\n"
" mat.retro_path_idx_mask = meshIdxMask\n"
" mat.retro_path_type_mask = meshTypeMask\n"
" material_dict[key] = mat\n"
" material_index.append(key)\n"
" return len(material_index)-1\n"
"\n"
"bpy.context.scene.name = '%s'\n"
"# Clear Scene\n"
"for ob in bpy.data.objects:\n"
" if ob.type != 'CAMERA':\n"
" bpy.context.scene.objects.unlink(ob)\n"
" bpy.data.objects.remove(ob)\n"
"\n"
"bm = bmesh.new()\n"
"height_lay = bm.faces.layers.float.new('Height')\n",
entryName.data());
for (const Node& n : nodes)
{
zeus::simd_floats f(n.position.simd);
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
}
for (const Node& n : nodes) {
zeus::simd_floats f(n.position.simd);
os.format("bm.verts.new((%f,%f,%f))\n", f[0], f[1], f[2]);
}
os << "bm.verts.ensure_lookup_table()\n";
os << "bm.verts.ensure_lookup_table()\n";
for (const Region& r : regions)
{
os << "tri_verts = []\n";
for (int i=0 ; i<r.nodeCount ; ++i)
os.format("tri_verts.append(bm.verts[%u])\n", r.nodeStart + i);
for (const Region& r : regions) {
os << "tri_verts = []\n";
for (int i = 0; i < r.nodeCount; ++i)
os.format("tri_verts.append(bm.verts[%u])\n", r.nodeStart + i);
os.format("face = bm.faces.get(tri_verts)\n"
"if face is None:\n"
" face = bm.faces.new(tri_verts)\n"
" face.normal_flip()\n"
"face.material_index = select_material(0x%04X, 0x%04X)\n"
"face.smooth = False\n"
"face[height_lay] = %f\n"
"\n", r.meshIndexMask, r.meshTypeMask, r.height);
os.format(
"face = bm.faces.get(tri_verts)\n"
"if face is None:\n"
" face = bm.faces.new(tri_verts)\n"
" face.normal_flip()\n"
"face.material_index = select_material(0x%04X, 0x%04X)\n"
"face.smooth = False\n"
"face[height_lay] = %f\n"
"\n",
r.meshIndexMask, r.meshTypeMask, r.height);
#if 0
zeus::CVector3f center = xf->multiplyOneOverW(r.centroid);
@@ -105,100 +103,88 @@ void PATH::sendToBlender(hecl::blender::Connection& conn, std::string_view entry
(aabb.max.v[2] - aabb.min.v[2]) / 2.f,
center.x, center.y, center.z);
#endif
}
}
os << "bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.001)\n"
"path_mesh = bpy.data.meshes.new('PATH')\n"
"bm.to_mesh(path_mesh)\n"
"path_mesh_obj = bpy.data.objects.new(path_mesh.name, path_mesh)\n"
"\n"
"for mat_name in material_index:\n"
" mat = material_dict[mat_name]\n"
" path_mesh.materials.append(mat)\n"
"\n"
"bpy.context.scene.objects.link(path_mesh_obj)\n"
"path_mesh_obj.draw_type = 'SOLID'\n"
"path_mesh_obj.game.physics_type = 'STATIC'\n"
"path_mesh_obj.layers[1] = True\n"
"bpy.context.scene.hecl_path_obj = path_mesh_obj.name\n"
"\n"
"for ar in bpy.context.screen.areas:\n"
" for sp in ar.spaces:\n"
" if sp.type == 'VIEW_3D':\n"
" sp.viewport_shade = 'SOLID'\n";
os << "bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=0.001)\n"
"path_mesh = bpy.data.meshes.new('PATH')\n"
"bm.to_mesh(path_mesh)\n"
"path_mesh_obj = bpy.data.objects.new(path_mesh.name, path_mesh)\n"
"\n"
"for mat_name in material_index:\n"
" mat = material_dict[mat_name]\n"
" path_mesh.materials.append(mat)\n"
"\n"
"bpy.context.scene.objects.link(path_mesh_obj)\n"
"path_mesh_obj.draw_type = 'SOLID'\n"
"path_mesh_obj.game.physics_type = 'STATIC'\n"
"path_mesh_obj.layers[1] = True\n"
"bpy.context.scene.hecl_path_obj = path_mesh_obj.name\n"
"\n"
"for ar in bpy.context.screen.areas:\n"
" for sp in ar.spaces:\n"
" if sp.type == 'VIEW_3D':\n"
" sp.viewport_shade = 'SOLID'\n";
if (xf)
{
const zeus::CMatrix4f& w = *xf;
zeus::simd_floats xfMtxF[4];
for (int i = 0; i < 4; ++i)
w.m[i].mSimd.copy_to(xfMtxF[i]);
os.format("mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
"path_mesh_obj.location = mtxd[0]\n"
"path_mesh_obj.rotation_quaternion = mtxd[1]\n"
"path_mesh_obj.scale = mtxd[2]\n",
xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0],
xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1],
xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]);
}
if (xf) {
const zeus::CMatrix4f& w = *xf;
zeus::simd_floats xfMtxF[4];
for (int i = 0; i < 4; ++i)
w.m[i].mSimd.copy_to(xfMtxF[i]);
os.format(
"mtx = Matrix(((%f,%f,%f,%f),(%f,%f,%f,%f),(%f,%f,%f,%f),(0.0,0.0,0.0,1.0)))\n"
"mtxd = mtx.decompose()\n"
"path_mesh_obj.rotation_mode = 'QUATERNION'\n"
"path_mesh_obj.location = mtxd[0]\n"
"path_mesh_obj.rotation_quaternion = mtxd[1]\n"
"path_mesh_obj.scale = mtxd[2]\n",
xfMtxF[0][0], xfMtxF[1][0], xfMtxF[2][0], xfMtxF[3][0], xfMtxF[0][1], xfMtxF[1][1], xfMtxF[2][1], xfMtxF[3][1],
xfMtxF[0][2], xfMtxF[1][2], xfMtxF[2][2], xfMtxF[3][2]);
}
os.linkBackground("//!area.blend");
os.centerView();
os.close();
os.linkBackground("//!area.blend");
os.centerView();
os.close();
}
bool PATH::Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged)
{
PATH path;
path.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::PathMesh))
return false;
bool PATH::Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged) {
PATH path;
path.read(rs);
hecl::blender::Connection& conn = btok.getBlenderConnection();
if (!conn.createBlend(outPath, hecl::blender::BlendType::PathMesh))
return false;
const zeus::CMatrix4f* xf = pakRouter.lookupMAPATransform(entry.id);
path.sendToBlender(conn, pakRouter.getBestEntryName(entry, false), xf);
return conn.saveBlend();
const zeus::CMatrix4f* xf = pakRouter.lookupMAPATransform(entry.id);
path.sendToBlender(conn, pakRouter.getBestEntryName(entry, false), xf);
return conn.saveBlend();
}
bool PATH::Cook(const hecl::ProjectPath& outPath,
const PathMesh& mesh)
{
athena::io::MemoryReader r(mesh.data.data(), mesh.data.size());
PATH path;
path.read(r);
if (!path.regions.empty())
{
AROTBuilder octreeBuilder;
octreeBuilder.buildPath(path);
}
else
{
path.octreeNodeCount = 1;
path.octree.emplace_back();
OctreeNode& n = path.octree.back();
n.isLeaf = 1;
n.aabb[0] = zeus::CVector3f{FLT_MAX, FLT_MAX, FLT_MAX};
n.aabb[1] = zeus::CVector3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
for (int i=0 ; i<8 ; ++i)
n.children[i] = 0xffffffff;
}
bool PATH::Cook(const hecl::ProjectPath& outPath, const PathMesh& mesh) {
athena::io::MemoryReader r(mesh.data.data(), mesh.data.size());
PATH path;
path.read(r);
if (!path.regions.empty()) {
AROTBuilder octreeBuilder;
octreeBuilder.buildPath(path);
} else {
path.octreeNodeCount = 1;
path.octree.emplace_back();
OctreeNode& n = path.octree.back();
n.isLeaf = 1;
n.aabb[0] = zeus::CVector3f{FLT_MAX, FLT_MAX, FLT_MAX};
n.aabb[1] = zeus::CVector3f{-FLT_MAX, -FLT_MAX, -FLT_MAX};
for (int i = 0; i < 8; ++i)
n.children[i] = 0xffffffff;
}
athena::io::FileWriter w(outPath.getAbsolutePath());
path.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i=0 ; i<32-rem ; ++i)
w.writeUByte(0xff);
return true;
athena::io::FileWriter w(outPath.getAbsolutePath());
path.write(w);
int64_t rem = w.position() % 32;
if (rem)
for (int64_t i = 0; i < 32 - rem; ++i)
w.writeUByte(0xff);
return true;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,88 +4,74 @@
#include "DataSpec/DNACommon/PAK.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct PATH : BigDNA
{
using PathMesh = hecl::blender::PathMesh;
namespace DataSpec::DNAMP1 {
struct PATH : BigDNA {
using PathMesh = hecl::blender::PathMesh;
AT_DECL_DNA
Value<atUint32> version;
struct Node : BigDNA {
AT_DECL_DNA
Value<atUint32> version;
Value<atVec3f> position;
Value<atVec3f> normal;
};
Value<atUint32> nodeCount;
Vector<Node, AT_DNA_COUNT(nodeCount)> nodes;
struct Node : BigDNA
{
AT_DECL_DNA
Value<atVec3f> position;
Value<atVec3f> normal;
};
struct Link : BigDNA {
AT_DECL_DNA
Value<atUint32> nodeIdx;
Value<atUint32> regionIdx;
Value<float> width2d;
Value<float> oneOverWidth2d;
};
Value<atUint32> linkCount;
Vector<Link, AT_DNA_COUNT(linkCount)> links;
struct Region : BigDNA {
AT_DECL_DNA
Value<atUint32> nodeCount;
Vector<Node, AT_DNA_COUNT(nodeCount)> nodes;
struct Link : BigDNA
{
AT_DECL_DNA
Value<atUint32> nodeIdx;
Value<atUint32> regionIdx;
Value<float> width2d;
Value<float> oneOverWidth2d;
};
Value<atUint32> nodeStart;
Value<atUint32> linkCount;
Vector<Link, AT_DNA_COUNT(linkCount)> links;
Value<atUint32> linkStart;
Value<atUint16> meshIndexMask;
Value<atUint16> meshTypeMask;
Value<float> height;
Value<atVec3f> normal;
Value<atUint32> regionIdx;
Value<atVec3f> centroid;
Value<atVec3f> aabb[2];
Value<atUint32> regionIdxPtr;
};
Value<atUint32> regionCount;
Vector<Region, AT_DNA_COUNT(regionCount)> regions;
struct Region : BigDNA
{
AT_DECL_DNA
Value<atUint32> nodeCount;
Value<atUint32> nodeStart;
Value<atUint32> linkCount;
Value<atUint32> linkStart;
Value<atUint16> meshIndexMask;
Value<atUint16> meshTypeMask;
Value<float> height;
Value<atVec3f> normal;
Value<atUint32> regionIdx;
Value<atVec3f> centroid;
Value<atVec3f> aabb[2];
Value<atUint32> regionIdxPtr;
};
Vector<atUint32, AT_DNA_COUNT((((regionCount * (regionCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, AT_DNA_COUNT(bitmap1.size())> bitmap2;
Vector<atUint32, AT_DNA_COUNT(((((regionCount * regionCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
Value<atUint32> octreeRegionLookupCount;
Vector<atUint32, AT_DNA_COUNT(octreeRegionLookupCount)> octreeRegionLookup;
struct OctreeNode : BigDNA {
AT_DECL_DNA
Value<atUint32> isLeaf;
Value<atVec3f> aabb[2];
Value<atVec3f> centroid;
Value<atUint32> children[8];
Value<atUint32> regionCount;
Vector<Region, AT_DNA_COUNT(regionCount)> regions;
Value<atUint32> regionStart;
};
Value<atUint32> octreeNodeCount;
Vector<OctreeNode, AT_DNA_COUNT(octreeNodeCount)> octree;
Vector<atUint32, AT_DNA_COUNT((((regionCount * (regionCount - 1)) / 2) + 31) / 32)> bitmap1;
Vector<atUint32, AT_DNA_COUNT(bitmap1.size())> bitmap2;
Vector<atUint32, AT_DNA_COUNT(((((regionCount * regionCount) + 31) / 32) - bitmap1.size()) * 2)> bitmap3;
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName, const zeus::CMatrix4f* xf);
Value<atUint32> octreeRegionLookupCount;
Vector<atUint32, AT_DNA_COUNT(octreeRegionLookupCount)> octreeRegionLookup;
static bool Extract(const SpecBase& dataSpec, PAKEntryReadStream& rs, const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter, const PAK::Entry& entry, bool force, hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
struct OctreeNode : BigDNA
{
AT_DECL_DNA
Value<atUint32> isLeaf;
Value<atVec3f> aabb[2];
Value<atVec3f> centroid;
Value<atUint32> children[8];
Value<atUint32> regionCount;
Value<atUint32> regionStart;
};
Value<atUint32> octreeNodeCount;
Vector<OctreeNode, AT_DNA_COUNT(octreeNodeCount)> octree;
void sendToBlender(hecl::blender::Connection& conn, std::string_view entryName,
const zeus::CMatrix4f* xf);
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const hecl::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
hecl::blender::Token& btok,
std::function<void(const hecl::SystemChar*)> fileChanged);
static bool Cook(const hecl::ProjectPath& outPath,
const PathMesh& mesh);
static bool Cook(const hecl::ProjectPath& outPath, const PathMesh& mesh);
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,32 +3,28 @@
#include "DataSpec/DNACommon/SAVWCommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct Scan : BigDNA
{
AT_DECL_DNA_YAML
UniqueID32 scanId;
Value<SAVWCommon::EScanCategory> category;
namespace DataSpec::DNAMP1 {
struct Scan : BigDNA {
AT_DECL_DNA_YAML
UniqueID32 scanId;
Value<SAVWCommon::EScanCategory> category;
Scan() = default;
Scan(const UniqueID32& id) : scanId(id), category(SAVWCommon::EScanCategory::None) {}
Scan() = default;
Scan(const UniqueID32& id) : scanId(id), category(SAVWCommon::EScanCategory::None) {}
};
struct SAVW : BigDNA
{
AT_DECL_DNA_YAML
SAVWCommon::Header header;
Value<atUint32> skippableCutsceneCount;
Vector<atUint32, AT_DNA_COUNT(skippableCutsceneCount)> skippableCutscenes;
Value<atUint32> relayCount;
Vector<atUint32, AT_DNA_COUNT(relayCount)> relays;
Value<atUint32> layerCount;
Vector<SAVWCommon::Layer, AT_DNA_COUNT(layerCount)> layers;
Value<atUint32> doorCount;
Vector<atUint32, AT_DNA_COUNT(doorCount)> doors;
Value<atUint32> scanCount;
Vector<Scan, AT_DNA_COUNT(scanCount)> scans;
struct SAVW : BigDNA {
AT_DECL_DNA_YAML
SAVWCommon::Header header;
Value<atUint32> skippableCutsceneCount;
Vector<atUint32, AT_DNA_COUNT(skippableCutsceneCount)> skippableCutscenes;
Value<atUint32> relayCount;
Vector<atUint32, AT_DNA_COUNT(relayCount)> relays;
Value<atUint32> layerCount;
Vector<SAVWCommon::Layer, AT_DNA_COUNT(layerCount)> layers;
Value<atUint32> doorCount;
Vector<atUint32, AT_DNA_COUNT(doorCount)> doors;
Value<atUint32> scanCount;
Vector<Scan, AT_DNA_COUNT(scanCount)> scans;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,81 +1,73 @@
#include "SCAN.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
static const std::vector<std::string> PaneNames =
{
"imagepane_pane0", "imagepane_pane1", "imagepane_pane2", "imagepane_pane3", "imagepane_pane01",
"imagepane_pane12", "imagepane_pane23", "imagepane_pane012", "imagepane_pane123", "imagepane_pane0123",
"imagepane_pane4", "imagepane_pane5", "imagepane_pane6", "imagepane_pane7", "imagepane_pane45",
"imagepane_pane56", "imagepane_pane67", "imagepane_pane456", "imagepane_pane567", "imagepane_pane4567"
};
static const std::vector<std::string> PaneNames = {
"imagepane_pane0", "imagepane_pane1", "imagepane_pane2", "imagepane_pane3", "imagepane_pane01",
"imagepane_pane12", "imagepane_pane23", "imagepane_pane012", "imagepane_pane123", "imagepane_pane0123",
"imagepane_pane4", "imagepane_pane5", "imagepane_pane6", "imagepane_pane7", "imagepane_pane45",
"imagepane_pane56", "imagepane_pane67", "imagepane_pane456", "imagepane_pane567", "imagepane_pane4567"};
template <>
void SCAN::Texture::Enumerate<BigDNA::Read>(typename Read::StreamT& r)
{
texture.read(r);
appearanceRange = r.readFloatBig();
position = Position(r.readUint32Big());
width = r.readUint32Big();
height = r.readUint32Big();
interval = r.readFloatBig();
fadeDuration = r.readFloatBig();
void SCAN::Texture::Enumerate<BigDNA::Read>(typename Read::StreamT& r) {
texture.read(r);
appearanceRange = r.readFloatBig();
position = Position(r.readUint32Big());
width = r.readUint32Big();
height = r.readUint32Big();
interval = r.readFloatBig();
fadeDuration = r.readFloatBig();
}
template <>
void SCAN::Texture::Enumerate<BigDNA::Write>(typename Write::StreamT& w)
{
texture.write(w);
w.writeFloatBig(appearanceRange);
w.writeUint32Big(atUint32(position));
w.writeUint32Big(width);
w.writeUint32Big(height);
w.writeFloatBig(interval);
w.writeFloatBig(fadeDuration);
void SCAN::Texture::Enumerate<BigDNA::Write>(typename Write::StreamT& w) {
texture.write(w);
w.writeFloatBig(appearanceRange);
w.writeUint32Big(atUint32(position));
w.writeUint32Big(width);
w.writeUint32Big(height);
w.writeFloatBig(interval);
w.writeFloatBig(fadeDuration);
}
template <>
void SCAN::Texture::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r)
{
r.enumerate("texture", texture);
appearanceRange = r.readFloat("appearanceRange");
std::string tmp = r.readString("position");
void SCAN::Texture::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& r) {
r.enumerate("texture", texture);
appearanceRange = r.readFloat("appearanceRange");
std::string tmp = r.readString("position");
auto idx = std::find(PaneNames.begin(), PaneNames.end(), tmp);
if (idx != PaneNames.end())
position = Position(idx - PaneNames.begin());
else
position = Position::Invalid;
auto idx = std::find(PaneNames.begin(), PaneNames.end(), tmp);
if (idx != PaneNames.end())
position = Position(idx - PaneNames.begin());
else
position = Position::Invalid;
width = r.readUint32("width");
height = r.readUint32("height");
interval = r.readFloat("interval");
fadeDuration = r.readFloat("fadeDuration");
width = r.readUint32("width");
height = r.readUint32("height");
interval = r.readFloat("interval");
fadeDuration = r.readFloat("fadeDuration");
}
template <>
void SCAN::Texture::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w)
{
w.enumerate("texture", texture);
w.writeFloat("appearanceRange", appearanceRange);
if (position != Position::Invalid)
w.writeString("position", PaneNames.at(atUint32(position)));
else
w.writeString("position", "undefined");
w.writeUint32("width", width);
w.writeUint32("height", height);
w.writeFloat("interval", interval);
w.writeFloat("fadeDuration", fadeDuration);
void SCAN::Texture::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& w) {
w.enumerate("texture", texture);
w.writeFloat("appearanceRange", appearanceRange);
if (position != Position::Invalid)
w.writeString("position", PaneNames.at(atUint32(position)));
else
w.writeString("position", "undefined");
w.writeUint32("width", width);
w.writeUint32("height", height);
w.writeFloat("interval", interval);
w.writeFloat("fadeDuration", fadeDuration);
}
const char* SCAN::Texture::DNAType() { return "urde::DNAMP1::SCAN::Texture"; }
template <>
void SCAN::Texture::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s)
{
texture.binarySize(s);
s += 24;
void SCAN::Texture::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& s) {
texture.binarySize(s);
s += 24;
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,111 +4,106 @@
#include "DataSpec/DNACommon/DNACommon.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct SCAN : BigDNA
{
AT_DECL_DNA_YAML
Value<atUint32> version;
Value<atUint32> magic;
UniqueID32 frame;
UniqueID32 string;
namespace DataSpec::DNAMP1 {
struct SCAN : BigDNA {
AT_DECL_DNA_YAML
Value<atUint32> version;
Value<atUint32> magic;
UniqueID32 frame;
UniqueID32 string;
enum class ScanSpeed : atUint32
{ Normal, Slow };
Value<ScanSpeed> scanSpeed;
enum class ScanSpeed : atUint32 { Normal, Slow };
Value<ScanSpeed> scanSpeed;
enum class Category : atUint32
{
None,
SpacePirateData,
ChozoLore,
Creatures,
Research
enum class Category : atUint32 { None, SpacePirateData, ChozoLore, Creatures, Research };
Value<Category> category;
Value<bool> isImportant;
struct Texture : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
UniqueID32 texture;
Value<float> appearanceRange;
enum class Position : atInt32 {
Pane0,
Pane1,
Pane2,
Pane3,
Pane01,
Pane12,
Pane23,
Pane012,
Pane123,
Pane0123,
Pane4,
Pane5,
Pane6,
Pane7,
Pane45,
Pane56,
Pane67,
Pane456,
Pane567,
Pane4567,
Invalid = -1
};
Value<Position> position;
Value<atUint32> width; // width of animation cell
Value<atUint32> height; // height of animation cell
Value<float> interval; // 0.0 - 1.0
Value<float> fadeDuration; // 0.0 - 1.0
};
Value<Category> category;
Texture textures[4];
Value<bool> isImportant;
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
SCAN scan;
scan.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(scan, writer);
return true;
}
struct Texture : BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
UniqueID32 texture;
Value<float> appearanceRange;
enum class Position : atInt32
{
Pane0, Pane1, Pane2, Pane3, Pane01, Pane12, Pane23, Pane012,
Pane123, Pane0123, Pane4, Pane5, Pane6, Pane7, Pane45, Pane56,
Pane67, Pane456, Pane567, Pane4567, Invalid = -1
};
Value<Position> position;
Value<atUint32> width; // width of animation cell
Value<atUint32> height; // height of animation cell
Value<float> interval; // 0.0 - 1.0
Value<float> fadeDuration; // 0.0 - 1.0
};
static bool Cook(const SCAN& scan, const hecl::ProjectPath& outPath) {
athena::io::FileWriter ws(outPath.getAbsolutePath());
scan.write(ws);
return true;
}
Texture textures[4];
static Category GetCategory(const hecl::ProjectPath& inPath) {
SCAN scan;
athena::io::FileReader reader(inPath.getAbsolutePath());
if (reader.hasError())
return Category::None;
if (!athena::io::FromYAMLStream(scan, reader))
return Category::None;
return scan.category;
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
SCAN scan;
scan.read(rs);
athena::io::FileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(scan, writer);
return true;
static void Name(const SpecBase& dataSpec, PAKEntryReadStream& rs, PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry) {
SCAN scan;
scan.read(rs);
if (scan.string) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
ent->name = hecl::Format("SCAN_%s_strg", entry.id.toString().c_str());
}
static bool Cook(const SCAN& scan, const hecl::ProjectPath& outPath)
{
athena::io::FileWriter ws(outPath.getAbsolutePath());
scan.write(ws);
return true;
for (int i = 0; i < 4; ++i) {
const Texture& tex = scan.textures[i];
if (tex.texture) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
ent->name = hecl::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i + 1);
}
}
}
static Category GetCategory(const hecl::ProjectPath& inPath)
{
SCAN scan;
athena::io::FileReader reader(inPath.getAbsolutePath());
if (reader.hasError())
return Category::None;
if (!athena::io::FromYAMLStream(scan, reader))
return Category::None;
return scan.category;
}
static void Name(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
PAKRouter<PAKBridge>& pakRouter,
PAK::Entry& entry)
{
SCAN scan;
scan.read(rs);
if (scan.string)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(scan.string);
ent->name = hecl::Format("SCAN_%s_strg", entry.id.toString().c_str());
}
for (int i=0 ; i<4 ; ++i)
{
const Texture& tex = scan.textures[i];
if (tex.texture)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(tex.texture);
ent->name = hecl::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i+1);
}
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut)
{
g_curSpec->flattenDependencies(frame, pathsOut);
g_curSpec->flattenDependencies(string, pathsOut);
for (int i = 0; i < 4; ++i)
g_curSpec->flattenDependencies(textures[i].texture, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) {
g_curSpec->flattenDependencies(frame, pathsOut);
g_curSpec->flattenDependencies(string, pathsOut);
for (int i = 0; i < 4; ++i)
g_curSpec->flattenDependencies(textures[i].texture, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,231 +1,195 @@
#include "SCLY.hpp"
#include "ScriptObjects/ScriptTypes.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
template <>
void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
{
fourCC = rs.readUint32Little();
version = rs.readUint32Big();
layerCount = rs.readUint32Big();
rs.enumerateBig(layerSizes, layerCount);
atUint32 i = 0;
rs.enumerate<ScriptLayer>(layers, layerCount,
[&i,this](athena::io::IStreamReader& rs, ScriptLayer& layer) {
atUint64 start = rs.position();
layer.read(rs);
rs.seek(start + layerSizes[i++], athena::Begin);
});
void SCLY::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
fourCC = rs.readUint32Little();
version = rs.readUint32Big();
layerCount = rs.readUint32Big();
rs.enumerateBig(layerSizes, layerCount);
atUint32 i = 0;
rs.enumerate<ScriptLayer>(layers, layerCount, [&i, this](athena::io::IStreamReader& rs, ScriptLayer& layer) {
atUint64 start = rs.position();
layer.read(rs);
rs.seek(start + layerSizes[i++], athena::Begin);
});
}
template <>
void SCLY::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
{
ws.writeUint32Big(fourCC);
ws.writeUint32Big(version);
ws.writeUint32Big(layerCount);
ws.enumerateBig(layerSizes);
ws.enumerate(layers);
void SCLY::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws) {
ws.writeUint32Big(fourCC);
ws.writeUint32Big(version);
ws.writeUint32Big(layerCount);
ws.enumerateBig(layerSizes);
ws.enumerate(layers);
}
template <>
void SCLY::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{
__isz += 12;
__isz += layerSizes.size() * 4;
for (const ScriptLayer& layer : layers)
layer.binarySize(__isz);
void SCLY::Enumerate<BigDNA::BinarySize>(size_t& __isz) {
__isz += 12;
__isz += layerSizes.size() * 4;
for (const ScriptLayer& layer : layers)
layer.binarySize(__isz);
}
void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge>& pakRouter, bool force) const
{
for (atUint32 i = 0; i < layerCount; i++)
{
bool active;
hecl::ProjectPath layerPath = pakRouter.getAreaLayerWorking(entry.id, i, active);
if (layerPath.isNone())
layerPath.makeDirChain(true);
void SCLY::exportToLayerDirectories(const PAK::Entry& entry, PAKRouter<PAKBridge>& pakRouter, bool force) const {
for (atUint32 i = 0; i < layerCount; i++) {
bool active;
hecl::ProjectPath layerPath = pakRouter.getAreaLayerWorking(entry.id, i, active);
if (layerPath.isNone())
layerPath.makeDirChain(true);
if (active)
{
hecl::ProjectPath activePath(layerPath, "!defaultactive");
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _SYS_STR("wb")));
}
hecl::ProjectPath yamlFile(layerPath, _SYS_STR("!objects.yaml"));
if (force || yamlFile.isNone())
{
athena::io::FileWriter writer(yamlFile.getAbsolutePath());
athena::io::ToYAMLStream(layers[i], writer);
}
if (active) {
hecl::ProjectPath activePath(layerPath, "!defaultactive");
fclose(hecl::Fopen(activePath.getAbsolutePath().data(), _SYS_STR("wb")));
}
}
void SCLY::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
for (const ScriptLayer& layer : layers)
layer.addCMDLRigPairs(pakRouter, charAssoc);
}
void SCLY::ScriptLayer::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
for (const std::unique_ptr<IScriptObject>& obj : objects)
obj->addCMDLRigPairs(pakRouter, charAssoc);
}
void SCLY::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
for (const ScriptLayer& layer : layers)
layer.nameIDs(pakRouter);
}
void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
for (const std::unique_ptr<IScriptObject>& obj : objects)
obj->nameIDs(pakRouter);
}
template <>
void SCLY::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& docin)
{
fourCC = docin.readUint32("fourCC");
version = docin.readUint32("version");
layerCount = docin.enumerate("layerSizes", layerSizes);
docin.enumerate("layers", layers);
}
template <>
void SCLY::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& docout)
{
docout.writeUint32("fourCC", fourCC);
docout.writeUint32("version", version);
docout.enumerate("layerSizes", layerSizes);
docout.enumerate("layers", layers);
}
const char* SCLY::DNAType()
{
return "urde::DNAMP1::SCLY";
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs)
{
unknown = rs.readUByte();
objectCount = rs.readUint32Big();
objects.clear();
objects.reserve(objectCount);
for (atUint32 i = 0; i < objectCount; i++)
{
atUint8 type = rs.readUByte();
atUint32 len = rs.readUint32Big();
atUint64 start = rs.position();
auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool
{ return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end())
{
std::unique_ptr<IScriptObject> obj((*iter)->a());
obj->type = type;
obj->read(rs);
objects.push_back(std::move(obj));
size_t actualLen = rs.position() - start;
if (actualLen != len)
Log.report(logvisor::Fatal, _SYS_STR("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, actualLen, len);
rs.seek(start + len, athena::Begin);
}
else
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
hecl::ProjectPath yamlFile(layerPath, _SYS_STR("!objects.yaml"));
if (force || yamlFile.isNone()) {
athena::io::FileWriter writer(yamlFile.getAbsolutePath());
athena::io::ToYAMLStream(layers[i], writer);
}
}
}
void SCLY::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
for (const ScriptLayer& layer : layers)
layer.addCMDLRigPairs(pakRouter, charAssoc);
}
void SCLY::ScriptLayer::addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter,
CharacterAssociations<UniqueID32>& charAssoc) const {
for (const std::unique_ptr<IScriptObject>& obj : objects)
obj->addCMDLRigPairs(pakRouter, charAssoc);
}
void SCLY::nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
for (const ScriptLayer& layer : layers)
layer.nameIDs(pakRouter);
}
void SCLY::ScriptLayer::nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
for (const std::unique_ptr<IScriptObject>& obj : objects)
obj->nameIDs(pakRouter);
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& rs)
{
unknown = rs.readUByte("unknown");
size_t objCount;
objects.clear();
if (auto v = rs.enterSubVector("objects", objCount))
{
objectCount = objCount;
objects.reserve(objCount);
for (atUint32 i = 0; i < objectCount; i++)
{
if (auto rec = rs.enterSubRecord(nullptr))
{
atUint8 type = rs.readUByte("type");
auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(), [&type](const ScriptObjectSpec* obj) -> bool
{ return obj->type == type; });
void SCLY::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& docin) {
fourCC = docin.readUint32("fourCC");
version = docin.readUint32("version");
layerCount = docin.enumerate("layerSizes", layerSizes);
docin.enumerate("layers", layers);
}
if (iter != SCRIPT_OBJECT_DB.end())
{
std::unique_ptr<IScriptObject> obj((*iter)->a());
obj->read(rs);
obj->type = type;
objects.push_back(std::move(obj));
}
else
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
template <>
void SCLY::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& docout) {
docout.writeUint32("fourCC", fourCC);
docout.writeUint32("version", version);
docout.enumerate("layerSizes", layerSizes);
docout.enumerate("layers", layers);
}
const char* SCLY::DNAType() { return "urde::DNAMP1::SCLY"; }
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::Read>(athena::io::IStreamReader& rs) {
unknown = rs.readUByte();
objectCount = rs.readUint32Big();
objects.clear();
objects.reserve(objectCount);
for (atUint32 i = 0; i < objectCount; i++) {
atUint8 type = rs.readUByte();
atUint32 len = rs.readUint32Big();
atUint64 start = rs.position();
auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(),
[&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a());
obj->type = type;
obj->read(rs);
objects.push_back(std::move(obj));
size_t actualLen = rs.position() - start;
if (actualLen != len)
Log.report(logvisor::Fatal,
_SYS_STR("Error while reading object of type 0x%.2X, did not read the expected amount of data, read "
"0x%x, expected 0x%x"),
(atUint32)type, actualLen, len);
rs.seek(start + len, athena::Begin);
} else
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::ReadYaml>(athena::io::YAMLDocReader& rs) {
unknown = rs.readUByte("unknown");
size_t objCount;
objects.clear();
if (auto v = rs.enterSubVector("objects", objCount)) {
objectCount = objCount;
objects.reserve(objCount);
for (atUint32 i = 0; i < objectCount; i++) {
if (auto rec = rs.enterSubRecord(nullptr)) {
atUint8 type = rs.readUByte("type");
auto iter = std::find_if(SCRIPT_OBJECT_DB.begin(), SCRIPT_OBJECT_DB.end(),
[&type](const ScriptObjectSpec* obj) -> bool { return obj->type == type; });
if (iter != SCRIPT_OBJECT_DB.end()) {
std::unique_ptr<IScriptObject> obj((*iter)->a());
obj->read(rs);
obj->type = type;
objects.push_back(std::move(obj));
} else
Log.report(logvisor::Fatal, _SYS_STR("Unable to find type 0x%X in object database"), (atUint32)type);
}
}
else
objectCount = 0;
} else
objectCount = 0;
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws)
{
ws.writeUByte(unknown);
ws.writeUint32Big(objectCount);
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
ws.writeByte(obj->type);
size_t expLen = 0;
obj->binarySize(expLen);
ws.writeUint32Big(expLen);
auto start = ws.position();
obj->write(ws);
auto wrote = ws.position() - start;
if (wrote != expLen)
Log.report(logvisor::Error, "expected writing %lu byte SCLY obj; wrote %llu", expLen, wrote);
}
void SCLY::ScriptLayer::Enumerate<BigDNA::Write>(athena::io::IStreamWriter& ws) {
ws.writeUByte(unknown);
ws.writeUint32Big(objectCount);
for (const std::unique_ptr<IScriptObject>& obj : objects) {
ws.writeByte(obj->type);
size_t expLen = 0;
obj->binarySize(expLen);
ws.writeUint32Big(expLen);
auto start = ws.position();
obj->write(ws);
auto wrote = ws.position() - start;
if (wrote != expLen)
Log.report(logvisor::Error, "expected writing %lu byte SCLY obj; wrote %llu", expLen, wrote);
}
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::BinarySize>(size_t& __isz)
{
void SCLY::ScriptLayer::Enumerate<BigDNA::BinarySize>(size_t& __isz) {
__isz += 5;
for (const std::unique_ptr<IScriptObject>& obj : objects) {
__isz += 5;
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
__isz += 5;
obj->binarySize(__isz);
}
obj->binarySize(__isz);
}
}
template <>
void SCLY::ScriptLayer::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& ws)
{
ws.writeUByte("unknown", unknown);
if (auto v = ws.enterSubVector("objects"))
{
for (const std::unique_ptr<IScriptObject>& obj : objects)
{
if (auto rec = ws.enterSubRecord(nullptr))
{
ws.writeUByte("type", obj->type);
obj->write(ws);
}
}
void SCLY::ScriptLayer::Enumerate<BigDNA::WriteYaml>(athena::io::YAMLDocWriter& ws) {
ws.writeUByte("unknown", unknown);
if (auto v = ws.enterSubVector("objects")) {
for (const std::unique_ptr<IScriptObject>& obj : objects) {
if (auto rec = ws.enterSubRecord(nullptr)) {
ws.writeUByte("type", obj->type);
obj->write(ws);
}
}
}
}
const char* SCLY::ScriptLayer::DNAType()
{
return "urde::DNAMP1::SCLY::ScriptLayer";
}
const char* SCLY::ScriptLayer::DNAType() { return "urde::DNAMP1::SCLY::ScriptLayer"; }
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,30 +4,27 @@
#include "ScriptObjects/IScriptObject.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
struct SCLY : BigDNA
{
namespace DataSpec::DNAMP1 {
struct SCLY : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<FourCC> fourCC;
Value<atUint32> version;
Value<atUint32> layerCount;
Vector<atUint32, AT_DNA_COUNT(layerCount)> layerSizes;
struct ScriptLayer : BigDNA {
AT_DECL_EXPLICIT_DNA_YAML
Value<FourCC> fourCC;
Value<atUint32> version;
Value<atUint32> layerCount;
Vector<atUint32, AT_DNA_COUNT(layerCount)> layerSizes;
struct ScriptLayer : BigDNA
{
AT_DECL_EXPLICIT_DNA_YAML
Value<atUint8> unknown;
Value<atUint32> objectCount;
Vector<std::unique_ptr<IScriptObject>, AT_DNA_COUNT(objectCount)> objects;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
};
Vector<ScriptLayer, AT_DNA_COUNT(layerCount)> layers;
void exportToLayerDirectories(const PAK::Entry &, PAKRouter<PAKBridge>&, bool) const;
Value<atUint8> unknown;
Value<atUint32> objectCount;
Vector<std::unique_ptr<IScriptObject>, AT_DNA_COUNT(objectCount)> objects;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
};
Vector<ScriptLayer, AT_DNA_COUNT(layerCount)> layers;
void exportToLayerDirectories(const PAK::Entry&, PAKRouter<PAKBridge>&, bool) const;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,564 +1,460 @@
#include "STRG.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
const std::vector<FourCC> skLanguages = {FOURCC('ENGL'), FOURCC('FREN'), FOURCC('GERM'), FOURCC('SPAN'),
FOURCC('ITAL'), FOURCC('DUTC'), FOURCC('JAPN')};
static uint32_t ParseTag(const char16_t* str)
{
char parseStr[9];
int i;
for (i = 0; i < 8 && str[i]; ++i)
parseStr[i] = str[i];
parseStr[i] = '\0';
return strtoul(parseStr, nullptr, 16);
static uint32_t ParseTag(const char16_t* str) {
char parseStr[9];
int i;
for (i = 0; i < 8 && str[i]; ++i)
parseStr[i] = str[i];
parseStr[i] = '\0';
return strtoul(parseStr, nullptr, 16);
}
static std::u16string_view::const_iterator SkipCommas(std::u16string& ret, std::u16string_view str,
std::u16string_view::const_iterator it, size_t count)
{
for (size_t i = 0; i < count; ++i)
{
auto cpos = str.find(u',', it - str.begin());
if (cpos == std::u16string::npos)
return str.end();
auto end = str.begin() + cpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
return it;
std::u16string_view::const_iterator it, size_t count) {
for (size_t i = 0; i < count; ++i) {
auto cpos = str.find(u',', it - str.begin());
if (cpos == std::u16string::npos)
return str.end();
auto end = str.begin() + cpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
return it;
}
static std::u16string_view::const_iterator UncookTextureList(std::u16string& ret, std::u16string_view str,
std::u16string_view::const_iterator it)
{
while (true)
{
UniqueID32 id = ParseTag(&*it);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
ret.append(hecl::UTF8ToChar16(path ? path.getRelativePathUTF8() : id.toString()));
it += 8;
if (*it == u';')
{
ret.push_back(u';');
return it + 1;
}
else if (*it == u',')
{
ret.push_back(u',');
++it;
}
else
{
break;
}
std::u16string_view::const_iterator it) {
while (true) {
UniqueID32 id = ParseTag(&*it);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id);
ret.append(hecl::UTF8ToChar16(path ? path.getRelativePathUTF8() : id.toString()));
it += 8;
if (*it == u';') {
ret.push_back(u';');
return it + 1;
} else if (*it == u',') {
ret.push_back(u',');
++it;
} else {
break;
}
}
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
}
static std::u16string_view::const_iterator CookTextureList(std::u16string& ret, std::u16string_view str,
std::u16string_view::const_iterator it)
{
while (true)
{
auto end = str.find_first_of(u",;", it - str.begin());
if (end == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
auto endIt = str.begin() + end;
hecl::ProjectPath path =
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
it = endIt;
if (*it == u';')
{
ret.push_back(u';');
return it + 1;
}
else if (*it == u',')
{
ret.push_back(u',');
++it;
}
else
{
break;
}
std::u16string_view::const_iterator it) {
while (true) {
auto end = str.find_first_of(u",;", it - str.begin());
if (end == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
auto endIt = str.begin() + end;
hecl::ProjectPath path =
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
it = endIt;
if (*it == u';') {
ret.push_back(u';');
return it + 1;
} else if (*it == u',') {
ret.push_back(u',');
++it;
} else {
break;
}
}
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
}
static std::u16string_view::const_iterator GatherTextureList(std::vector<hecl::ProjectPath>& pathsOut,
std::u16string_view str, std::u16string_view::const_iterator it)
{
while (true)
{
auto end = str.find_first_of(u",;", it - str.begin());
if (end == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
auto endIt = str.begin() + end;
std::u16string_view str,
std::u16string_view::const_iterator it) {
while (true) {
auto end = str.find_first_of(u",;", it - str.begin());
if (end == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing comma/semicolon token while pasing font tag");
auto endIt = str.begin() + end;
hecl::ProjectPath path =
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
if (path)
pathsOut.push_back(path);
it = endIt;
if (*it == u';') {
return it + 1;
} else if (*it == u',') {
++it;
} else {
break;
}
}
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
}
static std::u16string UncookString(std::u16string_view str) {
std::u16string ret;
ret.reserve(str.size());
for (auto it = str.begin(); it != str.end();) {
if (*it == u'&') {
ret.push_back(u'&');
++it;
if (!str.compare(it - str.begin(), 5, u"image")) {
ret.append(u"image=");
it += 6;
if (!str.compare(it - str.begin(), 1, u"A")) {
it = SkipCommas(ret, str, it, 2);
it = UncookTextureList(ret, str, it);
continue;
} else if (!str.compare(it - str.begin(), 2, u"SA")) {
it = SkipCommas(ret, str, it, 4);
it = UncookTextureList(ret, str, it);
continue;
} else if (!str.compare(it - str.begin(), 2, u"SI")) {
it = SkipCommas(ret, str, it, 3);
it = UncookTextureList(ret, str, it);
continue;
}
} else if (!str.compare(it - str.begin(), 4, u"font")) {
ret.append(u"font=");
it += 5;
UniqueID32 id = ParseTag(&*it);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id, true);
ret.append(hecl::UTF8ToChar16(path ? path.getRelativePathUTF8() : id.toString()));
ret.push_back(u';');
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
it = str.end();
else
it = str.begin() + scpos + 1;
} else {
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos) {
it = str.end();
} else {
auto end = str.begin() + scpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
}
} else {
ret.push_back(*it);
++it;
}
}
return ret;
}
static std::u16string CookString(std::u16string_view str) {
std::u16string ret;
ret.reserve(str.size());
for (auto it = str.begin(); it != str.end();) {
if (*it == u'&') {
ret.push_back(u'&');
++it;
if (!str.compare(it - str.begin(), 5, u"image")) {
ret.append(u"image=");
it += 6;
if (!str.compare(it - str.begin(), 1, u"A")) {
it = SkipCommas(ret, str, it, 2);
it = CookTextureList(ret, str, it);
continue;
} else if (!str.compare(it - str.begin(), 2, u"SA")) {
it = SkipCommas(ret, str, it, 4);
it = CookTextureList(ret, str, it);
continue;
} else if (!str.compare(it - str.begin(), 2, u"SI")) {
it = SkipCommas(ret, str, it, 3);
it = CookTextureList(ret, str, it);
continue;
}
} else if (!str.compare(it - str.begin(), 4, u"font")) {
ret.append(u"font=");
it += 5;
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
hecl::ProjectPath path =
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, endIt)));
if (path)
pathsOut.push_back(path);
it = endIt;
if (*it == u';')
{
return it + 1;
}
else if (*it == u',')
{
++it;
}
else
{
break;
UniqueIDBridge::MakePathFromString<UniqueID32>(hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
ret.push_back(u';');
it = str.begin() + scpos + 1;
} else {
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos) {
it = str.end();
} else {
auto end = str.begin() + scpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
}
} else {
ret.push_back(*it);
++it;
}
/* Failsafe */
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
return str.end();
return str.begin() + scpos + 1;
}
return ret;
}
static std::u16string UncookString(std::u16string_view str)
{
std::u16string ret;
ret.reserve(str.size());
for (auto it = str.begin(); it != str.end();)
{
if (*it == u'&')
{
ret.push_back(u'&');
++it;
if (!str.compare(it - str.begin(), 5, u"image"))
{
ret.append(u"image=");
it += 6;
if (!str.compare(it - str.begin(), 1, u"A"))
{
it = SkipCommas(ret, str, it, 2);
it = UncookTextureList(ret, str, it);
continue;
}
else if (!str.compare(it - str.begin(), 2, u"SA"))
{
it = SkipCommas(ret, str, it, 4);
it = UncookTextureList(ret, str, it);
continue;
}
else if (!str.compare(it - str.begin(), 2, u"SI"))
{
it = SkipCommas(ret, str, it, 3);
it = UncookTextureList(ret, str, it);
continue;
}
}
else if (!str.compare(it - str.begin(), 4, u"font"))
{
ret.append(u"font=");
it += 5;
UniqueID32 id = ParseTag(&*it);
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(id, true);
ret.append(hecl::UTF8ToChar16(path ? path.getRelativePathUTF8() : id.toString()));
ret.push_back(u';');
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
it = str.end();
else
it = str.begin() + scpos + 1;
void STRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const {
std::u16string skip;
for (const auto& lang : langs) {
for (const std::u16string& str : lang.second) {
std::u16string_view strView(str);
for (auto it = strView.begin(); it != strView.end();) {
if (*it == u'&') {
++it;
if (!str.compare(it - strView.begin(), 5, u"image")) {
it += 6;
if (!str.compare(it - strView.begin(), 1, u"A")) {
it = SkipCommas(skip, str, it, 2);
it = GatherTextureList(pathsOut, str, it);
continue;
} else if (!str.compare(it - strView.begin(), 2, u"SA")) {
it = SkipCommas(skip, str, it, 4);
it = GatherTextureList(pathsOut, str, it);
continue;
} else if (!str.compare(it - strView.begin(), 2, u"SI")) {
it = SkipCommas(skip, str, it, 3);
it = GatherTextureList(pathsOut, str, it);
continue;
}
} else if (!str.compare(it - strView.begin(), 4, u"font")) {
it += 5;
auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
if (path)
pathsOut.push_back(path);
it = strView.begin() + scpos + 1;
} else {
auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos)
it = strView.end();
else
{
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
{
it = str.end();
}
else
{
auto end = str.begin() + scpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
}
}
else
{
ret.push_back(*it);
++it;
}
it = strView.begin() + scpos + 1;
}
} else
++it;
}
}
return ret;
}
}
static std::u16string CookString(std::u16string_view str)
{
std::u16string ret;
ret.reserve(str.size());
for (auto it = str.begin(); it != str.end();)
{
if (*it == u'&')
{
ret.push_back(u'&');
++it;
if (!str.compare(it - str.begin(), 5, u"image"))
{
ret.append(u"image=");
it += 6;
if (!str.compare(it - str.begin(), 1, u"A"))
{
it = SkipCommas(ret, str, it, 2);
it = CookTextureList(ret, str, it);
continue;
}
else if (!str.compare(it - str.begin(), 2, u"SA"))
{
it = SkipCommas(ret, str, it, 4);
it = CookTextureList(ret, str, it);
continue;
}
else if (!str.compare(it - str.begin(), 2, u"SI"))
{
it = SkipCommas(ret, str, it, 3);
it = CookTextureList(ret, str, it);
continue;
}
}
else if (!str.compare(it - str.begin(), 4, u"font"))
{
ret.append(u"font=");
it += 5;
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
hecl::Char16ToUTF8(std::u16string(it, str.begin() + scpos)));
ret.append(hecl::UTF8ToChar16(UniqueID32(path).toString()));
ret.push_back(u';');
it = str.begin() + scpos + 1;
}
else
{
auto scpos = str.find(u';', it - str.begin());
if (scpos == std::u16string::npos)
{
it = str.end();
}
else
{
auto end = str.begin() + scpos + 1;
ret.insert(ret.end(), it, end);
it = end;
}
}
}
else
{
ret.push_back(*it);
++it;
}
void STRG::_read(athena::io::IStreamReader& reader) {
atUint32 langCount = reader.readUint32Big();
atUint32 strCount = reader.readUint32Big();
std::vector<std::pair<FourCC, atUint32>> readLangs;
readLangs.reserve(langCount);
for (atUint32 l = 0; l < langCount; ++l) {
DNAFourCC lang;
lang.read(reader);
atUint32 off = reader.readUint32Big();
readLangs.emplace_back(lang, off);
}
atUint32 tablesStart = reader.position();
langs.clear();
langs.reserve(skLanguages.size());
for (const std::pair<FourCC, atUint32>& lang : readLangs) {
std::vector<std::u16string> strs;
reader.seek(tablesStart + lang.second, athena::SeekOrigin::Begin);
reader.readUint32Big(); // table size
atUint32 langStart = reader.position();
for (atUint32 s = 0; s < strCount; ++s) {
atUint32 strOffset = reader.readUint32Big();
atUint32 tmpOffset = reader.position();
reader.seek(langStart + strOffset, athena::SeekOrigin::Begin);
strs.emplace_back(UncookString(reader.readU16StringBig()));
reader.seek(tmpOffset, athena::SeekOrigin::Begin);
}
return ret;
}
langs.emplace_back(lang.first, strs);
}
void STRG::gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const
{
std::u16string skip;
for (const auto& lang : langs)
{
for (const std::u16string& str : lang.second)
{
std::u16string_view strView(str);
for (auto it = strView.begin(); it != strView.end();)
{
if (*it == u'&')
{
++it;
if (!str.compare(it - strView.begin(), 5, u"image"))
{
it += 6;
if (!str.compare(it - strView.begin(), 1, u"A"))
{
it = SkipCommas(skip, str, it, 2);
it = GatherTextureList(pathsOut, str, it);
continue;
}
else if (!str.compare(it - strView.begin(), 2, u"SA"))
{
it = SkipCommas(skip, str, it, 4);
it = GatherTextureList(pathsOut, str, it);
continue;
}
else if (!str.compare(it - strView.begin(), 2, u"SI"))
{
it = SkipCommas(skip, str, it, 3);
it = GatherTextureList(pathsOut, str, it);
continue;
}
}
else if (!str.compare(it - strView.begin(), 4, u"font"))
{
it += 5;
auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos)
Log.report(logvisor::Fatal, "Missing semicolon token while pasing font tag");
hecl::ProjectPath path = UniqueIDBridge::MakePathFromString<UniqueID32>(
hecl::Char16ToUTF8(std::u16string(it, strView.begin() + scpos)));
if (path)
pathsOut.push_back(path);
it = strView.begin() + scpos + 1;
}
else
{
auto scpos = str.find(u';', it - strView.begin());
if (scpos == std::u16string::npos)
it = strView.end();
else
it = strView.begin() + scpos + 1;
}
}
else
++it;
}
}
}
}
void STRG::_read(athena::io::IStreamReader& reader)
{
atUint32 langCount = reader.readUint32Big();
atUint32 strCount = reader.readUint32Big();
std::vector<std::pair<FourCC, atUint32>> readLangs;
readLangs.reserve(langCount);
for (atUint32 l = 0; l < langCount; ++l)
{
DNAFourCC lang;
lang.read(reader);
atUint32 off = reader.readUint32Big();
readLangs.emplace_back(lang, off);
}
atUint32 tablesStart = reader.position();
langs.clear();
langs.reserve(skLanguages.size());
for (const std::pair<FourCC, atUint32>& lang : readLangs)
{
std::vector<std::u16string> strs;
reader.seek(tablesStart + lang.second, athena::SeekOrigin::Begin);
reader.readUint32Big(); // table size
atUint32 langStart = reader.position();
for (atUint32 s = 0; s < strCount; ++s)
{
atUint32 strOffset = reader.readUint32Big();
atUint32 tmpOffset = reader.position();
reader.seek(langStart + strOffset, athena::SeekOrigin::Begin);
strs.emplace_back(UncookString(reader.readU16StringBig()));
reader.seek(tmpOffset, athena::SeekOrigin::Begin);
}
langs.emplace_back(lang.first, strs);
}
langMap.clear();
langMap.reserve(langCount);
for (std::pair<FourCC, std::vector<std::u16string>>& item : langs)
langMap.emplace(item.first, &item.second);
langMap.clear();
langMap.reserve(langCount);
for (std::pair<FourCC, std::vector<std::u16string>>& item : langs)
langMap.emplace(item.first, &item.second);
}
template <>
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader)
{
atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321)
Log.report(logvisor::Error, "invalid STRG magic");
void STRG::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
atUint32 magic = reader.readUint32Big();
if (magic != 0x87654321)
Log.report(logvisor::Error, "invalid STRG magic");
atUint32 version = reader.readUint32Big();
if (version != 0)
Log.report(logvisor::Error, "invalid STRG version");
atUint32 version = reader.readUint32Big();
if (version != 0)
Log.report(logvisor::Error, "invalid STRG version");
_read(reader);
_read(reader);
}
template <>
void STRG::Enumerate<BigDNA::Write>(typename Write::StreamT& writer)
{
writer.writeUint32Big(0x87654321);
writer.writeUint32Big(0);
writer.writeUint32Big(langs.size());
atUint32 strCount = STRG::count();
writer.writeUint32Big(strCount);
void STRG::Enumerate<BigDNA::Write>(typename Write::StreamT& writer) {
writer.writeUint32Big(0x87654321);
writer.writeUint32Big(0);
writer.writeUint32Big(langs.size());
atUint32 strCount = STRG::count();
writer.writeUint32Big(strCount);
std::vector<std::u16string> strings;
strings.reserve(strCount * langs.size());
std::vector<std::u16string> strings;
strings.reserve(strCount * langs.size());
atUint32 offset = 0;
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
{
DNAFourCC(lang.first).write(writer);
writer.writeUint32Big(offset);
offset += strCount * 4 + 4;
atUint32 langStrCount = lang.second.size();
for (atUint32 s = 0; s < strCount; ++s)
{
std::u16string str = CookString(lang.second[s]);
atUint32 chCount = str.size();
if (s < langStrCount)
offset += (chCount + 1) * 2;
else
offset += 1;
strings.push_back(std::move(str));
}
atUint32 offset = 0;
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs) {
DNAFourCC(lang.first).write(writer);
writer.writeUint32Big(offset);
offset += strCount * 4 + 4;
atUint32 langStrCount = lang.second.size();
for (atUint32 s = 0; s < strCount; ++s) {
std::u16string str = CookString(lang.second[s]);
atUint32 chCount = str.size();
if (s < langStrCount)
offset += (chCount + 1) * 2;
else
offset += 1;
strings.push_back(std::move(str));
}
}
auto langIt = strings.cbegin();
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs) {
atUint32 langStrCount = lang.second.size();
atUint32 tableSz = strCount * 4;
auto strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s) {
if (s < langStrCount)
tableSz += ((strIt++)->size() + 1) * 2;
else
tableSz += 1;
}
writer.writeUint32Big(tableSz);
offset = strCount * 4;
strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s) {
writer.writeUint32Big(offset);
if (s < langStrCount)
offset += ((strIt++)->size() + 1) * 2;
else
offset += 1;
}
auto langIt = strings.cbegin();
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
{
atUint32 langStrCount = lang.second.size();
atUint32 tableSz = strCount * 4;
auto strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s)
{
if (s < langStrCount)
tableSz += ((strIt++)->size() + 1) * 2;
else
tableSz += 1;
}
writer.writeUint32Big(tableSz);
offset = strCount * 4;
strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s)
{
writer.writeUint32Big(offset);
if (s < langStrCount)
offset += ((strIt++)->size() + 1) * 2;
else
offset += 1;
}
strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s)
{
if (s < langStrCount)
writer.writeU16StringBig(*strIt++);
else
writer.writeUByte(0);
}
langIt = strIt;
strIt = langIt;
for (atUint32 s = 0; s < strCount; ++s) {
if (s < langStrCount)
writer.writeU16StringBig(*strIt++);
else
writer.writeUByte(0);
}
langIt = strIt;
}
}
template <>
void STRG::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& _s)
{
_s += 16;
_s += langs.size() * 12;
void STRG::Enumerate<BigDNA::BinarySize>(typename BinarySize::StreamT& _s) {
_s += 16;
_s += langs.size() * 12;
size_t strCount = STRG::count();
_s += langs.size() * strCount * 4;
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs)
{
atUint32 langStrCount = lang.second.size();
for (atUint32 s = 0; s < strCount; ++s)
{
if (s < langStrCount)
_s += (CookString(lang.second[s]).size() + 1) * 2;
else
_s += 1;
}
size_t strCount = STRG::count();
_s += langs.size() * strCount * 4;
for (const std::pair<FourCC, std::vector<std::u16string>>& lang : langs) {
atUint32 langStrCount = lang.second.size();
for (atUint32 s = 0; s < strCount; ++s) {
if (s < langStrCount)
_s += (CookString(lang.second[s]).size() + 1) * 2;
else
_s += 1;
}
}
}
template <>
void STRG::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader)
{
const athena::io::YAMLNode* root = reader.getRootNode();
void STRG::Enumerate<BigDNA::ReadYaml>(typename ReadYaml::StreamT& reader) {
const athena::io::YAMLNode* root = reader.getRootNode();
/* Validate Pass */
if (root->m_type == YAML_MAPPING_NODE)
{
for (const auto& lang : root->m_mapChildren)
{
if (lang.first == "DNAType")
continue;
/* Validate Pass */
if (root->m_type == YAML_MAPPING_NODE) {
for (const auto& lang : root->m_mapChildren) {
if (lang.first == "DNAType")
continue;
if (lang.first.size() != 4)
{
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping",
lang.first.c_str());
return;
}
if (lang.second->m_type != YAML_SEQUENCE_NODE)
{
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping",
lang.first.c_str());
return;
}
for (const auto& str : lang.second->m_seqChildren)
{
if (str->m_type != YAML_SCALAR_NODE)
{
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping",
lang.first.c_str());
return;
}
}
}
}
else
{
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
if (lang.first.size() != 4) {
Log.report(logvisor::Warning, "STRG language string '%s' must be exactly 4 characters; skipping",
lang.first.c_str());
return;
}
if (lang.second->m_type != YAML_SEQUENCE_NODE) {
Log.report(logvisor::Warning, "STRG language string '%s' must contain a sequence; skipping",
lang.first.c_str());
return;
}
for (const auto& str : lang.second->m_seqChildren) {
if (str->m_type != YAML_SCALAR_NODE) {
Log.report(logvisor::Warning, "STRG language '%s' must contain all scalars; skipping", lang.first.c_str());
return;
}
}
}
} else {
Log.report(logvisor::Warning, "STRG must have a mapping root node; skipping");
return;
}
/* Read Pass */
langs.clear();
for (const auto& lang : root->m_mapChildren)
{
if (lang.first == "DNAType")
continue;
/* Read Pass */
langs.clear();
for (const auto& lang : root->m_mapChildren) {
if (lang.first == "DNAType")
continue;
std::vector<std::u16string> strs;
for (const auto& str : lang.second->m_seqChildren)
strs.emplace_back(hecl::UTF8ToChar16(str->m_scalarString));
langs.emplace_back(FourCC(lang.first.c_str()), strs);
}
std::vector<std::u16string> strs;
for (const auto& str : lang.second->m_seqChildren)
strs.emplace_back(hecl::UTF8ToChar16(str->m_scalarString));
langs.emplace_back(FourCC(lang.first.c_str()), strs);
}
langMap.clear();
langMap.reserve(langs.size());
for (auto& item : langs)
langMap.emplace(item.first, &item.second);
langMap.clear();
langMap.reserve(langs.size());
for (auto& item : langs)
langMap.emplace(item.first, &item.second);
}
template <>
void STRG::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer)
{
for (const auto& lang : langs)
{
if (auto v = writer.enterSubVector(lang.first.toString().c_str()))
for (const std::u16string& str : lang.second)
writer.writeU16String(nullptr, str);
}
void STRG::Enumerate<BigDNA::WriteYaml>(typename WriteYaml::StreamT& writer) {
for (const auto& lang : langs) {
if (auto v = writer.enterSubVector(lang.first.toString().c_str()))
for (const std::u16string& str : lang.second)
writer.writeU16String(nullptr, str);
}
}
const char* STRG::DNAType() { return "urde::DNAMP1::STRG"; }
}
} // namespace DataSpec::DNAMP1

View File

@@ -5,84 +5,73 @@
#include "DataSpec/DNACommon/STRG.hpp"
#include "DNAMP1.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct STRG : ISTRG
{
AT_DECL_EXPLICIT_DNA_YAML
AT_DECL_DNAV
void _read(athena::io::IStreamReader& reader);
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
struct STRG : ISTRG {
AT_DECL_EXPLICIT_DNA_YAML
AT_DECL_DNAV
void _read(athena::io::IStreamReader& reader);
std::vector<std::pair<FourCC, std::vector<std::u16string>>> langs;
std::unordered_map<FourCC, std::vector<std::u16string>*> langMap;
int32_t lookupIdx(std::string_view name) const {return -1;}
int32_t lookupIdx(std::string_view name) const { return -1; }
size_t count() const
{
size_t retval = 0;
for (const auto& item : langs)
{
size_t sz = item.second.size();
if (sz > retval)
retval = sz;
}
return retval;
size_t count() const {
size_t retval = 0;
for (const auto& item : langs) {
size_t sz = item.second.size();
if (sz > retval)
retval = sz;
}
std::string getUTF8(const FourCC& lang, size_t idx) const
{
auto search = langMap.find(lang);
if (search != langMap.end())
return hecl::Char16ToUTF8(search->second->at(idx));
return std::string();
}
std::u16string getUTF16(const FourCC& lang, size_t idx) const
{
auto search = langMap.find(lang);
if (search != langMap.end())
return search->second->at(idx);
return std::u16string();
}
hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const
{
auto search = langMap.find(lang);
if (search != langMap.end())
return retval;
}
std::string getUTF8(const FourCC& lang, size_t idx) const {
auto search = langMap.find(lang);
if (search != langMap.end())
return hecl::Char16ToUTF8(search->second->at(idx));
return std::string();
}
std::u16string getUTF16(const FourCC& lang, size_t idx) const {
auto search = langMap.find(lang);
if (search != langMap.end())
return search->second->at(idx);
return std::u16string();
}
hecl::SystemString getSystemString(const FourCC& lang, size_t idx) const {
auto search = langMap.find(lang);
if (search != langMap.end())
#if HECL_UCS2
return hecl::Char16ToWide(search->second->at(idx));
return hecl::Char16ToWide(search->second->at(idx));
#else
return hecl::Char16ToUTF8(search->second->at(idx));
return hecl::Char16ToUTF8(search->second->at(idx));
#endif
return hecl::SystemString();
}
return hecl::SystemString();
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
{
STRG strg;
strg.read(rs);
athena::io::TransactionalFileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(strg, writer);
return true;
}
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath) {
STRG strg;
strg.read(rs);
athena::io::TransactionalFileWriter writer(outPath.getAbsolutePath());
athena::io::ToYAMLStream(strg, writer);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath)
{
STRG strg;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(strg, reader);
athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}
static bool Cook(const hecl::ProjectPath& inPath, const hecl::ProjectPath& outPath) {
STRG strg;
athena::io::FileReader reader(inPath.getAbsolutePath());
athena::io::FromYAMLStream(strg, reader);
athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}
static bool Cook(const STRG& strg, const hecl::ProjectPath& outPath)
{
athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}
static bool Cook(const STRG& strg, const hecl::ProjectPath& outPath) {
athena::io::TransactionalFileWriter ws(outPath.getAbsolutePath());
strg.write(ws);
return true;
}
void gatherDependencies(std::vector<hecl::ProjectPath> &pathsOut) const;
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,17 +4,14 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct AIJumpPoint : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown1;
namespace DataSpec::DNAMP1 {
struct AIJumpPoint : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown1;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,20 +3,17 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
struct AIKeyframe : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<atUint32> unknown5;
Value<float> unknown6;
struct AIKeyframe : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<atUint32> unknown5;
Value<float> unknown6;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,37 +1,31 @@
#include "Actor.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const
{
hecl::blender::Connection& conn = btok.getBlenderConnection();
zeus::CAABox aabbOut;
zeus::CAABox Actor::getVISIAABB(hecl::blender::Token& btok) const {
hecl::blender::Connection& conn = btok.getBlenderConnection();
zeus::CAABox aabbOut;
if (model)
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(model);
conn.openBlend(path);
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
}
else if (animationParameters.animationCharacterSet)
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
}
if (model) {
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(model);
conn.openBlend(path);
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
} else if (animationParameters.animationCharacterSet) {
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
}
if (aabbOut.min.x() > aabbOut.max.x())
return {};
if (aabbOut.min.x() > aabbOut.max.x())
return {};
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
return aabbOut.getTransformedAABox(xf);
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
return aabbOut.getTransformedAABox(xf);
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -3,67 +3,56 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Actor : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name SO_NAME_SPECPROP();
Value<atVec3f> location SO_LOCATION_SPECPROP();
Value<atVec3f> orientation SO_ORIENTATION_SPECPROP();
Value<atVec3f> scale SO_SCALE_SPECPROP();
Value<atVec3f> collisionExtent SO_COLLISION_EXTENT_SPECPROP();
Value<atVec3f> collisionOffset SO_COLLISION_OFFSET_SPECPROP();
Value<float> mass;
Value<float> zMomentum;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
UniqueID32 model;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<bool> looping;
Value<bool> snow;
Value<bool> solid;
Value<bool> cameraPassthrough;
Value<bool> active;
Value<atUint32> shaderIdx;
Value<float> xrayAlpha;
Value<bool> noThermalHotZ;
Value<bool> castsShadow;
Value<bool> scaleAdvancementDelta;
Value<bool> materialFlag54;
namespace DataSpec::DNAMP1 {
struct Actor : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name SO_NAME_SPECPROP();
Value<atVec3f> location SO_LOCATION_SPECPROP();
Value<atVec3f> orientation SO_ORIENTATION_SPECPROP();
Value<atVec3f> scale SO_SCALE_SPECPROP();
Value<atVec3f> collisionExtent SO_COLLISION_EXTENT_SPECPROP();
Value<atVec3f> collisionOffset SO_COLLISION_OFFSET_SPECPROP();
Value<float> mass;
Value<float> zMomentum;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
UniqueID32 model;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<bool> looping;
Value<bool> snow;
Value<bool> solid;
Value<bool> cameraPassthrough;
Value<bool> active;
Value<atUint32> shaderIdx;
Value<float> xrayAlpha;
Value<bool> noThermalHotZ;
Value<bool> castsShadow;
Value<bool> scaleAdvancementDelta;
Value<bool> materialFlag54;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut);
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(model, pathsOut);
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const;
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,56 +4,45 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ActorContraption : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> unknown1;
Value<atVec3f> scanOffset;
Value<float> unknown2;
Value<float> unknown3;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
AnimationParameters animationParameters;
ActorParameters actorParameters;
UniqueID32 particle;
DamageInfo damageInfo;
Value<bool> active; // needs verification
namespace DataSpec::DNAMP1 {
struct ActorContraption : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> unknown1;
Value<atVec3f> scanOffset;
Value<float> unknown2;
Value<float> unknown3;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
AnimationParameters animationParameters;
ActorParameters actorParameters;
UniqueID32 particle;
DamageInfo damageInfo;
Value<bool> active; // needs verification
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (particle)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (particle) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(particle, pathsOut);
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(particle, pathsOut);
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ActorKeyframe : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> animationId;
Value<bool> looping;
Value<float> lifetime;
Value<bool> active;
Value<atUint32> fadeOut;
Value<float> totalPlayback;
namespace DataSpec::DNAMP1 {
struct ActorKeyframe : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> animationId;
Value<bool> looping;
Value<float> lifetime;
Value<bool> active;
Value<atUint32> fadeOut;
Value<float> totalPlayback;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,18 +4,15 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ActorRotate : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> rotationOffset;
Value<float> timeScale;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct ActorRotate : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> rotationOffset;
Value<float> timeScale;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> active;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,51 +4,41 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct AmbientAI : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> collisionExtent;
Value<atVec3f> collisionOffset;
Value<float> mass;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<float> alertRange;
Value<float> impactRange;
Value<atInt32> alertAnim;
Value<atInt32> impactAnim;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct AmbientAI : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<atVec3f> collisionExtent;
Value<atVec3f> collisionOffset;
Value<float> mass;
HealthInfo healthInfo;
DamageVulnerability damageVulnerability;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<float> alertRange;
Value<float> impactRange;
Value<atInt32> alertAnim;
Value<atInt32> impactAnim;
Value<bool> active;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,34 +4,24 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct AreaAttributes : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
enum class EWeatherType : atUint32
{
None,
Snow,
Rain
};
namespace DataSpec::DNAMP1 {
struct AreaAttributes : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
enum class EWeatherType : atUint32 { None, Snow, Rain };
Value<atUint32> unknown1;
Value<bool> skyboxEnabled;
Value<EWeatherType> weather;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
UniqueID32 skybox;
Value<atUint32> unknown6;
Value<atUint32> unknown1;
Value<bool> skyboxEnabled;
Value<EWeatherType> weather;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
UniqueID32 skybox;
Value<atUint32> unknown6;
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(skybox, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(skybox, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,61 +4,49 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct AtomicAlpha : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 wpsc;
UniqueID32 model;
DamageInfo damageInfo;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
namespace DataSpec::DNAMP1 {
struct AtomicAlpha : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 wpsc;
UniqueID32 model;
DamageInfo damageInfo;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(model, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(model, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,74 +4,61 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct AtomicBeta : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 elsc;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 part;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
DamageVulnerability damageVulnerabilty;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<atUint32> unknown7;
Value<atUint32> unknown8;
Value<atUint32> unknown9;
Value<float> unknown10;
namespace DataSpec::DNAMP1 {
struct AtomicBeta : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 elsc;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 part;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
DamageVulnerability damageVulnerabilty;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<atUint32> unknown7;
Value<atUint32> unknown8;
Value<atUint32> unknown9;
Value<float> unknown10;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (elsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
if (wpsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (part)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
ent->name = name + "_part";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (elsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
if (wpsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (part) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
ent->name = name + "_part";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(elsc, pathsOut);
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(part, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(elsc, pathsOut);
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(part, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,144 +4,121 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Babygoth : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
DamageInfo damageInfo2;
UniqueID32 wpsc2;
UniqueID32 particle1;
DamageInfo damageInfo3;
DamageVulnerability damageVulnerabilty1;
DamageVulnerability damageVulnerabilty2;
UniqueID32 cmdlShelless;
UniqueID32 cskrShelless;
Value<float> unknown3;
Value<atUint32> unknown4;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
UniqueID32 particle5;
Value<atUint32> unknown5;
Value<atUint32> unknown6;
Value<atUint32> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
UniqueID32 texture;
Value<atUint32> unknown11;
UniqueID32 particle6;
namespace DataSpec::DNAMP1 {
struct Babygoth : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
DamageInfo damageInfo2;
UniqueID32 wpsc2;
UniqueID32 particle1;
DamageInfo damageInfo3;
DamageVulnerability damageVulnerabilty1;
DamageVulnerability damageVulnerabilty2;
UniqueID32 cmdlShelless;
UniqueID32 cskrShelless;
Value<float> unknown3;
Value<atUint32> unknown4;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
UniqueID32 particle5;
Value<atUint32> unknown5;
Value<atUint32> unknown6;
Value<atUint32> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
UniqueID32 texture;
Value<atUint32> unknown11;
UniqueID32 particle6;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
UniqueID32 cinf = patternedInfo.animationParameters.getCINF(pakRouter);
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
UniqueID32 cinf = patternedInfo.animationParameters.getCINF(pakRouter);
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
if (cmdlShelless && cskrShelless)
{
charAssoc.m_cmdlRigs[cmdlShelless] = std::make_pair(cskrShelless, cinf);
charAssoc.m_cskrCinfToCharacter[cskrShelless] = std::make_pair(
patternedInfo.animationParameters.animationCharacterSet, "ATTACH.SHELLESS.CSKR");
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet,
{}, cmdlShelless, "SHELLESS");
}
if (cmdlShelless && cskrShelless) {
charAssoc.m_cmdlRigs[cmdlShelless] = std::make_pair(cskrShelless, cinf);
charAssoc.m_cskrCinfToCharacter[cskrShelless] =
std::make_pair(patternedInfo.animationParameters.animationCharacterSet, "ATTACH.SHELLESS.CSKR");
charAssoc.addAttachmentRig(patternedInfo.animationParameters.animationCharacterSet, {}, cmdlShelless, "SHELLESS");
}
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (cmdlShelless)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cmdlShelless);
ent->name = name + "_emodel";
}
if (cskrShelless)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cskrShelless);
ent->name = name + "_eskin";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
if (texture)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_tex";
}
if (particle6)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
ent->name = name + "_part6";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (cmdlShelless) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cmdlShelless);
ent->name = name + "_emodel";
}
if (cskrShelless) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(cskrShelless);
ent->name = name + "_eskin";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
if (texture) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_tex";
}
if (particle6) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
ent->name = name + "_part6";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(cmdlShelless, pathsOut);
g_curSpec->flattenDependencies(cskrShelless, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
g_curSpec->flattenDependencies(texture, pathsOut);
g_curSpec->flattenDependencies(particle6, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(cmdlShelless, pathsOut);
g_curSpec->flattenDependencies(cskrShelless, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
g_curSpec->flattenDependencies(texture, pathsOut);
g_curSpec->flattenDependencies(particle6, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,21 +4,18 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct BallTrigger : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<atVec3f> unknown5;
Value<bool> unknown6;
namespace DataSpec::DNAMP1 {
struct BallTrigger : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<atVec3f> unknown5;
Value<bool> unknown6;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,57 +4,46 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Beetle : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
DamageInfo damageInfo;
Value<atVec3f> unknown2;
Value<float> unknown3;
DamageVulnerability damageVulnerabilty1;
DamageVulnerability damageVulnerabilty2;
UniqueID32 model;
Value<atUint32> unknown4;
Value<float> unknown5;
Value<float> unknown6;
namespace DataSpec::DNAMP1 {
struct Beetle : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
DamageInfo damageInfo;
Value<atVec3f> unknown2;
Value<float> unknown3;
DamageVulnerability damageVulnerabilty1;
DamageVulnerability damageVulnerabilty2;
UniqueID32 model;
Value<atUint32> unknown4;
Value<float> unknown5;
Value<float> unknown6;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(model, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,95 +4,78 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct BloodFlower : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 particle1;
UniqueID32 wpsc1;
UniqueID32 wpsc2;
DamageInfo damageInfo1;
DamageInfo damageInfo2;
DamageInfo damageInfo3;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
Value<float> unknown1;
UniqueID32 particle5;
Value<atUint32> unknown2;
namespace DataSpec::DNAMP1 {
struct BloodFlower : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 particle1;
UniqueID32 wpsc1;
UniqueID32 wpsc2;
DamageInfo damageInfo1;
DamageInfo damageInfo2;
DamageInfo damageInfo3;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
Value<float> unknown1;
UniqueID32 particle5;
Value<atUint32> unknown2;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,78 +4,63 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Burrower : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 particle1;
UniqueID32 particle2;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 particle3;
Value<atUint32> unknown; // always FF
UniqueID32 particle4;
namespace DataSpec::DNAMP1 {
struct Burrower : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
UniqueID32 particle1;
UniqueID32 particle2;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 particle3;
Value<atUint32> unknown; // always FF
UniqueID32 particle4;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,27 +4,24 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Camera : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> shotDuration;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Value<bool> unknown6;
Value<bool> unknown7;
Value<bool> disableInput;
Value<bool> unknown9;
Value<float> fov;
Value<bool> unknown11;
Value<bool> unknown12;
namespace DataSpec::DNAMP1 {
struct Camera : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> shotDuration;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Value<bool> unknown6;
Value<bool> unknown7;
Value<bool> disableInput;
Value<bool> unknown9;
Value<float> fov;
Value<bool> unknown11;
Value<bool> unknown12;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraBlurKeyframe : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> btype;
Value<float> amount;
Value<atUint32> unk;
Value<float> timeIn;
Value<float> timeOut;
namespace DataSpec::DNAMP1 {
struct CameraBlurKeyframe : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> btype;
Value<float> amount;
Value<atUint32> unk;
Value<float> timeIn;
Value<float> timeOut;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,37 +4,30 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraFilterKeyframe : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> ftype;
Value<atUint32> shape;
Value<atUint32> filterIdx;
Value<atUint32> unk;
DNAColor color;
Value<float> timeIn;
Value<float> timeOut;
UniqueID32 texture;
namespace DataSpec::DNAMP1 {
struct CameraFilterKeyframe : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> ftype;
Value<atUint32> shape;
Value<atUint32> filterIdx;
Value<atUint32> unk;
DNAColor color;
Value<float> timeIn;
Value<float> timeOut;
UniqueID32 texture;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (texture)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_texture";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (texture) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_texture";
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(texture, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(texture, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,66 +4,60 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraHint : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
namespace DataSpec::DNAMP1 {
struct CameraHint : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<atUint32> priority;
Value<atUint32> behaviour;
struct CameraHintParameters : BigDNA {
AT_DECL_DNA
Value<atUint32> propertyCount;
Value<bool> calculateCamPos; // 0x1
Value<bool> chaseAllowed; // 0x2
Value<bool> boostAllowed; // 0x4
Value<bool> obscureAvoidance; // 0x8
Value<bool> volumeCollider; // 0x10
Value<bool> applyImmediately; // 0x20
Value<bool> lookAtBall; // 0x40
Value<bool> hintDistanceSelection; // 0x80
Value<bool> hintDistanceSelfPos; // 0x100
Value<bool> controlInterpolation; // 0x200
Value<bool> sinusoidalInterpolation; // 0x400
Value<bool> sinusoidalInterpolationHintless; // 0x800
Value<bool> clampVelocity; // 0x1000
Value<bool> skipCinematic; // 0x2000
Value<bool> noElevationInterp; // 0x4000
Value<bool> directElevation; // 0x8000
Value<bool> overrideLookDir; // 0x10000
Value<bool> noElevationVelClamp; // 0x20000
Value<bool> calculateTransformFromPrevCam; // 0x40000
Value<bool> noSpline; // 0x80000
Value<bool> unknown21; // 0x100000
Value<bool> unknown22; // 0x200000
} cameraHintParameters;
struct BoolFloat : BigDNA {
AT_DECL_DNA
Value<bool> active;
Value<atUint32> priority;
Value<atUint32> behaviour;
struct CameraHintParameters : BigDNA
{
AT_DECL_DNA
Value<atUint32> propertyCount;
Value<bool> calculateCamPos; // 0x1
Value<bool> chaseAllowed; // 0x2
Value<bool> boostAllowed; // 0x4
Value<bool> obscureAvoidance; // 0x8
Value<bool> volumeCollider; // 0x10
Value<bool> applyImmediately; // 0x20
Value<bool> lookAtBall; // 0x40
Value<bool> hintDistanceSelection; // 0x80
Value<bool> hintDistanceSelfPos; // 0x100
Value<bool> controlInterpolation; // 0x200
Value<bool> sinusoidalInterpolation; // 0x400
Value<bool> sinusoidalInterpolationHintless; // 0x800
Value<bool> clampVelocity; // 0x1000
Value<bool> skipCinematic; // 0x2000
Value<bool> noElevationInterp; // 0x4000
Value<bool> directElevation; // 0x8000
Value<bool> overrideLookDir; // 0x10000
Value<bool> noElevationVelClamp; // 0x20000
Value<bool> calculateTransformFromPrevCam; // 0x40000
Value<bool> noSpline; // 0x80000
Value<bool> unknown21; // 0x100000
Value<bool> unknown22; // 0x200000
} cameraHintParameters;
struct BoolFloat : BigDNA
{
AT_DECL_DNA
Value<bool> active;
Value<float> value;
} minDist, maxDist, backwardsDist; // 0x400000, 0x800000, 0x1000000
struct BoolVec3f : BigDNA
{
AT_DECL_DNA
Value<bool> active;
Value<atVec3f> value;
} lookAtOffset, chaseLookAtOffset; // 0x2000000, 0x4000000
Value<atVec3f> ballToCam;
BoolFloat fov, attitudeRange, azimuthRange, anglePerSecond; // 0x8000000, 0x10000000, 0x20000000, 0x40000000
Value<float> clampVelRange;
Value<float> clampRotRange;
BoolFloat elevation; // 0x80000000
Value<float> interpolateTime;
Value<float> clampVelTime;
Value<float> controlInterpDur;
Value<float> value;
} minDist, maxDist, backwardsDist; // 0x400000, 0x800000, 0x1000000
struct BoolVec3f : BigDNA {
AT_DECL_DNA
Value<bool> active;
Value<atVec3f> value;
} lookAtOffset, chaseLookAtOffset; // 0x2000000, 0x4000000
Value<atVec3f> ballToCam;
BoolFloat fov, attitudeRange, azimuthRange, anglePerSecond; // 0x8000000, 0x10000000, 0x20000000, 0x40000000
Value<float> clampVelRange;
Value<float> clampRotRange;
BoolFloat elevation; // 0x80000000
Value<float> interpolateTime;
Value<float> clampVelTime;
Value<float> controlInterpDur;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraHintTrigger : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
namespace DataSpec::DNAMP1 {
struct CameraHintTrigger : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,20 +4,17 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraPitchVolume : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
namespace DataSpec::DNAMP1 {
struct CameraPitchVolume : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,21 +4,18 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraShaker : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<float> xMag;
Value<float> xB;
Value<float> yMag;
Value<float> yB;
Value<float> zMag;
Value<float> zB;
Value<float> duration;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct CameraShaker : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<float> xMag;
Value<float> xB;
Value<float> yMag;
Value<float> yB;
Value<float> zMag;
Value<float> zB;
Value<float> duration;
Value<bool> active;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,18 +4,15 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CameraWaypoint : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown2;
Value<atUint32> unknown3;
namespace DataSpec::DNAMP1 {
struct CameraWaypoint : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> active;
Value<float> unknown2;
Value<atUint32> unknown3;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,84 +4,71 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ChozoGhost : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
BehaveChance BehaveChance1;
BehaveChance BehaveChance2;
BehaveChance BehaveChance3;
Value<atUint32> sound1;
Value<float> unknown5;
Value<atUint32> sound2;
Value<atUint32> sound3;
Value<atUint32> unknown6;
Value<float> unknown7;
Value<atUint32> unknown8;
Value<float> unknown9;
UniqueID32 particle;
Value<atUint32> soundId4;
Value<float> unknown10;
Value<float> unknown11;
Value<atUint32> unknown12;
Value<atUint32> unknown13;
namespace DataSpec::DNAMP1 {
struct ChozoGhost : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
BehaveChance BehaveChance1;
BehaveChance BehaveChance2;
BehaveChance BehaveChance3;
Value<atUint32> sound1;
Value<float> unknown5;
Value<atUint32> sound2;
Value<atUint32> sound3;
Value<atUint32> unknown6;
Value<float> unknown7;
Value<atUint32> unknown8;
Value<float> unknown9;
UniqueID32 particle;
Value<atUint32> soundId4;
Value<float> unknown10;
Value<float> unknown11;
Value<atUint32> unknown12;
Value<atUint32> unknown13;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,24 +4,21 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ColorModulate : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec4f> colorA;
Value<atVec4f> colorB;
Value<atUint32> blendMode;
Value<float> timeA2B;
Value<float> timeB2A;
Value<bool> doReverse;
Value<bool> resetTargetWhenDone;
Value<bool> depthCompare;
Value<bool> depthUpdate;
Value<bool> depthBackwards;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct ColorModulate : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec4f> colorA;
Value<atVec4f> colorB;
Value<atUint32> blendMode;
Value<float> timeA2B;
Value<float> timeB2A;
Value<bool> doReverse;
Value<bool> resetTargetWhenDone;
Value<bool> depthCompare;
Value<bool> depthUpdate;
Value<bool> depthBackwards;
Value<bool> active;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,16 +4,13 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ControllerAction : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> command;
Value<bool> deactivateOnClose;
namespace DataSpec::DNAMP1 {
struct ControllerAction : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atUint32> command;
Value<bool> deactivateOnClose;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,17 +4,14 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Counter : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> startValue; // needs verification
Value<atUint32> maxValue;
Value<bool> unknown1;
Value<bool> unknown2;
namespace DataSpec::DNAMP1 {
struct Counter : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> startValue; // needs verification
Value<atUint32> maxValue;
Value<bool> unknown1;
Value<bool> unknown2;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,21 +4,18 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct CoverPoint : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<atUint32> unknown2;
Value<bool> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
namespace DataSpec::DNAMP1 {
struct CoverPoint : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<atUint32> unknown2;
Value<bool> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,58 +4,48 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DamageableTrigger : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
HealthInfo healthInfo;
DamageVulnerability damageVulnerabilty;
Value<atUint32> faceFlag;
UniqueID32 patternTex1;
UniqueID32 patternTex2;
UniqueID32 colorTex;
Value<bool> lockOn;
Value<bool> active;
VisorParameters visorParameters;
namespace DataSpec::DNAMP1 {
struct DamageableTrigger : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
HealthInfo healthInfo;
DamageVulnerability damageVulnerabilty;
Value<atUint32> faceFlag;
UniqueID32 patternTex1;
UniqueID32 patternTex2;
UniqueID32 colorTex;
Value<bool> lockOn;
Value<bool> active;
VisorParameters visorParameters;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (patternTex1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex1);
ent->name = name + "_patternTex1";
}
if (patternTex2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex2);
ent->name = name + "_patternTex2";
}
if (colorTex)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(colorTex);
ent->name = name + "_colorTex";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (patternTex1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex1);
ent->name = name + "_patternTex1";
}
if (patternTex2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(patternTex2);
ent->name = name + "_patternTex2";
}
if (colorTex) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(colorTex);
ent->name = name + "_colorTex";
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(patternTex1, pathsOut);
g_curSpec->flattenDependencies(patternTex2, pathsOut);
g_curSpec->flattenDependencies(colorTex, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(patternTex1, pathsOut);
g_curSpec->flattenDependencies(patternTex2, pathsOut);
g_curSpec->flattenDependencies(colorTex, pathsOut);
}
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const
{
zeus::CVector3f halfExtent = zeus::CVector3f(volume) / 2.f;
zeus::CVector3f loc(location);
return zeus::CAABox(loc - halfExtent, loc + halfExtent);
}
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const {
zeus::CVector3f halfExtent = zeus::CVector3f(volume) / 2.f;
zeus::CVector3f loc(location);
return zeus::CAABox(loc - halfExtent, loc + halfExtent);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,58 +4,47 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Debris : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> zImpulse;
Value<atVec3f> velocity;
DNAColor endsColor;
Value<float> mass;
Value<float> restitution;
Value<float> duration;
Value<atUint32> scaleType;
Value<bool> randomAngImpulse;
UniqueID32 model;
ActorParameters actorParameters;
UniqueID32 particle;
Value<atVec3f> particleScale;
Value<bool> b1;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct Debris : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> zImpulse;
Value<atVec3f> velocity;
DNAColor endsColor;
Value<float> mass;
Value<float> restitution;
Value<float> duration;
Value<atUint32> scaleType;
Value<bool> randomAngImpulse;
UniqueID32 model;
ActorParameters actorParameters;
UniqueID32 particle;
Value<atVec3f> particleScale;
Value<bool> b1;
Value<bool> active;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,91 +4,78 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DebrisExtended : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> linConeAngle;
Value<float> linMinMag;
Value<float> linMaxMag;
Value<float> angMinMag;
Value<float> angMaxMag;
Value<float> minDuration;
Value<float> maxDuration;
Value<float> colorInT;
Value<float> colorOutT;
DNAColor color;
DNAColor endsColor;
Value<float> scaleOutT;
Value<atVec3f> endScale;
Value<float> restitution;
Value<float> downwardSpeed;
Value<atVec3f> localOffset;
UniqueID32 model;
ActorParameters actorParameters;
UniqueID32 particle1;
Value<atVec3f> particle1Scale;
Value<bool> particle1GlobalTranslation;
Value<bool> deferDeleteTillParticle1Done;
Value<atUint32> particle1Or;
UniqueID32 particle2;
Value<atVec3f> particle2Scale;
Value<bool> particle2GlobalTranslation;
Value<bool> deferDeleteTillParticle2Done;
Value<atUint32> particle2Or;
UniqueID32 particle3;
Value<atVec3f> particle3Scale;
Value<atUint32> particle3Or;
Value<bool> solid;
Value<bool> dieOnProjectile;
Value<bool> noBounce;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct DebrisExtended : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> linConeAngle;
Value<float> linMinMag;
Value<float> linMaxMag;
Value<float> angMinMag;
Value<float> angMaxMag;
Value<float> minDuration;
Value<float> maxDuration;
Value<float> colorInT;
Value<float> colorOutT;
DNAColor color;
DNAColor endsColor;
Value<float> scaleOutT;
Value<atVec3f> endScale;
Value<float> restitution;
Value<float> downwardSpeed;
Value<atVec3f> localOffset;
UniqueID32 model;
ActorParameters actorParameters;
UniqueID32 particle1;
Value<atVec3f> particle1Scale;
Value<bool> particle1GlobalTranslation;
Value<bool> deferDeleteTillParticle1Done;
Value<atUint32> particle1Or;
UniqueID32 particle2;
Value<atVec3f> particle2Scale;
Value<bool> particle2GlobalTranslation;
Value<bool> deferDeleteTillParticle2Done;
Value<atUint32> particle2Or;
UniqueID32 particle3;
Value<atVec3f> particle3Scale;
Value<atUint32> particle3Or;
Value<bool> solid;
Value<bool> dieOnProjectile;
Value<bool> noBounce;
Value<bool> active;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,16 +4,13 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DebugCameraWaypoint : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atUint32> unknown1;
namespace DataSpec::DNAMP1 {
struct DebugCameraWaypoint : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atUint32> unknown1;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,20 +4,17 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DistanceFog : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> fogMode;
Value<atVec4f> fogColor; // CColor
Value<atVec2f> range;
Value<float> colorDelta;
Value<atVec2f> rangeDelta;
Value<bool> expl;
Value<bool> active;
namespace DataSpec::DNAMP1 {
struct DistanceFog : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> fogMode;
Value<atVec4f> fogColor; // CColor
Value<atVec2f> range;
Value<float> colorDelta;
Value<atVec2f> rangeDelta;
Value<bool> expl;
Value<bool> active;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Dock : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<atUint32> dock;
Value<atUint32> room;
Value<bool> loadConnected;
namespace DataSpec::DNAMP1 {
struct Dock : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> active;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<atUint32> dock;
Value<atUint32> room;
Value<bool> loadConnected;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,15 +4,12 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DockAreaChange : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
namespace DataSpec::DNAMP1 {
struct DockAreaChange : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<bool> unknown2;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -1,29 +1,25 @@
#include "DoorArea.hpp"
#include "hecl/Blender/Connection.hpp"
namespace DataSpec::DNAMP1
{
namespace DataSpec::DNAMP1 {
zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const
{
hecl::blender::Connection& conn = btok.getBlenderConnection();
zeus::CAABox aabbOut;
zeus::CAABox DoorArea::getVISIAABB(hecl::blender::Token& btok) const {
hecl::blender::Connection& conn = btok.getBlenderConnection();
zeus::CAABox aabbOut;
if (animationParameters.animationCharacterSet)
{
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(
animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
}
if (animationParameters.animationCharacterSet) {
hecl::ProjectPath path = UniqueIDBridge::TranslatePakIdToPath(animationParameters.animationCharacterSet);
conn.openBlend(path.getWithExtension(_SYS_STR(".blend"), true));
hecl::blender::DataStream ds = conn.beginData();
auto aabb = ds.getMeshAABB();
aabbOut = zeus::CAABox(aabb.first, aabb.second);
}
if (aabbOut.min.x() > aabbOut.max.x())
return {};
if (aabbOut.min.x() > aabbOut.max.x())
return {};
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
return aabbOut.getTransformedAABox(xf);
zeus::CTransform xf = ConvertEditorEulerToTransform4f(scale, orientation, location);
return aabbOut.getTransformedAABox(xf);
}
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,51 +4,41 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct DoorArea : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<atVec3f> orbitPos;
Value<atVec3f> collisionExtent;
Value<atVec3f> collisionOffset;
Value<bool> active;
Value<bool> open;
Value<bool> projectilesCollide;
Value<float> animationLength;
Value<bool> isMorphballDoor;
namespace DataSpec::DNAMP1 {
struct DoorArea : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
AnimationParameters animationParameters;
ActorParameters actorParameters;
Value<atVec3f> orbitPos;
Value<atVec3f> collisionExtent;
Value<atVec3f> collisionOffset;
Value<bool> active;
Value<bool> open;
Value<bool> projectilesCollide;
Value<float> animationLength;
Value<bool> isMorphballDoor;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
animationParameters.nameANCS(pakRouter, name + "_animp");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
animationParameters.depANCS(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const;
zeus::CAABox getVISIAABB(hecl::blender::Token& btok) const;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,96 +4,85 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Drone : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> unknown2;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
DamageInfo damageInfo1;
Value<atUint32> unknown3;
DamageInfo damageInfo2;
Value<atUint32> unknown4;
Value<atUint32> unknown5;
Value<atUint32> unknown6;
FlareDefinition flareDefinition1;
FlareDefinition flareDefinition2;
FlareDefinition flareDefinition3;
FlareDefinition flareDefinition4;
FlareDefinition flareDefinition5;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<float> unknown16;
Value<float> unknown17;
Value<float> unknown18;
Value<float> unknown19;
Value<float> unknown20;
Value<float> unknown21;
Value<float> unknown22;
Value<float> unknown23;
Value<float> unknown24;
Value<float> unknown25;
UniqueID32 crsc;
Value<float> unknon26;
Value<float> unknon27;
Value<float> unknon28;
Value<float> unknon29;
Value<atUint32> sound; // verification needed
Value<bool> unknown30;
namespace DataSpec::DNAMP1 {
struct Drone : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
Value<float> unknown2;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
DamageInfo damageInfo1;
Value<atUint32> unknown3;
DamageInfo damageInfo2;
Value<atUint32> unknown4;
Value<atUint32> unknown5;
Value<atUint32> unknown6;
FlareDefinition flareDefinition1;
FlareDefinition flareDefinition2;
FlareDefinition flareDefinition3;
FlareDefinition flareDefinition4;
FlareDefinition flareDefinition5;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<float> unknown16;
Value<float> unknown17;
Value<float> unknown18;
Value<float> unknown19;
Value<float> unknown20;
Value<float> unknown21;
Value<float> unknown22;
Value<float> unknown23;
Value<float> unknown24;
Value<float> unknown25;
UniqueID32 crsc;
Value<float> unknon26;
Value<float> unknon27;
Value<float> unknon28;
Value<float> unknon29;
Value<atUint32> sound; // verification needed
Value<bool> unknown30;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (crsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(crsc);
ent->name = name + "_crsc";
}
flareDefinition1.nameIDs(pakRouter, name + "_flare1");
flareDefinition2.nameIDs(pakRouter, name + "_flare2");
flareDefinition3.nameIDs(pakRouter, name + "_flare3");
flareDefinition4.nameIDs(pakRouter, name + "_flare4");
flareDefinition5.nameIDs(pakRouter, name + "_flare5");
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (crsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(crsc);
ent->name = name + "_crsc";
}
flareDefinition1.nameIDs(pakRouter, name + "_flare1");
flareDefinition2.nameIDs(pakRouter, name + "_flare2");
flareDefinition3.nameIDs(pakRouter, name + "_flare3");
flareDefinition4.nameIDs(pakRouter, name + "_flare4");
flareDefinition5.nameIDs(pakRouter, name + "_flare5");
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(crsc, pathsOut);
flareDefinition1.depIDs(pathsOut);
flareDefinition2.depIDs(pathsOut);
flareDefinition3.depIDs(pathsOut);
flareDefinition4.depIDs(pathsOut);
flareDefinition5.depIDs(pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(crsc, pathsOut);
flareDefinition1.depIDs(pathsOut);
flareDefinition2.depIDs(pathsOut);
flareDefinition3.depIDs(pathsOut);
flareDefinition4.depIDs(pathsOut);
flareDefinition5.depIDs(pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,57 +4,49 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Effect : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
UniqueID32 part;
UniqueID32 elsc;
Value<bool> hotInThermal;
Value<bool> noTimerUnlessAreaOccluded;
Value<bool> rebuildSystemsOnActivate;
Value<bool> active;
Value<bool> useRateInverseCamDist;
Value<float> rateInverseCamDist;
Value<float> rateInverseCamDistRate;
Value<float> duration;
Value<float> durationResetWhileVisible;
Value<bool> useRateCamDistRange;
Value<float> rateCamDistRangeMin;
Value<float> rateCamDistRangeMax;
Value<float> rateCamDistRangeFarRate;
Value<bool> combatVisorVisible;
Value<bool> thermalVisorVisible;
Value<bool> xrayVisorVisible;
Value<bool> dieWhenSystemsDone;
LightParameters lightParameters;
namespace DataSpec::DNAMP1 {
struct Effect : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
UniqueID32 part;
UniqueID32 elsc;
Value<bool> hotInThermal;
Value<bool> noTimerUnlessAreaOccluded;
Value<bool> rebuildSystemsOnActivate;
Value<bool> active;
Value<bool> useRateInverseCamDist;
Value<float> rateInverseCamDist;
Value<float> rateInverseCamDistRate;
Value<float> duration;
Value<float> durationResetWhileVisible;
Value<bool> useRateCamDistRange;
Value<float> rateCamDistRangeMin;
Value<float> rateCamDistRangeMax;
Value<float> rateCamDistRangeFarRate;
Value<bool> combatVisorVisible;
Value<bool> thermalVisorVisible;
Value<bool> xrayVisorVisible;
Value<bool> dieWhenSystemsDone;
LightParameters lightParameters;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (part)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
ent->name = name + "_part";
}
if (elsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (part) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(part);
ent->name = name + "_part";
}
if (elsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(part, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(part, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,39 +4,32 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ElectroMagneticPulse : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
UniqueID32 particle;
namespace DataSpec::DNAMP1 {
struct ElectroMagneticPulse : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<bool> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
UniqueID32 particle;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (particle)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (particle) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(particle, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(particle, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,137 +4,120 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct ElitePirate : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters1;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
UniqueID32 particle1;
Value<atUint32> soundID1;
ActorParameters actorParameters2;
AnimationParameters animationParameters;
UniqueID32 particle2;
Value<atUint32> soundID2;
UniqueID32 model;
DamageInfo damageInfo1;
Value<float> unknown9;
UniqueID32 particle3;
UniqueID32 particle4;
UniqueID32 particle5;
UniqueID32 particle6;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<atUint32> unknown16;
Value<atUint32> soundID3;
Value<atUint32> soundID4;
UniqueID32 particle7;
DamageInfo damageInfo2;
UniqueID32 elsc;
Value<atUint32> soundID5;
Value<bool> unknown17;
Value<bool> unknown18;
namespace DataSpec::DNAMP1 {
struct ElitePirate : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters1;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
UniqueID32 particle1;
Value<atUint32> soundID1;
ActorParameters actorParameters2;
AnimationParameters animationParameters;
UniqueID32 particle2;
Value<atUint32> soundID2;
UniqueID32 model;
DamageInfo damageInfo1;
Value<float> unknown9;
UniqueID32 particle3;
UniqueID32 particle4;
UniqueID32 particle5;
UniqueID32 particle6;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<atUint32> unknown16;
Value<atUint32> soundID3;
Value<atUint32> soundID4;
UniqueID32 particle7;
DamageInfo damageInfo2;
UniqueID32 elsc;
Value<atUint32> soundID5;
Value<bool> unknown17;
Value<bool> unknown18;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters1.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
actorParameters2.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters1.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
actorParameters2.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
if (particle6)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
ent->name = name + "_part6";
}
if (particle7)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle7);
ent->name = name + "_part7";
}
if (elsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters1.nameIDs(pakRouter, name + "_actp1");
actorParameters2.nameIDs(pakRouter, name + "_actp2");
animationParameters.nameANCS(pakRouter, name + "_animp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
if (particle5) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle5);
ent->name = name + "_part5";
}
if (particle6) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle6);
ent->name = name + "_part6";
}
if (particle7) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle7);
ent->name = name + "_part7";
}
if (elsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters1.nameIDs(pakRouter, name + "_actp1");
actorParameters2.nameIDs(pakRouter, name + "_actp2");
animationParameters.nameANCS(pakRouter, name + "_animp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
g_curSpec->flattenDependencies(particle6, pathsOut);
g_curSpec->flattenDependencies(particle7, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters1.depIDs(pathsOut, lazyOut);
actorParameters2.depIDs(pathsOut, lazyOut);
animationParameters.depANCS(pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(model, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
g_curSpec->flattenDependencies(particle5, pathsOut);
g_curSpec->flattenDependencies(particle6, pathsOut);
g_curSpec->flattenDependencies(particle7, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters1.depIDs(pathsOut, lazyOut);
actorParameters2.depIDs(pathsOut, lazyOut);
animationParameters.depANCS(pathsOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters1.scanIDs(scansOut);
actorParameters2.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const {
actorParameters1.scanIDs(scansOut);
actorParameters2.scanIDs(scansOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,79 +4,65 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct EnergyBall : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<atUint32> unknown1;
Value<float> unknown2;
DamageInfo damageInfo1;
Value<float> unknown3;
UniqueID32 texture;
Value<atUint32> soundID1;
UniqueID32 particle1;
UniqueID32 elsc;
Value<atUint32> soundID2;
Value<float> unknown4;
Value<float> unknown5;
UniqueID32 particle2;
DamageInfo damageInfo2;
Value<float> unknown6;
namespace DataSpec::DNAMP1 {
struct EnergyBall : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<atUint32> unknown1;
Value<float> unknown2;
DamageInfo damageInfo1;
Value<float> unknown3;
UniqueID32 texture;
Value<atUint32> soundID1;
UniqueID32 particle1;
UniqueID32 elsc;
Value<atUint32> soundID2;
Value<float> unknown4;
Value<float> unknown5;
UniqueID32 particle2;
DamageInfo damageInfo2;
Value<float> unknown6;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (texture)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_texture";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (elsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (texture) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture);
ent->name = name + "_texture";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (elsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(elsc);
ent->name = name + "_elsc";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(texture, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(texture, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(elsc, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,16 +4,13 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct EnvFxDensityController : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown1;
Value<float> unknown2;
Value<atUint32> unknown3;
namespace DataSpec::DNAMP1 {
struct EnvFxDensityController : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<bool> unknown1;
Value<float> unknown2;
Value<atUint32> unknown3;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,86 +4,71 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Eyeball : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown2;
Value<float> unknown3;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 particle1;
UniqueID32 particle2;
UniqueID32 texture1;
UniqueID32 texture2;
Value<atUint32> unknown4;
Value<atUint32> unknown5; // always ff
Value<atUint32> unknown6; // always ff
Value<atUint32> unknown7; // always ff
Value<atUint32> unknown8;
Value<bool> unknown9;
namespace DataSpec::DNAMP1 {
struct Eyeball : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown2;
Value<float> unknown3;
UniqueID32 wpsc;
DamageInfo damageInfo;
UniqueID32 particle1;
UniqueID32 particle2;
UniqueID32 texture1;
UniqueID32 texture2;
Value<atUint32> unknown4;
Value<atUint32> unknown5; // always ff
Value<atUint32> unknown6; // always ff
Value<atUint32> unknown7; // always ff
Value<atUint32> unknown8;
Value<bool> unknown9;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (texture1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture1);
ent->name = name + "_tex1";
}
if (texture2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture2);
ent->name = name + "_tex2";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc);
ent->name = name + "_wpsc";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (texture1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture1);
ent->name = name + "_tex1";
}
if (texture2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(texture2);
ent->name = name + "_tex2";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(texture1, pathsOut);
g_curSpec->flattenDependencies(texture2, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(texture1, pathsOut);
g_curSpec->flattenDependencies(texture2, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,44 +4,34 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FireFlea : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown1;
Value<bool> unknown2;
Value<float> unknown3;
namespace DataSpec::DNAMP1 {
struct FireFlea : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown1;
Value<bool> unknown2;
Value<float> unknown3;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,89 +4,78 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FishCloud : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
UniqueID32 model;
AnimationParameters animationParameters;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<atUint32> unknown16;
Value<atVec4f> unknown17; // CColor
Value<bool> unknown18;
Value<float> unknown19;
UniqueID32 deathParticle1;
Value<atUint32> deathParticle1Frames;
UniqueID32 deathParticle2;
Value<atUint32> deathParticle2Frames;
UniqueID32 deathParticle3;
Value<atUint32> deathParticle3Frames;
UniqueID32 deathParticle4;
Value<atUint32> deathParticle4Frames;
Value<atUint32> deathSFX;
Value<bool> unknown29;
Value<bool> unknown30;
namespace DataSpec::DNAMP1 {
struct FishCloud : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> volume;
Value<bool> unknown1;
UniqueID32 model;
AnimationParameters animationParameters;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
Value<atUint32> unknown16;
Value<atVec4f> unknown17; // CColor
Value<bool> unknown18;
Value<float> unknown19;
UniqueID32 deathParticle1;
Value<atUint32> deathParticle1Frames;
UniqueID32 deathParticle2;
Value<atUint32> deathParticle2Frames;
UniqueID32 deathParticle3;
Value<atUint32> deathParticle3Frames;
UniqueID32 deathParticle4;
Value<atUint32> deathParticle4Frames;
Value<atUint32> deathSFX;
Value<bool> unknown29;
Value<bool> unknown30;
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (model)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
if (deathParticle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle1);
ent->name = name + "_deathParticle1";
}
if (deathParticle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle2);
ent->name = name + "_deathParticle2";
}
if (deathParticle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle3);
ent->name = name + "_deathParticle3";
}
if (deathParticle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle4);
ent->name = name + "_deathParticle4";
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (model) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(model);
ent->name = name + "_model";
}
animationParameters.nameANCS(pakRouter, name + "_animp");
if (deathParticle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle1);
ent->name = name + "_deathParticle1";
}
if (deathParticle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle2);
ent->name = name + "_deathParticle2";
}
if (deathParticle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle3);
ent->name = name + "_deathParticle3";
}
if (deathParticle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(deathParticle4);
ent->name = name + "_deathParticle4";
}
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(model, pathsOut);
animationParameters.depANCS(pathsOut);
g_curSpec->flattenDependencies(deathParticle1, pathsOut);
g_curSpec->flattenDependencies(deathParticle2, pathsOut);
g_curSpec->flattenDependencies(deathParticle3, pathsOut);
g_curSpec->flattenDependencies(deathParticle4, pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(model, pathsOut);
animationParameters.depANCS(pathsOut);
g_curSpec->flattenDependencies(deathParticle1, pathsOut);
g_curSpec->flattenDependencies(deathParticle2, pathsOut);
g_curSpec->flattenDependencies(deathParticle3, pathsOut);
g_curSpec->flattenDependencies(deathParticle4, pathsOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FishCloudModifier : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> position;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
Value<float> unknown4;
Value<float> unknown5;
namespace DataSpec::DNAMP1 {
struct FishCloudModifier : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> position;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
Value<float> unknown4;
Value<float> unknown5;
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,88 +4,76 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct Flaahgra : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters1;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
DamageVulnerability damageVulnerabilty;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
UniqueID32 particle;
DamageInfo damageInfo3;
ActorParameters actorParameters2;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
AnimationParameters animationParameters;
UniqueID32 dependencyGroup;
namespace DataSpec::DNAMP1 {
struct Flaahgra : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters1;
Value<float> unknown1;
Value<float> unknown2;
Value<float> unknown3;
Value<float> unknown4;
DamageVulnerability damageVulnerabilty;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
UniqueID32 particle;
DamageInfo damageInfo3;
ActorParameters actorParameters2;
Value<float> unknown5;
Value<float> unknown6;
Value<float> unknown7;
AnimationParameters animationParameters;
UniqueID32 dependencyGroup;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters1.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
actorParameters2.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters1.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
actorParameters2.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
if (dependencyGroup)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(dependencyGroup);
ent->name = name + "_dgrp";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters1.nameIDs(pakRouter, name + "_actp1");
actorParameters2.nameIDs(pakRouter, name + "_actp2");
animationParameters.nameANCS(pakRouter, name + "_animp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (particle) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle);
ent->name = name + "_part";
}
if (dependencyGroup) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(dependencyGroup);
ent->name = name + "_dgrp";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters1.nameIDs(pakRouter, name + "_actp1");
actorParameters2.nameIDs(pakRouter, name + "_actp2");
animationParameters.nameANCS(pakRouter, name + "_animp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
g_curSpec->flattenDependencies(dependencyGroup, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters1.depIDs(pathsOut, lazyOut);
actorParameters2.depIDs(pathsOut, lazyOut);
animationParameters.depANCS(pathsOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(particle, pathsOut);
g_curSpec->flattenDependencies(dependencyGroup, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters1.depIDs(pathsOut, lazyOut);
actorParameters2.depIDs(pathsOut, lazyOut);
animationParameters.depANCS(pathsOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters1.scanIDs(scansOut);
actorParameters2.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const {
actorParameters1.scanIDs(scansOut);
actorParameters2.scanIDs(scansOut);
}
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,41 +4,31 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FlaahgraTentacle : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
namespace DataSpec::DNAMP1 {
struct FlaahgraTentacle : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,45 +4,35 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FlickerBat : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> unknown4;
namespace DataSpec::DNAMP1 {
struct FlickerBat : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atUint32> unknown1;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> unknown4;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,113 +4,96 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FlyingPirate : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
Value<atUint32> unknown3;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
Value<atUint32> unknown4;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
UniqueID32 wpsc3;
Value<float> unknown5;
Value<float> unknown6;
UniqueID32 particle1;
DamageInfo damageInfo3;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<atUint32> unknown11;
Value<atUint32> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
Value<atUint32> unknown16;
Value<atUint32> unknown17;
Value<float> unknown18;
Value<float> unknown19;
Value<float> unknown20;
namespace DataSpec::DNAMP1 {
struct FlyingPirate : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> orientation;
Value<atVec3f> scale;
PatternedInfo patternedInfo;
ActorParameters actorParameters;
Value<float> unknown1;
Value<float> unknown2;
Value<atUint32> unknown3;
UniqueID32 wpsc1;
DamageInfo damageInfo1;
Value<atUint32> unknown4;
UniqueID32 wpsc2;
DamageInfo damageInfo2;
UniqueID32 wpsc3;
Value<float> unknown5;
Value<float> unknown6;
UniqueID32 particle1;
DamageInfo damageInfo3;
Value<float> unknown7;
Value<float> unknown8;
Value<float> unknown9;
Value<float> unknown10;
Value<atUint32> unknown11;
Value<atUint32> unknown12;
Value<float> unknown13;
Value<float> unknown14;
Value<float> unknown15;
UniqueID32 particle2;
UniqueID32 particle3;
UniqueID32 particle4;
Value<atUint32> unknown16;
Value<atUint32> unknown17;
Value<float> unknown18;
Value<float> unknown19;
Value<float> unknown20;
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const
{
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void addCMDLRigPairs(PAKRouter<PAKBridge>& pakRouter, CharacterAssociations<UniqueID32>& charAssoc) const {
actorParameters.addCMDLRigPairs(pakRouter, charAssoc, patternedInfo.animationParameters);
}
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const
{
if (wpsc1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (wpsc3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc3);
ent->name = name + "_wpsc3";
}
if (particle1)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4)
{
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
void nameIDs(PAKRouter<PAKBridge>& pakRouter) const {
if (wpsc1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc1);
ent->name = name + "_wpsc1";
}
if (wpsc2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc2);
ent->name = name + "_wpsc2";
}
if (wpsc3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(wpsc3);
ent->name = name + "_wpsc3";
}
if (particle1) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle1);
ent->name = name + "_part1";
}
if (particle2) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle2);
ent->name = name + "_part2";
}
if (particle3) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle3);
ent->name = name + "_part3";
}
if (particle4) {
PAK::Entry* ent = (PAK::Entry*)pakRouter.lookupEntry(particle4);
ent->name = name + "_part4";
}
patternedInfo.nameIDs(pakRouter, name + "_patterned");
actorParameters.nameIDs(pakRouter, name + "_actp");
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut,
std::vector<hecl::ProjectPath>& lazyOut) const
{
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(wpsc3, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut, std::vector<hecl::ProjectPath>& lazyOut) const {
g_curSpec->flattenDependencies(wpsc1, pathsOut);
g_curSpec->flattenDependencies(wpsc2, pathsOut);
g_curSpec->flattenDependencies(wpsc3, pathsOut);
g_curSpec->flattenDependencies(particle1, pathsOut);
g_curSpec->flattenDependencies(particle2, pathsOut);
g_curSpec->flattenDependencies(particle3, pathsOut);
g_curSpec->flattenDependencies(particle4, pathsOut);
patternedInfo.depIDs(pathsOut);
actorParameters.depIDs(pathsOut, lazyOut);
}
void gatherScans(std::vector<Scan>& scansOut) const
{
actorParameters.scanIDs(scansOut);
}
void gatherScans(std::vector<Scan>& scansOut) const { actorParameters.scanIDs(scansOut); }
};
}
} // namespace DataSpec::DNAMP1

View File

@@ -4,19 +4,16 @@
#include "IScriptObject.hpp"
#include "Parameters.hpp"
namespace DataSpec::DNAMP1
{
struct FogVolume : IScriptObject
{
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<float> unknown1;
Value<float> unknown2;
Value<atVec4f> unkonwn3;
Value<bool> unknown4;
namespace DataSpec::DNAMP1 {
struct FogVolume : IScriptObject {
AT_DECL_DNA_YAML
AT_DECL_DNAV
String<-1> name;
Value<atVec3f> location;
Value<atVec3f> volume;
Value<float> unknown1;
Value<float> unknown2;
Value<atVec4f> unkonwn3;
Value<bool> unknown4;
};
}
} // namespace DataSpec::DNAMP1

Some files were not shown because too many files have changed in this diff Show More