Reformat gfx/trade/game_boy.png and fix tools/gfx --preserve

This commit is contained in:
Rangi 2020-06-28 19:56:06 -04:00
parent a0e8e5ac5b
commit 022f9e6af1
5 changed files with 7 additions and 5 deletions

View File

@ -186,6 +186,8 @@ gfx/title/old_fg.2bpp: tools/gfx += --interleave --png=$<
gfx/title/logo.2bpp: rgbgfx += -x 4
gfx/trade/ball.2bpp: tools/gfx += --remove-whitespace
gfx/trade/game_boy.2bpp: tools/gfx += --remove-duplicates --preserve=0x23,0x27
gfx/trade/game_boy_cable.2bpp: gfx/trade/game_boy.2bpp gfx/trade/link_cable.2bpp ; cat $^ > $@
gfx/slots/slots_1.2bpp: tools/gfx += --trim-whitespace
gfx/slots/slots_2.2bpp: tools/gfx += --interleave --png=$<

View File

@ -1460,6 +1460,6 @@ TradeArrowRightGFX: INCBIN "gfx/trade/arrow_right.2bpp"
TradeArrowLeftGFX: INCBIN "gfx/trade/arrow_left.2bpp"
TradeCableGFX: INCBIN "gfx/trade/cable.2bpp"
TradeBubbleGFX: INCBIN "gfx/trade/bubble.2bpp"
TradeGameBoyLZ: INCBIN "gfx/trade/game_boy.2bpp.lz"
TradeGameBoyLZ: INCBIN "gfx/trade/game_boy_cable.2bpp.lz"
TradeBallGFX: INCBIN "gfx/trade/ball.2bpp"
TradePoofGFX: INCBIN "gfx/trade/poof.2bpp"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 B

After

Width:  |  Height:  |  Size: 214 B

BIN
gfx/trade/link_cable.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 216 B

View File

@ -68,7 +68,7 @@ void get_args(int argc, char *argv[]) {
while (token) {
Options.num_preserved++;
Options.preserved = realloc(Options.preserved, Options.num_preserved * sizeof(int));
Options.preserved[Options.num_preserved-1] = strtoul(optarg, NULL, 0);
Options.preserved[Options.num_preserved-1] = strtoul(token, NULL, 0);
token = strtok(NULL, ",");
}
break;
@ -139,7 +139,7 @@ void remove_whitespace(struct Graphic *graphic) {
int i = 0;
for (int j = 0, d = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
while (j < graphic->size && is_whitespace(&graphic->data[j], tile_size) && !is_preserved(j / tile_size - d)) {
shift_preserved(j / tile_size);
shift_preserved(j / tile_size - d);
d++;
j += tile_size;
}
@ -181,7 +181,7 @@ void remove_duplicates(struct Graphic *graphic) {
if ((Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) || is_preserved(j / tile_size - d)) {
break;
}
shift_preserved(j / tile_size);
shift_preserved(j / tile_size - d);
d++;
j += tile_size;
}
@ -235,7 +235,7 @@ void remove_flip(struct Graphic *graphic, bool xflip, bool yflip) {
if ((Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) || is_preserved(j / tile_size - d)) {
break;
}
shift_preserved(j / tile_size);
shift_preserved(j / tile_size - d);
d++;
j += tile_size;
}