Fix some object lock names

This commit is contained in:
GriffinR 2021-05-04 01:21:50 -04:00
parent 24e02085d7
commit 4206359862
5 changed files with 18 additions and 10 deletions

View File

@ -812,12 +812,12 @@
.byte 0x68 .byte 0x68
.endm .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 .macro lockall
.byte 0x69 .byte 0x69
.endm .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 .macro lock
.byte 0x6a .byte 0x6a
.endm .endm

View File

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

View File

@ -40,7 +40,7 @@ bool8 IsFreezePlayerFinished(void)
} }
void ScriptFreezeObjectEvents(void) void FreezeObjects_WaitForPlayer(void)
{ {
FreezeObjectEvents(); FreezeObjectEvents();
CreateTask(Task_FreezePlayer, 80); 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; u8 taskId;
FreezeObjectEventsExceptOne(gSelectedObjectEvent); FreezeObjectEventsExceptOne(gSelectedObjectEvent);
@ -144,6 +146,8 @@ static void Task_FreezeObjectAndPlayer(u8 taskId)
DestroyTask(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) void FreezeForApproachingTrainers(void)
{ {
u8 trainerObjectId1, trainerObjectId2, taskId; u8 trainerObjectId1, trainerObjectId2, taskId;

View File

@ -1203,6 +1203,8 @@ bool8 ScrCmd_turnvobject(struct ScriptContext *ctx)
return FALSE; 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) bool8 ScrCmd_lockall(struct ScriptContext *ctx)
{ {
if (IsUpdateLinkStateCBActive()) if (IsUpdateLinkStateCBActive())
@ -1211,12 +1213,14 @@ bool8 ScrCmd_lockall(struct ScriptContext *ctx)
} }
else else
{ {
ScriptFreezeObjectEvents(); FreezeObjects_WaitForPlayer();
SetupNativeScript(ctx, IsFreezePlayerFinished); SetupNativeScript(ctx, IsFreezePlayerFinished);
return TRUE; 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) bool8 ScrCmd_lock(struct ScriptContext *ctx)
{ {
if (IsUpdateLinkStateCBActive()) if (IsUpdateLinkStateCBActive())
@ -1227,12 +1231,12 @@ bool8 ScrCmd_lock(struct ScriptContext *ctx)
{ {
if (gObjectEvents[gSelectedObjectEvent].active) if (gObjectEvents[gSelectedObjectEvent].active)
{ {
LockSelectedObjectEvent(); FreezeObjects_WaitForPlayerAndSelected();
SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished); SetupNativeScript(ctx, IsFreezeSelectedObjectAndPlayerFinished);
} }
else else
{ {
ScriptFreezeObjectEvents(); FreezeObjects_WaitForPlayer();
SetupNativeScript(ctx, IsFreezePlayerFinished); SetupNativeScript(ctx, IsFreezePlayerFinished);
} }
return TRUE; return TRUE;

View File

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