WAD3 model cleanup

This commit is contained in:
Matt Nadareski
2025-10-30 23:50:44 -04:00
parent 2fa00d1a16
commit aaff7e7332
13 changed files with 21 additions and 28 deletions

View File

@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.WAD3
public const uint SignatureUInt32 = 0x33444157;
}
}
}

View File

@@ -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;
}
}

View File

@@ -25,4 +25,4 @@ namespace SabreTools.Data.Models.WAD3
/// </summary>
Font = 0x46,
}
}
}

View File

@@ -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; }
}
}

View File

@@ -8,4 +8,4 @@ namespace SabreTools.Data.Models.WAD3
{
// No shared fields between types
}
}
}

View File

@@ -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; }
}
}

View File

@@ -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

View File

@@ -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; }
}
}

View File

@@ -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)

View File

@@ -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; }
}
}

View File

@@ -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

View File

@@ -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();

View File

@@ -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