Document field_tasks

This commit is contained in:
GriffinR 2021-11-16 21:34:47 -05:00
parent 61aa9c3ba9
commit eb95ac0b9c
7 changed files with 716 additions and 526 deletions

View File

@ -1298,7 +1298,7 @@
.byte 0xa5
.endm
@ Enables a function that gets called every step by Task_RunPerStepCallback.
@
.macro setstepcallback subroutine:req
.byte 0xa6
.byte \subroutine

View File

@ -117,10 +117,10 @@
#define MB_BRIDGE_OVER_POND_LOW 0x71
#define MB_BRIDGE_OVER_POND_MED 0x72
#define MB_BRIDGE_OVER_POND_HIGH 0x73
#define MB_PACIFIDLOG_VERTICAL_LOG_1 0x74
#define MB_PACIFIDLOG_VERTICAL_LOG_2 0x75
#define MB_PACIFIDLOG_HORIZONTAL_LOG_1 0x76
#define MB_PACIFIDLOG_HORIZONTAL_LOG_2 0x77
#define MB_PACIFIDLOG_VERTICAL_LOG_TOP 0x74
#define MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM 0x75
#define MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT 0x76
#define MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT 0x77
#define MB_FORTREE_BRIDGE 0x78
#define MB_UNUSED_79 0x79
#define MB_BRIDGE_OVER_POND_MED_EDGE_1 0x7A

View File

@ -182,22 +182,22 @@
#define METATILE_Cave_ShoalCave_BlueStone_Small 0x35B
// gTileset_Pacifidlog
#define METATILE_Pacifidlog_Door 0x21A
#define METATILE_Pacifidlog_FloatingLogs_Horizontal0 0x250
#define METATILE_Pacifidlog_FloatingLogs_Horizontal1 0x251
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal0 0x252
#define METATILE_Pacifidlog_HalfSubmergedLogs_Horizontal1 0x253
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal0 0x254
#define METATILE_Pacifidlog_SubmergedLogs_Horizontal1 0x255
#define METATILE_Pacifidlog_FloatingLogs_Vertical0 0x258
#define METATILE_Pacifidlog_FloatingLogs_Vertical1 0x260
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical0 0x259
#define METATILE_Pacifidlog_HalfSubmergedLogs_Vertical1 0x261
#define METATILE_Pacifidlog_SubmergedLogs_Vertical0 0x25A
#define METATILE_Pacifidlog_SubmergedLogs_Vertical1 0x262
#define METATILE_Pacifidlog_SkyPillar_CrackedFloor_Hole 0x237
#define METATILE_Pacifidlog_SkyPillar_DoorOpen_Top 0x2AA
#define METATILE_Pacifidlog_SkyPillar_DoorOpen_Bottom 0x2B2
#define METATILE_Pacifidlog_Door 0x21A
#define METATILE_Pacifidlog_FloatingLogs_HorizontalLeft 0x250
#define METATILE_Pacifidlog_FloatingLogs_HorizontalRight 0x251
#define METATILE_Pacifidlog_HalfSubmergedLogs_HorizontalLeft 0x252
#define METATILE_Pacifidlog_HalfSubmergedLogs_HorizontalRight 0x253
#define METATILE_Pacifidlog_SubmergedLogs_HorizontalLeft 0x254
#define METATILE_Pacifidlog_SubmergedLogs_HorizontalRight 0x255
#define METATILE_Pacifidlog_FloatingLogs_VerticalTop 0x258
#define METATILE_Pacifidlog_FloatingLogs_VerticalBottom 0x260
#define METATILE_Pacifidlog_HalfSubmergedLogs_VerticalTop 0x259
#define METATILE_Pacifidlog_HalfSubmergedLogs_VerticalBottom 0x261
#define METATILE_Pacifidlog_SubmergedLogs_VerticalTop 0x25A
#define METATILE_Pacifidlog_SubmergedLogs_VerticalBottom 0x262
#define METATILE_Pacifidlog_SkyPillar_CrackedFloor_Hole 0x237
#define METATILE_Pacifidlog_SkyPillar_DoorOpen_Top 0x2AA
#define METATILE_Pacifidlog_SkyPillar_DoorOpen_Bottom 0x2B2
// gTileset_Fortree
#define METATILE_Fortree_LongGrass_Root 0x208

View File

