Skip to content

Commit

Permalink
Terrain chunk checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyuu17 committed Jul 4, 2024
1 parent ae8745d commit 5a5f42a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/SWBF2/Native/Chunks/TerrainChunk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ namespace SWBF2::Native
return; // No terrain

auto infoReaderChild = streamReader.ReadChildWithHeader<"INFO"_m>();
if (infoReaderChild)
{
*infoReaderChild >> tern.m_gridUnitSize;
*infoReaderChild >> tern.m_heightScale;
Expand All @@ -40,6 +41,7 @@ namespace SWBF2::Native
}

auto ltexChild = streamReader.ReadChildWithHeader<"LTEX"_m>();
if (ltexChild)
{
for (int i = 0; i < tern.m_textureCount; i++)
{
Expand All @@ -51,17 +53,20 @@ namespace SWBF2::Native
}

auto dtexReaderChild = streamReader.ReadChildWithHeader<"DTEX"_m>();
if (dtexReaderChild)
{
// unused?
dtexReaderChild->SkipBytes((uint32_t)dtexReaderChild->RemainingBytes());
}

auto dtlxReaderChild = streamReader.ReadChildWithHeader<"DTLX"_m>();
if (dtlxReaderChild)
{
*dtlxReaderChild >> tern.m_detailTexture;
}

auto scalChild = streamReader.ReadChildWithHeader<"SCAL"_m>();
if (scalChild)
{
for (int i = 0; i < tern.m_textureCount; i++)
{
Expand All @@ -73,6 +78,7 @@ namespace SWBF2::Native
}

auto axisChild = streamReader.ReadChildWithHeader<"AXIS"_m>();
if (axisChild)
{
for (int i = 0; i < tern.m_textureCount; i++)
{
Expand All @@ -84,6 +90,7 @@ namespace SWBF2::Native
}

auto rotnChild = streamReader.ReadChildWithHeader<"ROTN"_m>();
if (rotnChild)
{
for (int i = 0; i < tern.m_textureCount; i++)
{
Expand Down

0 comments on commit 5a5f42a

Please sign in to comment.