shithub: pokecrystal

Download patch

ref: 6e12a515031027ab0412ef37a3f6e3b24adfc736
parent: 8c3905c4cdb4f24810473da51d52cc3e16062173
author: xCrystal <rgr.crystal@gmail.com>
date: Mon Jan 1 09:47:16 EST 2018

Use more palette(s) constants

--- a/constants/hardware_constants.asm
+++ b/constants/hardware_constants.asm
@@ -50,7 +50,7 @@
 OAM_Y_FLIP    EQU 6
 OAM_PRIORITY  EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
 
-; BP Map attribute flags
+; BG Map attribute flags
 PALETTE_MASK EQU %111
 VRAM_BANK_1  EQU 1 << OAM_TILE_BANK ; $08
 OBP_NUM      EQU 1 << OAM_OBP_NUM   ; $10
@@ -60,7 +60,7 @@
 
 ; Other useful constants
 LCDC_DEFAULT EQU %11100011
-LY_VBLANK EQU 144
+LY_VBLANK    EQU 144
 
 ; Hardware registers
 rJOYP       EQU $ff00 ; Joypad (R/W)
--- a/engine/battle_anims/bg_effects.asm
+++ b/engine/battle_anims/bg_effects.asm
@@ -2588,8 +2588,8 @@
 	ld b, a
 	ld c, $1
 	call CopyPals
-	ld hl, OBPals + 8
-	ld de, UnknOBPals + 8
+	ld hl, OBPals palette 1
+	ld de, UnknOBPals palette 1
 	pop af
 	ld b, a
 	ld c, $1
@@ -2610,8 +2610,8 @@
 	ld a, h
 	push bc
 	push af
-	ld hl, BGPals + 8
-	ld de, UnknBGPals + 8
+	ld hl, BGPals palette 1
+	ld de, UnknBGPals palette 1
 	ld b, a
 	ld c, $1
 	call CopyPals
--- a/engine/crystal_intro.asm
+++ b/engine/crystal_intro.asm
@@ -1532,7 +1532,7 @@
 	ld b, 8 ; number of BG pals
 .loop1
 	push hl
-	ld c, 8 ; number of bytes per pal
+	ld c, 1 palettes
 .loop2
 	ld a, [hli]
 	ld [de], a
@@ -1735,7 +1735,7 @@
 	adc d
 	ld d, a
 
-	ld bc, 8
+	ld bc, 1 palettes
 	call CopyBytes
 	pop bc
 
@@ -1747,7 +1747,7 @@
 	adc d
 	ld d, a
 
-	ld bc, 8
+	ld bc, 1 palettes
 	call CopyBytes
 
 	pop af
@@ -1950,7 +1950,7 @@
 	ld [rSVBK], a
 
 	ld hl, BGPals
-	ld bc, 16 * 8
+	ld bc, 16 palettes
 	xor a
 	call ByteFill
 
--- a/engine/debug.asm
+++ b/engine/debug.asm
@@ -1202,10 +1202,10 @@
 	ld [rSVBK], a
 	ld hl, BGPals
 	ld a, [wcf64]
-	ld bc, 8
+	ld bc, 1 palettes
 	call AddNTimes
 	ld de, wc608
-	ld bc, 8
+	ld bc, 1 palettes
 	call CopyBytes
 	pop af
 	ld [rSVBK], a
@@ -1232,12 +1232,12 @@
 	ld [rSVBK], a
 	ld hl, BGPals
 	ld a, [wcf64]
-	ld bc, 8
+	ld bc, 1 palettes
 	call AddNTimes
 	ld e, l
 	ld d, h
 	ld hl, wc608
-	ld bc, 8
+	ld bc, 1 palettes
 	call CopyBytes
 	hlcoord 1, 0
 	ld de, wc608
--- a/engine/events/poisonstep_pals.asm
+++ b/engine/events/poisonstep_pals.asm
@@ -29,7 +29,7 @@
 	ld a, $5
 	ld [rSVBK], a
 	ld hl, BGPals
-	ld c, $20
+	ld c, 4 palettes
 .loop
 ; RGB 28, 21, 31
 	ld a, LOW(palred 28 + palgreen 21 + palblue 31)
--- a/engine/pokedex.asm
+++ b/engine/pokedex.asm
@@ -2351,7 +2351,7 @@
 	ld a, $5
 	ld [rSVBK], a
 	ld hl, UnknBGPals
-	ld bc, $40
+	ld bc, 8 palettes
 	xor a
 	call ByteFill
 	pop af
--- a/mobile/mobile_22_2.asm
+++ b/mobile/mobile_22_2.asm
@@ -621,7 +621,7 @@
 	ld [rSVBK], a
 	ld hl, Palette_8b6d5
 	ld de, UnknBGPals
