mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-02-21 11:43:37 +01:00
Merge pull request #1526 from sphericalice/doc-curtain-special
Document the CloseBattlePikeCurtain special
This commit is contained in:
commit
4f7f6c1082
@ -352,6 +352,7 @@
|
|||||||
#define METATILE_InsideShip_IntactDoor_Bottom_Interior 0x297
|
#define METATILE_InsideShip_IntactDoor_Bottom_Interior 0x297
|
||||||
|
|
||||||
// gTileset_BattlePike
|
// gTileset_BattlePike
|
||||||
|
#define METATILE_BattlePike_CurtainFrames_Start 0x201
|
||||||
#define METATILE_BattlePike_Curtain_Stage0_Tile0 0x24A
|
#define METATILE_BattlePike_Curtain_Stage0_Tile0 0x24A
|
||||||
#define METATILE_BattlePike_Curtain_Stage0_Tile1 0x251
|
#define METATILE_BattlePike_Curtain_Stage0_Tile1 0x251
|
||||||
#define METATILE_BattlePike_Curtain_Stage0_Tile2 0x252
|
#define METATILE_BattlePike_Curtain_Stage0_Tile2 0x252
|
||||||
|
@ -11,6 +11,11 @@
|
|||||||
|
|
||||||
#define METATILE_ID(tileset, name) (METATILE_##tileset##_##name)
|
#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
|
enum
|
||||||
{
|
{
|
||||||
CONNECTION_INVALID = -1,
|
CONNECTION_INVALID = -1,
|
||||||
|
@ -3910,13 +3910,18 @@ static void Task_LoopWingFlapSE(u8 taskId)
|
|||||||
#undef playCount
|
#undef playCount
|
||||||
#undef delay
|
#undef delay
|
||||||
|
|
||||||
|
#define CURTAIN_HEIGHT 4
|
||||||
|
#define CURTAIN_WIDTH 3
|
||||||
|
#define tFrameTimer data
|
||||||
|
#define tCurrentFrame data[3]
|
||||||
|
|
||||||
void CloseBattlePikeCurtain(void)
|
void CloseBattlePikeCurtain(void)
|
||||||
{
|
{
|
||||||
u8 taskId = CreateTask(Task_CloseBattlePikeCurtain, 8);
|
u8 taskId = CreateTask(Task_CloseBattlePikeCurtain, 8);
|
||||||
gTasks[taskId].data[0] = 4;
|
gTasks[taskId].tFrameTimer[0] = 4;
|
||||||
gTasks[taskId].data[1] = 4;
|
gTasks[taskId].tFrameTimer[1] = 4;
|
||||||
gTasks[taskId].data[2] = 4;
|
gTasks[taskId].tFrameTimer[2] = 4;
|
||||||
gTasks[taskId].data[3] = 0;
|
gTasks[taskId].tCurrentFrame = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_CloseBattlePikeCurtain(u8 taskId)
|
static void Task_CloseBattlePikeCurtain(u8 taskId)
|
||||||
@ -3924,19 +3929,21 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
|
|||||||
u8 x, y;
|
u8 x, y;
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
data[data[3]]--;
|
tFrameTimer[tCurrentFrame]--;
|
||||||
if (data[data[3]] == 0)
|
if (tFrameTimer[tCurrentFrame] == 0)
|
||||||
{
|
{
|
||||||
for (y = 0; y < 4; y++)
|
for (y = 0; y < CURTAIN_HEIGHT; y++)
|
||||||
{
|
{
|
||||||
for (x = 0; x < 3; x++)
|
for (x = 0; x < CURTAIN_WIDTH; x++)
|
||||||
{
|
{
|
||||||
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + x + 6, gSaveBlock1Ptr->pos.y + y + 4, x + 513 + y * 8 + data[3] * 32);
|
MapGridSetMetatileIdAt(gSaveBlock1Ptr->pos.x + x + MAP_OFFSET - 1,
|
||||||
|
gSaveBlock1Ptr->pos.y + y + MAP_OFFSET - 3,
|
||||||
|
(x + METATILE_BattlePike_CurtainFrames_Start) + (y * METATILE_ROW_WIDTH) + (tCurrentFrame * CURTAIN_HEIGHT * METATILE_ROW_WIDTH));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DrawWholeMapView();
|
DrawWholeMapView();
|
||||||
data[3]++;
|
tCurrentFrame++;
|
||||||
if (data[3] == 3)
|
if (tCurrentFrame == 3)
|
||||||
{
|
{
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
EnableBothScriptContexts();
|
EnableBothScriptContexts();
|
||||||
@ -3944,6 +3951,11 @@ static void Task_CloseBattlePikeCurtain(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef CURTAIN_HEIGHT
|
||||||
|
#undef CURTAIN_WIDTH
|
||||||
|
#undef tFrameTimer
|
||||||
|
#undef tCurrentFrame
|
||||||
|
|
||||||
void GetBattlePyramidHint(void)
|
void GetBattlePyramidHint(void)
|
||||||
{
|
{
|
||||||
gSpecialVar_Result = gSpecialVar_0x8004 / 7;
|
gSpecialVar_Result = gSpecialVar_0x8004 / 7;
|
||||||
|
@ -134,14 +134,14 @@ u16 MoveRotatingTileObjects(u8 puzzleNumber)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Object is on a metatile after the puzzle tile section (never occurs, in both cases the puzzle tiles are last)
|
// Object is on a metatile after the puzzle tile section (never occurs, in both cases the puzzle tiles are last)
|
||||||
if ((u8)((metatile - puzzleTileStart) / 8) >= 5)
|
if ((u8)((metatile - puzzleTileStart) / METATILE_ROW_WIDTH) >= 5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Object is on a metatile in puzzle tile section, but not one of the currently rotating color
|
// Object is on a metatile in puzzle tile section, but not one of the currently rotating color
|
||||||
if ((u8)((metatile - puzzleTileStart) / 8) != puzzleNumber)
|
if ((u8)((metatile - puzzleTileStart) / METATILE_ROW_WIDTH) != puzzleNumber)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
puzzleTileNum = (u8)((metatile - puzzleTileStart) % 8);
|
puzzleTileNum = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
|
||||||
|
|
||||||
// First 4 puzzle tiles are the colored arrows
|
// First 4 puzzle tiles are the colored arrows
|
||||||
if (puzzleTileNum < 4)
|
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
|
// 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)
|
// 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
|
// 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) % 8);
|
tileDifference = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
|
||||||
tileDifference -= (sRotatingTilePuzzle->objects[i].prevPuzzleTileNum);
|
tileDifference -= (sRotatingTilePuzzle->objects[i].prevPuzzleTileNum);
|
||||||
|
|
||||||
// Always true, see above
|
// Always true, see above
|
||||||
@ -331,7 +331,7 @@ static void TurnUnsavedRotatingTileObject(u8 eventTemplateId, u8 puzzleTileNum)
|
|||||||
else
|
else
|
||||||
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
|
puzzleTileStart = METATILE_TrickHousePuzzle_Arrow_YellowOnWhite_Right;
|
||||||
|
|
||||||
tileDifference = (u8)((metatile - puzzleTileStart) % 8);
|
tileDifference = (u8)((metatile - puzzleTileStart) % METATILE_ROW_WIDTH);
|
||||||
tileDifference -= puzzleTileNum;
|
tileDifference -= puzzleTileNum;
|
||||||
|
|
||||||
if (tileDifference < 0 || tileDifference == 3)
|
if (tileDifference < 0 || tileDifference == 3)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user