summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile8
-rwxr-xr-xengine/gfx/color.asm50
-rw-r--r--gfx/mail/cloud.pngbin0 -> 110 bytes
-rw-r--r--gfx/mail/ditto.pngbin0 -> 120 bytes
-rw-r--r--gfx/mail/dragonite.pngbin0 -> 192 bytes
-rw-r--r--gfx/mail/dratini.pngbin0 -> 131 bytes
-rw-r--r--gfx/mail/eevee.pngbin0 -> 128 bytes
-rw-r--r--gfx/mail/eon_mail_border_1.pngbin0 -> 84 bytes
-rw-r--r--gfx/mail/eon_mail_border_2.pngbin0 -> 77 bytes
-rw-r--r--gfx/mail/flower_1.pngbin0 -> 112 bytes
-rw-r--r--gfx/mail/flower_2.pngbin0 -> 106 bytes
-rw-r--r--gfx/mail/flower_mail_border.pngbin0 -> 137 bytes
-rw-r--r--gfx/mail/grass.pngbin0 -> 84 bytes
-rw-r--r--gfx/mail/lapras.pngbin0 -> 117 bytes
-rw-r--r--gfx/mail/large_circle.pngbin0 -> 103 bytes
-rw-r--r--gfx/mail/large_heart.pngbin0 -> 112 bytes
-rw-r--r--gfx/mail/large_note.pngbin0 -> 115 bytes
-rw-r--r--gfx/mail/large_pokeball.pngbin0 -> 119 bytes
-rw-r--r--gfx/mail/large_triangle.pngbin0 -> 110 bytes
-rw-r--r--gfx/mail/litebluemail_border.pngbin0 -> 136 bytes
-rw-r--r--gfx/mail/lovely_mail_border.pngbin0 -> 121 bytes
-rw-r--r--gfx/mail/lovely_mail_underline.pngbin0 -> 80 bytes
-rw-r--r--gfx/mail/mew.pngbin0 -> 230 bytes
-rw-r--r--gfx/mail/morph_mail_border.pngbin0 -> 76 bytes
-rw-r--r--gfx/mail/morph_mail_corner.pngbin0 -> 110 bytes
-rw-r--r--gfx/mail/morph_mail_divider.pngbin0 -> 74 bytes
-rw-r--r--gfx/mail/music_mail_border.pngbin0 -> 107 bytes
-rw-r--r--gfx/mail/natu.pngbin0 -> 121 bytes
-rw-r--r--gfx/mail/oddish.pngbin0 -> 118 bytes
-rw-r--r--gfx/mail/poliwag.pngbin0 -> 136 bytes
-rw-r--r--gfx/mail/portraitmail_border.pngbin0 -> 93 bytes
-rw-r--r--gfx/mail/portraitmail_underline.pngbin0 -> 74 bytes
-rw-r--r--gfx/mail/sentret.pngbin0 -> 116 bytes
-rw-r--r--gfx/mail/small_heart.pngbin0 -> 84 bytes
-rw-r--r--gfx/mail/small_note.pngbin0 -> 86 bytes
-rw-r--r--gfx/mail/small_pokeball.pngbin0 -> 86 bytes
-rw-r--r--gfx/mail/small_triangle.pngbin0 -> 88 bytes
-rw-r--r--gfx/mail/surf_mail_border.pngbin0 -> 126 bytes
-rw-r--r--gfx/mail/unused_grass.pngbin0 -> 92 bytes
-rw-r--r--gfx/mail/wave.pngbin0 -> 91 bytes
-rw-r--r--tools/gfx.py38
-rw-r--r--tools/pokemontools/gfx.py39
42 files changed, 74 insertions, 61 deletions
diff --git a/Makefile b/Makefile
index 721d6f69..f67934ed 100644
--- a/Makefile
+++ b/Makefile
@@ -99,7 +99,7 @@ pokesilver.gbc: $(silver_obj) pokesilver.link
tools/sort_symfile.sh pokesilver.sym
pngs:
- find gfx/pokemon gfx/trainers -iname "*.lz" -exec $(gfx) unlz {} +
- find gfx/pokemon gfx/trainers -iname "*.[12]bpp" -exec $(gfx) png {} +
- find gfx/pokemon gfx/trainers -iname "*.[12]bpp" -exec touch {} +
- find gfx/pokemon gfx/trainers -iname "*.lz" -exec touch {} +
+ find gfx/pokemon gfx/trainers gfx/mail -iname "*.lz" -exec $(gfx) unlz {} +
+ find gfx/pokemon gfx/trainers gfx/mail -iname "*.[12]bpp" -exec $(gfx) png {} +
+ find gfx/pokemon gfx/trainers gfx/mail -iname "*.[12]bpp" -exec touch {} +
+ find gfx/pokemon gfx/trainers gfx/mail -iname "*.lz" -exec touch {} +
diff --git a/engine/gfx/color.asm b/engine/gfx/color.asm
index 1e404a61..ca713987 100755
--- a/engine/gfx/color.asm
+++ b/engine/gfx/color.asm
@@ -376,55 +376,7 @@ LoadMailPalettes:
ret
.MailPals:
- RGB 20, 31, 11
- RGB 31, 19, 00
- RGB 31, 10, 09
- RGB 00, 00, 00
-
- RGB 15, 20, 31
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 24, 17, 31
- RGB 30, 26, 00
- RGB 08, 11, 31
- RGB 00, 00, 00
-
- RGB 31, 25, 17
- RGB 31, 18, 04
- RGB 28, 12, 05
- RGB 00, 00, 00
-
- RGB 19, 26, 31
- RGB 31, 05, 08
- RGB 31, 09, 31
- RGB 00, 00, 00
-
- RGB 31, 19, 28
- RGB 31, 21, 00
- RGB 12, 22, 00
- RGB 00, 00, 00
-
- RGB 19, 17, 23
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 07, 26, 31
- RGB 26, 26, 27
- RGB 31, 11, 11
- RGB 00, 00, 00
-
- RGB 21, 31, 21
- RGB 30, 26, 00
- RGB 31, 12, 00
- RGB 00, 00, 00
-
- RGB 07, 26, 31
- RGB 31, 31, 00
- RGB 00, 21, 00
- RGB 00, 00, 00
+INCLUDE "gfx/mail/mail.pal"
INCLUDE "predef/cgb.asm"
diff --git a/gfx/mail/cloud.png b/gfx/mail/cloud.png
new file mode 100644
index 00000000..1e8559eb
--- /dev/null
+++ b/gfx/mail/cloud.png
Binary files differ
diff --git a/gfx/mail/ditto.png b/gfx/mail/ditto.png
new file mode 100644
index 00000000..d0775fc3
--- /dev/null
+++ b/gfx/mail/ditto.png
Binary files differ
diff --git a/gfx/mail/dragonite.png b/gfx/mail/dragonite.png
new file mode 100644
index 00000000..f4d374e4
--- /dev/null
+++ b/gfx/mail/dragonite.png
Binary files differ
diff --git a/gfx/mail/dratini.png b/gfx/mail/dratini.png
new file mode 100644
index 00000000..51c0d4a9
--- /dev/null
+++ b/gfx/mail/dratini.png
Binary files differ
diff --git a/gfx/mail/eevee.png b/gfx/mail/eevee.png
new file mode 100644
index 00000000..6c020746
--- /dev/null
+++ b/gfx/mail/eevee.png
Binary files differ
diff --git a/gfx/mail/eon_mail_border_1.png b/gfx/mail/eon_mail_border_1.png
new file mode 100644
index 00000000..83c029e9
--- /dev/null
+++ b/gfx/mail/eon_mail_border_1.png
Binary files differ
diff --git a/gfx/mail/eon_mail_border_2.png b/gfx/mail/eon_mail_border_2.png
new file mode 100644
index 00000000..b34ffce1
--- /dev/null
+++ b/gfx/mail/eon_mail_border_2.png
Binary files differ
diff --git a/gfx/mail/flower_1.png b/gfx/mail/flower_1.png
new file mode 100644
index 00000000..2147bef3
--- /dev/null
+++ b/gfx/mail/flower_1.png
Binary files differ
diff --git a/gfx/mail/flower_2.png b/gfx/mail/flower_2.png
new file mode 100644
index 00000000..3f0d34ed
--- /dev/null
+++ b/gfx/mail/flower_2.png
Binary files differ
diff --git a/gfx/mail/flower_mail_border.png b/gfx/mail/flower_mail_border.png
new file mode 100644
index 00000000..4d2ade2a
--- /dev/null
+++ b/gfx/mail/flower_mail_border.png
Binary files differ
diff --git a/gfx/mail/grass.png b/gfx/mail/grass.png
new file mode 100644
index 00000000..7e1f1761
--- /dev/null
+++ b/gfx/mail/grass.png
Binary files differ
diff --git a/gfx/mail/lapras.png b/gfx/mail/lapras.png
new file mode 100644
index 00000000..5ea40f47
--- /dev/null
+++ b/gfx/mail/lapras.png
Binary files differ
diff --git a/gfx/mail/large_circle.png b/gfx/mail/large_circle.png
new file mode 100644
index 00000000..d91eae23
--- /dev/null
+++ b/gfx/mail/large_circle.png
Binary files differ
diff --git a/gfx/mail/large_heart.png b/gfx/mail/large_heart.png
new file mode 100644
index 00000000..07532857
--- /dev/null
+++ b/gfx/mail/large_heart.png
Binary files differ
diff --git a/gfx/mail/large_note.png b/gfx/mail/large_note.png
new file mode 100644
index 00000000..b0f0728b
--- /dev/null
+++ b/gfx/mail/large_note.png
Binary files differ
diff --git a/gfx/mail/large_pokeball.png b/gfx/mail/large_pokeball.png
new file mode 100644
index 00000000..5c2dcb10
--- /dev/null
+++ b/gfx/mail/large_pokeball.png
Binary files differ
diff --git a/gfx/mail/large_triangle.png b/gfx/mail/large_triangle.png
new file mode 100644
index 00000000..1a518f77
--- /dev/null
+++ b/gfx/mail/large_triangle.png
Binary files differ
diff --git a/gfx/mail/litebluemail_border.png b/gfx/mail/litebluemail_border.png
new file mode 100644
index 00000000..485e390f
--- /dev/null
+++ b/gfx/mail/litebluemail_border.png
Binary files differ
diff --git a/gfx/mail/lovely_mail_border.png b/gfx/mail/lovely_mail_border.png
new file mode 100644
index 00000000..48b8e7b7
--- /dev/null
+++ b/gfx/mail/lovely_mail_border.png
Binary files differ
diff --git a/gfx/mail/lovely_mail_underline.png b/gfx/mail/lovely_mail_underline.png
new file mode 100644
index 00000000..211848bf
--- /dev/null
+++ b/gfx/mail/lovely_mail_underline.png
Binary files differ
diff --git a/gfx/mail/mew.png b/gfx/mail/mew.png
new file mode 100644
index 00000000..8a8ea55e
--- /dev/null
+++ b/gfx/mail/mew.png
Binary files differ
diff --git a/gfx/mail/morph_mail_border.png b/gfx/mail/morph_mail_border.png
new file mode 100644
index 00000000..0fc395ef
--- /dev/null
+++ b/gfx/mail/morph_mail_border.png
Binary files differ
diff --git a/gfx/mail/morph_mail_corner.png b/gfx/mail/morph_mail_corner.png
new file mode 100644
index 00000000..b4d151f4
--- /dev/null
+++ b/gfx/mail/morph_mail_corner.png
Binary files differ
diff --git a/gfx/mail/morph_mail_divider.png b/gfx/mail/morph_mail_divider.png
new file mode 100644
index 00000000..8a280b39
--- /dev/null
+++ b/gfx/mail/morph_mail_divider.png
Binary files differ
diff --git a/gfx/mail/music_mail_border.png b/gfx/mail/music_mail_border.png
new file mode 100644
index 00000000..035757ee
--- /dev/null
+++ b/gfx/mail/music_mail_border.png
Binary files differ
diff --git a/gfx/mail/natu.png b/gfx/mail/natu.png
new file mode 100644
index 00000000..ef4c1ebe
--- /dev/null
+++ b/gfx/mail/natu.png
Binary files differ
diff --git a/gfx/mail/oddish.png b/gfx/mail/oddish.png
new file mode 100644
index 00000000..76143236
--- /dev/null
+++ b/gfx/mail/oddish.png
Binary files differ
diff --git a/gfx/mail/poliwag.png b/gfx/mail/poliwag.png
new file mode 100644
index 00000000..a1b092e6
--- /dev/null
+++ b/gfx/mail/poliwag.png
Binary files differ
diff --git a/gfx/mail/portraitmail_border.png b/gfx/mail/portraitmail_border.png
new file mode 100644
index 00000000..9efb3401
--- /dev/null
+++ b/gfx/mail/portraitmail_border.png
Binary files differ
diff --git a/gfx/mail/portraitmail_underline.png b/gfx/mail/portraitmail_underline.png
new file mode 100644
index 00000000..6c32516e
--- /dev/null
+++ b/gfx/mail/portraitmail_underline.png
Binary files differ
diff --git a/gfx/mail/sentret.png b/gfx/mail/sentret.png
new file mode 100644
index 00000000..b277a2c9
--- /dev/null
+++ b/gfx/mail/sentret.png
Binary files differ
diff --git a/gfx/mail/small_heart.png b/gfx/mail/small_heart.png
new file mode 100644
index 00000000..51a61a19
--- /dev/null
+++ b/gfx/mail/small_heart.png
Binary files differ
diff --git a/gfx/mail/small_note.png b/gfx/mail/small_note.png
new file mode 100644
index 00000000..cc95134f
--- /dev/null
+++ b/gfx/mail/small_note.png
Binary files differ
diff --git a/gfx/mail/small_pokeball.png b/gfx/mail/small_pokeball.png
new file mode 100644
index 00000000..666c5981
--- /dev/null
+++ b/gfx/mail/small_pokeball.png
Binary files differ
diff --git a/gfx/mail/small_triangle.png b/gfx/mail/small_triangle.png
new file mode 100644
index 00000000..f5d98bf9
--- /dev/null
+++ b/gfx/mail/small_triangle.png
Binary files differ
diff --git a/gfx/mail/surf_mail_border.png b/gfx/mail/surf_mail_border.png
new file mode 100644
index 00000000..c1b6d7f5
--- /dev/null
+++ b/gfx/mail/surf_mail_border.png
Binary files differ
diff --git a/gfx/mail/unused_grass.png b/gfx/mail/unused_grass.png
new file mode 100644
index 00000000..bdc18dba
--- /dev/null
+++ b/gfx/mail/unused_grass.png
Binary files differ
diff --git a/gfx/mail/wave.png b/gfx/mail/wave.png
new file mode 100644
index 00000000..2f8d140c
--- /dev/null
+++ b/gfx/mail/wave.png
Binary files differ
diff --git a/tools/gfx.py b/tools/gfx.py
index f817b374..36e06010 100644
--- a/tools/gfx.py
+++ b/tools/gfx.py
@@ -1,6 +1,6 @@
"""Supplementary scripts for graphics conversion."""
-import os
+import os, re
import argparse
from pokemontools import gfx, lz
@@ -40,8 +40,9 @@ def get_pokemon_dimensions(name):
if name.startswith('unown_'):
name = 'unown'
base_stats = get_base_stats()
- # TODO: extra space at end = hack for pidgeot/mew (caught by pidgeotto/mewtwo)
- start = base_stats.find('\tdb ' + name.upper() + ' ')
+ # hack for pidgeot/mew (previously caught by being substrings of pidgeotto/mewtwo)
+ pattern = re.compile('\s+db {0}\s+'.format(name.upper()))
+ start = pattern.search(base_stats).start()
start = base_stats.find('\tdn ', start)
end = base_stats.find('\n', start)
line = base_stats[start:end].replace(',', ' ')
@@ -82,8 +83,39 @@ def filepath_rules(filepath):
args['pic'] = True
elif 'gfx/trainers' in filedir:
+ trainer_name = filedir.split('/')[-1]
+ args['pal_file'] = os.path.join(filedir, trainer_name + '.pal')
args['pic'] = True
+ elif 'gfx/mail' in filedir:
+ px8 = ['eon_mail_border_2', 'grass', 'lovely_mail_border', 'lovely_mail_underline',
+ 'morph_mail_border', 'morph_mail_divider', 'portrail_mail_border',
+ 'portraitmail_border', 'portraitmail_underline', 'small_heart', 'small_note',
+ 'small_pokeball', 'small_triangle', 'wave']
+ px16 = ['eon_mail_border_1', 'flower_1', 'flower_2', 'large_circle', 'large_heart',
+ 'large_pokeball', 'large_triangle', 'morph_mail_corner',
+ 'music_mail_border', 'oddish', 'sentret', 'unused_grass']
+ px24 = ['cloud', 'ditto', 'dratini', 'eevee', 'lapras',
+ 'mew', 'natu', 'poliwag']
+ if name in px8:
+ args['width'] = 8
+ elif name in px16:
+ args['width'] = 16
+ elif name in px24:
+ args['width'] = 24
+
+ elif name == 'dragonite':
+ args['width'] = 56
+ args['rows'] = [(0, 6), (1, 6), (2, 6)]
+
+ elif name == 'large_note':
+ args['width'] = 16
+ args['rows'] = [(1, 1), (0, 2)]
+
+ elif name in ['surf_mail_border', 'flower_mail_border', 'litebluemail_border']:
+ args['width'] = 24
+ args['whitespace'] = [4]
+
elif os.path.join(filedir, name) in pics:
args['pic'] = True
diff --git a/tools/pokemontools/gfx.py b/tools/pokemontools/gfx.py
index 1beb5446..97e4d838 100644
--- a/tools/pokemontools/gfx.py
+++ b/tools/pokemontools/gfx.py
@@ -426,6 +426,8 @@ def convert_2bpp_to_png(image, **kwargs):
pic_dimensions = kwargs.get('pic_dimensions', None)
pal_file = kwargs.get('pal_file', None)
interleave = kwargs.get('interleave', False)
+ rows = kwargs.get('rows', None)
+ whitespace = kwargs.get('whitespace', None)
# Width must be specified to interleave.
if interleave and width:
@@ -454,13 +456,39 @@ def convert_2bpp_to_png(image, **kwargs):
def px_length(img):
return len(img) * 4
def tile_length(img):
- return len(img) * 4 / (8*8)
+ return len(img) * 4 // (8*8)
if width and height:
- tile_width = width / 8
+ tile_width = width // 8
more_tile_padding = (tile_width - (tile_length(image) % tile_width or tile_width))
image += pad_color * 0x10 * more_tile_padding
+ elif width and rows:
+ newimage = bytearray([])
+ padding = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
+ height = len(rows) * 8
+ cur_index = 0
+ for offset, tile_width in rows:
+ for x in range(0, offset):
+ newimage += padding
+ next_index = min(len(image),cur_index+ 0x10*tile_width)
+ newimage += image[cur_index:next_index]
+ cur_index = next_index
+ row_padding = max(0, width//8 - offset - tile_width)
+ for x in range(0, row_padding):
+ newimage += padding
+ image = newimage
+
+ elif width and whitespace:
+ padding = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0])
+ cur_offset = 0
+ cur_idx = 0
+ for idx in whitespace:
+ next_offset = cur_offset + 0x10*(idx-cur_idx)
+ image = image[cur_offset:next_offset] + padding + image[next_offset:]
+ cur_offset = next_offset + 0x10
+ cur_idx = idx
+
elif width and not height:
tile_width = width // 8
more_tile_padding = (tile_width - (tile_length(image) % tile_width or tile_width))
@@ -468,7 +496,7 @@ def convert_2bpp_to_png(image, **kwargs):
height = px_length(image) / width
elif height and not width:
- tile_height = height / 8
+ tile_height = height // 8
more_tile_padding = (tile_height - (tile_length(image) % tile_height or tile_height))
image += pad_color * 0x10 * more_tile_padding
width = px_length(image) / height
@@ -820,12 +848,13 @@ def export_1bpp_to_2bpp(filename):
to_file(name + '.2bpp', image)
-def export_1bpp_to_png(filename, fileout=None):
+def export_1bpp_to_png(filename, fileout=None, **arguments):
if fileout == None:
fileout = os.path.splitext(filename)[0] + '.png'
- arguments = read_filename_arguments(filename)
+ if arguments is None :
+ arguments = read_filename_arguments(filename)
image = io.open(filename, 'rb').read()
image = convert_1bpp_to_2bpp(image)