Skip to content

Commit

Permalink
Allow multiple palettes to be edited, allowing the All Palettes item …
Browse files Browse the repository at this point in the history
…to work
  • Loading branch information
maxim-zhao committed Oct 6, 2024
1 parent 18cdad1 commit 822fa2d
Show file tree
Hide file tree
Showing 6 changed files with 949 additions and 886 deletions.
2 changes: 1 addition & 1 deletion editor/ArtItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace sth1edwv
public class ArtItem
{
public TileSet TileSet { get; set; }
public Palette Palette { get; set; }
public Dictionary<string, Palette> Palettes { get; } = [];
public bool PaletteEditable { get; set; }
public string Name { get; init; }
public TileMap TileMap { get; set; }
Expand Down
6 changes: 4 additions & 2 deletions editor/Cartridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,9 @@ private void ReadAssets()
: GetTileSet(offset, asset.TileGrouping, asset.TilesPerRow);
break;
case Game.Asset.Types.Palette:
_assetsLookup[asset] = item.Palette = GetPalette(offset, asset.FixedSize / 16);
var palette = GetPalette(offset, asset.FixedSize / 16);
_assetsLookup[asset] = palette;
item.Palettes.Add(part.Name, palette);
item.PaletteEditable = !asset.Hidden; // Hidden only applies to palettes for now...
// TODO we don't handle multiple palettes here yet
break;
Expand All @@ -2763,7 +2765,7 @@ private void ReadAssets()
break;
case Game.Asset.Types.TileMap:
{
// We assume these are set second so we have to check if it's a set or overlay
// We assume these are set second, so we have to check if it's a set or overlay
var tileMap = new TileMap(Memory, offset, asset.GetLength(Memory));
if (item.TileMap is { HasForeground: true })
{
Expand Down
Loading

0 comments on commit 822fa2d

Please sign in to comment.