Parse AnimLight property

This commit is contained in:
Jarrod Doyle 2024-09-29 09:52:12 +01:00
parent 8b7ffcd7a3
commit 46fe99bbfc
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
3 changed files with 106 additions and 0 deletions

View File

@ -330,6 +330,110 @@ public class PropLight : Property
} }
} }
public class PropAnimLight : Property
{
public enum AnimMode
{
FlipMinMax,
SlideSmoothly,
Random,
MinBrightness,
MaxBrightness,
ZeroBrightness,
SmoothlyBrighten,
SmoothlyDim,
RandomButCoherent,
FlickerMinMax,
}
// Standard light props
public float Brightness;
public Vector3 Offset;
public float Radius;
public float InnerRadius;
public bool QuadLit;
public bool Dynamic;
// Animation
public AnimMode Mode;
public int MsToBrighten;
public int MsToDim;
public float MinBrightness;
public float MaxBrightness;
// Start state
public float CurrentBrightness;
public bool Rising;
public int Timer;
public bool Inactive;
// World rep info
public bool Refresh; // Not relevant to us. It's used to tell dromed it needs to relight
public ushort LightTableMapIndex;
public ushort LightTableLightIndex;
public ushort CellsReached;
private int _unknown;
public override void Read(BinaryReader reader)
{
base.Read(reader);
Brightness = reader.ReadSingle();
Offset = reader.ReadVec3();
Refresh = reader.ReadBoolean();
reader.ReadBytes(3);
LightTableMapIndex = reader.ReadUInt16();
CellsReached = reader.ReadUInt16();
LightTableLightIndex = reader.ReadUInt16();
Mode = (AnimMode)reader.ReadUInt16();
MsToBrighten = reader.ReadInt32();
MsToDim = reader.ReadInt32();
MinBrightness = reader.ReadSingle();
MaxBrightness = reader.ReadSingle();
CurrentBrightness = reader.ReadSingle();
Rising = reader.ReadBoolean();
reader.ReadBytes(3);
Timer = reader.ReadInt32();
Inactive = reader.ReadBoolean();
reader.ReadBytes(3);
Radius = reader.ReadSingle();
_unknown = reader.ReadInt32();
QuadLit = reader.ReadBoolean();
reader.ReadBytes(3);
InnerRadius = reader.ReadSingle();
Dynamic = reader.ReadBoolean();
reader.ReadBytes(3);
}
public override void Write(BinaryWriter writer)
{
base.Write(writer);
writer.Write(Brightness);
writer.WriteVec3(Offset);
writer.Write(Refresh);
writer.Write(new byte[3]);
writer.Write(LightTableMapIndex);
writer.Write(CellsReached);
writer.Write(LightTableLightIndex);
writer.Write((ushort)Mode);
writer.Write(MsToBrighten);
writer.Write(MsToDim);
writer.Write(CurrentBrightness);
writer.Write(Rising);
writer.Write(new byte[3]);
writer.Write(Timer);
writer.Write(Inactive);
writer.Write(new byte[3]);
writer.Write(Radius);
writer.Write(_unknown);
writer.Write(QuadLit);
writer.Write(new byte[3]);
writer.Write(InnerRadius);
writer.Write(Dynamic);
writer.Write(new byte[3]);
}
}
public class PropLightColor : Property public class PropLightColor : Property
{ {
public float Hue; public float Hue;

View File

@ -152,6 +152,7 @@ public class DbFile
"P$OTxtRepr2" => new PropertyChunk<PropString>(), "P$OTxtRepr2" => new PropertyChunk<PropString>(),
"P$OTxtRepr3" => new PropertyChunk<PropString>(), "P$OTxtRepr3" => new PropertyChunk<PropString>(),
"P$Light" => new PropertyChunk<PropLight>(), "P$Light" => new PropertyChunk<PropLight>(),
"P$AnimLight" => new PropertyChunk<PropAnimLight>(),
"P$LightColo" => new PropertyChunk<PropLightColor>(), "P$LightColo" => new PropertyChunk<PropLightColor>(),
"P$Spotlight" => new PropertyChunk<PropSpotlight>(), "P$Spotlight" => new PropertyChunk<PropSpotlight>(),
"P$RenderAlp" => new PropertyChunk<PropFloat>(), "P$RenderAlp" => new PropertyChunk<PropFloat>(),

View File

@ -101,6 +101,7 @@ public class ObjectHierarchy
AddProp<PropString>("P$OTxtRepr3"); AddProp<PropString>("P$OTxtRepr3");
AddProp<PropFloat>("P$RenderAlp"); AddProp<PropFloat>("P$RenderAlp");
AddProp<PropLight>("P$Light"); AddProp<PropLight>("P$Light");
AddProp<PropAnimLight>("P$AnimLight");
AddProp<PropLightColor>("P$LightColo"); AddProp<PropLightColor>("P$LightColo");
AddProp<PropSpotlight>("P$Spotlight"); AddProp<PropSpotlight>("P$Spotlight");
} }