Merge pull request #595 from GriffinRichards/gbagfx-pals
Automatically constrain png pixels to bit depth
|
Before Width: | Height: | Size: 370 B After Width: | Height: | Size: 255 B |
|
Before Width: | Height: | Size: 380 B After Width: | Height: | Size: 265 B |
|
Before Width: | Height: | Size: 368 B After Width: | Height: | Size: 315 B |
|
Before Width: | Height: | Size: 365 B After Width: | Height: | Size: 250 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 258 B |
|
Before Width: | Height: | Size: 394 B After Width: | Height: | Size: 279 B |
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 278 B |
|
Before Width: | Height: | Size: 392 B After Width: | Height: | Size: 277 B |
|
Before Width: | Height: | Size: 387 B After Width: | Height: | Size: 272 B |
|
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 362 B After Width: | Height: | Size: 247 B |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 373 B After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 256 B |
|
Before Width: | Height: | Size: 339 B After Width: | Height: | Size: 224 B |
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 319 B |
|
Before Width: | Height: | Size: 470 B After Width: | Height: | Size: 357 B |
|
Before Width: | Height: | Size: 375 B After Width: | Height: | Size: 318 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 316 B |
|
Before Width: | Height: | Size: 376 B After Width: | Height: | Size: 262 B |
|
Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 254 B |
@@ -94,7 +94,7 @@
|
||||
|
||||
// gTileset_VermilionCity
|
||||
#define METATILE_VermilionCity_Door 0x29E
|
||||
#define METATILE_VermilionCity_PokemonFanClubDoor 0x2E1 // Used to reference door tiles in field_door.c, but the metatile in the tileset is dummied
|
||||
#define METATILE_VermilionCity_SSAnneWarp 0x2E1
|
||||
|
||||
// gTileset_VermilionGym
|
||||
#define METATILE_VermilionGym_Floor 0x281
|
||||
|
||||
@@ -922,9 +922,11 @@ const u16 gTilesetPalettes_SeaCottage[][16] =
|
||||
INCBIN_U16("data/tilesets/secondary/sea_cottage/palettes/15.gbapal"),
|
||||
};
|
||||
|
||||
const u32 gTilesetTiles_SilphCo[] = INCBIN_U32("data/tilesets/secondary/condominiums/tiles.4bpp.lz");
|
||||
// Shared by SilphCo
|
||||
const u32 gTilesetTiles_Condominiums[] = INCBIN_U32("data/tilesets/secondary/condominiums/tiles.4bpp.lz");
|
||||
|
||||
const u16 gTilesetPalettes_SilphCo[][16] =
|
||||
// Shared by SilphCo
|
||||
const u16 gTilesetPalettes_Condominiums[][16] =
|
||||
{
|
||||
INCBIN_U16("data/tilesets/secondary/condominiums/palettes/00.gbapal"),
|
||||
INCBIN_U16("data/tilesets/secondary/condominiums/palettes/01.gbapal"),
|
||||
|
||||
@@ -497,8 +497,8 @@ const struct Tileset gTileset_SilphCo =
|
||||
{
|
||||
.isCompressed = TRUE,
|
||||
.isSecondary = TRUE,
|
||||
.tiles = gTilesetTiles_SilphCo,
|
||||
.palettes = gTilesetPalettes_SilphCo,
|
||||
.tiles = gTilesetTiles_Condominiums,
|
||||
.palettes = gTilesetPalettes_Condominiums,
|
||||
.metatiles = gMetatiles_SilphCo,
|
||||
.metatileAttributes = gMetatileAttributes_SilphCo,
|
||||
.callback = InitTilesetAnim_SilphCo,
|
||||
@@ -585,8 +585,8 @@ const struct Tileset gTileset_Condominiums =
|
||||
{
|
||||
.isCompressed = TRUE,
|
||||
.isSecondary = TRUE,
|
||||
.tiles = gTilesetTiles_SilphCo,
|
||||
.palettes = gTilesetPalettes_SilphCo,
|
||||
.tiles = gTilesetTiles_Condominiums,
|
||||
.palettes = gTilesetPalettes_Condominiums,
|
||||
.metatiles = gMetatiles_Condominiums,
|
||||
.metatileAttributes = gMetatileAttributes_Condominiums,
|
||||
.callback = NULL,
|
||||
|
||||
@@ -251,7 +251,11 @@ static const struct DoorGraphics sDoorGraphics[] = {
|
||||
{METATILE_CeruleanCity_Door, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_Cerulean, sDoorAnimPalettes_Cerulean},
|
||||
{METATILE_LavenderTown_Door, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_Lavender, sDoorAnimPalettes_Lavender},
|
||||
{METATILE_VermilionCity_Door, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_Vermilion, sDoorAnimPalettes_Vermilion},
|
||||
{METATILE_VermilionCity_PokemonFanClubDoor, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_PokemonFanClub, sDoorAnimPalettes_PokemonFanClub},
|
||||
/* Below was presumably intended for the door to the Pokemon Fan Club. The metatile is surrounded by metatiles for the fan club building.
|
||||
Its animation tiles are similar to the Vermilion door above, and the building on the map uses that metatile instead. The unused tiles
|
||||
have the pokeball above the door in view, but on the map the pokeball above the door is too high to be in view.
|
||||
The metatile below was subsequently re-used for the warp to enter the SS Anne from the harbor, which has no door. */
|
||||
{METATILE_VermilionCity_SSAnneWarp, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_PokemonFanClub, sDoorAnimPalettes_PokemonFanClub},
|
||||
{METATILE_CeladonCity_DeptStoreDoor, DOOR_SOUND_SLIDING, 0, sDoorAnimTiles_DeptStore, sDoorAnimPalettes_DeptStore},
|
||||
{METATILE_FuchsiaCity_Door, DOOR_SOUND_NORMAL, 0, sDoorAnimTiles_Fuchsia, sDoorAnimPalettes_Fuchsia},
|
||||
{METATILE_FuchsiaCity_SafariZoneDoor, DOOR_SOUND_SLIDING, 0, sDoorAnimTiles_SafariZone, sDoorAnimPalettes_SafariZone},
|
||||
|
||||
@@ -62,10 +62,7 @@ static unsigned char *ConvertBitDepth(unsigned char *src, int srcBitDepth, int d
|
||||
|
||||
for (j = 8 - srcBitDepth; j >= 0; j -= srcBitDepth)
|
||||
{
|
||||
unsigned char pixel = (srcByte >> j) % (1 << srcBitDepth);
|
||||
|
||||
if (pixel >= (1 << destBitDepth))
|
||||
FATAL_ERROR("Image exceeds the maximum color value for a %ibpp image.\n", destBitDepth);
|
||||
unsigned char pixel = (srcByte >> j) % (1 << destBitDepth);
|
||||
*dest |= pixel << destBit;
|
||||
destBit -= destBitDepth;
|
||||
if (destBit < 0)
|
||||
|
||||