mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Add NUM_TILES_PER_METATILE
This commit is contained in:
parent
dc24fde7f6
commit
f55443656f
@ -9,6 +9,8 @@
|
||||
#define NUM_PALS_TOTAL 13
|
||||
#define MAX_MAP_DATA_SIZE 10240
|
||||
|
||||
#define NUM_TILES_PER_METATILE 8
|
||||
|
||||
// Map coordinates are offset by 7 when using the map
|
||||
// buffer because it needs to load sufficient border
|
||||
// metatiles to fill the player's view (the player has
|
||||
|
@ -1977,7 +1977,7 @@ static void SetDecorSelectionMetatiles(struct PlaceDecorationGraphicsDataBuffer
|
||||
shape = data->decoration->shape;
|
||||
for (i = 0; i < sDecorTilemaps[shape].size; i++)
|
||||
{
|
||||
data->tiles[sDecorTilemaps[shape].tiles[i]] = GetMetatile(data->decoration->tiles[sDecorTilemaps[shape].y[i]] * 8 + sDecorTilemaps[shape].x[i]);
|
||||
data->tiles[sDecorTilemaps[shape].tiles[i]] = GetMetatile(data->decoration->tiles[sDecorTilemaps[shape].y[i]] * NUM_TILES_PER_METATILE + sDecorTilemaps[shape].x[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2037,7 +2037,7 @@ static u8 gpu_pal_decompress_alloc_tag_and_upload(struct PlaceDecorationGraphics
|
||||
SetDecorSelectionMetatiles(data);
|
||||
SetDecorSelectionBoxOamAttributes(data->decoration->shape);
|
||||
SetDecorSelectionBoxTiles(data);
|
||||
CopyPalette(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * 8) + 7] >> 12);
|
||||
CopyPalette(data->palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(data->decoration->tiles[0] * NUM_TILES_PER_METATILE) + 7] >> 12);
|
||||
LoadSpritePalette(&sSpritePal_PlaceDecoration);
|
||||
return CreateSprite(&sDecorationSelectorSpriteTemplate, 0, 0, 0);
|
||||
}
|
||||
@ -2093,7 +2093,7 @@ static u8 AddDecorationIconObjectFromObjectEvent(u16 tilesTag, u16 paletteTag, u
|
||||
SetDecorSelectionMetatiles(&sPlaceDecorationGraphicsDataBuffer);
|
||||
SetDecorSelectionBoxOamAttributes(sPlaceDecorationGraphicsDataBuffer.decoration->shape);
|
||||
SetDecorSelectionBoxTiles(&sPlaceDecorationGraphicsDataBuffer);
|
||||
CopyPalette(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * 8) + 7] >> 12);
|
||||
CopyPalette(sPlaceDecorationGraphicsDataBuffer.palette, ((u16 *)gTilesetPointer_SecretBaseRedCave->metatiles)[(sPlaceDecorationGraphicsDataBuffer.decoration->tiles[0] * NUM_TILES_PER_METATILE) + 7] >> 12);
|
||||
sheet.data = sPlaceDecorationGraphicsDataBuffer.image;
|
||||
sheet.size = sDecorShapeSizes[sPlaceDecorationGraphicsDataBuffer.decoration->shape] * TILE_SIZE_4BPP;
|
||||
sheet.tag = tilesTag;
|
||||
|
@ -237,7 +237,7 @@ static void DrawMetatileAt(const struct MapLayout *mapLayout, u16 offset, int x,
|
||||
metatiles = mapLayout->secondaryTileset->metatiles;
|
||||
metatileId -= NUM_METATILES_IN_PRIMARY;
|
||||
}
|
||||
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * 8, offset);
|
||||
DrawMetatile(MapGridGetMetatileLayerTypeAt(x, y), metatiles + metatileId * NUM_TILES_PER_METATILE, offset);
|
||||
}
|
||||
|
||||
static void DrawMetatile(s32 metatileLayerType, const u16 *tiles, u16 offset)
|
||||
|
@ -808,9 +808,9 @@ static void BuyMenuDrawMapBg(void)
|
||||
metatileLayerType = METATILE_LAYER_TYPE_COVERED;
|
||||
|
||||
if (metatile < NUM_METATILES_IN_PRIMARY)
|
||||
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * 8, metatileLayerType);
|
||||
BuyMenuDrawMapMetatile(i, j, mapLayout->primaryTileset->metatiles + metatile * NUM_TILES_PER_METATILE, metatileLayerType);
|
||||
else
|
||||
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * 8), metatileLayerType);
|
||||
BuyMenuDrawMapMetatile(i, j, mapLayout->secondaryTileset->metatiles + ((metatile - NUM_METATILES_IN_PRIMARY) * NUM_TILES_PER_METATILE), metatileLayerType);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user