pokeemerald/src/fldeff_strength.c
tustin2121 1cb659df8c Renaming Script Contexts
- Determined how the various script contexts were used and renamed accordingly.
- ScriptContext2_Enable/Disable => Lock/UnlockPlayerFieldControls - The sole purpose of the flag is to make sure the player can't move around in the overworld. It has nothing to do with script contexts.
- ScriptContext1 => ScriptContext - It is the global script context used to set up scripts which run over many frames.
- ScriptContext2_RunNewScript => RunScriptImmediately - ScriptContext2's sole purpose was to run scripts immediately and in a separate context, usually while the global context is waiting for things like map loads or screen changes.
2022-08-15 15:18:12 -04:00

51 lines
1.4 KiB
C

#include "global.h"
#include "event_data.h"
#include "event_scripts.h"
#include "field_effect.h"
#include "fldeff.h"
#include "party_menu.h"
#include "script.h"
#include "string_util.h"
#include "task.h"
#include "constants/event_objects.h"
#include "constants/field_effects.h"
// static functions
static void FieldCallback_Strength(void);
static void StartStrengthFieldEffect(void);
// text
bool8 SetUpFieldMove_Strength(void)
{
if (CheckObjectGraphicsInFrontOfPlayer(OBJ_EVENT_GFX_PUSHABLE_BOULDER) == TRUE)
{
gSpecialVar_Result = GetCursorSelectionMonId();
gFieldCallback2 = FieldCallback_PrepareFadeInFromMenu;
gPostMenuFieldCallback = FieldCallback_Strength;
return TRUE;
}
return FALSE;
}
static void FieldCallback_Strength(void)
{
gFieldEffectArguments[0] = GetCursorSelectionMonId();
ScriptContext_SetupScript(EventScript_UseStrength);
}
bool8 FldEff_UseStrength(void)
{
u8 taskId = CreateFieldMoveTask();
gTasks[taskId].data[8] = (u32)StartStrengthFieldEffect >> 16;
gTasks[taskId].data[9] = (u32)StartStrengthFieldEffect;
GetMonNickname(&gPlayerParty[gFieldEffectArguments[0]], gStringVar1);
return FALSE;
}
// Just passes control back to EventScript_UseStrength
static void StartStrengthFieldEffect(void)
{
FieldEffectActiveListRemove(FLDEFF_USE_STRENGTH);
ScriptContext_Enable();
}