Finish syncing link_rfu_2
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
gHostRfuGameData
|
||||
Rfu
|
||||
gRfu
|
||||
gHostRfuUsername
|
||||
|
||||
@@ -27,6 +27,9 @@ typedef double f64;
|
||||
typedef u8 bool8;
|
||||
typedef u16 bool16;
|
||||
typedef u32 bool32;
|
||||
typedef vu8 vbool8;
|
||||
typedef vu16 vbool16;
|
||||
typedef vu32 vbool32;
|
||||
|
||||
struct BgCnt
|
||||
{
|
||||
|
||||
+1
-2
@@ -250,7 +250,7 @@ void SetSuppressLinkErrorMessage(bool8);
|
||||
bool8 HasLinkErrorOccurred(void);
|
||||
void ResetSerial(void);
|
||||
u32 LinkMain1(u8 *, u16 *, u16[MAX_RFU_PLAYERS][CMD_LENGTH]);
|
||||
void RFUVSync(void);
|
||||
void RfuVSync(void);
|
||||
void Timer3Intr(void);
|
||||
void SerialCB(void);
|
||||
u8 GetLinkPlayerCount(void);
|
||||
@@ -258,7 +258,6 @@ bool32 InUnionRoom(void);
|
||||
|
||||
void SetLinkStandbyCallback(void);
|
||||
void SetWirelessCommType1(void);
|
||||
void LinkRfu_DestroyIdleTask(void);
|
||||
void SetCloseLinkCallback(void);
|
||||
void OpenLink(void);
|
||||
bool8 IsLinkMaster(void);
|
||||
|
||||
+140
-106
@@ -6,33 +6,29 @@
|
||||
#include "link.h"
|
||||
#include "AgbRfu_LinkManager.h"
|
||||
|
||||
#define RFUCMD_MASK 0xFF00
|
||||
#define RFUCMD_MASK 0xFF00
|
||||
|
||||
#define RFUCMD_SEND_PACKET 0x2F00
|
||||
#define RFUCMD_READY_CLOSE_LINK 0x5f00
|
||||
#define RFUCMD_READY_EXIT_STANDBY 0x6600
|
||||
#define RFUCMD_PLAYERS_LIST 0x7700
|
||||
#define RFUCMD_PLAYERS_LIST_2 0x7800
|
||||
#define RFUCMD_SEND_BLOCK_INIT 0x8800
|
||||
#define RFUCMD_SEND_BLOCK_STEP 0x8900
|
||||
#define RFUCMD_SEND_BLOCK_REQ 0xa100
|
||||
#define RFUCMD_SEND_HELD_KEYS 0xbe00
|
||||
#define RFUCMD_PARENT_DISCONNECT 0xed00
|
||||
#define RFUCMD_CHILD_DISCONNECT 0xee00
|
||||
#define RFUCMD_SEND_PACKET 0x2F00
|
||||
#define RFUCMD_BLENDER_SEND_KEYS 0x4400
|
||||
#define RFUCMD_READY_CLOSE_LINK 0x5F00
|
||||
#define RFUCMD_READY_EXIT_STANDBY 0x6600
|
||||
#define RFUCMD_SEND_PLAYER_IDS 0x7700
|
||||
#define RFUCMD_SEND_PLAYER_IDS_NEW 0x7800
|
||||
#define RFUCMD_SEND_BLOCK_INIT 0x8800
|
||||
#define RFUCMD_SEND_BLOCK 0x8900
|
||||
#define RFUCMD_SEND_BLOCK_REQ 0xA100
|
||||
#define RFUCMD_SEND_HELD_KEYS 0xBE00
|
||||
#define RFUCMD_DISCONNECT 0xED00
|
||||
#define RFUCMD_DISCONNECT_PARENT 0xEE00
|
||||
|
||||
#define RFU_PACKET_SIZE 6
|
||||
|
||||
#define RFU_SERIAL_7F7D 0x7F7D
|
||||
#define RFU_SERIAL_GAME 0x0002 // Serial number for Pokémon game (FRLG or Emerald)
|
||||
#define RFU_SERIAL_WONDER_DISTRIBUTOR 0x7F7D // Serial number for distributing Wonder Cards / News
|
||||
#define RFU_SERIAL_END 0xFFFF
|
||||
|
||||
#define COMM_SLOT_LENGTH 14
|
||||
#define RECV_QUEUE_NUM_SLOTS 20
|
||||
#define RECV_QUEUE_SLOT_LENGTH (14 * MAX_RFU_PLAYERS)
|
||||
|
||||
#define SEND_QUEUE_NUM_SLOTS 40
|
||||
#define SEND_QUEUE_SLOT_LENGTH 14
|
||||
|
||||
#define BACKUP_QUEUE_NUM_SLOTS 2
|
||||
#define BACKUP_QUEUE_SLOT_LENGTH 14
|
||||
|
||||
#define UNUSED_QUEUE_NUM_SLOTS 2
|
||||
#define UNUSED_QUEUE_SLOT_LENGTH 256
|
||||
|
||||
@@ -48,13 +44,40 @@
|
||||
#define RFU_STATUS_WAIT_ACK_JOIN_GROUP 7
|
||||
#define RFU_STATUS_LEAVE_GROUP_NOTICE 8
|
||||
#define RFU_STATUS_LEAVE_GROUP 9
|
||||
#define RFU_STATUS_10 10
|
||||
#define RFU_STATUS_11 11
|
||||
#define RFU_STATUS_CHILD_LEAVE_READY 10
|
||||
#define RFU_STATUS_CHILD_LEAVE 11
|
||||
#define RFU_STATUS_ACK_JOIN_GROUP 12
|
||||
|
||||
#define RFU_RECV_IDLE 0
|
||||
#define RFU_RECV_RECEIVING 1
|
||||
#define RFU_RECV_FINISHED 2
|
||||
// Values for disconnectMode
|
||||
enum {
|
||||
RFU_DISCONNECT_NONE,
|
||||
RFU_DISCONNECT_ERROR,
|
||||
RFU_DISCONNECT_NORMAL,
|
||||
};
|
||||
|
||||
// Values for errorState
|
||||
enum {
|
||||
RFU_ERROR_STATE_NONE,
|
||||
RFU_ERROR_STATE_OCCURRED,
|
||||
RFU_ERROR_STATE_PROCESSED,
|
||||
RFU_ERROR_STATE_DISCONNECTING,
|
||||
RFU_ERROR_STATE_IGNORE,
|
||||
};
|
||||
|
||||
// These error flags are set in errorInfo, and given as
|
||||
// the uppermost 16 bits of 'status' for sLinkErrorBuffer.
|
||||
// The first 8 bits are reserved for the link manager msg
|
||||
// when the error occurred, and the last 8 bits are this
|
||||
// sequence of presumably meaningful error flags, but
|
||||
// ultimately sLinkErrorBuffer's status is never read.
|
||||
#define F_RFU_ERROR_1 (1 << 8)
|
||||
#define F_RFU_ERROR_2 (1 << 9) // Never set
|
||||
#define F_RFU_ERROR_3 (1 << 10) // Never set
|
||||
#define F_RFU_ERROR_4 (1 << 11) // Never set
|
||||
#define F_RFU_ERROR_5 (1 << 12)
|
||||
#define F_RFU_ERROR_6 (1 << 13)
|
||||
#define F_RFU_ERROR_7 (1 << 14)
|
||||
#define F_RFU_ERROR_8 (1 << 15)
|
||||
|
||||
// RfuTgtData.gname is read as these structs.
|
||||
struct RfuGameCompatibilityData
|
||||
@@ -62,36 +85,47 @@ struct RfuGameCompatibilityData
|
||||
u16 language:4;
|
||||
u16 hasNews:1;
|
||||
u16 hasCard:1;
|
||||
u16 unknown:1;
|
||||
u16 unknown:1; // Never read
|
||||
u16 isChampion:1;
|
||||
u16 hasNationalDex:1;
|
||||
u16 gameClear:1;
|
||||
u16 version:4;
|
||||
u16 unk_01_6:2;
|
||||
u16 unused:2;
|
||||
u8 playerTrainerId[2];
|
||||
};
|
||||
|
||||
// This struct is sent via the Wireless Adapter as the game name or "gname" data.
|
||||
// Gname is only applicable during Wireless Single Game Pak Multiplay, when the
|
||||
// adapter needs this data for connection. Per the RFU manual, during "normal"
|
||||
// wireless play (the kind the Pokémon games use) the gname data can be used for
|
||||
// anything the developers want. This struct is what GF decided to use it for.
|
||||
// It can be up to 13 bytes in size (RFU_GAME_NAME_LENGTH).
|
||||
// The player's name is sent separately as the username ("uname"), and does not
|
||||
// use a struct (gHostRfuUsername).
|
||||
struct __attribute__((packed, aligned(2))) RfuGameData
|
||||
{
|
||||
struct RfuGameCompatibilityData unk_00;
|
||||
u8 child_sprite_gender[RFU_CHILD_MAX]; // u8 sprite_idx:3;
|
||||
// u8 gender:1;
|
||||
// u8 unk_4:3
|
||||
// u8 active:1
|
||||
u16 species:10;
|
||||
u16 type:6;
|
||||
struct RfuGameCompatibilityData compatibility;
|
||||
u8 partnerInfo[RFU_CHILD_MAX];
|
||||
u16 tradeSpecies:10;
|
||||
u16 tradeType:6;
|
||||
u8 activity:7;
|
||||
u8 started:1;
|
||||
u8 startedActivity:1;
|
||||
u8 playerGender:1;
|
||||
u8 level:7;
|
||||
u8 tradeLevel:7;
|
||||
u8 padding;
|
||||
}; // size: RFU_GNAME_SIZE
|
||||
|
||||
struct Padded_U8
|
||||
{
|
||||
u8 value;
|
||||
};
|
||||
|
||||
// Constants for getting/setting information in 'partnerInfo' of RfuGameData.
|
||||
// This data is used to determine what the link partners look like from
|
||||
// the host's perspective.
|
||||
// Bits 0-2 are a shortened trainerId
|
||||
// Bit 3 is the player's gender
|
||||
// Bits 4-6 are unknown/unused
|
||||
// Bit 7 is an 'active' flag
|
||||
#define PINFO_TID_MASK 0x7
|
||||
#define PINFO_GENDER_SHIFT 3
|
||||
#define PINFO_ACTIVE_FLAG (1 << 7)
|
||||
|
||||
struct RfuBlockSend
|
||||
{
|
||||
/* 0x00 */ u16 next;
|
||||
@@ -106,7 +140,7 @@ struct RfuBlockSend
|
||||
|
||||
struct RfuRecvQueue
|
||||
{
|
||||
/* 0x000 */ u8 slots[RECV_QUEUE_NUM_SLOTS][RECV_QUEUE_SLOT_LENGTH];
|
||||
/* 0x000 */ u8 slots[RECV_QUEUE_NUM_SLOTS][COMM_SLOT_LENGTH * MAX_RFU_PLAYERS];
|
||||
/* 0x578 */ vu8 recv_slot;
|
||||
/* 0x579 */ vu8 send_slot;
|
||||
/* 0x57a */ vu8 count;
|
||||
@@ -115,7 +149,7 @@ struct RfuRecvQueue
|
||||
|
||||
struct RfuSendQueue
|
||||
{
|
||||
/* 0x000 */ u8 slots[SEND_QUEUE_NUM_SLOTS][SEND_QUEUE_SLOT_LENGTH];
|
||||
/* 0x000 */ u8 slots[SEND_QUEUE_NUM_SLOTS][COMM_SLOT_LENGTH];
|
||||
/* 0x230 */ vu8 recv_slot;
|
||||
/* 0x231 */ vu8 send_slot;
|
||||
/* 0x232 */ vu8 count;
|
||||
@@ -124,7 +158,7 @@ struct RfuSendQueue
|
||||
|
||||
struct RfuBackupQueue
|
||||
{
|
||||
/* 0x00 */ u8 slots[BACKUP_QUEUE_NUM_SLOTS][BACKUP_QUEUE_SLOT_LENGTH];
|
||||
/* 0x00 */ u8 slots[BACKUP_QUEUE_NUM_SLOTS][COMM_SLOT_LENGTH];
|
||||
/* 0x1c */ vu8 recv_slot;
|
||||
/* 0x1d */ vu8 send_slot;
|
||||
/* 0x1e */ vu8 count;
|
||||
@@ -141,24 +175,24 @@ struct RfuUnusedQueue
|
||||
|
||||
struct RfuManager
|
||||
{
|
||||
/* 0x000 */ void (*RfuFunc)(void);
|
||||
/* 0x000 */ void (*callback)(void);
|
||||
/* 0x004 */ u16 state;
|
||||
/* 0x006 */ u8 filler_06[4];
|
||||
/* 0x00a */ u16 linkman_msg;
|
||||
/* 0x00c */ u8 parent_child;
|
||||
/* 0x006 */ u8 unused1[4];
|
||||
/* 0x00a */ u16 errorInfo;
|
||||
/* 0x00c */ u8 parentChild;
|
||||
/* 0x00d */ u8 playerCount;
|
||||
/* 0x00e */ u8 unk_0e;
|
||||
/* 0x00f */ u8 unk_0f;
|
||||
/* 0x010 */ u16 linkman_param[2];
|
||||
/* 0x014 */ u8 main_UNI_recvBuffer[RFU_CHILD_MAX][14];
|
||||
/* 0x04c */ u8 lastCmdBeforeCommInterrupt[14];
|
||||
/* 0x05a */ u8 cmdA100_blockRequestType;
|
||||
/* 0x00e */ bool8 runParentMain2;
|
||||
/* 0x00f */ u8 unused2;
|
||||
/* 0x010 */ u16 errorParams[2];
|
||||
/* 0x014 */ u8 childRecvBuffer[RFU_CHILD_MAX][COMM_SLOT_LENGTH];
|
||||
/* 0x04c */ u8 childSendBuffer[COMM_SLOT_LENGTH];
|
||||
/* 0x05a */ u8 blockRequestType;
|
||||
/* 0x05b */ u8 sendBlockInitDelay;
|
||||
/* 0x05c */ bool8 blockReceived[MAX_RFU_PLAYERS];
|
||||
/* 0x061 */ u8 numBlocksReceived[MAX_RFU_PLAYERS];
|
||||
/* 0x066 */ u8 idleTaskId;
|
||||
/* 0x067 */ u8 searchTaskId;
|
||||
/* 0x068 */ u8 filler_68[4];
|
||||
/* 0x068 */ u8 unused3[4];
|
||||
/* 0x06c */ struct RfuBlockSend sendBlock;
|
||||
/* 0x080 */ struct RfuBlockSend recvBlock[MAX_RFU_PLAYERS];
|
||||
/* 0x0e4 */ bool8 readyCloseLink[MAX_RFU_PLAYERS];
|
||||
@@ -170,45 +204,45 @@ struct RfuManager
|
||||
/* 0x0f2 */ u16 packet[RFU_PACKET_SIZE];
|
||||
/* 0x0fe */ u16 resendExitStandbyTimer;
|
||||
/* 0x100 */ u16 resendExitStandbyCount;
|
||||
/* 0x102 */ u8 unk_102;
|
||||
/* 0x104 */ struct RfuTgtData tgtData;
|
||||
/* 0x102 */ u8 childSendCmdId;
|
||||
/* 0x104 */ struct RfuTgtData parent;
|
||||
/* 0x124 */ struct RfuRecvQueue recvQueue;
|
||||
/* 0x6a0 */ struct RfuSendQueue sendQueue;
|
||||
/* 0x8d4 */ struct RfuBackupQueue backupQueue;
|
||||
/* 0x8f4 */ vu8 linkRecovered;
|
||||
/* 0x8f5 */ u8 reconnectedParentIdx;
|
||||
/* 0x8f6 */ vu8 child_slot;
|
||||
/* 0x8f7 */ u8 unk_c3f[70];
|
||||
/* 0x8f5 */ u8 reconnectParentId;
|
||||
/* 0x8f6 */ vu8 childSlot;
|
||||
/* 0x8f7 */ u8 childRecvQueue[COMM_SLOT_LENGTH * MAX_RFU_PLAYERS];
|
||||
/* 0x93d */ u8 sendStatus;
|
||||
/* 0x93e */ u8 recvStatus;
|
||||
/* 0x93f */ u8 recvCmds[MAX_RFU_PLAYERS][7][2];
|
||||
/* 0x93f */ u8 recvCmds[MAX_RFU_PLAYERS][CMD_LENGTH - 1][2];
|
||||
/* 0x985 */ u8 parentId;
|
||||
/* 0x986 */ u8 multiplayerId; // childId
|
||||
/* 0x987 */ u8 unk_ccf;
|
||||
/* 0x988 */ vu8 sem_UNI_SendRecv;
|
||||
/* 0x987 */ u8 connectParentFailures;
|
||||
/* 0x988 */ vu8 childSendCount;
|
||||
/* 0x989 */ u8 partnerSendStatuses[RFU_CHILD_MAX];
|
||||
/* 0x98d */ u8 partnerRecvStatuses[RFU_CHILD_MAX];
|
||||
/* 0x991 */ u8 linkClosing;
|
||||
/* 0x992 */ u8 unk_cda;
|
||||
/* 0x993 */ volatile bool8 unk_cdb;
|
||||
/* 0x994 */ volatile bool8 unk_cdc;
|
||||
/* 0x995 */ u8 unk_cdd;
|
||||
/* 0x991 */ bool8 stopNewConnections;
|
||||
/* 0x992 */ u8 parentSendSlot;
|
||||
/* 0x993 */ vbool8 parentFinished;
|
||||
/* 0x994 */ vbool8 parentMain2Failed;
|
||||
/* 0x995 */ u8 unused5;
|
||||
/* 0x996 */ u8 linkPlayerIdx[RFU_CHILD_MAX];
|
||||
/* 0x99a */ u8 bm_PartnerFlags;
|
||||
/* 0x99b */ u8 bm_DisconnectSlot;
|
||||
/* 0x99c */ u8 unk_ce4;
|
||||
/* 0x99d */ u8 bmChatLeaderMaybe;
|
||||
/* 0x99e */ u8 unionRoomChatters;
|
||||
/* 0x99a */ u8 parentSlots;
|
||||
/* 0x99b */ u8 disconnectSlots;
|
||||
/* 0x99c */ u8 disconnectMode;
|
||||
/* 0x99d */ u8 nextChildBits;
|
||||
/* 0x99e */ u8 newChildQueue;
|
||||
/* 0x99f */ u8 acceptSlot_flag;
|
||||
/* 0x9a0 */ bool8 foundNewLeaderMaybe;
|
||||
/* 0x9a1 */ u8 unk_ce9;
|
||||
/* 0x9a2 */ u8 unk_cea[RFU_CHILD_MAX];
|
||||
/* 0x9a6 */ u8 unk_cee[RFU_CHILD_MAX];
|
||||
/* 0x9a0 */ bool8 playerExchangeActive;
|
||||
/* 0x9a1 */ u8 incomingChild;
|
||||
/* 0x9a2 */ u8 numChildRecvErrors[RFU_CHILD_MAX];
|
||||
/* 0x9a6 */ u8 childRecvIds[RFU_CHILD_MAX];
|
||||
}; // size: 0x9AC
|
||||
|
||||
extern struct RfuGameData gHostRfuGameData;
|
||||
extern u8 gHostRfuUsername[];
|
||||
extern struct RfuManager Rfu;
|
||||
extern struct RfuManager gRfu;
|
||||
|
||||
// GameFreak signatures
|
||||
void AddTextPrinterToWindow1(const u8 *str);
|
||||
@@ -223,14 +257,14 @@ void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0);
|
||||
void MEvent_CreateTask_Leader(u32 arg0);
|
||||
void Rfu_SendPacket(void *data);
|
||||
u8 CreateTask_ListenToWireless(void);
|
||||
void LinkRfu_DestroyIdleTask(void);
|
||||
void DestroyTask_RfuIdle(void);
|
||||
void InitRFUAPI(void);
|
||||
void sub_80FB128(bool32 a0);
|
||||
void RfuSetIgnoreError(bool32 enable);
|
||||
bool32 IsSendingKeysToRfu(void);
|
||||
void ClearLinkRfuCallback(void);
|
||||
u8 GetRfuPlayerCount(void);
|
||||
u8 Rfu_GetLinkPlayerCount(void);
|
||||
void StartSendingKeysToRfu(void);
|
||||
u8 LinkRfu_GetMultiplayerId(void);
|
||||
u8 Rfu_GetMultiplayerId(void);
|
||||
bool32 Rfu_InitBlockSend(const u8 * src, size_t size);
|
||||
bool8 Rfu_SendBlockRequest(u8 blockRequestType);
|
||||
u8 Rfu_GetBlockReceivedStatus(void);
|
||||
@@ -238,15 +272,15 @@ void Rfu_SetBlockReceivedFlag(u8 linkPlayerId);
|
||||
void Rfu_ResetBlockReceivedFlag(u8 linkPlayerId);
|
||||
bool8 Rfu_IsMaster(void);
|
||||
void ResetLinkRfuGFLayer(void);
|
||||
bool32 LinkRfuMain1(void);
|
||||
bool32 LinkRfuMain2(void);
|
||||
bool32 RfuMain1(void);
|
||||
bool32 RfuMain2(void);
|
||||
bool32 IsRfuRecvQueueEmpty(void);
|
||||
u32 GetRfuRecvQueueLength(void);
|
||||
void LinkRfu_Shutdown(void);
|
||||
void LinkRfu_CreateIdleTask(void);
|
||||
bool8 ToggleLMANlinkRecovery(bool32 enable);
|
||||
void CreateTask_RfuIdle(void);
|
||||
bool8 Rfu_SetLinkRecovery(bool32 enable);
|
||||
void var_800D_set_xB(void);
|
||||
struct RfuGameData *GetHostRFUtgtGname(void);
|
||||
struct RfuGameData *GetHostRfuGameData(void);
|
||||
void UpdateWirelessStatusIndicatorSprite(void);
|
||||
void InitRFU(void);
|
||||
bool32 RfuHasErrored(void);
|
||||
@@ -262,44 +296,44 @@ bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *dest);
|
||||
void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *dest);
|
||||
bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue * queue, u8 *dest);
|
||||
void RfuSendQueue_Enqueue(struct RfuSendQueue * queue, u8 *src);
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 started, s32 child_sprite_genders);
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 started, s32 partnerInfo);
|
||||
void UpdateGameData_GroupLockedIn(bool8 started);
|
||||
bool32 IsRfuSerialNumberValid(u32 serialNo);
|
||||
bool8 IsRfuRecoveringFromLinkLoss(void);
|
||||
bool8 LmanAcceptSlotFlagIsNotZero(void);
|
||||
void LinkRfu_StopManagerAndFinalizeSlots(void);
|
||||
bool32 sub_80FA5D4(void);
|
||||
bool32 sub_80FC1CC(void);
|
||||
bool32 RfuTryDisconnectLeavingChildren(void);
|
||||
bool32 IsRfuCommunicatingWithAllChildren(void);
|
||||
bool32 WaitRfuState(bool32 a0);
|
||||
bool32 CheckTrainerHasLeftByIdAndName(u16 trainerId, const u8 *trainerName);
|
||||
void SendByteToPartnerByIdAndName(u8 a0, u16 a1, const u8 *a2);
|
||||
u32 WaitSendByteToPartnerByIdAndName(u16 a0, const u8 *a1);
|
||||
void SetHostRFUtgtGname(u8 activity, u32 child_sprite_genders, u32 a2);
|
||||
bool32 HasTrainerLeftPartnersList(u16 trainerId, const u8 *trainerName);
|
||||
void SendRfuStatusToPartner(u8 status, u16 trainerId, const u8 *name);
|
||||
u32 WaitSendRfuStatusToPartner(u16 trainerId, const u8 *name);
|
||||
void SetHostRfuGameData(u8 activity, u32 partnerInfo, bool32 startedActivity);
|
||||
void InitializeRfuLinkManager_LinkLeader(u32 availSlots);
|
||||
void RequestDisconnectSlotByTrainerNameAndId(const u8 *trainerName, u16 trainerId);
|
||||
void LinkRfu3_SetGnameUnameFromStaticBuffers(struct RfuGameData *gname, u8 *uname);
|
||||
void InitializeRfuLinkManager_JoinGroup(void);
|
||||
void SendLeaveGroupNotice(void);
|
||||
void CreateTask_RfuReconnectWithParent(const u8 *src, u16 trainerId);
|
||||
void UpdateGameDataWithActivitySpriteGendersFlag(u8 activity, u32 child_sprite_genders, u32 started);
|
||||
void UpdateGameData_SetActivity(u8 activity, u32 partnerInfo, u32 startedActivity);
|
||||
void RecordMixTrainerNames(void);
|
||||
void LinkRfu_CreateConnectionAsParent();
|
||||
void LinkRfu_StopManagerBeforeEnteringChat();
|
||||
void SetGnameBufferWonderFlags(bool32 hasNews, bool32 hasCard);
|
||||
void ClearAndInitHostRFUtgtGname(void);
|
||||
void sub_80F8FA0(void);
|
||||
void RfuUpdatePlayerGnameStateAndSend(u32 type, u32 species, u32 level);
|
||||
void SetHostRfuWonderFlags(bool32 hasNews, bool32 hasCard);
|
||||
void ResetHostRfuGameData(void);
|
||||
void StopUnionRoomLinkManager(void);
|
||||
void SetTradeBoardRegisteredMonInfo(u32 type, u32 species, u32 level);
|
||||
bool32 IsUnionRoomListenTaskActive(void);
|
||||
void InitializeRfuLinkManager_EnterUnionRoom(void);
|
||||
void sub_80FBD6C(u32 a0);
|
||||
void sub_80FC114(const u8 *name, struct RfuGameData *structPtr, u8 a2);
|
||||
void Rfu_DisconnectPlayerById(u32 playerIdx);
|
||||
void TryConnectToUnionRoomParent(const u8 *name, struct RfuGameData *parent, u8 activity);
|
||||
bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name);
|
||||
bool8 LinkRfu_GetNameIfCompatible(struct RfuGameData *gname, u8 *uname, u8 idx);
|
||||
bool8 LinkRfu_GetNameIfSerial7F7D(struct RfuGameData *gname, u8 *uname, u8 idx);
|
||||
bool32 RfuHasFoundNewLeader(void);
|
||||
void Rfu_UnionRoomChat_StopLinkManager(void);
|
||||
void sub_80FB9D0(void);
|
||||
void sub_80FB030(u32 a0);
|
||||
bool32 Rfu_IsPlayerExchangeActive(void);
|
||||
void Rfu_StopPartnerSearch(void);
|
||||
void RfuSetNormalDisconnectMode(void);
|
||||
void SetUnionRoomChatPlayerData(u32 numPlayers);
|
||||
void ClearRecvCommands(void);
|
||||
|
||||
#include "mevent_server.h"
|
||||
|
||||
@@ -6,7 +6,7 @@ extern bool8 gGiftIsFromEReader;
|
||||
void MainCB_FreeAllBuffersAndReturnToInitTitleScreen(void);
|
||||
void PrintMysteryGiftOrEReaderTopMenu(bool8, bool32);
|
||||
void c2_mystery_gift(void);
|
||||
void c2_mystery_gift_e_reader_run(void);
|
||||
void CB2_MysteryGiftEReader(void);
|
||||
s8 mevent_message_print_and_prompt_yes_no(u8 * textState, u16 * windowId, bool8 yesNoBoxPlacement, const u8 * str);
|
||||
void MG_DrawTextBorder(u8 windowId);
|
||||
u16 GetMysteryGiftBaseBlock(void);
|
||||
|
||||
@@ -519,7 +519,7 @@ void TryReceiveLinkBattleData(void)
|
||||
|
||||
if (gReceivedRemoteLinkPlayers != 0 && (gBattleTypeFlags & BATTLE_TYPE_LINK_IN_BATTLE) && (gLinkPlayers[0].linkType == 0x2211))
|
||||
{
|
||||
LinkRfu_DestroyIdleTask();
|
||||
DestroyTask_RfuIdle();
|
||||
for (i = 0; i < GetLinkPlayerCount(); i++)
|
||||
{
|
||||
if (GetBlockReceivedStatus() & gBitTable[i])
|
||||
|
||||
+3
-3
@@ -969,9 +969,9 @@ static u32 QuitBerryCrush(MainCallback callback)
|
||||
#define ERROR_EXIT(exitCallback) \
|
||||
{ \
|
||||
SetMainCallback2(exitCallback); \
|
||||
Rfu.linkman_param[0] = 0; \
|
||||
Rfu.linkman_param[1] = 0; \
|
||||
Rfu.errorState = 1; \
|
||||
gRfu.errorParams[0] = 0; \
|
||||
gRfu.errorParams[1] = 0; \
|
||||
gRfu.errorState = 1; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
+12
-16
@@ -227,7 +227,7 @@ bool8 IsWirelessAdapterConnected(void)
|
||||
|
||||
SetWirelessCommType1();
|
||||
InitRFUAPI();
|
||||
sub_80FB128(TRUE);
|
||||
RfuSetIgnoreError(TRUE);
|
||||
if (rfu_LMAN_REQBN_softReset_and_checkID() == RFU_ID)
|
||||
{
|
||||
rfu_REQ_stopMode();
|
||||
@@ -748,21 +748,16 @@ void ClearLinkCallback(void)
|
||||
void ClearLinkCallback_2(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
ClearLinkRfuCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
gLinkCallback = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
u8 GetLinkPlayerCount(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
return GetRfuPlayerCount();
|
||||
}
|
||||
return Rfu_GetLinkPlayerCount();
|
||||
|
||||
return EXTRACT_PLAYER_COUNT(gLinkStatus);
|
||||
}
|
||||
|
||||
@@ -977,7 +972,7 @@ u8 GetMultiplayerId(void)
|
||||
{
|
||||
if (gWirelessCommType == 1)
|
||||
{
|
||||
return LinkRfu_GetMultiplayerId();
|
||||
return Rfu_GetMultiplayerId();
|
||||
}
|
||||
return SIO_MULTI_CNT->id;
|
||||
}
|
||||
@@ -1647,10 +1642,11 @@ void LinkPlayerFromBlock(u32 who)
|
||||
}
|
||||
}
|
||||
|
||||
// When this function returns TRUE the callbacks are skipped
|
||||
bool8 HandleLinkConnection(void)
|
||||
{
|
||||
bool32 r4;
|
||||
bool32 r5;
|
||||
bool32 main1Failed;
|
||||
bool32 main2Failed;
|
||||
|
||||
if (gWirelessCommType == 0)
|
||||
{
|
||||
@@ -1663,14 +1659,14 @@ bool8 HandleLinkConnection(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
r4 = LinkRfuMain1();
|
||||
r5 = LinkRfuMain2();
|
||||
main1Failed = RfuMain1(); // Always returns FALSE
|
||||
main2Failed = RfuMain2();
|
||||
if (IsSendingKeysOverCable() == TRUE)
|
||||
{
|
||||
if (r4 == TRUE || IsRfuRecvQueueEmpty() || r5)
|
||||
{
|
||||
// This will never be reached.
|
||||
// IsSendingKeysOverCable is always FALSE for wireless communication
|
||||
if (main1Failed == TRUE || IsRfuRecvQueueEmpty() || main2Failed)
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
|
||||
+1118
-1030
File diff suppressed because it is too large
Load Diff
+28
-56
@@ -298,10 +298,8 @@ void RfuRecvQueue_Reset(struct RfuRecvQueue *queue)
|
||||
|
||||
for (i = 0; i < RECV_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
for (j = 0; j < RECV_QUEUE_SLOT_LENGTH; j++)
|
||||
{
|
||||
for (j = 0; j < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; j++)
|
||||
queue->slots[i][j] = 0;
|
||||
}
|
||||
}
|
||||
queue->send_slot = 0;
|
||||
queue->recv_slot = 0;
|
||||
@@ -316,10 +314,8 @@ void RfuSendQueue_Reset(struct RfuSendQueue *queue)
|
||||
|
||||
for (i = 0; i < SEND_QUEUE_NUM_SLOTS; i++)
|
||||
{
|
||||
for (j = 0; j < SEND_QUEUE_SLOT_LENGTH; j++)
|
||||
{
|
||||
for (j = 0; j < COMM_SLOT_LENGTH; j++)
|
||||
queue->slots[i][j] = 0;
|
||||
}
|
||||
}
|
||||
queue->send_slot = 0;
|
||||
queue->recv_slot = 0;
|
||||
@@ -356,26 +352,20 @@ void RfuRecvQueue_Enqueue(struct RfuRecvQueue *queue, u8 *src)
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
count = 0;
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i += RECV_QUEUE_SLOT_LENGTH / MAX_RFU_PLAYERS)
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i += COMM_SLOT_LENGTH)
|
||||
{
|
||||
if (src[i] == 0 && src[i + 1] == 0)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count != MAX_RFU_PLAYERS)
|
||||
{
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
queue->slots[queue->recv_slot][i] = src[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= RECV_QUEUE_NUM_SLOTS;
|
||||
queue->count++;
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
src[i] = 0;
|
||||
}
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
}
|
||||
@@ -394,26 +384,20 @@ void RfuSendQueue_Enqueue(struct RfuSendQueue *queue, u8 *src)
|
||||
{
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
{
|
||||
if (src[i] != 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i != SEND_QUEUE_SLOT_LENGTH)
|
||||
if (i != COMM_SLOT_LENGTH)
|
||||
{
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
queue->slots[queue->recv_slot][i] = src[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= SEND_QUEUE_NUM_SLOTS;
|
||||
queue->count++;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
src[i] = 0;
|
||||
}
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
}
|
||||
@@ -432,17 +416,13 @@ bool8 RfuRecvQueue_Dequeue(struct RfuRecvQueue *queue, u8 *dest)
|
||||
REG_IME = 0;
|
||||
if (queue->recv_slot == queue->send_slot || queue->full)
|
||||
{
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
dest[i] = 0;
|
||||
}
|
||||
REG_IME = imeBak;
|
||||
return FALSE;
|
||||
}
|
||||
for (i = 0; i < RECV_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH * MAX_RFU_PLAYERS; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= RECV_QUEUE_NUM_SLOTS;
|
||||
queue->count--;
|
||||
@@ -456,15 +436,11 @@ bool8 RfuSendQueue_Dequeue(struct RfuSendQueue *queue, u8 *dest)
|
||||
u16 imeBak;
|
||||
|
||||
if (queue->recv_slot == queue->send_slot || queue->full)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
imeBak = REG_IME;
|
||||
REG_IME = 0;
|
||||
for (i = 0; i < SEND_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= SEND_QUEUE_NUM_SLOTS;
|
||||
queue->count--;
|
||||
@@ -482,10 +458,8 @@ void RfuBackupQueue_Enqueue(struct RfuBackupQueue *queue, const u8 *dest)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
queue->slots[queue->recv_slot][i] = dest[i];
|
||||
}
|
||||
queue->recv_slot++;
|
||||
queue->recv_slot %= BACKUP_QUEUE_NUM_SLOTS;
|
||||
if (queue->count < BACKUP_QUEUE_NUM_SLOTS)
|
||||
@@ -509,10 +483,8 @@ bool8 RfuBackupQueue_Dequeue(struct RfuBackupQueue *queue, u8 *dest)
|
||||
}
|
||||
if (dest != NULL)
|
||||
{
|
||||
for (i = 0; i < BACKUP_QUEUE_SLOT_LENGTH; i++)
|
||||
{
|
||||
for (i = 0; i < COMM_SLOT_LENGTH; i++)
|
||||
dest[i] = queue->slots[queue->send_slot][i];
|
||||
}
|
||||
}
|
||||
queue->send_slot++;
|
||||
queue->send_slot %= BACKUP_QUEUE_NUM_SLOTS;
|
||||
@@ -672,30 +644,30 @@ static u8 GetConnectedChildStrength(u8 maxFlags)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 started, s32 child_sprite_genders)
|
||||
void InitHostRFUtgtGname(struct RfuGameData *data, u8 activity, bool32 startedActivity, s32 partnerInfo)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
data->unk_00.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
data->compatibility.playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i];
|
||||
}
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
data->child_sprite_gender[i] = child_sprite_genders;
|
||||
child_sprite_genders >>= 8;
|
||||
data->partnerInfo[i] = partnerInfo;
|
||||
partnerInfo >>= 8;
|
||||
}
|
||||
data->playerGender = gSaveBlock2Ptr->playerGender;
|
||||
data->activity = activity;
|
||||
data->started = started;
|
||||
data->unk_00.language = GAME_LANGUAGE;
|
||||
data->unk_00.version = GAME_VERSION;
|
||||
data->unk_00.hasNews = FALSE;
|
||||
data->unk_00.hasCard = FALSE;
|
||||
data->unk_00.unknown = FALSE;
|
||||
data->unk_00.isChampion = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
|
||||
data->unk_00.hasNationalDex = IsNationalPokedexEnabled();
|
||||
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
|
||||
data->startedActivity = startedActivity;
|
||||
data->compatibility.language = GAME_LANGUAGE;
|
||||
data->compatibility.version = GAME_VERSION;
|
||||
data->compatibility.hasNews = FALSE;
|
||||
data->compatibility.hasCard = FALSE;
|
||||
data->compatibility.unknown = FALSE;
|
||||
data->compatibility.isChampion = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
|
||||
data->compatibility.hasNationalDex = IsNationalPokedexEnabled();
|
||||
data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -749,7 +721,7 @@ bool8 LinkRfu_GetNameIfCompatible(struct RfuGameData *gname, u8 *uname, u8 idx)
|
||||
bool8 LinkRfu_GetNameIfSerial7F7D(struct RfuGameData *gname, u8 *uname, u8 idx)
|
||||
{
|
||||
bool8 retVal = FALSE;
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_7F7D)
|
||||
if (gRfuLinkStatus->partner[idx].serialNo == RFU_SERIAL_WONDER_DISTRIBUTOR)
|
||||
{
|
||||
memcpy(gname, gRfuLinkStatus->partner[idx].gname, RFU_GAME_NAME_LENGTH);
|
||||
memcpy(uname, gRfuLinkStatus->partner[idx].uname, RFU_USER_NAME_LENGTH);
|
||||
|
||||
+1
-1
@@ -358,7 +358,7 @@ extern void ProcessDma3Requests(void);
|
||||
static void VBlankIntr(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
RFUVSync();
|
||||
RfuVSync();
|
||||
else if (!gLinkVSyncDisabled)
|
||||
LinkVSync();
|
||||
|
||||
|
||||
@@ -354,7 +354,7 @@ void vblankcb_mystery_gift_e_reader_run(void)
|
||||
TransferPlttBuffer();
|
||||
}
|
||||
|
||||
void c2_mystery_gift_e_reader_run(void)
|
||||
void CB2_MysteryGiftEReader(void)
|
||||
{
|
||||
RunTasks();
|
||||
RunTextPrinters();
|
||||
@@ -434,7 +434,7 @@ void c2_mystery_gift(void)
|
||||
{
|
||||
if (HandleMysteryGiftOrEReaderSetup(0))
|
||||
{
|
||||
SetMainCallback2(c2_mystery_gift_e_reader_run);
|
||||
SetMainCallback2(CB2_MysteryGiftEReader);
|
||||
gGiftIsFromEReader = FALSE;
|
||||
task_add_00_mystery_gift();
|
||||
}
|
||||
@@ -444,7 +444,7 @@ void c2_ereader(void)
|
||||
{
|
||||
if (HandleMysteryGiftOrEReaderSetup(1))
|
||||
{
|
||||
SetMainCallback2(c2_mystery_gift_e_reader_run);
|
||||
SetMainCallback2(CB2_MysteryGiftEReader);
|
||||
gGiftIsFromEReader = TRUE;
|
||||
task_add_00_ereader();
|
||||
}
|
||||
|
||||
+1
-1
@@ -3239,7 +3239,7 @@ bool32 IsSendingKeysOverCable(void)
|
||||
static u32 GetLinkSendQueueLength(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
return Rfu.sendQueue.count;
|
||||
return gRfu.sendQueue.count;
|
||||
else
|
||||
return gLink.sendQueue.count;
|
||||
}
|
||||
|
||||
+2
-2
@@ -3851,7 +3851,7 @@ static void CursorCB_Register(u8 taskId)
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
|
||||
|
||||
switch (CanRegisterMonForTradingBoard(*(struct RfuGameCompatibilityData *)GetHostRFUtgtGname(), species2, species, isEventLegal))
|
||||
switch (CanRegisterMonForTradingBoard(*(struct RfuGameCompatibilityData *)GetHostRfuGameData(), species2, species, isEventLegal))
|
||||
{
|
||||
case CANT_REGISTER_MON:
|
||||
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
|
||||
@@ -3877,7 +3877,7 @@ static void CursorCB_Trade1(u8 taskId)
|
||||
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
|
||||
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
|
||||
u8 isEventLegal = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_EVENT_LEGAL);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct RfuGameCompatibilityData *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isEventLegal);
|
||||
u32 stringId = GetUnionRoomTradeMessageId(*(struct RfuGameCompatibilityData *)GetHostRfuGameData(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, isEventLegal);
|
||||
|
||||
if (stringId != UR_TRADE_MSG_NONE)
|
||||
{
|
||||
|
||||
+1
-1
@@ -2540,7 +2540,7 @@ static int GetPlayersAtJumpPeak(void)
|
||||
|
||||
static bool32 AreLinkQueuesEmpty(void)
|
||||
{
|
||||
return !Rfu.recvQueue.count && !Rfu.sendQueue.count;
|
||||
return !gRfu.recvQueue.count && !gRfu.sendQueue.count;
|
||||
}
|
||||
|
||||
static int GetNumPlayersForBonus(u8 *arg0)
|
||||
|
||||
@@ -524,17 +524,17 @@ static void AssembleGroup(u32 group, struct RfuGameData * gname)
|
||||
{
|
||||
return;
|
||||
}
|
||||
SpawnGroupMember(group, 0, GetUnionRoomPlayerGraphicsId(gname->playerGender, gname->unk_00.playerTrainerId[0]), gname);
|
||||
SpawnGroupMember(group, 0, GetUnionRoomPlayerGraphicsId(gname->playerGender, gname->compatibility.playerTrainerId[0]), gname);
|
||||
}
|
||||
for (i = 1; i < 5; i++)
|
||||
{
|
||||
if (gname->child_sprite_gender[i - 1] == 0)
|
||||
if (gname->partnerInfo[i - 1] == 0)
|
||||
{
|
||||
DespawnGroupMember(group, i);
|
||||
}
|
||||
else if (IsUnionRoomPlayerFacingTileAt(group, i, x, y) == FALSE && IsUnionRoomPlayerFacingTileAt(group, i, x2, y2) == FALSE)
|
||||
{
|
||||
SpawnGroupMember(group, i, GetUnionRoomPlayerGraphicsId((gname->child_sprite_gender[i - 1] >> 3) & 1, gname->child_sprite_gender[i - 1] & 7), gname);
|
||||
SpawnGroupMember(group, i, GetUnionRoomPlayerGraphicsId((gname->partnerInfo[i - 1] >> 3) & 1, gname->partnerInfo[i - 1] & 7), gname);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -546,7 +546,7 @@ static void SpawnGroupLeaderAndMembers(u32 group, struct RfuGameData * gname)
|
||||
{
|
||||
case 0x40:
|
||||
case 0x54:
|
||||
SpawnGroupLeader(group, gname->playerGender, gname->unk_00.playerTrainerId[0]);
|
||||
SpawnGroupLeader(group, gname->playerGender, gname->compatibility.playerTrainerId[0]);
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
DespawnGroupMember(group, i);
|
||||
|
||||
+4
-4
@@ -759,7 +759,7 @@ static void CB2_ReturnFromLinkTrade2(void)
|
||||
{
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
LinkRfu_CreateIdleTask();
|
||||
CreateTask_RfuIdle();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -802,13 +802,13 @@ static void CB2_ReturnFromLinkTrade2(void)
|
||||
case 4:
|
||||
if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
|
||||
{
|
||||
LinkRfu_DestroyIdleTask();
|
||||
DestroyTask_RfuIdle();
|
||||
CalculatePlayerPartyCount();
|
||||
gMain.state++;
|
||||
sTradeMenuResourcesPtr->loadUISpritesState = 0;
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
ToggleLMANlinkRecovery(TRUE);
|
||||
Rfu_SetLinkRecovery(TRUE);
|
||||
SetLinkStandbyCallback();
|
||||
}
|
||||
}
|
||||
@@ -2019,7 +2019,7 @@ static void TradeMenuCB_12(void)
|
||||
|
||||
static void TradeMenuCB_16(void)
|
||||
{
|
||||
if (!ToggleLMANlinkRecovery(FALSE))
|
||||
if (!Rfu_SetLinkRecovery(FALSE))
|
||||
{
|
||||
SetLinkStandbyCallback();
|
||||
sTradeMenuResourcesPtr->tradeMenuCBnum = 13;
|
||||
|
||||
+97
-107
@@ -646,12 +646,12 @@ static const u8 sUnref_84570D1[] = _("{DYNAMIC 00}·{DYNAMIC 01}");
|
||||
|
||||
#define IntlConvPartnerUname7(dest, arg1) ({ \
|
||||
StringCopy_PlayerName(dest, (arg1).gname_uname.uname); \
|
||||
ConvertInternationalString(dest, (arg1).gname_uname.gname.unk_00.language); \
|
||||
ConvertInternationalString(dest, (arg1).gname_uname.gname.compatibility.language); \
|
||||
})
|
||||
|
||||
#define IntlConvPartnerUname(dest, arg1) ({ \
|
||||
StringCopy(dest, (arg1).gname_uname.uname); \
|
||||
ConvertInternationalString(dest, (arg1).gname_uname.gname.unk_00.language); \
|
||||
ConvertInternationalString(dest, (arg1).gname_uname.gname.compatibility.language); \
|
||||
})
|
||||
|
||||
#define CopyTrainerCardData(dest, src, _version) ({ \
|
||||
@@ -744,7 +744,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
case 0:
|
||||
sPlayerCurrActivity = sLinkGroupToActivityAndCapacity[gSpecialVar_0x8004];
|
||||
sPlayerActivityGroupSize = sLinkGroupToActivityAndCapacity[gSpecialVar_0x8004] >> 8;
|
||||
SetHostRFUtgtGname(sPlayerCurrActivity, 0, 0);
|
||||
SetHostRfuGameData(sPlayerCurrActivity, 0, 0);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_LinkLeader(sPlayerActivityGroupSize & 0xF);
|
||||
@@ -819,19 +819,19 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
if ((sPlayerActivityGroupSize >> 4) != 0
|
||||
&& data->playerCount > (sPlayerActivityGroupSize >> 4) - 1
|
||||
&& (sPlayerActivityGroupSize & 0xF) != 0
|
||||
&& sub_80FC1CC()
|
||||
&& IsRfuCommunicatingWithAllChildren()
|
||||
&& JOY_NEW(START_BUTTON))
|
||||
{
|
||||
data->state = 15;
|
||||
LinkRfu_StopManagerAndFinalizeSlots();
|
||||
}
|
||||
if (data->state == 6 && sub_80FA5D4())
|
||||
if (data->state == 6 && RfuTryDisconnectLeavingChildren())
|
||||
{
|
||||
data->state = 9;
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
if (!sub_80FA5D4())
|
||||
if (!RfuTryDisconnectLeavingChildren())
|
||||
{
|
||||
data->state = 6;
|
||||
data->playerCount = UnionRoomLeaderField0CompactionAndCount(data->field_0);
|
||||
@@ -861,21 +861,21 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
switch (UnionRoomHandleYesNo(&data->textState, CheckTrainerHasLeftByIdAndName(
|
||||
ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId),
|
||||
switch (UnionRoomHandleYesNo(&data->textState, HasTrainerLeftPartnersList(
|
||||
ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId),
|
||||
data->field_0->arr[data->playerCount].gname_uname.uname)))
|
||||
{
|
||||
case 0:
|
||||
LoadWirelessStatusIndicatorSpriteGfx();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
data->field_19 = 5;
|
||||
SendByteToPartnerByIdAndName(5, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
SendRfuStatusToPartner(5, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
data->state = 12;
|
||||
break;
|
||||
case 1:
|
||||
case -1:
|
||||
data->field_19 = 6;
|
||||
SendByteToPartnerByIdAndName(6, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
SendRfuStatusToPartner(6, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
data->state = 12;
|
||||
break;
|
||||
case -3:
|
||||
@@ -884,7 +884,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 12:
|
||||
val = WaitSendByteToPartnerByIdAndName(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
val = WaitSendRfuStatusToPartner(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
if (val == 1)
|
||||
{
|
||||
// Xfer complete
|
||||
@@ -918,7 +918,7 @@ static void Task_TryBecomeLinkLeader(u8 taskId)
|
||||
else
|
||||
{
|
||||
// Sent "no"
|
||||
RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.uname, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId));
|
||||
RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.uname, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId));
|
||||
data->field_0->arr[data->playerCount].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
|
||||
UnionRoomLeaderField0CompactionAndCount(data->field_0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
@@ -1287,7 +1287,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
|
||||
switch (data->state)
|
||||
{
|
||||
case 0:
|
||||
SetHostRFUtgtGname(sLinkGroupToURoomActivity[gSpecialVar_0x8004], 0, 0);
|
||||
SetHostRfuGameData(sLinkGroupToURoomActivity[gSpecialVar_0x8004], 0, 0);
|
||||
sPlayerCurrActivity = sLinkGroupToURoomActivity[gSpecialVar_0x8004];
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
@@ -1343,7 +1343,7 @@ static void Task_TryJoinLinkGroup(u8 taskId)
|
||||
u32 unusedVar;
|
||||
unusedVar = data->field_0->arr[id].gname_uname.gname.activity;
|
||||
|
||||
if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.started)
|
||||
if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.startedActivity)
|
||||
{
|
||||
u32 var = IsTryingToTradeWithHoennTooSoon(data, id);
|
||||
if (var == 0)
|
||||
@@ -1536,11 +1536,11 @@ static u32 IsTryingToTradeWithHoennTooSoon(struct UnkStruct_Group * arg0, s32 id
|
||||
{
|
||||
struct UnkStruct_x20 * structPtr = &arg0->field_0->arr[id];
|
||||
|
||||
if (sPlayerCurrActivity == ACTIVITY_TRADE && structPtr->gname_uname.gname.unk_00.version != VERSION_FIRE_RED && structPtr->gname_uname.gname.unk_00.version != VERSION_LEAF_GREEN)
|
||||
if (sPlayerCurrActivity == ACTIVITY_TRADE && structPtr->gname_uname.gname.compatibility.version != VERSION_FIRE_RED && structPtr->gname_uname.gname.compatibility.version != VERSION_LEAF_GREEN)
|
||||
{
|
||||
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP))
|
||||
return 1;
|
||||
else if (structPtr->gname_uname.gname.unk_00.isChampion)
|
||||
else if (structPtr->gname_uname.gname.compatibility.isChampion)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
@@ -1558,8 +1558,8 @@ static void AskToJoinRfuGroup(struct UnkStruct_Group * data, s32 id)
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
IntlConvPartnerUname7(gStringVar1, data->field_0->arr[data->leaderId]);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(sLinkGroupToURoomActivity[gSpecialVar_0x8004], 0, TRUE);
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.uname, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.unk_00.playerTrainerId));
|
||||
UpdateGameData_SetActivity(sLinkGroupToURoomActivity[gSpecialVar_0x8004], 0, TRUE);
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.uname, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.compatibility.playerTrainerId));
|
||||
}
|
||||
|
||||
u8 CreateTask_ListenToWireless(void)
|
||||
@@ -1585,11 +1585,11 @@ static void Task_ListenToWireless(u8 taskId)
|
||||
switch (data->state)
|
||||
{
|
||||
case 0:
|
||||
SetHostRFUtgtGname(0, 0, 0);
|
||||
SetHostRfuGameData(0, 0, 0);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_JoinGroup();
|
||||
sub_80FB128(TRUE);
|
||||
RfuSetIgnoreError(TRUE);
|
||||
data->field_4 = AllocZeroed(4 * sizeof(struct UnkStruct_x1C));
|
||||
data->field_0 = AllocZeroed(16 * sizeof(struct UnkStruct_x20));
|
||||
data->state = 2;
|
||||
@@ -1649,7 +1649,7 @@ static u8 URoomGroupListGetTextColor(struct UnkStruct_Group * data, u32 id)
|
||||
{
|
||||
if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
|
||||
{
|
||||
if (data->field_0->arr[id].gname_uname.gname.started)
|
||||
if (data->field_0->arr[id].gname_uname.gname.startedActivity)
|
||||
return UR_COLOR_WHT_WHT_LTE;
|
||||
else if (data->field_0->arr[id].field_1A_1)
|
||||
return UR_COLOR_RED_WHT_LTR;
|
||||
@@ -1976,7 +1976,7 @@ static void Task_StartActivity(u8 taskId)
|
||||
else
|
||||
{
|
||||
LinkRfu_StopManagerBeforeEnteringChat();
|
||||
SetHostRFUtgtGname(ACTIVITY_CHAT | IN_UNION_ROOM, 0, 1);
|
||||
SetHostRfuGameData(ACTIVITY_CHAT | IN_UNION_ROOM, 0, 1);
|
||||
}
|
||||
EnterUnionRoomChat();
|
||||
break;
|
||||
@@ -2076,8 +2076,8 @@ static void Task_MEvent_Leader(u8 taskId)
|
||||
case 0:
|
||||
sPlayerCurrActivity = data->activity;
|
||||
sPlayerActivityGroupSize = 2;
|
||||
SetHostRFUtgtGname(data->activity, 0, 0);
|
||||
SetGnameBufferWonderFlags(FALSE, FALSE);
|
||||
SetHostRfuGameData(data->activity, 0, 0);
|
||||
SetHostRfuWonderFlags(FALSE, FALSE);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_LinkLeader(2);
|
||||
@@ -2145,19 +2145,19 @@ static void Task_MEvent_Leader(u8 taskId)
|
||||
data->field_0->arr[data->playerCount].field_1B = 0;
|
||||
RedrawListMenu(data->listTaskId);
|
||||
data->field_19 = 5;
|
||||
SendByteToPartnerByIdAndName(5, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
SendRfuStatusToPartner(5, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
data->state = 8;
|
||||
break;
|
||||
case 1:
|
||||
case -1:
|
||||
data->field_19 = 6;
|
||||
SendByteToPartnerByIdAndName(6, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
SendRfuStatusToPartner(6, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
data->state = 8;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
val = WaitSendByteToPartnerByIdAndName(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
val = WaitSendRfuStatusToPartner(ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId), data->field_0->arr[data->playerCount].gname_uname.uname);
|
||||
if (val == 1)
|
||||
{
|
||||
if (data->field_19 == 5)
|
||||
@@ -2172,7 +2172,7 @@ static void Task_MEvent_Leader(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.uname, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.unk_00.playerTrainerId));
|
||||
RequestDisconnectSlotByTrainerNameAndId(data->field_0->arr[data->playerCount].gname_uname.uname, ReadAsU16(data->field_0->arr[data->playerCount].gname_uname.gname.compatibility.playerTrainerId));
|
||||
data->field_0->arr[data->playerCount].groupScheduledAnim = UNION_ROOM_SPAWN_NONE;
|
||||
UnionRoomLeaderField0CompactionAndCount(data->field_0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
@@ -2283,7 +2283,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
|
||||
switch (data->state)
|
||||
{
|
||||
case 0:
|
||||
SetHostRFUtgtGname(data->cardOrNews + ACTIVITY_WCARD2, 0, 0);
|
||||
SetHostRfuGameData(data->cardOrNews + ACTIVITY_WCARD2, 0, 0);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_JoinGroup();
|
||||
@@ -2338,14 +2338,14 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
|
||||
u32 unusedVar;
|
||||
unusedVar = data->field_0->arr[id].gname_uname.gname.activity;
|
||||
|
||||
if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.started)
|
||||
if (data->field_0->arr[id].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[id].gname_uname.gname.startedActivity)
|
||||
{
|
||||
data->leaderId = id;
|
||||
LoadWirelessStatusIndicatorSpriteGfx();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
RedrawListMenu(data->listTaskId);
|
||||
IntlConvPartnerUname(gStringVar1, data->field_0->arr[data->leaderId]);
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.uname, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.unk_00.playerTrainerId));
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[data->leaderId].gname_uname.uname, ReadAsU16(data->field_0->arr[data->leaderId].gname_uname.gname.compatibility.playerTrainerId));
|
||||
PlaySE(SE_POKENAV_ON);
|
||||
data->state = 4;
|
||||
}
|
||||
@@ -2449,7 +2449,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
|
||||
switch (data->state)
|
||||
{
|
||||
case 0:
|
||||
SetHostRFUtgtGname(0, 0, 0);
|
||||
SetHostRfuGameData(0, 0, 0);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_JoinGroup();
|
||||
@@ -2498,7 +2498,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
|
||||
id = ListMenu_ProcessInput(data->listTaskId);
|
||||
if (data->refreshTimer > 120)
|
||||
{
|
||||
if (data->field_0->arr[0].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[0].gname_uname.gname.started)
|
||||
if (data->field_0->arr[0].groupScheduledAnim == UNION_ROOM_SPAWN_IN && !data->field_0->arr[0].gname_uname.gname.startedActivity)
|
||||
{
|
||||
if (GetGnameWonderFlagByLinkGroup(&data->field_0->arr[0].gname_uname.gname, data->cardOrNews + LINK_GROUP_WONDER_CARD))
|
||||
{
|
||||
@@ -2506,7 +2506,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
|
||||
data->refreshTimer = 0;
|
||||
LoadWirelessStatusIndicatorSpriteGfx();
|
||||
CreateWirelessStatusIndicatorSprite(0, 0);
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[0].gname_uname.uname, ReadAsU16(data->field_0->arr[0].gname_uname.gname.unk_00.playerTrainerId));
|
||||
CreateTask_RfuReconnectWithParent(data->field_0->arr[0].gname_uname.uname, ReadAsU16(data->field_0->arr[0].gname_uname.gname.compatibility.playerTrainerId));
|
||||
PlaySE(SE_POKENAV_ON);
|
||||
data->state = 4;
|
||||
}
|
||||
@@ -2608,7 +2608,7 @@ void UnionRoomSpecial(void)
|
||||
{
|
||||
struct UnkStruct_URoom * dataPtr;
|
||||
|
||||
ClearAndInitHostRFUtgtGname();
|
||||
ResetHostRfuGameData();
|
||||
CreateTask(Task_RunUnionRoom, 10);
|
||||
|
||||
// dumb line needed to match
|
||||
@@ -2689,8 +2689,8 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
data->state = 2;
|
||||
break;
|
||||
case 2:
|
||||
SetHostRFUtgtGname(IN_UNION_ROOM, 0, 0);
|
||||
RfuUpdatePlayerGnameStateAndSend(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetHostRfuGameData(IN_UNION_ROOM, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_EnterUnionRoom();
|
||||
@@ -2709,11 +2709,11 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
switch (sUnionRoomTrade.field_0)
|
||||
{
|
||||
case 1:
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
if (id >= PARTY_SIZE)
|
||||
{
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
RfuUpdatePlayerGnameStateAndSend(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(0, 0, 0);
|
||||
UnionRoom_ScheduleFieldMessageAndExit(gText_UR_RegistrationCanceled);
|
||||
}
|
||||
else if (!RegisterTradeMonAndGetIsEgg(GetCursorSelectionMonId(), &sUnionRoomTrade))
|
||||
@@ -2734,7 +2734,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
sPlayerCurrActivity = ACTIVITY_TRADE | IN_UNION_ROOM;
|
||||
RegisterTradeMon(GetCursorSelectionMonId(), &sUnionRoomTrade);
|
||||
data->state = 51;
|
||||
@@ -2753,7 +2753,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
{
|
||||
if (gSpecialVar_Result == 9)
|
||||
{
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
PlaySE(SE_PC_LOGIN);
|
||||
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
|
||||
data->state = 42;
|
||||
@@ -2761,7 +2761,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
else if (gSpecialVar_Result == 11)
|
||||
{
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
data->state = 23;
|
||||
gSpecialVar_Result = 0;
|
||||
}
|
||||
@@ -2786,7 +2786,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
else if (PlayerIsTalkingToUnionRoomAide())
|
||||
{
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
PlaySE(SE_PC_LOGIN);
|
||||
UR_EnableScriptContext2AndFreezeObjectEvents();
|
||||
StringCopy(gStringVar1, gSaveBlock2Ptr->playerName);
|
||||
@@ -2805,8 +2805,8 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 4:
|
||||
data->state = 11;
|
||||
UR_EnableScriptContext2AndFreezeObjectEvents();
|
||||
RfuUpdatePlayerGnameStateAndSend(0, 0, 0);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_NPCTALK | IN_UNION_ROOM, GetActivePartnerSpriteGenderParam(data), FALSE);
|
||||
SetTradeBoardRegisteredMonInfo(0, 0, 0);
|
||||
UpdateGameData_SetActivity(ACTIVITY_NPCTALK | IN_UNION_ROOM, GetActivePartnerSpriteGenderParam(data), FALSE);
|
||||
break;
|
||||
}
|
||||
HandleUnionRoomPlayerRefresh(data);
|
||||
@@ -2815,21 +2815,21 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 23:
|
||||
if (!FuncIsActiveTask(Task_StartMenuHandleInput))
|
||||
{
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(IN_UNION_ROOM, 0, FALSE);
|
||||
UpdateGameData_SetActivity(IN_UNION_ROOM, 0, FALSE);
|
||||
data->state = 4;
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
UR_RunTextPrinters_CheckPrinter0Active();
|
||||
playerGender = GetUnionRoomPlayerGender(taskData[1], data->field_0);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
switch (UnionRoomGetPlayerInteractionResponse(data->field_0, taskData[0], taskData[1], playerGender))
|
||||
{
|
||||
case 0:
|
||||
data->state = 26;
|
||||
break;
|
||||
case 1:
|
||||
sub_80FC114(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, sPlayerCurrActivity);
|
||||
TryConnectToUnionRoomParent(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, sPlayerCurrActivity);
|
||||
data->field_12 = id; // Should be just 0, but won't match any other way.
|
||||
data->state = 25;
|
||||
break;
|
||||
@@ -3014,8 +3014,8 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 0:
|
||||
CopyBgTilemapBufferToVram(0);
|
||||
sPlayerCurrActivity = ACTIVITY_CHAT | IN_UNION_ROOM;
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_CHAT | IN_UNION_ROOM, 0, TRUE);
|
||||
sub_80FC114(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, sPlayerCurrActivity);
|
||||
UpdateGameData_SetActivity(ACTIVITY_CHAT | IN_UNION_ROOM, 0, TRUE);
|
||||
TryConnectToUnionRoomParent(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, sPlayerCurrActivity);
|
||||
data->field_12 = taskData[1];
|
||||
data->state = 20;
|
||||
taskData[3] = 0;
|
||||
@@ -3044,7 +3044,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 1:
|
||||
case 2:
|
||||
playerGender = GetUnionRoomPlayerGender(taskData[1], data->field_0);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
if (IsUnionRoomListenTaskActive() == TRUE)
|
||||
UnionRoom_ScheduleFieldMessageAndExit(gTexts_UR_ChatDeclined[playerGender]);
|
||||
else
|
||||
@@ -3060,7 +3060,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
if (RfuHasErrored())
|
||||
{
|
||||
playerGender = GetUnionRoomPlayerGender(taskData[1], data->field_0);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
UpdateGameData_SetActivity(ACTIVITY_PLYRTALK | IN_UNION_ROOM, 0, TRUE);
|
||||
if (IsUnionRoomListenTaskActive() == TRUE)
|
||||
UnionRoom_ScheduleFieldMessageAndExit(gTexts_UR_ChatDeclined[playerGender]);
|
||||
else
|
||||
@@ -3071,7 +3071,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
break;
|
||||
case 11:
|
||||
PlaySE(SE_DING_DONG);
|
||||
sub_80F8FA0();
|
||||
StopUnionRoomLinkManager();
|
||||
data->state = 12;
|
||||
data->recvActivityRequest[0] = 0;
|
||||
break;
|
||||
@@ -3107,7 +3107,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
ReceiveUnionRoomActivityPacket(data);
|
||||
if (UnionRoom_HandleContactFromOtherPlayer(data) && JOY_NEW(B_BUTTON))
|
||||
{
|
||||
sub_80FBD6C(1);
|
||||
Rfu_DisconnectPlayerById(1);
|
||||
StringCopy(gStringVar4, gText_UR_ChatEnded);
|
||||
data->state = 36;
|
||||
}
|
||||
@@ -3122,9 +3122,9 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 0:
|
||||
data->playerSendBuffer[0] = ACTIVITY_ACCEPT | IN_UNION_ROOM;
|
||||
if (sPlayerCurrActivity == (ACTIVITY_CHAT | IN_UNION_ROOM))
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(sPlayerCurrActivity | IN_UNION_ROOM, GetSinglePartnerSpriteGenderParam(1), FALSE);
|
||||
UpdateGameData_SetActivity(sPlayerCurrActivity | IN_UNION_ROOM, GetSinglePartnerSpriteGenderParam(1), FALSE);
|
||||
else
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(sPlayerCurrActivity | IN_UNION_ROOM, GetSinglePartnerSpriteGenderParam(1), TRUE);
|
||||
UpdateGameData_SetActivity(sPlayerCurrActivity | IN_UNION_ROOM, GetSinglePartnerSpriteGenderParam(1), TRUE);
|
||||
|
||||
data->field_8->arr[0].field_1B = 0;
|
||||
taskData[3] = 0;
|
||||
@@ -3218,20 +3218,20 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 42:
|
||||
if (GetHostRFUtgtGname()->species == SPECIES_NONE)
|
||||
if (GetHostRfuGameData()->tradeSpecies == SPECIES_NONE)
|
||||
{
|
||||
data->state = 43;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GetHostRFUtgtGname()->species == SPECIES_EGG)
|
||||
if (GetHostRfuGameData()->tradeSpecies == SPECIES_EGG)
|
||||
{
|
||||
StringCopy(gStringVar4, gText_UR_CancelRegistrationOfEgg);
|
||||
}
|
||||
else
|
||||
{
|
||||
StringCopy(gStringVar1, gSpeciesNames[GetHostRFUtgtGname()->species]);
|
||||
ConvertIntToDecimalStringN(gStringVar2, GetHostRFUtgtGname()->level, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringCopy(gStringVar1, gSpeciesNames[GetHostRfuGameData()->tradeSpecies]);
|
||||
ConvertIntToDecimalStringN(gStringVar2, GetHostRfuGameData()->tradeLevel, STR_CONV_MODE_LEFT_ALIGN, 3);
|
||||
StringExpandPlaceholders(gStringVar4, gText_UR_CancelRegistrationOfMon);
|
||||
}
|
||||
UnionRoom_ScheduleFieldMessageWithFollowupState(44, gStringVar4);
|
||||
@@ -3286,7 +3286,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case -2:
|
||||
case 18:
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
RfuUpdatePlayerGnameStateAndSend(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(0, 0, 0);
|
||||
UnionRoom_ScheduleFieldMessageAndExit(gText_UR_RegistrationCanceled);
|
||||
break;
|
||||
default:
|
||||
@@ -3297,7 +3297,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 55:
|
||||
RfuUpdatePlayerGnameStateAndSend(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
UnionRoom_ScheduleFieldMessageAndExit(gText_UR_RegistraionCompleted);
|
||||
break;
|
||||
case 44:
|
||||
@@ -3316,7 +3316,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
case 56:
|
||||
if (PrintOnTextbox(&data->textState, gText_UR_RegistrationCanceled2))
|
||||
{
|
||||
RfuUpdatePlayerGnameStateAndSend(0, 0, 0);
|
||||
SetTradeBoardRegisteredMonInfo(0, 0, 0);
|
||||
ResetUnionRoomTrade(&sUnionRoomTrade);
|
||||
HandleCancelTrade(TRUE);
|
||||
data->state = 4;
|
||||
@@ -3343,7 +3343,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
data->state = 4;
|
||||
break;
|
||||
default:
|
||||
switch (IsRequestedTypeAndSpeciesInPlayerParty(data->field_0->arr[var5].gname_uname.gname.type, data->field_0->arr[var5].gname_uname.gname.species))
|
||||
switch (IsRequestedTypeAndSpeciesInPlayerParty(data->field_0->arr[var5].gname_uname.gname.tradeType, data->field_0->arr[var5].gname_uname.gname.tradeSpecies))
|
||||
{
|
||||
case UR_TRADE_MATCH:
|
||||
IntlConvPartnerUname(gStringVar1, data->field_0->arr[var5]);
|
||||
@@ -3352,12 +3352,12 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
break;
|
||||
case UR_TRADE_NOTYPE:
|
||||
IntlConvPartnerUname(gStringVar1, data->field_0->arr[var5]);
|
||||
StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].gname_uname.gname.type]);
|
||||
StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].gname_uname.gname.tradeType]);
|
||||
UnionRoom_ScheduleFieldMessageWithFollowupState(46, gText_UR_DontHaveTypeTrainerWants);
|
||||
break;
|
||||
case UR_TRADE_NOEGG:
|
||||
IntlConvPartnerUname(gStringVar1, data->field_0->arr[var5]);
|
||||
StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].gname_uname.gname.type]);
|
||||
StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].gname_uname.gname.tradeType]);
|
||||
UnionRoom_ScheduleFieldMessageWithFollowupState(46, gText_UR_DontHaveEggTrainerWants);
|
||||
break;
|
||||
}
|
||||
@@ -3382,9 +3382,9 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
if (PrintOnTextbox(&data->textState, gText_UR_WhichMonWillYouOffer))
|
||||
{
|
||||
sUnionRoomTrade.field_0 = 2;
|
||||
memcpy(&gPartnerTgtGnameSub, &data->field_0->arr[taskData[1]].gname_uname.gname.unk_00, sizeof(gPartnerTgtGnameSub));
|
||||
gUnionRoomRequestedMonType = data->field_0->arr[taskData[1]].gname_uname.gname.type;
|
||||
gUnionRoomOfferedSpecies = data->field_0->arr[taskData[1]].gname_uname.gname.species;
|
||||
memcpy(&gPartnerTgtGnameSub, &data->field_0->arr[taskData[1]].gname_uname.gname.compatibility, sizeof(gPartnerTgtGnameSub));
|
||||
gUnionRoomRequestedMonType = data->field_0->arr[taskData[1]].gname_uname.gname.tradeType;
|
||||
gUnionRoomOfferedSpecies = data->field_0->arr[taskData[1]].gname_uname.gname.tradeSpecies;
|
||||
gFieldCallback = FieldCB_ContinueScriptUnionRoom;
|
||||
ChooseMonForTradingBoard(PARTY_MENU_TYPE_UNION_ROOM_TRADE, CB2_ReturnToField);
|
||||
BackUpURoomField0ToDecompressionBuffer(data);
|
||||
@@ -3393,7 +3393,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
break;
|
||||
case 51:
|
||||
sPlayerCurrActivity = ACTIVITY_TRADE | IN_UNION_ROOM;
|
||||
sub_80FC114(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, ACTIVITY_TRADE | IN_UNION_ROOM);
|
||||
TryConnectToUnionRoomParent(data->field_0->arr[taskData[1]].gname_uname.uname, &data->field_0->arr[taskData[1]].gname_uname.gname, ACTIVITY_TRADE | IN_UNION_ROOM);
|
||||
IntlConvPartnerUname(gStringVar1, data->field_0->arr[taskData[1]]);
|
||||
UR_PrintFieldMessage(gTexts_UR_CommunicatingWait[2]);
|
||||
data->state = 25;
|
||||
@@ -3488,11 +3488,11 @@ static void Task_InitUnionRoom(u8 taskId)
|
||||
structPtr->state = 1;
|
||||
break;
|
||||
case 1:
|
||||
SetHostRFUtgtGname(ACTIVITY_SEARCH, 0, 0);
|
||||
SetHostRfuGameData(ACTIVITY_SEARCH, 0, 0);
|
||||
SetWirelessCommType1();
|
||||
OpenLink();
|
||||
InitializeRfuLinkManager_EnterUnionRoom();
|
||||
sub_80FB128(TRUE);
|
||||
RfuSetIgnoreError(TRUE);
|
||||
structPtr->state = 2;
|
||||
break;
|
||||
case 2:
|
||||
@@ -3519,7 +3519,7 @@ static void Task_InitUnionRoom(u8 taskId)
|
||||
if (structPtr->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
|
||||
{
|
||||
IntlConvPartnerUname(text, structPtr->field_0->arr[i]);
|
||||
if (PlayerHasMetTrainerBefore(ReadAsU16(structPtr->field_0->arr[i].gname_uname.gname.unk_00.playerTrainerId), text))
|
||||
if (PlayerHasMetTrainerBefore(ReadAsU16(structPtr->field_0->arr[i].gname_uname.gname.compatibility.playerTrainerId), text))
|
||||
{
|
||||
StringCopy(sUnionRoomPlayerName, text);
|
||||
break;
|
||||
@@ -3659,7 +3659,7 @@ static void Task_SearchForChildOrParent(u8 taskId)
|
||||
{
|
||||
gname_uname = sUnionGnameUnamePair_Dummy;
|
||||
}
|
||||
if (gname_uname.gname.unk_00.language == LANGUAGE_JAPANESE)
|
||||
if (gname_uname.gname.compatibility.language == LANGUAGE_JAPANESE)
|
||||
{
|
||||
gname_uname = sUnionGnameUnamePair_Dummy;
|
||||
}
|
||||
@@ -3720,7 +3720,7 @@ static bool32 GetGnameWonderFlagByLinkGroup(struct RfuGameData * gname, s16 link
|
||||
{
|
||||
if (linkGroup == LINK_GROUP_WONDER_CARD)
|
||||
{
|
||||
if (!gname->unk_00.hasCard)
|
||||
if (!gname->compatibility.hasCard)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -3731,7 +3731,7 @@ static bool32 GetGnameWonderFlagByLinkGroup(struct RfuGameData * gname, s16 link
|
||||
}
|
||||
else if (linkGroup == LINK_GROUP_WONDER_NEWS)
|
||||
{
|
||||
if (!gname->unk_00.hasNews)
|
||||
if (!gname->compatibility.hasNews)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4078,7 +4078,7 @@ static bool8 AreGnameUnameDifferent(struct UnionGnameUnamePair * left, const str
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
if (left->gname.unk_00.playerTrainerId[i] != right->gname.unk_00.playerTrainerId[i])
|
||||
if (left->gname.compatibility.playerTrainerId[i] != right->gname.compatibility.playerTrainerId[i])
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
@@ -4100,32 +4100,22 @@ static bool32 AreUnionRoomPlayerGnamesDifferent(struct UnionGnameUnamePair * lef
|
||||
s32 i;
|
||||
|
||||
if (left->gname.activity != right->gname.activity)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (left->gname.started != right->gname.started)
|
||||
{
|
||||
if (left->gname.startedActivity != right->gname.startedActivity)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
{
|
||||
if (left->gname.child_sprite_gender[i] != right->gname.child_sprite_gender[i])
|
||||
{
|
||||
if (left->gname.partnerInfo[i] != right->gname.partnerInfo[i])
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if (left->gname.species != right->gname.species)
|
||||
{
|
||||
if (left->gname.tradeSpecies != right->gname.tradeSpecies)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (left->gname.type != right->gname.type)
|
||||
{
|
||||
if (left->gname.tradeType != right->gname.tradeType)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
@@ -4185,7 +4175,7 @@ static void PrintUnionRoomGroupOnWindow(u8 windowId, u8 x, u8 y, struct UnkStruc
|
||||
{
|
||||
IntlConvPartnerUname(uname, *group);
|
||||
UR_AddTextPrinterParameterized(windowId, 2, uname, x, y, colorIdx);
|
||||
ConvertIntToDecimalStringN(id_str, group->gname_uname.gname.unk_00.playerTrainerId[0] | (group->gname_uname.gname.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
|
||||
ConvertIntToDecimalStringN(id_str, group->gname_uname.gname.compatibility.playerTrainerId[0] | (group->gname_uname.gname.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
|
||||
StringCopy(gStringVar4, gText_UR_ID);
|
||||
StringAppend(gStringVar4, id_str);
|
||||
x += 77;
|
||||
@@ -4202,7 +4192,7 @@ static void PrintGroupMemberCandidateOnWindowWithColor(u8 windowId, u8 x, u8 y,
|
||||
{
|
||||
IntlConvPartnerUname(uname, *group);
|
||||
UR_AddTextPrinterParameterized(windowId, 2, uname, x, y, colorIdx);
|
||||
ConvertIntToDecimalStringN(id_str, group->gname_uname.gname.unk_00.playerTrainerId[0] | (group->gname_uname.gname.unk_00.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
|
||||
ConvertIntToDecimalStringN(id_str, group->gname_uname.gname.compatibility.playerTrainerId[0] | (group->gname_uname.gname.compatibility.playerTrainerId[1] << 8), STR_CONV_MODE_LEADING_ZEROS, 5);
|
||||
StringCopy(gStringVar4, gText_UR_ID);
|
||||
StringAppend(gStringVar4, id_str);
|
||||
x += 71;
|
||||
@@ -4250,7 +4240,7 @@ static u32 ConvPartnerUnameAndGetWhetherMetAlready(struct UnkStruct_x20 * x20)
|
||||
{
|
||||
u8 sp0[30];
|
||||
IntlConvPartnerUname(sp0, *x20);
|
||||
return PlayerHasMetTrainerBefore(ReadAsU16(x20->gname_uname.gname.unk_00.playerTrainerId), sp0);
|
||||
return PlayerHasMetTrainerBefore(ReadAsU16(x20->gname_uname.gname.compatibility.playerTrainerId), sp0);
|
||||
}
|
||||
|
||||
static s32 UnionRoomGetPlayerInteractionResponse(struct UnkStruct_Main0 * main0, u8 overrideGender, u8 playerIdx, u32 playerGender)
|
||||
@@ -4259,10 +4249,10 @@ static s32 UnionRoomGetPlayerInteractionResponse(struct UnkStruct_Main0 * main0,
|
||||
|
||||
struct UnkStruct_x20 * x20 = &main0->arr[playerIdx];
|
||||
|
||||
if (!x20->gname_uname.gname.started && overrideGender == 0)
|
||||
if (!x20->gname_uname.gname.startedActivity && overrideGender == 0)
|
||||
{
|
||||
IntlConvPartnerUname(gStringVar1, *x20);
|
||||
metBefore = PlayerHasMetTrainerBefore(ReadAsU16(x20->gname_uname.gname.unk_00.playerTrainerId), gStringVar1);
|
||||
metBefore = PlayerHasMetTrainerBefore(ReadAsU16(x20->gname_uname.gname.compatibility.playerTrainerId), gStringVar1);
|
||||
if (x20->gname_uname.gname.activity == (ACTIVITY_CHAT | IN_UNION_ROOM))
|
||||
{
|
||||
StringExpandPlaceholders(gStringVar4, gTexts_UR_JoinChat[metBefore][playerGender]);
|
||||
@@ -4279,7 +4269,7 @@ static s32 UnionRoomGetPlayerInteractionResponse(struct UnkStruct_Main0 * main0,
|
||||
IntlConvPartnerUname(gStringVar1, *x20);
|
||||
if (overrideGender != 0)
|
||||
{
|
||||
playerGender = (x20->gname_uname.gname.unk_00.playerTrainerId[overrideGender + 1] >> 3) & 1;
|
||||
playerGender = (x20->gname_uname.gname.compatibility.playerTrainerId[overrideGender + 1] >> 3) & 1;
|
||||
}
|
||||
switch (x20->gname_uname.gname.activity & 0x3F)
|
||||
{
|
||||
@@ -4310,9 +4300,9 @@ static void nullsub_92(u8 windowId, u32 itemId, u8 y)
|
||||
static void TradeBoardPrintItemInfo(u8 windowId, u8 y, struct RfuGameData * gname, const u8 * uname, u8 colorIdx)
|
||||
{
|
||||
u8 level_t[4];
|
||||
u16 species = gname->species;
|
||||
u8 type = gname->type;
|
||||
u8 level = gname->level;
|
||||
u16 species = gname->tradeSpecies;
|
||||
u8 type = gname->tradeType;
|
||||
u8 level = gname->tradeLevel;
|
||||
|
||||
UR_AddTextPrinterParameterized(windowId, 2, uname, 8, y, colorIdx);
|
||||
if (species == SPECIES_EGG)
|
||||
@@ -4337,8 +4327,8 @@ static void TradeBoardListMenuItemPrintFunc(u8 windowId, u32 itemId, u8 y)
|
||||
|
||||
if (itemId == -3 && y == sTradeBoardListMenuTemplate.upText_Y)
|
||||
{
|
||||
rfu = GetHostRFUtgtGname();
|
||||
if (rfu->species != SPECIES_NONE)
|
||||
rfu = GetHostRfuGameData();
|
||||
if (rfu->tradeSpecies != SPECIES_NONE)
|
||||
{
|
||||
TradeBoardPrintItemInfo(windowId, y, rfu, gSaveBlock2Ptr->playerName, 5);
|
||||
}
|
||||
@@ -4348,7 +4338,7 @@ static void TradeBoardListMenuItemPrintFunc(u8 windowId, u32 itemId, u8 y)
|
||||
j = 0;
|
||||
for (i = 0; i < UROOM_MAX_GROUP_COUNT; i++)
|
||||
{
|
||||
if (leader->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && leader->field_0->arr[i].gname_uname.gname.species != SPECIES_NONE)
|
||||
if (leader->field_0->arr[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && leader->field_0->arr[i].gname_uname.gname.tradeSpecies != SPECIES_NONE)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
@@ -4369,7 +4359,7 @@ static s32 GetIndexOfNthTradeBoardOffer(struct UnkStruct_x20 * x20, s32 n)
|
||||
|
||||
for (i = 0; i < UROOM_MAX_GROUP_COUNT; i++)
|
||||
{
|
||||
if (x20[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && x20[i].gname_uname.gname.species != SPECIES_NONE)
|
||||
if (x20[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN && x20[i].gname_uname.gname.tradeSpecies != SPECIES_NONE)
|
||||
{
|
||||
j++;
|
||||
}
|
||||
@@ -4641,8 +4631,8 @@ static void HandleCancelTrade(bool32 unlockObjs)
|
||||
sPlayerCurrActivity = 0;
|
||||
if (unlockObjs)
|
||||
{
|
||||
RfuUpdatePlayerGnameStateAndSend(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
UpdateGameDataWithActivitySpriteGendersFlag(IN_UNION_ROOM, 0, FALSE);
|
||||
SetTradeBoardRegisteredMonInfo(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel);
|
||||
UpdateGameData_SetActivity(IN_UNION_ROOM, 0, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4670,7 +4660,7 @@ static u8 GetActivePartnerSpriteGenderParam(struct UnkStruct_URoom * uroom)
|
||||
if (uroom->field_C->arr[i].active)
|
||||
{
|
||||
retVal |= uroom->field_C->arr[i].gname_uname.gname.playerGender << 3;
|
||||
retVal |= uroom->field_C->arr[i].gname_uname.gname.unk_00.playerTrainerId[0] & 7;
|
||||
retVal |= uroom->field_C->arr[i].gname_uname.gname.compatibility.playerTrainerId[0] & 7;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+15
-15
@@ -324,7 +324,7 @@ static void ChatEntryRoutine_Join(void)
|
||||
sWork->routineState++;
|
||||
// fall through
|
||||
case 1:
|
||||
if (IsLinkTaskFinished() && !RfuHasFoundNewLeader())
|
||||
if (IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive())
|
||||
{
|
||||
if (SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
sWork->routineState++;
|
||||
@@ -527,14 +527,14 @@ static void ChatEntryRoutine_AskQuitChatting(void)
|
||||
sWork->routineState = 3;
|
||||
break;
|
||||
case 0:
|
||||
Rfu_UnionRoomChat_StopLinkManager();
|
||||
Rfu_StopPartnerSearch();
|
||||
PrepareSendBuffer_Disband(sWork->sendMessageBuffer);
|
||||
sWork->routineState = 4;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if (IsLinkTaskFinished() && !RfuHasFoundNewLeader() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
if (IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
{
|
||||
if (sWork->multiplayerId == 0)
|
||||
sWork->routineState = 6;
|
||||
@@ -577,15 +577,15 @@ static void ChatEntryRoutine_ExitChat(void)
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (IsLinkTaskFinished() && !RfuHasFoundNewLeader() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
if (IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
sWork->routineState++;
|
||||
break;
|
||||
case 4:
|
||||
if ((GetBlockReceivedStatus() & 1) && !RfuHasFoundNewLeader())
|
||||
if ((GetBlockReceivedStatus() & 1) && !Rfu_IsPlayerExchangeActive())
|
||||
sWork->routineState++;
|
||||
break;
|
||||
case 5:
|
||||
if (IsLinkTaskFinished() && !RfuHasFoundNewLeader())
|
||||
if (IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive())
|
||||
{
|
||||
SetCloseLinkCallback();
|
||||
sWork->exitDelayTimer = 0;
|
||||
@@ -620,7 +620,7 @@ static void ChatEntryRoutine_Drop(void)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (!RunDisplaySubtask(0) && IsLinkTaskFinished() && !RfuHasFoundNewLeader())
|
||||
if (!RunDisplaySubtask(0) && IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive())
|
||||
{
|
||||
SetCloseLinkCallback();
|
||||
sWork->exitDelayTimer = 0;
|
||||
@@ -666,7 +666,7 @@ static void ChatEntryRoutine_Disbanded(void)
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (RunDisplaySubtask(0) != TRUE && IsLinkTaskFinished() && !RfuHasFoundNewLeader())
|
||||
if (RunDisplaySubtask(0) != TRUE && IsLinkTaskFinished() && !Rfu_IsPlayerExchangeActive())
|
||||
{
|
||||
SetCloseLinkCallback();
|
||||
sWork->exitDelayTimer = 0;
|
||||
@@ -704,7 +704,7 @@ static void ChatEntryRoutine_SendMessage(void)
|
||||
sWork->routineState++;
|
||||
// fall through
|
||||
case 1:
|
||||
if (IsLinkTaskFinished() == TRUE && !RfuHasFoundNewLeader() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
if (IsLinkTaskFinished() == TRUE && !Rfu_IsPlayerExchangeActive() && SendBlock(0, sWork->sendMessageBuffer, sizeof(sWork->sendMessageBuffer)))
|
||||
sWork->routineState++;
|
||||
break;
|
||||
case 2:
|
||||
@@ -1144,7 +1144,7 @@ static void PrepareSendBuffer_Leave(u8 *arg0)
|
||||
arg0[0] = CHAT_MESSAGE_LEAVE;
|
||||
StringCopy(&arg0[1], gSaveBlock2Ptr->playerName);
|
||||
arg0[1 + (PLAYER_NAME_LENGTH + 1)] = sWork->multiplayerId;
|
||||
sub_80FB9D0();
|
||||
RfuSetNormalDisconnectMode();
|
||||
}
|
||||
|
||||
static void PrepareSendBuffer_Drop(u8 *arg0)
|
||||
@@ -1355,7 +1355,7 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
}
|
||||
|
||||
tBlockReceivedStatus = GetBlockReceivedStatus();
|
||||
if (!tBlockReceivedStatus && RfuHasFoundNewLeader())
|
||||
if (!tBlockReceivedStatus && Rfu_IsPlayerExchangeActive())
|
||||
return;
|
||||
|
||||
tI = 0;
|
||||
@@ -1409,13 +1409,13 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
// You're the leader, and the person who left is not you
|
||||
if (GetLinkPlayerCount() == 2)
|
||||
{
|
||||
Rfu_UnionRoomChat_StopLinkManager();
|
||||
Rfu_StopPartnerSearch();
|
||||
sWork->exitType = CHATEXIT_LEADER_LAST;
|
||||
DestroyTask(taskId);
|
||||
return;
|
||||
}
|
||||
|
||||
sub_80FBD6C(tCurrLinkPlayer);
|
||||
Rfu_DisconnectPlayerById(tCurrLinkPlayer);
|
||||
}
|
||||
|
||||
tState = 3;
|
||||
@@ -1433,10 +1433,10 @@ static void Task_ReceiveChatMessage(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 2:
|
||||
if (!RfuHasFoundNewLeader())
|
||||
if (!Rfu_IsPlayerExchangeActive())
|
||||
{
|
||||
if (sWork->multiplayerId == 0)
|
||||
sub_80FB030(sWork->linkPlayerCount);
|
||||
SetUnionRoomChatPlayerData(sWork->linkPlayerCount);
|
||||
|
||||
tState = 1;
|
||||
}
|
||||
|
||||
@@ -366,7 +366,7 @@ static u32 CountMembersInGroup(struct UnkStruct_x20 * unk20, u32 * counts)
|
||||
k = 0;
|
||||
for (j = 0; j < RFU_CHILD_MAX; j++)
|
||||
{
|
||||
if (unk20->gname_uname.gname.child_sprite_gender[j] != 0) k++;
|
||||
if (unk20->gname_uname.gname.partnerInfo[j] != 0) k++;
|
||||
}
|
||||
k++;
|
||||
counts[sCountParams[i][1]] += k;
|
||||
|
||||
Reference in New Issue
Block a user