@ -102,10 +102,10 @@ bool8 MetatileBehavior_IsShortGrass(u8);
bool8 MetatileBehavior_IsHotSprings(u8);
bool8 MetatileBehavior_IsWaterfall(u8);
bool8 MetatileBehavior_IsFortreeBridge(u8);
bool8 MetatileBehavior_IsPacifidlogVerticalLog1(u8);
bool8 MetatileBehavior_IsPacifidlogVerticalLog2(u8);
bool8 MetatileBehavior_IsPacifidlogHorizontalLog1(u8);
bool8 MetatileBehavior_IsPacifidlogHorizontalLog2(u8);
bool8 MetatileBehavior_IsPacifidlogVerticalLogTop(u8);
bool8 MetatileBehavior_IsPacifidlogVerticalLogBottom(u8);
bool8 MetatileBehavior_IsPacifidlogHorizontalLogLeft(u8);
bool8 MetatileBehavior_IsPacifidlogHorizontalLogRight(u8);
bool8 MetatileBehavior_IsPacifidlogLog(u8);
bool8 MetatileBehavior_IsTrickHousePuzzleDoor(u8);
bool8 MetatileBehavior_IsRegionMap(u8);

File diff suppressed because it is too large Load Diff

View File

@ -126,10 +126,10 @@ static const u8 sTileBitAttributes[] =
[MB_BRIDGE_OVER_POND_LOW] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_MED] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_HIGH] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_2] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_TOP] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_FORTREE_BRIDGE] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
[MB_UNUSED_79] = TILE_ATTRIBUTES(FALSE, FALSE, FALSE),
[MB_BRIDGE_OVER_POND_MED_EDGE_1] = TILE_ATTRIBUTES(TRUE, FALSE, FALSE),
@ -1131,33 +1131,33 @@ bool8 MetatileBehavior_IsFortreeBridge(u8 metatileBehavior)
return FALSE;
}
bool8 MetatileBehavior_IsPacifidlogVerticalLog1(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogVerticalLogTop(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_1)
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_TOP)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPacifidlogVerticalLog2(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogVerticalLogBottom(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_2)
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPacifidlogHorizontalLog1(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogHorizontalLogLeft(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_1)
if (metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT)
return TRUE;
else
return FALSE;
}
bool8 MetatileBehavior_IsPacifidlogHorizontalLog2(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogHorizontalLogRight(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_2)
if (metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT)
return TRUE;
else
return FALSE;
@ -1165,10 +1165,10 @@ bool8 MetatileBehavior_IsPacifidlogHorizontalLog2(u8 metatileBehavior)
bool8 MetatileBehavior_IsPacifidlogLog(u8 metatileBehavior)
{
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_1
|| metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_2
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_1
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_2)
if (metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_TOP
|| metatileBehavior == MB_PACIFIDLOG_VERTICAL_LOG_BOTTOM
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_LEFT
|| metatileBehavior == MB_PACIFIDLOG_HORIZONTAL_LOG_RIGHT)
return TRUE;
else
return FALSE;

View File

@ -1214,109 +1214,108 @@ void SecretBasePerStepCallback(u8 taskId)
tState = 1;
break;
case 1:
// End if player hasn't moved
PlayerGetDestCoords(&x, &y);
if (x != tPlayerX || y != tPlayerY)
{
tPlayerX = x;
tPlayerY = y;
VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1);
behavior = MapGridGetMetatileBehaviorAt(x, y);
tileId = MapGridGetMetatileIdAt(x, y);
if (tileId == METATILE_SecretBase_SolidBoard_Top || tileId == METATILE_SecretBase_SolidBoard_Bottom)
{
if (sInFriendSecretBase == TRUE)
{
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SOLID_BOARD);
}
}
else if (tileId == METATILE_SecretBase_SmallChair
|| tileId == METATILE_SecretBase_PokemonChair
|| tileId == METATILE_SecretBase_HeavyChair
|| tileId == METATILE_SecretBase_PrettyChair
|| tileId == METATILE_SecretBase_ComfortChair
|| tileId == METATILE_SecretBase_RaggedChair
|| tileId == METATILE_SecretBase_BrickChair
|| tileId == METATILE_SecretBase_CampChair
|| tileId == METATILE_SecretBase_HardChair)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_CHAIR);
}
else if (tileId == METATILE_SecretBase_RedTent_DoorTop
|| tileId == METATILE_SecretBase_RedTent_Door
|| tileId == METATILE_SecretBase_BlueTent_DoorTop
|| tileId == METATILE_SecretBase_BlueTent_Door)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_TENT);
}
else if ((behavior == MB_IMPASSABLE_NORTHEAST && tileId == METATILE_SecretBase_Stand_CornerRight)
|| (behavior == MB_IMPASSABLE_NORTHWEST && MapGridGetMetatileIdAt(x, y) == METATILE_SecretBase_Stand_CornerLeft))
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_STAND);
}
else if (behavior == MB_IMPASSABLE_WEST_AND_EAST && tileId == METATILE_SecretBase_Slide_StairLanding)
{
if (sInFriendSecretBase == TRUE)
{
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ SECRET_BASE_USED_SLIDE);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_DECLINED_SLIDE);
}
}
else if (behavior == MB_SLIDE_SOUTH && tileId == METATILE_SecretBase_Slide_SlideTop)
{
if (sInFriendSecretBase == TRUE)
{
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SLIDE);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ SECRET_BASE_DECLINED_SLIDE);
}
}
else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_GLITTER_MAT);
}
else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE)
{
PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y);
if (sInFriendSecretBase == TRUE)
{
switch ((int)MapGridGetMetatileIdAt(x, y))
{
case METATILE_SecretBase_RedBalloon:
case METATILE_SecretBase_BlueBalloon:
case METATILE_SecretBase_YellowBalloon:
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_BALLOON);
break;
case METATILE_SecretBase_MudBall:
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_MUD_BALL);
break;
}
}
}
else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_BREAKABLE_DOOR);
if (x == tPlayerX && y == tPlayerY)
return;
ShatterSecretBaseBreakableDoor(x, y);
}
else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_NOTE_MAT);
}
else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE)
tPlayerX = x;
tPlayerY = y;
VarSet(VAR_SECRET_BASE_STEP_COUNTER, VarGet(VAR_SECRET_BASE_STEP_COUNTER) + 1);
behavior = MapGridGetMetatileBehaviorAt(x, y);
tileId = MapGridGetMetatileIdAt(x, y);
if (tileId == METATILE_SecretBase_SolidBoard_Top || tileId == METATILE_SecretBase_SolidBoard_Bottom)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SOLID_BOARD);
}
else if (tileId == METATILE_SecretBase_SmallChair
|| tileId == METATILE_SecretBase_PokemonChair
|| tileId == METATILE_SecretBase_HeavyChair
|| tileId == METATILE_SecretBase_PrettyChair
|| tileId == METATILE_SecretBase_ComfortChair
|| tileId == METATILE_SecretBase_RaggedChair
|| tileId == METATILE_SecretBase_BrickChair
|| tileId == METATILE_SecretBase_CampChair
|| tileId == METATILE_SecretBase_HardChair)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_CHAIR);
}
else if (tileId == METATILE_SecretBase_RedTent_DoorTop
|| tileId == METATILE_SecretBase_RedTent_Door
|| tileId == METATILE_SecretBase_BlueTent_DoorTop
|| tileId == METATILE_SecretBase_BlueTent_Door)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_TENT);
}
else if ((behavior == MB_IMPASSABLE_NORTHEAST && tileId == METATILE_SecretBase_Stand_CornerRight)
|| (behavior == MB_IMPASSABLE_NORTHWEST && MapGridGetMetatileIdAt(x, y) == METATILE_SecretBase_Stand_CornerLeft))
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_STAND);
}
else if (behavior == MB_IMPASSABLE_WEST_AND_EAST && tileId == METATILE_SecretBase_Slide_StairLanding)
{
if (sInFriendSecretBase == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_JUMP_MAT);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ SECRET_BASE_USED_SLIDE);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_DECLINED_SLIDE);
}
else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE)
}
else if (behavior == MB_SLIDE_SOUTH && tileId == METATILE_SecretBase_Slide_SlideTop)
{
if (sInFriendSecretBase == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SPIN_MAT);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SLIDE);
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) ^ SECRET_BASE_DECLINED_SLIDE);
}
}
else if (MetatileBehavior_IsSecretBaseGlitterMat(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_GLITTER_MAT);
}
else if (MetatileBehavior_IsSecretBaseBalloon(behavior) == TRUE)
{
PopSecretBaseBalloon(MapGridGetMetatileIdAt(x, y), x, y);
if (sInFriendSecretBase == TRUE)
{
switch ((int)MapGridGetMetatileIdAt(x, y))
{
case METATILE_SecretBase_RedBalloon:
case METATILE_SecretBase_BlueBalloon:
case METATILE_SecretBase_YellowBalloon:
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_BALLOON);
break;
case METATILE_SecretBase_MudBall:
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_MUD_BALL);
break;
}
}
}
else if (MetatileBehavior_IsSecretBaseBreakableDoor(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_BREAKABLE_DOOR);
ShatterSecretBaseBreakableDoor(x, y);
}
else if (MetatileBehavior_IsSecretBaseSoundMat(behavior) == TRUE){
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_LOW_TV_FLAGS, VarGet(VAR_SECRET_BASE_LOW_TV_FLAGS) | SECRET_BASE_USED_NOTE_MAT);
}
else if (MetatileBehavior_IsSecretBaseJumpMat(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_JUMP_MAT);
}
else if (MetatileBehavior_IsSecretBaseSpinMat(behavior) == TRUE)
{
if (sInFriendSecretBase == TRUE)
VarSet(VAR_SECRET_BASE_HIGH_TV_FLAGS, VarGet(VAR_SECRET_BASE_HIGH_TV_FLAGS) | SECRET_BASE_USED_SPIN_MAT);
}
break;
case 2:
// This state is never reached, and tFldEff is never set