Skip to content

Commit

Permalink
Started working on adding guilds. Requires client modding.
Browse files Browse the repository at this point in the history
  • Loading branch information
Wincent01 committed Feb 1, 2020
1 parent a1a3e6b commit 727a764
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
7 changes: 7 additions & 0 deletions InfectedRose.Terrain/HeightMap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ public class HeightMap : IConstruct
public int Height { get; set; }

public float UnknownFloat0 { get; set; }

public float UnknownFloat1 { get; set; }

public float UnknownFloat2 { get; set; }

public int[] UnknownIntArray { get; set; }
Expand Down Expand Up @@ -62,5 +64,10 @@ public void Deserialize(BitReader reader)
Data[i] = reader.Read<float>();
}
}

public float GetValue(int x, int y)
{
return Data[y * Width + x];
}
}
}
7 changes: 0 additions & 7 deletions InfectedRose.Terrain/TerrainEditor.cs

This file was deleted.

31 changes: 31 additions & 0 deletions InfectedRose.Terrain/TerrainFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,36 @@ public void Deserialize(BitReader reader)
Chunks.Add(chunk);
}
}

public float[,] GenerateHeightMap()
{
var heights = new float[
ChunkCountX * Chunks[0].HeightMap.Width,
ChunkCountY * Chunks[0].HeightMap.Height
];

for (var chunkY = 0; chunkY < ChunkCountY; ++chunkY)
{
for (var chunkX = 0; chunkX < ChunkCountX; ++chunkX)
{
var chunk = Chunks[chunkY * ChunkCountX + chunkX];

for (var y = 0; y < chunk.HeightMap.Height; ++y)
{
for (var x = 0; x < chunk.HeightMap.Width; ++x)
{
var value = chunk.HeightMap.GetValue(x, y);

var pixelX = chunkX * Chunks[0].HeightMap.Width + x;
var pixelY = chunkY * Chunks[0].HeightMap.Height + y;

heights[pixelX, pixelY] = value;
}
}
}
}

return heights;
}
}
}

0 comments on commit 727a764

Please sign in to comment.