From 09f2b74d6e2291fa7e4e8004ae7eedc9b7df389e Mon Sep 17 00:00:00 2001 From: Jaizu Date: Tue, 2 Nov 2021 07:27:02 +0100 Subject: Fix Secret Bases (thanks to Citrus Bolt) --- Triple-layer-metatiles.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Triple-layer-metatiles.md b/Triple-layer-metatiles.md index 7affc2c..95aa620 100644 --- a/Triple-layer-metatiles.md +++ b/Triple-layer-metatiles.md @@ -199,6 +199,31 @@ static bool8 IsMetatileLayerEmpty(const u16 *src) Note that when using the `pokemart` you have to absolutely make sure that no triple layer tiles are around the UI elements when the mart is open. The mart uses one BG layer for itself, which we need to take into account here. +### Fixing Secret Bases + +This one is a bit easier. All those changes go to `src/decoration.c` + +In `PlaceDecorationGraphicsDataBuffer`: + +```diff +- 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]] * 12 + sDecorTilemaps[shape].x[i]); +``` + +In `PlaceDecorationGraphics`: + +```diff +- 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] * 12) + 7] >> 12); +``` + +In `AddDecorationIconObjectFromObjectEvent`: + +```diff +- 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] * 12) + 7] >> 12); +``` + ## Updating existing tilesets As mentioned previously this method requires us 4 additional tilemap entries for each metatile. The normal tileset data does not contain that data and at this stage your game will just look corrupted. Luckily we can just run a simple python script to migrate old tilesets. It can be found here: https://gist.github.com/SBird1337/ccfa47b5ef41c454b637735d4574592a -- cgit v1.2.3