Implemented light colors/palettes for primary tilesets.
This commit is contained in:
parent
bd3c9ed3b9
commit
e7cbec7eda
1 changed files with 17 additions and 9 deletions
|
@ -894,6 +894,8 @@ static void FieldmapUnkDummy(void)
|
|||
void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
|
||||
{
|
||||
u16 black = RGB_BLACK;
|
||||
u32 low = 0;
|
||||
u32 high = 0;
|
||||
|
||||
if (tileset)
|
||||
{
|
||||
|
@ -902,25 +904,31 @@ void LoadTilesetPalette(struct Tileset const *tileset, u16 destOffset, u16 size)
|
|||
LoadPalette(&black, destOffset, 2);
|
||||
LoadPalette(((u16*)tileset->palettes) + 1, destOffset + 1, size - 2);
|
||||
FieldmapPaletteDummy(destOffset + 1, (size - 2) >> 1);
|
||||
low = 0;
|
||||
high = NUM_PALS_IN_PRIMARY;
|
||||
}
|
||||
else if (tileset->isSecondary == TRUE)
|
||||
{
|
||||
u8 i;
|
||||
LoadPalette(((u16*)tileset->palettes) + (NUM_PALS_IN_PRIMARY * 16), destOffset, size);
|
||||
for (i = NUM_PALS_IN_PRIMARY; i < NUM_PALS_TOTAL; i++) {
|
||||
if (tileset->lightPalettes & (1 << (i - NUM_PALS_IN_PRIMARY))) { // Mark as light palette
|
||||
u16 index = i * 16;
|
||||
gPlttBufferFaded[index] = gPlttBufferUnfaded[index] |= 0x8000;
|
||||
if (tileset->customLightColor & (1 << (i - NUM_PALS_IN_PRIMARY))) // Mark as custom light color
|
||||
gPlttBufferFaded[index+15] = gPlttBufferUnfaded[index+15] |= 0x8000;
|
||||
}
|
||||
}
|
||||
low = NUM_PALS_IN_PRIMARY;
|
||||
high = NUM_PALS_TOTAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadCompressedPalette((u32*)tileset->palettes, destOffset, size);
|
||||
FieldmapPaletteDummy(destOffset, size >> 1);
|
||||
}
|
||||
if (tileset->isSecondary == FALSE || tileset->isSecondary == TRUE) {
|
||||
u32 i;
|
||||
for (i = low; i < high; i++) {
|
||||
if (tileset->lightPalettes & (1 << (i - low))) { // Mark as light palette
|
||||
u32 index = i * 16;
|
||||
gPlttBufferFaded[index] = gPlttBufferUnfaded[index] |= 0x8000;
|
||||
if (tileset->customLightColor & (1 << (i - low))) // Mark as custom light color
|
||||
gPlttBufferFaded[index+15] = gPlttBufferUnfaded[index+15] |= 0x8000;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue