Maybe load FO4 light records

macos_ci_fix
Alexei Kotov 1 year ago
parent 24d7a096ba
commit f2449df2f7

@ -35,9 +35,6 @@ void ESM4::Light::load(ESM4::Reader& reader)
{ {
mId = reader.getFormIdFromHeader(); mId = reader.getFormIdFromHeader();
mFlags = reader.hdr().record.flags; mFlags = reader.hdr().record.flags;
std::uint32_t esmVer = reader.esmVersion();
bool isFONV = esmVer == ESM::VER_132 || esmVer == ESM::VER_133 || esmVer == ESM::VER_134;
while (reader.getSubRecordHeader()) while (reader.getSubRecordHeader())
{ {
const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader(); const ESM4::SubRecordHeader& subHdr = reader.subRecordHeader();
@ -51,31 +48,31 @@ void ESM4::Light::load(ESM4::Reader& reader)
break; break;
case ESM4::SUB_DATA: case ESM4::SUB_DATA:
{ {
// FIXME: TES4 might be uint32 as well, need to check if (subHdr.dataSize != 32 && subHdr.dataSize != 48 && subHdr.dataSize != 64)
if (isFONV || (esmVer == ESM::VER_094 && subHdr.dataSize == 32) /*FO3*/)
{ {
reader.get(mData.time); // uint32 reader.skipSubRecordData();
break;
} }
else reader.get(mData.time);
reader.get(mData.duration); // float
reader.get(mData.radius); reader.get(mData.radius);
reader.get(mData.colour); reader.get(mData.colour);
reader.get(mData.flags); reader.get(mData.flags);
// if (reader.esmVersion() == ESM::VER_094 || reader.esmVersion() == ESM::VER_170) reader.get(mData.falloff);
if (subHdr.dataSize == 48) reader.get(mData.FOV);
// TES5, FO4
if (subHdr.dataSize >= 48)
{ {
reader.get(mData.falloff);
reader.get(mData.FOV);
reader.get(mData.nearClip); reader.get(mData.nearClip);
reader.get(mData.frequency); reader.get(mData.frequency);
reader.get(mData.intensityAmplitude); reader.get(mData.intensityAmplitude);
reader.get(mData.movementAmplitude); reader.get(mData.movementAmplitude);
} if (subHdr.dataSize == 64)
else if (subHdr.dataSize == 32) // TES4 {
{ reader.get(mData.constant);
reader.get(mData.falloff); reader.get(mData.scalar);
reader.get(mData.FOV); reader.get(mData.exponent);
reader.get(mData.godRaysNearClip);
}
} }
reader.get(mData.value); reader.get(mData.value);
reader.get(mData.weight); reader.get(mData.weight);
@ -104,7 +101,7 @@ void ESM4::Light::load(ESM4::Reader& reader)
case ESM4::SUB_MODS: case ESM4::SUB_MODS:
case ESM4::SUB_MODF: // Model data end case ESM4::SUB_MODF: // Model data end
case ESM4::SUB_OBND: case ESM4::SUB_OBND:
case ESM4::SUB_VMAD: // Dragonborn only? case ESM4::SUB_VMAD:
case ESM4::SUB_DAMC: // Destructible case ESM4::SUB_DAMC: // Destructible
case ESM4::SUB_DEST: case ESM4::SUB_DEST:
case ESM4::SUB_DMDC: case ESM4::SUB_DMDC:
@ -114,8 +111,14 @@ void ESM4::Light::load(ESM4::Reader& reader)
case ESM4::SUB_DSTA: case ESM4::SUB_DSTA:
case ESM4::SUB_DSTD: case ESM4::SUB_DSTD:
case ESM4::SUB_DSTF: // Destructible end case ESM4::SUB_DSTF: // Destructible end
case ESM4::SUB_KSIZ:
case ESM4::SUB_KWDA:
case ESM4::SUB_LNAM: // FO4
case ESM4::SUB_MICO: // FO4
case ESM4::SUB_NAM0: // FO4
case ESM4::SUB_PRPS: // FO4 case ESM4::SUB_PRPS: // FO4
case ESM4::SUB_PTRN: // FO4 case ESM4::SUB_PTRN: // FO4
case ESM4::SUB_WGDR: // FO4
reader.skipSubRecordData(); reader.skipSubRecordData();
break; break;
default: default:

@ -56,8 +56,7 @@ namespace ESM4
struct Data struct Data
{ {
std::uint32_t time; // FO/FONV only std::int32_t time;
float duration = -1;
std::uint32_t radius; std::uint32_t radius;
std::uint32_t colour; // RGBA std::uint32_t colour; // RGBA
// flags: // flags:
@ -74,10 +73,14 @@ namespace ESM4
std::int32_t flags; std::int32_t flags;
float falloff = 1.f; float falloff = 1.f;
float FOV = 90; // FIXME: FOV in degrees or radians? float FOV = 90; // FIXME: FOV in degrees or radians?
float nearClip; // TES5 only float nearClip; // TES5+
float frequency; // TES5 only float frequency; // TES5+
float intensityAmplitude; // TES5 only float intensityAmplitude; // TES5+
float movementAmplitude; // TES5 only float movementAmplitude; // TES5+
float constant; // FO4
float scalar; // FO4
float exponent; // FO4
float godRaysNearClip; // FO4
std::uint32_t value; // gold std::uint32_t value; // gold
float weight; float weight;
}; };

Loading…
Cancel
Save