shithub: pokecrystal

Download patch

ref: 41ae3610f6c601e7803d6bcd049cf690f111f29a
parent: f42e731d766e3f979f5f437d255c159d0dd3c485
author: yenatch <yenatch@gmail.com>
date: Fri Jun 23 20:45:31 EDT 2017

pngs in gfx/fx

- gave up on wind.png
- add --remove-yflip

--- a/Makefile
+++ b/Makefile
@@ -135,6 +135,24 @@
 gfx/slots_3a.2bpp: tools/gfx += --interleave --width=16
 gfx/slots_3b.2bpp: tools/gfx += --interleave --width=24 --remove-duplicates --keep-whitespace --remove-xflip
 
+gfx/fx/angels.2bpp: tools/gfx += --trim-whitespace
+gfx/fx/beam.2bpp: tools/gfx += --remove-xflip --remove-yflip --remove-whitespace
+gfx/fx/bubble.2bpp: tools/gfx += --trim-whitespace
+gfx/fx/charge.2bpp: tools/gfx += --trim-whitespace
+gfx/fx/egg.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/explosion.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/hit.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/horn.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/lightning.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/misc.2bpp: tools/gfx += --remove-duplicates --remove-xflip
+gfx/fx/noise.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/objects.2bpp: tools/gfx += --remove-whitespace --remove-xflip
+gfx/fx/pokeball.2bpp: tools/gfx += --remove-xflip --keep-whitespace
+gfx/fx/reflect.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/rocks.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/skyattack.2bpp: tools/gfx += --remove-whitespace
+gfx/fx/status.2bpp: tools/gfx += --remove-whitespace
+
 
 %.bin: ;
 %.blk: ;
