Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CentrED/UI/Windows/LandBrushManagerWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ public void DrawPreview(string name, Vector2 size)
private void DrawTile(int id, Vector2 size)
{
var spriteInfo = CEDGame.MapManager.Texmaps.GetTexmap(CEDGame.MapManager.UoFileManager.TileData.LandData[id].TexID);
if (spriteInfo.Texture == null)
{
//Fallback to flat land art when texmaps are absent in this shard's art set
var isArtValid = CEDGame.MapManager.UoFileManager.Arts.File.GetValidRefEntry(id).Length > 0;
spriteInfo = CEDGame.MapManager.Arts.GetLand(isArtValid ? (uint)id : 0);
}
if (spriteInfo.Texture != null)
{
CEDGame.UIManager.DrawImage(spriteInfo.Texture, spriteInfo.UV, size, true);
Expand Down Expand Up @@ -327,10 +333,16 @@ private unsafe void ToggleDirButton(LandBrushTransition transition, Direction di
var spriteInfo = CEDGame.MapManager.Texmaps.GetTexmap(CEDGame.MapManager.UoFileManager.TileData.LandData[tileId].TexID);
if (spriteInfo.Texture == null)
{
//Fallback to VOID
spriteInfo = CEDGame.MapManager.Texmaps.GetTexmap(0x0001);
//Fallback to flat land art when texmaps are absent in this shard's art set
var isArtValid = CEDGame.MapManager.UoFileManager.Arts.File.GetValidRefEntry(tileId).Length > 0;
spriteInfo = CEDGame.MapManager.Arts.GetLand(isArtValid ? (uint)tileId : 0);
}
var tex = spriteInfo.Texture;
if (tex == null)
{
//No art available either - avoid NRE crash
return (default, Vector2.Zero, Vector2.Zero);
}
var bounds = spriteInfo.UV;
var texPtr = CEDGame.UIManager._uiRenderer.BindTexture(tex);
var fWidth = (float)tex.Width;
Expand Down