diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index e810e354a5..9120787ea9 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -1258,7 +1258,11 @@ EventScript_CloseMossdeepGameCornerBarrier:: CableClub_OnResume: special InitUnionRoom +.if OW_FLAG_MOVE_UNION_ROOM_CHECK != 0 + return +.else end +.endif MossdeepCity_GameCorner_1F_EventScript_InfoMan2:: lock diff --git a/data/scripts/pkmn_center_nurse.inc b/data/scripts/pkmn_center_nurse.inc index 5cef458749..4aca9d768b 100644 --- a/data/scripts/pkmn_center_nurse.inc +++ b/data/scripts/pkmn_center_nurse.inc @@ -36,6 +36,11 @@ EventScript_PkmnCenterNurse_TakeAndHealPkmn:: applymovement VAR_0x800B, Movement_PkmnCenterNurse_Turn @ Changed from Common_Movement_WalkInPlaceFasterLeft to force the follower to enter their Poké Ball waitmovement 0 dofieldeffect FLDEFF_POKECENTER_HEAL +.if OW_UNION_DISABLE_CHECK == FALSE && OW_FLAG_MOVE_UNION_ROOM_CHECK != 0 + setflag OW_FLAG_MOVE_UNION_ROOM_CHECK + call CableClub_OnResume + clearflag OW_FLAG_MOVE_UNION_ROOM_CHECK +.endif waitfieldeffect FLDEFF_POKECENTER_HEAL applymovement VAR_0x800B, Common_Movement_WalkInPlaceFasterDown waitmovement 0 diff --git a/include/config/overworld.h b/include/config/overworld.h index 3298a03209..dd109b7104 100644 --- a/include/config/overworld.h +++ b/include/config/overworld.h @@ -106,6 +106,8 @@ #define OW_POPUP_BW_ALPHA_BLEND FALSE // Enables alpha blending/transparency for the pop-ups. Mainly intended to be used with the black color option. // Pokémon Center -#define OW_IGNORE_EGGS_ON_HEAL GEN_LATEST // In Gen 4+, the nurse in the Pokémon Center does not heal Eggs on healing machine. +#define OW_IGNORE_EGGS_ON_HEAL GEN_LATEST // In Gen 4+, the nurse in the Pokémon Center does not heal Eggs on healing machine. +#define OW_UNION_DISABLE_CHECK FALSE // When TRUE, the nurse does not inform the player if there is a trainer waiting in the Union Room. This speeds up the loading of the Pokémon Center. +#define OW_FLAG_MOVE_UNION_ROOM_CHECK 0 // If this flag is set, the game will only check if players are in the Union Room while healing Pokémon, and not when players enter the Pokémon Center. This speeds up the loading of the Pokémon Center. This is ignored if OW_UNION_DISABLE_CHECK is TRUE. #endif // GUARD_CONFIG_OVERWORLD_H diff --git a/include/link.h b/include/link.h index 66dd5fecd2..6763065055 100644 --- a/include/link.h +++ b/include/link.h @@ -344,5 +344,6 @@ bool8 DoesLinkPlayerCountMatchSaved(void); void SetCloseLinkCallbackAndType(u16 type); bool32 IsSendingKeysToLink(void); u32 GetLinkRecvQueueLength(void); +bool32 ShouldCheckForUnionRoom(void); #endif // GUARD_LINK_H diff --git a/src/link.c b/src/link.c index f784a36c67..a78e69260a 100644 --- a/src/link.c +++ b/src/link.c @@ -2367,3 +2367,17 @@ void ResetRecvBuffer(void) } } } + +bool32 ShouldCheckForUnionRoom(void) +{ + if (OW_UNION_DISABLE_CHECK) + return FALSE; + + if (OW_FLAG_MOVE_UNION_ROOM_CHECK == 0) + return TRUE; + + if (FlagGet(OW_FLAG_MOVE_UNION_ROOM_CHECK)) + return TRUE; + + return FALSE; +} diff --git a/src/union_room.c b/src/union_room.c index f4ee01d1b4..ac4c61035a 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -3294,6 +3294,9 @@ void InitUnionRoom(void) { struct WirelessLink_URoom *data; + if (!ShouldCheckForUnionRoom()) + return; + sUnionRoomPlayerName[0] = EOS; CreateTask(Task_InitUnionRoom, 0); sWirelessLinkMain.uRoom = sWirelessLinkMain.uRoom; // Needed to match. @@ -3377,6 +3380,9 @@ static void Task_InitUnionRoom(u8 taskId) bool16 BufferUnionRoomPlayerName(void) { + if (!ShouldCheckForUnionRoom()) + return FALSE; + if (sUnionRoomPlayerName[0] != EOS) { StringCopy(gStringVar1, sUnionRoomPlayerName);