Skip to content

Commit

Permalink
Use 16-colour palettes in UI to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
maxim-zhao committed Dec 20, 2021
1 parent aabe834 commit f7de574
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions editor/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -637,14 +637,14 @@ private void listBoxArt_SelectedIndexChanged(object sender, EventArgs e)
if (artItem.TileMap != null)
{
pictureBoxArtLayout.Image?.Dispose();
pictureBoxArtLayout.Image = artItem.TileMap.GetImage(artItem.TileSet, artItem.Palette);
pictureBoxArtLayout.Image = artItem.TileMap.GetImage(artItem.TileSet, artItem.Palette.GetSubPalette(0, 16));
tabControlArt.TabPages.Add(tabPageArtLayout);
}

if (artItem.TileSet != null)
{
otherArtTileSetViewer.TilesPerRow = artItem.TileSet.TilesPerRow;
otherArtTileSetViewer.SetData(artItem.TileSet, artItem.Palette);
otherArtTileSetViewer.SetData(artItem.TileSet, artItem.Palette.GetSubPalette(0, 16));
tabControlArt.TabPages.Add(tabPageArtTiles);
}

Expand Down
10 changes: 5 additions & 5 deletions editor/GameObjects/TileSet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public TileSet(Memory memory, int offset, int length, int bitPlanes = 4, List<Po
// Read the data and convert to tiles
Tiles = new EnumerableMemoryStream(memory.GetStream(offset, length))
.PlanarToChunky(bitPlanes)
.ToChunks(64 * grouping.Count)
.ToChunks(64 * _grouping.Count)
.Select((x, index) => new Tile(x, grouping, index))
.ToList();
}
Expand All @@ -109,7 +109,7 @@ public TileSet(Memory memory, int offset, List<Point> grouping, int tilesPerRow
// Default grouping
_grouping = grouping ?? Groupings.Single;

var decompressed = Compression.DecompressArt(memory, offset, out var foo);
var decompressed = Compression.DecompressArt(memory, offset, out _);
Tiles = decompressed
.ToChunks(64 * _grouping.Count)
.Select((x, index) => new Tile(x, _grouping, index))
Expand Down Expand Up @@ -143,7 +143,7 @@ public TileSet(Bitmap image, TileSet baseTileSet)
Marshal.Copy(data.Scan0 + (y + row) * data.Stride + x, buffer, row*8, 8);
}
// Check if we already have it
if (!tiles.Any(x => x.SequenceEqual(buffer)))
if (!tiles.Any(tile => tile.SequenceEqual(buffer)))
{
// No, so add it
tiles.Add(buffer);
Expand All @@ -169,7 +169,7 @@ public TileSet(Bitmap image, TileSet baseTileSet)
// We copy these from the base to ensure we match formats on serialization.
Compressed = baseTileSet.Compressed;
_bitPlanes = baseTileSet._bitPlanes;
Tiles = tiles.Select((x, index) => new Tile(x, TileSet.Groupings.Single, index)).ToList();
Tiles = tiles.Select((x, index) => new Tile(x, Groupings.Single, index)).ToList();
}

public int Offset { get; set; }
Expand Down Expand Up @@ -352,7 +352,7 @@ public void AddTile()

public void RemoveTile()
{
var tile = Tiles[Tiles.Count - 1];
var tile = Tiles[^1];
Tiles.RemoveAt(Tiles.Count - 1);
tile.Dispose();
}
Expand Down
6 changes: 5 additions & 1 deletion editor/sth1edwv.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/UserDictionary/Words/=bitplane/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=edwv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=paletted/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=SDSC/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tileset/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Tileset/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=VRAM/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=_0020removal/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

0 comments on commit f7de574

Please sign in to comment.