summaryrefslogtreecommitdiff
path: root/src/fieldmap.c
diff options
context:
space:
mode:
authorDiegoisawesome <diego@domoreaweso.me>2018-09-18 10:03:24 -0500
committerDiegoisawesome <diego@domoreaweso.me>2018-09-18 10:03:24 -0500
commit899ae7a59a2335917b3494b2b5c65dfa52faf4ce (patch)
tree8f921c44429758bc0387da5a875c30306a795504 /src/fieldmap.c
parent3303c416d45c8ed95912f44923a09cf68909abdc (diff)
Add defines for tile, metatile, and palette count
Diffstat (limited to 'src/fieldmap.c')
-rw-r--r--src/fieldmap.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/fieldmap.c b/src/fieldmap.c
index 019db9d0d..96f5d2b85 100644
--- a/src/fieldmap.c
+++ b/src/fieldmap.c
@@ -482,15 +482,15 @@ void MapGridSetMetatileEntryAt(int x, int y, u16 metatile)
u16 GetBehaviorByMetatileId(u16 metatile)
{
u16 *attributes;
- if (metatile <= 0x1ff)
+ if (metatile < NUM_METATILES_IN_PRIMARY)
{
attributes = gMapHeader.mapLayout->primaryTileset->metatileAttributes;
return attributes[metatile];
}
- else if (metatile <= 0x3ff)
+ else if (metatile < NUM_METATILES_TOTAL)
{
attributes = gMapHeader.mapLayout->secondaryTileset->metatileAttributes;
- return attributes[metatile - 0x200];
+ return attributes[metatile - NUM_METATILES_IN_PRIMARY];
}
else
{
@@ -979,7 +979,7 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1
}
else if (tileset->isSecondary == TRUE)
{
- LoadPalette(((u16*)tileset->palettes) + 0x60, destOffset, size);
+ LoadPalette(((u16*)tileset->palettes) + (NUM_PALS_IN_PRIMARY * 16), destOffset, size);
nullsub_3(destOffset, size >> 1);
}
else
@@ -992,35 +992,35 @@ void apply_map_tileset_palette(struct Tileset const *tileset, u16 destOffset, u1
void copy_map_tileset1_to_vram(struct MapLayout const *mapLayout)
{
- copy_tileset_patterns_to_vram(mapLayout->primaryTileset, 0x200, 0);
+ copy_tileset_patterns_to_vram(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0);
}
void copy_map_tileset2_to_vram(struct MapLayout const *mapLayout)
{
- copy_tileset_patterns_to_vram(mapLayout->secondaryTileset, 0x200, 0x200);
+ copy_tileset_patterns_to_vram(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY);
}
void copy_map_tileset2_to_vram_2(struct MapLayout const *mapLayout)
{
- copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, 0x200, 0x200);
+ copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY);
}
void apply_map_tileset1_palette(struct MapLayout const *mapLayout)
{
- apply_map_tileset_palette(mapLayout->primaryTileset, 0, 0xC0);
+ apply_map_tileset_palette(mapLayout->primaryTileset, 0, NUM_PALS_IN_PRIMARY * 16 * 2);
}
void apply_map_tileset2_palette(struct MapLayout const *mapLayout)
{
- apply_map_tileset_palette(mapLayout->secondaryTileset, 0x60, 0xE0);
+ apply_map_tileset_palette(mapLayout->secondaryTileset, NUM_PALS_IN_PRIMARY * 16, (NUM_PALS_TOTAL - NUM_PALS_IN_PRIMARY) * 16 * 2);
}
void copy_map_tileset1_tileset2_to_vram(struct MapLayout const *mapLayout)
{
if (mapLayout)
{
- copy_tileset_patterns_to_vram2(mapLayout->primaryTileset, 0x200, 0);
- copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, 0x200, 0x200);
+ copy_tileset_patterns_to_vram2(mapLayout->primaryTileset, NUM_TILES_IN_PRIMARY, 0);
+ copy_tileset_patterns_to_vram2(mapLayout->secondaryTileset, NUM_TILES_TOTAL - NUM_TILES_IN_PRIMARY, NUM_TILES_IN_PRIMARY);
}
}