This commit is contained in:
Phillip Stephens 2015-10-12 02:43:58 -07:00
commit d929743a79
14 changed files with 326 additions and 29 deletions

View File

@ -3,6 +3,11 @@
#include <BlenderConnection.hpp>
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES 1
#endif
#include <math.h>
namespace Retro
{

View File

@ -495,27 +495,42 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag
}
}
const char* c_soc_log[2] = {"color_combiner_sockets[-1]", "color_combiner_sockets[-2]"};
if (!(c_tev_opts & 2))
{
/* B nodes */
if (!strcmp(cc, "ONE"))
out.format("color_combiner_sockets.append(%s)\n", cb);
{
if (strcmp(cb, "ZERO") && strcmp(cb, "HALF") && strcmp(cb, "ONE"))
{
out.format("color_combiner_sockets.append(%s)\n", cb);
++c_combiner_idx;
}
else
{
c_soc_log[1] = c_soc_log[0];
c_soc_log[0] = cb;
}
}
else
{
AddColorCombiner(out, COMB_MULT, cc, cb, nullptr);
++c_combiner_idx;
++c_combiner_idx;
}
}
if (!(c_tev_opts & 4))
{
/* A+B node */
AddColorCombiner(out, COMB_ADD, "color_combiner_sockets[-1]", "color_combiner_sockets[-2]", nullptr);
AddColorCombiner(out, COMB_ADD, c_soc_log[0], c_soc_log[1], nullptr);
++c_combiner_idx;
}
if (!(c_tev_opts & 8))
{
/* +D node */
AddColorCombiner(out, COMB_ADD, cd, "color_combiner_sockets[-1]", nullptr);
AddColorCombiner(out, COMB_ADD, cd, c_soc_log[0], nullptr);
++c_combiner_idx;
}
@ -542,27 +557,42 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag
}
}
const char* a_soc_log[2] = {"alpha_combiner_sockets[-1]", "alpha_combiner_sockets[-2]"};
if (!(a_tev_opts & 2))
{
/* B nodes */
if (!strcmp(ac, "ONE"))
out.format("alpha_combiner_sockets.append(%s)\n", ab);
{
if (strcmp(ab, "ZERO") && strcmp(ab, "HALF") && strcmp(ab, "ONE"))
{
out.format("alpha_combiner_sockets.append(%s)\n", ab);
++a_combiner_idx;
}
else
{
a_soc_log[1] = a_soc_log[0];
a_soc_log[0] = ab;
}
}
else
{
AddAlphaCombiner(out, COMB_MULT, ac, ab, nullptr);
++a_combiner_idx;
++a_combiner_idx;
}
}
if (!(a_tev_opts & 4))
{
/* A+B node */
AddAlphaCombiner(out, COMB_ADD, "alpha_combiner_sockets[-1]", "alpha_combiner_sockets[-2]", nullptr);
AddAlphaCombiner(out, COMB_ADD, a_soc_log[0], a_soc_log[1], nullptr);
++a_combiner_idx;
}
if (!(a_tev_opts & 8))
{
/* +D node */
AddAlphaCombiner(out, COMB_ADD, ad, "alpha_combiner_sockets[-1]", nullptr);
AddAlphaCombiner(out, COMB_ADD, ad, a_soc_log[0], nullptr);
++a_combiner_idx;
}

View File

