pokeemerald/include/union_room.h

163 lines
4.2 KiB
C
Raw Normal View History

2019-03-27 03:41:05 +00:00
#ifndef GUARD_UNION_ROOM_H
#define GUARD_UNION_ROOM_H
2020-01-15 20:46:17 +00:00
#include "link_rfu.h"
2020-06-08 22:16:57 +00:00
#include "link.h"
2020-06-01 14:23:12 +00:00
#include "constants/union_room.h"
2019-03-30 18:36:52 +00:00
// In the Union Room the player is only ever connected to ≤ 4 other players.
// However, there can be up to MAX_UNION_ROOM_LEADERS (8) object events to
2022-09-11 18:14:49 +00:00
// represent leaders of recently discovered link groups, and each of those groups
// may have up to MAX_RFU_PLAYERS (5) players in it including the leader.
// These players are represented on-screen by NPC sprites drawn around the leader.
// Thus there can be 40 sprites of other players on-screen, in 8 groups of 5.
#define NUM_UNION_ROOM_SPRITES (MAX_UNION_ROOM_LEADERS * MAX_RFU_PLAYERS)
// The maximum number of recently connected players that can be tracked.
// Note that this is significantly less than NUM_UNION_ROOM_SPRITES, i.e. not
// every player that can be shown in the Union Room can be tracked at once.
2022-09-11 18:14:49 +00:00
// Information such as a group member's gender can instead be read from partnerInfo
// of the leader's RfuGameData by tracking at least all of the group leaders.
#define MAX_RFU_PLAYER_LIST_SIZE 16
struct RfuPlayerData
2019-03-30 18:36:52 +00:00
{
struct RfuGameData data;
u8 ALIGNED(4) name[RFU_USER_NAME_LENGTH];
2019-03-30 18:36:52 +00:00
};
struct RfuPlayer
2019-03-30 18:36:52 +00:00
{
struct RfuPlayerData rfu;
2020-06-08 22:16:57 +00:00
u16 timeoutCounter;
2020-05-30 08:09:21 +00:00
u8 groupScheduledAnim:2;
2020-06-08 22:16:57 +00:00
bool8 useRedText:1; // Never set
u8 newPlayerCountdown;
u8 unused;
2019-03-30 18:36:52 +00:00
};
struct RfuPlayerList
2019-03-30 18:36:52 +00:00
{
struct RfuPlayer players[MAX_RFU_PLAYER_LIST_SIZE];
2019-03-30 18:36:52 +00:00
};
struct RfuIncomingPlayer
2019-03-30 18:36:52 +00:00
{
struct RfuPlayerData rfu;
bool8 active:1;
2019-03-30 18:36:52 +00:00
};
struct RfuIncomingPlayerList
2019-03-30 18:36:52 +00:00
{
struct RfuIncomingPlayer players[MAX_RFU_PLAYERS];
2019-03-30 18:36:52 +00:00
};
2020-05-30 08:09:21 +00:00
struct WirelessLink_Leader
2019-03-30 18:36:52 +00:00
{
struct RfuPlayerList *playerList;
struct RfuIncomingPlayerList *incomingPlayerList;
struct RfuPlayerList *playerListBackup;
2019-03-30 18:36:52 +00:00
u8 state;
u8 textState;
2020-05-30 08:09:21 +00:00
u8 delayTimerAfterOk;
2019-03-30 18:36:52 +00:00
u8 listWindowId;
2020-05-30 08:09:21 +00:00
u8 bButtonCancelWindowId;
u8 nPlayerModeWindowId;
2019-03-30 18:36:52 +00:00
u8 listTaskId;
2020-05-30 08:09:21 +00:00
u8 playerCount;
u16 yesNoWindowId;
u8 unused;
2020-05-30 08:09:21 +00:00
u8 listenTaskId;
u8 activity;
2020-06-08 22:16:57 +00:00
u8 joinRequestAnswer;
u16 memberConfirmTimeout;
2019-03-30 18:36:52 +00:00
};
2020-05-30 08:09:21 +00:00
struct WirelessLink_Group
2019-03-30 18:36:52 +00:00
{
struct RfuPlayerList *playerList;
struct RfuIncomingPlayerList *incomingPlayerList;
2019-03-30 18:36:52 +00:00
u8 state;
u8 textState;
u8 delayTimerAfterOk; // Unused
2019-03-30 18:36:52 +00:00
u8 listWindowId;
2020-05-30 08:09:21 +00:00
u8 bButtonCancelWindowId;
u8 playerNameAndIdWindowId;
2019-03-30 18:36:52 +00:00
u8 listTaskId;
2020-05-30 08:09:21 +00:00
u8 leaderId;
u8 unused;
2020-05-30 08:09:21 +00:00
u8 listenTaskId;
bool8 isWonderNews;
bool8 showListMenu; // Never set
2020-05-30 08:09:21 +00:00
u8 refreshTimer;
u8 delayBeforePrint;
2019-03-30 18:36:52 +00:00
};
2020-06-01 14:23:12 +00:00
struct UnionRoomObject
2019-03-30 18:36:52 +00:00
{
2020-06-01 14:23:12 +00:00
u8 state;
u8 gfxId;
s8 animState;
u8 schedAnim;
2019-03-30 18:36:52 +00:00
};
2019-03-27 03:41:05 +00:00
2020-05-30 08:09:21 +00:00
struct WirelessLink_URoom
2019-03-30 18:36:52 +00:00
{
struct RfuPlayerList *playerList;
struct RfuIncomingPlayerList *incomingChildList;
struct RfuPlayerList *spawnPlayer;
struct RfuIncomingPlayerList *incomingParentList;
2020-06-08 22:16:57 +00:00
u16 unknown; // Never read
u16 unreadPlayerId;
2019-03-30 18:36:52 +00:00
u8 state;
u8 stateAfterPrint;
u8 textState;
2020-06-08 22:16:57 +00:00
u8 filler[4];
2020-05-30 08:09:21 +00:00
u8 topListMenuWindowId;
u8 topListMenuId;
u8 tradeBoardMainWindowId;
u8 tradeBoardHeaderWindowId;
2020-06-08 22:16:57 +00:00
u8 unused1;
u8 searchTaskId;
u8 spriteIds[NUM_UNION_ROOM_SPRITES];
2020-06-08 22:16:57 +00:00
u8 unused2;
u8 tradeBoardListMenuId;
2020-05-30 08:09:21 +00:00
u16 playerSendBuffer[6];
u8 activityRequestStrbufs[4][16];
u16 partnerYesNoResponse;
u16 recvActivityRequest[3];
struct UnionRoomObject objects[MAX_UNION_ROOM_LEADERS];
2020-06-08 22:16:57 +00:00
u8 trainerCardStrBuffer[12][15];
u8 trainerCardColorStrBuffer[48];
u8 trainerCardMsgStrBuffer[200];
2019-03-30 18:36:52 +00:00
};
struct UnionRoomTrade
2019-03-30 18:36:52 +00:00
{
2020-06-08 22:16:57 +00:00
u16 state;
2019-03-30 18:36:52 +00:00
u16 type;
u32 playerPersonality;
2020-06-08 22:16:57 +00:00
u8 offerPlayerId;
2019-03-30 18:36:52 +00:00
u16 playerSpecies;
u16 playerLevel;
u16 species;
u16 level;
u32 personality;
};
2020-05-30 08:09:21 +00:00
extern u8 gPlayerCurrActivity;
extern struct RfuGameCompatibilityData gRfuPartnerCompatibilityData;
2019-03-30 18:36:52 +00:00
2019-10-04 21:24:03 +00:00
extern u16 gUnionRoomOfferedSpecies;
extern u8 gUnionRoomRequestedMonType;
2019-03-30 18:36:52 +00:00
2020-06-03 22:00:53 +00:00
u8 CreateTask_CreateTradeMenu(void);
2020-06-08 22:16:57 +00:00
void SetUsingUnionRoomStartMenu(void);
2021-10-14 18:10:42 +00:00
void CreateTask_LinkMysteryGiftWithFriend(u32 activity);
void CreateTask_LinkMysteryGiftOverWireless(u32 activity);
void CreateTask_SendMysteryGift(u32 activity);
2020-05-30 08:09:21 +00:00
u8 CreateTask_ListenToWireless(void);
void StartUnionRoomBattle(u16 battleFlags);
2019-03-27 03:41:05 +00:00
#endif //GUARD_UNION_ROOM_H