Rename TILESET_WIDTH to METATILE_ROW_WIDTH

This commit is contained in:
sphericalice 2021-10-25 20:51:04 +01:00
parent 5bce17cbce
commit 7b5267c799
3 changed files with 11 additions and 11 deletions

View file

@ -11,6 +11,11 @@
#define METATILE_ID(tileset, name) (METATILE_##tileset##_##name)
// Rows of metatiles do not actually have a strict width.
// This constant is used for calculations for finding the next row of metatiles
// for constructing large tiles, such as the Battle Pike's curtain tile.
#define METATILE_ROW_WIDTH 8
enum
{
CONNECTION_INVALID = -1,
@ -36,11 +41,6 @@ struct Tileset
/*0x14*/ TilesetCB callback;
};
// Tilesets do not actually have a strict width.
// This constant is simply used for the offset between rows of metatiles for
// large tiles, such as the Battle Pike's curtain tile.
#define TILESET_WIDTH 8
struct MapLayout
{
/*0x00*/ s32 width;

View file

@ -3959,7 +3959,7 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
{
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + x + MAP_OFFSET - 1,
gSaveBlock1Ptr->pos.y + y + MAP_OFFSET - 3,
(x + METATILE_BattlePike_CurtainFrames_Start) + (y * TILESET_WIDTH) + (tCurrentFrame * CURTAIN_HEIGHT * TILESET_WIDTH));
(x + METATILE_BattlePike_CurtainFrames_Start) + (y * METATILE_ROW_WIDTH) + (tCurrentFrame * CURTAIN_HEIGHT * METATILE_ROW_WIDTH));
}
}
DrawWholeMapView();

View file

@ -134,14 +134,14 @@ u16 MoveRotatingTileObjects(u8 puzzleNumber)
continue;
// Object is on a metatile after the puzzle tile section (never occurs, in both cases the puzzle tiles are last)
if ((u8)((metatile - puzzleTileStart) / TILESET_WIDTH) >= 5)
if ((u8)((metatile - puzzleTileStart) / METATILE_ROW_WIDTH) >= 5)
continue;
// Object is on a metatile in puzzle tile section, but not one of the currently rotating color
if ((u8)((metatile - puzzleTileStart) / TILESET_WIDTH) != puzzleNumber)
if ((u8)((metatile - puzzleTileStart) / METATILE_ROW_WIDTH) != puzzleNumber)
continue;
puzzleTileNum = (u8)((metatile - puzzleTileStart) % TILESET_WIDTH);
puzzleTileNum = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
// First 4 puzzle tiles are the colored arrows
if (puzzleTileNum < 4)
@ -221,7 +221,7 @@ void TurnRotatingTileObjects(void)
// prevPuzzleTileNum will similarly be a number [0-3] representing the arrow tile the object just moved from
// All the puzzles are oriented counter-clockwise and can only move 1 step at a time, so the difference between the current tile and the previous tile will always either be -1 or 3 (0-1, 1-2, 2-3, 3-0)
// Which means tileDifference will always either be -1 or 3 after the below subtraction, and rotation will always be ROTATE_COUNTERCLOCKWISE after the following conditionals
tileDifference = (u8)((metatile - puzzleTileStart) % TILESET_WIDTH);
tileDifference = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
tileDifference -= (sRotatingTilePuzzle->objects[i].prevPuzzleTileNum);
// Always true, see above
@ -331,7 +331,7 @@ static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 puzzleTileNum)
else
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
tileDifference = (u8)((metatile - puzzleTileStart) % TILESET_WIDTH);
tileDifference = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
tileDifference -= puzzleTileNum;
if (tileDifference < 0 || tileDifference == 3)