Skip to content

Commit

Permalink
Add OW_UNION_DISABLE_CHECK and OW_FLAG_MOVE_UNION_ROOM_CHECK (rh-hide…
Browse files Browse the repository at this point in the history
…out#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 rh-hideout#5448 (comment)
  • Loading branch information
pkmnsnfrn authored Oct 7, 2024
1 parent a7fca61 commit 0dcb28b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 1 deletion.
4 changes: 4 additions & 0 deletions data/scripts/cable_club.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions data/scripts/pkmn_center_nurse.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion include/config/overworld.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions include/link.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,5 +344,6 @@ bool8 DoesLinkPlayerCountMatchSaved(void);
void SetCloseLinkCallbackAndType(u16 type);
bool32 IsSendingKeysToLink(void);
u32 GetLinkRecvQueueLength(void);
bool32 ShouldCheckForUnionRoom(void);

#endif // GUARD_LINK_H
14 changes: 14 additions & 0 deletions src/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
6 changes: 6 additions & 0 deletions src/union_room.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -3377,6 +3380,9 @@ static void Task_InitUnionRoom(u8 taskId)

bool16 BufferUnionRoomPlayerName(void)
{
if (!ShouldCheckForUnionRoom())
return FALSE;

if (sUnionRoomPlayerName[0] != EOS)
{
StringCopy(gStringVar1, sUnionRoomPlayerName);
Expand Down

0 comments on commit 0dcb28b

Please sign in to comment.