diff --git a/dCommon/LevelFile.cpp b/dCommon/LevelFile.cpp index 835f82603..1c36a4e62 100644 --- a/dCommon/LevelFile.cpp +++ b/dCommon/LevelFile.cpp @@ -291,8 +291,13 @@ void LevelFile::ReadParticles(std::istream& file) { BinaryIO::BinaryRead(file, particle.position); BinaryIO::BinaryRead(file, particle.rotation); particle.effectNames = ReadWideString32(file); - if (version < 46) BinaryIO::BinaryRead(file, particle.unknown); - else config = ReadWideString32(file); + if (version < 46) { + // Before version 46 the effect names end with a wide null + uint16_t nameTerminator{}; + BinaryIO::BinaryRead(file, nameTerminator); + } else { + config = ReadWideString32(file); + } particle.config = config; if (file.fail()) throw std::runtime_error("Failed to read from istream."); // The client stops at a particle with no effect diff --git a/dCommon/LevelFile.h b/dCommon/LevelFile.h index 6a85f21cf..be176f14c 100644 --- a/dCommon/LevelFile.h +++ b/dCommon/LevelFile.h @@ -91,7 +91,6 @@ struct LevelParticle { NiPoint3 position; NiQuaternion rotation = QuatUtils::IDENTITY; std::string effectNames; // separated by ';' - uint16_t unknown{}; // before version 46 // Version 46 on. The client keeps the last one it read for a particle without one std::string config; }; diff --git a/tests/dGameTests/dZoneManagerTests/LevelTests.cpp b/tests/dGameTests/dZoneManagerTests/LevelTests.cpp index bc6ffa92d..b81a75c06 100644 --- a/tests/dGameTests/dZoneManagerTests/LevelTests.cpp +++ b/tests/dGameTests/dZoneManagerTests/LevelTests.cpp @@ -103,7 +103,7 @@ namespace { WriteFloats(stream, { 4.0f, 5.0f, 6.0f }); // position WriteFloats(stream, { 1.0f, 0.0f, 0.0f, 0.0f }); // rotation, w first WriteWString32(stream, names); - if (version < 46) Write(stream, 9); + if (version < 46) Write(stream, 0); // the names' wide null else WriteWString32(stream, config); } @@ -286,7 +286,6 @@ TEST(LevelTests, ReadsAFileFromBeforeChunks) { EXPECT_EQ(level.sounds[0].config.find(u"soundName")->second->GetValueAsString(), "birds"); ASSERT_EQ(level.particles.size(), 1); EXPECT_EQ(level.particles[0].priority, 0); // only from version 43 - EXPECT_EQ(level.particles[0].unknown, 9); } // Older lighting: fog distances only before 39, no directional colour before 36, and before 33 a fixed spawn point