pokeemerald/src/fldeff_teleport.c

45 lines
1.2 KiB
C
Raw Normal View History

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