binary files a/gfx/fx/aeroblast.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/aeroblast.2bpp.lz.2f07c4ea differ
binary files /dev/null b/gfx/fx/aeroblast.png differ
binary files a/gfx/fx/angels.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/angels.2bpp.lz.b026d81e differ
binary files /dev/null b/gfx/fx/angels.png differ
binary files a/gfx/fx/beam.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/beam.2bpp.lz.80b6d613 differ
binary files /dev/null b/gfx/fx/beam.png differ
binary files a/gfx/fx/bubble.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/bubble.2bpp.lz.03b8ac99 differ
binary files /dev/null b/gfx/fx/bubble.png differ
binary files a/gfx/fx/charge.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/charge.2bpp.lz.95d3ea98 differ
binary files /dev/null b/gfx/fx/charge.png differ
binary files a/gfx/fx/cut.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/cut.2bpp.lz.03d343ed differ
binary files /dev/null b/gfx/fx/cut.png differ
binary files a/gfx/fx/egg.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/egg.2bpp.lz.41dd1a53 differ
binary files /dev/null b/gfx/fx/egg.png differ
binary files a/gfx/fx/explosion.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/explosion.2bpp.lz.55fc334f differ
binary files /dev/null b/gfx/fx/explosion.png differ
binary files a/gfx/fx/fire.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/fire.2bpp.lz.d7701cda differ
binary files /dev/null b/gfx/fx/fire.png differ
binary files a/gfx/fx/flower.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/flower.2bpp.lz.1bc2e9d2 differ
binary files /dev/null b/gfx/fx/flower.png differ
binary files a/gfx/fx/globe.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/globe.2bpp.lz.710dbb8e differ
binary files /dev/null b/gfx/fx/globe.png differ
binary files a/gfx/fx/haze.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/haze.2bpp.lz.91424607 differ
binary files /dev/null b/gfx/fx/haze.png differ
binary files a/gfx/fx/hit.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/hit.2bpp.lz.2b3c83f2 differ
binary files /dev/null b/gfx/fx/hit.png differ
binary files a/gfx/fx/horn.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/horn.2bpp.lz.48908aae differ
binary files /dev/null b/gfx/fx/horn.png differ
binary files a/gfx/fx/ice.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/ice.2bpp.lz.664d900f differ
binary files /dev/null b/gfx/fx/ice.png differ
binary files a/gfx/fx/lightning.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/lightning.2bpp.lz.a88fc131 differ
binary files /dev/null b/gfx/fx/lightning.png differ
binary files a/gfx/fx/misc.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/misc.2bpp.lz.4b20c3d7 differ
binary files /dev/null b/gfx/fx/misc.png differ
binary files a/gfx/fx/noise.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/noise.2bpp.lz.acb4a76e differ
binary files /dev/null b/gfx/fx/noise.png differ
binary files a/gfx/fx/objects.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/objects.2bpp.lz.83f812de differ
binary files /dev/null b/gfx/fx/objects.png differ
--- a/gfx/fx/plant.2bpp.lz
+++ /dev/null
@@ -1,3 +1,0 @@
-a<<~B��ߡ>�����
-<$xx��c	>2��88i��~Bø}c}CC��➆�xx<$|D~B^b3=a��C	e00PpC��
-=%}EC_c�����<�>��c����_aOq'83<e
79Nr����
)���`�@I@�  00<,.2/1'9a��
,4\d����	������
\ No newline at end of file
--- /dev/null
+++ b/gfx/fx/plant.2bpp.lz.4a00c417
@@ -1,0 +1,3 @@
+a<<~B��ߡ>�����
+<$xx��c	>2��88i��~Bø}c}CC��➆�xx<$|D~B^b3=a��C	e00PpC��
+=%}EC_c�����<�>��c����_aOq'83<e
79Nr����
)���`�@I@�  00<,.2/1'9a��
,4\d����	������
\ No newline at end of file
binary files /dev/null b/gfx/fx/plant.png differ
binary files a/gfx/fx/poison.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/poison.2bpp.lz.fc7dc9c1 differ
binary files /dev/null b/gfx/fx/poison.png differ
binary files a/gfx/fx/pokeball.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/pokeball.2bpp.lz.c58f7e01 differ
binary files /dev/null b/gfx/fx/pokeball.png differ
--- a/gfx/fx/powder.2bpp.lz
+++ /dev/null
@@ -1,1 +1,0 @@
-@@��GEa8(@@��EG��Î
\ No newline at end of file
--- /dev/null
+++ b/gfx/fx/powder.2bpp.lz.bfd566bb
@@ -1,0 +1,1 @@
+@@��GEa8(@@��EG��Î
\ No newline at end of file
binary files /dev/null b/gfx/fx/powder.png differ
binary files a/gfx/fx/psychic.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/psychic.2bpp.lz.d80f285c differ
binary files /dev/null b/gfx/fx/psychic.png differ
binary files a/gfx/fx/reflect.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/reflect.2bpp.lz.9a9c822d differ
binary files /dev/null b/gfx/fx/reflect.png differ
binary files a/gfx/fx/rocks.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/rocks.2bpp.lz.73d0153e differ
binary files /dev/null b/gfx/fx/rocks.png differ
binary files a/gfx/fx/rope.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/rope.2bpp.lz.209d63dd differ
binary files /dev/null b/gfx/fx/rope.png differ
binary files a/gfx/fx/sand.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/sand.2bpp.lz.c87c0eaa differ
binary files /dev/null b/gfx/fx/sand.png differ
binary files a/gfx/fx/shapes.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/shapes.2bpp.lz.262d77f0 differ
binary files /dev/null b/gfx/fx/shapes.png differ
binary files a/gfx/fx/shine.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/shine.2bpp.lz.5fb79056 differ
binary files /dev/null b/gfx/fx/shine.png differ
binary files a/gfx/fx/skyattack.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/skyattack.2bpp.lz.31738ab8 differ
binary files /dev/null b/gfx/fx/skyattack.png differ
binary files a/gfx/fx/smoke.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/smoke.2bpp.lz.aa05905e differ
binary files /dev/null b/gfx/fx/smoke.png differ
binary files a/gfx/fx/speed.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/speed.2bpp.lz.1732b364 differ
binary files /dev/null b/gfx/fx/speed.png differ
binary files a/gfx/fx/status.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/status.2bpp.lz.0c0aa13e differ
binary files /dev/null b/gfx/fx/status.png differ
binary files a/gfx/fx/water.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/water.2bpp.lz.7b52ed12 differ
binary files /dev/null b/gfx/fx/water.png differ
binary files a/gfx/fx/wave.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/wave.2bpp.lz.bee99402 differ
binary files /dev/null b/gfx/fx/wave.png differ
binary files a/gfx/fx/web.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/web.2bpp.lz.80e3d480 differ
binary files /dev/null b/gfx/fx/web.png differ
binary files a/gfx/fx/whip.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/whip.2bpp.lz.d80d8d6e differ
binary files /dev/null b/gfx/fx/whip.png differ
binary files a/gfx/fx/wind.2bpp.lz /dev/null differ
binary files /dev/null b/gfx/fx/wind.2bpp.lz.5a785180 differ
binary files /dev/null b/gfx/fx/wind.png differ
--- a/tools/gfx.c
+++ b/tools/gfx.c
@@ -7,7 +7,7 @@
 #include "common.h"
 
 static void usage(void) {
-	fprintf(stderr, "Usage: gfx [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [-w width] [-d depth] [-h] [-o outfile] infile\n");
+	fprintf(stderr, "Usage: gfx [--trim-whitespace] [--remove-whitespace] [--interleave] [--remove-duplicates [--keep-whitespace]] [--remove-xflip] [--remove-yflip] [-w width] [-d depth] [-h] [-o outfile] infile\n");
 }
 
 static void error(char *message) {
@@ -26,6 +26,7 @@
 	int remove_duplicates;
 	int keep_whitespace;
 	int remove_xflip;
+	int remove_yflip;
 };
 
 struct Options Options = {
@@ -40,6 +41,7 @@
 		{"remove-duplicates", no_argument, &Options.remove_duplicates, 1},
 		{"keep-whitespace", no_argument, &Options.keep_whitespace, 1},
 		{"remove-xflip", no_argument, &Options.remove_xflip, 1},
+		{"remove-yflip", no_argument, &Options.remove_yflip, 1},
 		{"width", required_argument, 0, 'w'},
 		{"depth", required_argument, 0, 'd'},
 		{"help", no_argument, 0, 'h'},
@@ -157,12 +159,12 @@
 	for (int i = 0; i < tile_size; i++) {
 		int byte = i;
 		if (yflip) {
-			byte = tile_size - 1 - i;
+			byte = tile_size - 1 - (i ^ 1);
 			if (Options.interleave && i < half_size) {
-				byte = half_size - 1 - i;
+				byte = half_size - 1 - (i ^ 1);
 			}
 		}
-		if (flip) {
+		if (xflip) {
 			for (int bit = 0; bit < 8; bit++) {
 				flip[byte] |= ((tile[i] >> bit) & 1) << (7 - bit);
 			}
@@ -176,16 +178,12 @@
 	return false;
 }
 
-bool xflip_exists(uint8_t *tile, uint8_t *tiles, int tile_size, int num_tiles) {
-	return flip_exists(tile, tiles, tile_size, num_tiles, true, false);
-}
-
-void remove_xflip(struct Graphic *graphic) {
+void remove_flip(struct Graphic *graphic, bool xflip, bool yflip) {
 	int tile_size = Options.depth * 8;
 	if (Options.interleave) tile_size *= 2;
 	int num_tiles = 0;
 	for (int i = 0, j = 0; i < graphic->size && j < graphic->size; i += tile_size, j += tile_size) {
-		while (xflip_exists(&graphic->data[j], graphic->data, tile_size, num_tiles)) {
+		while (flip_exists(&graphic->data[j], graphic->data, tile_size, num_tiles, xflip, yflip)) {
 			if (Options.keep_whitespace && is_whitespace(&graphic->data[j], tile_size)) {
 				break;
 			}
@@ -253,7 +251,13 @@
 		remove_duplicates(&graphic);
 	}
 	if (Options.remove_xflip) {
-		remove_xflip(&graphic);
+		remove_flip(&graphic, true, false);
+	}
+	if (Options.remove_yflip) {
+		remove_flip(&graphic, false, true);
+	}
+	if (Options.remove_xflip && Options.remove_yflip) {
+		remove_flip(&graphic, true, true);
 	}
 	if (Options.remove_whitespace) {
 		remove_whitespace(&graphic);