-	ld bc, $0018
+	ld bc, 3 palettes
 	call CopyBytes
 	pop af
 	ld [rSVBK], a
--- a/mobile/mobile_45_sprite_engine.asm
+++ b/mobile/mobile_45_sprite_engine.asm
@@ -658,7 +658,7 @@
 	ld [rSVBK], a
 	ld hl, BGPals
 	ld de, UnknBGPals
-	ld bc, $0040
+	ld bc, 8 palettes
 	call CopyBytes
 	pop af
 	ld [rSVBK], a
--- a/mobile/mobile_5b.asm
+++ b/mobile/mobile_5b.asm
@@ -243,7 +243,7 @@
 	ld a, $5
 	ld [rSVBK], a
 	ld a, $ff
-	ld bc, $0008
+	ld bc, 1 palettes
 	ld hl, UnknBGPals
 	call ByteFill
 	pop af
--- a/mobile/mobile_5c.asm
+++ b/mobile/mobile_5c.asm
@@ -717,7 +717,7 @@
 	ld [rSVBK], a
 	ld hl, Palette_171d71
 	ld de, UnknBGPals
-	ld bc, $40
+	ld bc, 8 palettes
 	call CopyBytes
 	ld hl, EngineBuffer5
 	ld a, $ff
@@ -885,11 +885,11 @@
 	ld [rSVBK], a
 	ld hl, Palette_172edf
 	ld de, UnknBGPals
-	ld bc, $40
+	ld bc, 8 palettes
 	call CopyBytes
 	ld hl, Palette_172edf
 	ld de, BGPals
-	ld bc, $40
+	ld bc, 8 palettes
 	call CopyBytes
 	call SetPalettes
 	pop af
--- a/mobile/mobile_5e.asm
+++ b/mobile/mobile_5e.asm
@@ -765,22 +765,22 @@
 
 	ld hl, Palette_17ac55
 	ld de, UnknBGPals ; $d000
-	ld bc, $30
+	ld bc, 6 palettes
 	call CopyBytes
 
 	ld hl, Palette_17ac95
 	ld de, UnknOBPals
-	ld bc, $40
+	ld bc, 8 palettes
 	call CopyBytes
 
 	ld hl, GFX_17afa5 + $510
-	ld de, UnknOBPals + 2 * 4
-	ld bc, $10
+	ld de, UnknOBPals palette 1
+	ld bc, 2 palettes
 	call CopyBytes
 
-	ld hl, MapObjectPals + 8
-	ld de, UnknOBPals + 6 * 4
-	ld bc, $8
+	ld hl, MapObjectPals palette 1
+	ld de, UnknOBPals palette 3
+	ld bc, 1 palettes
 	ld a, BANK(MapObjectPals)
 	call FarCopyBytes
 
--- a/mobile/mobile_5f.asm
+++ b/mobile/mobile_5f.asm
@@ -49,7 +49,7 @@
 
 	ld hl, HaveWantPals
 	ld de, UnknBGPals
-	ld bc, $80
+	ld bc, 16 palettes
 	call CopyBytes
 
 	pop af
@@ -1964,8 +1964,8 @@
 	ld a, $5
 	ld [rSVBK], a
 	ld hl, UnknBGPals
-	ld de, $8
-	ld c, $8
+	ld de, 1 palettes
+	ld c, 8
 .asm_17dcbb
 	push hl
 	ld a, $ff
--- a/tilesets/animations.asm
+++ b/tilesets/animations.asm
@@ -954,7 +954,7 @@
 	jr z, .color2
 
 .color1
-	ld hl, UnknBGPals + $1a ; pal 3 color 1
+	ld hl, UnknBGPals + palette 3 + 2
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -962,7 +962,7 @@
 	jr .end
 
 .color0
-	ld hl, UnknBGPals + $18 ; pal 3 color 0
+	ld hl, UnknBGPals + palette 3
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -970,7 +970,7 @@
 	jr .end
 
 .color2
-	ld hl, UnknBGPals + $1c ; pal 3 color 2
+	ld hl, UnknBGPals + palette 3 + 4
 	ld a, [hli]
 	ld [rBGPD], a
 	ld a, [hli]
@@ -1007,11 +1007,11 @@
 	ld a, [hVBlankCounter]
 	and %00000010
 	jr nz, .bit1set
-	ld hl, UnknBGPals + $20 ; pal 4 color 0
+	ld hl, UnknBGPals + palette 4
 	jr .okay
 
 .bit1set
-	ld hl, UnknBGPals + $22 ; pal 4 color 2
+	ld hl, UnknBGPals + palette 4 + 2
 
 .okay
 	ld a, [hli]