diff --git a/DataSpec/DNAMP1/CMDLMaterials.cpp b/DataSpec/DNAMP1/CMDLMaterials.cpp index 54f734d65..17d734e01 100644 --- a/DataSpec/DNAMP1/CMDLMaterials.cpp +++ b/DataSpec/DNAMP1/CMDLMaterials.cpp @@ -494,28 +494,43 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag ++c_combiner_idx; } } + + 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; } @@ -541,28 +556,43 @@ static void AddTEVStage(Stream& out, const MaterialSet::Material::TEVStage& stag ++a_combiner_idx; } } + + 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; } diff --git a/DataSpec/DNAMP1/SCLY.cpp b/DataSpec/DNAMP1/SCLY.cpp index e4a67ce41..5083eed1b 100644 --- a/DataSpec/DNAMP1/SCLY.cpp +++ b/DataSpec/DNAMP1/SCLY.cpp @@ -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 diff --git a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp index 6cc83fb8c..0525b7cb6 100644 --- a/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/PlayerActor.hpp @@ -33,11 +33,7 @@ struct PlayerActor : IScriptObject { DECL_YAML Value propertyCount; - Value unknown1; - Value unknown2; - Value unknown3; - Value unknown4; - Value unknown5; + Vector bools; } playerParameters; Value unknown8; }; diff --git a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp index 6087e597c..7fc2ab94a 100644 --- a/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp +++ b/DataSpec/DNAMP1/ScriptObjects/WorldTeleporter.hpp @@ -11,7 +11,7 @@ namespace DNAMP1 { struct WorldTeleporter : IScriptObject { - DECL_YAML + Delete expl; String<-1> name; Value unknown1; UniqueID32 mlvl; @@ -33,7 +33,260 @@ struct WorldTeleporter : IScriptObject Value unknown10; Value unknown11; Value unknown12; + + /* Trilogy additions (property count 26) */ + Value unknown13; + Value unknown14; + Value unknown15; + Value unknown16; + Value 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"; + } }; + } } diff --git a/MathLib b/MathLib index 72972196a..5ec947366 160000 --- a/MathLib +++ b/MathLib @@ -1 +1 @@ -Subproject commit 72972196a4ebf8d41ba9e5c212fe89cd796f97eb +Subproject commit 5ec947366a9577369e68091945ddb93eaaefcc74