This commit is contained in:
Jack Andersen 2015-11-24 16:16:17 -10:00
commit 6c78f91fa7
5 changed files with 59 additions and 21 deletions

View File

@ -219,12 +219,12 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const DNAMP1::PAK::Entry& ent
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
case SBIG('ANCS'):
return {nullptr, ANCS::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 3};
case SBIG('MLVL'):
return {MLVL::Extract, nullptr, {_S(".yaml")}};
// case SBIG('MAPA'):
// return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
return {nullptr, MLVL::Extract, {_S(".blend")}, 3};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
case SBIG('MAPA'):
return {nullptr, MAPA::Extract, {_S(".blend")}, 4};
}
return {};
}

View File

@ -1,14 +1,30 @@
#ifndef __DNAMP2_MAPA_HPP__
#define __DNAMP2_MAPA_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNAMP1/MAPA.hpp"
#include "DNAMP2.hpp"
namespace Retro
{
namespace DNAMP2
{
struct MAPA : DNAMP1::MAPA
{};
{
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
MAPA mapa;
mapa.read(rs);
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
return DNAMAPA::ReadMAPAToBlender(conn, mapa, outPath, pakRouter, entry, force);
}
};
}
}

View File

@ -2,6 +2,8 @@
#define __DNAMP2_MLVL_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DNAMP2.hpp"
namespace Retro
{
@ -91,14 +93,23 @@ struct MLVL : BigYAML
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const DNAMP1::PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
MLVL mlvl;
mlvl.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
mlvl.toYAMLFile(fp);
fclose(fp);
return true;
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
entry, force, fileChanged);
}
};

View File

@ -154,16 +154,16 @@ void PAKBridge::build()
HECL::SNPrintf(num, 16, _S("%02u "), ai);
areaDeps.name = num + areaDeps.name;
const MLVL::LayerFlags& areaLayers = *layerFlagsIt++;
if (areaLayers.layerCount)
const MLVL::LayerFlags& layerFlags = *layerFlagsIt++;
if (layerFlags.layerCount)
{
areaDeps.layers.reserve(areaLayers.layerCount);
for (unsigned l=0 ; l<areaLayers.layerCount ; ++l)
areaDeps.layers.reserve(layerFlags.layerCount);
for (unsigned l=1 ; l<layerFlags.layerCount ; ++l)
{
areaDeps.layers.emplace_back();
Level::Area::Layer& layer = areaDeps.layers.back();
layer.name = LayerName(mlvl.layerNames[layerIdx++]);
layer.active = areaLayers.flags >> l & 0x1;
layer.active = layerFlags.flags >> (l-1) & 0x1;
/* Trim possible trailing whitespace */
#if HECL_UCS2
while (layer.name.size() && iswspace(layer.name.back()))
@ -229,10 +229,10 @@ ResExtractor<PAKBridge> PAKBridge::LookupExtractor(const PAK::Entry& entry)
return {nullptr, CMDL::Extract, {_S(".blend")}, 1};
case SBIG('CHAR'):
return {nullptr, CHAR::Extract, {_S(".yaml"), _S(".blend")}, 2};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 3};
case SBIG('MLVL'):
return {MLVL::Extract, nullptr, {_S(".yaml")}};
return {nullptr, MLVL::Extract, {_S(".blend")}, 3};
case SBIG('MREA'):
return {nullptr, MREA::Extract, {_S(".blend")}, 4};
}
return {};
}

View File

@ -2,6 +2,8 @@
#define __DNAMP3_MLVL_HPP__
#include "../DNACommon/PAK.hpp"
#include "../DNACommon/MLVL.hpp"
#include "DNAMP3.hpp"
namespace Retro
{
@ -75,14 +77,23 @@ struct MLVL : BigYAML
Value<atUint32> layerNameOffsetCount;
Vector<atUint32, DNA_COUNT(layerNameOffsetCount)> layerNameOffsets;
static bool Extract(PAKEntryReadStream& rs, const HECL::ProjectPath& outPath)
static bool Extract(const SpecBase& dataSpec,
PAKEntryReadStream& rs,
const HECL::ProjectPath& outPath,
PAKRouter<PAKBridge>& pakRouter,
const PAK::Entry& entry,
bool force,
std::function<void(const HECL::SystemChar*)> fileChanged)
{
MLVL mlvl;
mlvl.read(rs);
FILE* fp = HECL::Fopen(outPath.getAbsolutePath().c_str(), _S("wb"));
mlvl.toYAMLFile(fp);
fclose(fp);
return true;
HECL::BlenderConnection& conn = HECL::BlenderConnection::SharedConnection();
return DNAMLVL::ReadMLVLToBlender(conn, mlvl, outPath, pakRouter,
entry, force, fileChanged);
}
};