pokeemerald/src/fldeff_dig.c

64 lines
1.4 KiB
C
Raw Normal View History

2018-12-24 21:59:05 +01:00
#include "global.h"
#include "braille_puzzles.h"
#include "field_effect.h"
#include "field_player_avatar.h"
#include "fldeff.h"
#include "item_use.h"
#include "overworld.h"
#include "party_menu.h"
#include "sprite.h"
#include "constants/field_effects.h"
// static functions
2020-07-02 10:59:52 +02:00
static void FieldCallback_Dig(void);
static void StartDigFieldEffect(void);
2018-12-24 21:59:05 +01:00
// text
bool8 SetUpFieldMove_Dig(void)
{
if (CanUseDigOrEscapeRopeOnCurMap() == TRUE)
2018-12-24 21:59:05 +01:00
{
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
2020-07-02 10:59:52 +02:00
gPostMenuFieldCallback = FieldCallback_Dig;
2018-12-24 21:59:05 +01:00
return TRUE;
}
else
{
return FALSE;
}
}
2020-07-02 10:59:52 +02:00
static void FieldCallback_Dig(void)
2018-12-24 21:59:05 +01:00
{
Overworld_ResetStateAfterDigEscRope();
FieldEffectStart(FLDEFF_USE_DIG);
gFieldEffectArguments[0] = GetCursorSelectionMonId();
}
bool8 FldEff_UseDig(void)
{
u8 taskId = CreateFieldMoveTask();
2018-12-24 21:59:05 +01:00
2020-07-02 10:59:52 +02:00
gTasks[taskId].data[8] = (u32)StartDigFieldEffect >> 16;
gTasks[taskId].data[9] = (u32)StartDigFieldEffect;
2018-12-24 21:59:05 +01:00
if (!ShouldDoBrailleDigEffect())
SetPlayerAvatarTransitionFlags(PLAYER_AVATAR_FLAG_ON_FOOT);
return FALSE;
}
2020-07-02 10:59:52 +02:00
static void StartDigFieldEffect(void)
2018-12-24 21:59:05 +01:00
{
u8 taskId;
FieldEffectActiveListRemove(FLDEFF_USE_DIG);
if (ShouldDoBrailleDigEffect())
{
DoBrailleDigEffect();
}
else
{
2019-12-22 01:01:38 +01:00
taskId = CreateTask(Task_UseDigEscapeRopeOnField, 8);
2018-12-24 21:59:05 +01:00
gTasks[taskId].data[0] = 0;
}
}