shithub: pokecrystal

Download patch

ref: fb9fdd038d4ab94eab276585c7a8a46d8f9e33ad
parent: d2fabc3b157528bd4d5d76665e27b960f7a08b60
parent: 9fbe7ea42390e7a0d6a1288f076d7951ce66b5eb
author: Bryan Bishop <[email protected]>
date: Sat Jan 12 17:22:00 EST 2013

Merge pull request #80 from yenatch/master

rgb macro for palettes

--- a/constants.asm
+++ b/constants.asm
@@ -31,6 +31,10 @@
 	db BANK(\1)
 	ENDM
 
+RGB: MACRO
+	dw ((\3 << 10) | (\2 << 5) | (\1))
+	ENDM
+
 ; eventually replace with python macro
 note: MACRO
 	db \1
--- a/extras/gfx.py
+++ b/extras/gfx.py
@@ -1283,6 +1283,28 @@
 
 
 
+def hex_to_rgb(word):
+	red = word & 0b11111
+	word >>= 5
+	green = word & 0b11111
+	word >>= 5
+	blue = word & 0b11111
+	return (red, green, blue)
+
+def grab_palettes(address, length = 0x80):
+	output = ''
+	for word in range(length/2):
+		color = ord(rom[address+1])*0x100 + ord(rom[address])
+		address += 2
+		color = hex_to_rgb(color)
+		red = str(color[0]).zfill(2)
+		green = str(color[1]).zfill(2)
+		blue = str(color[2]).zfill(2)
+		output += '\tRGB '+red+', '+green+', '+blue
+		output += '\n'
+	return output
+
+
 if __name__ == "__main__":
 	parser = argparse.ArgumentParser()
 	parser.add_argument('cmd', nargs='?', metavar='cmd', type=str)
@@ -1317,7 +1339,11 @@
 		# python gfx.py un [address] [num_tiles] [filename]
 		get_uncompressed_gfx(int(args.arg1,16), int(args.arg2), args.arg3)
 	
-	else:
-		# python gfx.py
-		decompress_all()
-		if debug: print 'decompressed known gfx to ../gfx/!'
+	elif args.cmd == 'pal':
+		# python gfx.py pal [address] [length]
+		print grab_palettes(int(args.arg1,16), int(args.arg2))
+	
+	#else:
+		## python gfx.py
+		#decompress_all()
+		#if debug: print 'decompressed known gfx to ../gfx/!'
--- a/main.asm
+++ b/main.asm
@@ -89646,23 +89646,87 @@
 
 TitleScreenPalettes:
 ; BG
-	dw $0000, $0013, $7D0F, $7D0F
-	dw $0000, $7FFF, $7E0F, $343F
-	dw $0000, $1CE7, $7FFF, $7862
-	dw $0000, $35AD, $4BFF, $7862
-	dw $0000, $4E73, $339D, $7862
-	dw $0000, $6739, $1B3C, $7862
-	dw $0000, $7FFF, $02BA, $7862
-	dw $0000, $4D6B, $7FFF, $0000
+	RGB 00, 00, 00
+	RGB 19, 00, 00
+	RGB 15, 08, 31
+	RGB 15, 08, 31
+	
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 15, 16, 31
+	RGB 31, 01, 13
+	
+	RGB 00, 00, 00
+	RGB 07, 07, 07
+	RGB 31, 31, 31
+	RGB 02, 03, 30
+	
+	RGB 00, 00, 00
+	RGB 13, 13, 13
+	RGB 31, 31, 18
+	RGB 02, 03, 30
+	
+	RGB 00, 00, 00
+	RGB 19, 19, 19
+	RGB 29, 28, 12
+	RGB 02, 03, 30
+	
+	RGB 00, 00, 00
+	RGB 25, 25, 25
+	RGB 28, 25, 06
+	RGB 02, 03, 30
+	
+	RGB 00, 00, 00
+	RGB 31, 31, 31
+	RGB 26, 21, 00
+	RGB 02, 03, 30
+	
+	RGB 00, 00, 00
+	RGB 11, 11, 19
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	
 ; OBJ
-	dw $0000, $3C0A, $58B1, $7D33
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
-	dw $7FFF, $0000, $0000, $0000
+	RGB 00, 00, 00
+	RGB 10, 00, 15
+	RGB 17, 05, 22
+	RGB 19, 09, 31
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	
+	RGB 31, 31, 31
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+	RGB 00, 00, 00
+
 
 INCBIN "baserom.gbc", $10ff5e, $110000 - $10ff5e