Add OW_UNION_DISABLE_CHECK and OW_FLAG_MOVE_UNION_ROOM_CHECK (#5448)

* First addition of both checks

* Updated config file

* fixed spacing

* Updated spacing

* Fixed issues where feature was always on

* Update overworld.h

fixed spacing per https://github.com/rh-hideout/pokeemerald-expansion/pull/5448#discussion_r1789647611
This commit is contained in:
psf 2024-10-07 08:07:23 -07:00 committed by GitHub
parent a7fca616b0
commit 0dcb28ba0e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 33 additions and 1 deletions

View file

@ -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

View file

@ -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

View file

@ -107,5 +107,7 @@
// 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_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

View file

@ -344,5 +344,6 @@ bool8 DoesLinkPlayerCountMatchSaved(void);
void SetCloseLinkCallbackAndType(u16 type);
bool32 IsSendingKeysToLink(void);
u32 GetLinkRecvQueueLength(void);
bool32 ShouldCheckForUnionRoom(void);
#endif // GUARD_LINK_H

View file

@ -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;
}

View file

@ -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);