Skip to content

Commit

Permalink
Add missing CGameCtnDecoration header chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
BigBang1112 committed Jan 21, 2025
1 parent d291e70 commit 2ea50a7
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Src/GBX.NET/Engines/Game/CGameCtnDecoration.chunkl
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
CGameCtnDecoration 0x03038000
- inherits: CGameCtnCollector

0x001 // LightMap
0x000 (header, struct: SMoodRemaping)

0x001 (header, struct: SLightMap) // LightMap
versionb version
int
int // CHmsLightMap Tech

0x011 // DecoSize
CGameCtnDecorationSize DecoSize (external)
Expand Down
38 changes: 38 additions & 0 deletions Src/GBX.NET/Engines/Game/CGameCtnDecoration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,44 @@

public partial class CGameCtnDecoration
{
/// <summary>
/// Refers from <see cref="CGameCtnDecorationMood"/>.
/// </summary>
public string RemapFolder { get; set; } = "";

/// <summary>
/// Refers from <see cref="CGameCtnDecorationMood"/>.
/// </summary>
public CPlugGameSkin? Remapping { get; set; }

public partial class HeaderChunk03038000
{
public byte U01;

public override void ReadWrite(CGameCtnDecoration n, GbxReaderWriter rw)
{
rw.Byte(ref U01);
n.RemapFolder = rw.String(n.RemapFolder);

if (rw.Reader is not null)
{
n.Remapping = new CPlugGameSkin();
var headerChunk = new CPlugGameSkin.HeaderChunk090F4000 { Node = n.Remapping };
n.Remapping.Chunks.Add(headerChunk);
headerChunk.ReadWrite(n.Remapping, rw);
}

if (rw.Writer is not null)
{
var remapping = n.Remapping ?? new();
(remapping.Chunks
.OfType<CPlugGameSkin.HeaderChunk090F4000>()
.FirstOrDefault() ?? new CPlugGameSkin.HeaderChunk090F4000())
.ReadWrite(remapping, rw);
}
}
}

public override IHeaderChunk? CreateHeaderChunk(uint chunkId)
{
if (chunkId == 0x090F4000)
Expand Down

0 comments on commit 2ea50a7

Please sign in to comment.