Document wireless_communication_status_screen

This commit is contained in:
PikalaxALT
2020-02-03 20:09:14 -05:00
parent d187a96ca2
commit e0d25c3289
15 changed files with 517 additions and 506 deletions
+1 -1
View File
@@ -1149,7 +1149,7 @@ CableClub_EventScript_81BBFD8:: @ 81BBFD8
goto_if_eq CableClub_EventScript_AdapterNotConnected goto_if_eq CableClub_EventScript_AdapterNotConnected
special HelpSystem_Disable special HelpSystem_Disable
fadescreen FADE_TO_BLACK fadescreen FADE_TO_BLACK
special sub_814F1D4 special Special_WirelessCommunicationScreen
waitstate waitstate
msgbox CableClub_Text_ParticipantsStepUpToCounter msgbox CableClub_Text_ParticipantsStepUpToCounter
special HelpSystem_Enable special HelpSystem_Enable
+1 -1
View File
@@ -374,7 +374,7 @@ gSpecials:: @ 815FD60
def_special TryBecomeLinkLeader def_special TryBecomeLinkLeader
def_special TryJoinLinkGroup def_special TryJoinLinkGroup
def_special UnionRoomSpecial def_special UnionRoomSpecial
def_special sub_814F1D4 def_special Special_WirelessCommunicationScreen
def_special EnableNationalPokedex def_special EnableNationalPokedex
def_special sub_80699E0 def_special sub_80699E0
def_special sub_80699BC def_special sub_80699BC
+5 -5
View File
@@ -4498,19 +4498,19 @@ gUnknown_841E243:: @ 841E243
gUnknown_841E244:: @ 841E244 gUnknown_841E244:: @ 841E244
.string "$" .string "$"
gUnknown_841E245:: @ 841E245 gText_WirelessCommunicationStatus:: @ 841E245
.string "Wireless Communication Status$" .string "Wireless Communication Status$"
gUnknown_841E263:: @ 841E263 gText_PeopleTrading:: @ 841E263
.string "People trading:$" .string "People trading:$"
gUnknown_841E273:: @ 841E273 gText_PeopleBattling:: @ 841E273
.string "People battling:$" .string "People battling:$"
gUnknown_841E284:: @ 841E284 gText_PeopleInUnionRoom:: @ 841E284
.string "People in the UNION ROOM:$" .string "People in the UNION ROOM:$"
gUnknown_841E29E:: @ 841E29E gText_PeopleCommunicating:: @ 841E29E
.string "People communicating:$" .string "People communicating:$"
gUnknown_841E2B4:: @ 841E2B4 gUnknown_841E2B4:: @ 841E2B4
+21 -19
View File
@@ -5,29 +5,31 @@
#define UNION_ROOM_SPAWN_IN 1 #define UNION_ROOM_SPAWN_IN 1
#define UNION_ROOM_SPAWN_OUT 2 #define UNION_ROOM_SPAWN_OUT 2
#define UROOM_ACTIVITY_NONE 0 #define ACTIVITY_NONE 0
#define UROOM_ACTIVITY_BATTLE 1 #define ACTIVITY_BATTLE 1
#define UROOM_ACTIVITY_DBLBATTLE 2 #define ACTIVITY_DBLBATTLE 2
#define UROOM_ACTIVITY_MLTBATTLE 3 #define ACTIVITY_MLTBATTLE 3
#define UROOM_ACTIVITY_TRADE 4 #define ACTIVITY_TRADE 4
#define UROOM_ACTIVITY_CHAT 5 #define ACTIVITY_CHAT 5
#define UROOM_ACTIVITY_WCARD 6 #define ACTIVITY_WCARD 6
#define UROOM_ACTIVITY_WNEWS 7 #define ACTIVITY_WNEWS 7
#define UROOM_ACTIVITY_CARD 8 #define ACTIVITY_CARD 8
#define UROOM_ACTIVITY_PJUMP 9 #define ACTIVITY_PJUMP 9
#define UROOM_ACTIVITY_BCRUSH 10 #define ACTIVITY_BCRUSH 10
#define UROOM_ACTIVITY_BPICK 11 #define ACTIVITY_BPICK 11
#define UROOM_ACTIVITY_SEARCH 12 #define ACTIVITY_SEARCH 12
#define UROOM_ACTIVITY_SPINTRADE 13 #define ACTIVITY_SPINTRADE 13
#define UROOM_ACTIVITY_ITEMTRADE 14 #define ACTIVITY_ITEMTRADE 14
// Player response // Player response
#define UROOM_ACTIVITY_ACCEPT 17 #define ACTIVITY_ACCEPT 17
#define UROOM_ACTIVITY_DECLINE 18 #define ACTIVITY_DECLINE 18
// Duplicate IDs? // Duplicate IDs?
#define UROOM_ACTIVITY_WCARD2 21 #define ACTIVITY_WCARD2 21
#define UROOM_ACTIVITY_WNEWS2 22 #define ACTIVITY_WNEWS2 22
#define IN_UNION_ROOM 0x40
// Used in UR_AddTextPrinterParameterized // Used in UR_AddTextPrinterParameterized
#define UR_COLOR_DKE_WHT_LTE 0 #define UR_COLOR_DKE_WHT_LTE 0
+5 -5
View File
@@ -279,7 +279,7 @@ typedef struct UnkRfuStruct_2
/* 0x004 */ u16 state; /* 0x004 */ u16 state;
/* 0x006 */ u8 filler_06[4]; /* 0x006 */ u8 filler_06[4];
/* 0x00a */ u16 linkman_msg; /* 0x00a */ u16 linkman_msg;
/* 0x00c */ u8 unk_0c; // parentChildMode? /* 0x00c */ u8 parent_child;
/* 0x00d */ u8 playerCount; /* 0x00d */ u8 playerCount;
/* 0x00e */ u8 unk_0e; /* 0x00e */ u8 unk_0e;
/* 0x00f */ u8 unk_0f; /* 0x00f */ u8 unk_0f;
@@ -372,7 +372,7 @@ 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);
void sub_80F9E2C(void * data); void sub_80F9E2C(void * data);
u8 sub_8116DE0(void); u8 CreateTask_ListenToWireless(void);
void sub_80FBB4C(void); void sub_80FBB4C(void);
void sub_80F86F4(void); void sub_80F86F4(void);
void sub_80FB128(bool32 a0); void sub_80FB128(bool32 a0);
@@ -392,7 +392,7 @@ bool32 LinkRfuMain1(void);
bool32 LinkRfuMain2(void); bool32 LinkRfuMain2(void);
bool32 IsRfuRecvQueueEmpty(void); bool32 IsRfuRecvQueueEmpty(void);
u32 GetRfuRecvQueueLength(void); u32 GetRfuRecvQueueLength(void);
void sub_80F8DC0(void); void LinkRfu_Shutdown(void);
void sub_80FBB20(void); void sub_80FBB20(void);
bool8 sub_80FA484(bool32 a0); bool8 sub_80FA484(bool32 a0);
void var_800D_set_xB(void); void var_800D_set_xB(void);
@@ -425,10 +425,10 @@ bool32 sub_80FA634(u16 trainerId, const u8 *trainerName);
void sub_80FA670(u8 a0, u16 a1, const u8 *a2); void sub_80FA670(u8 a0, u16 a1, const u8 *a2);
u32 sub_80FA6FC(u16 a0, const u8 *a1); u32 sub_80FA6FC(u16 a0, const u8 *a1);
void SetHostRFUtgtGname(u8 activity, u32 child_sprite_genders, u32 a2); void SetHostRFUtgtGname(u8 activity, u32 child_sprite_genders, u32 a2);
void sub_80FBB8C(u32 a0); void InitializeRfuLinkManager_LinkLeader(u32 availSlots);
void sub_80FBD4C(const u8 *trainerName, u16 trainerId); void sub_80FBD4C(const u8 *trainerName, u16 trainerId);
void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *gname, u8 *uname); void LinkRfu3_SetGnameUnameFromStaticBuffers(struct GFtgtGname *gname, u8 *uname);
void sub_80FBBD8(void); void InitializeRfuLinkManager_JoinGroup(void);
void sub_80FA6BC(void); void sub_80FA6BC(void);
void sub_80FBF54(const u8 *src, u16 trainerId); void sub_80FBF54(const u8 *src, u16 trainerId);
void sub_80FB008(u8 activity, u32 child_sprite_genders, u32 a2); void sub_80FB008(u8 activity, u32 child_sprite_genders, u32 a2);
+11
View File
@@ -1100,4 +1100,15 @@ extern const u8 gText_Symbols[];
extern const u8 gText_Register2[]; extern const u8 gText_Register2[];
extern const u8 gText_Exit[]; extern const u8 gText_Exit[];
// wireless_communication_status_screen
extern const u8 gUnknown_841E2B4[];
extern const u8 gUnknown_841E2BF[];
extern const u8 gUnknown_841E2C9[];
extern const u8 gUnknown_841E2D4[];
extern const u8 gText_WirelessCommunicationStatus[];
extern const u8 gText_PeopleTrading[];
extern const u8 gText_PeopleBattling[];
extern const u8 gText_PeopleInUnionRoom[];
extern const u8 gText_PeopleCommunicating[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H
+8 -8
View File
@@ -12,21 +12,21 @@
#define UROOM_MAX_GROUP_COUNT 8 #define UROOM_MAX_GROUP_COUNT 8
#define UROOM_MAX_PARTY_SIZE 5 #define UROOM_MAX_PARTY_SIZE 5
struct UnkStruct_Shared struct UnionGnameUnamePair
{ {
struct GFtgtGname gname; struct GFtgtGname gname;
u8 ALIGNED(4) playerName[PLAYER_NAME_LENGTH + 1]; u8 ALIGNED(4) uname[PLAYER_NAME_LENGTH + 1];
}; };
struct UnkStruct_x1C struct UnkStruct_x1C
{ {
struct UnkStruct_Shared unk0; struct UnionGnameUnamePair gname_uname;
u8 active:1; u8 active:1;
}; };
struct UnkStruct_x20 struct UnkStruct_x20
{ {
struct UnkStruct_Shared unk; struct UnionGnameUnamePair gname_uname;
u16 field_18; u16 field_18;
u8 groupScheduledAnim:2; u8 groupScheduledAnim:2;
u8 field_1A_1:1; u8 field_1A_1:1;
@@ -59,7 +59,7 @@ struct UnkStruct_Leader
struct UnkStruct_Main0 * field_8; struct UnkStruct_Main0 * field_8;
u8 state; u8 state;
u8 textState; u8 textState;
u8 field_E; u8 delayTimerAfterOk;
u8 listWindowId; u8 listWindowId;
u8 field_10; u8 field_10;
u8 field_11; u8 field_11;
@@ -68,8 +68,8 @@ struct UnkStruct_Leader
u8 field_14; u8 field_14;
u8 field_15; u8 field_15;
u8 field_16; u8 field_16;
u8 field_17; u8 taskId_sub_8119EB8;
u8 field_18; u8 activity;
u8 field_19; u8 field_19;
u16 field_1A; u16 field_1A;
}; };
@@ -88,7 +88,7 @@ struct UnkStruct_Group
u8 field_F; u8 field_F;
u8 field_10; u8 field_10;
u8 field_11; u8 field_11;
u8 field_12; u8 cardOrNews;
u8 field_13; u8 field_13;
u8 field_14; u8 field_14;
u8 field_15; u8 field_15;
+1 -1
View File
@@ -401,7 +401,7 @@ void CloseLink(void)
gReceivedRemoteLinkPlayers = FALSE; gReceivedRemoteLinkPlayers = FALSE;
if (gWirelessCommType) if (gWirelessCommType)
{ {
sub_80F8DC0(); LinkRfu_Shutdown();
} }
gLinkOpen = FALSE; gLinkOpen = FALSE;
DisableSerial(); DisableSerial();
+56 -56
View File
@@ -188,7 +188,7 @@ void sub_80F85F8(void)
s32 i; s32 i;
u8 errorState_bak = Rfu.errorState; u8 errorState_bak = Rfu.errorState;
CpuFill16(0, &Rfu, sizeof Rfu); CpuFill16(0, &Rfu, sizeof Rfu);
Rfu.unk_0c = 0xFF; Rfu.parent_child = MODE_NEUTRAL;
Rfu.errorState = errorState_bak; Rfu.errorState = errorState_bak;
if (Rfu.errorState != 4) if (Rfu.errorState != 4)
{ {
@@ -230,7 +230,7 @@ void sub_80F86F4(void)
} }
} }
static void sub_80F8738(u8 taskId) static void Task_LinkLeaderSearchForChildren(u8 taskId)
{ {
sub_80FA738(); sub_80FA738();
switch (Rfu.state) switch (Rfu.state)
@@ -243,7 +243,7 @@ static void sub_80F8738(u8 taskId)
case 1: case 1:
break; break;
case 2: case 2:
rfu_LMAN_establishConnection(Rfu.unk_0c, 0, 240, (u16*)sAcceptedSerialNos); rfu_LMAN_establishConnection(Rfu.parent_child, 0, 240, (u16*)sAcceptedSerialNos);
Rfu.state = 3; Rfu.state = 3;
gTasks[taskId].data[1] = 6; gTasks[taskId].data[1] = 6;
break; break;
@@ -317,7 +317,7 @@ static void sub_80F887C(s32 r2, s32 r5)
} }
} }
static void sub_80F893C(u8 taskId) static void Task_JoinGroupSearchForParent(u8 taskId)
{ {
switch (Rfu.state) switch (Rfu.state)
{ {
@@ -329,7 +329,7 @@ static void sub_80F893C(u8 taskId)
case 1: case 1:
break; break;
case 6: case 6:
rfu_LMAN_establishConnection(Rfu.unk_0c, 0, 240, (u16*)sAcceptedSerialNos); rfu_LMAN_establishConnection(Rfu.parent_child, 0, 240, (u16*)sAcceptedSerialNos);
Rfu.state = 7; Rfu.state = 7;
gTasks[taskId].data[1] = 7; gTasks[taskId].data[1] = 7;
break; break;
@@ -393,7 +393,7 @@ static void sub_80F8AEC(void)
Rfu.unk_cda = sub_80F886C(acceptSlot); Rfu.unk_cda = sub_80F886C(acceptSlot);
Rfu.bm_PartnerFlags = acceptSlot; Rfu.bm_PartnerFlags = acceptSlot;
sub_80F887C(acceptSlot, -1); sub_80F887C(acceptSlot, -1);
Rfu.unk_0c = 1; Rfu.parent_child = MODE_PARENT;
} }
static void sub_80F8B34(u8 taskId) static void sub_80F8B34(u8 taskId)
@@ -423,7 +423,7 @@ static void sub_80F8B34(u8 taskId)
case 13: case 13:
if (rfu_UNI_setSendData(1 << Rfu.child_slot, Rfu.unk_4c, sizeof(Rfu.unk_4c)) == 0) if (rfu_UNI_setSendData(1 << Rfu.child_slot, Rfu.unk_4c, sizeof(Rfu.unk_4c)) == 0)
{ {
Rfu.unk_0c = 0; Rfu.parent_child = MODE_CHILD;
DestroyTask(taskId); DestroyTask(taskId);
if (gTasks[taskId].data[7]) if (gTasks[taskId].data[7])
{ {
@@ -449,7 +449,7 @@ static void sub_80F8B34(u8 taskId)
sub_80F8AEC(); sub_80F8AEC();
Rfu.state = 20; Rfu.state = 20;
gTasks[taskId].data[1] = 8; gTasks[taskId].data[1] = 8;
Rfu.unk_0c = 1; Rfu.parent_child = MODE_PARENT;
CreateTask(sub_80FA834, 5); CreateTask(sub_80FA834, 5);
Rfu.unk_ce8 = TRUE; Rfu.unk_ce8 = TRUE;
DestroyTask(taskId); DestroyTask(taskId);
@@ -494,7 +494,7 @@ static void sub_80F8DA8(u16 unused)
Rfu.unk_cdb = 1; Rfu.unk_cdb = 1;
} }
void sub_80F8DC0(void) void LinkRfu_Shutdown(void)
{ {
u8 i; u8 i;
@@ -502,23 +502,23 @@ void sub_80F8DC0(void)
return; return;
rfu_LMAN_powerDownRFU(); rfu_LMAN_powerDownRFU();
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
if (FuncIsActiveTask(sub_80F8738) == TRUE) if (FuncIsActiveTask(Task_LinkLeaderSearchForChildren) == TRUE)
{ {
DestroyTask(Rfu.unk_67); DestroyTask(Rfu.unk_67);
sub_80F85F8(); sub_80F85F8();
} }
} }
else if (Rfu.unk_0c == 0) else if (Rfu.parent_child == MODE_CHILD)
{ {
if (FuncIsActiveTask(sub_80F893C) == TRUE) if (FuncIsActiveTask(Task_JoinGroupSearchForParent) == TRUE)
{ {
DestroyTask(Rfu.unk_67); DestroyTask(Rfu.unk_67);
sub_80F85F8(); sub_80F85F8();
} }
} }
else if (Rfu.unk_0c == 2) else if (Rfu.parent_child == 2)
{ {
if (FuncIsActiveTask(sub_80F8B34) == TRUE) if (FuncIsActiveTask(sub_80F8B34) == TRUE)
{ {
@@ -535,11 +535,11 @@ void sub_80F8DC0(void)
} }
} }
static void sub_80F8E74(void) static void CreateTask_LinkLeaderSearchForChildren(void)
{ {
if (gQuestLogState == 2 || gQuestLogState == 3) if (gQuestLogState == 2 || gQuestLogState == 3)
return; return;
Rfu.unk_67 = CreateTask(sub_80F8738, 1); Rfu.unk_67 = CreateTask(Task_LinkLeaderSearchForChildren, 1);
} }
static bool8 sub_80F8EA4(void) static bool8 sub_80F8EA4(void)
@@ -561,11 +561,11 @@ static bool32 sub_80F8ECC(void)
return FALSE; return FALSE;
} }
static void sub_80F8F10(void) static void CreateTask_JoinGroupSearchForParent(void)
{ {
if (gQuestLogState == 2 || gQuestLogState == 3) if (gQuestLogState == 2 || gQuestLogState == 3)
return; return;
Rfu.unk_67 = CreateTask(sub_80F893C, 1); Rfu.unk_67 = CreateTask(Task_JoinGroupSearchForParent, 1);
} }
bool8 sub_80F8F40(void) bool8 sub_80F8F40(void)
@@ -712,7 +712,7 @@ static bool32 sub_80F911C(void)
} }
if (!lman.acceptSlot_flag) if (!lman.acceptSlot_flag)
{ {
sub_80F8DC0(); LinkRfu_Shutdown();
gReceivedRemoteLinkPlayers = 0; gReceivedRemoteLinkPlayers = 0;
return FALSE; return FALSE;
} }
@@ -917,7 +917,7 @@ static void HandleSendFailure(u8 unused, u32 flags)
void Rfu_SetBlockReceivedFlag(u8 a0) void Rfu_SetBlockReceivedFlag(u8 a0)
{ {
if (Rfu.unk_0c == 1 && a0) if (Rfu.parent_child == MODE_PARENT && a0)
Rfu.unk_61[a0] = 1; Rfu.unk_61[a0] = 1;
else else
Rfu.unk_5c[a0] = 1; Rfu.unk_5c[a0] = 1;
@@ -933,7 +933,7 @@ static u8 sub_80F9770(const u8 *a0)
{ {
u8 i; u8 i;
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
return FALSE; return FALSE;
for (i = 0; i < RFU_CHILD_MAX; i++) for (i = 0; i < RFU_CHILD_MAX; i++)
{ {
@@ -986,7 +986,7 @@ static void RfuHandleReceiveCommand(u8 unused)
switch (gRecvCmds[i][0] & 0xff00) switch (gRecvCmds[i][0] & 0xff00)
{ {
case RFU_COMMAND_0x7800: case RFU_COMMAND_0x7800:
if (Rfu.unk_0c == 0 && gReceivedRemoteLinkPlayers != 0) if (Rfu.parent_child == MODE_CHILD && gReceivedRemoteLinkPlayers != 0)
return; return;
// fallthrough // fallthrough
case RFU_COMMAND_0x7700: case RFU_COMMAND_0x7700:
@@ -1018,7 +1018,7 @@ static void RfuHandleReceiveCommand(u8 unused)
{ {
Rfu.cmd_8800_recvbuf[i].receiving = 2; Rfu.cmd_8800_recvbuf[i].receiving = 2;
Rfu_SetBlockReceivedFlag(i); Rfu_SetBlockReceivedFlag(i);
if (GetHostRFUtgtGname()->activity == (UROOM_ACTIVITY_CHAT | 0x40) && gReceivedRemoteLinkPlayers != 0 && Rfu.unk_0c == 0) if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | 0x40) && gReceivedRemoteLinkPlayers != 0 && Rfu.parent_child == MODE_CHILD)
sub_80FAA58(gBlockRecvBuffer); sub_80FAA58(gBlockRecvBuffer);
} }
} }
@@ -1034,7 +1034,7 @@ static void RfuHandleReceiveCommand(u8 unused)
Rfu.unk_e9[i] = 1; Rfu.unk_e9[i] = 1;
break; break;
case RFU_COMMAND_0xed00: case RFU_COMMAND_0xed00:
if (Rfu.unk_0c == 0) if (Rfu.parent_child == MODE_CHILD)
{ {
if (gReceivedRemoteLinkPlayers != 0) if (gReceivedRemoteLinkPlayers != 0)
{ {
@@ -1057,7 +1057,7 @@ static void RfuHandleReceiveCommand(u8 unused)
} }
break; break;
case RFU_COMMAND_0xee00: case RFU_COMMAND_0xee00:
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
Rfu.bm_DisconnectSlot |= gRecvCmds[i][1]; Rfu.bm_DisconnectSlot |= gRecvCmds[i][1];
Rfu.unk_ce4 = gRecvCmds[i][2]; Rfu.unk_ce4 = gRecvCmds[i][2];
@@ -1068,7 +1068,7 @@ static void RfuHandleReceiveCommand(u8 unused)
gLinkPartnersHeldKeys[i] = gRecvCmds[i][1]; gLinkPartnersHeldKeys[i] = gRecvCmds[i][1];
break; break;
} }
if (Rfu.unk_0c == 1 && Rfu.unk_61[i]) if (Rfu.parent_child == MODE_PARENT && Rfu.unk_61[i])
{ {
if (Rfu.unk_61[i] == 4) if (Rfu.unk_61[i] == 4)
{ {
@@ -1221,7 +1221,7 @@ static void RfuFunc_HandleBlockSend(void)
if (gSendCmd[0] == 0) if (gSendCmd[0] == 0)
{ {
RfuPrepareSendBuffer(RFU_COMMAND_0x8800); RfuPrepareSendBuffer(RFU_COMMAND_0x8800);
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
if (++Rfu.unk_5b > 2) if (++Rfu.unk_5b > 2)
Rfu.RfuFunc = RfuFunc_SendNextBlock; Rfu.RfuFunc = RfuFunc_SendNextBlock;
@@ -1253,7 +1253,7 @@ static void RfuFunc_SendLastBlock(void)
const u8 *src = Rfu.cmd_8800_sendbuf.payload; const u8 *src = Rfu.cmd_8800_sendbuf.payload;
u8 mpId = GetMultiplayerId(); u8 mpId = GetMultiplayerId();
s32 i; s32 i;
if (Rfu.unk_0c == 0) if (Rfu.parent_child == MODE_CHILD)
{ {
gSendCmd[0] = RFU_COMMAND_0x8900 | (Rfu.cmd_8800_sendbuf.count - 1); gSendCmd[0] = RFU_COMMAND_0x8900 | (Rfu.cmd_8800_sendbuf.count - 1);
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
@@ -1298,7 +1298,7 @@ static void sub_80FA140(void)
static void sub_80FA160(void) static void sub_80FA160(void)
{ {
if (Rfu.unk_0c == 0) if (Rfu.parent_child == MODE_CHILD)
{ {
rfu_LMAN_requestChangeAgbClockMaster(); rfu_LMAN_requestChangeAgbClockMaster();
Rfu.unk_ce4 = 2; Rfu.unk_ce4 = 2;
@@ -1328,7 +1328,7 @@ static void sub_80FA1C4(void)
if (count == playerCount) if (count == playerCount)
{ {
gBattleTypeFlags &= (u16)~BATTLE_TYPE_20; gBattleTypeFlags &= (u16)~BATTLE_TYPE_20;
if (Rfu.unk_0c == 0) if (Rfu.parent_child == MODE_CHILD)
{ {
Rfu.errorState = 3; Rfu.errorState = 3;
sub_80FA160(); sub_80FA160();
@@ -1469,7 +1469,7 @@ void sub_80FA4A8(void)
u8 LinkRfu_GetMultiplayerId(void) u8 LinkRfu_GetMultiplayerId(void)
{ {
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
return 0; return 0;
return Rfu.unk_cce; return Rfu.unk_cce;
} }
@@ -1637,7 +1637,7 @@ static void sub_80FA834(u8 taskId)
} }
break; break;
case 1: case 1:
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
if (gReceivedRemoteLinkPlayers) if (gReceivedRemoteLinkPlayers)
RfuPrepareSendBuffer(RFU_COMMAND_0x7800); RfuPrepareSendBuffer(RFU_COMMAND_0x7800);
@@ -1657,7 +1657,7 @@ static void sub_80FA834(u8 taskId)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
break; break;
case 3: case 3:
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
if (sub_80F9C50()) if (sub_80F9C50())
{ {
@@ -1881,7 +1881,7 @@ bool32 LinkRfuMain1(void)
rfu_LMAN_manager_entity(Random()); rfu_LMAN_manager_entity(Random());
if (Rfu.unk_ef == 0) if (Rfu.unk_ef == 0)
{ {
switch (Rfu.unk_0c) switch (Rfu.parent_child)
{ {
case 1: case 1:
sub_80F911C(); sub_80F911C();
@@ -1902,7 +1902,7 @@ bool32 LinkRfuMain2(void)
bool32 retval = FALSE; bool32 retval = FALSE;
if (Rfu.unk_ef == 0) if (Rfu.unk_ef == 0)
{ {
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
retval = sub_80F9204(); retval = sub_80F9204();
RfuCheckErrorStatus(); RfuCheckErrorStatus();
} }
@@ -1958,7 +1958,7 @@ void sub_80FB030(u32 linkPlayerCount)
u32 child_sprite_genders; u32 child_sprite_genders;
s32 bm_child_slots; s32 bm_child_slots;
if (GetHostRFUtgtGname()->activity == (UROOM_ACTIVITY_CHAT | 0x40)) if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | 0x40))
{ {
numConnectedChildren = 0; numConnectedChildren = 0;
child_sprite_genders = 0; child_sprite_genders = 0;
@@ -1976,7 +1976,7 @@ void sub_80FB030(u32 linkPlayerCount)
break; break;
} }
} }
sub_80FB008(UROOM_ACTIVITY_CHAT | 0x40, child_sprite_genders, 0); sub_80FB008(ACTIVITY_CHAT | 0x40, child_sprite_genders, 0);
} }
} }
@@ -2201,7 +2201,7 @@ static u8 sub_80FB5A0(s32 a0)
if ((a0 >> i) & 1) if ((a0 >> i) & 1)
{ {
struct GFtgtGname *structPtr = (void *)&gRfuLinkStatus->partner[i].gname; struct GFtgtGname *structPtr = (void *)&gRfuLinkStatus->partner[i].gname;
if (structPtr->activity == (UROOM_ACTIVITY_CHAT | 0x40)) if (structPtr->activity == (ACTIVITY_CHAT | 0x40))
ret |= (1 << i); ret |= (1 << i);
} }
} }
@@ -2222,7 +2222,7 @@ static void LmanCallback_Parent(u8 msg, u8 param_count)
RfuSetErrorStatus(4, 0); RfuSetErrorStatus(4, 0);
break; break;
case LMAN_MSG_NEW_CHILD_CONNECT_ACCEPTED: case LMAN_MSG_NEW_CHILD_CONNECT_ACCEPTED:
if (GetHostRFUtgtGname()->activity == (UROOM_ACTIVITY_CHAT | 0x40) && Rfu.unk_cd9 == 0) if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | 0x40) && Rfu.unk_cd9 == 0)
{ {
u8 idx = sub_80FB5A0(lman.param[0]); u8 idx = sub_80FB5A0(lman.param[0]);
if (idx != 0) if (idx != 0)
@@ -2257,7 +2257,7 @@ static void LmanCallback_Parent(u8 msg, u8 param_count)
case LMAN_MSG_SEARCH_CHILD_PERIOD_EXPIRED: case LMAN_MSG_SEARCH_CHILD_PERIOD_EXPIRED:
break; break;
case LMAN_MSG_END_WAIT_CHILD_NAME: case LMAN_MSG_END_WAIT_CHILD_NAME:
if (GetHostRFUtgtGname()->activity != (UROOM_ACTIVITY_CHAT | 0x40) && lman.acceptCount > 1) if (GetHostRFUtgtGname()->activity != (ACTIVITY_CHAT | 0x40) && lman.acceptCount > 1)
{ {
r1 = 1 << sub_80F886C(lman.param[0]); r1 = 1 << sub_80F886C(lman.param[0]);
rfu_REQ_disconnect(lman.acceptSlot_flag ^ r1); rfu_REQ_disconnect(lman.acceptSlot_flag ^ r1);
@@ -2309,7 +2309,7 @@ static void LmanCallback_Parent(u8 msg, u8 param_count)
case LMAN_MSG_LINK_RECOVERY_FAILED_AND_DISCONNECTED: case LMAN_MSG_LINK_RECOVERY_FAILED_AND_DISCONNECTED:
if (Rfu.linkLossRecoveryState != 2) if (Rfu.linkLossRecoveryState != 2)
Rfu.linkLossRecoveryState = 4; Rfu.linkLossRecoveryState = 4;
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
if (gReceivedRemoteLinkPlayers == 1) if (gReceivedRemoteLinkPlayers == 1)
{ {
@@ -2386,7 +2386,7 @@ bool32 GetRfuUnkCE8(void)
bool8 Rfu_IsMaster(void) bool8 Rfu_IsMaster(void)
{ {
return Rfu.unk_0c; return Rfu.parent_child;
} }
void RFUVSync(void) void RFUVSync(void)
@@ -2459,29 +2459,29 @@ static void sub_80FBB74(void)
UpdatePaletteFade(); UpdatePaletteFade();
} }
void sub_80FBB8C(u32 a0) void InitializeRfuLinkManager_LinkLeader(u32 availSlots)
{ {
Rfu.unk_0c = 1; Rfu.parent_child = MODE_PARENT;
CopyPlayerNameToUnameBuffer(); CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(LmanCallback_Parent2, NULL); rfu_LMAN_initializeManager(LmanCallback_Parent2, NULL);
sRfuReqConfig = sRfuReqConfigTemplate; sRfuReqConfig = sRfuReqConfigTemplate;
sRfuReqConfig.availSlot_flag = sAvailSlots[a0 - 1]; sRfuReqConfig.availSlot_flag = sAvailSlots[availSlots - 1];
sub_80F8E74(); CreateTask_LinkLeaderSearchForChildren();
} }
void sub_80FBBD8(void) void InitializeRfuLinkManager_JoinGroup(void)
{ {
Rfu.unk_0c = 0; Rfu.parent_child = MODE_CHILD;
CopyPlayerNameToUnameBuffer(); CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(LmanCallback_Child, MscCallback_Child); rfu_LMAN_initializeManager(LmanCallback_Child, MscCallback_Child);
sub_80F8F10(); CreateTask_JoinGroupSearchForParent();
} }
void sub_80FBC00(void) void sub_80FBC00(void)
{ {
if (gQuestLogState == 2 || gQuestLogState == 3) if (gQuestLogState == 2 || gQuestLogState == 3)
return; return;
Rfu.unk_0c = 2; Rfu.parent_child = 2;
CopyPlayerNameToUnameBuffer(); CopyPlayerNameToUnameBuffer();
rfu_LMAN_initializeManager(LmanCallback_Parent, NULL); rfu_LMAN_initializeManager(LmanCallback_Parent, NULL);
sRfuReqConfig = sRfuReqConfigTemplate; sRfuReqConfig = sRfuReqConfigTemplate;
@@ -2602,7 +2602,7 @@ static void sub_80FBE80(u8 taskId)
if (sub_80F8ECC()) if (sub_80F8ECC())
DestroyTask(taskId); DestroyTask(taskId);
} }
else if (GetHostRFUtgtGname()->activity == UROOM_ACTIVITY_WCARD2 || GetHostRFUtgtGname()->activity == UROOM_ACTIVITY_WNEWS2) else if (GetHostRFUtgtGname()->activity == ACTIVITY_WCARD2 || GetHostRFUtgtGname()->activity == ACTIVITY_WNEWS2)
{ {
data[15]++; data[15]++;
} }
@@ -2644,16 +2644,16 @@ void sub_80FBF54(const u8 *src, u16 trainerId)
static bool32 ShouldRejectPartnerConnectionBasedOnActivity(s16 activity, struct GFtgtGname *partnerGname) static bool32 ShouldRejectPartnerConnectionBasedOnActivity(s16 activity, struct GFtgtGname *partnerGname)
{ {
if (GetHostRFUtgtGname()->activity == (UROOM_ACTIVITY_CHAT | 0x40)) if (GetHostRFUtgtGname()->activity == (ACTIVITY_CHAT | 0x40))
{ {
if (partnerGname->activity != (UROOM_ACTIVITY_CHAT | 0x40)) if (partnerGname->activity != (ACTIVITY_CHAT | 0x40))
return TRUE; return TRUE;
} }
else if (partnerGname->activity != 0x40) else if (partnerGname->activity != 0x40)
{ {
return TRUE; return TRUE;
} }
else if (activity == (UROOM_ACTIVITY_TRADE | 0x40)) else if (activity == (ACTIVITY_TRADE | 0x40))
{ {
struct GFtgtGname *myTradeGname = (struct GFtgtGname *)&Rfu.unk_104.gname; struct GFtgtGname *myTradeGname = (struct GFtgtGname *)&Rfu.unk_104.gname;
if (myTradeGname->species == SPECIES_EGG) if (myTradeGname->species == SPECIES_EGG)
@@ -2720,7 +2720,7 @@ void sub_80FC114(const u8 *name, struct GFtgtGname *structPtr, u8 activity)
taskId = CreateTask(sub_80FC028, 2); taskId = CreateTask(sub_80FC028, 2);
gTasks[taskId].data[1] = activity; gTasks[taskId].data[1] = activity;
taskId2 = FindTaskIdByFunc(sub_80F8B34); taskId2 = FindTaskIdByFunc(sub_80F8B34);
if (activity == (UROOM_ACTIVITY_CHAT | 0x40)) if (activity == (ACTIVITY_CHAT | 0x40))
{ {
if (taskId2 != 0xFF) if (taskId2 != 0xFF)
gTasks[taskId2].data[7] = 1; gTasks[taskId2].data[7] = 1;
@@ -2781,7 +2781,7 @@ static void sub_80FC228(void)
nullsub_88(GetBlockReceivedStatus(), 0x1C, 0x13, 2); nullsub_88(GetBlockReceivedStatus(), 0x1C, 0x13, 2);
nullsub_88(gRfuLinkStatus->connSlotFlag, 0x14, 1, 1); nullsub_88(gRfuLinkStatus->connSlotFlag, 0x14, 1, 1);
nullsub_88(gRfuLinkStatus->linkLossSlotFlag, 0x17, 1, 1); nullsub_88(gRfuLinkStatus->linkLossSlotFlag, 0x17, 1, 1);
if (Rfu.unk_0c == 1) if (Rfu.parent_child == MODE_PARENT)
{ {
for (i = 0; i < RFU_CHILD_MAX; i++) for (i = 0; i < RFU_CHILD_MAX; i++)
{ {
+7 -6
View File
@@ -25,6 +25,7 @@
#include "help_system.h" #include "help_system.h"
#include "strings.h" #include "strings.h"
#include "constants/songs.h" #include "constants/songs.h"
#include "constants/union_room.h"
EWRAM_DATA u8 sDownArrowCounterAndYCoordIdx[8] = {}; EWRAM_DATA u8 sDownArrowCounterAndYCoordIdx[8] = {};
EWRAM_DATA bool8 gGiftIsFromEReader = FALSE; EWRAM_DATA bool8 gGiftIsFromEReader = FALSE;
@@ -1237,21 +1238,21 @@ void task00_mystery_gift(u8 taskId)
case 0: case 0:
if (data->source == 1) if (data->source == 1)
{ {
MEvent_CreateTask_CardOrNewsWithFriend(0x15); MEvent_CreateTask_CardOrNewsWithFriend(ACTIVITY_WCARD2);
} }
else if (data->source == 0) else if (data->source == 0)
{ {
MEvent_CreateTask_CardOrNewsOverWireless(0x15); MEvent_CreateTask_CardOrNewsOverWireless(ACTIVITY_WCARD2);
} }
break; break;
case 1: case 1:
if (data->source == 1) if (data->source == 1)
{ {
MEvent_CreateTask_CardOrNewsWithFriend(0x16); MEvent_CreateTask_CardOrNewsWithFriend(ACTIVITY_WNEWS2);
} }
else if (data->source == 0) else if (data->source == 0)
{ {
MEvent_CreateTask_CardOrNewsOverWireless(0x16); MEvent_CreateTask_CardOrNewsOverWireless(ACTIVITY_WNEWS2);
} }
break; break;
} }
@@ -1595,10 +1596,10 @@ void task00_mystery_gift(u8 taskId)
switch (data->IsCardOrNews) switch (data->IsCardOrNews)
{ {
case 0: case 0:
MEvent_CreateTask_Leader(21); MEvent_CreateTask_Leader(ACTIVITY_WCARD2);
break; break;
case 1: case 1:
MEvent_CreateTask_Leader(22); MEvent_CreateTask_Leader(ACTIVITY_WNEWS2);
break; break;
} }
data->source = 1; data->source = 1;
+3 -3
View File
@@ -588,11 +588,11 @@ static void UpdateUnionRoomPlayerSprites(struct UnkStruct_URoom * groups)
{ {
if (x20_p[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN) if (x20_p[i].groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{ {
SpawnGroupLeaderAndMembers(i, &x20_p[i].unk.gname); SpawnGroupLeaderAndMembers(i, &x20_p[i].gname_uname.gname);
} }
else if (x20_p[i].groupScheduledAnim == UNION_ROOM_SPAWN_OUT) else if (x20_p[i].groupScheduledAnim == UNION_ROOM_SPAWN_OUT)
{ {
DespawnGroupLeaderAndMembers(i, &x20_p[i].unk.gname); DespawnGroupLeaderAndMembers(i, &x20_p[i].gname_uname.gname);
} }
} }
} }
@@ -661,5 +661,5 @@ static void UnionPartnerObjectSetFacing(s32 member, s32 group, u8 direction)
void UpdateUnionGroupMemberFacing(u32 member, u32 group, struct UnkStruct_Main0 *main0_p) void UpdateUnionGroupMemberFacing(u32 member, u32 group, struct UnkStruct_Main0 *main0_p)
{ {
return UnionPartnerObjectSetFacing(member, group, UnionPartnerObjectGetFacing(member, group, &main0_p->arr[group].unk.gname)); return UnionPartnerObjectSetFacing(member, group, UnionPartnerObjectGetFacing(member, group, &main0_p->arr[group].gname_uname.gname));
} }
+256 -256
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -147,11 +147,11 @@ void CB2_UnionRoomBattle(void)
memset(gBlockSendBuffer, 0, 0x20); memset(gBlockSendBuffer, 0, 0x20);
if (gSelectedOrderFromParty[0] == -gSelectedOrderFromParty[1]) if (gSelectedOrderFromParty[0] == -gSelectedOrderFromParty[1])
{ {
gBlockSendBuffer[0] = UROOM_ACTIVITY_DECLINE | 0x40; gBlockSendBuffer[0] = ACTIVITY_DECLINE | 0x40;
} }
else else
{ {
gBlockSendBuffer[0] = UROOM_ACTIVITY_ACCEPT | 0x40; gBlockSendBuffer[0] = ACTIVITY_ACCEPT | 0x40;
} }
SendBlock(0, gBlockSendBuffer, 0x20); SendBlock(0, gBlockSendBuffer, 0x20);
gMain.state++; gMain.state++;
@@ -160,7 +160,7 @@ void CB2_UnionRoomBattle(void)
case 4: case 4:
if (GetBlockReceivedStatus() == 3) if (GetBlockReceivedStatus() == 3)
{ {
if (gBlockRecvBuffer[0][0] == (UROOM_ACTIVITY_ACCEPT | 0x40) && gBlockRecvBuffer[1][0] == (UROOM_ACTIVITY_ACCEPT | 0x40)) if (gBlockRecvBuffer[0][0] == (ACTIVITY_ACCEPT | 0x40) && gBlockRecvBuffer[1][0] == (ACTIVITY_ACCEPT | 0x40))
{ {
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gMain.state = 50; gMain.state = 50;
@@ -168,7 +168,7 @@ void CB2_UnionRoomBattle(void)
else else
{ {
sub_800AAC0(); sub_800AAC0();
if (gBlockRecvBuffer[GetMultiplayerId()][0] == (UROOM_ACTIVITY_DECLINE | 0x40)) if (gBlockRecvBuffer[GetMultiplayerId()][0] == (ACTIVITY_DECLINE | 0x40))
{ {
gMain.state = 6; gMain.state = 6;
} }
+131 -136
View File
@@ -13,6 +13,7 @@
#include "dynamic_placeholder_text_util.h" #include "dynamic_placeholder_text_util.h"
#include "overworld.h" #include "overworld.h"
#include "sound.h" #include "sound.h"
#include "strings.h"
#include "menu.h" #include "menu.h"
#include "librfu.h" #include "librfu.h"
#include "link_rfu.h" #include "link_rfu.h"
@@ -22,32 +23,22 @@
struct WirelessCommunicationStatusScreenStruct struct WirelessCommunicationStatusScreenStruct
{ {
u32 field_00[4]; u32 counts[4];
u32 field_10[4]; u32 lastCounts[4];
u32 field_20[16]; u32 activities[16];
u8 field_60; u8 taskId;
u8 field_61; u8 rfuTaskId;
u8 filler_62[0xA]; u8 filler_62[0xA];
}; };
struct WirelessCommunicationStatusScreenStruct * gUnknown_3002040; static struct WirelessCommunicationStatusScreenStruct * sWCSS;
extern const u8 gUnknown_841E2B4[]; static void CB2_InitWirelessCommunicationScreen(void);
extern const u8 gUnknown_841E2BF[]; static void Task_WirelessCommunicationScreen(u8 taskId);
extern const u8 gUnknown_841E2C9[]; static void WCSS_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 palIdx);
extern const u8 gUnknown_841E2D4[]; static bool32 UpdateCommunicationCounts(u32 * counts, u32 * lastCounts, u32 * activities, u8 taskId);
extern const u8 gUnknown_841E245[];
extern const u8 gUnknown_841E263[];
extern const u8 gUnknown_841E273[];
extern const u8 gUnknown_841E284[];
extern const u8 gUnknown_841E29E[];
void sub_814F1E4(void); static const u16 sWCSS_Palettes[][16] = {
void sub_814F46C(u8 taskId);
void sub_814F65C(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 palIdx);
bool32 sub_814F7E4(u32 * a0, u32 * a1, u32 * a2, u8 taskId);
const u16 gUnknown_846F4D0[][16] = {
INCBIN_U16("graphics/misc/unk_846f4d0.gbapal"), INCBIN_U16("graphics/misc/unk_846f4d0.gbapal"),
INCBIN_U16("graphics/misc/unk_846f4f0.gbapal"), INCBIN_U16("graphics/misc/unk_846f4f0.gbapal"),
INCBIN_U16("graphics/misc/unk_846f510.gbapal"), INCBIN_U16("graphics/misc/unk_846f510.gbapal"),
@@ -66,10 +57,10 @@ const u16 gUnknown_846F4D0[][16] = {
INCBIN_U16("graphics/misc/unk_846f6b0.gbapal") INCBIN_U16("graphics/misc/unk_846f6b0.gbapal")
}; };
const u32 gUnknown_846F6D0[] = INCBIN_U32("graphics/misc/unk_846f6d0.4bpp.lz"); static const u32 sBgTilesGfx[] = INCBIN_U32("graphics/misc/unk_846f6d0.4bpp.lz");
const u16 gUnknown_846F8E0[] = INCBIN_U16("graphics/misc/unk_846f8e0.bin"); static const u16 sBgTilemap[] = INCBIN_U16("graphics/misc/unk_846f8e0.bin");
const struct BgTemplate gUnknown_846FA74[] = { static const struct BgTemplate sBGTemplates[] = {
{ {
.bg = 0, .bg = 0,
.charBaseIndex = 2, .charBaseIndex = 2,
@@ -89,7 +80,7 @@ const struct BgTemplate gUnknown_846FA74[] = {
} }
}; };
const struct WindowTemplate gUnknown_846FA7C[] = { static const struct WindowTemplate sWindowTemplates[] = {
{ {
.bg = 0x00, .bg = 0x00,
.tilemapLeft = 0x03, .tilemapLeft = 0x03,
@@ -117,47 +108,51 @@ const struct WindowTemplate gUnknown_846FA7C[] = {
}, DUMMY_WIN_TEMPLATE }, DUMMY_WIN_TEMPLATE
}; };
const u8 *const gUnknown_846FA9C[] = { static const u8 *const gUnknown_846FA9C[] = {
gUnknown_841E2B4, gUnknown_841E2B4,
gUnknown_841E2BF, gUnknown_841E2BF,
gUnknown_841E2C9, gUnknown_841E2C9,
gUnknown_841E2D4 gUnknown_841E2D4
}; };
const u8 *const gUnknown_846FAAC[] = {
gUnknown_841E245, static const u8 *const sHeaderTextPtrs[] = {
gUnknown_841E263, gText_WirelessCommunicationStatus,
gUnknown_841E273, gText_PeopleTrading,
gUnknown_841E284, gText_PeopleBattling,
gUnknown_841E29E gText_PeopleInUnionRoom,
gText_PeopleCommunicating
}; };
const u8 gUnknown_846FAC0[][3] = { static const u8 sCountParams[][3] = {
{0x01, 0x01, 0x02}, // activity, count idx, by
{0x02, 0x01, 0x02}, // by=0 means count all
{0x03, 0x01, 0x04}, // UB: no check for count idx == -1
{0x04, 0x00, 0x02}, {ACTIVITY_BATTLE, 1, 2},
{0x15, 0x03, 0x02}, {ACTIVITY_DBLBATTLE, 1, 2},
{0x16, 0x03, 0x02}, {ACTIVITY_MLTBATTLE, 1, 4},
{0x09, 0x04, 0x00}, {ACTIVITY_TRADE, 0, 2},
{0x0a, 0x04, 0x00}, {ACTIVITY_WCARD2, 3, 2},
{0x0b, 0x04, 0x00}, {ACTIVITY_WNEWS2, 3, 2},
{0x0c, 0xff, 0x00}, {ACTIVITY_PJUMP, 4, 0},
{0x0d, 0x00, 0x00}, {ACTIVITY_BCRUSH, 4, 0},
{0x0e, 0xff, 0x00}, {ACTIVITY_BPICK, 4, 0},
{0x0f, 0x04, 0x00}, {ACTIVITY_SEARCH, -1, 0},
{0x10, 0xff, 0x00}, {ACTIVITY_SPINTRADE, 0, 0},
{0x40, 0x02, 0x01}, {ACTIVITY_ITEMTRADE, -1, 0},
{0x41, 0x02, 0x02}, {0x0f, 4, 0},
{0x44, 0x02, 0x02}, {0x10, -1, 0},
{0x45, 0x02, 0x00}, {0x40, 2, 1},
{0x48, 0x02, 0x02}, {ACTIVITY_BATTLE | 0x40, 2, 2},
{0x54, 0x02, 0x01}, {ACTIVITY_TRADE | 0x40, 2, 2},
{0x53, 0x02, 0x02}, {ACTIVITY_CHAT | 0x40, 2, 0},
{0x51, 0x02, 0x01}, {ACTIVITY_CARD | 0x40, 2, 2},
{0x52, 0x02, 0x01} {20 | 0x40, 2, 1},
{19 | 0x40, 2, 2},
{ACTIVITY_ACCEPT | 0x40, 2, 1},
{ACTIVITY_DECLINE | 0x40, 2, 1}
}; };
void sub_814F19C(void) static void CB2_RunWirelessCommunicationScreen(void)
{ {
if (!IsDma3ManagerBusyWithBgCopy()) if (!IsDma3ManagerBusyWithBgCopy())
{ {
@@ -169,50 +164,50 @@ void sub_814F19C(void)
} }
} }
void sub_814F1C0(void) static void VBlankCB_WirelessCommunicationScreen(void)
{ {
LoadOam(); LoadOam();
ProcessSpriteCopyRequests(); ProcessSpriteCopyRequests();
TransferPlttBuffer(); TransferPlttBuffer();
} }
void sub_814F1D4(void) void Special_WirelessCommunicationScreen(void)
{ {
SetMainCallback2(sub_814F1E4); SetMainCallback2(CB2_InitWirelessCommunicationScreen);
} }
void sub_814F1E4(void) static void CB2_InitWirelessCommunicationScreen(void)
{ {
SetGpuReg(REG_OFFSET_DISPCNT, 0); SetGpuReg(REG_OFFSET_DISPCNT, 0);
gUnknown_3002040 = AllocZeroed(sizeof(*gUnknown_3002040)); sWCSS = AllocZeroed(sizeof(*sWCSS));
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
ResetBgsAndClearDma3BusyFlags(0); ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(0, gUnknown_846FA74, NELEMS(gUnknown_846FA74)); InitBgsFromTemplates(0, sBGTemplates, NELEMS(sBGTemplates));
SetBgTilemapBuffer(1, Alloc(0x800)); SetBgTilemapBuffer(1, Alloc(0x800));
SetBgTilemapBuffer(0, Alloc(0x800)); SetBgTilemapBuffer(0, Alloc(0x800));
DecompressAndLoadBgGfxUsingHeap(1, gUnknown_846F6D0, 0, 0, 0); DecompressAndLoadBgGfxUsingHeap(1, sBgTilesGfx, 0, 0, 0);
CopyToBgTilemapBuffer(1, gUnknown_846F8E0, 0, 0); CopyToBgTilemapBuffer(1, sBgTilemap, 0, 0);
InitWindows(gUnknown_846FA7C); InitWindows(sWindowTemplates);
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
ResetPaletteFade(); ResetPaletteFade();
ResetSpriteData(); ResetSpriteData();
ResetTasks(); ResetTasks();
ScanlineEffect_Stop(); ScanlineEffect_Stop();
m4aSoundVSyncOn(); m4aSoundVSyncOn();
SetVBlankCallback(sub_814F1C0); SetVBlankCallback(VBlankCB_WirelessCommunicationScreen);
gUnknown_3002040->field_60 = CreateTask(sub_814F46C, 0); sWCSS->taskId = CreateTask(Task_WirelessCommunicationScreen, 0);
gUnknown_3002040->field_61 = sub_8116DE0(); sWCSS->rfuTaskId = CreateTask_ListenToWireless();
gUnknown_3002040->field_10[3] = 1; sWCSS->lastCounts[3] = 1;
ChangeBgX(0, 0, 0); ChangeBgX(0, 0, 0);
ChangeBgY(0, 0, 0); ChangeBgY(0, 0, 0);
ChangeBgX(1, 0, 0); ChangeBgX(1, 0, 0);
ChangeBgY(1, 0, 0); ChangeBgY(1, 0, 0);
LoadPalette(gUnknown_846F4D0, 0, 0x20); LoadPalette(sWCSS_Palettes, 0, 0x20);
Menu_LoadStdPalAt(0xf0); Menu_LoadStdPalAt(0xf0);
DynamicPlaceholderTextUtil_Reset(); DynamicPlaceholderTextUtil_Reset();
FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0xF); FillBgTilemapBufferRect(0, 0x000, 0, 0, 32, 32, 0xF);
CopyBgTilemapBufferToVram(1); CopyBgTilemapBufferToVram(1);
SetMainCallback2(sub_814F19C); SetMainCallback2(CB2_RunWirelessCommunicationScreen);
RunTasks(); RunTasks();
RunTextPrinters(); RunTextPrinters();
AnimateSprites(); AnimateSprites();
@@ -220,7 +215,7 @@ void sub_814F1E4(void)
UpdatePaletteFade(); UpdatePaletteFade();
} }
void sub_814F32C(void) static void ExitWirelessCommunicationStatusScreen(void)
{ {
s32 i; s32 i;
@@ -229,28 +224,28 @@ void sub_814F32C(void)
{ {
Free(GetBgTilemapBuffer(i)); Free(GetBgTilemapBuffer(i));
} }
Free(gUnknown_3002040); Free(sWCSS);
SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic); SetMainCallback2(CB2_ReturnToFieldContinueScriptPlayMapMusic);
} }
void sub_814F364(s16 * unk0, s16 * unk1) static void WCSS_CyclePalette(s16 * frameCtr_p, s16 * palIdx_p)
{ {
s32 idx; s32 idx;
(*unk0)++; (*frameCtr_p)++;
if (*unk0 > 5) if (*frameCtr_p > 5)
{ {
(*unk1)++; (*palIdx_p)++;
if (*unk1 == 14) if (*palIdx_p == 14)
{ {
*unk1 = 0; *palIdx_p = 0;
} }
*unk0 = 0; *frameCtr_p = 0;
} }
idx = *unk1 + 2; idx = *palIdx_p + 2;
LoadPalette(gUnknown_846F4D0[idx], 0, 16); LoadPalette(sWCSS_Palettes[idx], 0, 16);
} }
void sub_814F3A8(void) static void PrintHeaderTexts(void)
{ {
s32 i; s32 i;
u32 width; u32 width;
@@ -258,26 +253,26 @@ void sub_814F3A8(void)
FillWindowPixelBuffer(0, 0); FillWindowPixelBuffer(0, 0);
FillWindowPixelBuffer(1, 0); FillWindowPixelBuffer(1, 0);
FillWindowPixelBuffer(2, 0); FillWindowPixelBuffer(2, 0);
width = 0xC0 - GetStringWidth(3, gUnknown_846FAAC[0], 0); width = 0xC0 - GetStringWidth(3, sHeaderTextPtrs[0], 0);
sub_814F65C(0, 3, gUnknown_846FAAC[0], width / 2, 6, 3); WCSS_AddTextPrinterParameterized(0, 3, sHeaderTextPtrs[0], width / 2, 6, 3);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
sub_814F65C(1, 3, gUnknown_846FAAC[i + 1], 0, 30 * i + 10, 1); WCSS_AddTextPrinterParameterized(1, 3, sHeaderTextPtrs[i + 1], 0, 30 * i + 10, 1);
} }
sub_814F65C(1, 3, gUnknown_846FAAC[i + 1], 0, 30 * i + 10, 2); WCSS_AddTextPrinterParameterized(1, 3, sHeaderTextPtrs[i + 1], 0, 30 * i + 10, 2);
PutWindowTilemap(0); PutWindowTilemap(0);
CopyWindowToVram(0, 2); CopyWindowToVram(0, 2);
PutWindowTilemap(1); PutWindowTilemap(1);
CopyWindowToVram(1, 2); CopyWindowToVram(1, 2);
} }
void sub_814F46C(u8 taskId) static void Task_WirelessCommunicationScreen(u8 taskId)
{ {
s32 i; s32 i;
switch (gTasks[taskId].data[0]) switch (gTasks[taskId].data[0])
{ {
case 0: case 0:
sub_814F3A8(); PrintHeaderTexts();
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
break; break;
case 1: case 1:
@@ -292,16 +287,16 @@ void sub_814F46C(u8 taskId)
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
break; break;
case 3: case 3:
if (sub_814F7E4(gUnknown_3002040->field_00, gUnknown_3002040->field_10, gUnknown_3002040->field_20, gUnknown_3002040->field_61)) if (UpdateCommunicationCounts(sWCSS->counts, sWCSS->lastCounts, sWCSS->activities, sWCSS->rfuTaskId))
{ {
FillWindowPixelBuffer(2, 0x00); FillWindowPixelBuffer(2, 0x00);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
ConvertIntToDecimalStringN(gStringVar4, gUnknown_3002040->field_00[i], STR_CONV_MODE_RIGHT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar4, sWCSS->counts[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
if (i != 3) if (i != 3)
sub_814F65C(2, 3, gStringVar4, 4, 30 * i + 10, 1); WCSS_AddTextPrinterParameterized(2, 3, gStringVar4, 4, 30 * i + 10, 1);
else else
sub_814F65C(2, 3, gStringVar4, 4, 100, 2); WCSS_AddTextPrinterParameterized(2, 3, gStringVar4, 4, 100, 2);
} }
PutWindowTilemap(2); PutWindowTilemap(2);
CopyWindowToVram(2, 3); CopyWindowToVram(2, 3);
@@ -309,10 +304,10 @@ void sub_814F46C(u8 taskId)
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{ {
PlaySE(SE_SELECT); PlaySE(SE_SELECT);
gTasks[gUnknown_3002040->field_61].data[15] = 0xFF; gTasks[sWCSS->rfuTaskId].data[15] = 0xFF;
gTasks[taskId].data[0]++; gTasks[taskId].data[0]++;
} }
sub_814F364(&gTasks[taskId].data[7], &gTasks[taskId].data[8]); WCSS_CyclePalette(&gTasks[taskId].data[7], &gTasks[taskId].data[8]);
break; break;
case 4: case 4:
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
@@ -321,70 +316,70 @@ void sub_814F46C(u8 taskId)
case 5: case 5:
if (!gPaletteFade.active) if (!gPaletteFade.active)
{ {
SetMainCallback2(sub_814F32C); SetMainCallback2(ExitWirelessCommunicationStatusScreen);
DestroyTask(taskId); DestroyTask(taskId);
} }
break; break;
} }
} }
void sub_814F65C(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 palIdx) static void WCSS_AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 * str, u8 x, u8 y, u8 palIdx)
{ {
u8 textColor[3]; u8 textColor[3];
switch (palIdx) switch (palIdx)
{ {
case 0: case 0:
textColor[0] = 0; textColor[0] = TEXT_COLOR_TRANSPARENT;
textColor[1] = 2; textColor[1] = TEXT_COLOR_DARK_GREY;
textColor[2] = 3; textColor[2] = TEXT_COLOR_LIGHT_GREY;
break; break;
case 1: case 1:
textColor[0] = 0; textColor[0] = TEXT_COLOR_TRANSPARENT;
textColor[1] = 1; textColor[1] = TEXT_COLOR_WHITE;
textColor[2] = 3; textColor[2] = TEXT_COLOR_LIGHT_GREY;
break; break;
case 2: case 2:
textColor[0] = 0; textColor[0] = TEXT_COLOR_TRANSPARENT;
textColor[1] = 4; textColor[1] = TEXT_COLOR_RED;
textColor[2] = 5; textColor[2] = TEXT_COLOR_LIGHT_RED;
break; break;
case 3: case 3:
textColor[0] = 0; textColor[0] = TEXT_COLOR_TRANSPARENT;
textColor[1] = 7; textColor[1] = TEXT_COLOR_LIGHT_GREEN;
textColor[2] = 6; textColor[2] = TEXT_COLOR_GREEN;
break; break;
case 4: case 4:
textColor[0] = 0; textColor[0] = TEXT_COLOR_TRANSPARENT;
textColor[1] = 1; textColor[1] = TEXT_COLOR_WHITE;
textColor[2] = 2; textColor[2] = TEXT_COLOR_DARK_GREY;
break; break;
// default: UB // default: UB
} }
AddTextPrinterParameterized4(windowId, fontId,x, y, fontId == 0 ? 0 : 1, 0, textColor, -1, str); AddTextPrinterParameterized4(windowId, fontId,x, y, fontId == 0 ? 0 : 1, 0, textColor, -1, str);
} }
u32 sub_814F714(struct UnkStruct_x20 * unk20, u32 * arg1) static u32 CountMembersInGroup(struct UnkStruct_x20 * unk20, u32 * counts)
{ {
u32 activity = unk20->unk.gname.activity; u32 activity = unk20->gname_uname.gname.activity;
s32 i, j, k; s32 i, j, k;
for (i = 0; i < NELEMS(gUnknown_846FAC0); i++) for (i = 0; i < NELEMS(sCountParams); i++)
{ {
if (activity == gUnknown_846FAC0[i][0] && unk20->groupScheduledAnim == UNION_ROOM_SPAWN_IN) if (activity == sCountParams[i][0] && unk20->groupScheduledAnim == UNION_ROOM_SPAWN_IN)
{ {
if (gUnknown_846FAC0[i][2] == 0) if (sCountParams[i][2] == 0)
{ {
k = 0; k = 0;
for (j = 0; j < 4; j++) for (j = 0; j < RFU_CHILD_MAX; j++)
{ {
if (unk20->unk.gname.child_sprite_gender[j] != 0) k++; if (unk20->gname_uname.gname.child_sprite_gender[j] != 0) k++;
} }
k++; k++;
arg1[gUnknown_846FAC0[i][1]] += k; counts[sCountParams[i][1]] += k;
} }
else else
{ {
arg1[gUnknown_846FAC0[i][1]] += gUnknown_846FAC0[i][2]; counts[sCountParams[i][1]] += sCountParams[i][2];
} }
} }
} }
@@ -392,46 +387,46 @@ u32 sub_814F714(struct UnkStruct_x20 * unk20, u32 * arg1)
return activity; return activity;
} }
bool32 sub_814F7BC(const u32 * ptr0, const u32 * ptr1) static bool32 HaveCountsChanged(const u32 * newCounts, const u32 * prevCounts)
{ {
s32 i; s32 i;
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (ptr0[i] != ptr1[i]) if (newCounts[i] != prevCounts[i])
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
bool32 sub_814F7E4(u32 * a0, u32 * a1, u32 * a2, u8 taskId) static bool32 UpdateCommunicationCounts(u32 * counts, u32 * lastCounts, u32 * activities, u8 taskId)
{ {
bool32 r8 = FALSE; bool32 activitiesUpdated = FALSE;
u32 sp0[4] = {0, 0, 0, 0}; u32 buffer[4] = {0, 0, 0, 0};
struct UnkStruct_Group * group = (void *)gTasks[taskId].data; struct UnkStruct_Group * group = (void *)gTasks[taskId].data;
s32 i; s32 i;
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
{ {
u32 r1 = sub_814F714(&group->field_0->arr[i], sp0); u32 activity = CountMembersInGroup(&group->field_0->arr[i], buffer);
if (r1 != a2[i]) if (activity != activities[i])
{ {
a2[i] = r1; activities[i] = activity;
r8 = TRUE; activitiesUpdated = TRUE;
} }
} }
if (sub_814F7BC(sp0, a1) == FALSE) if (HaveCountsChanged(buffer, lastCounts) == FALSE)
{ {
if (r8 == TRUE) if (activitiesUpdated == TRUE)
return TRUE; return TRUE;
else else
return FALSE; return FALSE;
} }
memcpy(a0, sp0, sizeof(sp0)); memcpy(counts, buffer, sizeof(buffer));
memcpy(a1, sp0, sizeof(sp0)); memcpy(lastCounts, buffer, sizeof(buffer));
a0[3] = a0[0] + a0[1] + a0[2]; counts[3] = counts[0] + counts[1] + counts[2];
return TRUE; return TRUE;
} }
+7 -5
View File
@@ -86,9 +86,10 @@ gUnknown_3002030: @ 3002030
gUnknown_3002038: @ 3002038 gUnknown_3002038: @ 3002038
.space 0x8 .space 0x8
gUnknown_3002040: @ 3002040 .align 2
.space 0x4 .include "src/wireless_communication_status_screen.o"
.align 2
gUnknown_3002044: @ 3002044 gUnknown_3002044: @ 3002044
.space 0x4 .space 0x4
@@ -100,10 +101,11 @@ gUnknown_3002044: @ 3002044
.align 3 .align 3
.include "asm/m4a_1.o" .include "asm/m4a_1.o"
.align 3
.include "src/agb_flash.o" .include "src/agb_flash.o"
.align 3
.space 0x4 @ This isn't needed for Ruby/Sapphire or Emerald.
.include "*libgcc.a:dp-bit.o" .include "*libgcc.a:dp-bit.o"
.align 3
.include "*libgcc.a:fp-bit.o" .include "*libgcc.a:fp-bit.o"
.align 3
.include "*libc.a:syscalls.o" .include "*libc.a:syscalls.o"