Allow flags in trigger scripts (#4900)
This commit is contained in:
parent
cc00446eb8
commit
e82e3b4198
1 changed files with 11 additions and 1 deletions
|
@ -932,6 +932,16 @@ static s8 GetWarpEventAtPosition(struct MapHeader *mapHeader, u16 x, u16 y, u8 e
|
|||
return WARP_ID_NONE;
|
||||
}
|
||||
|
||||
static bool32 ShouldTriggerScriptRun(const struct CoordEvent *coordEvent)
|
||||
{
|
||||
u16 *varPtr = GetVarPointer(coordEvent->trigger);
|
||||
// Treat non Vars as flags
|
||||
if (varPtr == NULL)
|
||||
return (FlagGet(coordEvent->trigger) == coordEvent->index);
|
||||
else
|
||||
return (*varPtr == coordEvent->index);
|
||||
}
|
||||
|
||||
static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
|
||||
{
|
||||
if (coordEvent != NULL)
|
||||
|
@ -946,7 +956,7 @@ static const u8 *TryRunCoordEventScript(const struct CoordEvent *coordEvent)
|
|||
RunScriptImmediately(coordEvent->script);
|
||||
return NULL;
|
||||
}
|
||||
if (VarGet(coordEvent->trigger) == (u8)coordEvent->index)
|
||||
if (ShouldTriggerScriptRun(coordEvent))
|
||||
return coordEvent->script;
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in a new issue