From d31ccfafa1b959d608c5a6c6d50ede632350ee04 Mon Sep 17 00:00:00 2001 From: Michael Becker Date: Mon, 23 Mar 2020 01:36:14 -0400 Subject: [PATCH] still debugging, give us the ability to offset the pixel value by an arbitrary palette selector value --- .../PictureCollection/CWESpriteDataFormat.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CSharp/Plugins/UniversalEditor.Plugins.ChaosWorks/DataFormats/Multimedia/PictureCollection/CWESpriteDataFormat.cs b/CSharp/Plugins/UniversalEditor.Plugins.ChaosWorks/DataFormats/Multimedia/PictureCollection/CWESpriteDataFormat.cs index e17d2f10..3f1f40c3 100644 --- a/CSharp/Plugins/UniversalEditor.Plugins.ChaosWorks/DataFormats/Multimedia/PictureCollection/CWESpriteDataFormat.cs +++ b/CSharp/Plugins/UniversalEditor.Plugins.ChaosWorks/DataFormats/Multimedia/PictureCollection/CWESpriteDataFormat.cs @@ -134,6 +134,8 @@ namespace UniversalEditor.Plugins.ChaosWorks.DataFormats.Multimedia.PictureColle // now that we've loaded the frame definitions and embedded color palette, // we can go back and read the pixel data List> lists = new List>(); + int paletteSelector = 0; + for (uint i = 0; i < frameCount; i++) { int x = 0, y = 0; @@ -169,11 +171,11 @@ namespace UniversalEditor.Plugins.ChaosWorks.DataFormats.Multimedia.PictureColle size_count = (ushort)(-(short)size_count); byte index = br.ReadByte(); - Color color = palette.Entries[index].Color; + Color color = palette.Entries[paletteSelector + index].Color; for (int k = 0; k < size_count; k++) { - Console.WriteLine("cwe-sprite: setting pixel ({0}, {1}) to color {2}", x, y, color); + // Console.WriteLine("cwe-sprite: setting pixel ({0}, {1}) to color {2}", x, y, color); pic.SetPixel(color, y, x); y++; } @@ -183,9 +185,9 @@ namespace UniversalEditor.Plugins.ChaosWorks.DataFormats.Multimedia.PictureColle for (int k = 0; k < size_count; k++) { byte index = br.ReadByte(); - Color color = palette.Entries[index].Color; + Color color = palette.Entries[paletteSelector + index].Color; - Console.WriteLine("cwe-sprite: setting pixel ({0}, {1}) to color {2}", x, y, color); + // Console.WriteLine("cwe-sprite: setting pixel ({0}, {1}) to color {2}", x, y, color); pic.SetPixel(color, y, x); y++; }