mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-27 20:24:18 +01:00
Merge pull request #1285 from GriffinRichards/doc-fieldscr
Minor field_screen_effect / field_player_avatar documentation
This commit is contained in:
commit
f2ce06683d
@ -209,7 +209,7 @@ gScriptCmdTable:: @ 81DB67C
|
|||||||
.4byte ScrCmd_checkmonobedience @ 0xce
|
.4byte ScrCmd_checkmonobedience @ 0xce
|
||||||
.4byte ScrCmd_gotoram @ 0xcf
|
.4byte ScrCmd_gotoram @ 0xcf
|
||||||
.4byte ScrCmd_nop1 @ 0xd0
|
.4byte ScrCmd_nop1 @ 0xd0
|
||||||
.4byte ScrCmd_warpD1 @ 0xd1
|
.4byte ScrCmd_warpspinenter @ 0xd1
|
||||||
.4byte ScrCmd_setmonmetlocation @ 0xd2
|
.4byte ScrCmd_setmonmetlocation @ 0xd2
|
||||||
.4byte ScrCmd_moverotatingtileobjects @ 0xd3
|
.4byte ScrCmd_moverotatingtileobjects @ 0xd3
|
||||||
.4byte ScrCmd_turnrotatingtileobjects @ 0xd4
|
.4byte ScrCmd_turnrotatingtileobjects @ 0xd4
|
||||||
|
@ -36,7 +36,7 @@ void sub_808BCE8(void);
|
|||||||
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
|
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
|
||||||
void sub_808B864(void);
|
void sub_808B864(void);
|
||||||
void sub_808BCF4(void);
|
void sub_808BCF4(void);
|
||||||
void sub_808D074(u8);
|
void SetSpinStartFacingDir(u8);
|
||||||
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
|
||||||
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8);
|
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8);
|
||||||
void SetPlayerAvatarFieldMove(void);
|
void SetPlayerAvatarFieldMove(void);
|
||||||
@ -57,10 +57,10 @@ void PlayerWheelieMove(u8 direction);
|
|||||||
void PlayerPopWheelieWhileMoving(u8 direction);
|
void PlayerPopWheelieWhileMoving(u8 direction);
|
||||||
void PlayerUseAcroBikeOnBumpySlope(u8 direction);
|
void PlayerUseAcroBikeOnBumpySlope(u8 direction);
|
||||||
void PlayerEndWheelieWhileMoving(u8 direction);
|
void PlayerEndWheelieWhileMoving(u8 direction);
|
||||||
void sub_808D194(void);
|
void DoPlayerSpinEntrance(void);
|
||||||
void sub_808D1C8(void);
|
void DoPlayerSpinExit(void);
|
||||||
bool32 sub_808D1B4(void);
|
bool32 IsPlayerSpinEntranceActive(void);
|
||||||
bool32 sub_808D1E8(void);
|
bool32 IsPlayerSpinExitActive(void);
|
||||||
void SetPlayerInvisibility(bool8 invisible);
|
void SetPlayerInvisibility(bool8 invisible);
|
||||||
u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y);
|
u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y);
|
||||||
void StartFishing(u8 rod);
|
void StartFishing(u8 rod);
|
||||||
|
@ -18,8 +18,8 @@ void FieldCB_WarpExitFadeFromBlack(void);
|
|||||||
void FieldCB_WarpExitFadeFromWhite(void);
|
void FieldCB_WarpExitFadeFromWhite(void);
|
||||||
bool8 FieldCB_ReturnToFieldOpenStartMenu(void);
|
bool8 FieldCB_ReturnToFieldOpenStartMenu(void);
|
||||||
void ReturnToFieldOpenStartMenu(void);
|
void ReturnToFieldOpenStartMenu(void);
|
||||||
void sub_80AF6D4(void);
|
void FieldCB_ReturnToFieldNoScript(void);
|
||||||
void sub_80AF6F0(void);
|
void FieldCB_ReturnToFieldNoScriptCheckMusic(void);
|
||||||
void DoWarp(void);
|
void DoWarp(void);
|
||||||
void DoDiveWarp(void);
|
void DoDiveWarp(void);
|
||||||
void DoSootopolisLegendWarp(void);
|
void DoSootopolisLegendWarp(void);
|
||||||
@ -35,8 +35,8 @@ void DoCableClubWarp(void);
|
|||||||
void DoContestHallWarp(void);
|
void DoContestHallWarp(void);
|
||||||
void AnimateFlash(u8 flashLevel);
|
void AnimateFlash(u8 flashLevel);
|
||||||
void WriteBattlePyramidViewScanlineEffectBuffer(void);
|
void WriteBattlePyramidViewScanlineEffectBuffer(void);
|
||||||
void sub_80B0244(void);
|
void DoSpinEnterWarp(void);
|
||||||
void sub_80B0268(void);
|
void DoSpinExitWarp(void);
|
||||||
void DoOrbEffect(void);
|
void DoOrbEffect(void);
|
||||||
void FadeOutOrbEffect(void);
|
void FadeOutOrbEffect(void);
|
||||||
void sub_80B05B4(void);
|
void sub_80B05B4(void);
|
||||||
|
@ -607,7 +607,7 @@ static void CB2_EndWildBattle(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetMainCallback2(CB2_ReturnToField);
|
SetMainCallback2(CB2_ReturnToField);
|
||||||
gFieldCallback = sub_80AF6F0;
|
gFieldCallback = FieldCB_ReturnToFieldNoScriptCheckMusic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -730,7 +730,8 @@ static bool8 TryStartWarpEventScript(struct MapPosition *position, u16 metatileB
|
|||||||
}
|
}
|
||||||
if (MetatileBehavior_IsWarpOrBridge(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsWarpOrBridge(metatileBehavior) == TRUE)
|
||||||
{
|
{
|
||||||
sub_80B0268();
|
// Maybe unused? This MB is used by log bridges, but there's never a warp event on them
|
||||||
|
DoSpinExitWarp();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE)
|
if (MetatileBehavior_IsMtPyreHole(metatileBehavior) == TRUE)
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
#include "constants/songs.h"
|
#include "constants/songs.h"
|
||||||
#include "constants/trainer_types.h"
|
#include "constants/trainer_types.h"
|
||||||
|
|
||||||
static EWRAM_DATA u8 gUnknown_0203734C = 0;
|
static EWRAM_DATA u8 sSpinStartFacingDir = 0;
|
||||||
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
|
EWRAM_DATA struct ObjectEvent gObjectEvents[OBJECT_EVENTS_COUNT] = {};
|
||||||
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
|
EWRAM_DATA struct PlayerAvatar gPlayerAvatar = {};
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ static u8 Fishing_PutRodAway(struct Task *task);
|
|||||||
static u8 Fishing_EndNoMon(struct Task *task);
|
static u8 Fishing_EndNoMon(struct Task *task);
|
||||||
static void AlignFishingAnimationFrames(void);
|
static void AlignFishingAnimationFrames(void);
|
||||||
|
|
||||||
static u8 sub_808D38C(struct ObjectEvent *object, s16 *a1);
|
static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *a1);
|
||||||
|
|
||||||
// .rodata
|
// .rodata
|
||||||
|
|
||||||
@ -2050,54 +2050,64 @@ static void AlignFishingAnimationFrames(void)
|
|||||||
SetSurfBobWhileFishingState(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 1, playerSprite->pos2.y);
|
SetSurfBobWhileFishingState(gObjectEvents[gPlayerAvatar.objectEventId].fieldEffectSpriteId, 1, playerSprite->pos2.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_808D074(u8 a0)
|
void SetSpinStartFacingDir(u8 direction)
|
||||||
{
|
{
|
||||||
gUnknown_0203734C = a0;
|
sSpinStartFacingDir = direction;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_808D080(void)
|
static u8 GetSpinStartFacingDir(void)
|
||||||
{
|
{
|
||||||
if (gUnknown_0203734C == 0)
|
if (sSpinStartFacingDir == DIR_NONE)
|
||||||
{
|
return DIR_SOUTH;
|
||||||
return 1;
|
|
||||||
}
|
return sSpinStartFacingDir;
|
||||||
return gUnknown_0203734C;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_808D094(u8 taskId)
|
// Task data for Task_DoPlayerSpinEntrance and Task_DoPlayerSpinExit
|
||||||
|
#define tState data[0]
|
||||||
|
#define tSpinDelayTimer data[1]
|
||||||
|
#define tSpeed data[2]
|
||||||
|
#define tCurY data[3]
|
||||||
|
#define tDestY data[4]
|
||||||
|
#define tStartDir data[5]
|
||||||
|
#define tPriority data[6]
|
||||||
|
#define tSubpriority data[7]
|
||||||
|
#define tGroundTimer data[8]
|
||||||
|
|
||||||
|
static void Task_DoPlayerSpinExit(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *object = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *object = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
struct Sprite *sprite = &gSprites[object->spriteId];
|
struct Sprite *sprite = &gSprites[object->spriteId];
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0: // Init
|
||||||
if (!ObjectEventClearHeldMovementIfFinished(object))
|
if (!ObjectEventClearHeldMovementIfFinished(object))
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
sub_808D074(object->facingDirection);
|
SetSpinStartFacingDir(object->facingDirection);
|
||||||
data[1] = 0;
|
tSpinDelayTimer = 0;
|
||||||
data[2] = 1;
|
tSpeed = 1;
|
||||||
data[3] = (u16)(sprite->pos1.y + sprite->pos2.y) << 4;
|
tCurY = (u16)(sprite->pos1.y + sprite->pos2.y) << 4;
|
||||||
sprite->pos2.y = 0;
|
sprite->pos2.y = 0;
|
||||||
CameraObjectReset2();
|
CameraObjectReset2();
|
||||||
object->fixedPriority = TRUE;
|
object->fixedPriority = TRUE;
|
||||||
sprite->oam.priority = 0;
|
sprite->oam.priority = 0;
|
||||||
sprite->subpriority = 0;
|
sprite->subpriority = 0;
|
||||||
sprite->subspriteMode = SUBSPRITES_OFF;
|
sprite->subspriteMode = SUBSPRITES_OFF;
|
||||||
data[0]++;
|
tState++;
|
||||||
case 1:
|
case 1: // Spin while rising
|
||||||
sub_808D38C(object, &data[1]);
|
TrySpinPlayerForWarp(object, &tSpinDelayTimer);
|
||||||
data[3] -= data[2];
|
|
||||||
data[2] += 3;
|
// Rise and accelerate
|
||||||
sprite->pos1.y = data[3] >> 4;
|
tCurY -= tSpeed;
|
||||||
|
tSpeed += 3;
|
||||||
|
sprite->pos1.y = tCurY >> 4;
|
||||||
|
|
||||||
|
// Check if offscreen
|
||||||
if (sprite->pos1.y + (s16)gTotalCameraPixelOffsetY < -32)
|
if (sprite->pos1.y + (s16)gTotalCameraPixelOffsetY < -32)
|
||||||
{
|
tState++;
|
||||||
data[0]++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
@ -2105,84 +2115,86 @@ static void sub_808D094(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_808D1FC(u8 taskId);
|
static void Task_DoPlayerSpinEntrance(u8 taskId);
|
||||||
|
|
||||||
void sub_808D194(void)
|
void DoPlayerSpinEntrance(void)
|
||||||
{
|
{
|
||||||
sub_808D1FC(CreateTask(sub_808D1FC, 0));
|
Task_DoPlayerSpinEntrance(CreateTask(Task_DoPlayerSpinEntrance, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_808D1B4(void)
|
bool32 IsPlayerSpinEntranceActive(void)
|
||||||
{
|
{
|
||||||
return FuncIsActiveTask(sub_808D1FC);
|
return FuncIsActiveTask(Task_DoPlayerSpinEntrance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_808D1C8(void)
|
void DoPlayerSpinExit(void)
|
||||||
{
|
{
|
||||||
sub_808D094(CreateTask(sub_808D094, 0));
|
Task_DoPlayerSpinExit(CreateTask(Task_DoPlayerSpinExit, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool32 sub_808D1E8(void)
|
bool32 IsPlayerSpinExitActive(void)
|
||||||
{
|
{
|
||||||
return FuncIsActiveTask(sub_808D094);
|
return FuncIsActiveTask(Task_DoPlayerSpinExit);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const u8 gUnknown_084975BC[] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH};
|
static const u8 sSpinDirections[] = {DIR_SOUTH, DIR_WEST, DIR_EAST, DIR_NORTH, DIR_SOUTH};
|
||||||
|
|
||||||
static void sub_808D1FC(u8 taskId)
|
static void Task_DoPlayerSpinEntrance(u8 taskId)
|
||||||
{
|
{
|
||||||
struct ObjectEvent *object = &gObjectEvents[gPlayerAvatar.objectEventId];
|
struct ObjectEvent *object = &gObjectEvents[gPlayerAvatar.objectEventId];
|
||||||
struct Sprite *sprite = &gSprites[object->spriteId];
|
struct Sprite *sprite = &gSprites[object->spriteId];
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
data[5] = sub_808D080();
|
// Because the spin start facing direction is never set for this
|
||||||
ObjectEventForceSetHeldMovement(object, GetFaceDirectionMovementAction(gUnknown_084975BC[data[5]]));
|
// warp type, the player will always exit the warp facing South.
|
||||||
data[1] = 0;
|
// This may have been intentional, unclear
|
||||||
data[2] = 116;
|
tStartDir = GetSpinStartFacingDir();
|
||||||
data[4] = sprite->pos1.y;
|
ObjectEventForceSetHeldMovement(object, GetFaceDirectionMovementAction(sSpinDirections[tStartDir]));
|
||||||
data[6] = sprite->oam.priority;
|
tSpinDelayTimer = 0;
|
||||||
data[7] = sprite->subpriority;
|
tSpeed = 116;
|
||||||
data[3] = -((u16)sprite->pos2.y + 32) * 16;
|
tDestY = sprite->pos1.y;
|
||||||
|
tPriority = sprite->oam.priority;
|
||||||
|
tSubpriority = sprite->subpriority;
|
||||||
|
tCurY = -((u16)sprite->pos2.y + 32) * 16;
|
||||||
sprite->pos2.y = 0;
|
sprite->pos2.y = 0;
|
||||||
CameraObjectReset2();
|
CameraObjectReset2();
|
||||||
object->fixedPriority = TRUE;
|
object->fixedPriority = TRUE;
|
||||||
sprite->oam.priority = 1;
|
sprite->oam.priority = 1;
|
||||||
sprite->subpriority = 0;
|
sprite->subpriority = 0;
|
||||||
sprite->subspriteMode = SUBSPRITES_OFF;
|
sprite->subspriteMode = SUBSPRITES_OFF;
|
||||||
data[0]++;
|
tState++;
|
||||||
case 1:
|
case 1: // Spin while descending
|
||||||
sub_808D38C(object, &data[1]);
|
TrySpinPlayerForWarp(object, &tSpinDelayTimer);
|
||||||
data[3] += data[2];
|
|
||||||
data[2] -= 3;
|
// Fall and decelerate
|
||||||
if (data[2] < 4)
|
tCurY += tSpeed;
|
||||||
|
tSpeed -= 3;
|
||||||
|
if (tSpeed < 4)
|
||||||
|
tSpeed = 4;
|
||||||
|
sprite->pos1.y = tCurY >> 4;
|
||||||
|
|
||||||
|
// Check if reached dest
|
||||||
|
if (sprite->pos1.y >= tDestY)
|
||||||
{
|
{
|
||||||
data[2] = 4;
|
sprite->pos1.y = tDestY;
|
||||||
}
|
tGroundTimer = 0;
|
||||||
sprite->pos1.y = data[3] >> 4;
|
tState++;
|
||||||
if (sprite->pos1.y >= data[4])
|
|
||||||
{
|
|
||||||
sprite->pos1.y = data[4];
|
|
||||||
data[8] = 0;
|
|
||||||
data[0]++;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2: // Spin on ground
|
||||||
sub_808D38C(object, &data[1]);
|
TrySpinPlayerForWarp(object, &tSpinDelayTimer);
|
||||||
data[8]++;
|
if (++tGroundTimer > 8)
|
||||||
if (data[8] > 8)
|
tState++;
|
||||||
{
|
|
||||||
data[0]++;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3: // Spin until facing original direction
|
||||||
if (data[5] == sub_808D38C(object, &data[1]))
|
if (tStartDir == TrySpinPlayerForWarp(object, &tSpinDelayTimer))
|
||||||
{
|
{
|
||||||
object->fixedPriority = 0;
|
object->fixedPriority = 0;
|
||||||
sprite->oam.priority = data[6];
|
sprite->oam.priority = tPriority;
|
||||||
sprite->subpriority = data[7];
|
sprite->subpriority = tSubpriority;
|
||||||
CameraObjectReset1();
|
CameraObjectReset1();
|
||||||
DestroyTask(taskId);
|
DestroyTask(taskId);
|
||||||
}
|
}
|
||||||
@ -2190,19 +2202,15 @@ static void sub_808D1FC(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_808D38C(struct ObjectEvent *object, s16 *a1)
|
static u8 TrySpinPlayerForWarp(struct ObjectEvent *object, s16 *delayTimer)
|
||||||
{
|
{
|
||||||
if (*a1 < 8 && ++(*a1) < 8)
|
if (*delayTimer < 8 && ++(*delayTimer) < 8)
|
||||||
{
|
|
||||||
return object->facingDirection;
|
return object->facingDirection;
|
||||||
}
|
|
||||||
|
|
||||||
if (!ObjectEventCheckHeldMovementStatus(object))
|
if (!ObjectEventCheckHeldMovementStatus(object))
|
||||||
{
|
|
||||||
return object->facingDirection;
|
return object->facingDirection;
|
||||||
}
|
|
||||||
|
|
||||||
ObjectEventForceSetHeldMovement(object, GetFaceDirectionMovementAction(gUnknown_084975BC[object->facingDirection]));
|
ObjectEventForceSetHeldMovement(object, GetFaceDirectionMovementAction(sSpinDirections[object->facingDirection]));
|
||||||
*a1 = 0;
|
*delayTimer = 0;
|
||||||
return gUnknown_084975BC[object->facingDirection];
|
return sSpinDirections[object->facingDirection];
|
||||||
}
|
}
|
||||||
|
@ -42,11 +42,14 @@ static void Task_DoContestHallWarp(u8);
|
|||||||
static void FillPalBufferWhite(void);
|
static void FillPalBufferWhite(void);
|
||||||
static void Task_ExitDoor(u8);
|
static void Task_ExitDoor(u8);
|
||||||
static bool32 WaitForWeatherFadeIn(void);
|
static bool32 WaitForWeatherFadeIn(void);
|
||||||
static void Task_TeleportTileWarpExit(u8 taskId);
|
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);
|
||||||
|
|
||||||
|
// data[0] is used universally by tasks in this file as a state for switches
|
||||||
|
#define tState data[0]
|
||||||
|
|
||||||
// const
|
// const
|
||||||
static const u16 sFlashLevelPixelRadii[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 };
|
static const u16 sFlashLevelPixelRadii[] = { 200, 72, 64, 56, 48, 40, 32, 24, 0 };
|
||||||
const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelPixelRadii) - 1;
|
const s32 gMaxFlashLevel = ARRAY_COUNT(sFlashLevelPixelRadii) - 1;
|
||||||
@ -156,17 +159,17 @@ static void Task_ReturnToFieldCableLink(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
task->data[1] = CreateTask_ReestablishCableClubLink();
|
task->data[1] = CreateTask_ReestablishCableClubLink();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (gTasks[task->data[1]].isActive != TRUE)
|
if (gTasks[task->data[1]].isActive != TRUE)
|
||||||
{
|
{
|
||||||
WarpFadeInScreen();
|
WarpFadeInScreen();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -191,11 +194,11 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetLinkStandbyCallback();
|
SetLinkStandbyCallback();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!IsLinkTaskFinished())
|
if (!IsLinkTaskFinished())
|
||||||
@ -206,7 +209,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
WarpFadeInScreen();
|
WarpFadeInScreen();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -224,16 +227,16 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetLinkStandbyCallback();
|
SetLinkStandbyCallback();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (IsLinkTaskFinished())
|
if (IsLinkTaskFinished())
|
||||||
{
|
{
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -295,12 +298,12 @@ void FieldCB_WarpExitFadeFromBlack(void)
|
|||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FieldCB_TeleportTileWarpExit(void)
|
static void FieldCB_SpinEnterWarp(void)
|
||||||
{
|
{
|
||||||
Overworld_PlaySpecialMapMusic();
|
Overworld_PlaySpecialMapMusic();
|
||||||
WarpFadeInScreen();
|
WarpFadeInScreen();
|
||||||
PlaySE(SE_WARP_OUT);
|
PlaySE(SE_WARP_OUT);
|
||||||
CreateTask(Task_TeleportTileWarpExit, 10);
|
CreateTask(Task_SpinEnterWarp, 10);
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,14 +323,14 @@ static void Task_ExitDoor(u8 taskId)
|
|||||||
s16 *x = &task->data[2];
|
s16 *x = &task->data[2];
|
||||||
s16 *y = &task->data[3];
|
s16 *y = &task->data[3];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetPlayerVisibility(FALSE);
|
SetPlayerVisibility(FALSE);
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
PlayerGetDestCoords(x, y);
|
PlayerGetDestCoords(x, y);
|
||||||
FieldSetDoorOpened(*x, *y);
|
FieldSetDoorOpened(*x, *y);
|
||||||
task->data[0] = 1;
|
task->tState = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (WaitForWeatherFadeIn())
|
if (WaitForWeatherFadeIn())
|
||||||
@ -336,7 +339,7 @@ static void Task_ExitDoor(u8 taskId)
|
|||||||
SetPlayerVisibility(TRUE);
|
SetPlayerVisibility(TRUE);
|
||||||
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_DOWN);
|
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_DOWN);
|
||||||
task->data[0] = 2;
|
task->tState = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -346,14 +349,14 @@ static void Task_ExitDoor(u8 taskId)
|
|||||||
task->data[1] = FieldAnimateDoorClose(*x, *y);
|
task->data[1] = FieldAnimateDoorClose(*x, *y);
|
||||||
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]);
|
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]);
|
||||||
task->data[0] = 3;
|
task->tState = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
||||||
{
|
{
|
||||||
UnfreezeObjectEvents();
|
UnfreezeObjectEvents();
|
||||||
task->data[0] = 4;
|
task->tState = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
@ -369,13 +372,13 @@ static void Task_ExitNonAnimDoor(u8 taskId)
|
|||||||
s16 *x = &task->data[2];
|
s16 *x = &task->data[2];
|
||||||
s16 *y = &task->data[3];
|
s16 *y = &task->data[3];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetPlayerVisibility(FALSE);
|
SetPlayerVisibility(FALSE);
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
PlayerGetDestCoords(x, y);
|
PlayerGetDestCoords(x, y);
|
||||||
task->data[0] = 1;
|
task->tState = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (WaitForWeatherFadeIn())
|
if (WaitForWeatherFadeIn())
|
||||||
@ -384,14 +387,14 @@ static void Task_ExitNonAnimDoor(u8 taskId)
|
|||||||
SetPlayerVisibility(TRUE);
|
SetPlayerVisibility(TRUE);
|
||||||
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], GetWalkNormalMovementAction(GetPlayerFacingDirection()));
|
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], GetWalkNormalMovementAction(GetPlayerFacingDirection()));
|
||||||
task->data[0] = 2;
|
task->tState = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (IsPlayerStandingStill())
|
if (IsPlayerStandingStill())
|
||||||
{
|
{
|
||||||
UnfreezeObjectEvents();
|
UnfreezeObjectEvents();
|
||||||
task->data[0] = 3;
|
task->tState = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
@ -403,12 +406,12 @@ static void Task_ExitNonAnimDoor(u8 taskId)
|
|||||||
|
|
||||||
static void Task_ExitNonDoor(u8 taskId)
|
static void Task_ExitNonDoor(u8 taskId)
|
||||||
{
|
{
|
||||||
switch (gTasks[taskId].data[0])
|
switch (gTasks[taskId].tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
gTasks[taskId].data[0]++;
|
gTasks[taskId].tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (WaitForWeatherFadeIn())
|
if (WaitForWeatherFadeIn())
|
||||||
@ -443,7 +446,7 @@ bool8 FieldCB_ReturnToFieldOpenStartMenu(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void task_mpl_807E3C8(u8 taskId)
|
static void Task_ReturnToFieldNoScript(u8 taskId)
|
||||||
{
|
{
|
||||||
if (WaitForWeatherFadeIn() == 1)
|
if (WaitForWeatherFadeIn() == 1)
|
||||||
{
|
{
|
||||||
@ -453,19 +456,19 @@ static void task_mpl_807E3C8(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80AF6D4(void)
|
void FieldCB_ReturnToFieldNoScript(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
FadeInFromBlack();
|
FadeInFromBlack();
|
||||||
CreateTask(task_mpl_807E3C8, 10);
|
CreateTask(Task_ReturnToFieldNoScript, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80AF6F0(void)
|
void FieldCB_ReturnToFieldNoScriptCheckMusic(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
Overworld_PlaySpecialMapMusic();
|
Overworld_PlaySpecialMapMusic();
|
||||||
FadeInFromBlack();
|
FadeInFromBlack();
|
||||||
CreateTask(task_mpl_807E3C8, 10);
|
CreateTask(Task_ReturnToFieldNoScript, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool32 PaletteFadeActive(void)
|
static bool32 PaletteFadeActive(void)
|
||||||
@ -543,7 +546,9 @@ void DoLavaridgeGym1FWarp(void)
|
|||||||
StartLavaridgeGym1FWarp(10);
|
StartLavaridgeGym1FWarp(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Warp from a teleporting tile, e.g. in Aqua Hideout (For the move Teleport see FldEff_TeleportWarpOut)
|
// DoSpinEnterWarp but with a fade out
|
||||||
|
// Screen fades out to exit current map, player spins down from top to enter new map
|
||||||
|
// Used by teleporting tiles, e.g. in Aqua Hideout (For the move Teleport see FldEff_TeleportWarpOut)
|
||||||
void DoTeleportTileWarp(void)
|
void DoTeleportTileWarp(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
@ -551,7 +556,7 @@ void DoTeleportTileWarp(void)
|
|||||||
WarpFadeOutScreen();
|
WarpFadeOutScreen();
|
||||||
PlaySE(SE_WARP_IN);
|
PlaySE(SE_WARP_IN);
|
||||||
CreateTask(Task_WarpAndLoadMap, 10);
|
CreateTask(Task_WarpAndLoadMap, 10);
|
||||||
gFieldCallback = FieldCB_TeleportTileWarpExit;
|
gFieldCallback = FieldCB_SpinEnterWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoMossdeepGymWarp(void)
|
void DoMossdeepGymWarp(void)
|
||||||
@ -574,8 +579,6 @@ void DoPortholeWarp(void)
|
|||||||
gFieldCallback = FieldCB_ShowPortholeView;
|
gFieldCallback = FieldCB_ShowPortholeView;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tState data[0]
|
|
||||||
|
|
||||||
static void Task_DoCableClubWarp(u8 taskId)
|
static void Task_DoCableClubWarp(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
@ -598,8 +601,6 @@ static void Task_DoCableClubWarp(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tState
|
|
||||||
|
|
||||||
void DoCableClubWarp(void)
|
void DoCableClubWarp(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
@ -613,20 +614,20 @@ static void Task_ReturnToWorldFromLinkRoom(u8 taskId)
|
|||||||
{
|
{
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ClearLinkCallback_2();
|
ClearLinkCallback_2();
|
||||||
FadeScreen(FADE_TO_BLACK, 0);
|
FadeScreen(FADE_TO_BLACK, 0);
|
||||||
TryFadeOutOldMapMusic();
|
TryFadeOutOldMapMusic();
|
||||||
PlaySE(SE_EXIT);
|
PlaySE(SE_EXIT);
|
||||||
data[0]++;
|
tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!PaletteFadeActive() && BGMusicStopped())
|
if (!PaletteFadeActive() && BGMusicStopped())
|
||||||
{
|
{
|
||||||
SetCloseLinkCallback();
|
SetCloseLinkCallback();
|
||||||
data[0]++;
|
tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -649,12 +650,12 @@ static void Task_WarpAndLoadMap(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!PaletteFadeActive())
|
if (!PaletteFadeActive())
|
||||||
@ -665,7 +666,7 @@ static void Task_WarpAndLoadMap(u8 taskId)
|
|||||||
task->data[1] = 1;
|
task->data[1] = 1;
|
||||||
}
|
}
|
||||||
if (BGMusicStopped())
|
if (BGMusicStopped())
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -682,14 +683,14 @@ static void Task_DoDoorWarp(u8 taskId)
|
|||||||
s16 *x = &task->data[2];
|
s16 *x = &task->data[2];
|
||||||
s16 *y = &task->data[3];
|
s16 *y = &task->data[3];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
PlayerGetDestCoords(x, y);
|
PlayerGetDestCoords(x, y);
|
||||||
PlaySE(GetDoorSoundEffect(*x, *y - 1));
|
PlaySE(GetDoorSoundEffect(*x, *y - 1));
|
||||||
task->data[1] = FieldAnimateDoorOpen(*x, *y - 1);
|
task->data[1] = FieldAnimateDoorOpen(*x, *y - 1);
|
||||||
task->data[0] = 1;
|
task->tState = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
||||||
@ -699,7 +700,7 @@ static void Task_DoDoorWarp(u8 taskId)
|
|||||||
ObjectEventClearHeldMovementIfActive(&gObjectEvents[objEventId]);
|
ObjectEventClearHeldMovementIfActive(&gObjectEvents[objEventId]);
|
||||||
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_UP);
|
ObjectEventSetHeldMovement(&gObjectEvents[objEventId], MOVEMENT_ACTION_WALK_NORMAL_UP);
|
||||||
task->data[0] = 2;
|
task->tState = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -710,20 +711,20 @@ static void Task_DoDoorWarp(u8 taskId)
|
|||||||
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
objEventId = GetObjectEventIdByLocalIdAndMap(OBJ_EVENT_ID_PLAYER, 0, 0);
|
||||||
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]);
|
ObjectEventClearHeldMovementIfFinished(&gObjectEvents[objEventId]);
|
||||||
SetPlayerVisibility(FALSE);
|
SetPlayerVisibility(FALSE);
|
||||||
task->data[0] = 3;
|
task->tState = 3;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
if (task->data[1] < 0 || gTasks[task->data[1]].isActive != TRUE)
|
||||||
{
|
{
|
||||||
task->data[0] = 4;
|
task->tState = 4;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
TryFadeOutOldMapMusic();
|
TryFadeOutOldMapMusic();
|
||||||
WarpFadeOutScreen();
|
WarpFadeOutScreen();
|
||||||
PlayRainStoppingSoundEffect();
|
PlayRainStoppingSoundEffect();
|
||||||
task->data[0] = 0;
|
task->tState = 0;
|
||||||
task->func = Task_WarpAndLoadMap;
|
task->func = Task_WarpAndLoadMap;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -733,17 +734,17 @@ static void Task_DoContestHallWarp(u8 taskId)
|
|||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!PaletteFadeActive() && BGMusicStopped())
|
if (!PaletteFadeActive() && BGMusicStopped())
|
||||||
{
|
{
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -850,22 +851,22 @@ static void UpdateFlashLevelEffect(u8 taskId)
|
|||||||
{
|
{
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
SetFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
||||||
data[0] = 1;
|
tState = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SetFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
SetFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
||||||
data[0] = 0;
|
tState = 0;
|
||||||
tCurFlashRadius += tFlashRadiusDelta;
|
tCurFlashRadius += tFlashRadiusDelta;
|
||||||
if (tCurFlashRadius > tDestFlashRadius)
|
if (tCurFlashRadius > tDestFlashRadius)
|
||||||
{
|
{
|
||||||
if (tClearScanlineEffect == 1)
|
if (tClearScanlineEffect == 1)
|
||||||
{
|
{
|
||||||
ScanlineEffect_Stop();
|
ScanlineEffect_Stop();
|
||||||
data[0] = 2;
|
tState = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -884,22 +885,22 @@ static void UpdateOrbFlashEffect(u8 taskId)
|
|||||||
{
|
{
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
|
|
||||||
switch (data[0])
|
switch (tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetOrbFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
SetOrbFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
||||||
data[0] = 1;
|
tState = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
SetOrbFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
SetOrbFlashScanlineEffectWindowBoundaries(gScanlineEffectRegBuffers[gScanlineEffect.srcBuffer], tFlashCenterX, tFlashCenterY, tCurFlashRadius);
|
||||||
data[0] = 0;
|
tState = 0;
|
||||||
tCurFlashRadius += tFlashRadiusDelta;
|
tCurFlashRadius += tFlashRadiusDelta;
|
||||||
if (tCurFlashRadius > tDestFlashRadius)
|
if (tCurFlashRadius > tDestFlashRadius)
|
||||||
{
|
{
|
||||||
if (tClearScanlineEffect == 1)
|
if (tClearScanlineEffect == 1)
|
||||||
{
|
{
|
||||||
ScanlineEffect_Stop();
|
ScanlineEffect_Stop();
|
||||||
data[0] = 2;
|
tState = 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -914,7 +915,7 @@ static void UpdateOrbFlashEffect(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80AFF90(u8 taskId)
|
static void Task_WaitForFlashUpdate(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!FuncIsActiveTask(UpdateFlashLevelEffect))
|
if (!FuncIsActiveTask(UpdateFlashLevelEffect))
|
||||||
{
|
{
|
||||||
@ -923,13 +924,13 @@ static void sub_80AFF90(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80AFFB8(void)
|
static void StartWaitForFlashUpdate(void)
|
||||||
{
|
{
|
||||||
if (!FuncIsActiveTask(sub_80AFF90))
|
if (!FuncIsActiveTask(Task_WaitForFlashUpdate))
|
||||||
CreateTask(sub_80AFF90, 80);
|
CreateTask(Task_WaitForFlashUpdate, 80);
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_80AFFDC(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, s32 clearScanlineEffect, u8 delta)
|
static u8 StartUpdateFlashLevelEffect(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, s32 clearScanlineEffect, u8 delta)
|
||||||
{
|
{
|
||||||
u8 taskId = CreateTask(UpdateFlashLevelEffect, 80);
|
u8 taskId = CreateTask(UpdateFlashLevelEffect, 80);
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
@ -948,7 +949,7 @@ static u8 sub_80AFFDC(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 dest
|
|||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
static u8 sub_80B003C(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, s32 clearScanlineEffect, u8 delta)
|
static u8 StartUpdateOrbFlashEffect(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 destFlashRadius, s32 clearScanlineEffect, u8 delta)
|
||||||
{
|
{
|
||||||
u8 taskId = CreateTask(UpdateOrbFlashEffect, 80);
|
u8 taskId = CreateTask(UpdateOrbFlashEffect, 80);
|
||||||
s16 *data = gTasks[taskId].data;
|
s16 *data = gTasks[taskId].data;
|
||||||
@ -972,14 +973,15 @@ static u8 sub_80B003C(s32 centerX, s32 centerY, s32 initialFlashRadius, s32 dest
|
|||||||
#undef tFlashRadiusDelta
|
#undef tFlashRadiusDelta
|
||||||
#undef tClearScanlineEffect
|
#undef tClearScanlineEffect
|
||||||
|
|
||||||
|
// A higher flashLevel value is a smaller flash radius (more darkness). 0 is full brightness
|
||||||
void AnimateFlash(u8 flashLevel)
|
void AnimateFlash(u8 flashLevel)
|
||||||
{
|
{
|
||||||
u8 curFlashLevel = Overworld_GetFlashLevel();
|
u8 curFlashLevel = Overworld_GetFlashLevel();
|
||||||
u8 value = 0;
|
bool8 fullBrightness = FALSE;
|
||||||
if (!flashLevel)
|
if (!flashLevel)
|
||||||
value = 1;
|
fullBrightness = TRUE;
|
||||||
sub_80AFFDC(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], value, 1);
|
StartUpdateFlashLevelEffect(DISPLAY_WIDTH / 2, DISPLAY_HEIGHT / 2, sFlashLevelPixelRadii[curFlashLevel], sFlashLevelPixelRadii[flashLevel], fullBrightness, 1);
|
||||||
sub_80AFFB8();
|
StartWaitForFlashUpdate();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -998,18 +1000,18 @@ void WriteBattlePyramidViewScanlineEffectBuffer(void)
|
|||||||
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);
|
CpuFastSet(&gScanlineEffectRegBuffers[0], &gScanlineEffectRegBuffers[1], 480);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Task_TeleportTileWarpExit(u8 taskId)
|
static void Task_SpinEnterWarp(u8 taskId)
|
||||||
{
|
{
|
||||||
switch (gTasks[taskId].data[0])
|
switch (gTasks[taskId].tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
sub_808D194();
|
DoPlayerSpinEntrance();
|
||||||
gTasks[taskId].data[0]++;
|
gTasks[taskId].tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (WaitForWeatherFadeIn() && sub_808D1B4() != TRUE)
|
if (WaitForWeatherFadeIn() && IsPlayerSpinEntranceActive() != TRUE)
|
||||||
{
|
{
|
||||||
UnfreezeObjectEvents();
|
UnfreezeObjectEvents();
|
||||||
ScriptContext2_Disable();
|
ScriptContext2_Disable();
|
||||||
@ -1019,29 +1021,29 @@ static void Task_TeleportTileWarpExit(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80B01BC(u8 taskId)
|
static void Task_SpinExitWarp(u8 taskId)
|
||||||
{
|
{
|
||||||
struct Task *task = &gTasks[taskId];
|
struct Task *task = &gTasks[taskId];
|
||||||
|
|
||||||
switch (task->data[0])
|
switch (task->tState)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
FreezeObjectEvents();
|
FreezeObjectEvents();
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
PlaySE(SE_WARP_IN);
|
PlaySE(SE_WARP_IN);
|
||||||
sub_808D1C8();
|
DoPlayerSpinExit();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (!sub_808D1E8())
|
if (!IsPlayerSpinExitActive())
|
||||||
{
|
{
|
||||||
WarpFadeOutScreen();
|
WarpFadeOutScreen();
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!PaletteFadeActive() && BGMusicStopped())
|
if (!PaletteFadeActive() && BGMusicStopped())
|
||||||
task->data[0]++;
|
task->tState++;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
@ -1051,18 +1053,22 @@ static void sub_80B01BC(u8 taskId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B0244(void)
|
// Only called by an unused function
|
||||||
|
// DoTeleportTileWarp is used instead
|
||||||
|
void DoSpinEnterWarp(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
CreateTask(Task_WarpAndLoadMap, 10);
|
CreateTask(Task_WarpAndLoadMap, 10);
|
||||||
gFieldCallback = FieldCB_TeleportTileWarpExit;
|
gFieldCallback = FieldCB_SpinEnterWarp;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sub_80B0268(void)
|
// Opposite of DoSpinEnterWarp / DoTeleportTileWarp
|
||||||
|
// Player exits current map by spinning up offscreen, enters new map with a fade in
|
||||||
|
void DoSpinExitWarp(void)
|
||||||
{
|
{
|
||||||
ScriptContext2_Enable();
|
ScriptContext2_Enable();
|
||||||
gFieldCallback = FieldCB_DefaultWarpExit;
|
gFieldCallback = FieldCB_DefaultWarpExit;
|
||||||
CreateTask(sub_80B01BC, 10);
|
CreateTask(Task_SpinExitWarp, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadOrbEffectPalette(bool8 blueOrb)
|
static void LoadOrbEffectPalette(bool8 blueOrb)
|
||||||
@ -1109,7 +1115,6 @@ static bool8 sub_80B02C8(u16 shakeDir)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define tState data[0]
|
|
||||||
#define tBlueOrb data[1]
|
#define tBlueOrb data[1]
|
||||||
#define tCenterX data[2]
|
#define tCenterX data[2]
|
||||||
#define tCenterY data[3]
|
#define tCenterY data[3]
|
||||||
@ -1148,7 +1153,7 @@ static void Task_OrbEffect(u8 taskId)
|
|||||||
case 1:
|
case 1:
|
||||||
sub_8199DF0(0, PIXEL_FILL(1), 0, 1);
|
sub_8199DF0(0, PIXEL_FILL(1), 0, 1);
|
||||||
LoadOrbEffectPalette(tBlueOrb);
|
LoadOrbEffectPalette(tBlueOrb);
|
||||||
sub_80B003C(tCenterX, tCenterY, 1, 160, 1, 2);
|
StartUpdateOrbFlashEffect(tCenterX, tCenterY, 1, 160, 1, 2);
|
||||||
tState = 2;
|
tState = 2;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
@ -1243,7 +1248,6 @@ void FadeOutOrbEffect(void)
|
|||||||
gTasks[taskId].tState = 6;
|
gTasks[taskId].tState = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef tState
|
|
||||||
#undef tBlueOrb
|
#undef tBlueOrb
|
||||||
#undef tCenterX
|
#undef tCenterX
|
||||||
#undef tCenterY
|
#undef tCenterY
|
||||||
|
@ -53,7 +53,7 @@ static bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
|
|||||||
static u8 GetDirectionToHiddenItem(s16 distanceX, s16 distanceY);
|
static u8 GetDirectionToHiddenItem(s16 distanceX, s16 distanceY);
|
||||||
static void PlayerFaceHiddenItem(u8 a);
|
static void PlayerFaceHiddenItem(u8 a);
|
||||||
static void CheckForHiddenItemsInMapConnection(u8 taskId);
|
static void CheckForHiddenItemsInMapConnection(u8 taskId);
|
||||||
static void sub_80FDC00(u8 taskId);
|
static void Task_OpenRegisteredPokeblockCase(u8 taskId);
|
||||||
static void ItemUseOnFieldCB_Bike(u8 taskId);
|
static void ItemUseOnFieldCB_Bike(u8 taskId);
|
||||||
static void ItemUseOnFieldCB_Rod(u8);
|
static void ItemUseOnFieldCB_Rod(u8);
|
||||||
static void ItemUseOnFieldCB_Itemfinder(u8);
|
static void ItemUseOnFieldCB_Itemfinder(u8);
|
||||||
@ -69,7 +69,7 @@ static void Task_StartUseRepel(u8 taskId);
|
|||||||
static void Task_UseRepel(u8 taskId);
|
static void Task_UseRepel(u8 taskId);
|
||||||
static void Task_CloseCantUseKeyItemMessage(u8 taskId);
|
static void Task_CloseCantUseKeyItemMessage(u8 taskId);
|
||||||
static void SetDistanceOfClosestHiddenItem(u8 taskId, s16 x, s16 y);
|
static void SetDistanceOfClosestHiddenItem(u8 taskId, s16 x, s16 y);
|
||||||
static void CB2_OpenPokeblockCaseOnField(void);
|
static void CB2_OpenPokeblockFromBag(void);
|
||||||
|
|
||||||
// EWRAM variables
|
// EWRAM variables
|
||||||
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
EWRAM_DATA static void(*sItemUseOnFieldCB)(u8 taskId) = NULL;
|
||||||
@ -615,23 +615,23 @@ void ItemUseOutOfBattle_PokeblockCase(u8 taskId)
|
|||||||
}
|
}
|
||||||
else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE)
|
else if (gTasks[taskId].tUsingRegisteredKeyItem != TRUE)
|
||||||
{
|
{
|
||||||
gBagMenu->exitCallback = CB2_OpenPokeblockCaseOnField;
|
gBagMenu->exitCallback = CB2_OpenPokeblockFromBag;
|
||||||
Task_FadeAndCloseBagMenu(taskId);
|
Task_FadeAndCloseBagMenu(taskId);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gFieldCallback = sub_80AF6D4;
|
gFieldCallback = FieldCB_ReturnToFieldNoScript;
|
||||||
FadeScreen(FADE_TO_BLACK, 0);
|
FadeScreen(FADE_TO_BLACK, 0);
|
||||||
gTasks[taskId].func = sub_80FDC00;
|
gTasks[taskId].func = Task_OpenRegisteredPokeblockCase;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CB2_OpenPokeblockCaseOnField(void)
|
static void CB2_OpenPokeblockFromBag(void)
|
||||||
{
|
{
|
||||||
OpenPokeblockCase(PBLOCK_CASE_FIELD, CB2_ReturnToBagMenuPocket);
|
OpenPokeblockCase(PBLOCK_CASE_FIELD, CB2_ReturnToBagMenuPocket);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sub_80FDC00(u8 taskId)
|
static void Task_OpenRegisteredPokeblockCase(u8 taskId)
|
||||||
{
|
{
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +107,7 @@ void CB2_EndSafariBattle(void)
|
|||||||
{
|
{
|
||||||
ScriptContext2_RunNewScript(SafariZone_EventScript_OutOfBallsMidBattle);
|
ScriptContext2_RunNewScript(SafariZone_EventScript_OutOfBallsMidBattle);
|
||||||
WarpIntoMap();
|
WarpIntoMap();
|
||||||
gFieldCallback = sub_80AF6F0;
|
gFieldCallback = FieldCB_ReturnToFieldNoScriptCheckMusic;
|
||||||
SetMainCallback2(CB2_LoadMap);
|
SetMainCallback2(CB2_LoadMap);
|
||||||
}
|
}
|
||||||
else if (gBattleOutcome == B_OUTCOME_CAUGHT)
|
else if (gBattleOutcome == B_OUTCOME_CAUGHT)
|
||||||
|
@ -2235,7 +2235,9 @@ bool8 ScrCmd_gotoram(struct ScriptContext *ctx)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8 ScrCmd_warpD1(struct ScriptContext *ctx)
|
// Unused
|
||||||
|
// For the warp used by the Aqua Hideout, see DoTeleportTileWarp
|
||||||
|
bool8 ScrCmd_warpspinenter(struct ScriptContext *ctx)
|
||||||
{
|
{
|
||||||
u8 mapGroup = ScriptReadByte(ctx);
|
u8 mapGroup = ScriptReadByte(ctx);
|
||||||
u8 mapNum = ScriptReadByte(ctx);
|
u8 mapNum = ScriptReadByte(ctx);
|
||||||
@ -2244,8 +2246,8 @@ bool8 ScrCmd_warpD1(struct ScriptContext *ctx)
|
|||||||
u16 y = VarGet(ScriptReadHalfword(ctx));
|
u16 y = VarGet(ScriptReadHalfword(ctx));
|
||||||
|
|
||||||
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
SetWarpDestination(mapGroup, mapNum, warpId, x, y);
|
||||||
sub_808D074(GetPlayerFacingDirection());
|
SetSpinStartFacingDir(GetPlayerFacingDirection());
|
||||||
sub_80B0244();
|
DoSpinEnterWarp();
|
||||||
ResetInitialPlayerAvatarState();
|
ResetInitialPlayerAvatarState();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user