Merge pull request #1471 from GriffinRichards/fix-lock

Fix some object lock names
This commit is contained in:
GriffinR 2021-07-03 11:21:10 -04:00 committed by GitHub
commit b4f66496ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 10 deletions

View File

@ -813,12 +813,12 @@
.byte 0x68
.endm
@ Ceases movement for all Objects on-screen.
@ Freezes all objects immediately except the player. The player is frozen once their movement is finished.
.macro lockall
.byte 0x69
.endm
@ If the script was called by an Object, then that Object's movement will cease.
@ Freezes all objects immediately except the player and the selected object. The player and selected object are frozen once their movement is finished.
.macro lock
.byte 0x6a
.endm

View File

@ -2,9 +2,9 @@
#define GUARD_EVENT_OBJECT_LOCK_H
bool8 IsFreezePlayerFinished(void);
void ScriptFreezeObjectEvents(void);
bool8 IsFreezeSelectedObjectAndPlayerFinished(void);
void LockSelectedObjectEvent(void);
void FreezeObjects_WaitForPlayer(void);
void FreezeObjects_WaitForPlayerAndSelected(void);
void FreezeForApproachingTrainers(void);
bool8 IsFreezeObjectAndPlayerFinished(void);
void ScriptUnfreezeObjectEvents(void);

View File

@ -40,7 +40,7 @@ bool8 IsFreezePlayerFinished(void)
}
void ScriptFreezeObjectEvents(void)
void FreezeObjects_WaitForPlayer(void)
{
FreezeObjectEvents();
CreateTask(Task_FreezePlayer, 80);
@ -82,7 +82,9 @@ bool8 IsFreezeSelectedObjectAndPlayerFinished(void)
}
}
void LockSelectedObjectEvent(void)
// Freeze all objects immediately except the selected object and the player.
// The selected object and player are frozen once their movement is finished.
void FreezeObjects_WaitForPlayerAndSelected(void)
{
u8 taskId;
FreezeObjectEventsExceptOne(gSelectedObjectEvent);
@ -144,6 +146,8 @@ static void Task_FreezeObjectAndPlayer(u8 taskId)
DestroyTask(taskId);
}
// Freeze all objects immediately except the player and the approaching trainers.
// The approaching trainers and player are frozen once their movement is finished
void FreezeForApproachingTrainers(void)
{
u8 trainerObjectId1, trainerObjectId2, taskId;

View File

@ -1203,6 +1203,8 @@ bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
return FALSE;
}
// lockall freezes all object events except the player immediately.
// The player is frozen after waiting for their current movement to finish.
bool8 ScrCmd_lockall(struct ScriptContext *ctx)
{
if (IsUpdateLinkStateCBActive())
@ -1211,12 +1213,14 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx)
}
else
{
ScriptFreezeObjectEvents();
FreezeObjects_WaitForPlayer();
SetupNativeScript(ctx, IsFreezePlayerFinished);
return TRUE;
}
}
// lock freezes all object events except the player and the selected object immediately.
// The player and selected object are frozen after waiting for their current movement to finish.
bool8 ScrCmd_lock(struct ScriptContext *ctx)
{
if (IsUpdateLinkStateCBActive())
@ -1227,12 +1231,12 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx)
{
if (gObjectEvents[gSelectedObjectEvent].active)
{
LockSelectedObjectEvent();
FreezeObjects_WaitForPlayerAndSelected();
SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished);
}
else
{
ScriptFreezeObjectEvents();
FreezeObjects_WaitForPlayer();
SetupNativeScript(ctx, IsFreezePlayerFinished);
}
return TRUE;

View File

@ -4420,7 +4420,7 @@ static void HandleCancelActivity(bool32 setData)
static void UR_EnableScriptContext2AndFreezeObjectEvents(void)
{
ScriptContext2_Enable();
ScriptFreezeObjectEvents();
FreezeObjects_WaitForPlayer();
}
static u8 GetActivePartnerSpriteGenderParam(struct WirelessLink_URoom *data)