Cleaned up and reordered functions
This commit is contained in:
parent
fe428fc89b
commit
04faf370e6
4 changed files with 248 additions and 207 deletions
|
@ -43,6 +43,6 @@ void FadeOutOrbEffect(void);
|
||||||
void WriteFlashScanlineEffectBuffer(u8 flashLevel);
|
void WriteFlashScanlineEffectBuffer(u8 flashLevel);
|
||||||
bool8 IsPlayerStandingStill(void);
|
bool8 IsPlayerStandingStill(void);
|
||||||
void DoStairWarp(u16 metatileBehavior, u16 delay);
|
void DoStairWarp(u16 metatileBehavior, u16 delay);
|
||||||
bool8 IsDirectionalStairWarpMetatileBehavior(u16 metatileBehavior, u8 playerDirection);
|
bool32 IsDirectionalStairWarpMetatileBehavior(u16 metatileBehavior, u8 playerDirection);
|
||||||
|
|
||||||
#endif // GUARD_FIELD_SCREEN_EFFECT_H
|
#endif // GUARD_FIELD_SCREEN_EFFECT_H
|
||||||
|
|
|
@ -727,34 +727,38 @@ static bool8 CheckStandardWildEncounter(u16 metatileBehavior)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void StorePlayerStateAndSetupWarp(struct MapPosition *position, s32 warpEventId)
|
||||||
|
{
|
||||||
|
StoreInitialPlayerAvatarState();
|
||||||
|
SetupWarp(&gMapHeader, warpEventId, position);
|
||||||
|
}
|
||||||
|
|
||||||
static bool8 TryArrowWarp(struct MapPosition *position, u16 metatileBehavior, u8 direction)
|
static bool8 TryArrowWarp(struct MapPosition *position, u16 metatileBehavior, u8 direction)
|
||||||
{
|
{
|
||||||
s8 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position);
|
s32 warpEventId = GetWarpEventAtMapPosition(&gMapHeader, position);
|
||||||
u16 delay;
|
u32 delay;
|
||||||
|
|
||||||
if (warpEventId != WARP_ID_NONE)
|
if (warpEventId == WARP_ID_NONE)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE)
|
||||||
{
|
{
|
||||||
if (IsArrowWarpMetatileBehavior(metatileBehavior, direction) == TRUE)
|
StorePlayerStateAndSetupWarp(position, warpEventId);
|
||||||
|
DoWarp();
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else if (IsDirectionalStairWarpMetatileBehavior(metatileBehavior, direction) == TRUE)
|
||||||
|
{
|
||||||
|
delay = 0;
|
||||||
|
if (gPlayerAvatar.flags & PLAYER_AVATAR_FLAG_BIKE)
|
||||||
{
|
{
|
||||||
StoreInitialPlayerAvatarState();
|
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
|
||||||
SetupWarp(&gMapHeader, warpEventId, position);
|
delay = 12;
|
||||||
DoWarp();
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else if (IsDirectionalStairWarpMetatileBehavior(metatileBehavior, direction) == TRUE)
|
|
||||||
{
|
|
||||||
delay = 0;
|
|
||||||
if (gPlayerAvatar.flags & (PLAYER_AVATAR_FLAG_MACH_BIKE | PLAYER_AVATAR_FLAG_ACRO_BIKE))
|
|
||||||
{
|
|
||||||
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
|
|
||||||
delay = 12;
|
|
||||||
}
|
|
||||||
|
|
||||||
StoreInitialPlayerAvatarState();
|
|
||||||
SetupWarp(&gMapHeader, warpEventId, position);
|
|
||||||
DoStairWarp(metatileBehavior, delay);
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StorePlayerStateAndSetupWarp(position, warpEventId);
|
||||||
|
DoStairWarp(metatileBehavior, delay);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,14 @@ static void Task_SpinEnterWarp(u8 taskId);
|
||||||
static void Task_WarpAndLoadMap(u8 taskId);
|
static void Task_WarpAndLoadMap(u8 taskId);
|
||||||
static void Task_DoDoorWarp(u8 taskId);
|
static void Task_DoDoorWarp(u8 taskId);
|
||||||
static void Task_EnableScriptAfterMusicFade(u8 taskId);
|
static void Task_EnableScriptAfterMusicFade(u8 taskId);
|
||||||
static void Task_ExitStairs(u8 taskId);
|
|
||||||
|
static void ExitStairsMovement(s16*, s16*, s16*, s16*, s16*);
|
||||||
|
static void GetStairsMovementDirection(u32, s16*, s16*);
|
||||||
|
static void Task_ExitStairs(u8);
|
||||||
|
static bool8 WaitStairExitMovementFinished(s16*, s16*, s16*, s16*, s16*);
|
||||||
|
static void UpdateStairsMovement(s16, s16, s16*, s16*, s16*);
|
||||||
|
static void Task_StairWarp(u8);
|
||||||
|
static void ForceStairsMovement(u32, s16*, s16*);
|
||||||
|
|
||||||
// data[0] is used universally by tasks in this file as a state for switches
|
// data[0] is used universally by tasks in this file as a state for switches
|
||||||
#define tState data[0]
|
#define tState data[0]
|
||||||
|
@ -1328,129 +1335,6 @@ static bool32 PrintWhiteOutRecoveryMessage(u8 taskId, const u8 *text, u32 x, u32
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void GetStairsMovementDirection(u8 a0, s16 *a1, s16 *a2)
|
|
||||||
{
|
|
||||||
if (MetatileBehavior_IsDirectionalUpRightStairWarp(a0))
|
|
||||||
{
|
|
||||||
*a1 = 16;
|
|
||||||
*a2 = -10;
|
|
||||||
}
|
|
||||||
else if (MetatileBehavior_IsDirectionalUpLeftStairWarp(a0))
|
|
||||||
{
|
|
||||||
*a1 = -17;
|
|
||||||
*a2 = -10;
|
|
||||||
}
|
|
||||||
else if (MetatileBehavior_IsDirectionalDownRightStairWarp(a0))
|
|
||||||
{
|
|
||||||
*a1 = 17;
|
|
||||||
*a2 = 3;
|
|
||||||
}
|
|
||||||
else if (MetatileBehavior_IsDirectionalDownLeftStairWarp(a0))
|
|
||||||
{
|
|
||||||
*a1 = -17;
|
|
||||||
*a2 = 3;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*a1 = 0;
|
|
||||||
*a2 = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool8 WaitStairExitMovementFinished(s16 *a0, s16 *a1, s16 *a2, s16 *a3, s16 *a4)
|
|
||||||
{
|
|
||||||
struct Sprite *sprite;
|
|
||||||
sprite = &gSprites[gPlayerAvatar.spriteId];
|
|
||||||
if (*a4 != 0)
|
|
||||||
{
|
|
||||||
*a2 += *a0;
|
|
||||||
*a3 += *a1;
|
|
||||||
sprite->x2 = *a2 >> 5;
|
|
||||||
sprite->y2 = *a3 >> 5;
|
|
||||||
(*a4)--;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sprite->x2 = 0;
|
|
||||||
sprite->y2 = 0;
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ExitStairsMovement(s16 *a0, s16 *a1, s16 *a2, s16 *a3, s16 *a4)
|
|
||||||
{
|
|
||||||
s16 x, y;
|
|
||||||
u8 behavior;
|
|
||||||
s32 r1;
|
|
||||||
struct Sprite *sprite;
|
|
||||||
|
|
||||||
PlayerGetDestCoords(&x, &y);
|
|
||||||
behavior = MapGridGetMetatileBehaviorAt(x, y);
|
|
||||||
if (MetatileBehavior_IsDirectionalDownRightStairWarp(behavior) || MetatileBehavior_IsDirectionalUpRightStairWarp(behavior))
|
|
||||||
r1 = 3;
|
|
||||||
else
|
|
||||||
r1 = 4;
|
|
||||||
|
|
||||||
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceSlowMovementAction(r1));
|
|
||||||
GetStairsMovementDirection(behavior, a0, a1);
|
|
||||||
*a2 = *a0 * 16;
|
|
||||||
*a3 = *a1 * 16;
|
|
||||||
*a4 = 16;
|
|
||||||
sprite = &gSprites[gPlayerAvatar.spriteId];
|
|
||||||
sprite->x2 = *a2 >> 5;
|
|
||||||
sprite->y2 = *a3 >> 5;
|
|
||||||
*a0 *= -1;
|
|
||||||
*a1 *= -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Task_ExitStairs(u8 taskId)
|
|
||||||
{
|
|
||||||
s16 * data = gTasks[taskId].data;
|
|
||||||
switch (data[0])
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
if (WaitForWeatherFadeIn() == TRUE)
|
|
||||||
{
|
|
||||||
CameraObjectReset();
|
|
||||||
UnlockPlayerFieldControls();
|
|
||||||
DestroyTask(taskId);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 0:
|
|
||||||
Overworld_PlaySpecialMapMusic();
|
|
||||||
WarpFadeInScreen();
|
|
||||||
LockPlayerFieldControls();
|
|
||||||
ExitStairsMovement(&data[1], &data[2], &data[3], &data[4], &data[5]);
|
|
||||||
data[0]++;
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
if (!WaitStairExitMovementFinished(&data[1], &data[2], &data[3], &data[4], &data[5]))
|
|
||||||
data[0]++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool8 IsDirectionalStairWarpMetatileBehavior(u16 metatileBehavior, u8 playerDirection)
|
|
||||||
{
|
|
||||||
switch (playerDirection)
|
|
||||||
{
|
|
||||||
case DIR_WEST:
|
|
||||||
if (MetatileBehavior_IsDirectionalUpLeftStairWarp(metatileBehavior))
|
|
||||||
return TRUE;
|
|
||||||
if (MetatileBehavior_IsDirectionalDownLeftStairWarp(metatileBehavior))
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
case DIR_EAST:
|
|
||||||
if (MetatileBehavior_IsDirectionalUpRightStairWarp(metatileBehavior))
|
|
||||||
return TRUE;
|
|
||||||
if (MetatileBehavior_IsDirectionalDownRightStairWarp(metatileBehavior))
|
|
||||||
return TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
FRLG_WHITEOUT_ENTER_MSG_SCREEN,
|
FRLG_WHITEOUT_ENTER_MSG_SCREEN,
|
||||||
FRLG_WHITEOUT_PRINT_MSG,
|
FRLG_WHITEOUT_PRINT_MSG,
|
||||||
|
@ -1517,86 +1401,236 @@ void FieldCB_RushInjuredPokemonToCenter(void)
|
||||||
gTasks[taskId].tState = FRLG_WHITEOUT_ENTER_MSG_SCREEN;
|
gTasks[taskId].tState = FRLG_WHITEOUT_ENTER_MSG_SCREEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ForceStairsMovement(u16 a0, s16 *a1, s16 *a2)
|
static void GetStairsMovementDirection(u32 metatileBehavior, s16 *speedX, s16 *speedY)
|
||||||
{
|
{
|
||||||
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
if (MetatileBehavior_IsDirectionalUpRightStairWarp(metatileBehavior))
|
||||||
GetStairsMovementDirection(a0, a1, a2);
|
{
|
||||||
|
*speedX = 16;
|
||||||
|
*speedY = -10;
|
||||||
|
}
|
||||||
|
else if (MetatileBehavior_IsDirectionalUpLeftStairWarp(metatileBehavior))
|
||||||
|
{
|
||||||
|
*speedX = -17;
|
||||||
|
*speedY = -10;
|
||||||
|
}
|
||||||
|
else if (MetatileBehavior_IsDirectionalDownRightStairWarp(metatileBehavior))
|
||||||
|
{
|
||||||
|
*speedX = 17;
|
||||||
|
*speedY = 3;
|
||||||
|
}
|
||||||
|
else if (MetatileBehavior_IsDirectionalDownLeftStairWarp(metatileBehavior))
|
||||||
|
{
|
||||||
|
*speedX = -17;
|
||||||
|
*speedY = 3;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*speedX = 0;
|
||||||
|
*speedY = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void UpdateStairsMovement(s16 a0, s16 a1, s16 *a2, s16 *a3, s16 *a4)
|
static bool8 WaitStairExitMovementFinished(s16 *speedX, s16 *speedY, s16 *offsetX, s16 *offsetY, s16 *timer)
|
||||||
{
|
{
|
||||||
struct Sprite *playerSpr = &gSprites[gPlayerAvatar.spriteId];
|
struct Sprite *sprite;
|
||||||
struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
sprite = &gSprites[gPlayerAvatar.spriteId];
|
||||||
|
if (*timer != 0)
|
||||||
|
{
|
||||||
|
*offsetX += *speedX;
|
||||||
|
*offsetY += *speedY;
|
||||||
|
sprite->x2 = *offsetX >> 5;
|
||||||
|
sprite->y2 = *offsetY >> 5;
|
||||||
|
(*timer)--;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite->x2 = 0;
|
||||||
|
sprite->y2 = 0;
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (a1 > 0 || *a4 > 6)
|
static void ExitStairsMovement(s16 *speedX, s16 *speedY, s16 *offsetX, s16 *offsetY, s16 *timer)
|
||||||
*a3 += a1;
|
{
|
||||||
|
s16 x, y;
|
||||||
|
u32 metatileBehavior;
|
||||||
|
s32 direction;
|
||||||
|
struct Sprite *sprite;
|
||||||
|
|
||||||
*a2 += a0;
|
PlayerGetDestCoords(&x, &y);
|
||||||
(*a4)++;
|
metatileBehavior = MapGridGetMetatileBehaviorAt(x, y);
|
||||||
playerSpr->x2 = *a2 >> 5;
|
if (MetatileBehavior_IsDirectionalDownRightStairWarp(metatileBehavior) || MetatileBehavior_IsDirectionalUpRightStairWarp(metatileBehavior))
|
||||||
playerSpr->y2 = *a3 >> 5;
|
direction = DIR_WEST;
|
||||||
if (playerObj->heldMovementFinished)
|
else
|
||||||
ObjectEventForceSetHeldMovement(playerObj, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
direction = DIR_EAST;
|
||||||
|
|
||||||
|
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceSlowMovementAction(direction));
|
||||||
|
GetStairsMovementDirection(metatileBehavior, speedX, speedY);
|
||||||
|
*offsetX = *speedX * 16;
|
||||||
|
*offsetY = *speedY * 16;
|
||||||
|
*timer = 16;
|
||||||
|
sprite = &gSprites[gPlayerAvatar.spriteId];
|
||||||
|
sprite->x2 = *offsetX >> 5;
|
||||||
|
sprite->y2 = *offsetY >> 5;
|
||||||
|
*speedX *= -1;
|
||||||
|
*speedY *= -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define tState data[0]
|
||||||
|
#define tSpeedX data[1]
|
||||||
|
#define tSpeedY data[2]
|
||||||
|
#define tOffsetX data[3]
|
||||||
|
#define tOffsetY data[4]
|
||||||
|
#define tTimer data[5]
|
||||||
|
|
||||||
|
static void Task_ExitStairs(u8 taskId)
|
||||||
|
{
|
||||||
|
s16 * data = gTasks[taskId].data;
|
||||||
|
switch (tState)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
if (WaitForWeatherFadeIn() == TRUE)
|
||||||
|
{
|
||||||
|
CameraObjectReset();
|
||||||
|
UnlockPlayerFieldControls();
|
||||||
|
DestroyTask(taskId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0:
|
||||||
|
Overworld_PlaySpecialMapMusic();
|
||||||
|
WarpFadeInScreen();
|
||||||
|
LockPlayerFieldControls();
|
||||||
|
ExitStairsMovement(&tSpeedX, &tSpeedY, &tOffsetX, &tOffsetY, &tTimer);
|
||||||
|
tState++;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
if (!WaitStairExitMovementFinished(&tSpeedX, &tSpeedY, &tOffsetX, &tOffsetY, &tTimer))
|
||||||
|
tState++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ForceStairsMovement(u32 metatileBehavior, s16 *speedX, s16 *speedY)
|
||||||
|
{
|
||||||
|
ObjectEventForceSetHeldMovement(&gObjectEvents[gPlayerAvatar.objectEventId], GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
||||||
|
GetStairsMovementDirection(metatileBehavior, speedX, speedY);
|
||||||
|
}
|
||||||
|
#undef tSpeedX
|
||||||
|
#undef tSpeedY
|
||||||
|
#undef tOffsetX
|
||||||
|
#undef tOffsetY
|
||||||
|
#undef tTimer
|
||||||
|
|
||||||
|
#define tMetatileBehavior data[1]
|
||||||
|
#define tSpeedX data[2]
|
||||||
|
#define tSpeedY data[3]
|
||||||
|
#define tOffsetX data[4]
|
||||||
|
#define tOffsetY data[5]
|
||||||
|
#define tTimer data[6]
|
||||||
|
#define tDelay data[15]
|
||||||
|
|
||||||
|
static void UpdateStairsMovement(s16 speedX, s16 speedY, s16 *offsetX, s16 *offsetY, s16 *timer)
|
||||||
|
{
|
||||||
|
struct Sprite *playerSprite = &gSprites[gPlayerAvatar.spriteId];
|
||||||
|
struct ObjectEvent *playerObjectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
|
|
||||||
|
if (speedY > 0 || *timer > 6)
|
||||||
|
*offsetY += speedY;
|
||||||
|
|
||||||
|
*offsetX += speedX;
|
||||||
|
(*timer)++;
|
||||||
|
playerSprite->x2 = *offsetX >> 5;
|
||||||
|
playerSprite->y2 = *offsetY >> 5;
|
||||||
|
if (playerObjectEvent->heldMovementFinished)
|
||||||
|
ObjectEventForceSetHeldMovement(playerObjectEvent, GetWalkInPlaceNormalMovementAction(GetPlayerFacingDirection()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_StairWarp(u8 taskId)
|
static void Task_StairWarp(u8 taskId)
|
||||||
{
|
{
|
||||||
s16 * data = gTasks[taskId].data;
|
s16 * data = gTasks[taskId].data;
|
||||||
struct ObjectEvent *playerObj = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *playerObjectEvent = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
struct Sprite *playerSpr = &gSprites[gPlayerAvatar.spriteId];
|
struct Sprite *playerSprite = &gSprites[gPlayerAvatar.spriteId];
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
LockPlayerFieldControls();
|
LockPlayerFieldControls();
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
CameraObjectFreeze();
|
CameraObjectFreeze();
|
||||||
data[0]++;
|
tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!ObjectEventIsMovementOverridden(playerObj) || ObjectEventClearHeldMovementIfFinished(playerObj))
|
if (!ObjectEventIsMovementOverridden(playerObjectEvent) || ObjectEventClearHeldMovementIfFinished(playerObjectEvent))
|
||||||
{
|
|
||||||
if (data[15] != 0)
|
|
||||||
data[15]--;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
TryFadeOutOldMapMusic();
|
if (tDelay != 0)
|
||||||
PlayRainStoppingSoundEffect();
|
tDelay--;
|
||||||
playerSpr->oam.priority = 1;
|
else
|
||||||
ForceStairsMovement(data[1], &data[2], &data[3]);
|
{
|
||||||
PlaySE(SE_EXIT);
|
TryFadeOutOldMapMusic();
|
||||||
data[0]++;
|
PlayRainStoppingSoundEffect();
|
||||||
|
playerSprite->oam.priority = 1;
|
||||||
|
ForceStairsMovement(tMetatileBehavior, &tSpeedX, &tSpeedY);
|
||||||
|
PlaySE(SE_EXIT);
|
||||||
|
tState++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case 2:
|
||||||
case 2:
|
UpdateStairsMovement(tSpeedX, tSpeedY, &tOffsetX, &tOffsetY, &tTimer);
|
||||||
UpdateStairsMovement(data[2], data[3], &data[4], &data[5], &data[6]);
|
tDelay++;
|
||||||
data[15]++;
|
if (tDelay >= 12)
|
||||||
if (data[15] >= 12)
|
{
|
||||||
{
|
WarpFadeOutScreen();
|
||||||
WarpFadeOutScreen();
|
tState++;
|
||||||
data[0]++;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case 3:
|
||||||
case 3:
|
UpdateStairsMovement(tSpeedX, tSpeedY, &tOffsetX, &tOffsetY, &tTimer);
|
||||||
UpdateStairsMovement(data[2], data[3], &data[4], &data[5], &data[6]);
|
if (!PaletteFadeActive() && BGMusicStopped())
|
||||||
if (!PaletteFadeActive() && BGMusicStopped())
|
tState++;
|
||||||
data[0]++;
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
gFieldCallback = FieldCB_DefaultWarpExit;
|
||||||
gFieldCallback = FieldCB_DefaultWarpExit;
|
WarpIntoMap();
|
||||||
WarpIntoMap();
|
SetMainCallback2(CB2_LoadMap);
|
||||||
SetMainCallback2(CB2_LoadMap);
|
DestroyTask(taskId);
|
||||||
DestroyTask(taskId);
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoStairWarp(u16 metatileBehavior, u16 delay)
|
void DoStairWarp(u16 metatileBehavior, u16 delay)
|
||||||
{
|
{
|
||||||
u8 taskId = CreateTask(Task_StairWarp, 10);
|
u8 taskId = CreateTask(Task_StairWarp, 10);
|
||||||
gTasks[taskId].data[1] = metatileBehavior;
|
gTasks[taskId].tMetatileBehavior = metatileBehavior;
|
||||||
gTasks[taskId].data[15] = delay;
|
gTasks[taskId].tDelay = delay;
|
||||||
Task_StairWarp(taskId);
|
Task_StairWarp(taskId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef tMetatileBehavior
|
||||||
|
#undef tSpeedX
|
||||||
|
#undef tSpeedY
|
||||||
|
#undef tOffsetX
|
||||||
|
#undef tOffsetY
|
||||||
|
#undef tTimer
|
||||||
|
#undef tDelay
|
||||||
|
|
||||||
|
bool32 IsDirectionalStairWarpMetatileBehavior(u16 metatileBehavior, u8 playerDirection)
|
||||||
|
{
|
||||||
|
switch (playerDirection)
|
||||||
|
{
|
||||||
|
case DIR_WEST:
|
||||||
|
if (MetatileBehavior_IsDirectionalUpLeftStairWarp(metatileBehavior))
|
||||||
|
return TRUE;
|
||||||
|
if (MetatileBehavior_IsDirectionalDownLeftStairWarp(metatileBehavior))
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
case DIR_EAST:
|
||||||
|
if (MetatileBehavior_IsDirectionalUpRightStairWarp(metatileBehavior))
|
||||||
|
return TRUE;
|
||||||
|
if (MetatileBehavior_IsDirectionalDownRightStairWarp(metatileBehavior))
|
||||||
|
return TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
|
@ -1435,7 +1435,10 @@ bool8 MetatileBehavior_IsDirectionalDownLeftStairWarp(u8 metatileBehavior)
|
||||||
|
|
||||||
bool8 MetatileBehavior_IsDirectionalStairWarp(u8 metatileBehavior)
|
bool8 MetatileBehavior_IsDirectionalStairWarp(u8 metatileBehavior)
|
||||||
{
|
{
|
||||||
if (metatileBehavior >= MB_UP_RIGHT_STAIR_WARP && metatileBehavior <= MB_DOWN_LEFT_STAIR_WARP)
|
if (metatileBehavior == MB_UP_RIGHT_STAIR_WARP
|
||||||
|
|| metatileBehavior == MB_UP_LEFT_STAIR_WARP
|
||||||
|
|| metatileBehavior == MB_DOWN_RIGHT_STAIR_WARP
|
||||||
|
|| metatileBehavior == MB_DOWN_LEFT_STAIR_WARP)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue