Merge branch 'romhack' into lighting

This commit is contained in:
Ariel A 2022-03-16 19:43:13 -04:00
commit 07333b5219
4 changed files with 18 additions and 2 deletions

View File

@ -25,6 +25,7 @@ void FieldEffectScript_LoadTiles(u8 **script);
void FieldEffectScript_LoadFadedPalette(u8 **script);
void FieldEffectScript_LoadPalette(u8 **script);
void FieldEffectScript_CallNative(u8 **script, u32 *val);
void FieldEffectFreeGraphicsResources(struct Sprite *sprite);
void FieldEffectFreeTilesIfUnused(u16 tileStart);
void FieldEffectFreePaletteIfUnused(u8 paletteNum);
bool8 FieldEffectCmd_loadtiles(u8 **script, u32 *val);

View File

@ -4802,6 +4802,12 @@ bool8 MovementType_FollowPlayer_Shadow(struct ObjectEvent *objectEvent, struct S
objectEvent->triggerGroundEffectsOnMove = FALSE; // Stop endless reflection spawning
return FALSE;
}
// Move follower to player, in case we end up in the shadowing state for only 1 frame
// This way the player cannot talk to the invisible follower before it appears
if (objectEvent->invisible) {
MoveObjectEventToMapCoords(objectEvent, gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.x, gObjectEvents[gPlayerAvatar.objectEventId].currentCoords.y);
objectEvent->triggerGroundEffectsOnMove = FALSE; // Stop endless reflection spawning
}
sprite->data[1] = 1; // Enter active state; if the player moves the follower will appear
return TRUE;
}

View File

@ -3118,7 +3118,8 @@ static void HideFrontierExchangeCornerItemIcon(u16 menu, u16 unused)
case SCROLL_MULTI_BF_EXCHANGE_CORNER_DECOR_VENDOR_2:
case SCROLL_MULTI_BF_EXCHANGE_CORNER_VITAMIN_VENDOR:
case SCROLL_MULTI_BF_EXCHANGE_CORNER_HOLD_ITEM_VENDOR:
DestroySpriteAndFreeResources(&gSprites[sScrollableMultichoice_ItemSpriteId]);
// This makes sure deleting the icon will not clear palettes in use by object events
FieldEffectFreeGraphicsResources(&gSprites[sScrollableMultichoice_ItemSpriteId]);
break;
}
sScrollableMultichoice_ItemSpriteId = MAX_SPRITES;

View File

@ -1032,7 +1032,15 @@ bool8 ScrCmd_applymovement_at(struct ScriptContext *ctx)
static bool8 WaitForMovementFinish(void)
{
return ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup);
if (ScriptMovement_IsObjectMovementFinished(sMovingNpcId, sMovingNpcMapNum, sMovingNpcMapGroup)) {
struct ObjectEvent *objEvent = GetFollowerObject();
// If the follower is still entering the pokeball, wait for it to finish too
// This prevents a `release` after this script command from getting the follower stuck in an intermediate state
if (sMovingNpcId != OBJ_EVENT_ID_FOLLOWER && objEvent && ObjectEventGetHeldMovementActionId(objEvent) == MOVEMENT_ACTION_ENTER_POKEBALL)
return ScriptMovement_IsObjectMovementFinished(objEvent->localId, objEvent->mapNum, objEvent->mapGroup);
return TRUE;
}
return FALSE;
}
bool8 ScrCmd_waitmovement(struct ScriptContext *ctx)