ref: 145efc13535fbc9d8ab2786d29209d97aebf0481
parent: aec3802587c8cd6955cce119d56a4e4970e83ba5
author: Rangi <remy.oukaour+rangi42@gmail.com>
date: Wed Apr 4 12:14:48 EDT 2018
Use constants for screen size in metatiles
--- a/constants/gfx_constants.asm
+++ b/constants/gfx_constants.asm
@@ -18,8 +18,10 @@
BG_MAP_HEIGHT EQU 32 ; tiles
METATILE_WIDTH EQU 4 ; tiles
-SURROUNDING_WIDTH EQU 6 * METATILE_WIDTH ; tiles
-SURROUNDING_HEIGHT EQU 5 * METATILE_WIDTH ; tiles
+SCREEN_META_WIDTH EQU 6 ; metatiles
+SCREEN_META_HEIGHT EQU 5 ; metatiles
+SURROUNDING_WIDTH EQU SCREEN_META_WIDTH * METATILE_WIDTH ; tiles
+SURROUNDING_HEIGHT EQU SCREEN_META_HEIGHT * METATILE_WIDTH ; tiles
HP_BAR_LENGTH EQU 6 ; tiles
--- a/home/map.asm
+++ b/home/map.asm
@@ -1454,8 +1454,8 @@
ld h, [hl]
ld l, a
ld de, wScreenSave
- ld c, $5
- ld b, $6
+ ld c, SCREEN_META_HEIGHT
+ ld b, SCREEN_META_WIDTH
.row
push bc
push hl
@@ -1467,9 +1467,9 @@
jr nz, .col
pop hl
ld a, [wMapWidth]
- add $6
+ add 6
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
pop bc
dec c
@@ -1498,10 +1498,10 @@
ret
.up
- ld de, wScreenSave + 6
+ ld de, wScreenSave + SCREEN_META_WIDTH
ld a, [hMapObjectIndexBuffer]
ld c, a
- ld b, $0
+ ld b, 0
add hl, bc
jr .vertical
@@ -1508,8 +1508,8 @@
.down
ld de, wScreenSave
.vertical
- ld b, 6
- ld c, 4
+ ld b, SCREEN_META_WIDTH
+ ld c, SCREEN_META_HEIGHT - 1
jr SaveScreen_LoadNeighbor
.left
@@ -1520,8 +1520,8 @@
.right
ld de, wScreenSave
.horizontal
- ld b, 5
- ld c, 5
+ ld b, SCREEN_META_WIDTH - 1
+ ld c, SCREEN_META_HEIGHT
jr SaveScreen_LoadNeighbor
LoadNeighboringBlockData:: ; 28e3
@@ -1533,8 +1533,8 @@
add 6
ld [hConnectionStripLength], a
ld de, wScreenSave
- ld b, 6
- ld c, 5
+ ld b, SCREEN_META_WIDTH
+ ld c, SCREEN_META_HEIGHT
SaveScreen_LoadNeighbor:: ; 28f7
.row
--- a/wram.asm
+++ b/wram.asm
@@ -2769,7 +2769,7 @@
wMapNumber:: db ; dcb6 ; map number of current map
wYCoord:: db ; dcb7 ; current y coordinate relative to top-left corner of current map
wXCoord:: db ; dcb8 ; current x coordinate relative to top-left corner of current map
-wScreenSave:: ds 6 * 5
+wScreenSave:: ds SCREEN_META_WIDTH * SCREEN_META_HEIGHT
wCurrMapDataEnd::