Document union_room.c

This commit is contained in:
GriffinR 2020-05-30 04:09:21 -04:00
parent 24075e9e72
commit 4fe507e453
34 changed files with 1811 additions and 1664 deletions

View File

@ -3,6 +3,6 @@
#include "main.h" #include "main.h"
void sub_8020C70(MainCallback callback); void StartBerryCrush(MainCallback callback);
#endif // GUARD_BERRY_CRUSH_H #endif // GUARD_BERRY_CRUSH_H

View File

@ -11,7 +11,7 @@
void sub_80B37D4(TaskFunc taskFunc); void sub_80B37D4(TaskFunc taskFunc);
u8 sub_80B3050(void); u8 sub_80B3050(void);
void sub_80B360C(void); void CB2_ReturnFromCableClubBattle(void);
bool32 sub_80B2AF4(u16 *arg0, u16 *arg1); bool32 sub_80B2AF4(u16 *arg0, u16 *arg1);
void sub_80B3AF8(u8 taskId); void sub_80B3AF8(u8 taskId);
void task00_08081A90(u8 taskId); void task00_08081A90(u8 taskId);

View File

@ -1,6 +1,58 @@
#ifndef GUARD_CONSTANTS_UNION_ROOM_H #ifndef GUARD_CONSTANTS_UNION_ROOM_H
#define GUARD_CONSTANTS_UNION_ROOM_H #define GUARD_CONSTANTS_UNION_ROOM_H
#define UNION_ROOM_SPAWN_NONE 0
#define UNION_ROOM_SPAWN_IN 1
#define UNION_ROOM_SPAWN_OUT 2
#define ACTIVITY_NONE 0
#define ACTIVITY_BATTLE_SINGLE 1
#define ACTIVITY_BATTLE_DOUBLE 2
#define ACTIVITY_BATTLE_MULTI 3
#define ACTIVITY_TRADE 4
#define ACTIVITY_CHAT 5
#define ACTIVITY_WONDER_CARD 6
#define ACTIVITY_WONDER_NEWS 7
#define ACTIVITY_CARD 8
#define ACTIVITY_POKEMON_JUMP 9
#define ACTIVITY_BERRY_CRUSH 10
#define ACTIVITY_BERRY_PICK 11
#define ACTIVITY_SEARCH 12
#define ACTIVITY_SPIN_TRADE 13
#define ACTIVITY_BATTLE_TOWER_OPEN 14
#define ACTIVITY_RECORD_CORNER 15
#define ACTIVITY_BERRY_BLENDER 16
// Player response
#define ACTIVITY_ACCEPT 17
#define ACTIVITY_DECLINE 18
#define ACTIVITY_NPCTALK 19
#define ACTIVITY_PLYRTALK 20
// Duplicate IDs?
#define ACTIVITY_WONDER_CARD2 21
#define ACTIVITY_WONDER_NEWS2 22
#define ACTIVITY_CONTEST_COOL 23
#define ACTIVITY_CONTEST_BEAUTY 24
#define ACTIVITY_CONTEST_CUTE 25
#define ACTIVITY_CONTEST_SMART 26
#define ACTIVITY_CONTEST_TOUGH 27
#define ACTIVITY_BATTLE_TOWER 28
#define ACTIVITY_29 29
#define IN_UNION_ROOM 0x40
// Used in UR_AddTextPrinterParameterized
#define UR_COLOR_DKE_WHT_LTE 0
#define UR_COLOR_RED_WHT_LTR 1
#define UR_COLOR_GRN_WHT_LTG 2
#define UR_COLOR_WHT_WHT_LTE 3
#define UR_COLOR_WHT_DKE_LTE 4
#define UR_COLOR_GRN_DN6_LTB 5
#define UR_COLOR_DN5_DN6_LTB 6
#define LINK_GROUP_SINGLE_BATTLE 0 #define LINK_GROUP_SINGLE_BATTLE 0
#define LINK_GROUP_DOUBLE_BATTLE 1 #define LINK_GROUP_DOUBLE_BATTLE 1
#define LINK_GROUP_MULTI_BATTLE 2 #define LINK_GROUP_MULTI_BATTLE 2
@ -10,8 +62,8 @@
#define LINK_GROUP_BERRY_PICKING 6 #define LINK_GROUP_BERRY_PICKING 6
#define LINK_GROUP_WONDER_CARD 7 #define LINK_GROUP_WONDER_CARD 7
#define LINK_GROUP_WONDER_NEWS 8 #define LINK_GROUP_WONDER_NEWS 8
#define LINK_GROUP_UNK_9 9 #define LINK_GROUP_UNION_ROOM_RESUME 9
#define LINK_GROUP_UNK_10 10 #define LINK_GROUP_UNION_ROOM_INIT 10
#define LINK_GROUP_UNK_11 11 #define LINK_GROUP_UNK_11 11
#define LINK_GROUP_RECORD_CORNER 12 #define LINK_GROUP_RECORD_CORNER 12
#define LINK_GROUP_BERRY_BLENDER 13 #define LINK_GROUP_BERRY_BLENDER 13
@ -25,4 +77,8 @@
#define LINK_GROUP_BATTLE_TOWER_OPEN 21 #define LINK_GROUP_BATTLE_TOWER_OPEN 21
#define NUM_LINK_GROUP_TYPES 22 #define NUM_LINK_GROUP_TYPES 22
#define UR_TRADE_MATCH 0
#define UR_TRADE_NOTYPE 1
#define UR_TRADE_NOEGG 2
#endif //GUARD_CONSTANTS_UNION_ROOM_H #endif //GUARD_CONSTANTS_UNION_ROOM_H

View File

@ -1,7 +1,7 @@
#ifndef GUARD_DODRIO_BERRY_PICKING_H #ifndef GUARD_DODRIO_BERRY_PICKING_H
#define GUARD_DODRIO_BERRY_PICKING_H #define GUARD_DODRIO_BERRY_PICKING_H
void sub_802493C(u16 a0, void (*callback)(void)); void StartDodrioBerryPicking(u16 a0, void (*callback)(void));
void IsDodrioInParty(void); void IsDodrioInParty(void);
void ShowDodrioBerryPickingRecords(void); void ShowDodrioBerryPickingRecords(void);

View File

@ -8,6 +8,6 @@ void LockSelectedObjectEvent(void);
void sub_8098630(void); void sub_8098630(void);
bool8 sub_8098734(void); bool8 sub_8098734(void);
void ScriptUnfreezeObjectEvents(void); void ScriptUnfreezeObjectEvents(void);
void sub_8098524(void); void UnionRoom_UnlockPlayerAndChatPartner(void);
#endif // GUARD_EVENT_OBJECT_LOCK_H #endif // GUARD_EVENT_OBJECT_LOCK_H

View File

@ -274,7 +274,7 @@ void LoadWirelessStatusIndicatorSpriteGfx(void);
bool8 IsLinkTaskFinished(void); bool8 IsLinkTaskFinished(void);
void CreateWirelessStatusIndicatorSprite(u8, u8); void CreateWirelessStatusIndicatorSprite(u8, u8);
void sub_800ADF8(void); void sub_800ADF8(void);
void sub_800B488(void); void SetWirelessCommType1(void);
void CheckShouldAdvanceLinkState(void); void CheckShouldAdvanceLinkState(void);
void sub_8011BD0(void); void sub_8011BD0(void);
u8 IsLinkMaster(void); u8 IsLinkMaster(void);

View File

@ -204,7 +204,7 @@ extern u8 gWirelessStatusIndicatorSpriteId;
// Exported ROM declarations // Exported ROM declarations
void WipeTrainerNameRecords(void); void WipeTrainerNameRecords(void);
void sub_800E700(void); void sub_800E700(void);
void sub_800EDD4(void); void LinkRfu_Shutdown(void);
void sub_800F6FC(u8 who); void sub_800F6FC(u8 who);
void sub_800F728(u8 who); void sub_800F728(u8 who);
bool32 IsSendingKeysToRfu(void); bool32 IsSendingKeysToRfu(void);
@ -225,51 +225,51 @@ void sub_800E174(void);
void sub_800E6D0(void); void sub_800E6D0(void);
bool32 sub_8010EC0(void); bool32 sub_8010EC0(void);
bool32 sub_8010F1C(void); bool32 sub_8010F1C(void);
bool32 sub_8011A80(void); bool32 RfuIsErrorStatus1or2(void);
bool32 IsRfuRecvQueueEmpty(void); bool32 IsRfuRecvQueueEmpty(void);
u32 GetRfuRecvQueueLength(void); u32 GetRfuRecvQueueLength(void);
void RfuVSync(void); void RfuVSync(void);
void sub_80111B0(bool32 a0); void sub_80111B0(bool32 a0);
u8 sub_8011A74(void); u8 RfuGetErrorStatus(void);
struct GFtgtGname *sub_800F7DC(void); struct GFtgtGname *GetHostRFUtgtGname(void);
void sub_8011068(u8 a0); void UpdateGameData_GroupLockedIn(u8 a0);
void sub_8011170(u32 a0); void sub_8011170(u32 a0);
void sub_8011A64(u8 a0, u16 a1); void RfuSetErrorStatus(u8 a0, u16 a1);
u8 sub_801048C(bool32 a0); u8 sub_801048C(bool32 a0);
void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2); void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2);
void sub_8010F84(u8 a0, u32 a1, u32 a2); void SetHostRFUtgtGname(u8 a0, u32 a1, u32 a2);
void sub_8011C10(u32 a0); void InitializeRfuLinkManager_LinkLeader(u32 a0);
bool32 sub_8012240(void); bool32 sub_8012240(void);
void sub_800EF38(void); void LinkRfu_StopManagerAndFinalizeSlots(void);
bool32 sub_80105EC(void); bool32 sub_80105EC(void);
bool32 sub_801064C(u16 a0, const u8 *a1); bool32 TrainerIdAndNameStillInPartnersList(u16 a0, const u8 *a1);
void sub_8010688(u8 a0, u16 a1, const u8 *a2); void SendByteToPartnerByIdAndName(u8 a0, u16 a1, const u8 *a2);
u32 sub_8010714(u16 a0, const u8 *a1); u32 WaitSendByteToPartnerByIdAndName(u16 a0, const u8 *a1);
void sub_8011DC0(const u8 *a0, u16 a1); void RequestDisconnectSlotByTrainerNameAndId(const u8 *a0, u16 a1);
bool8 sub_800EF1C(void); bool8 LmanAcceptSlotFlagIsNotZero(void);
bool32 sub_800EF58(bool32 a0); bool32 WaitRfuState(bool32 a0);
void DestroyWirelessStatusIndicatorSprite(void); void DestroyWirelessStatusIndicatorSprite(void);
void sub_801103C(void); void sub_801103C(void);
void sub_8011C5C(void); void InitializeRfuLinkManager_JoinGroup(void);
void sub_80106D4(void); void LinkRfuNIsend8(void);
void RecordMixTrainerNames(void); void RecordMixTrainerNames(void);
void sub_800ED10(void); void LinkRfu_CreateConnectionAsParent(void);
void sub_800ED28(void); void LinkRfu_StopManagerBeforeEnteringChat(void);
void sub_8011090(u8 a0, u32 a1, u32 a2); void UpdateGameDataWithActivitySpriteGendersFlag(u8 a0, u32 a1, u32 a2);
void sub_8011FC8(const u8 *src, u16 trainerId); void CreateTask_RfuReconnectWithParent(const u8 *src, u16 trainerId);
void sub_8010FA0(bool32 a0, bool32 a1); void SetGnameBufferWonderFlags(bool32 a0, bool32 a1);
void sub_8010F60(void); void ClearAndInitHostRFUtgtGname(void);
void sub_8010FCC(u32 a0, u32 a1, u32 a2); void sub_8010FCC(u32 a0, u32 a1, u32 a2);
void sub_8011C84(void); void InitializeRfuLinkManager_EnterUnionRoom(void);
void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2); void sub_8012188(const u8 *name, struct GFtgtGname *structPtr, u8 a2);
bool32 sub_8011B90(void); bool32 IsUnionRoomListenTaskActive(void);
void sub_800FE50(void *a0); void sub_800FE50(void *a0);
bool32 sub_800E540(u16 id, u8 *name); bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name);
void sub_8011DE0(u32 arg0); void sub_8011DE0(u32 arg0);
u8 sub_801100C(s32 a0); u8 sub_801100C(s32 a0);
void sub_800EF7C(void); void sub_800EF7C(void);
bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx); bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx); bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
s32 sub_800E87C(u8 idx); s32 sub_800E87C(u8 idx);
void sub_8011BA4(void); void sub_8011BA4(void);
void sub_8010198(void); void sub_8010198(void);
@ -325,9 +325,6 @@ void PkmnStrToASCII(u8 *q1, const u8 *q2);
void ASCIIToPkmnStr(u8 *q1, const u8 *q2); void ASCIIToPkmnStr(u8 *q1, const u8 *q2);
u8 sub_800DD1C(u8 maxFlags); u8 sub_800DD1C(u8 maxFlags);
void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3); void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3);
bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx);
void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2);
void CreateWirelessStatusIndicatorSprite(u8 x, u8 y); void CreateWirelessStatusIndicatorSprite(u8 x, u8 y);
void DestroyWirelessStatusIndicatorSprite(void); void DestroyWirelessStatusIndicatorSprite(void);
void LoadWirelessStatusIndicatorSpriteGfx(void); void LoadWirelessStatusIndicatorSpriteGfx(void);
@ -337,7 +334,6 @@ void sub_800E174(void);
void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name); void CopyTrainerRecord(struct TrainerNameRecord *dest, u32 trainerId, const u8 *name);
bool32 NameIsNotEmpty(const u8 *name); bool32 NameIsNotEmpty(const u8 *name);
void RecordMixTrainerNames(void); void RecordMixTrainerNames(void);
bool32 sub_800E540(u16 id, u8 *name);
void WipeTrainerNameRecords(void); void WipeTrainerNameRecords(void);
#endif //GUARD_LINK_RFU_H #endif //GUARD_LINK_RFU_H