@ -3,7 +3,9 @@
#include "DeafBabe.hpp"
#include "../DNACommon/BabeDead.hpp"
#define _USE_MATH_DEFINES
#ifndef _USE_MATH_DEFINES
#define _USE_MATH_DEFINES 1
#endif
#include <math.h>
namespace Retro
@ -92,7 +94,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Read meshes */
atUint32 curSec = 1;
for (int m=0 ; m<head.meshCount ; ++m)
for (atUint32 m=0 ; m<head.meshCount ; ++m)
{
MeshHeader mHeader;
secStart = rs.position();

View File

@ -90,8 +90,9 @@ void SCLY::ScriptLayer::read(Athena::io::IStreamReader& rs)
obj->type = type;
obj->read(rs);
objects.push_back(obj);
if ((rs.position() - start) != len)
Log.report(LogVisor::FatalError, _S("Error while reading object of type 0x%.2X, did not read the expected amount of data, read 0x%x, expected 0x%x"), (atUint32)type, (rs.position() - start), len);
size_t actualLen = rs.position() - start;
if (actualLen != len)
Log.report(LogVisor::Warning, _S("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

View File

@ -33,11 +33,7 @@ struct PlayerActor : IScriptObject
{
DECL_YAML
Value<atUint32> propertyCount;
Value<bool> unknown1;
Value<bool> unknown2;
Value<bool> unknown3;
Value<bool> unknown4;
Value<bool> unknown5;
Vector<bool, DNA_COUNT(propertyCount)> bools;
} playerParameters;
Value<atUint32> unknown8;
};

View File

@ -11,7 +11,7 @@ namespace DNAMP1
{
struct WorldTeleporter : IScriptObject
{
DECL_YAML
Delete expl;
String<-1> name;
Value<bool> unknown1;
UniqueID32 mlvl;
@ -33,7 +33,260 @@ struct WorldTeleporter : IScriptObject
Value<float> unknown10;
Value<float> unknown11;
Value<float> unknown12;
/* Trilogy additions (property count 26) */
Value<bool> unknown13;
Value<bool> unknown14;
Value<float> unknown15;
Value<float> unknown16;
Value<float> unknown17;
void read(Athena::io::IStreamReader& __dna_reader)
{
IScriptObject::read(__dna_reader);
/* name */
name = __dna_reader.readString(-1);
/* unknown1 */
unknown1 = __dna_reader.readBool();
/* mlvl */
mlvl.read(__dna_reader);
/* mrea */
mrea.read(__dna_reader);
/* animationParameters */
animationParameters.read(__dna_reader);
/* unknown2 */
unknown2 = __dna_reader.readVec3fBig();
/* model1 */
model1.read(__dna_reader);
/* unknown3 */
unknown3 = __dna_reader.readVec3fBig();
/* model2 */
model2.read(__dna_reader);
/* unknown4 */
unknown4 = __dna_reader.readVec3fBig();
/* unknown5 */
unknown5 = __dna_reader.readBool();
/* soundID */
soundID = __dna_reader.readUint32Big();
/* unknown6 */
unknown6 = __dna_reader.readUint32Big();
/* unknown7 */
unknown7 = __dna_reader.readUint32Big();
/* unknown8 */
unknown8 = __dna_reader.readBool();
/* font */
font.read(__dna_reader);
/* strg */
strg.read(__dna_reader);
/* unknown9 */
unknown9 = __dna_reader.readBool();
/* unknown10 */
unknown10 = __dna_reader.readFloatBig();
/* unknown11 */
unknown11 = __dna_reader.readFloatBig();
/* unknown12 */
unknown12 = __dna_reader.readFloatBig();
if (propertyCount == 26)
{
unknown13 = __dna_reader.readBool();
unknown14 = __dna_reader.readBool();
unknown15 = __dna_reader.readFloatBig();
unknown16 = __dna_reader.readFloatBig();
unknown17 = __dna_reader.readFloatBig();
}
else
{
unknown13 = false;
unknown14 = false;
unknown15 = 0.0;
unknown16 = 0.0;
unknown17 = 0.0;
}
}
void write(Athena::io::IStreamWriter& __dna_writer) const
{
IScriptObject::write(__dna_writer);
/* name */
__dna_writer.writeString(name, -1);
/* unknown1 */
__dna_writer.writeBool(unknown1);
/* mlvl */
mlvl.write(__dna_writer);
/* mrea */
mrea.write(__dna_writer);
/* animationParameters */
animationParameters.write(__dna_writer);
/* unknown2 */
__dna_writer.writeVec3fBig(unknown2);
/* model1 */
model1.write(__dna_writer);
/* unknown3 */
__dna_writer.writeVec3fBig(unknown3);
/* model2 */
model2.write(__dna_writer);
/* unknown4 */
__dna_writer.writeVec3fBig(unknown4);
/* unknown5 */
__dna_writer.writeBool(unknown5);
/* soundID */
__dna_writer.writeUint32Big(soundID);
/* unknown6 */
__dna_writer.writeUint32Big(unknown6);
/* unknown7 */
__dna_writer.writeUint32Big(unknown7);
/* unknown8 */
__dna_writer.writeBool(unknown8);
/* font */
font.write(__dna_writer);
/* strg */
strg.write(__dna_writer);
/* unknown9 */
__dna_writer.writeBool(unknown9);
/* unknown10 */
__dna_writer.writeFloatBig(unknown10);
/* unknown11 */
__dna_writer.writeFloatBig(unknown11);
/* unknown12 */
__dna_writer.writeFloatBig(unknown12);
if (propertyCount == 26)
{
__dna_writer.writeBool(unknown13);
__dna_writer.writeBool(unknown14);
__dna_writer.writeFloatBig(unknown15);
__dna_writer.writeFloatBig(unknown16);
__dna_writer.writeFloatBig(unknown17);
}
}
void fromYAML(Athena::io::YAMLDocReader& __dna_docin)
{
IScriptObject::fromYAML(__dna_docin);
/* name */
name = __dna_docin.readString("name");
/* unknown1 */
unknown1 = __dna_docin.readBool("unknown1");
/* mlvl */
__dna_docin.enumerate("mlvl", mlvl);
/* mrea */
__dna_docin.enumerate("mrea", mrea);
/* animationParameters */
__dna_docin.enumerate("animationParameters", animationParameters);
/* unknown2 */
unknown2 = __dna_docin.readVec3f("unknown2");
/* model1 */
__dna_docin.enumerate("model1", model1);
/* unknown3 */
unknown3 = __dna_docin.readVec3f("unknown3");
/* model2 */
__dna_docin.enumerate("model2", model2);
/* unknown4 */
unknown4 = __dna_docin.readVec3f("unknown4");
/* unknown5 */
unknown5 = __dna_docin.readBool("unknown5");
/* soundID */
soundID = __dna_docin.readUint32("soundID");
/* unknown6 */
unknown6 = __dna_docin.readUint32("unknown6");
/* unknown7 */
unknown7 = __dna_docin.readUint32("unknown7");
/* unknown8 */
unknown8 = __dna_docin.readBool("unknown8");
/* font */
__dna_docin.enumerate("font", font);
/* strg */
__dna_docin.enumerate("strg", strg);
/* unknown9 */
unknown9 = __dna_docin.readBool("unknown9");
/* unknown10 */
unknown10 = __dna_docin.readFloat("unknown10");
/* unknown11 */
unknown11 = __dna_docin.readFloat("unknown11");
/* unknown12 */
unknown12 = __dna_docin.readFloat("unknown12");
if (propertyCount == 26)
{
unknown13 = __dna_docin.readBool("unknown13");
unknown14 = __dna_docin.readBool("unknown14");
unknown15 = __dna_docin.readFloat("unknown15");
unknown16 = __dna_docin.readFloat("unknown16");
unknown17 = __dna_docin.readFloat("unknown17");
}
else
{
unknown13 = false;
unknown14 = false;
unknown15 = 0.0;
unknown16 = 0.0;
unknown17 = 0.0;
}
}
void toYAML(Athena::io::YAMLDocWriter& __dna_docout) const
{
IScriptObject::toYAML(__dna_docout);
/* name */
__dna_docout.writeString("name", name);
/* unknown1 */
__dna_docout.writeBool("unknown1", unknown1);
/* mlvl */
__dna_docout.enumerate("mlvl", mlvl);
/* mrea */
__dna_docout.enumerate("mrea", mrea);
/* animationParameters */
__dna_docout.enumerate("animationParameters", animationParameters);
/* unknown2 */
__dna_docout.writeVec3f("unknown2", unknown2);
/* model1 */
__dna_docout.enumerate("model1", model1);
/* unknown3 */
__dna_docout.writeVec3f("unknown3", unknown3);
/* model2 */
__dna_docout.enumerate("model2", model2);
/* unknown4 */
__dna_docout.writeVec3f("unknown4", unknown4);
/* unknown5 */
__dna_docout.writeBool("unknown5", unknown5);
/* soundID */
__dna_docout.writeUint32("soundID", soundID);
/* unknown6 */
__dna_docout.writeUint32("unknown6", unknown6);
/* unknown7 */
__dna_docout.writeUint32("unknown7", unknown7);
/* unknown8 */
__dna_docout.writeBool("unknown8", unknown8);
/* font */
__dna_docout.enumerate("font", font);
/* strg */
__dna_docout.enumerate("strg", strg);
/* unknown9 */
__dna_docout.writeBool("unknown9", unknown9);
/* unknown10 */
__dna_docout.writeFloat("unknown10", unknown10);
/* unknown11 */
__dna_docout.writeFloat("unknown11", unknown11);
/* unknown12 */
__dna_docout.writeFloat("unknown12", unknown12);
if (propertyCount == 26)
{
__dna_docout.writeBool("unknown13", unknown13);
__dna_docout.writeBool("unknown14", unknown14);
__dna_docout.writeFloat("unknown15", unknown15);
__dna_docout.writeFloat("unknown16", unknown16);
__dna_docout.writeFloat("unknown17", unknown17);
}
}
static const char* DNAType()
{
return "Retro::DNAMP1::WorldTeleporter";
}
};
}
}

View File

@ -73,7 +73,7 @@ MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source, atUint32 blk
m_source(source), m_blkCount(blkCount)
{
m_blockInfos.reserve(blkCount);
for (int i=0 ; i<blkCount ; ++i)
for (atUint32 i=0 ; i<blkCount ; ++i)
{
m_blockInfos.emplace_back();
BlockInfo& info = m_blockInfos.back();
@ -228,7 +228,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Read meshes */
atUint32 curSec = 1;
for (int m=0 ; m<head.meshCount ; ++m)
for (atUint32 m=0 ; m<head.meshCount ; ++m)
{
MeshHeader mHeader;
secStart = drs.position();

View File

@ -14,7 +14,7 @@ MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source,
{
m_blkCount = blkCount;
m_blockInfos.reserve(blkCount);
for (int i=0 ; i<blkCount ; ++i)
for (atUint32 i=0 ; i<blkCount ; ++i)
{
m_blockInfos.emplace_back();
BlockInfo& info = m_blockInfos.back();
@ -23,7 +23,7 @@ MREA::StreamReader::StreamReader(Athena::io::IStreamReader& source,
}
source.seekAlign32();
m_secIdxs.reserve(secIdxCount);
for (int i=0 ; i<secIdxCount ; ++i)
for (atUint32 i=0 ; i<secIdxCount ; ++i)
{
m_secIdxs.emplace_back();
std::pair<DNAFourCC, atUint32>& idx = m_secIdxs.back();
@ -136,7 +136,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
atUint32 curSec = 1;
std::vector<atUint32> surfaceCounts;
surfaceCounts.reserve(head.meshCount);
for (int m=0 ; m<head.meshCount ; ++m)
for (atUint32 m=0 ; m<head.meshCount ; ++m)
{
/* Mesh header */
MeshHeader mHeader;
@ -176,7 +176,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Now the meshes themselves */
if (secIdxIt->first == FOURCC('GPUD'))
{
for (int m=0 ; m<head.meshCount ; ++m)
for (atUint32 m=0 ; m<head.meshCount ; ++m)
{
curSec += DNACMDL::ReadGeomSectionsToBlender<PAKRouter<PAKBridge>, MaterialSet, RigPair, DNACMDL::SurfaceHeader_3>
(os, drs, pakRouter, entry, dummy, true,
@ -195,7 +195,7 @@ bool MREA::Extract(const SpecBase& dataSpec,
/* Skip SOBJ (SCLY) */
if (secIdxIt->first == FOURCC('SOBJ'))
{
for (int l=0 ; l<head.sclyLayerCount ; ++l)
for (atUint32 l=0 ; l<head.sclyLayerCount ; ++l)
drs.seek(head.secSizes[curSec++], Athena::Current);
++secIdxIt;
}

View File

@ -268,7 +268,7 @@ struct SpecMP1 : SpecBase
bool checkPathPrefix(const HECL::ProjectPath& path)
{
return path.getRelativePath().compare(0, 4, "MP1/") == 0;
return path.getRelativePath().compare(0, 4, _S("MP1/")) == 0;
}
bool validateYAMLDNAType(FILE* fp) const

View File

@ -258,7 +258,7 @@ struct SpecMP2 : SpecBase
bool checkPathPrefix(const HECL::ProjectPath& path)
{
return path.getRelativePath().compare(0, 4, "MP2/") == 0;
return path.getRelativePath().compare(0, 4, _S("MP2/")) == 0;
}
bool validateYAMLDNAType(FILE* fp) const

View File

@ -439,7 +439,7 @@ struct SpecMP3 : SpecBase
bool checkPathPrefix(const HECL::ProjectPath& path)
{
return path.getRelativePath().compare(0, 4, "MP3/") == 0;
return path.getRelativePath().compare(0, 4, _S("MP3/")) == 0;
}
bool validateYAMLDNAType(FILE* fp) const

View File

@ -6,3 +6,10 @@
* Mac OS X 10.9+
* Linux (with recent udev, xcb, xinput, glx)
* **[Coming Soon]** FreeBSD
### Build Prerequisites:
* [CMake 3+](https://cmake.org)
* [Python 3+](https://python.org)
* LLVM
* [Specialized Windows Package](https://www.dropbox.com/s/4u0rckvh3d3tvr1/LLVM-3.7.0-win64.exe)
* [OS X Package](http://llvm.org/releases/3.7.0/clang+llvm-3.7.0-x86_64-apple-darwin.tar.xz)

View File

@ -1,4 +1,7 @@
#if _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <objbase.h>
#endif

2
hecl

@ -1 +1 @@
Subproject commit b33c31a34bf8f2c8d13ac923abe58da624814368
Subproject commit abb371d22ba32982f87c174d494756e0477c21c1