Added flag for safe follower movement.

This commit is contained in:
Ariel A 2021-12-29 20:22:13 -05:00
parent 58a3e55b39
commit d06e1d4af6
2 changed files with 4 additions and 1 deletions

View file

@ -1641,6 +1641,7 @@
#define FLAG_ENABLE_MULTI_CORRIDOR_DOOR (SPECIAL_FLAGS_START + 0x2)
#define FLAG_SPECIAL_FLAG_UNUSED_0x4003 (SPECIAL_FLAGS_START + 0x3) // Unused Flag
#define FLAG_STORING_ITEMS_IN_PYRAMID_BAG (SPECIAL_FLAGS_START + 0x4)
#define FLAG_SAFE_FOLLOWER_MOVEMENT (SPECIAL_FLAGS_START + 0x5) // When set, applymovement does not put the follower inside a pokeball
// FLAG_SPECIAL_FLAG_0x4005 - 0x407F also exist and are unused
#define SPECIAL_FLAGS_END (SPECIAL_FLAGS_START + 0x7F)

View file

@ -1005,7 +1005,7 @@ bool8 ScrCmd_applymovement(struct ScriptContext *ctx)
ScriptMovement_StartObjectMovementScript(localId, gSaveBlock1Ptr->location.mapNum, gSaveBlock1Ptr->location.mapGroup, movementScript);
sMovingNpcId = localId;
if (localId != OBJ_EVENT_ID_FOLLOWER) { // Force follower into pokeball
if (localId != OBJ_EVENT_ID_FOLLOWER && !FlagGet(FLAG_SAFE_FOLLOWER_MOVEMENT)) { // Force follower into pokeball
objEvent = GetFollowerObject();
// return early if no follower or in shadowing state
if (objEvent == NULL || gSprites[objEvent->spriteId].data[1] == 0) {
@ -1262,6 +1262,7 @@ bool8 ScrCmd_releaseall(struct ScriptContext *ctx)
{
u8 playerObjectId;
struct ObjectEvent *followerObject = GetFollowerObject();
FlagClear(FLAG_SAFE_FOLLOWER_MOVEMENT);
// Release follower from movement iff it exists and is in the shadowing state
if (followerObject && gSprites[followerObject->spriteId].data[1] == 0)
ClearObjectEventMovement(followerObject, &gSprites[followerObject->spriteId]);
@ -1278,6 +1279,7 @@ bool8 ScrCmd_release(struct ScriptContext *ctx)
{
u8 playerObjectId;
struct ObjectEvent *followerObject = GetFollowerObject();
FlagClear(FLAG_SAFE_FOLLOWER_MOVEMENT);
// Release follower from movement iff it exists and is in the shadowing state
if (followerObject && gSprites[followerObject->spriteId].data[1] == 0)
ClearObjectEventMovement(followerObject, &gSprites[followerObject->spriteId]);