shithub: pokecrystal

Download patch

ref: a73c532738d055bb3d28a46b59f7fc87d2c998d4
parent: f81add782affc2ca3b196e0beb98e9c89d0f09ff
author: Rangi <[email protected]>
date: Mon Jan 22 14:40:17 EST 2018

tile+color macros in gfx.asm

--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -3,6 +3,7 @@
 LEN_2BPP_TILE EQU 2 * TILE_WIDTH ; bytes
 
 NUM_PAL_COLORS EQU 4
+PAL_COLOR_SIZE EQU 2
 
 PALRGB_WHITE EQUS "palred 31 + palgreen 31 + palblue 31" ; $7fff
 
--- a/engine/color.asm
+++ b/engine/color.asm
@@ -337,11 +337,11 @@
 	ret
 
 .Enemy:
-	ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP + 2
+	ld de, wBGPals2 palette PAL_BATTLE_BG_ENEMY_HP color 1
 	jr .okay
 
 .Player:
-	ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP + 2
+	ld de, wBGPals2 palette PAL_BATTLE_BG_PLAYER_HP color 1
 
 .okay
 	ld l, c
@@ -521,7 +521,7 @@
 	ld [de], a
 	inc de
 
-	ld c, 2 * 2
+	ld c, 2 * PAL_COLOR_SIZE
 .loop
 	ld a, [hli]
 	ld [de], a
@@ -1308,7 +1308,7 @@
 	inc hl
 endr
 .morn_day
-	ld de, wBGPals1 palette PAL_BG_ROOF + 2
+	ld de, wBGPals1 palette PAL_BG_ROOF color 1
 	ld bc, 4
 	ld a, BANK(wBGPals1)
 	call FarCopyWRAM
--- a/engine/tileset_anims.asm
+++ b/engine/tileset_anims.asm
@@ -952,7 +952,7 @@
 	jr z, .color2
 
 .color1
-	ld hl, wBGPals1 palette PAL_BG_WATER + 2
+	ld hl, wBGPals1 palette PAL_BG_WATER color 1
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -960,7 +960,7 @@
 	jr .end
 
 .color0
-	ld hl, wBGPals1 palette PAL_BG_WATER
+	ld hl, wBGPals1 palette PAL_BG_WATER color 0
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -968,7 +968,7 @@
 	jr .end
 
 .color2
-	ld hl, wBGPals1 palette PAL_BG_WATER + 4
+	ld hl, wBGPals1 palette PAL_BG_WATER color 2
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -1009,7 +1009,7 @@
 	jr .okay
 
 .bit1set
-	ld hl, wBGPals1 palette PAL_BG_YELLOW + 2
+	ld hl, wBGPals1 palette PAL_BG_YELLOW color 1
 
 .okay
 	ld a, [hli]
--- a/home/palettes.asm
+++ b/home/palettes.asm
@@ -280,7 +280,7 @@
 	jr nz, .loop
 
 ; de += 8 (next pal)
-	ld a, NUM_PAL_COLORS * 2
+	ld a, NUM_PAL_COLORS * PAL_COLOR_SIZE
 	add e
 	jr nc, .ok
 	inc d
--- a/macros.asm
+++ b/macros.asm
@@ -3,8 +3,8 @@
 INCLUDE "macros/rst.asm"
 INCLUDE "macros/data.asm"
 INCLUDE "macros/code.asm"
+INCLUDE "macros/gfx.asm"
 INCLUDE "macros/coords.asm"
-INCLUDE "macros/color.asm"
 
 INCLUDE "macros/scripts/audio.asm"
 INCLUDE "macros/scripts/maps.asm"
@@ -17,6 +17,3 @@
 INCLUDE "macros/scripts/gfx_anims.asm"
 
 percent EQUS "* $ff / 100"
-
-tiles EQUS "* LEN_2BPP_TILE"
-tile  EQUS "+ LEN_2BPP_TILE *"
--- a/macros/color.asm
+++ /dev/null
@@ -1,15 +1,0 @@
-RGB: MACRO
-rept _NARG / 3
-	dw palred (\1) + palgreen (\2) + palblue (\3)
-	shift
-	shift
-	shift
-endr
-ENDM
-
-palred   EQUS "(1 << 0) *"
-palgreen EQUS "(1 << 5) *"
-palblue  EQUS "(1 << 10) *"
-
-palettes EQUS "* 8"
-palette  EQUS "+ 8 *"
--- /dev/null
+++ b/macros/gfx.asm
@@ -1,0 +1,19 @@
+RGB: MACRO
+rept _NARG / 3
+	dw palred (\1) + palgreen (\2) + palblue (\3)
+	shift
+	shift
+	shift
+endr
+ENDM
+
+palred   EQUS "(1 << 0) *"
+palgreen EQUS "(1 << 5) *"
+palblue  EQUS "(1 << 10) *"
+
+palettes EQUS "* 8"
+palette  EQUS "+ 8 *"
+color    EQUS "+ 2 *"
+
+tiles EQUS "* LEN_2BPP_TILE"
+tile  EQUS "+ LEN_2BPP_TILE *"
--- a/mobile/mobile_5b.asm
+++ b/mobile/mobile_5b.asm
@@ -681,8 +681,8 @@
 	ld bc, 2
 	ld hl, Unknown_16cfa3
 	call AddNTimes
-	ld de, wBGPals1 + 1 palettes + 4
-	ld bc, 2
+	ld de, wBGPals1 palette 1 color 2
+	ld bc, PAL_COLOR_SIZE
 	ld a, $5
 	call FarCopyWRAM
 	farcall ApplyPals