pokeemerald/src/fldeff_teleport.c

44 lines
1012 B
C
Raw Normal View History

2017-12-04 02:46:56 +01:00
#include "global.h"
2018-01-02 02:21:30 +01:00
#include "fldeff_teleport.h"
2017-12-04 02:46:56 +01:00
#include "field_effect.h"
2018-01-02 02:21:30 +01:00
#include "field_player_avatar.h"
#include "party_menu.h"
#include "overworld.h"
#include "rom6.h"
2017-12-04 02:46:56 +01:00
#include "task.h"
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;
gPostMenuFieldCallback = hm_teleport_run_dp02scr;
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;
}
2017-12-04 23:12:05 +01:00
void hm_teleport_run_dp02scr(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();
gTasks[taskId].data[8] = (u32)sub_817C94C >> 16;
gTasks[taskId].data[9] = (u32)sub_817C94C;
2017-12-04 02:46:56 +01:00
SetPlayerAvatarTransitionFlags(1);
2018-01-02 02:21:30 +01:00
return FALSE;
2017-12-04 02:46:56 +01:00
}
2017-12-04 23:12:05 +01:00
void sub_817C94C(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
}