Merge branch 'fix_esm4' into 'master'

Fix regressions in ESM4 reader caused by !2902

See merge request OpenMW/openmw!2957
7344-support-launching-the-example-suite
Tetramir 2 years ago
commit 6936c3a1c8

@ -213,7 +213,7 @@ void ESM4::Land::load(ESM4::Reader& reader)
bool missing = false; bool missing = false;
for (int i = 0; i < 4; ++i) for (int i = 0; i < 4; ++i)
{ {
if (mTextures[i].base.formId.isZeroOrUnset()) if (mTextures[i].base.formId == 0)
{ {
// std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " missing base, quad " << i << std::endl; // std::cout << "ESM4::LAND " << ESM4::formIdToString(mFormId) << " missing base, quad " << i << std::endl;
// std::cout << "layers " << mTextures[i].layers.size() << std::endl; // std::cout << "layers " << mTextures[i].layers.size() << std::endl;

@ -74,7 +74,7 @@ namespace ESM4
struct BTXT struct BTXT
{ {
FormId formId; FormId32 formId;
std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right
std::uint8_t unknown1; std::uint8_t unknown1;
std::uint16_t unknown2; std::uint16_t unknown2;
@ -82,7 +82,7 @@ namespace ESM4
struct ATXT struct ATXT
{ {
FormId formId; FormId32 formId;
std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right std::uint8_t quadrant; // 0 = bottom left, 1 = bottom right, 2 = top left, 3 = top right
std::uint8_t unknown; std::uint8_t unknown;
std::uint16_t layerIndex; // texture layer, 0..7 std::uint16_t layerIndex; // texture layer, 0..7

@ -109,7 +109,7 @@ void ESM4::Pathgrid::load(ESM4::Reader& reader)
case ESM4::SUB_PGRL: case ESM4::SUB_PGRL:
{ {
static PGRL objLink; static PGRL objLink;
reader.get(objLink.object); reader.getFormId(objLink.object);
// object linkedNode // object linkedNode
std::size_t numNodes = (subHdr.dataSize - sizeof(int32_t)) / sizeof(int32_t); std::size_t numNodes = (subHdr.dataSize - sizeof(int32_t)) / sizeof(int32_t);

@ -69,7 +69,7 @@ void ESM4::Quest::load(ESM4::Reader& reader)
break; break;
} }
case ESM4::SUB_SCRI: case ESM4::SUB_SCRI:
reader.get(mQuestScript); reader.getFormId(mQuestScript);
break; break;
case ESM4::SUB_CTDA: // FIXME: how to detect if 1st/2nd param is a formid? case ESM4::SUB_CTDA: // FIXME: how to detect if 1st/2nd param is a formid?
{ {

@ -223,8 +223,8 @@ void ESM4::Race::load(ESM4::Reader& reader)
} }
case ESM4::SUB_DNAM: case ESM4::SUB_DNAM:
{ {
reader.get(mDefaultHair[0]); // male reader.getFormId(mDefaultHair[0]); // male
reader.get(mDefaultHair[1]); // female reader.getFormId(mDefaultHair[1]); // female
break; break;
} }
@ -421,7 +421,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
std::size_t numHairChoices = subHdr.dataSize / sizeof(FormId32); std::size_t numHairChoices = subHdr.dataSize / sizeof(FormId32);
mHairChoices.resize(numHairChoices); mHairChoices.resize(numHairChoices);
for (unsigned int i = 0; i < numHairChoices; ++i) for (unsigned int i = 0; i < numHairChoices; ++i)
reader.get(mHairChoices.at(i)); reader.getFormId(mHairChoices.at(i));
break; break;
} }
@ -430,7 +430,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
std::size_t numEyeChoices = subHdr.dataSize / sizeof(FormId32); std::size_t numEyeChoices = subHdr.dataSize / sizeof(FormId32);
mEyeChoices.resize(numEyeChoices); mEyeChoices.resize(numEyeChoices);
for (unsigned int i = 0; i < numEyeChoices; ++i) for (unsigned int i = 0; i < numEyeChoices; ++i)
reader.get(mEyeChoices.at(i)); reader.getFormId(mEyeChoices.at(i));
break; break;
} }
@ -495,7 +495,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
{ {
FormId race; FormId race;
std::int32_t adjustment; std::int32_t adjustment;
reader.get(race); reader.getFormId(race);
reader.get(adjustment); reader.get(adjustment);
mDisposition[race] = adjustment; mDisposition[race] = adjustment;
@ -505,8 +505,8 @@ void ESM4::Race::load(ESM4::Reader& reader)
{ {
if (subHdr.dataSize == 8) // TES4 if (subHdr.dataSize == 8) // TES4
{ {
reader.get(mVNAM[0]); // For TES4 seems to be 2 race formids reader.getFormId(mVNAM[0]); // For TES4 seems to be 2 race formids
reader.get(mVNAM[1]); reader.getFormId(mVNAM[1]);
} }
else if (subHdr.dataSize == 4) // TES5 else if (subHdr.dataSize == 4) // TES5
{ {

@ -79,7 +79,7 @@ void ESM4::World::load(ESM4::Reader& reader)
reader.getZString(mMapFile); reader.getZString(mMapFile);
break; // map filename, Oblivion only? break; // map filename, Oblivion only?
case ESM4::SUB_CNAM: case ESM4::SUB_CNAM:
reader.get(mClimate); reader.getFormId(mClimate);
break; break;
case ESM4::SUB_NAM2: case ESM4::SUB_NAM2:
reader.getFormId(mWater); reader.getFormId(mWater);

Loading…
Cancel
Save