shithub: pokecrystal

Download patch

ref: 022f9e6af1570f071eaf85cf65d50cb29ddc34f2
parent: a0e8e5ac5b7d91451ce6eac4c7c65641f7e5a59c
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Sun Jun 28 15:56:06 EDT 2020

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

--- a/Makefile
+++ b/Makefile
@@ -186,6 +186,8 @@
 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=$<
--- a/engine/movie/trade_animation.asm
+++ b/engine/movie/trade_animation.asm
@@ -1460,6 +1460,6 @@
 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 files a/gfx/trade/game_boy.png b/gfx/trade/game_boy.png differ
binary files /dev/null b/gfx/trade/link_cable.png differ
--- a/tools/gfx.c
+++ b/tools/gfx.c
@@ -68,7 +68,7 @@
 			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 @@
 	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 @@
 			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 @@
 			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;
 		}