View File

@ -79,7 +79,7 @@ void sub_8198DBC(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 itemCount, u
u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos); u8 sub_8199944(u8 windowId, u8 optionWidth, u8 columns, u8 rows, u8 initialCursorPos);
u8 sub_8199134(s8, s8); u8 sub_8199134(s8, s8);
u8 GetStartMenuWindowId(void); u8 GetStartMenuWindowId(void);
void sub_819A2BC(u8, u8); void ListMenuLoadStdPalAt(u8, u8);
u8 Menu_MoveCursor(s8 cursorDelta); u8 Menu_MoveCursor(s8 cursorDelta);
u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta); u8 Menu_MoveCursorNoWrapAround(s8 cursorDelta);
void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram); void DrawStdWindowFrame(u8 windowId, bool8 CopyToVram);

View File

@ -57,7 +57,7 @@ u32 sub_801B708(const u16 *a0, const struct MEventStruct_Unk1442CC *a1, const vo
bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1); bool32 MEventStruct_Unk1442CC_CompareField_unk_16(const struct MEventStruct_Unk1442CC *a0, const u16 *a1);
u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command); u16 MEventStruct_Unk1442CC_GetValueNFrom_unk_20(const struct MEventStruct_Unk1442CC *a0, u32 command);
u16 mevent_081445C0(u32 command); u16 mevent_081445C0(u32 command);
void sub_801B940(void); void ResetReceivedWonderCardFlag(void);
bool32 sub_801B94C(u16 a0); bool32 MEventHandleReceivedWonderCard(u16 a0);
#endif //GUARD_MEVENT_H #endif //GUARD_MEVENT_H

View File

@ -12,5 +12,7 @@ bool32 MG_PrintTextOnWindow1AndWaitButton(u8 *textState, const u8 *str);
void AddTextPrinterToWindow1(const u8 *src); void AddTextPrinterToWindow1(const u8 *src);
void c2_ereader(void); void c2_ereader(void);
void c2_mystery_gift(void); void c2_mystery_gift(void);
void MG_DrawTextBorder(u8 windowId);
s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u16 *windowId, bool8 yesNoBoxPlacement, const u8 *str);
#endif //GUARD_MYSTERY_GIFT_H #endif //GUARD_MYSTERY_GIFT_H

View File

@ -3,7 +3,7 @@
#include "main.h" #include "main.h"
void sub_802A9A8(u16 monId, MainCallback callback); void StartPokemonJump(u16 monId, MainCallback callback);
bool32 IsSpeciesAllowedInPokemonJump(u16 species); bool32 IsSpeciesAllowedInPokemonJump(u16 species);
void IsPokemonJumpSpeciesInParty(void); void IsPokemonJumpSpeciesInParty(void);
void ResetPokeJumpResults(void); void ResetPokeJumpResults(void);

View File

@ -5,23 +5,23 @@
// Exported type declarations // Exported type declarations
struct UnkStruct_Shared struct WirelessGnameUnamePair
{ {
struct GFtgtGname field_0; struct GFtgtGname gname;
u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1];
}; };
struct UnkStruct_x1C struct UnkStruct_x1C // WirelessLink_Member?
{ {
struct UnkStruct_Shared unk0; struct WirelessGnameUnamePair gname_uname;
u8 unk18:1; u8 active:1;
}; };
struct UnkStruct_x20 struct UnkStruct_x20 // WirelessLink_Member?
{ {
struct UnkStruct_Shared unk; struct WirelessGnameUnamePair gname_uname;
u16 field_18; u16 field_18;
u8 field_1A_0:2; u8 groupScheduledAnim:2;
u8 field_1A_1:1; u8 field_1A_1:1;
u8 field_1B; u8 field_1B;
u8 field_1D; u8 field_1D;
@ -44,29 +44,28 @@ struct UnkStruct_Main8
struct UnkStruct_x20 arr[5]; struct UnkStruct_x20 arr[5];
}; };
struct UnkStruct_Leader struct WirelessLink_Leader
{ {
struct UnkStruct_Main0 *field_0; struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4; struct UnkStruct_Main4 *field_4;
struct UnkStruct_Main8 *field_8; struct UnkStruct_Main8 *field_8;
u8 state; u8 state;
u8 textState; u8 textState;
u8 field_E; u8 delayTimerAfterOk;
u8 listWindowId; u8 listWindowId;
u8 field_10; u8 bButtonCancelWindowId;
u8 field_11; u8 nPlayerModeWindowId;
u8 listTaskId; u8 listTaskId;
u8 field_13; u8 playerCount;
u8 field_14; u16 field_14;
u8 field_15;
u8 field_16; u8 field_16;
u8 field_17; u8 listenTaskId;
u8 field_18; u8 activity;
u8 field_19; u8 field_19;
u16 field_1A; u16 field_1A;
}; };
struct UnkStruct_Group struct WirelessLink_Group
{ {
struct UnkStruct_Main0 *field_0; struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4; struct UnkStruct_Main4 *field_4;
@ -74,16 +73,16 @@ struct UnkStruct_Group
u8 textState; u8 textState;
u8 field_A; u8 field_A;
u8 listWindowId; u8 listWindowId;
u8 field_C; u8 bButtonCancelWindowId;
u8 field_D; u8 playerNameAndIdWindowId;
u8 listTaskId; u8 listTaskId;
u8 field_F; u8 leaderId;
u8 field_10; u8 field_10;
u8 field_11; u8 listenTaskId;
u8 field_12; u8 isWonderNews;
u8 field_13; u8 field_13;
u8 field_14; u8 refreshTimer;
u8 field_15; u8 delayBeforePrint;
}; };
struct UnkStruct_8019BA8 struct UnkStruct_8019BA8
@ -94,7 +93,7 @@ struct UnkStruct_8019BA8
u8 field_3; u8 field_3;
}; };
struct UnkStruct_URoom struct WirelessLink_URoom
{ {
struct UnkStruct_Main0 *field_0; struct UnkStruct_Main0 *field_0;
struct UnkStruct_Main4 *field_4; struct UnkStruct_Main4 *field_4;
@ -109,30 +108,30 @@ struct UnkStruct_URoom
u8 field_18; u8 field_18;
u8 field_19; u8 field_19;
u8 field_1A; u8 field_1A;
u8 field_1B; u8 topListMenuWindowId;
u8 field_1C; u8 topListMenuId;
u8 field_1D; u8 tradeBoardSelectWindowId;
u8 field_1E; u8 tradeBoardDetailsWindowId;
u8 field_1F; u8 field_1F;
u8 field_20; u8 field_20;
u8 spriteIds[40]; u8 spriteIds[40];
u8 field_49; u8 field_49;
u8 field_4A; u8 field_4A;
u16 field_4C[6]; u16 playerSendBuffer[6];
u8 field_58[0x98 - 0x58]; u8 activityRequestStrbufs[4][16];
u16 field_98; u16 partnerYesNoResponse;
u16 field_9A[3]; u16 recvActivityRequest[3];
struct UnkStruct_8019BA8 field_A0[8]; struct UnkStruct_8019BA8 field_A0[8];
u8 field_C0[12][15]; u8 field_C0[12][15];
u8 field_174[48]; u8 field_174[48];
u8 field_1A4[200]; u8 field_1A4[200];
}; };
union UnkUnion_Main union WirelessLink_Main
{ {
struct UnkStruct_Leader *leader; struct WirelessLink_Leader *leader;
struct UnkStruct_Group *group; struct WirelessLink_Group *group;
struct UnkStruct_URoom *uRoom; struct WirelessLink_URoom *uRoom;
}; };
struct UnionRoomTrade struct UnionRoomTrade
@ -152,20 +151,22 @@ struct UnionRoomTrade
// Exported RAM declarations // Exported RAM declarations
extern u8 gUnknown_02022C2C; extern u8 gPlayerCurrActivity;
extern union UnkUnion_Main gUnknown_02022C30; extern union WirelessLink_Main gUnknown_02022C30;
extern struct GFtgtGnameSub gUnknown_02022C38; extern struct GFtgtGnameSub gPartnerTgtGnameSub;
extern u16 gUnionRoomOfferedSpecies; extern u16 gUnionRoomOfferedSpecies;
extern u8 gUnionRoomRequestedMonType; extern u8 gUnionRoomRequestedMonType;
// Exported ROM declarations // Exported ROM declarations
u8 sub_8013F78(void); u8 CreateTask_ReturnFromLinkTrade(void);
void nullsub_89(u8 taskId); void nullsub_89(u8 taskId);
void var_800D_set_xB(void); void var_800D_set_xB(void);
void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0); void MEvent_CreateTask_CardOrNewsWithFriend(u32 arg0);
void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0); void MEvent_CreateTask_CardOrNewsOverWireless(u32 arg0);
void MEvent_CreateTask_Leader(u32 arg0); void MEvent_CreateTask_Leader(u32 arg0);
u8 CreateTask_ListenToWireless(void);
void StartUnionRoomBattle(u16 battleFlags);
#endif //GUARD_UNION_ROOM_H #endif //GUARD_UNION_ROOM_H

View File

@ -1,7 +1,6 @@
#ifndef GUARD_UNION_ROOM_BATTLE_H #ifndef GUARD_UNION_ROOM_BATTLE_H
#define GUARD_UNION_ROOM_BATTLE_H #define GUARD_UNION_ROOM_BATTLE_H
u8 sub_8013C40(void); void CB2_UnionRoomBattle(void);
void sub_8014210(u16 battleFlags);
#endif //GUARD_UNION_ROOM_BATTLE_H #endif //GUARD_UNION_ROOM_BATTLE_H

View File

@ -12,7 +12,7 @@ enum
#define UNION_ROOM_KB_ROW_COUNT 10 #define UNION_ROOM_KB_ROW_COUNT 10
void sub_801DD98(void); void EnterUnionRoomChat(void);
void copy_strings_to_sav1(void); void copy_strings_to_sav1(void);
#endif // GUARD_UNION_ROOM_CHAT_H #endif // GUARD_UNION_ROOM_CHAT_H

View File

@ -3,12 +3,12 @@
u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr); u8 sub_8019BA8(struct UnkStruct_8019BA8 * ptr);
void sub_8019E3C(void); void sub_8019E3C(void);
void sub_8019E70(u8 *arg0, s32 arg1); void CreateGroupMemberObjectsInvisible(u8 *arg0, s32 arg1);
void sub_8019F04(u8 *spriteIds); void DestroyGroupMemberObjects(u8 *spriteIds);
void sub_8019F2C(void); void sub_8019F2C(void);
void sub_801A274(struct UnkStruct_URoom *arg0); void ScheduleUnionRoomPlayerRefresh(struct WirelessLink_URoom *arg0);
void sub_801A284(struct UnkStruct_URoom *arg0); void HandleUnionRoomPlayerRefresh(struct WirelessLink_URoom *arg0);
bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3); bool32 RfuUnionTool_GetGroupAndMemberInFrontOfPlayer(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3);
void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2); void UpdateUnionGroupMemberFacing(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2);
#endif //GUARD_UNION_ROOM_PLAYER_AVATAR_H #endif //GUARD_UNION_ROOM_PLAYER_AVATAR_H

View File

