1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 21:59:55 +00:00

Updating RACE for FO4, first pass

This commit is contained in:
Alexei Kotov 2023-08-15 08:06:32 +03:00
parent 0c05bbea37
commit 4605894a5a
2 changed files with 127 additions and 16 deletions

View file

@ -658,7 +658,53 @@ namespace ESM4
SUB_JNAM = fourCC("JNAM"), // FONV SUB_JNAM = fourCC("JNAM"), // FONV
SUB_EFSD = fourCC("EFSD"), // FONV DeadMoney SUB_EFSD = fourCC("EFSD"), // FONV DeadMoney
SUB_PRPS = fourCC("PRPS"), // FO4 // Introduced in FO4
SUB_APPR = fourCC("APPR"),
SUB_ATKS = fourCC("ATKS"),
SUB_ATKT = fourCC("ATKT"),
SUB_ATKW = fourCC("ATKW"),
SUB_BMMP = fourCC("BMMP"),
SUB_BSMB = fourCC("BSMB"),
SUB_BSMP = fourCC("BSMP"),
SUB_BSMS = fourCC("BSMS"),
SUB_FMRI = fourCC("FMRI"),
SUB_FMRN = fourCC("FMRN"),
SUB_HLTX = fourCC("HLTX"),
SUB_MLSI = fourCC("MLSI"),
SUB_MPGN = fourCC("MPGN"),
SUB_MPGS = fourCC("MPGS"),
SUB_MPPC = fourCC("MPPC"),
SUB_MPPF = fourCC("MPPF"),
SUB_MPPI = fourCC("MPPI"),
SUB_MPPK = fourCC("MPPK"),
SUB_MPPM = fourCC("MPPM"),
SUB_MPPN = fourCC("MPPN"),
SUB_MPPT = fourCC("MPPT"),
SUB_MSID = fourCC("MSID"),
SUB_MSM0 = fourCC("MSM0"),
SUB_MSM1 = fourCC("MSM1"),
SUB_NTOP = fourCC("NTOP"),
SUB_PRPS = fourCC("PRPS"),
SUB_PTOP = fourCC("PTOP"),
SUB_RBPC = fourCC("RBPC"),
SUB_SADD = fourCC("SADD"),
SUB_SAKD = fourCC("SAKD"),
SUB_SAPT = fourCC("SAPT"),
SUB_SGNM = fourCC("SGNM"),
SUB_SRAC = fourCC("SRAC"),
SUB_SRAF = fourCC("SRAF"),
SUB_STCP = fourCC("STCP"),
SUB_STKD = fourCC("STKD"),
SUB_TETI = fourCC("TETI"),
SUB_TTEB = fourCC("TTEB"),
SUB_TTEC = fourCC("TTEC"),
SUB_TTED = fourCC("TTED"),
SUB_TTEF = fourCC("TTEF"),
SUB_TTET = fourCC("TTET"),
SUB_TTGE = fourCC("TTGE"),
SUB_TTGP = fourCC("TTGP"),
SUB_UNWP = fourCC("UNWP"),
SUB_WMAP = fourCC("WMAP"),
}; };
// Based on http://www.uesp.net/wiki/Tes5Mod:Mod_File_Format#Records // Based on http://www.uesp.net/wiki/Tes5Mod:Mod_File_Format#Records

View file

