2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2015-09-24 07:47:30 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
#include <athena/FileWriter.hpp>
|
2018-06-29 20:21:36 +00:00
|
|
|
#include "DataSpec/DNACommon/DNACommon.hpp"
|
2015-09-24 07:47:30 +00:00
|
|
|
#include "DNAMP1.hpp"
|
|
|
|
|
2017-12-29 08:08:12 +00:00
|
|
|
namespace DataSpec::DNAMP1
|
2015-09-24 07:47:30 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
struct SCAN : BigDNA
|
2015-11-19 13:16:15 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_DNA_YAML
|
2015-09-24 07:47:30 +00:00
|
|
|
Value<atUint32> version;
|
|
|
|
Value<atUint32> magic;
|
|
|
|
UniqueID32 frame;
|
|
|
|
UniqueID32 string;
|
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class ScanSpeed : atUint32
|
2015-09-24 07:47:30 +00:00
|
|
|
{ Normal, Slow };
|
|
|
|
Value<ScanSpeed> scanSpeed;
|
|
|
|
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class Category : atUint32
|
2015-09-24 07:47:30 +00:00
|
|
|
{
|
|
|
|
None,
|
|
|
|
SpacePirateData,
|
|
|
|
ChozoLore,
|
|
|
|
Creatures,
|
|
|
|
Research
|
|
|
|
};
|
|
|
|
|
|
|
|
Value<Category> category;
|
|
|
|
|
|
|
|
Value<bool> isImportant;
|
|
|
|
|
2018-02-22 07:24:51 +00:00
|
|
|
struct Texture : BigDNA
|
2015-09-24 07:47:30 +00:00
|
|
|
{
|
2018-02-22 07:24:51 +00:00
|
|
|
AT_DECL_EXPLICIT_DNA_YAML
|
2015-09-24 07:47:30 +00:00
|
|
|
UniqueID32 texture;
|
|
|
|
Value<float> appearanceRange;
|
2015-11-21 01:16:07 +00:00
|
|
|
enum class Position : atInt32
|
2015-09-24 07:47:30 +00:00
|
|
|
{
|
2016-01-10 22:27:59 +00:00
|
|
|
Pane0, Pane1, Pane2, Pane3, Pane01, Pane12, Pane23, Pane012,
|
|
|
|
Pane123, Pane0123, Pane4, Pane5, Pane6, Pane7, Pane45, Pane56,
|
|
|
|
Pane67, Pane456, Pane567, Pane4567, Invalid = -1
|
2015-09-24 07:47:30 +00:00
|
|
|
};
|
|
|
|
Value<Position> position;
|
2015-10-15 23:42:39 +00:00
|
|
|
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
|
2015-09-24 07:47:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
Texture textures[4];
|
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
static bool Extract(PAKEntryReadStream& rs, const hecl::ProjectPath& outPath)
|
2015-09-24 07:47:30 +00:00
|
|
|
{
|
|
|
|
SCAN scan;
|
|
|
|
scan.read(rs);
|
2016-08-22 03:47:48 +00:00
|
|
|
athena::io::FileWriter writer(outPath.getAbsolutePath());
|
2018-02-22 07:24:51 +00:00
|
|
|
athena::io::ToYAMLStream(scan, writer);
|
2015-09-24 07:47:30 +00:00
|
|
|
return true;
|
|
|
|
}
|
2015-10-27 00:19:03 +00:00
|
|
|
|
2017-01-31 11:21:45 +00:00
|
|
|
static bool Cook(const SCAN& scan, const hecl::ProjectPath& outPath)
|
2016-01-05 00:48:10 +00:00
|
|
|
{
|
2016-03-04 23:04:53 +00:00
|
|
|
athena::io::FileWriter ws(outPath.getAbsolutePath());
|
2016-01-05 00:48:10 +00:00
|
|
|
scan.write(ws);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-10-02 22:41:36 +00:00
|
|
|
static Category GetCategory(const hecl::ProjectPath& inPath)
|
|
|
|
{
|
|
|
|
SCAN scan;
|
|
|
|
athena::io::FileReader reader(inPath.getAbsolutePath());
|
|
|
|
if (reader.hasError())
|
|
|
|
return Category::None;
|
2018-02-22 07:24:51 +00:00
|
|
|
if (!athena::io::FromYAMLStream(scan, reader))
|
2016-10-02 22:41:36 +00:00
|
|
|
return Category::None;
|
|
|
|
return scan.category;
|
|
|
|
}
|
|
|
|
|
2015-10-27 00:19:03 +00:00
|
|
|
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);
|
2016-03-04 23:04:53 +00:00
|
|
|
ent->name = hecl::Format("SCAN_%s_strg", entry.id.toString().c_str());
|
2015-10-27 00:19:03 +00:00
|
|
|
}
|
|
|
|
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);
|
2016-03-04 23:04:53 +00:00
|
|
|
ent->name = hecl::Format("SCAN_%s_tex%d", entry.id.toString().c_str(), i+1);
|
2015-10-27 00:19:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-01-31 11:21:45 +00:00
|
|
|
|
|
|
|
void gatherDependencies(std::vector<hecl::ProjectPath>& pathsOut)
|
|
|
|
{
|
2018-01-06 06:50:42 +00:00
|
|
|
g_curSpec->flattenDependencies(frame, pathsOut);
|
|
|
|
g_curSpec->flattenDependencies(string, pathsOut);
|
2017-01-31 11:21:45 +00:00
|
|
|
for (int i = 0; i < 4; ++i)
|
|
|
|
g_curSpec->flattenDependencies(textures[i].texture, pathsOut);
|
|
|
|
}
|
2015-09-24 07:47:30 +00:00
|
|
|
};
|
2018-02-22 07:24:51 +00:00
|
|
|
|
2015-09-24 07:47:30 +00:00
|
|
|
}
|
|
|
|
|