@ -33,7 +33,7 @@ void HandleLinkBattleSetup(void)
if (gBattleTypeFlags & BATTLE_TYPE_LINK) if (gBattleTypeFlags & BATTLE_TYPE_LINK)
{ {
if (gWirelessCommType) if (gWirelessCommType)
sub_800B488(); SetWirelessCommType1();
if (!gReceivedRemoteLinkPlayers) if (!gReceivedRemoteLinkPlayers)
OpenLink(); OpenLink();
CreateTask(task00_08081A90, 0); CreateTask(task00_08081A90, 0);

View File

@ -832,7 +832,7 @@ u32 sub_8020C0C(MainCallback callback)
return 0; return 0;
} }
void sub_8020C70(MainCallback callback) void StartBerryCrush(MainCallback callback)
{ {
u8 playerCount = 0; u8 playerCount = 0;
u8 multiplayerId; u8 multiplayerId;

View File

@ -849,7 +849,7 @@ static void sub_80B32B4(u8 taskId)
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
gTrainerBattleOpponent_A = 0x800; gTrainerBattleOpponent_A = 0x800;
SetMainCallback2(CB2_InitBattle); SetMainCallback2(CB2_InitBattle);
gMain.savedCallback = sub_80B360C; gMain.savedCallback = CB2_ReturnFromCableClubBattle;
DestroyTask(taskId); DestroyTask(taskId);
break; break;
} }
@ -915,7 +915,7 @@ static void sub_80B33BC(u8 taskId)
CleanupOverworldWindowsAndTilemaps(); CleanupOverworldWindowsAndTilemaps();
gTrainerBattleOpponent_A = 0x800; gTrainerBattleOpponent_A = 0x800;
SetMainCallback2(CB2_InitBattle); SetMainCallback2(CB2_InitBattle);
gMain.savedCallback = sub_80B360C; gMain.savedCallback = CB2_ReturnFromCableClubBattle;
DestroyTask(taskId); DestroyTask(taskId);
break; break;
} }
@ -965,7 +965,7 @@ static void sub_80B3554(void)
RunTasks(); RunTasks();
} }
void sub_80B360C(void) void CB2_ReturnFromCableClubBattle(void)
{ {
gBattleTypeFlags &= ~BATTLE_TYPE_20; gBattleTypeFlags &= ~BATTLE_TYPE_20;
Overworld_ResetMapMusic(); Overworld_ResetMapMusic();
@ -1129,7 +1129,7 @@ static void sub_80B3894(u8 taskId)
case 3: case 3:
if (IsLinkTaskFinished()) if (IsLinkTaskFinished())
{ {
sub_8013F78(); CreateTask_ReturnFromLinkTrade();
DestroyTask(taskId); DestroyTask(taskId);
} }
break; break;

View File

@ -50,27 +50,36 @@ const u8 sText_4PlayerMode[] = _("4-PLAYER\nMODE");
const u8 sText_5PlayerMode[] = _("5-PLAYER\nMODE"); const u8 sText_5PlayerMode[] = _("5-PLAYER\nMODE");
static const u8 *const sPlayersNeededOrModeTexts[][5] = { static const u8 *const sPlayersNeededOrModeTexts[][5] = {
// 2 players required
{ {
sText_1PlayerNeeded, sText_1PlayerNeeded,
sText_2PlayerMode sText_2PlayerMode
}, { },
// 4 players required
{
sText_3PlayersNeeded, sText_3PlayersNeeded,
sText_2PlayersNeeded, sText_2PlayersNeeded,
sText_1PlayerNeeded, sText_1PlayerNeeded,
sText_4PlayerMode sText_4PlayerMode
}, { },
// 2-5 players required
{
sText_1PlayerNeeded, sText_1PlayerNeeded,
sText_2PlayerMode, sText_2PlayerMode,
sText_3PlayerMode, sText_3PlayerMode,
sText_4PlayerMode, sText_4PlayerMode,
sText_5PlayerMode sText_5PlayerMode
}, { },
// 3-5 players required
{
sText_2PlayersNeeded, sText_2PlayersNeeded,
sText_1PlayerNeeded, sText_1PlayerNeeded,
sText_3PlayerMode, sText_3PlayerMode,
sText_4PlayerMode, sText_4PlayerMode,
sText_5PlayerMode sText_5PlayerMode
}, { },
// 2-4 players required
{
sText_1PlayerNeeded, sText_1PlayerNeeded,
sText_2PlayerMode, sText_2PlayerMode,
sText_3PlayerMode, sText_3PlayerMode,
@ -484,8 +493,8 @@ static const u8 *const sChooseTrainerTexts[NUM_LINK_GROUP_TYPES] =
[LINK_GROUP_BERRY_PICKING] = sText_ChooseLeaderBerryPicking, [LINK_GROUP_BERRY_PICKING] = sText_ChooseLeaderBerryPicking,
[LINK_GROUP_WONDER_CARD] = sText_ChooseTrainerToShareWonderCards, [LINK_GROUP_WONDER_CARD] = sText_ChooseTrainerToShareWonderCards,
[LINK_GROUP_WONDER_NEWS] = sText_ChooseTrainerToShareWonderNews, [LINK_GROUP_WONDER_NEWS] = sText_ChooseTrainerToShareWonderNews,
[LINK_GROUP_UNK_9] = NULL, [LINK_GROUP_UNION_ROOM_RESUME] = NULL,
[LINK_GROUP_UNK_10] = NULL, [LINK_GROUP_UNION_ROOM_INIT] = NULL,
[LINK_GROUP_UNK_11] = NULL, [LINK_GROUP_UNK_11] = NULL,
[LINK_GROUP_RECORD_CORNER] = sText_ChooseLeaderRecordCorner, [LINK_GROUP_RECORD_CORNER] = sText_ChooseLeaderRecordCorner,
[LINK_GROUP_BERRY_BLENDER] = sText_ChooseLeaderBerryBlender, [LINK_GROUP_BERRY_BLENDER] = sText_ChooseLeaderBerryBlender,
@ -599,7 +608,7 @@ const u8 *const sLinkGroupActivityTexts[] = {
sText_BattleTowerLv50 sText_BattleTowerLv50
}; };
const struct WindowTemplate gUnknown_082F00BC = { static const struct WindowTemplate sWindowTemplate_BButtonCancel = {
.bg = 0x00, .bg = 0x00,
.tilemapLeft = 0x00, .tilemapLeft = 0x00,
.tilemapTop = 0x00, .tilemapTop = 0x00,
@ -609,29 +618,33 @@ const struct WindowTemplate gUnknown_082F00BC = {
.baseBlock = 0x0008 .baseBlock = 0x0008
}; };
const u32 gUnknown_082F00C4[NUM_LINK_GROUP_TYPES] = { // Minimum and maximum number of players for a link group
0x0201, // A minimum of 0 means the min and max are equal
0x0202, #define LINK_GROUP_CAPACITY(min, max)(((min) << 12) | ((max) << 8))
0x0403,
0x0204, static const u32 sLinkGroupToActivityAndCapacity[NUM_LINK_GROUP_TYPES] = {
0x2509, [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE | LINK_GROUP_CAPACITY(0, 2),
0x250a, [LINK_GROUP_DOUBLE_BATTLE] = ACTIVITY_BATTLE_DOUBLE | LINK_GROUP_CAPACITY(0, 2),
0x350b, [LINK_GROUP_MULTI_BATTLE] = ACTIVITY_BATTLE_MULTI | LINK_GROUP_CAPACITY(0, 4),
0x0000, [LINK_GROUP_TRADE] = ACTIVITY_TRADE | LINK_GROUP_CAPACITY(0, 2),
0x0000, [LINK_GROUP_POKEMON_JUMP] = ACTIVITY_POKEMON_JUMP | LINK_GROUP_CAPACITY(2, 5),
0x0000, [LINK_GROUP_BERRY_CRUSH] = ACTIVITY_BERRY_CRUSH | LINK_GROUP_CAPACITY(2, 5),
0x0000, [LINK_GROUP_BERRY_PICKING] = ACTIVITY_BERRY_PICK | LINK_GROUP_CAPACITY(3, 5),
0x0000, [LINK_GROUP_WONDER_CARD] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x240f, [LINK_GROUP_WONDER_NEWS] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x2410, [LINK_GROUP_UNION_ROOM_RESUME] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x0000, [LINK_GROUP_UNION_ROOM_INIT] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x2417, [LINK_GROUP_UNK_11] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x2418, [LINK_GROUP_RECORD_CORNER] = ACTIVITY_RECORD_CORNER | LINK_GROUP_CAPACITY(2, 4),
0x2419, [LINK_GROUP_BERRY_BLENDER] = ACTIVITY_BERRY_BLENDER | LINK_GROUP_CAPACITY(2, 4),
0x241a, [LINK_GROUP_UNK_14] = ACTIVITY_NONE | LINK_GROUP_CAPACITY(0, 0),
0x241b, [LINK_GROUP_COOL_CONTEST] = ACTIVITY_CONTEST_COOL | LINK_GROUP_CAPACITY(2, 4),
0x021c, [LINK_GROUP_BEAUTY_CONTEST] = ACTIVITY_CONTEST_BEAUTY | LINK_GROUP_CAPACITY(2, 4),
0x020e [LINK_GROUP_CUTE_CONTEST] = ACTIVITY_CONTEST_CUTE | LINK_GROUP_CAPACITY(2, 4),
[LINK_GROUP_SMART_CONTEST] = ACTIVITY_CONTEST_SMART | LINK_GROUP_CAPACITY(2, 4),
[LINK_GROUP_TOUGH_CONTEST] = ACTIVITY_CONTEST_TOUGH | LINK_GROUP_CAPACITY(2, 4),
[LINK_GROUP_BATTLE_TOWER] = ACTIVITY_BATTLE_TOWER | LINK_GROUP_CAPACITY(0, 2),
[LINK_GROUP_BATTLE_TOWER_OPEN] = ACTIVITY_BATTLE_TOWER_OPEN | LINK_GROUP_CAPACITY(0, 2)
}; };
const struct WindowTemplate gUnknown_082F011C = { const struct WindowTemplate gUnknown_082F011C = {
@ -654,7 +667,7 @@ const struct WindowTemplate gUnknown_082F0124 = {
.baseBlock = 0x0044 .baseBlock = 0x0044
}; };
const struct WindowTemplate gUnknown_082F012C = { static const struct WindowTemplate sWindowTemplate_NumPlayerMode = {
.bg = 0x00, .bg = 0x00,
.tilemapLeft = 0x10, .tilemapLeft = 0x10,
.tilemapTop = 0x03, .tilemapTop = 0x03,
@ -672,11 +685,11 @@ const struct ListMenuItem gUnknown_082F0134[] = {
{ sText_EmptyString, 4 } { sText_EmptyString, 4 }
}; };
const struct ListMenuTemplate gUnknown_082F015C = { static const struct ListMenuTemplate sListMenuTemplate_PossibleGroupMembers = {
.items = gUnknown_082F0134, .items = gUnknown_082F0134,
.moveCursorFunc = NULL, .moveCursorFunc = NULL,
.itemPrintFunc = sub_8013278, .itemPrintFunc = ItemPrintFunc_PossibleGroupMembers,
.totalItems = 5, .totalItems = ARRAY_COUNT(gUnknown_082F0134),
.maxShowed = 5, .maxShowed = 5,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -732,11 +745,11 @@ const struct ListMenuItem gUnknown_082F0184[] = {
{ sText_EmptyString, 15 } { sText_EmptyString, 15 }
}; };
const struct ListMenuTemplate gUnknown_082F0204 = { static const struct ListMenuTemplate sListMenuTemplate_UnionRoomGroups = {
.items = gUnknown_082F0184, .items = gUnknown_082F0184,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = sub_8013DF4, .itemPrintFunc = ListMenuItemPrintFunc_UnionRoomGroups,
.totalItems = 16, .totalItems = ARRAY_COUNT(gUnknown_082F0184),
.maxShowed = 5, .maxShowed = 5,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -753,7 +766,7 @@ const struct ListMenuTemplate gUnknown_082F0204 = {
.cursorKind = 0 .cursorKind = 0
}; };
const struct WindowTemplate gUnknown_082F021C = { static const struct WindowTemplate sWindowTemplate_InviteToActivity = {
.bg = 0x00, .bg = 0x00,
.tilemapLeft = 0x14, .tilemapLeft = 0x14,
.tilemapTop = 0x05, .tilemapTop = 0x05,
@ -770,11 +783,11 @@ const struct ListMenuItem gUnknown_082F0224[] = {
{ sText_Exit, 0x040 } { sText_Exit, 0x040 }
}; };
const struct ListMenuTemplate gUnknown_082F0244 = { static const struct ListMenuTemplate sListMenuTemplate_InviteToActivity = {
.items = gUnknown_082F0224, .items = gUnknown_082F0224,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 4, .totalItems = ARRAY_COUNT(gUnknown_082F0224),
.maxShowed = 4, .maxShowed = 4,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -811,7 +824,7 @@ const struct ListMenuTemplate gUnknown_082F027C = {
.items = gUnknown_082F0264, .items = gUnknown_082F0264,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = 3, .totalItems = ARRAY_COUNT(gUnknown_082F0264),
.maxShowed = 3, .maxShowed = 3,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -838,7 +851,7 @@ const struct WindowTemplate gUnknown_082F0294 = {
.baseBlock = 0x0001 .baseBlock = 0x0001
}; };
static const struct ListMenuItem sTradingBoardTypes[] = { static const struct ListMenuItem sTradingBoardTypes[NUMBER_OF_MON_TYPES] = {
{ gTypeNames[TYPE_NORMAL], TYPE_NORMAL }, { gTypeNames[TYPE_NORMAL], TYPE_NORMAL },
{ gTypeNames[TYPE_FIRE], TYPE_FIRE }, { gTypeNames[TYPE_FIRE], TYPE_FIRE },
{ gTypeNames[TYPE_WATER], TYPE_WATER }, { gTypeNames[TYPE_WATER], TYPE_WATER },
@ -856,14 +869,14 @@ static const struct ListMenuItem sTradingBoardTypes[] = {
{ gTypeNames[TYPE_DRAGON], TYPE_DRAGON }, { gTypeNames[TYPE_DRAGON], TYPE_DRAGON },
{ gTypeNames[TYPE_STEEL], TYPE_STEEL }, { gTypeNames[TYPE_STEEL], TYPE_STEEL },
{ gTypeNames[TYPE_DARK], TYPE_DARK }, { gTypeNames[TYPE_DARK], TYPE_DARK },
{ sText_Exit, NUMBER_OF_MON_TYPES } { sText_Exit, NUMBER_OF_MON_TYPES }
}; };
const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = { const struct ListMenuTemplate sMenuTemplate_TradingBoardRequestType = {
.items = sTradingBoardTypes, .items = sTradingBoardTypes,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = NULL, .itemPrintFunc = NULL,
.totalItems = NUMBER_OF_MON_TYPES, .totalItems = ARRAY_COUNT(sTradingBoardTypes),
.maxShowed = 6, .maxShowed = 6,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -900,7 +913,7 @@ const struct WindowTemplate gUnknown_082F034C = {
.baseBlock = 0x0039 .baseBlock = 0x0039
}; };
const struct ListMenuItem gUnknown_082F0354[] = { static const struct ListMenuItem sTradeBoardListMenuItems[] = {
{ sText_EmptyString, -3 }, { sText_EmptyString, -3 },
{ sText_EmptyString, 0 }, { sText_EmptyString, 0 },
{ sText_EmptyString, 1 }, { sText_EmptyString, 1 },
@ -913,11 +926,11 @@ const struct ListMenuItem gUnknown_082F0354[] = {
{ sText_Exit2, 8 } { sText_Exit2, 8 }
}; };
const struct ListMenuTemplate gUnknown_082F03A4 = { static const struct ListMenuTemplate sTradeBoardListMenuTemplate = {
.items = gUnknown_082F0354, .items = sTradeBoardListMenuItems,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = sub_8017BE8, .itemPrintFunc = TradeBoardListMenuItemPrintFunc,
.totalItems = 10, .totalItems = ARRAY_COUNT(sTradeBoardListMenuItems),
.maxShowed = 6, .maxShowed = 6,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -944,7 +957,7 @@ const struct WindowTemplate UnrefWindowTemplate_082F03B4 = {
.baseBlock = 0x0039 .baseBlock = 0x0039
}; };
const struct ListMenuItem gUnknown_082F03C4[] = { static const struct ListMenuItem sEmptyListMenuItems[] = {
{ sText_EmptyString, 0 }, { sText_EmptyString, 0 },
{ sText_EmptyString, 1 }, { sText_EmptyString, 1 },
{ sText_EmptyString, 2 }, { sText_EmptyString, 2 },
@ -963,11 +976,12 @@ const struct ListMenuItem gUnknown_082F03C4[] = {
{ sText_EmptyString, 15 } { sText_EmptyString, 15 }
}; };
const struct ListMenuTemplate UnrefListMenuTemplate_082F0444 = { // Unused
.items = gUnknown_082F03C4, static const struct ListMenuTemplate sUnknownListMenuTemplate = {
.items = sEmptyListMenuItems,
.moveCursorFunc = ListMenuDefaultCursorMoveFunc, .moveCursorFunc = ListMenuDefaultCursorMoveFunc,
.itemPrintFunc = nullsub_14, .itemPrintFunc = nullsub_14,
.totalItems = 16, .totalItems = ARRAY_COUNT(sEmptyListMenuItems),
.maxShowed = 4, .maxShowed = 4,
.windowId = 0, .windowId = 0,
.header_X = 0, .header_X = 0,
@ -984,78 +998,100 @@ const struct ListMenuTemplate UnrefListMenuTemplate_082F0444 = {
.cursorKind = 0 .cursorKind = 0
}; };
const struct UnkStruct_Shared gUnknown_082F045C = {0}; const struct WirelessGnameUnamePair sWirelessGnameUnamePair_Dummy = {0};
ALIGNED(4) const u8 gUnknown_082F0474[] = {0x01, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_SingleBattle[] = {ACTIVITY_BATTLE_SINGLE, 0xff};
ALIGNED(4) const u8 gUnknown_082F0478[] = {0x02, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_DoubleBattle[] = {ACTIVITY_BATTLE_DOUBLE, 0xff};
ALIGNED(4) const u8 gUnknown_082F047C[] = {0x03, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_MultiBattle[] = {ACTIVITY_BATTLE_MULTI, 0xff};
ALIGNED(4) const u8 gUnknown_082F0480[] = {0x04, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_Trade[] = {ACTIVITY_TRADE, 0xff};
ALIGNED(4) const u8 gUnknown_082F0484[] = {0x09, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_PokemonJump[] = {ACTIVITY_POKEMON_JUMP, 0xff};
ALIGNED(4) const u8 gUnknown_082F0488[] = {0x0a, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_BerryCrush[] = {ACTIVITY_BERRY_CRUSH, 0xff};
ALIGNED(4) const u8 gUnknown_082F048C[] = {0x0b, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_BerryPicking[] = {ACTIVITY_BERRY_PICK, 0xff};
ALIGNED(4) const u8 gUnknown_082F0490[] = {0x15, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_WonderCard[] = {ACTIVITY_WONDER_CARD2, 0xff};
ALIGNED(4) const u8 gUnknown_082F0494[] = {0x16, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_WonderNews[] = {ACTIVITY_WONDER_NEWS2, 0xff};
ALIGNED(4) const u8 gUnknown_082F0498[] = {0x40, 0x41, 0x44, 0x45, 0x48, 0x51, 0x52, 0x53, 0x54, 0xff}; ALIGNED(4) const u8 sAcceptedActivityIds_Resume[] = {
ALIGNED(4) const u8 gUnknown_082F04A4[] = {0x0c, 0xff}; IN_UNION_ROOM | ACTIVITY_NONE,
ALIGNED(4) const u8 gUnknown_082F04A8[] = {0x01, 0x02, 0x03, 0x04, 0x09, 0x0a, 0x0b, 0x15, 0x16, 0x0d, 0xff}; IN_UNION_ROOM | ACTIVITY_BATTLE_SINGLE,
ALIGNED(4) const u8 gUnknown_082F04B4[] = {0x0f, 0xff}; IN_UNION_ROOM | ACTIVITY_TRADE,
ALIGNED(4) const u8 gUnknown_082F04B8[] = {0x10, 0xff}; IN_UNION_ROOM | ACTIVITY_CHAT,
ALIGNED(4) const u8 gUnknown_082F04BC[] = {0x17, 0xff}; IN_UNION_ROOM | ACTIVITY_CARD,
ALIGNED(4) const u8 gUnknown_082F04C0[] = {0x18, 0xff}; IN_UNION_ROOM | ACTIVITY_ACCEPT,
ALIGNED(4) const u8 gUnknown_082F04C4[] = {0x19, 0xff}; IN_UNION_ROOM | ACTIVITY_DECLINE,
ALIGNED(4) const u8 gUnknown_082F04C8[] = {0x1a, 0xff}; IN_UNION_ROOM | ACTIVITY_NPCTALK,
ALIGNED(4) const u8 gUnknown_082F04CC[] = {0x1b, 0xff}; IN_UNION_ROOM | ACTIVITY_PLYRTALK,
ALIGNED(4) const u8 gUnknown_082F04D0[] = {0x1c, 0xff}; 0xff
ALIGNED(4) const u8 gUnknown_082F04D4[] = {0x0e, 0xff}; };
ALIGNED(4) const u8 sAcceptedActivityIds_Init[] = {ACTIVITY_SEARCH, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_Unk11[] = {
ACTIVITY_BATTLE_SINGLE,
ACTIVITY_BATTLE_DOUBLE,
ACTIVITY_BATTLE_MULTI,
ACTIVITY_TRADE,
ACTIVITY_POKEMON_JUMP,
ACTIVITY_BERRY_CRUSH,
ACTIVITY_BERRY_PICK,
ACTIVITY_WONDER_CARD2,
ACTIVITY_WONDER_NEWS2,
ACTIVITY_SPIN_TRADE,
0xff
};
ALIGNED(4) const u8 sAcceptedActivityIds_RecordCorner[] = {ACTIVITY_RECORD_CORNER, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_BerryBlender[] = {ACTIVITY_BERRY_BLENDER, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_CoolContest[] = {ACTIVITY_CONTEST_COOL, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_BeautyContest[] = {ACTIVITY_CONTEST_BEAUTY, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_CuteContest[] = {ACTIVITY_CONTEST_CUTE, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_SmartContest[] = {ACTIVITY_CONTEST_SMART, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_ToughContest[] = {ACTIVITY_CONTEST_TOUGH, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_BattleTower[] = {ACTIVITY_BATTLE_TOWER, 0xff};
ALIGNED(4) const u8 sAcceptedActivityIds_BattleTowerOpen[] = {ACTIVITY_BATTLE_TOWER_OPEN, 0xff};
const u8 *const gUnknown_082F04D8[NUM_LINK_GROUP_TYPES] = { const u8 *const sAcceptedActivityIds[NUM_LINK_GROUP_TYPES] = {
gUnknown_082F0474, [LINK_GROUP_SINGLE_BATTLE] = sAcceptedActivityIds_SingleBattle,
gUnknown_082F0478, [LINK_GROUP_DOUBLE_BATTLE] = sAcceptedActivityIds_DoubleBattle,
gUnknown_082F047C, [LINK_GROUP_MULTI_BATTLE] = sAcceptedActivityIds_MultiBattle,
gUnknown_082F0480, [LINK_GROUP_TRADE] = sAcceptedActivityIds_Trade,
gUnknown_082F0484, [LINK_GROUP_POKEMON_JUMP] = sAcceptedActivityIds_PokemonJump,
gUnknown_082F0488, [LINK_GROUP_BERRY_CRUSH] = sAcceptedActivityIds_BerryCrush,
gUnknown_082F048C, [LINK_GROUP_BERRY_PICKING] = sAcceptedActivityIds_BerryPicking,
gUnknown_082F0490, [LINK_GROUP_WONDER_CARD] = sAcceptedActivityIds_WonderCard,
gUnknown_082F0494, [LINK_GROUP_WONDER_NEWS] = sAcceptedActivityIds_WonderNews,
gUnknown_082F0498, [LINK_GROUP_UNION_ROOM_RESUME] = sAcceptedActivityIds_Resume,
gUnknown_082F04A4, [LINK_GROUP_UNION_ROOM_INIT] = sAcceptedActivityIds_Init,
gUnknown_082F04A8, [LINK_GROUP_UNK_11] = sAcceptedActivityIds_Unk11,
gUnknown_082F04B4, [LINK_GROUP_RECORD_CORNER] = sAcceptedActivityIds_RecordCorner,
gUnknown_082F04B8, [LINK_GROUP_BERRY_BLENDER] = sAcceptedActivityIds_BerryBlender,
NULL, [LINK_GROUP_UNK_14] = NULL,
gUnknown_082F04BC, [LINK_GROUP_COOL_CONTEST] = sAcceptedActivityIds_CoolContest,
gUnknown_082F04C0, [LINK_GROUP_BEAUTY_CONTEST] = sAcceptedActivityIds_BeautyContest,
gUnknown_082F04C4, [LINK_GROUP_CUTE_CONTEST] = sAcceptedActivityIds_CuteContest,
gUnknown_082F04C8, [LINK_GROUP_SMART_CONTEST] = sAcceptedActivityIds_SmartContest,
gUnknown_082F04CC, [LINK_GROUP_TOUGH_CONTEST] = sAcceptedActivityIds_ToughContest,
gUnknown_082F04D0, [LINK_GROUP_BATTLE_TOWER] = sAcceptedActivityIds_BattleTower,
gUnknown_082F04D4 [LINK_GROUP_BATTLE_TOWER_OPEN] = sAcceptedActivityIds_BattleTowerOpen
}; };
// Link group type to ID for gUnknown_02022C2C static const u8 sLinkGroupToURoomActivity[NUM_LINK_GROUP_TYPES + 2] =
const u8 gUnknown_082F0530[NUM_LINK_GROUP_TYPES + 2] =
{ {
0x01, [LINK_GROUP_SINGLE_BATTLE] = ACTIVITY_BATTLE_SINGLE,
0x02, [LINK_GROUP_DOUBLE_BATTLE] = ACTIVITY_BATTLE_DOUBLE,
0x03, [LINK_GROUP_MULTI_BATTLE] = ACTIVITY_BATTLE_MULTI,
0x04, [LINK_GROUP_TRADE] = ACTIVITY_TRADE,
0x09, [LINK_GROUP_POKEMON_JUMP] = ACTIVITY_POKEMON_JUMP,
0x0a, [LINK_GROUP_BERRY_CRUSH] = ACTIVITY_BERRY_CRUSH,
0x0b, [LINK_GROUP_BERRY_PICKING] = ACTIVITY_BERRY_PICK,
0x15, [LINK_GROUP_WONDER_CARD] = ACTIVITY_WONDER_CARD2,
0x16, [LINK_GROUP_WONDER_NEWS] = ACTIVITY_WONDER_NEWS2,
0x00, [LINK_GROUP_UNION_ROOM_RESUME] = ACTIVITY_NONE,
0x00, [LINK_GROUP_UNION_ROOM_INIT] = ACTIVITY_NONE,
0x00, [LINK_GROUP_UNK_11] = ACTIVITY_NONE,
0x0f, [LINK_GROUP_RECORD_CORNER] = ACTIVITY_RECORD_CORNER,
0x10, [LINK_GROUP_BERRY_BLENDER] = ACTIVITY_BERRY_BLENDER,
0x00, [LINK_GROUP_UNK_14] = ACTIVITY_NONE,
0x17, [LINK_GROUP_COOL_CONTEST] = ACTIVITY_CONTEST_COOL,
0x18, [LINK_GROUP_BEAUTY_CONTEST] = ACTIVITY_CONTEST_BEAUTY,
0x19, [LINK_GROUP_CUTE_CONTEST] = ACTIVITY_CONTEST_CUTE,
0x1a, [LINK_GROUP_SMART_CONTEST] = ACTIVITY_CONTEST_SMART,
0x1b, [LINK_GROUP_TOUGH_CONTEST] = ACTIVITY_CONTEST_TOUGH,
0x1c, [LINK_GROUP_BATTLE_TOWER] = ACTIVITY_BATTLE_TOWER,
0x0e [LINK_GROUP_BATTLE_TOWER_OPEN] = ACTIVITY_BATTLE_TOWER_OPEN
}; };

View File

@ -450,7 +450,7 @@ static void (*const gUnknown_082F7AF4[])(void) =
}; };
// code // code
void sub_802493C(u16 a0, void (*callback)(void)) void StartDodrioBerryPicking(u16 a0, void (*callback)(void))
{ {
gUnknown_03000DB0 = FALSE; gUnknown_03000DB0 = FALSE;

View File

@ -96,7 +96,7 @@ void ScriptUnfreezeObjectEvents(void)
UnfreezeObjectEvents(); UnfreezeObjectEvents();
} }
void sub_8098524(void) void UnionRoom_UnlockPlayerAndChatPartner(void)
{ {
u8 playerObjectId; u8 playerObjectId;

View File

@ -2290,7 +2290,7 @@ void SetupBagMenu_Textboxes(void)
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
LoadUserWindowBorderGfx(0, 1, 0xE0); LoadUserWindowBorderGfx(0, 1, 0xE0);
LoadMessageBoxGfx(0, 10, 0xD0); LoadMessageBoxGfx(0, 10, 0xD0);
sub_819A2BC(0xC0, 1); ListMenuLoadStdPalAt(0xC0, 1);
LoadPalette(&gUnknown_0860F074, 0xF0, 0x20); LoadPalette(&gUnknown_0860F074, 0xF0, 0x20);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {

View File

@ -221,7 +221,7 @@ static const u8 sUnused_082ED224[] = {0x00, 0xff, 0xfe, 0xff, 0x00};
bool8 IsWirelessAdapterConnected(void) bool8 IsWirelessAdapterConnected(void)
{ {
sub_800B488(); SetWirelessCommType1();
sub_800E700(); sub_800E700();
if (rfu_LMAN_REQBN_softReset_and_checkID() == 0x8001) if (rfu_LMAN_REQBN_softReset_and_checkID() == 0x8001)
{ {
@ -389,7 +389,7 @@ void CloseLink(void)
gReceivedRemoteLinkPlayers = FALSE; gReceivedRemoteLinkPlayers = FALSE;
if (gWirelessCommType) if (gWirelessCommType)
{ {
sub_800EDD4(); LinkRfu_Shutdown();
} }
gLinkOpen = FALSE; gLinkOpen = FALSE;
DisableSerial(); DisableSerial();
@ -1860,7 +1860,7 @@ bool8 HandleLinkConnection(void)
return FALSE; return FALSE;
} }
void sub_800B488(void) void SetWirelessCommType1(void)
{ {
if (gReceivedRemoteLinkPlayers == 0) if (gReceivedRemoteLinkPlayers == 0)
{ {

View File

@ -375,11 +375,11 @@ void sub_800EAFC(void)
void sub_800EB44(u8 taskId) void sub_800EB44(u8 taskId)
{ {
if (sub_800F7DC()->activity == 0x54 && sub_8011A74() == 4) if (GetHostRFUtgtGname()->activity == 0x54 && RfuGetErrorStatus() == 4)
{ {
rfu_REQ_disconnect(lman.acceptSlot_flag); rfu_REQ_disconnect(lman.acceptSlot_flag);
rfu_waitREQComplete(); rfu_waitREQComplete();
sub_8011A64(0, 0); RfuSetErrorStatus(0, 0);
} }
switch (Rfu.unk_04) switch (Rfu.unk_04)
{ {
@ -421,7 +421,7 @@ void sub_800EB44(u8 taskId)
case 16: case 16:
Rfu.unk_cdb = 0; Rfu.unk_cdb = 0;
rfu_LMAN_setMSCCallback(sub_800EDBC); rfu_LMAN_setMSCCallback(sub_800EDBC);
sub_8011068(1); UpdateGameData_GroupLockedIn(TRUE);
sub_800EAB4(); sub_800EAB4();
sub_800EAFC(); sub_800EAFC();
Rfu.unk_04 = 20; Rfu.unk_04 = 20;
@ -434,12 +434,12 @@ void sub_800EB44(u8 taskId)
} }
} }
void sub_800ED10(void) void LinkRfu_CreateConnectionAsParent(void)
{ {
rfu_LMAN_establishConnection(1, 0, 240, (u16 *)gUnknown_082ED6E0); rfu_LMAN_establishConnection(1, 0, 240, (u16 *)gUnknown_082ED6E0);
} }
void sub_800ED28(void) void LinkRfu_StopManagerBeforeEnteringChat(void)
{ {
rfu_LMAN_stopManager(FALSE); rfu_LMAN_stopManager(FALSE);
} }
@ -471,7 +471,7 @@ void sub_800EDBC(u16 unused)
Rfu.unk_cdb = 1; Rfu.unk_cdb = 1;
} }
void sub_800EDD4(void) void LinkRfu_Shutdown(void)
{ {
u8 i; u8 i;
@ -538,7 +538,7 @@ void sub_800EF00(void)
Rfu.unk_67 = CreateTask(sub_800E94C, 1); Rfu.unk_67 = CreateTask(sub_800E94C, 1);
} }
bool8 sub_800EF1C(void) bool8 LmanAcceptSlotFlagIsNotZero(void)
{ {
if (lman.acceptSlot_flag) if (lman.acceptSlot_flag)
{ {
@ -547,13 +547,13 @@ bool8 sub_800EF1C(void)
return FALSE; return FALSE;
} }
void sub_800EF38(void) void LinkRfu_StopManagerAndFinalizeSlots(void)
{ {
Rfu.unk_04 = 4; Rfu.unk_04 = 4;
Rfu.unk_ce7 = lman.acceptSlot_flag; Rfu.unk_ce7 = lman.acceptSlot_flag;
} }
bool32 sub_800EF58(bool32 a0) bool32 WaitRfuState(bool32 a0)
{ {
if (Rfu.unk_04 == 17 || a0) if (Rfu.unk_04 == 17 || a0)
{ {
@ -676,13 +676,13 @@ bool32 sub_800F0F8(void)
Rfu.unk_ce3 = 0; Rfu.unk_ce3 = 0;
if (Rfu.unk_ce4 == 1) if (Rfu.unk_ce4 == 1)
{ {
sub_8011A64(2, 0x8000); RfuSetErrorStatus(2, 0x8000);
sub_8011170(0x8000); sub_8011170(0x8000);
return FALSE; return FALSE;
} }
if (!lman.acceptSlot_flag) if (!lman.acceptSlot_flag)
{ {
sub_800EDD4(); LinkRfu_Shutdown();
gReceivedRemoteLinkPlayers = 0; gReceivedRemoteLinkPlayers = 0;
return FALSE; return FALSE;
} }
@ -831,15 +831,15 @@ bool32 sub_800F4F0(void)
{ {
rfu_REQ_disconnect(gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag); rfu_REQ_disconnect(gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag);
rfu_waitREQComplete(); rfu_waitREQComplete();
switchval = sub_8011A74(); switchval = RfuGetErrorStatus();
if (switchval != 1 && switchval != 6 && switchval != 9) if (switchval != 1 && switchval != 6 && switchval != 9)
sub_8011A64(2, 0x9000); RfuSetErrorStatus(2, 0x9000);
rfu_clearAllSlot(); rfu_clearAllSlot();
gReceivedRemoteLinkPlayers = FALSE; gReceivedRemoteLinkPlayers = FALSE;
Rfu.linkRfuCallback = NULL; Rfu.linkRfuCallback = NULL;
if (Rfu.unk_ce4 == 1) if (Rfu.unk_ce4 == 1)
{ {
sub_8011A64(2, 0x9000); RfuSetErrorStatus(2, 0x9000);
sub_8011170(0x9000); sub_8011170(0x9000);
} }
lman.state = lman.next_state = 0; lman.state = lman.next_state = 0;
@ -924,7 +924,7 @@ void rfu_func_080F97B8(void)
} }
} }
struct GFtgtGname *sub_800F7DC(void) struct GFtgtGname *GetHostRFUtgtGname(void)
{ {
return &gUnknown_02022B14; return &gUnknown_02022B14;
} }
@ -1000,7 +1000,7 @@ void sub_800F86C(u8 unused)
{ {
Rfu.unk_80[i].unk_12 = 2; Rfu.unk_80[i].unk_12 = 2;
sub_800F6FC(i); sub_800F6FC(i);
if (sub_800F7DC()->activity == 0x45 && gReceivedRemoteLinkPlayers != 0 && Rfu.unk_0c == 0) if (GetHostRFUtgtGname()->activity == 0x45 && gReceivedRemoteLinkPlayers != 0 && Rfu.unk_0c == 0)
sub_8010A70(gBlockRecvBuffer); sub_8010A70(gBlockRecvBuffer);
} }
} }
@ -1164,7 +1164,7 @@ void sub_800FD14(u16 command)
void sub_800FE50(void *a0) void sub_800FE50(void *a0)
{ {
if (gSendCmd[0] == 0 && !sub_8011A80()) if (gSendCmd[0] == 0 && !RfuIsErrorStatus1or2())
{ {
memcpy(Rfu.unk_f2, a0, sizeof(Rfu.unk_f2)); memcpy(Rfu.unk_f2, a0, sizeof(Rfu.unk_f2));
sub_800FD14(0x2f00); sub_800FD14(0x2f00);
@ -1535,7 +1535,7 @@ bool32 sub_80105EC(void)
return FALSE; return FALSE;
} }
bool32 sub_801064C(u16 a0, const u8 *a1) bool32 TrainerIdAndNameStillInPartnersList(u16 a0, const u8 *a1)
{ {
u8 r1 = sub_8011CE4(a1, a0); u8 r1 = sub_8011CE4(a1, a0);
if (r1 == 0xFF) if (r1 == 0xFF)
@ -1545,7 +1545,7 @@ bool32 sub_801064C(u16 a0, const u8 *a1)
return FALSE; return FALSE;
} }
void sub_8010688(u8 a0, u16 a1, const u8 *a2) void SendByteToPartnerByIdAndName(u8 a0, u16 a1, const u8 *a2)
{ {
u8 r4 = sub_8011CE4(a2, a1); u8 r4 = sub_8011CE4(a2, a1);
Rfu.unk_cd1[r4] = a0; Rfu.unk_cd1[r4] = a0;
@ -1553,14 +1553,14 @@ void sub_8010688(u8 a0, u16 a1, const u8 *a2)
rfu_NI_setSendData(1 << r4, 8, Rfu.unk_cd1 + r4, 1); rfu_NI_setSendData(1 << r4, 8, Rfu.unk_cd1 + r4, 1);
} }
void sub_80106D4(void) void LinkRfuNIsend8(void)
{ {
Rfu.unk_c85 = 8; Rfu.unk_c85 = 8;
rfu_clearSlot(4, Rfu.unk_c3e); rfu_clearSlot(4, Rfu.unk_c3e);
rfu_NI_setSendData(1 << Rfu.unk_c3e, 8, &Rfu.unk_c85, 1); rfu_NI_setSendData(1 << Rfu.unk_c3e, 8, &Rfu.unk_c85, 1);
} }
u32 sub_8010714(u16 a0, const u8 *a1) u32 WaitSendByteToPartnerByIdAndName(u16 a0, const u8 *a1)
{ {
u8 r0 = sub_8011CE4(a1, a0); u8 r0 = sub_8011CE4(a1, a0);
if (r0 == 0xFF) if (r0 == 0xFF)
@ -1597,7 +1597,7 @@ s32 sub_80107A0(void)
if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x46 || gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x48) if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x46 || gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x48)
{ {
rfu_clearSlot(8, Rfu.unk_c3e); rfu_clearSlot(8, Rfu.unk_c3e);
sub_8011A64(Rfu.unk_c86, 0); RfuSetErrorStatus(Rfu.unk_c86, 0);
retval = Rfu.unk_c86; retval = Rfu.unk_c86;
} }
else if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x47) else if (gRfuSlotStatusNI[Rfu.unk_c3e]->recv.state == 0x47)
@ -1842,7 +1842,7 @@ void sub_8010DB4(void)
gWirelessCommType = 2; gWirelessCommType = 2;
SetMainCallback2(CB2_LinkError); SetMainCallback2(CB2_LinkError);
gMain.savedCallback = CB2_LinkError; gMain.savedCallback = CB2_LinkError;
sub_800AF18((Rfu.unk_0a << 16) | (Rfu.unk_10 << 8) | Rfu.unk_12, Rfu.unk_124.unk_8c2, Rfu.unk_9e8.unk_232, sub_8011A74() == 2); sub_800AF18((Rfu.unk_0a << 16) | (Rfu.unk_10 << 8) | Rfu.unk_12, Rfu.unk_124.unk_8c2, Rfu.unk_9e8.unk_232, RfuGetErrorStatus() == 2);
Rfu.unk_ee = 2; Rfu.unk_ee = 2;
CloseLink(); CloseLink();
} }
@ -1850,7 +1850,7 @@ void sub_8010DB4(void)
{ {
if (lman.childClockSlave_flag) if (lman.childClockSlave_flag)
rfu_LMAN_requestChangeAgbClockMaster(); rfu_LMAN_requestChangeAgbClockMaster();
sub_8011A64(1, 0x7000); RfuSetErrorStatus(1, 0x7000);
sub_8011170(0x7000); sub_8011170(0x7000);
} }
} }
@ -1905,18 +1905,18 @@ void sub_8010F48(void)
StringCopy(gUnknown_02022B22, gSaveBlock2Ptr->playerName); StringCopy(gUnknown_02022B22, gSaveBlock2Ptr->playerName);
} }
void sub_8010F60(void) void ClearAndInitHostRFUtgtGname(void)
{ {
memset(&gUnknown_02022B14, 0, 0xD); memset(&gUnknown_02022B14, 0, 0xD);
sub_800DD94(&gUnknown_02022B14, 0, 0, 0); sub_800DD94(&gUnknown_02022B14, 0, 0, 0);
} }
void sub_8010F84(u8 a0, u32 a1, u32 a2) void SetHostRFUtgtGname(u8 a0, u32 a1, u32 a2)
{ {
sub_800DD94(&gUnknown_02022B14, a0, a2, a1); sub_800DD94(&gUnknown_02022B14, a0, a2, a1);
} }
void sub_8010FA0(bool32 a0, bool32 a1) void SetGnameBufferWonderFlags(bool32 a0, bool32 a1)
{ {
gUnknown_02022B14.unk_00.hasNews = a0; gUnknown_02022B14.unk_00.hasNews = a0;
gUnknown_02022B14.unk_00.hasCard = a1; gUnknown_02022B14.unk_00.hasCard = a1;
@ -1946,16 +1946,16 @@ void sub_801103C(void)
r5->child_sprite_gender[i - 1] = sub_801100C(i); r5->child_sprite_gender[i - 1] = sub_801100C(i);
} }
void sub_8011068(u8 a0) void UpdateGameData_GroupLockedIn(u8 a0)
{ {
gUnknown_02022B14.started = a0; gUnknown_02022B14.started = a0;
rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22); rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22);
} }
void sub_8011090(u8 a0, u32 a1, u32 a2) void UpdateGameDataWithActivitySpriteGendersFlag(u8 a0, u32 a1, u32 a2)
{ {
if (a0) if (a0)
sub_8010F84(a0, a1, a2); SetHostRFUtgtGname(a0, a1, a2);
rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22); rfu_REQ_configGameData(0, 2, (const u8 *)&gUnknown_02022B14, gUnknown_02022B22);
} }
@ -1966,7 +1966,7 @@ void sub_80110B8(u32 a0)
u32 r7; u32 r7;
s32 r8; s32 r8;
if (sub_800F7DC()->activity == 0x45) if (GetHostRFUtgtGname()->activity == 0x45)
{ {
r5 = 0; r5 = 0;
r7 = 0; r7 = 0;
@ -1981,7 +1981,7 @@ void sub_80110B8(u32 a0)
break; break;
} }
} }
sub_8011090(0x45, r7, 0); UpdateGameDataWithActivitySpriteGendersFlag(0x45, r7, 0);
} }
} }
@ -2038,7 +2038,7 @@ void sub_801120C(u8 a0, u8 unused1)
if ((lman.param[0] >> i) & 1) if ((lman.param[0] >> i) & 1)
{ {
struct GFtgtGname *structPtr = (void *)gRfuLinkStatus->partner[i].gname; struct GFtgtGname *structPtr = (void *)gRfuLinkStatus->partner[i].gname;
if (structPtr->activity == sub_800F7DC()->activity) if (structPtr->activity == GetHostRFUtgtGname()->activity)
{ {
Rfu.unk_cd1[i] = 0; Rfu.unk_cd1[i] = 0;
Rfu.unk_cd5[i] = 0; Rfu.unk_cd5[i] = 0;
@ -2085,21 +2085,21 @@ void sub_801120C(u8 a0, u8 unused1)
else else
sub_80111FC(); sub_80111FC();
} }
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
break; break;
case 0x34: case 0x34:
break; break;
case 0x42 ... 0x44: case 0x42 ... 0x44:
break; break;
case 0xf3: case 0xf3:
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
sub_8011170(a0); sub_8011170(a0);
Rfu.unk_ef = 1; Rfu.unk_ef = 1;
break; break;
case 0xf0 ... 0xf2: case 0xf0 ... 0xf2:
case 0xff: case 0xff:
sub_8011170(a0); sub_8011170(a0);
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
Rfu.unk_cdb = 1; Rfu.unk_cdb = 1;
break; break;
} }
@ -2121,7 +2121,7 @@ void sub_8011404(u8 a0, u8 unused1)
Rfu.unk_c3e = lman.param[0]; Rfu.unk_c3e = lman.param[0];
break; break;
case 0x23: case 0x23:
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
break; break;
case 0x24: case 0x24:
Rfu.unk_04 = 11; Rfu.unk_04 = 11;
@ -2131,7 +2131,7 @@ void sub_8011404(u8 a0, u8 unused1)
rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70); rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70);
break; break;
case 0x25: case 0x25:
sub_8011A64(2, 0x25); RfuSetErrorStatus(2, 0x25);
break; break;
case 0x30: case 0x30:
Rfu.unk_f0 = 2; Rfu.unk_f0 = 2;
@ -2141,7 +2141,7 @@ void sub_8011404(u8 a0, u8 unused1)
if (Rfu.unk_f0 != 2) if (Rfu.unk_f0 != 2)
Rfu.unk_f0 = 4; Rfu.unk_f0 = 4;
if (Rfu.unk_c86 != 9) if (Rfu.unk_c86 != 9)
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
nullsub_5(gUnknown_082ED7FC, 5, 5); nullsub_5(gUnknown_082ED7FC, 5, 5);
if (gReceivedRemoteLinkPlayers == 1) if (gReceivedRemoteLinkPlayers == 1)
sub_8011170(a0); sub_8011170(a0);
@ -2159,13 +2159,13 @@ void sub_8011404(u8 a0, u8 unused1)
case 0x42 ... 0x44: case 0x42 ... 0x44:
break; break;
case 0xF3: case 0xF3:
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
sub_8011170(a0); sub_8011170(a0);
Rfu.unk_ef = 1; Rfu.unk_ef = 1;
break; break;
case 0xF0 ... 0xF2: case 0xF0 ... 0xF2:
case 0xFF: case 0xFF:
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
sub_8011170(a0); sub_8011170(a0);
Rfu.unk_cdb = 1; Rfu.unk_cdb = 1;
break; break;
@ -2214,10 +2214,10 @@ void sub_8011674(u8 a0, u8 unused1)
Rfu.unk_04 = 0x11; Rfu.unk_04 = 0x11;
break; break;
case 0x10: case 0x10:
sub_8011A64(4, 0); RfuSetErrorStatus(4, 0);
break; break;
case 0x11: case 0x11:
if (sub_800F7DC()->activity == 0x45 && Rfu.unk_cd9 == 0) if (GetHostRFUtgtGname()->activity == 0x45 && Rfu.unk_cd9 == 0)
{ {
u8 idx = sub_8011628(lman.param[0]); u8 idx = sub_8011628(lman.param[0]);
if (idx != 0) if (idx != 0)
@ -2240,7 +2240,7 @@ void sub_8011674(u8 a0, u8 unused1)
Rfu.unk_ce4 = 2; Rfu.unk_ce4 = 2;
} }
} }
else if (sub_800F7DC()->activity == 0x54) else if (GetHostRFUtgtGname()->activity == 0x54)
{ {
rfu_REQ_disconnect(lman.acceptSlot_flag); rfu_REQ_disconnect(lman.acceptSlot_flag);
rfu_waitREQComplete(); rfu_waitREQComplete();
@ -2252,7 +2252,7 @@ void sub_8011674(u8 a0, u8 unused1)
case 0x13: case 0x13:
break; break;
case 0x14: case 0x14:
if (sub_800F7DC()->activity != 0x45 && lman.acceptCount > 1) if (GetHostRFUtgtGname()->activity != 0x45 && lman.acceptCount > 1)
{ {
r1 = 1 << sub_800E87C(lman.param[0]); r1 = 1 << sub_800E87C(lman.param[0]);
rfu_REQ_disconnect(lman.acceptSlot_flag ^ r1); rfu_REQ_disconnect(lman.acceptSlot_flag ^ r1);
@ -2279,16 +2279,16 @@ void sub_8011674(u8 a0, u8 unused1)
} }
else else
{ {
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
} }
break; break;
case 0x24: case 0x24:
Rfu.unk_04 = 0xD; Rfu.unk_04 = 0xD;
sub_8011A64(3, 0); RfuSetErrorStatus(3, 0);
rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70); rfu_setRecvBuffer(0x10, Rfu.unk_c3e, Rfu.unk_c3f, 70);
break; break;
case 0x25: case 0x25:
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
break; break;
case 0x31: case 0x31:
if (lman.acceptSlot_flag & lman.param[0]) if (lman.acceptSlot_flag & lman.param[0])
@ -2324,7 +2324,7 @@ void sub_8011674(u8 a0, u8 unused1)
if (gRfuLinkStatus->parentChild == 0xFF && lman.pcswitch_flag == 0 && FuncIsActiveTask(sub_800EB44) == TRUE) if (gRfuLinkStatus->parentChild == 0xFF && lman.pcswitch_flag == 0 && FuncIsActiveTask(sub_800EB44) == TRUE)
Rfu.unk_04 = 0x11; Rfu.unk_04 = 0x11;
sub_8011A64(2, a0); RfuSetErrorStatus(2, a0);
break; break;
case 0x40: case 0x40:
Rfu.unk_ce3 = 0; Rfu.unk_ce3 = 0;
@ -2332,14 +2332,14 @@ void sub_8011674(u8 a0, u8 unused1)
case 0x42 ... 0x44: case 0x42 ... 0x44:
break; break;
case 0xF3: case 0xF3:
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
sub_8011170(a0); sub_8011170(a0);
Rfu.unk_ef = 1; Rfu.unk_ef = 1;
break; break;
case 0xF0 ... 0xF2: case 0xF0 ... 0xF2:
case 0xFF: case 0xFF:
sub_8011170(a0); sub_8011170(a0);
sub_8011A64(1, a0); RfuSetErrorStatus(1, a0);
Rfu.unk_cdb = 0; Rfu.unk_cdb = 0;
break; break;
} }
@ -2350,20 +2350,20 @@ void sub_8011A50(void)
Rfu.unk_ce4 = 2; Rfu.unk_ce4 = 2;
} }
void sub_8011A64(u8 a0, u16 a1) void RfuSetErrorStatus(u8 a0, u16 a1)
{ {
Rfu.unk_f1 = a0; Rfu.unk_f1 = a0;
Rfu.unk_0a = a1; Rfu.unk_0a = a1;
} }
u8 sub_8011A74(void) u8 RfuGetErrorStatus(void)
{ {
return Rfu.unk_f1; return Rfu.unk_f1;
} }
bool32 sub_8011A80(void) bool32 RfuIsErrorStatus1or2(void)
{ {
u32 var = sub_8011A74() - 1; u32 var = RfuGetErrorStatus() - 1;
if (var < 2) if (var < 2)
return TRUE; return TRUE;
else else
@ -2409,7 +2409,7 @@ void sub_8011AFC(void)
if (IsWirelessAdapterConnected()) if (IsWirelessAdapterConnected())
{ {
gLinkType = LINKTYPE_0x1111; gLinkType = LINKTYPE_0x1111;
sub_800B488(); SetWirelessCommType1();
OpenLink(); OpenLink();
SeedRng(gMain.vblankCounter2); SeedRng(gMain.vblankCounter2);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
@ -2425,7 +2425,7 @@ void sub_8011AFC(void)
} }
} }
bool32 sub_8011B90(void) bool32 IsUnionRoomListenTaskActive(void)
{ {
return FuncIsActiveTask(sub_800EB44); return FuncIsActiveTask(sub_800EB44);
} }
@ -2450,7 +2450,7 @@ void sub_8011BF8(void)
UpdatePaletteFade(); UpdatePaletteFade();
} }
void sub_8011C10(u32 a0) void InitializeRfuLinkManager_LinkLeader(u32 a0)
{ {
Rfu.unk_0c = 1; Rfu.unk_0c = 1;
sub_8010F48(); sub_8010F48();
@ -2460,7 +2460,7 @@ void sub_8011C10(u32 a0)
sub_800EE78(); sub_800EE78();
} }
void sub_8011C5C(void) void InitializeRfuLinkManager_JoinGroup(void)
{ {
Rfu.unk_0c = 0; Rfu.unk_0c = 0;
sub_8010F48(); sub_8010F48();
@ -2468,7 +2468,7 @@ void sub_8011C5C(void)
sub_800EF00(); sub_800EF00();
} }
void sub_8011C84(void) void InitializeRfuLinkManager_EnterUnionRoom(void)
{ {
Rfu.unk_0c = 2; Rfu.unk_0c = 2;
sub_8010F48(); sub_8010F48();
@ -2516,7 +2516,7 @@ void sub_8011D6C(u32 a0)
Rfu.unk_cda = sub_800E87C(Rfu.unk_ce2); Rfu.unk_cda = sub_800E87C(Rfu.unk_ce2);
} }
void sub_8011DC0(const u8 *ptr, u16 a1) void RequestDisconnectSlotByTrainerNameAndId(const u8 *ptr, u16 a1)
{ {
u8 var = sub_8011CE4(ptr, a1); u8 var = sub_8011CE4(ptr, a1);
if (var != 0xFF) if (var != 0xFF)
@ -2584,13 +2584,13 @@ void sub_8011EF4(u8 taskId)
if (sub_800EEBC()) if (sub_800EEBC())
DestroyTask(taskId); DestroyTask(taskId);
} }
else if (sub_800F7DC()->activity == 0x15 || sub_800F7DC()->activity == 0x16) else if (GetHostRFUtgtGname()->activity == 0x15 || GetHostRFUtgtGname()->activity == 0x16)
{ {
data[15]++; data[15]++;
} }
else else
{ {
sub_8011A64(2, 0x7000); RfuSetErrorStatus(2, 0x7000);
DestroyTask(taskId); DestroyTask(taskId);
} }
} }
@ -2607,12 +2607,12 @@ void sub_8011EF4(u8 taskId)
if (data[15] > 240) if (data[15] > 240)
{ {
sub_8011A64(2, 0x7000); RfuSetErrorStatus(2, 0x7000);
DestroyTask(taskId); DestroyTask(taskId);
} }
} }
void sub_8011FC8(const u8 *src, u16 trainerId) void CreateTask_RfuReconnectWithParent(const u8 *src, u16 trainerId)
{ {
u8 taskId; u8 taskId;
s16 *data; s16 *data;
@ -2626,7 +2626,7 @@ void sub_8011FC8(const u8 *src, u16 trainerId)
bool32 sub_801200C(s16 a1, struct GFtgtGname *structPtr) bool32 sub_801200C(s16 a1, struct GFtgtGname *structPtr)
{ {
if (sub_800F7DC()->activity == 0x45) if (GetHostRFUtgtGname()->activity == 0x45)
{ {
if (structPtr->activity != 0x45) if (structPtr->activity != 0x45)
return TRUE; return TRUE;
@ -2663,7 +2663,7 @@ void sub_801209C(u8 taskId)
if (++gTasks[taskId].data[0] > 300) if (++gTasks[taskId].data[0] > 300)
{ {
sub_8011A64(2, 0x7000); RfuSetErrorStatus(2, 0x7000);
DestroyTask(taskId); DestroyTask(taskId);
} }
@ -2683,7 +2683,7 @@ void sub_801209C(u8 taskId)
} }
else else
{ {
sub_8011A64(2, 0x7000); RfuSetErrorStatus(2, 0x7000);
DestroyTask(taskId); DestroyTask(taskId);
} }
} }

View File

@ -625,7 +625,7 @@ void sub_800DD94(struct GFtgtGname *data, u8 r9, bool32 r2, s32 r3)
data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR); data->unk_00.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
} }
bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx) bool8 LinkRfu_GetNameIfCompatible(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
{ {
bool8 retVal; bool8 retVal;
@ -660,7 +660,7 @@ bool8 sub_800DE7C(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
return retVal; return retVal;
} }
bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx) bool8 LinkRfu_GetNameIfSerial7F7D(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
{ {
bool8 retVal = FALSE; bool8 retVal = FALSE;
if (gRfuLinkStatus->partner[idx].serialNo == 0x7F7D) if (gRfuLinkStatus->partner[idx].serialNo == 0x7F7D)
@ -677,7 +677,7 @@ bool8 sub_800DF34(struct GFtgtGname *buff1, u8 *buff2, u8 idx)
return retVal; return retVal;
} }
void sub_800DF90(struct GFtgtGname *buff1, u8 *buff2) void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *buff1, u8 *buff2)
{ {
memcpy(buff1, &gUnknown_02022B14, 0xD); memcpy(buff1, &gUnknown_02022B14, 0xD);
memcpy(buff2, gUnknown_02022B22, 8); memcpy(buff2, gUnknown_02022B22, 8);
@ -820,7 +820,7 @@ void sub_800E174(void)
gMain.oamBuffer[125].paletteNum = sprite->oam.paletteNum; gMain.oamBuffer[125].paletteNum = sprite->oam.paletteNum;
gMain.oamBuffer[125].tileNum = sprite->data[6] + sprite->anims[sprite->data[2]][sprite->data[4]].frame.imageValue; gMain.oamBuffer[125].tileNum = sprite->data[6] + sprite->anims[sprite->data[2]][sprite->data[4]].frame.imageValue;
CpuCopy16(gMain.oamBuffer + 125, (struct OamData *)OAM + 125, sizeof(struct OamData)); CpuCopy16(gMain.oamBuffer + 125, (struct OamData *)OAM + 125, sizeof(struct OamData));
if (sub_8011A74() == 1) if (RfuGetErrorStatus() == 1)
{ {
DestroyWirelessStatusIndicatorSprite(); DestroyWirelessStatusIndicatorSprite();
} }
@ -908,7 +908,7 @@ void RecordMixTrainerNames(void)
} }
} }
bool32 sub_800E540(u16 id, u8 *name) bool32 PlayerHasMetTrainerBefore(u16 id, u8 *name)
{ {
s32 i; s32 i;

View File

@ -2107,7 +2107,7 @@ void sub_819A27C(u8 windowId, u16 speciesId, u32 personality, u16 x, u16 y)
BlitBitmapToWindow(windowId, GetMonIconPtr(speciesId, personality, 1), x, y, 32, 32); BlitBitmapToWindow(windowId, GetMonIconPtr(speciesId, personality, 1), x, y, 32, 32);
} }
void sub_819A2BC(u8 palOffset, u8 palId) void ListMenuLoadStdPalAt(u8 palOffset, u8 palId)
{ {
const u16 *palette; const u16 *palette;

View File

@ -548,12 +548,12 @@ u16 mevent_081445C0(u32 command)
return 0; return 0;
} }
void sub_801B940(void) void ResetReceivedWonderCardFlag(void)
{ {
gUnknown_02022C70 = FALSE; gUnknown_02022C70 = FALSE;
} }
bool32 sub_801B94C(u16 a0) bool32 MEventHandleReceivedWonderCard(u16 a0)
{ {
gUnknown_02022C70 = FALSE; gUnknown_02022C70 = FALSE;
if (a0 == 0) if (a0 == 0)

View File

@ -3527,7 +3527,7 @@ static void CursorCb_Register(u8 taskId)
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE); u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)sub_800F7DC(), species2, species, obedience)) switch (CanRegisterMonForTradingBoard(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), species2, species, obedience))
{ {
case CANT_REGISTER_MON: case CANT_REGISTER_MON:
StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow);
@ -3553,7 +3553,7 @@ static void CursorCb_Trade1(u8 taskId)
u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2); u16 species2 = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES2);
u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES); u16 species = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_SPECIES);
u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE); u8 obedience = GetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_OBEDIENCE);
u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)sub_800F7DC(), gUnknown_02022C38, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience); u32 stringId = GetUnionRoomTradeMessageId(*(struct GFtgtGnameSub *)GetHostRFUtgtGname(), gPartnerTgtGnameSub, species2, gUnionRoomOfferedSpecies, gUnionRoomRequestedMonType, species, obedience);
if (stringId != UR_TRADE_MSG_NONE) if (stringId != UR_TRADE_MSG_NONE)
{ {

View File

@ -400,7 +400,7 @@ static const struct PokemonJumpMons gPkmnJumpSpecies[] =
{ .species = SPECIES_BAGON, .unk2 = 1, }, { .species = SPECIES_BAGON, .unk2 = 1, },
}; };
void sub_802A9A8(u16 partyIndex, MainCallback callback) void StartPokemonJump(u16 partyIndex, MainCallback callback)
{ {
u8 taskId; u8 taskId;

View File

@ -52,6 +52,7 @@
#include "constants/rgb.h" #include "constants/rgb.h"
#include "constants/species.h" #include "constants/species.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/union_room.h"
#define Trade_SendData(ptr) (SendBlock(bitmask_all_link_players_but_self(), ptr->linkData, 20)) #define Trade_SendData(ptr) (SendBlock(bitmask_all_link_players_but_self(), ptr->linkData, 20))
@ -234,7 +235,7 @@ static void CB2_SaveAndEndWirelessTrade(void);
static bool8 SendLinkData(const void *linkData, u32 size) static bool8 SendLinkData(const void *linkData, u32 size)
{ {
if (gUnknown_02022C2C == 29) if (gPlayerCurrActivity == ACTIVITY_29)
{ {
rfu_NI_setSendData(lman.acceptSlot_flag, 84, linkData, size); rfu_NI_setSendData(lman.acceptSlot_flag, 84, linkData, size);
return TRUE; return TRUE;
@ -252,7 +253,7 @@ static void sub_80771AC(u8 a0)
static bool32 sub_80771BC(void) static bool32 sub_80771BC(void)
{ {
if (gUnknown_02022C2C == 29) if (gPlayerCurrActivity == ACTIVITY_29)
{ {
if (gRfuSlotStatusNI[sub_800E87C(lman.acceptSlot_flag)]->send.state == 0) if (gRfuSlotStatusNI[sub_800E87C(lman.acceptSlot_flag)]->send.state == 0)
return TRUE; return TRUE;
@ -288,7 +289,7 @@ static void TradeResetReceivedFlag(u32 who)
static bool32 IsWirelessTrade(void) static bool32 IsWirelessTrade(void)
{ {
if (gWirelessCommType && gUnknown_02022C2C == 29) if (gWirelessCommType && gPlayerCurrActivity == ACTIVITY_29)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
@ -393,7 +394,7 @@ static void CB2_CreateTradeMenu(void)
if (gWirelessCommType) if (gWirelessCommType)
{ {
sub_800B488(); SetWirelessCommType1();
OpenLink(); OpenLink();
sub_8011BA4(); sub_8011BA4();
} }

File diff suppressed because it is too large Load Diff

View File

@ -35,14 +35,14 @@ struct UnkStruct_3000DAC
/*0x62*/ u8 filler_62[10]; /*0x62*/ u8 filler_62[10];
}; };
struct UnkStruct_2022C6C struct UnionRoomBattleWork
{ {
s16 a0; s16 textState;
}; };
static struct UnkStruct_3000DAC * gUnknown_03000DAC; static struct UnkStruct_3000DAC * gUnknown_03000DAC;
EWRAM_DATA struct UnkStruct_2022C6C * gUnknown_02022C6C = NULL; EWRAM_DATA struct UnionRoomBattleWork * sWork = NULL;
void sub_801A43C(void); void sub_801A43C(void);
void sub_801A6C0(u8 taskId); void sub_801A6C0(u8 taskId);
@ -53,7 +53,7 @@ const u16 gWirelessInfoScreenPal[] = INCBIN_U16("graphics/interface/wireless_inf
const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz"); const u32 gWirelessInfoScreenGfx[] = INCBIN_U32("graphics/interface/wireless_info_screen.4bpp.lz");
const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz"); const u32 gWirelessInfoScreenTilemap[] = INCBIN_U32("graphics/interface/wireless_info_screen.bin.lz");
const struct BgTemplate gUnknown_082F0D34[] = { static const struct BgTemplate sBgTemplates[] = {
{ {
.bg = 0, .bg = 0,
.charBaseIndex = 2, .charBaseIndex = 2,
@ -67,7 +67,7 @@ const struct BgTemplate gUnknown_082F0D34[] = {
} }
}; };
const struct WindowTemplate gUnknown_082F0D3C[] = { const struct WindowTemplate sWindowTemplates[] = {
{ {
.bg = 0x00, .bg = 0x00,
.tilemapLeft = 0x03, .tilemapLeft = 0x03,
@ -191,12 +191,12 @@ void sub_801A43C(void)
gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC)); gUnknown_03000DAC = AllocZeroed(sizeof(struct UnkStruct_3000DAC));
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_082F0D34, ARRAY_COUNT(gUnknown_082F0D34)); InitBgsFromTemplates(0, sBgTemplates, ARRAY_COUNT(sBgTemplates));
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(0x800));
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(0x800));
DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0); DecompressAndLoadBgGfxUsingHeap(1, gWirelessInfoScreenGfx, 0, 0, 0);
CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0); CopyToBgTilemapBuffer(1, gWirelessInfoScreenTilemap, 0, 0);
InitWindows(gUnknown_082F0D3C); InitWindows(sWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
ResetPaletteFade(); ResetPaletteFade();
ResetSpriteData(); ResetSpriteData();
@ -205,7 +205,7 @@ void sub_801A43C(void)
m4aSoundVSyncOn(); m4aSoundVSyncOn();
SetVBlankCallback(sub_801A418); SetVBlankCallback(sub_801A418);
gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0); gUnknown_03000DAC->taskId = CreateTask(sub_801A6C0, 0);
gUnknown_03000DAC->unk61 = sub_8013C40(); gUnknown_03000DAC->unk61 = CreateTask_ListenToWireless();
gUnknown_03000DAC->unk10[3] = 1; gUnknown_03000DAC->unk10[3] = 1;
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
@ -369,7 +369,7 @@ static void sub_801A8B0(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 m
u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1) u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
{ {
s32 i, j, r2; s32 i, j, r2;
u32 result = a0->unk.field_0.activity; u32 result = a0->gname_uname.gname.activity;
for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++) for (i = 0; i < (unsigned)ARRAY_COUNT(gUnknown_082F0D70); i++)
{ {
@ -377,7 +377,7 @@ u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
{ {
continue; continue;
} }
if (a0->field_1A_0 != 1) if (a0->groupScheduledAnim != 1)
{ {
continue; continue;
} }
@ -386,7 +386,7 @@ u32 sub_801A960(struct UnkStruct_x20 * a0, u32 * a1)
r2 = 0; r2 = 0;
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
{ {
if (a0->unk.field_0.child_sprite_gender[j] != 0) if (a0->gname_uname.gname.child_sprite_gender[j] != 0)
{ {
r2++; r2++;
} }
@ -450,7 +450,7 @@ bool32 sub_801AA30(u32 * a0, u32 * a1, u32 * a2, u8 taskId)
void sub_801AAD4(void) void sub_801AAD4(void)
{ {
s32 i; s32 i;
sub_8014210(10); StartUnionRoomBattle(10);
for (i = 0; i < UNION_ROOM_PARTY_SIZE; i++) for (i = 0; i < UNION_ROOM_PARTY_SIZE; i++)
{ {
gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1]; gEnemyParty[i] = gPlayerParty[gSelectedOrderFromParty[i] - 1];
@ -506,13 +506,13 @@ void sub_801AC40(void)
TransferPlttBuffer(); TransferPlttBuffer();
} }
void sub_801AC54(void) void CB2_UnionRoomBattle(void)
{ {
switch (gMain.state) switch (gMain.state)
{ {
case 0: case 0:
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
gUnknown_02022C6C = AllocZeroed(4); sWork = AllocZeroed(4);
ResetSpriteData(); ResetSpriteData();
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetTasks(); ResetTasks();
@ -535,7 +535,7 @@ void sub_801AC54(void)
gMain.state++; gMain.state++;
break; break;
case 1: case 1:
if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_CommStandbyAwaitingOtherPlayer, 0)) if (sub_801ABDC(&sWork->textState, gText_CommStandbyAwaitingOtherPlayer, 0))
{ {
gMain.state++; gMain.state++;
} }
@ -604,7 +604,7 @@ void sub_801AC54(void)
} }
break; break;
case 7: case 7:
if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_RefusedBattle, 1)) if (sub_801ABDC(&sWork->textState, gText_RefusedBattle, 1))
{ {
SetMainCallback2(CB2_ReturnToField); SetMainCallback2(CB2_ReturnToField);
} }
@ -616,7 +616,7 @@ void sub_801AC54(void)
} }
break; break;
case 9: case 9:
if (sub_801ABDC(&gUnknown_02022C6C->a0, gText_BattleWasRefused, 1)) if (sub_801ABDC(&sWork->textState, gText_BattleWasRefused, 1))
{ {
SetMainCallback2(CB2_ReturnToField); SetMainCallback2(CB2_ReturnToField);
} }

View File

@ -588,7 +588,7 @@ const struct SpriteTemplate gUnknown_082F3244 = {
.callback = SpriteCallbackDummy .callback = SpriteCallbackDummy
}; };
void sub_801DD98(void) void EnterUnionRoomChat(void)
{ {
gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84)); gUnknown_02022C84 = Alloc(sizeof(*gUnknown_02022C84));
sub_801DDD0(gUnknown_02022C84); sub_801DDD0(gUnknown_02022C84);

View File

@ -17,28 +17,46 @@ static u8 sub_8019DF4(void);
static u32 sub_8019F8C(u32 playerIdx, u32 arg1); static u32 sub_8019F8C(u32 playerIdx, u32 arg1);
static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2); static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2);
ALIGNED(4) const u8 gUnknown_082F072C[][10] = { static const u8 sUnionRoomObjGfxIds[GENDER_COUNT][10] = {
{0x21, 0x2c, 0x1f, 0x23, 0x25, 0x24, 0x41, 0x42}, [MALE] = {
{0x22, 0x28, 0x20, 0x2f, 0x2f, 0x0e, 0x14, 0x2d} OBJ_EVENT_GFX_MAN_3,
OBJ_EVENT_GFX_BLACK_BELT,
OBJ_EVENT_GFX_CAMPER,
OBJ_EVENT_GFX_YOUNGSTER,
OBJ_EVENT_GFX_PSYCHIC_M,
OBJ_EVENT_GFX_BUG_CATCHER,
OBJ_EVENT_GFX_MAN_4,
OBJ_EVENT_GFX_MAN_5
},
[FEMALE] = {
OBJ_EVENT_GFX_WOMAN_5,
OBJ_EVENT_GFX_HEX_MANIAC,
OBJ_EVENT_GFX_PICNICKER,
OBJ_EVENT_GFX_LASS,
OBJ_EVENT_GFX_LASS,
OBJ_EVENT_GFX_GIRL_3,
OBJ_EVENT_GFX_WOMAN_2,
OBJ_EVENT_GFX_BEAUTY
}
}; };
static const s16 gUnknown_082F0740[][2] = { static const s16 sUnionPartnerCoords[][2] = {
{0x4, 0x6}, { 4, 6},
{0xd, 0x8}, {13, 8},
{0xa, 0x6}, {10, 6},
{0x1, 0x8}, { 1, 8},
{0xd, 0x4}, {13, 4},
{0x7, 0x4}, { 7, 4},
{0x1, 0x4}, { 1, 4},
{0x7, 0x8} { 7, 8}
}; };
static const s8 gUnknown_082F0760[][2] = { static const s8 sFacingDirectionOffsets[][2] = {
{ 0, 0}, [DIR_NONE] = { 0, 0},
{ 1, 0}, [DIR_SOUTH] = { 1, 0},
{ 0, -1}, [DIR_NORTH] = { 0, -1},
{-1, 0}, [DIR_WEST] = {-1, 0},
{ 0, 1} [DIR_EAST] = { 0, 1}
}; };
static const u8 gUnknown_082F076A[] = { static const u8 gUnknown_082F076A[] = {
@ -79,22 +97,22 @@ static bool32 is_walking_or_running(void)
static u8 sub_8019978(u32 a0, u32 a1) static u8 sub_8019978(u32 a0, u32 a1)
{ {
return gUnknown_082F072C[a0][a1 % 8]; return sUnionRoomObjGfxIds[a0][a1 % 8];
} }
static void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3) static void sub_8019990(u32 a0, u32 a1, s32 * a2, s32 * a3)
{ {
*a2 = gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7; *a2 = sUnionPartnerCoords[a0][0] + sFacingDirectionOffsets[a1][0] + 7;
*a3 = gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7; *a3 = sUnionPartnerCoords[a0][1] + sFacingDirectionOffsets[a1][1] + 7;
} }
static bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3) static bool32 sub_80199E0(u32 a0, u32 a1, s32 a2, s32 a3)
{ {
if (gUnknown_082F0740[a0][0] + gUnknown_082F0760[a1][0] + 7 != a2) if (sUnionPartnerCoords[a0][0] + sFacingDirectionOffsets[a1][0] + 7 != a2)
{ {
return FALSE; return FALSE;
} }
else if (gUnknown_082F0740[a0][1] + gUnknown_082F0760[a1][1] + 7 != a3) else if (sUnionPartnerCoords[a0][1] + sFacingDirectionOffsets[a1][1] + 7 != a3)
{ {
return FALSE; return FALSE;
} }
@ -384,19 +402,19 @@ void sub_8019E3C(void)
sub_8019E20(); sub_8019E20();
} }
void sub_8019E70(u8 * sp8, s32 r9) void CreateGroupMemberObjectsInvisible(u8 * sp8, s32 r9)
{ {
s32 r7; s32 r7;
for (r7 = 0; r7 < 5; r7++) for (r7 = 0; r7 < 5; r7++)
{ {
s32 r5 = 5 * r9 + r7; s32 r5 = 5 * r9 + r7;
sp8[r5] = sprite_new(OBJ_EVENT_GFX_MAN_4, r5 - 0x38, gUnknown_082F0740[r9][0] + gUnknown_082F0760[r7][0], gUnknown_082F0740[r9][1] + gUnknown_082F0760[r7][1], 3, 1); sp8[r5] = sprite_new(OBJ_EVENT_GFX_MAN_4, r5 - 0x38, sUnionPartnerCoords[r9][0] + sFacingDirectionOffsets[r7][0], sUnionPartnerCoords[r9][1] + sFacingDirectionOffsets[r7][1], 3, 1);
sub_8097C44(r5 - 0x38, TRUE); sub_8097C44(r5 - 0x38, TRUE);
} }
} }
void sub_8019F04(u8 * r5) void DestroyGroupMemberObjects(u8 * r5)
{ {
s32 i; s32 i;
for (i = 0; i < 40; i++) for (i = 0; i < 40; i++)
@ -526,30 +544,30 @@ static void sub_801A214(u32 r5, struct GFtgtGname * unused)
} }
} }
static void sub_801A234(struct UnkStruct_URoom *r0) static void sub_801A234(struct WirelessLink_URoom *r0)
{ {
s32 i; s32 i;
struct UnkStruct_x20 * r4; struct UnkStruct_x20 * r4;
gUnknown_02022C68 = 0; gUnknown_02022C68 = 0;
for (i = 0, r4 = r0->field_0->arr; i < 8; i++) for (i = 0, r4 = r0->field_0->arr; i < 8; i++)
{ {
if (r4[i].field_1A_0 == 1) if (r4[i].groupScheduledAnim == 1)
{ {
sub_801A16C(i, &r4[i].unk.field_0); sub_801A16C(i, &r4[i].gname_uname.gname);
} }
else if (r4[i].field_1A_0 == 2) else if (r4[i].groupScheduledAnim == 2)
{ {
sub_801A214(i, &r4[i].unk.field_0); sub_801A214(i, &r4[i].gname_uname.gname);
} }
} }
} }
void sub_801A274(struct UnkStruct_URoom *unused) void ScheduleUnionRoomPlayerRefresh(struct WirelessLink_URoom *unused)
{ {
gUnknown_02022C68 = 300; gUnknown_02022C68 = 300;
} }
void sub_801A284(struct UnkStruct_URoom *r2) void HandleUnionRoomPlayerRefresh(struct WirelessLink_URoom *r2)
{ {
if (++gUnknown_02022C68 > 300) if (++gUnknown_02022C68 > 300)
{ {
@ -557,7 +575,7 @@ void sub_801A284(struct UnkStruct_URoom *r2)
} }
} }
bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3) bool32 RfuUnionTool_GetGroupAndMemberInFrontOfPlayer(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3)
{ {
s16 x, y; s16 x, y;
s32 i, j; s32 i, j;
@ -572,11 +590,11 @@ bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3)
for (j = 0; j < 5; j++) for (j = 0; j < 5; j++)
{ {
s32 r3 = 5 * i + j; s32 r3 = 5 * i + j;
if (x != gUnknown_082F0740[i][0] + gUnknown_082F0760[j][0] + 7) if (x != sUnionPartnerCoords[i][0] + sFacingDirectionOffsets[j][0] + 7)
{ {
continue; continue;
} }
if (y != gUnknown_082F0740[i][1] + gUnknown_082F0760[j][1] + 7) if (y != sUnionPartnerCoords[i][1] + sFacingDirectionOffsets[j][1] + 7)
{ {
continue; continue;
} }
@ -588,7 +606,7 @@ bool32 sub_801A2A8(struct UnkStruct_Main0 *arg0, s16 *arg1, s16 *arg2, u8 *arg3)
{ {
continue; continue;
} }
if (r4[i].field_1A_0 != 1) if (r4[i].groupScheduledAnim != 1)
{ {
continue; continue;
} }
@ -606,7 +624,7 @@ static void sub_801A3B0(s32 arg0, s32 arg1, u8 arg2)
sub_8097B78(5 * arg1 - 0x38 + arg0, arg2); sub_8097B78(5 * arg1 - 0x38 + arg0, arg2);
} }
void sub_801A3D0(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2) void UpdateUnionGroupMemberFacing(u32 arg0, u32 arg1, struct UnkStruct_Main0 *arg2)
{ {
return sub_801A3B0(arg0, arg1, sub_8019F64(arg0, arg1, &arg2->arr[arg1].unk.field_0)); return sub_801A3B0(arg0, arg1, sub_8019F64(arg0, arg1, &arg2->arr[arg1].gname_uname.gname));
} }