pokeemerald/src/fldeff_teleport.c

45 lines
1.2 KiB
C
Raw Normal View History

2017-12-04 02:46:56 +01:00
#include "global.h"
#include "field_effect.h"
2018-01-02 02:21:30 +01:00
#include "field_player_avatar.h"
2018-12-24 21:59:05 +01:00
#include "fldeff.h"
2018-01-02 02:21:30 +01:00
#include "party_menu.h"
#include "overworld.h"
2017-12-04 02:46:56 +01:00
#include "task.h"
2018-11-13 15:19:04 +01:00
#include "constants/field_effects.h"
2017-12-04 02:46:56 +01:00
2018-10-17 14:52:26 +02:00
static void FieldCallback_Teleport(void);
static void StartTeleportFieldEffect(void);
2017-12-04 23:12:05 +01:00
bool8 SetUpFieldMove_Teleport(void)
2017-12-04 02:46:56 +01:00
{
2018-01-02 02:21:30 +01:00
if (Overworld_MapTypeAllowsTeleportAndFly(gMapHeader.mapType) == TRUE)
2017-12-04 02:46:56 +01:00
{
2018-06-16 00:45:48 +02:00
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
2018-10-17 14:52:26 +02:00
gPostMenuFieldCallback = FieldCallback_Teleport;
2017-12-04 02:46:56 +01:00
return TRUE;
2018-02-13 18:38:54 +01:00
}
2017-12-04 02:46:56 +01:00
return FALSE;
}
2018-10-17 14:52:26 +02:00
static void FieldCallback_Teleport(void)
2017-12-04 02:46:56 +01:00
{
2018-01-02 02:21:30 +01:00
Overworld_ResetStateAfterTeleport();
FieldEffectStart(FLDEFF_USE_TELEPORT);
2017-12-04 02:46:56 +01:00
gFieldEffectArguments[0] = (u32)GetCursorSelectionMonId();
}
2018-01-02 02:21:30 +01:00
bool8 FldEff_UseTeleport(void)
2017-12-04 02:46:56 +01:00
{
2018-01-02 02:21:30 +01:00
u8 taskId = oei_task_add();
2018-10-17 14:52:26 +02:00
gTasks[taskId].data[8] = (u32)StartTeleportFieldEffect >> 16;
gTasks[taskId].data[9] = (u32)StartTeleportFieldEffect;
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
2018-01-02 02:21:30 +01:00
return FALSE;
2017-12-04 02:46:56 +01:00
}
2018-10-17 14:52:26 +02:00
static void StartTeleportFieldEffect(void)
2017-12-04 02:46:56 +01:00
{
2018-01-02 02:21:30 +01:00
FieldEffectActiveListRemove(FLDEFF_USE_TELEPORT);
CreateTeleportFieldEffectTask();
2017-12-04 02:46:56 +01:00
}