mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-19 23:35:11 +00:00
WAD3 model cleanup
This commit is contained in:
@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.WAD3
|
||||
|
||||
public const uint SignatureUInt32 = 0x33444157;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +43,6 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// </summary>
|
||||
/// <remarks>16 bytes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
|
||||
public string? Name;
|
||||
public string Name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// </summary>
|
||||
Font = 0x46,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,16 +9,16 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// <summary>
|
||||
/// Deserialized header data
|
||||
/// </summary>
|
||||
public Header? Header { get; set; }
|
||||
public Header Header { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Deserialized dir entry data
|
||||
/// </summary>
|
||||
public DirEntry[]? DirEntries { get; set; }
|
||||
public DirEntry[] DirEntries { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Deserialized file entry data
|
||||
/// </summary>
|
||||
public FileEntry[]? FileEntries { get; set; }
|
||||
public FileEntry[] FileEntries { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.WAD3
|
||||
{
|
||||
// No shared fields between types
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,6 +35,6 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// The color palette for the mipmaps (always 256 * 3 = 768 for GoldSrc)
|
||||
/// </summary>
|
||||
/// <remarks>[ColorsUsed][3]</remarks>
|
||||
public byte[][]? Palette { get; set; }
|
||||
public byte[][] Palette { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// </summary>
|
||||
/// <remarks>4 bytes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 4)]
|
||||
public string? Signature;
|
||||
public string Signature;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Directory entries
|
||||
|
||||
@@ -7,6 +7,6 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// Raw image data. Each byte points to an index in the palette
|
||||
/// </summary>
|
||||
/// <remarks>[width][height]</remarks>
|
||||
public byte[][]? Data { get; set; }
|
||||
public byte[][] Data { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// </summary>
|
||||
/// <remarks>16 bytes</remarks>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
|
||||
public string? Name;
|
||||
public string Name;
|
||||
|
||||
/// <summary>
|
||||
/// Dimensions of the texture (must be divisible by 16)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// Raw image data. Each byte points to an index in the palette
|
||||
/// </summary>
|
||||
/// <remarks>[height][width]</remarks>
|
||||
public byte[][]? Data { get; set; }
|
||||
public byte[][] Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of colors used in the palette (always 256 for GoldSrc)
|
||||
@@ -28,6 +28,6 @@ namespace SabreTools.Data.Models.WAD3
|
||||
/// The color palette for the mipmaps (always 256 * 3 = 768 for GoldSrc)
|
||||
/// </summary>
|
||||
/// <remarks>[ColorsUsed][3]</remarks>
|
||||
public byte[][]? Palette { get; set; }
|
||||
public byte[][] Palette { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public bool Extract(string outputDirectory, bool includeDebug)
|
||||
{
|
||||
// If we have no lumps
|
||||
if (DirEntries == null || DirEntries.Length == 0)
|
||||
if (DirEntries.Length == 0)
|
||||
return false;
|
||||
|
||||
// Loop through and extract all lumps to the output
|
||||
@@ -32,7 +32,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
public bool ExtractLump(int index, string outputDirectory, bool includeDebug)
|
||||
{
|
||||
// If we have no lumps
|
||||
if (DirEntries == null || DirEntries.Length == 0)
|
||||
if (DirEntries.Length == 0)
|
||||
return false;
|
||||
|
||||
// If the lumps index is invalid
|
||||
|
||||
@@ -23,28 +23,21 @@ namespace SabreTools.Serialization.Wrappers
|
||||
Print(builder, Model.FileEntries);
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, Header? header)
|
||||
private static void Print(StringBuilder builder, Header header)
|
||||
{
|
||||
builder.AppendLine(" Header Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (header == null)
|
||||
{
|
||||
builder.AppendLine(" No header");
|
||||
builder.AppendLine();
|
||||
return;
|
||||
}
|
||||
|
||||
builder.AppendLine(header.Signature, " Signature");
|
||||
builder.AppendLine(header.NumDirs, " Number of directory entries");
|
||||
builder.AppendLine(header.DirOffset, " Offset to first directory entry");
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, DirEntry[]? entries)
|
||||
private static void Print(StringBuilder builder, DirEntry[] entries)
|
||||
{
|
||||
builder.AppendLine(" Directory Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No directory entries");
|
||||
builder.AppendLine();
|
||||
@@ -68,11 +61,11 @@ namespace SabreTools.Serialization.Wrappers
|
||||
builder.AppendLine();
|
||||
}
|
||||
|
||||
private static void Print(StringBuilder builder, FileEntry[]? entries)
|
||||
private static void Print(StringBuilder builder, FileEntry[] entries)
|
||||
{
|
||||
builder.AppendLine(" File Entries Information:");
|
||||
builder.AppendLine(" -------------------------");
|
||||
if (entries == null || entries.Length == 0)
|
||||
if (entries.Length == 0)
|
||||
{
|
||||
builder.AppendLine(" No file entries");
|
||||
builder.AppendLine();
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace SabreTools.Serialization.Wrappers
|
||||
#region Extension Properties
|
||||
|
||||
/// <inheritdoc cref="Models.WAD3.File.DirEntries"/>
|
||||
public Data.Models.WAD3.DirEntry[]? DirEntries => Model.DirEntries;
|
||||
public Data.Models.WAD3.DirEntry[] DirEntries => Model.DirEntries;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user