Fix cgear png import

Closes #3231

Symptoms observed:
- Tiles were too dark (not high enough RBG value due to >>3; keep 8bit color here.
- Red/Blue channel inverted, swap R & B. Works? Hope this isn't something related to png storing rgb vs bgr and we'd need to check input pixel format?
- Tiles were misplaced slightly, off by 1. Fix order of operations so that the tile choice value is correct.
This commit is contained in:
Kurt 2021-07-10 19:32:10 -07:00
parent 6ee552b860
commit f5090e3ae7

View file

@ -182,10 +182,10 @@ namespace PKHeX.Core
private static int GetRGB555_32(int val) private static int GetRGB555_32(int val)
{ {
var R = (val >> 0 >> 3) & 0x1F; var R = (val >> 00) & 0xFF;
var G = (val >> 8 >> 3) & 0x1F; var G = (val >> 08) & 0xFF;
var B = (val >> 16 >> 3) & 0x1F; var B = (val >> 16) & 0xFF;
return 0xFF << 24 | R << 16 | G << 8 | B; return 0xFF << 24 | B << 16 | G << 8 | R;
} }
private static int GetRGB555_16(ushort val) private static int GetRGB555_16(ushort val)
@ -305,9 +305,9 @@ namespace PKHeX.Core
} }
// No tile found, add to list // No tile found, add to list
tilelist.Add(t);
tm.TileChoices[tileIndex] = tilelist.Count - 1; tm.TileChoices[tileIndex] = tilelist.Count - 1;
tm.Rotations[tileIndex] = 0; tm.Rotations[tileIndex] = 0;
tilelist.Add(t);
} }
private CGearBackground(int[] Palette, Tile[] tilelist, TileMap tm) private CGearBackground(int[] Palette, Tile[] tilelist, TileMap tm)