summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/field_camera.c6
-rw-r--r--src/fieldmap.c22
2 files changed, 14 insertions, 14 deletions
diff --git a/src/field_camera.c b/src/field_camera.c
index 8629bec2b..e8900e06a 100644
--- a/src/field_camera.c
+++ b/src/field_camera.c
@@ -232,14 +232,14 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 b, int c, int
u16 metatileId = MapGridGetMetatileIdAt(c, d);
u16 *metatiles;
- if (metatileId > 1024)
+ if (metatileId > NUM_METATILES_TOTAL)
metatileId = 0;
- if (metatileId < 512)
+ if (metatileId < NUM_METATILES_IN_PRIMARY)
metatiles = mapLayout->primaryTileset->metatiles;
else
{
metatiles = mapLayout->secondaryTileset->metatiles;
- metatileId -= 512;
+ metatileId -= NUM_METATILES_IN_PRIMARY;
}
DrawMetatile(MapGridGetMetatileLayerTypeAt(c, d), metatiles + metatileId * 8, b);
}
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);
}
}