shithub: pokecrystal

Download patch

ref: d1172e1fb67fe8bd9c33cc4ab0d45905167d4c53
parent: ee347bff48fb491e370e013e470cc0843b8912d5
author: yenatch <[email protected]>
date: Sun Feb 10 12:50:30 EST 2013

Add build target to mass-generate pngs from 2bpp files

--- a/Makefile
+++ b/Makefile
@@ -31,6 +31,10 @@
 	cmp baserom.gbc $@
 
 
+pngs:
+	python gfx.py dump-pngs
+
+
 front.png: tiles.png
 	python gfx.py png-to-lz --front $@ $(OBJECT_DIRECTORY)/tiles.2bpp
 
--- a/extras/gfx.py
+++ b/extras/gfx.py
@@ -1399,19 +1399,27 @@
 
 
 
-def mass_to_png():
+def mass_to_png(debug=False):
 	# greyscale
 	for root, dirs, files in os.walk('../gfx/'):
 		for name in files:
-			print os.path.splitext(name), os.path.join(root, name)
+			if debug: print os.path.splitext(name), os.path.join(root, name)
 			if os.path.splitext(name)[1] == '.2bpp':
 				to_png(os.path.join(root, name))
 
-def mass_to_colored_png():
+def mass_to_colored_png(debug=False):
+	# greyscale
+	for root, dirs, files in os.walk('../gfx/'):
+		if 'pics' not in root and 'trainers' not in root:
+			for name in files:
+				if debug: print os.path.splitext(name), os.path.join(root, name)
+				if os.path.splitext(name)[1] == '.2bpp':
+					to_png(os.path.join(root, name))
+	
 	# only monster and trainer pics for now
 	for root, dirs, files in os.walk('../gfx/pics/'):
 		for name in files:
-			print os.path.splitext(name), os.path.join(root, name)
+			if debug: print os.path.splitext(name), os.path.join(root, name)
 			if os.path.splitext(name)[1] == '.2bpp':
 				if 'normal.pal' in files:
 					to_png(os.path.join(root, name), None, os.path.join(root, 'normal.pal'))
@@ -1419,7 +1427,7 @@
 					to_png(os.path.join(root, name))
 	for root, dirs, files in os.walk('../gfx/trainers/'):
 		for name in files:
-			print os.path.splitext(name), os.path.join(root, name)
+			if debug: print os.path.splitext(name), os.path.join(root, name)
 			if os.path.splitext(name)[1] == '.2bpp':
 				to_png(os.path.join(root, name), None, os.path.join(root, name[:-5] + '.pal'))
 
@@ -1435,9 +1443,12 @@
 	parser.add_argument('arg5', nargs='?', metavar='arg5', type=str)
 	args = parser.parse_args()
 	
-	debug = True
+	debug = False
 	
-	if args.cmd == 'png-to-lz':
+	if args.cmd == 'dump-pngs':
+		mass_to_colored_png()
+	
+	elif args.cmd == 'png-to-lz':
 		# python gfx.py png-to-lz [--front anim(2bpp) | --vert] [png]
 		
 		# python gfx.py png-to-lz --front [anim(2bpp)] [png]
@@ -1514,7 +1525,7 @@
 		
 		if '.2bpp' in args.arg1:
 			if args.arg3 == 'greyscale':
-				to_png(args.arg1, args.arg2)http://i.imgur.com/BMHkNuC.png
+				to_png(args.arg1, args.arg2)
 			else:
 				to_png(args.arg1, args.arg2, args.arg3)