Merge branch 'exorcisingtoddfrommyoblivioncopy' into 'master'

Support ESM4::Light with no spotlight data again

See merge request OpenMW/openmw!4465
master
psi29a 1 month ago
commit 690de3c3f9

@ -48,7 +48,11 @@ void ESM4::Light::load(ESM4::Reader& reader)
break;
case ESM::fourCC("DATA"):
{
if (subHdr.dataSize != 32 && subHdr.dataSize != 48 && subHdr.dataSize != 64)
// 24: older TES4 records (found in GOG release)
// 32: newer TES4 records, FO3/FNV
// 48: TES5
// 64: FO4/FO76
if (subHdr.dataSize != 24 && subHdr.dataSize != 32 && subHdr.dataSize != 48 && subHdr.dataSize != 64)
{
reader.skipSubRecordData();
break;
@ -57,21 +61,23 @@ void ESM4::Light::load(ESM4::Reader& reader)
reader.get(mData.radius);
reader.get(mData.colour);
reader.get(mData.flags);
reader.get(mData.falloff);
reader.get(mData.FOV);
// TES5, FO4
if (subHdr.dataSize >= 48)
if (subHdr.dataSize >= 32)
{
reader.get(mData.nearClip);
reader.get(mData.frequency);
reader.get(mData.intensityAmplitude);
reader.get(mData.movementAmplitude);
if (subHdr.dataSize == 64)
reader.get(mData.falloff);
reader.get(mData.FOV);
if (subHdr.dataSize >= 48)
{
reader.get(mData.constant);
reader.get(mData.scalar);
reader.get(mData.exponent);
reader.get(mData.godRaysNearClip);
reader.get(mData.nearClip);
reader.get(mData.frequency);
reader.get(mData.intensityAmplitude);
reader.get(mData.movementAmplitude);
if (subHdr.dataSize == 64)
{
reader.get(mData.constant);
reader.get(mData.scalar);
reader.get(mData.exponent);
reader.get(mData.godRaysNearClip);
}
}
}
reader.get(mData.value);

@ -56,9 +56,9 @@ namespace ESM4
struct Data
{
std::int32_t time;
std::uint32_t radius;
std::uint32_t colour; // RGBA
std::int32_t time = 0;
std::uint32_t radius = 0;
std::uint32_t colour = 0; // RGBA
// flags:
// 0x00000001 = Dynamic
// 0x00000002 = Can be Carried
@ -70,19 +70,19 @@ namespace ESM4
// 0x00000100 = Pulse Slow
// 0x00000200 = Spot Light
// 0x00000400 = Spot Shadow
std::int32_t flags;
std::int32_t flags = 0;
float falloff = 1.f;
float FOV = 90; // FIXME: FOV in degrees or radians?
float nearClip; // TES5+
float frequency; // TES5+
float intensityAmplitude; // TES5+
float movementAmplitude; // TES5+
float constant; // FO4
float scalar; // FO4
float exponent; // FO4
float godRaysNearClip; // FO4
std::uint32_t value; // gold
float weight;
float nearClip = 0.f; // TES5+
float frequency = 0.f; // TES5+
float intensityAmplitude = 0.f; // TES5+
float movementAmplitude = 0.f; // TES5+
float constant = 0.f; // FO4
float scalar = 0.f; // FO4
float exponent = 0.f; // FO4
float godRaysNearClip = 0.f; // FO4
std::uint32_t value = 0; // gold
float weight = 0.f;
};
ESM::FormId mId; // from the header

Loading…
Cancel
Save