@ -139,7 +139,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
reader.get(mWeightFemale); reader.get(mWeightFemale);
reader.get(mRaceFlags); reader.get(mRaceFlags);
} }
else if (subHdr.dataSize >= 128 && subHdr.dataSize <= 164) // TES5 else if (subHdr.dataSize == 128 || subHdr.dataSize == 164) // TES5
{ {
mIsTES5 = true; mIsTES5 = true;
@ -188,7 +188,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
reader.get(dummy); // angular tolerance reader.get(dummy); // angular tolerance
reader.get(dummy2); // flags reader.get(dummy2); // flags
if (subHdr.dataSize > 128) if (subHdr.dataSize == 164)
{ {
reader.get(dummy2); // unknown 1 reader.get(dummy2); // unknown 1
reader.get(dummy2); // unknown 2 reader.get(dummy2); // unknown 2
@ -217,7 +217,7 @@ void ESM4::Race::load(ESM4::Reader& reader)
break; break;
} }
case ESM4::SUB_CNAM: // Only in TES4? case ESM4::SUB_CNAM:
// CNAM SNAM VNAM // CNAM SNAM VNAM
// Sheogorath 0x0 0000 98 2b 10011000 00101011 // Sheogorath 0x0 0000 98 2b 10011000 00101011
// Golden Saint 0x3 0011 26 46 00100110 01000110 // Golden Saint 0x3 0011 26 46 00100110 01000110
@ -406,11 +406,17 @@ void ESM4::Race::load(ESM4::Reader& reader)
break; /* 3, 6, 8 */ break; /* 3, 6, 8 */
// //
case ESM4::SUB_HNAM: case ESM4::SUB_HNAM:
{
// FIXME: this is a texture name in FO4
if (subHdr.dataSize % sizeof(ESM::FormId32) != 0)
reader.skipSubRecordData();
else
{ {
std::size_t numHairChoices = subHdr.dataSize / sizeof(ESM::FormId32); std::size_t numHairChoices = subHdr.dataSize / sizeof(ESM::FormId32);
mHairChoices.resize(numHairChoices); mHairChoices.resize(numHairChoices);
for (unsigned int i = 0; i < numHairChoices; ++i) for (unsigned int i = 0; i < numHairChoices; ++i)
reader.getFormId(mHairChoices.at(i)); reader.getFormId(mHairChoices.at(i));
}
break; break;
} }
@ -550,14 +556,23 @@ void ESM4::Race::load(ESM4::Reader& reader)
break; break;
} }
case ESM4::SUB_BOD2: // TES5 case ESM4::SUB_BOD2:
{
if (subHdr.dataSize == 8 || subHdr.dataSize == 4) // TES5, FO4
{ {
reader.get(mBodyTemplate.bodyPart); reader.get(mBodyTemplate.bodyPart);
mBodyTemplate.flags = 0; mBodyTemplate.flags = 0;
mBodyTemplate.unknown1 = 0; // probably padding mBodyTemplate.unknown1 = 0; // probably padding
mBodyTemplate.unknown2 = 0; // probably padding mBodyTemplate.unknown2 = 0; // probably padding
mBodyTemplate.unknown3 = 0; // probably padding mBodyTemplate.unknown3 = 0; // probably padding
mBodyTemplate.type = 0;
if (subHdr.dataSize == 8)
reader.get(mBodyTemplate.type); reader.get(mBodyTemplate.type);
}
else
{
reader.skipSubRecordData();
}
break; break;
} }
@ -675,7 +690,57 @@ void ESM4::Race::load(ESM4::Reader& reader)
case ESM4::SUB_MODT: // FO3 case ESM4::SUB_MODT: // FO3
case ESM4::SUB_MODD: // FO3 case ESM4::SUB_MODD: // FO3
case ESM4::SUB_ONAM: // FO3 case ESM4::SUB_ONAM: // FO3
case ESM4::SUB_PRPS: // FO4 // FO4
case ESM4::SUB_APPR:
case ESM4::SUB_ATKS:
case ESM4::SUB_ATKT:
case ESM4::SUB_ATKW:
case ESM4::SUB_BMMP:
case ESM4::SUB_BSMB:
case ESM4::SUB_BSMP:
case ESM4::SUB_BSMS:
case ESM4::SUB_CTDA:
case ESM4::SUB_FMRI:
case ESM4::SUB_FMRN:
case ESM4::SUB_HLTX:
case ESM4::SUB_MLSI:
case ESM4::SUB_MPGN:
case ESM4::SUB_MPGS:
case ESM4::SUB_MPPC:
case ESM4::SUB_MPPF:
case ESM4::SUB_MPPI:
case ESM4::SUB_MPPK:
case ESM4::SUB_MPPM:
case ESM4::SUB_MPPN:
case ESM4::SUB_MPPT:
case ESM4::SUB_MSID:
case ESM4::SUB_MSM0:
case ESM4::SUB_MSM1:
case ESM4::SUB_NNAM:
case ESM4::SUB_NTOP:
case ESM4::SUB_PRPS:
case ESM4::SUB_PTOP:
case ESM4::SUB_QSTI:
case ESM4::SUB_RBPC:
case ESM4::SUB_SADD:
case ESM4::SUB_SAKD:
case ESM4::SUB_SAPT:
case ESM4::SUB_SGNM:
case ESM4::SUB_SRAC:
case ESM4::SUB_SRAF:
case ESM4::SUB_STCP:
case ESM4::SUB_STKD:
case ESM4::SUB_TETI:
case ESM4::SUB_TTEB:
case ESM4::SUB_TTEC:
case ESM4::SUB_TTED:
case ESM4::SUB_TTEF:
case ESM4::SUB_TTET:
case ESM4::SUB_TTGE:
case ESM4::SUB_TTGP:
case ESM4::SUB_UNWP:
case ESM4::SUB_WMAP:
case ESM4::SUB_ZNAM:
reader.skipSubRecordData(); reader.skipSubRecordData();
break; break;
default: default: