mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
Document link contest connection
This commit is contained in:
parent
aca50c87be
commit
4911849723
@ -12,9 +12,9 @@ gRecvCmds
|
||||
gLinkStatus
|
||||
gLinkDummy1
|
||||
gLinkDummy2
|
||||
gUnknown_030030EC
|
||||
gUnknown_030030F0
|
||||
gUnknown_030030F4
|
||||
gReadyToExitStandby
|
||||
gReadyToCloseLink
|
||||
gReadyCloseLinkType
|
||||
gSuppressLinkErrorMessage
|
||||
gWirelessCommType
|
||||
gSavedLinkPlayerCount
|
||||
|
@ -322,7 +322,7 @@ extern u8 gContestMonPartyIndex;
|
||||
extern u8 gContestPlayerMonIndex;
|
||||
extern u8 gContestantTurnOrder[CONTESTANT_COUNT];
|
||||
extern u8 gLinkContestFlags;
|
||||
extern u8 gUnknown_02039F2B;
|
||||
extern u8 gContestLinkLeaderIndex;
|
||||
extern u16 gSpecialVar_ContestCategory;
|
||||
extern u16 gSpecialVar_ContestRank;
|
||||
extern u8 gNumLinkContestPlayers;
|
||||
@ -342,7 +342,7 @@ void CreateContestMonFromParty(u8 partyIndex);
|
||||
void SetContestants(u8 contestType, u8 rank);
|
||||
void SetLinkAIContestants(u8 contestType, u8 rank, bool32 isPostgame);
|
||||
u8 GetContestEntryEligibility(struct Pokemon *pkmn);
|
||||
void sub_80DB09C(u8 contestCategory);
|
||||
void CalculateRound1Points(u8 contestCategory);
|
||||
bool8 IsSpeciesNotUnown(u16 species);
|
||||
bool8 Contest_IsMonsTurnDisabled(u8 a);
|
||||
void SaveLinkContestResults(void);
|
||||
|
@ -1,24 +1,23 @@
|
||||
#ifndef GUARD_CONTEST_LINK_H
|
||||
#define GUARD_CONTEST_LINK_H
|
||||
|
||||
void sub_80FCC88(u8);
|
||||
void sub_80FCC88(u8);
|
||||
void Task_LinkContest_CommunicateFinalStandings(u8);
|
||||
void sub_80FC580(u8);
|
||||
void sub_80FC6BC(u8);
|
||||
void sub_80FC804(u8);
|
||||
void sub_80FCE48(u8);
|
||||
void sub_80FC894(u8);
|
||||
void Task_LinkContest_CommunicateMonIdxs(u8 taskId);
|
||||
void sub_81D9DE4(u8 taskId);
|
||||
void Task_LinkContest_Init(u8);
|
||||
void Task_LinkContest_CommunicateMonsRS(u8);
|
||||
void Task_LinkContest_CommunicateRngRS(u8);
|
||||
void Task_LinkContest_CommunicateLeaderIdsRS(u8);
|
||||
void Task_LinkContest_CommunicateCategoryRS(u8);
|
||||
void Task_LinkContest_CommunicateMonIdxs(u8);
|
||||
void Task_LinkContest_StartCommunicationEm(u8);
|
||||
void Task_LinkContest_CommunicateRound1Points(u8);
|
||||
void Task_LinkContest_CommunicateTurnOrder(u8);
|
||||
void sub_80F8714(u8);
|
||||
bool32 sub_80FC670(s16 *);
|
||||
void Task_LinkContest_FinalizeConnection(u8);
|
||||
void Task_LinkContest_CommunicateMoveSelections(u8);
|
||||
bool32 LinkContest_TryLinkStandby(s16 *);
|
||||
bool32 LinkContest_SendBlock(void *, u16);
|
||||
bool8 LinkContest_GetBlockReceivedFromAllPlayers(void);
|
||||
bool8 LinkContest_GetBlockReceived(u8);
|
||||
u8 sub_80F86E0(u8 *);
|
||||
void Task_LinkContest_CommunicateMoveSelections(u8 taskId);
|
||||
u8 LinkContest_GetLeaderIndex(u8 *);
|
||||
|
||||
#endif //GUARD_CONTEST_LINK_H
|
||||
|
@ -49,11 +49,11 @@
|
||||
(((status) & LINK_STAT_ERRORS) >> LINK_STAT_ERRORS_SHIFT)
|
||||
|
||||
#define LINKCMD_SEND_LINK_TYPE 0x2222
|
||||
#define LINKCMD_0x2FFE 0x2FFE
|
||||
#define LINKCMD_READY_EXIT_STANDBY 0x2FFE
|
||||
#define LINKCMD_SEND_HELD_KEYS 0x4444
|
||||
#define LINKCMD_0x5555 0x5555
|
||||
#define LINKCMD_0x5566 0x5566
|
||||
#define LINKCMD_0x5FFF 0x5FFF
|
||||
#define LINKCMD_READY_CLOSE_LINK 0x5FFF
|
||||
#define LINKCMD_0x6666 0x6666
|
||||
#define LINKCMD_0x7777 0x7777
|
||||
#define LINKCMD_CONT_BLOCK 0x8888
|
||||
@ -64,7 +64,7 @@
|
||||
#define LINKCMD_INIT_BLOCK 0xBBBB
|
||||
#define LINKCMD_READY_CANCEL_TRADE 0xBBCC
|
||||
#define LINKCMD_SEND_HELD_KEYS_2 0xCAFE
|
||||
#define LINKCMD_0xCCCC 0xCCCC
|
||||
#define LINKCMD_SEND_BLOCK_REQ 0xCCCC
|
||||
#define LINKCMD_START_TRADE 0xCCDD
|
||||
#define LINKCMD_CONFIRM_FINISH_TRADE 0xDCBA
|
||||
#define LINKCMD_SET_MONS_TO_TRADE 0xDDDD
|
||||
@ -273,11 +273,11 @@ bool32 InUnionRoom(void);
|
||||
void LoadWirelessStatusIndicatorSpriteGfx(void);
|
||||
bool8 IsLinkTaskFinished(void);
|
||||
void CreateWirelessStatusIndicatorSprite(u8, u8);
|
||||
void sub_800ADF8(void);
|
||||
void SetLinkStandbyCallback(void);
|
||||
void SetWirelessCommType1(void);
|
||||
void CheckShouldAdvanceLinkState(void);
|
||||
u8 IsLinkMaster(void);
|
||||
void sub_800AC34(void);
|
||||
void SetCloseLinkCallback(void);
|
||||
bool8 HandleLinkConnection(void);
|
||||
void SetLinkDebugValues(u32 seed, u32 flags);
|
||||
void sub_800A418(void);
|
||||
@ -305,9 +305,9 @@ extern u16 gLinkHeldKeys;
|
||||
extern u32 gLinkStatus;
|
||||
extern u8 gUnknown_030030E4;
|
||||
extern u8 gUnknown_030030E8;
|
||||
extern u8 gUnknown_030030EC[MAX_LINK_PLAYERS];
|
||||
extern u8 gUnknown_030030F0[MAX_LINK_PLAYERS];
|
||||
extern u16 gUnknown_030030F4;
|
||||
extern bool8 gReadyToExitStandby[MAX_LINK_PLAYERS];
|
||||
extern bool8 gReadyToCloseLink[MAX_LINK_PLAYERS];
|
||||
extern u16 gReadyCloseLinkType;
|
||||
extern u8 gSuppressLinkErrorMessage;
|
||||
extern u8 gWirelessCommType;
|
||||
extern bool8 gSavedLinkPlayerCount;
|
||||
@ -334,15 +334,15 @@ bool32 LinkDummy_Return2(void);
|
||||
void SetLocalLinkPlayerId(u8);
|
||||
u8 GetSavedPlayerCount(void);
|
||||
void sub_8009FAC(void);
|
||||
bool8 sub_800A4D8(u8 a0);
|
||||
bool8 SendBlockRequest(u8 type);
|
||||
u8 GetLinkPlayerCountAsBitFlags(void);
|
||||
u8 sub_800A0C8(s32, s32);
|
||||
u8 GetSavedLinkPlayerCountAsBitFlags(void);
|
||||
void sub_800AD10(void);
|
||||
void SetCloseLinkCallbackHandleJP(void);
|
||||
void CheckLinkPlayersMatchSaved(void);
|
||||
void StartSendingKeysToLink(void);
|
||||
bool8 DoesLinkPlayerCountMatchSaved(void);
|
||||
void sub_800ABF4(u16 a0);
|
||||
void SetCloseLinkCallbackAndType(u16 type);
|
||||
bool32 IsSendingKeysToLink(void);
|
||||
u32 GetLinkRecvQueueLength(void);
|
||||
|
||||
|
@ -8,11 +8,11 @@
|
||||
#define RFU_COMMAND_0x4400 0x4400
|
||||
#define RFU_COMMAND_0x8800 0x8800
|
||||
#define RFU_COMMAND_0x8900 0x8900
|
||||
#define RFU_COMMAND_0xA100 0xA100
|
||||
#define RFU_COMMAND_SEND_BLOCK_REQ 0xA100
|
||||
#define RFU_COMMAND_0x7700 0x7700
|
||||
#define RFU_COMMAND_0x7800 0x7800
|
||||
#define RFU_COMMAND_0x6600 0x6600
|
||||
#define RFU_COMMAND_0x5F00 0x5F00
|
||||
#define RFU_COMMAND_READY_EXIT_STANDBY 0x6600
|
||||
#define RFU_COMMAND_READY_CLOSE_LINK 0x5F00
|
||||
#define RFU_COMMAND_0x2F00 0x2F00
|
||||
#define RFU_COMMAND_0xBE00 0xBE00
|
||||
#define RFU_COMMAND_0xEE00 0xEE00
|
||||
@ -125,7 +125,7 @@ struct GFRfuManager
|
||||
/* 0x012 */ u16 unk_12;
|
||||
/* 0x014 */ u8 unk_14[RFU_CHILD_MAX][14];
|
||||
/* 0x04c */ u8 unk_4c[14];
|
||||
/* 0x05a */ u8 unk_5a;
|
||||
/* 0x05a */ u8 blockRequestType;
|
||||
/* 0x05b */ u8 unk_5b;
|
||||
/* 0x05c */ bool8 blockReceived[MAX_RFU_PLAYERS];
|
||||
/* 0x061 */ bool8 numBlocksReceived[MAX_RFU_PLAYERS];
|
||||
@ -134,14 +134,14 @@ struct GFRfuManager
|
||||
/* 0x068 */ u8 filler_68[4];
|
||||
/* 0x06c */ struct RfuBlockSend sendBlock;
|
||||
/* 0x080 */ struct RfuBlockSend recvBlock[MAX_RFU_PLAYERS];
|
||||
/* 0x0e4 */ u8 unk_e4[5];
|
||||
/* 0x0e9 */ u8 unk_e9[5];
|
||||
/* 0x0e4 */ bool8 readyCloseLink[MAX_RFU_PLAYERS];
|
||||
/* 0x0e9 */ bool8 readyExitStandby[MAX_RFU_PLAYERS];
|
||||
/* 0x0ee */ vu8 errorState;
|
||||
/* 0x0ef */ bool8 isShuttingDown;
|
||||
/* 0x0f0 */ u8 linkLossRecoveryState;
|
||||
/* 0x0f1 */ u8 status;
|
||||
/* 0x0f2 */ u16 unk_f2[6];
|
||||
/* 0x0fe */ u16 unk_fe;
|
||||
/* 0x0fe */ u16 resendExitStandbyTimer;
|
||||
/* 0x100 */ u16 unk_100;
|
||||
/* 0x102 */ u8 unk_102;
|
||||
/* 0x103 */ u8 filler_103[0x10A - 0x103];
|
||||
@ -203,11 +203,11 @@ bool32 Rfu_InitBlockSend(const u8 *src, size_t size);
|
||||
void ClearLinkRfuCallback(void);
|
||||
u8 Rfu_GetLinkPlayerCount(void);
|
||||
u8 Rfu_GetMultiplayerId(void);
|
||||
bool8 sub_8010100(u8 a0);
|
||||
bool8 Rfu_SendBlockRequest(u8 type);
|
||||
bool8 IsLinkRfuTaskFinished(void);
|
||||
bool8 Rfu_IsMaster(void);
|
||||
void task_add_05_task_del_08FA224_when_no_RfuFunc(void);
|
||||
void sub_8010434(void);
|
||||
void Rfu_SetCloseLinkCallback(void);
|
||||
void Rfu_SetLinkStandbyCallback(void);
|
||||
void ResetLinkRfuGFLayer(void);
|
||||
void UpdateWirelessStatusIndicatorSprite(void);
|
||||
void InitRFU(void);
|
||||
|
@ -886,9 +886,9 @@ void sub_80587B0(void)
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
if (gWirelessCommType == 0)
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
else
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
|
||||
gBattlerControllerFuncs[gActiveBattler] = sub_80586F8;
|
||||
}
|
||||
|
@ -1484,9 +1484,9 @@ static void CB2_PreInitMultiBattle(void)
|
||||
{
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
if (gWirelessCommType)
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
else
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
@ -2368,7 +2368,7 @@ static void sub_8038F34(void)
|
||||
case 6:
|
||||
if (IsLinkTaskFinished() == TRUE)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
BattlePutTextOnWindow(gText_LinkStandby3, 0);
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
}
|
||||
@ -2382,7 +2382,7 @@ static void sub_8038F34(void)
|
||||
break;
|
||||
case 8:
|
||||
if (!gWirelessCommType)
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
break;
|
||||
case 9:
|
||||
@ -2556,7 +2556,7 @@ static void sub_803939C(void)
|
||||
HandleBattleWindow(0x18, 8, 0x1D, 0xD, WINDOW_CLEAR);
|
||||
if (gMain.field_439_x4)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
BattlePutTextOnWindow(gText_LinkStandby3, 0);
|
||||
}
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
@ -2566,7 +2566,7 @@ static void sub_803939C(void)
|
||||
if (--gBattleCommunication[1] == 0)
|
||||
{
|
||||
if (gMain.field_439_x4 && !gWirelessCommType)
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
}
|
||||
break;
|
||||
@ -2605,7 +2605,7 @@ static void sub_803939C(void)
|
||||
{
|
||||
if (gMain.field_439_x4)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
BattlePutTextOnWindow(gText_LinkStandby3, 0);
|
||||
}
|
||||
gBattleCommunication[MULTIUSE_STATE]++;
|
||||
|
@ -2627,7 +2627,7 @@ static void LoadLinkMultiOpponentsData(void)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gSpecialVar_Result = 5;
|
||||
break;
|
||||
case 5:
|
||||
@ -2644,7 +2644,7 @@ static void LoadLinkMultiOpponentsData(void)
|
||||
static void sub_8164DCC(void)
|
||||
{
|
||||
if (gWirelessCommType != 0)
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
}
|
||||
|
||||
static void SetMultiPartnerGfx(void)
|
||||
|
@ -1230,7 +1230,7 @@ static void sub_8080018(void)
|
||||
sBerryBlenderData->field_114 = 0;
|
||||
Blender_CopyBerryData(&sBerryBlenderData->blendedBerries[0], gSpecialVar_ItemId);
|
||||
memcpy(gBlockSendBuffer, &sBerryBlenderData->blendedBerries[0], sizeof(struct BlenderBerry));
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sBerryBlenderData->framesToWait = 0;
|
||||
break;
|
||||
case 9:
|
||||
@ -1238,7 +1238,7 @@ static void sub_8080018(void)
|
||||
{
|
||||
ResetBlockReceivedFlags();
|
||||
if (GetMultiplayerId() == 0)
|
||||
sub_800A4D8(4);
|
||||
SendBlockRequest(4);
|
||||
sBerryBlenderData->mainState++;
|
||||
}
|
||||
break;
|
||||
@ -1332,7 +1332,7 @@ static void sub_8080018(void)
|
||||
sBerryBlenderData->mainState++;
|
||||
break;
|
||||
case 19:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sBerryBlenderData->mainState++;
|
||||
break;
|
||||
case 20:
|
||||
@ -2587,7 +2587,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
|
||||
switch (sBerryBlenderData->field_1A0)
|
||||
{
|
||||
case 0:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sBerryBlenderData->field_1A0 = 1;
|
||||
sBerryBlenderData->framesToWait = 0;
|
||||
break;
|
||||
@ -2606,7 +2606,7 @@ static bool8 LinkPlayAgainHandleSaving(void)
|
||||
case 3:
|
||||
if (++sBerryBlenderData->framesToWait == 10)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sBerryBlenderData->field_1A0++;
|
||||
}
|
||||
break;
|
||||
@ -2682,7 +2682,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
|
||||
break;
|
||||
case 5:
|
||||
Blender_PrintText(&sBerryBlenderData->textState, gText_SavingDontTurnOff2, 0);
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sBerryBlenderData->gameEndState++;
|
||||
break;
|
||||
case 6:
|
||||
@ -2702,7 +2702,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
|
||||
break;
|
||||
case 8:
|
||||
sBerryBlenderData->gameEndState++;
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
break;
|
||||
case 9:
|
||||
if (IsLinkTaskFinished())
|
||||
@ -2732,7 +2732,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
|
||||
case 11:
|
||||
if (++sBerryBlenderData->framesToWait > 30)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
sBerryBlenderData->gameEndState++;
|
||||
}
|
||||
break;
|
||||
|
@ -1125,7 +1125,7 @@ int sub_802130C(void)
|
||||
switch (var0->unkC)
|
||||
{
|
||||
case 0:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 1:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2027,7 +2027,7 @@ static u32 sub_8022CB0(struct BerryCrushGame *r4, u8 *r5)
|
||||
r4->unkC = 3;
|
||||
return 0;
|
||||
case 1:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
++r4->unkC;
|
||||
return 0;
|
||||
case 2:
|
||||
@ -2110,7 +2110,7 @@ static u32 sub_8022E5C(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1
|
||||
switch (r4->unkC)
|
||||
{
|
||||
case 0:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 1:
|
||||
if (IsLinkTaskFinished())
|
||||
@ -2167,7 +2167,7 @@ static u32 sub_8022F1C(struct BerryCrushGame *r5, u8 *r2)
|
||||
sub_8022BEC(3, 1, NULL);
|
||||
return 0;
|
||||
case 1:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 2:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2213,7 +2213,7 @@ static u32 sub_8023070(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r
|
||||
{
|
||||
case 0:
|
||||
sub_80214A8(r4, &r4->unk138);
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 1:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2233,7 +2233,7 @@ static u32 sub_8023070(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r
|
||||
return 0;
|
||||
r4->unk138.unk38[r4->unk138.unk0] = NULL;
|
||||
++r4->unk138.unk0;
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 4:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2247,7 +2247,7 @@ static u32 sub_8023070(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r
|
||||
break;
|
||||
case 5:
|
||||
sub_80216A8(r4, &r4->unk138);
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 6:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2295,7 +2295,7 @@ static u32 sub_80231B8(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 3:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2323,7 +2323,7 @@ static u32 sub_80232EC(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r
|
||||
return 0;
|
||||
// fallthrough
|
||||
case 0:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 3:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -2703,7 +2703,7 @@ static u32 sub_8023A30(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1
|
||||
case 4:
|
||||
if (!sub_80218D4(r4, &r4->unk138))
|
||||
return 0;
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
r4->unk10 = 0;
|
||||
break;
|
||||
case 5:
|
||||
@ -2737,7 +2737,7 @@ static u32 sub_8023BC0(struct BerryCrushGame *r5, u8 *r6)
|
||||
case 2:
|
||||
if (!sub_80218D4(r5, &r5->unk138))
|
||||
return 0;
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
r5->unk10 = 0;
|
||||
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
|
||||
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
|
||||
@ -3005,7 +3005,7 @@ static u32 sub_8024134(struct BerryCrushGame *r5, u8 *r4)
|
||||
r5->unkC = 0;
|
||||
return 0;
|
||||
case 1:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 2:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -3084,7 +3084,7 @@ static u32 sub_80242E0(struct BerryCrushGame *r4, __attribute__((unused)) u8 *r1
|
||||
switch (r4->unkC)
|
||||
{
|
||||
case 0:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 1:
|
||||
if (!IsLinkTaskFinished())
|
||||
@ -3184,12 +3184,12 @@ static u32 sub_8024508(struct BerryCrushGame *r5, __attribute__((unused)) u8 *r1
|
||||
switch (r5->unkC)
|
||||
{
|
||||
case 0:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
break;
|
||||
case 1:
|
||||
if (!IsLinkTaskFinished())
|
||||
return 0;
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
break;
|
||||
case 2:
|
||||
if (gReceivedRemoteLinkPlayers != 0)
|
||||
|
@ -203,7 +203,7 @@ static void sub_80B2600(u8 taskId)
|
||||
gTasks[taskId].data[0]++;
|
||||
if (gTasks[taskId].data[0] == 10)
|
||||
{
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
@ -357,7 +357,7 @@ static void Task_LinkupExchangeDataWithLeader(u8 taskId)
|
||||
if (gSpecialVar_Result == LINKUP_DIFF_SELECTIONS
|
||||
|| gSpecialVar_Result == LINKUP_WRONG_NUM_PLAYERS)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
HideFieldMessageBox();
|
||||
gTasks[taskId].func = Task_StopLinkup;
|
||||
}
|
||||
@ -392,7 +392,7 @@ static void Task_LinkupCheckStatusAfterConfirm(u8 taskId)
|
||||
{
|
||||
if (!Link_AnyPartnersPlayingRubyOrSapphire())
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
HideFieldMessageBox();
|
||||
gTasks[taskId].func = Task_StopLinkup;
|
||||
}
|
||||
@ -405,7 +405,7 @@ static void Task_LinkupCheckStatusAfterConfirm(u8 taskId)
|
||||
}
|
||||
else if (gSpecialVar_Result == LINKUP_DIFF_SELECTIONS)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
HideFieldMessageBox();
|
||||
gTasks[taskId].func = Task_StopLinkup;
|
||||
}
|
||||
@ -426,7 +426,7 @@ static void Task_LinkupCheckStatusAfterConfirm(u8 taskId)
|
||||
card->monSpecies[0] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[0] - 1], MON_DATA_SPECIES, NULL);
|
||||
card->monSpecies[1] = GetMonData(&gPlayerParty[gSelectedOrderFromParty[1] - 1], MON_DATA_SPECIES, NULL);
|
||||
gTasks[taskId].func = Task_LinkupAwaitTrainerCardData;
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,7 +481,7 @@ static void FinishLinkup(u16 *linkupStatus, u32 taskId)
|
||||
{
|
||||
// Unsuccessful battle tower linkup
|
||||
*linkupStatus = LINKUP_FAILED_BATTLE_TOWER;
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gTasks[taskId].func = Task_StopLinkup;
|
||||
}
|
||||
else
|
||||
@ -503,7 +503,7 @@ static void FinishLinkup(u16 *linkupStatus, u32 taskId)
|
||||
else
|
||||
{
|
||||
// Unsuccessful linkup
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gTasks[taskId].func = Task_StopLinkup;
|
||||
}
|
||||
}
|
||||
@ -686,7 +686,7 @@ static void Task_ValidateMixingGameLanguage(u8 taskId)
|
||||
if (mixingForeignGames)
|
||||
{
|
||||
gSpecialVar_Result = LINKUP_FOREIGN_GAME;
|
||||
sub_800AD10();
|
||||
SetCloseLinkCallbackHandleJP();
|
||||
gTasks[taskId].tState = 1;
|
||||
return;
|
||||
}
|
||||
@ -856,7 +856,7 @@ static void Task_StartWiredCableClubBattle(u8 taskId)
|
||||
task->tState++;
|
||||
break;
|
||||
case 3:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
task->tState++;
|
||||
break;
|
||||
case 4:
|
||||
@ -919,7 +919,7 @@ static void Task_StartWirelessCableClubBattle(u8 taskId)
|
||||
tState = 5;
|
||||
break;
|
||||
case 5:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
tState = 6;
|
||||
break;
|
||||
case 6:
|
||||
@ -974,7 +974,7 @@ static void CB2_ReturnFromUnionRoomBattle(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gMain.state = 1;
|
||||
}
|
||||
break;
|
||||
@ -1113,7 +1113,7 @@ static void Task_StartWiredTrade(u8 taskId)
|
||||
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
|
||||
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
|
||||
m4aMPlayAllStop();
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
task->tState++;
|
||||
break;
|
||||
case 3:
|
||||
@ -1146,7 +1146,7 @@ static void Task_StartWirelessTrade(u8 taskId)
|
||||
gSelectedTradeMonPositions[TRADE_PLAYER] = 0;
|
||||
gSelectedTradeMonPositions[TRADE_PARTNER] = 0;
|
||||
m4aMPlayAllStop();
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
tState++;
|
||||
break;
|
||||
case 3:
|
||||
@ -1264,7 +1264,7 @@ static void sub_80B3AAC(u8 taskId)
|
||||
// Unused
|
||||
static void sub_80B3AD0(u8 taskId)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gTasks[taskId].func = sub_80B3AAC;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ static void Task_EndCommunicateMoveSelections(u8 taskId);
|
||||
static void Task_HideMoveSelectScreen(u8 taskId);
|
||||
static void Task_HideApplauseMeterForAppealStart(u8 taskId);
|
||||
static void Task_WaitHideApplauseMeterForAppealStart(u8 taskId);
|
||||
static void sub_80D8A88(u8 taskId);
|
||||
static void Task_AppealSetup(u8 taskId);
|
||||
static void Task_DoAppeals(u8 taskId);
|
||||
static void sub_80DA110(u8);
|
||||
static void sub_80DA134(struct Sprite *);
|
||||
@ -94,7 +94,7 @@ static void Task_CommunicateFinalStandings(u8);
|
||||
static void Task_EndCommunicateFinalStandings(u8);
|
||||
static void Task_ContestReturnToField(u8);
|
||||
static void FieldCB_ContestReturnToField(void);
|
||||
static bool8 sub_80DA8A4(void);
|
||||
static bool8 IsPlayerLinkLeader(void);
|
||||
static void PrintContestantTrainerName(u8);
|
||||
static void PrintContestantTrainerNameWithColor(u8 a0, u8 a1);
|
||||
static void PrintContestantMonName(u8);
|
||||
@ -250,7 +250,7 @@ EWRAM_DATA u8 gContestantTurnOrder[CONTESTANT_COUNT] = {0};
|
||||
EWRAM_DATA u8 gLinkContestFlags = 0;
|
||||
// Bit 0: Is a link contest
|
||||
// Bit 1: Link contest uses wireless adapter
|
||||
EWRAM_DATA u8 gUnknown_02039F2B = 0;
|
||||
EWRAM_DATA u8 gContestLinkLeaderIndex = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_ContestCategory = 0;
|
||||
EWRAM_DATA u16 gSpecialVar_ContestRank = 0;
|
||||
EWRAM_DATA u8 gNumLinkContestPlayers = 0;
|
||||
@ -1118,7 +1118,7 @@ static void Task_TryStartLinkContest(u8 taskId)
|
||||
case 1:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
return;
|
||||
@ -1566,16 +1566,16 @@ static void Task_HideApplauseMeterForAppealStart(u8 taskId)
|
||||
static void Task_WaitHideApplauseMeterForAppealStart(u8 taskId)
|
||||
{
|
||||
if (!eContest.applauseMeterIsMoving && !eContest.sliderHeartsAnimating)
|
||||
gTasks[taskId].func = sub_80D8A88;
|
||||
gTasks[taskId].func = Task_AppealSetup;
|
||||
}
|
||||
|
||||
static void sub_80D8A88(u8 taskId)
|
||||
static void Task_AppealSetup(u8 taskId)
|
||||
{
|
||||
if (++gTasks[taskId].data[0] > 19)
|
||||
{
|
||||
eContest.turnNumber = 0;
|
||||
eContest.unk1921C = gRngValue;
|
||||
if ((gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) && sub_80DA8A4())
|
||||
if ((gLinkContestFlags & LINK_CONTEST_FLAG_IS_LINK) && IsPlayerLinkLeader())
|
||||
{
|
||||
s32 i;
|
||||
|
||||
@ -1611,7 +1611,7 @@ static void Task_DoAppeals(u8 taskId)
|
||||
u8 taskId2;
|
||||
|
||||
eContest.unk1920B_2 = 1;
|
||||
if (sub_80DA8A4())
|
||||
if (IsPlayerLinkLeader())
|
||||
sub_80DD080(eContest.currentContestant);
|
||||
taskId2 = CreateTask(sub_80FCC88, 0);
|
||||
SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110);
|
||||
@ -2339,7 +2339,7 @@ static void sub_80DA198(u8 taskId)
|
||||
u8 taskId2;
|
||||
|
||||
eContest.unk1920B_2 = 1;
|
||||
if (sub_80DA8A4())
|
||||
if (IsPlayerLinkLeader())
|
||||
{
|
||||
RankContestants();
|
||||
SetAttentionLevels();
|
||||
@ -2619,9 +2619,9 @@ static void TryPutPlayerLast(void)
|
||||
gContestPlayerMonIndex = CONTESTANT_COUNT - 1;
|
||||
}
|
||||
|
||||
static bool8 sub_80DA8A4(void)
|
||||
static bool8 IsPlayerLinkLeader(void)
|
||||
{
|
||||
if (gContestPlayerMonIndex == gUnknown_02039F2B)
|
||||
if (gContestPlayerMonIndex == gContestLinkLeaderIndex)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@ -2902,7 +2902,7 @@ static void PrintContestantMonNameWithColor(u8 contestant, u8 color)
|
||||
Contest_PrintTextToBg0WindowAt(gContestantTurnOrder[contestant], gDisplayedStringBattle, 5, 1, 7);
|
||||
}
|
||||
|
||||
static u16 sub_80DAFE0(u8 who, u8 contestCategory)
|
||||
static u16 CalculateContestantRound1Points(u8 who, u8 contestCategory)
|
||||
{
|
||||
u8 statMain;
|
||||
u8 statSub1;
|
||||
@ -2940,12 +2940,12 @@ static u16 sub_80DAFE0(u8 who, u8 contestCategory)
|
||||
return statMain + (statSub1 + statSub2 + gContestMons[who].sheen) / 2;
|
||||
}
|
||||
|
||||
void sub_80DB09C(u8 contestCategory)
|
||||
void CalculateRound1Points(u8 contestCategory)
|
||||
{
|
||||
s32 i;
|
||||
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
gContestMonRound1Points[i] = sub_80DAFE0(i, contestCategory);
|
||||
gContestMonRound1Points[i] = CalculateContestantRound1Points(i, contestCategory);
|
||||
}
|
||||
|
||||
static u8 sub_80DB0C4(void)
|
||||
@ -4252,13 +4252,12 @@ static void sub_80DD080(u8 contestant)
|
||||
u16 move;
|
||||
u8 effect;
|
||||
u8 rnd;
|
||||
bool8 r8;
|
||||
bool8 canUseTurn;
|
||||
s32 i;
|
||||
|
||||
eContestantStatus[contestant].appeal2 = 0;
|
||||
eContestantStatus[contestant].appeal1 = 0;
|
||||
r8 = ContestantCanUseTurn(contestant);
|
||||
if (!r8)
|
||||
if (!ContestantCanUseTurn(contestant))
|
||||
return;
|
||||
|
||||
move = eContestantStatus[contestant].currMove;
|
||||
@ -4974,7 +4973,7 @@ static void sub_80DE4A8(u8 taskId)
|
||||
u8 taskId2;
|
||||
|
||||
eContest.unk1920B_2 = 1;
|
||||
if (sub_80DA8A4())
|
||||
if (IsPlayerLinkLeader())
|
||||
sub_80DBAA0();
|
||||
taskId2 = CreateTask(sub_80FCC88, 0);
|
||||
SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110);
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "contest_link.h"
|
||||
#include "constants/flags.h"
|
||||
|
||||
static void sub_80FC5C0(u8);
|
||||
static void sub_80FC5DC(u8);
|
||||
static void Task_LinkContest_StartInitFlags(u8);
|
||||
static void Task_LinkContest_InitFlags(u8);
|
||||
|
||||
#define tState data[0]
|
||||
#define tCategory data[9]
|
||||
@ -52,7 +52,7 @@ bool8 LinkContest_GetBlockReceivedFromAllPlayers(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FC580(u8 taskId)
|
||||
void Task_LinkContest_Init(u8 taskId)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@ -60,15 +60,15 @@ void sub_80FC580(u8 taskId)
|
||||
gBlockRecvBuffer[i][0] = 0xFF;
|
||||
|
||||
gTasks[taskId].tState = 0;
|
||||
gTasks[taskId].func = sub_80FC5C0;
|
||||
gTasks[taskId].func = Task_LinkContest_StartInitFlags;
|
||||
}
|
||||
|
||||
static void sub_80FC5C0(u8 taskId)
|
||||
static void Task_LinkContest_StartInitFlags(u8 taskId)
|
||||
{
|
||||
gTasks[taskId].func = sub_80FC5DC;
|
||||
gTasks[taskId].func = Task_LinkContest_InitFlags;
|
||||
}
|
||||
|
||||
static void sub_80FC5DC(u8 taskId)
|
||||
static void Task_LinkContest_InitFlags(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -91,8 +91,9 @@ static void sub_80FC5DC(u8 taskId)
|
||||
SwitchTaskToFollowupFunc(taskId);
|
||||
}
|
||||
|
||||
bool32 sub_80FC670(s16 *state)
|
||||
bool32 LinkContest_TryLinkStandby(s16 *state)
|
||||
{
|
||||
// Skip standby for RS cabled links
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
|
||||
return TRUE;
|
||||
|
||||
@ -101,7 +102,7 @@ bool32 sub_80FC670(s16 *state)
|
||||
case 0:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
(*state)++;
|
||||
}
|
||||
return FALSE;
|
||||
@ -116,16 +117,17 @@ bool32 sub_80FC670(s16 *state)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FC6BC(u8 taskId)
|
||||
void Task_LinkContest_CommunicateMonsRS(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].tState)
|
||||
{
|
||||
case 0:
|
||||
// Send players mon
|
||||
if (GetMultiplayerId() == 0)
|
||||
{
|
||||
if (IsLinkTaskFinished())
|
||||
@ -141,6 +143,7 @@ void sub_80FC6BC(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// Wait for other players data
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
@ -153,9 +156,10 @@ void sub_80FC6BC(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
// Only if leader. Request other players data
|
||||
if (++gTasks[taskId].tTimer > 300)
|
||||
{
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
gTasks[taskId].tState = 1;
|
||||
}
|
||||
break;
|
||||
@ -168,7 +172,7 @@ void sub_80FC6BC(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FC804(u8 taskId)
|
||||
void Task_LinkContest_CommunicateRngRS(u8 taskId)
|
||||
{
|
||||
switch (gTasks[taskId].tState)
|
||||
{
|
||||
@ -198,11 +202,11 @@ void sub_80FC804(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FC894(u8 taskId)
|
||||
void Task_LinkContest_CommunicateCategoryRS(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].tState)
|
||||
@ -231,7 +235,7 @@ void sub_80FC894(u8 taskId)
|
||||
case 10:
|
||||
if (++gTasks[taskId].tTimer > 10)
|
||||
{
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
gTasks[taskId].tState = 1;
|
||||
}
|
||||
break;
|
||||
@ -311,7 +315,7 @@ void Task_LinkContest_CommunicateFinalStandings(u8 taskId)
|
||||
case 1:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonTotalPoints));
|
||||
memcpy(gContestMonTotalPoints, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestMonTotalPoints));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -335,7 +339,7 @@ void Task_LinkContest_CommunicateFinalStandings(u8 taskId)
|
||||
case 4:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestMonAppealPointTotals, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonAppealPointTotals));
|
||||
memcpy(gContestMonAppealPointTotals, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestMonAppealPointTotals));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -349,7 +353,7 @@ void Task_LinkContest_CommunicateFinalStandings(u8 taskId)
|
||||
case 7:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestMonRound2Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound2Points));
|
||||
memcpy(gContestMonRound2Points, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestMonRound2Points));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -363,7 +367,7 @@ void Task_LinkContest_CommunicateFinalStandings(u8 taskId)
|
||||
case 10:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestFinalStandings, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestFinalStandings));
|
||||
memcpy(gContestFinalStandings, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestFinalStandings));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -388,7 +392,7 @@ void sub_80FCC88(u8 taskId)
|
||||
case 1:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(eContestantStatus, gBlockRecvBuffer[gUnknown_02039F2B], CONTESTANT_COUNT * sizeof(struct ContestantStatus));
|
||||
memcpy(eContestantStatus, gBlockRecvBuffer[gContestLinkLeaderIndex], CONTESTANT_COUNT * sizeof(struct ContestantStatus));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -412,7 +416,7 @@ void sub_80FCC88(u8 taskId)
|
||||
case 4:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestResources->field_8, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct7));
|
||||
memcpy(gContestResources->field_8, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(struct UnknownContestStruct7));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -426,7 +430,7 @@ void sub_80FCC88(u8 taskId)
|
||||
case 7:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestResources->field_10, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(struct UnknownContestStruct5));
|
||||
memcpy(gContestResources->field_10, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(struct UnknownContestStruct5));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -440,7 +444,7 @@ void sub_80FCC88(u8 taskId)
|
||||
case 10:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder));
|
||||
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestantTurnOrder));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -451,11 +455,11 @@ void sub_80FCC88(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_80FCE48(u8 taskId)
|
||||
void Task_LinkContest_CommunicateLeaderIdsRS(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].tState)
|
||||
@ -484,7 +488,7 @@ void sub_80FCE48(u8 taskId)
|
||||
case 10:
|
||||
if (++gTasks[taskId].tTimer > 10)
|
||||
{
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
gTasks[taskId].tState = 1;
|
||||
}
|
||||
break;
|
||||
@ -499,7 +503,7 @@ void sub_80FCE48(u8 taskId)
|
||||
|
||||
void Task_LinkContest_CommunicateRound1Points(u8 taskId)
|
||||
{
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].tState)
|
||||
@ -514,7 +518,7 @@ void Task_LinkContest_CommunicateRound1Points(u8 taskId)
|
||||
case 1:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestMonRound1Points, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestMonRound1Points));
|
||||
memcpy(gContestMonRound1Points, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestMonRound1Points));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
@ -528,7 +532,7 @@ void Task_LinkContest_CommunicateRound1Points(u8 taskId)
|
||||
|
||||
void Task_LinkContest_CommunicateTurnOrder(u8 taskId)
|
||||
{
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].tState)
|
||||
@ -543,7 +547,7 @@ void Task_LinkContest_CommunicateTurnOrder(u8 taskId)
|
||||
case 1:
|
||||
if (LinkContest_GetBlockReceivedFromAllPlayers())
|
||||
{
|
||||
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gUnknown_02039F2B], sizeof(gContestantTurnOrder));
|
||||
memcpy(gContestantTurnOrder, gBlockRecvBuffer[gContestLinkLeaderIndex], sizeof(gContestantTurnOrder));
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
break;
|
||||
|
@ -6,21 +6,31 @@
|
||||
#include "random.h"
|
||||
#include "task.h"
|
||||
|
||||
static void sub_81D9F14(u8);
|
||||
static void sub_81D9F30(u8);
|
||||
static void sub_81D9F4C(u8);
|
||||
static void sub_81D9F68(u8);
|
||||
static void sub_81DA10C(u8);
|
||||
static void sub_81DA138(u8);
|
||||
static void sub_81DA160(u8);
|
||||
static void sub_81DA244(u8);
|
||||
static void sub_81DA2E8(u8);
|
||||
static void sub_81DA3B8(u8);
|
||||
static void sub_81DA488(u8);
|
||||
/*
|
||||
The functions in this file handle preliminary communication
|
||||
for Emerald-only link contests. If the link contest has an RS
|
||||
player linked, none of these functions are used.
|
||||
|
||||
The equivalent functions for RS-linked contests are spread
|
||||
between contest_link.c and contest_util.c, and are suffixed RS
|
||||
instead of Em
|
||||
*/
|
||||
|
||||
static void Task_LinkContest_CommunicateMonsEm(u8);
|
||||
static void Task_LinkContest_StartCommunicateRngEm(u8);
|
||||
static void Task_LinkContest_CommunicateRngEm(u8);
|
||||
static void Task_LinkContest_StartCommunicateLeaderIdsEm(u8);
|
||||
static void Task_LinkContest_CommunicateLeaderIdsEm(u8);
|
||||
static void Task_LinkContest_StartCommunicateCategoryEm(u8);
|
||||
static void Task_LinkContest_CommunicateCategoryEm(u8);
|
||||
static void Task_LinkContest_SetUpContestEm(u8);
|
||||
static void Task_LinkContest_CommunicateAIMonsEm(u8);
|
||||
static void Task_LinkContest_CalculateRound1Em(u8);
|
||||
static void Task_LinkContest_CalculateTurnOrderEm(u8);
|
||||
|
||||
#define tCategory data[9]
|
||||
|
||||
void sub_81D9DE4(u8 taskId)
|
||||
void Task_LinkContest_StartCommunicationEm(u8 taskId)
|
||||
{
|
||||
int gameCleared;
|
||||
|
||||
@ -47,57 +57,51 @@ void sub_81D9DE4(u8 taskId)
|
||||
gContestMons[gContestPlayerMonIndex].highestRank = gHighestRibbonRank;
|
||||
gameCleared = FlagGet(FLAG_SYS_GAME_CLEAR) > 0;
|
||||
gContestMons[gContestPlayerMonIndex].gameCleared = gameCleared;
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81DA160, sub_81D9F14);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateMonsEm, Task_LinkContest_StartCommunicateRngEm);
|
||||
}
|
||||
|
||||
static void sub_81D9F14(u8 taskId)
|
||||
static void Task_LinkContest_StartCommunicateRngEm(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81DA244, sub_81D9F30);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRngEm, Task_LinkContest_StartCommunicateLeaderIdsEm);
|
||||
}
|
||||
|
||||
static void sub_81D9F30(u8 taskId)
|
||||
static void Task_LinkContest_StartCommunicateLeaderIdsEm(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81DA2E8, sub_81D9F4C);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateLeaderIdsEm, Task_LinkContest_StartCommunicateCategoryEm);
|
||||
}
|
||||
|
||||
static void sub_81D9F4C(u8 taskId)
|
||||
static void Task_LinkContest_StartCommunicateCategoryEm(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81DA3B8, sub_81D9F68);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateCategoryEm, Task_LinkContest_SetUpContestEm);
|
||||
}
|
||||
|
||||
static void sub_81D9F68(u8 taskId)
|
||||
static void Task_LinkContest_SetUpContestEm(u8 taskId)
|
||||
{
|
||||
u8 i;
|
||||
u8 rank;
|
||||
int gameCleared;
|
||||
u8 contestCategories[CONTESTANT_COUNT];
|
||||
u8 data2[CONTESTANT_COUNT];
|
||||
u8 categories[CONTESTANT_COUNT];
|
||||
u8 leaderIds[CONTESTANT_COUNT];
|
||||
|
||||
memset(contestCategories, 0, sizeof(contestCategories));
|
||||
memset(data2, 0, sizeof(data2));
|
||||
memset(categories, 0, sizeof(categories));
|
||||
memset(leaderIds, 0, sizeof(leaderIds));
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
contestCategories[i] = gTasks[taskId].data[i + 1];
|
||||
categories[i] = gTasks[taskId].data[i + 1];
|
||||
|
||||
// Ensure all players are doing the same category
|
||||
i = 0;
|
||||
if (i < gNumLinkContestPlayers)
|
||||
{
|
||||
while (++i < gNumLinkContestPlayers)
|
||||
{
|
||||
if (contestCategories[0] != contestCategories[i])
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < gNumLinkContestPlayers && categories[0] == categories[i]; i++)
|
||||
;
|
||||
|
||||
if (i == gNumLinkContestPlayers)
|
||||
gSpecialVar_0x8004 = FALSE;
|
||||
gSpecialVar_0x8004 = FALSE; // Category choices the same
|
||||
else
|
||||
gSpecialVar_0x8004 = TRUE;
|
||||
gSpecialVar_0x8004 = TRUE; // Category choices differ
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
data2[i] = gTasks[taskId].data[i + 5];
|
||||
leaderIds[i] = gTasks[taskId].data[i + 5];
|
||||
|
||||
// If < 4 players and player is leader, set AI contestants based on rank and game clear
|
||||
if (gNumLinkContestPlayers != CONTESTANT_COUNT && GetMultiplayerId() == 0)
|
||||
{
|
||||
rank = gContestMons[0].highestRank;
|
||||
@ -110,43 +114,45 @@ static void sub_81D9F68(u8 taskId)
|
||||
if (rank)
|
||||
rank--;
|
||||
|
||||
gameCleared = 1;
|
||||
gameCleared = TRUE;
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
{
|
||||
if (!gContestMons[i].gameCleared)
|
||||
{
|
||||
gameCleared = 0;
|
||||
gameCleared = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetLinkAIContestants(contestCategories[0], rank, gameCleared);
|
||||
SetLinkAIContestants(categories[0], rank, gameCleared);
|
||||
}
|
||||
|
||||
gUnknown_02039F2B = sub_80F86E0(data2);
|
||||
// Assign link leader. After initial communication all players will read data only from them
|
||||
gContestLinkLeaderIndex = LinkContest_GetLeaderIndex(leaderIds);
|
||||
|
||||
if (gNumLinkContestPlayers < CONTESTANT_COUNT)
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_81DA488, sub_81DA10C);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateAIMonsEm, Task_LinkContest_CalculateRound1Em);
|
||||
else
|
||||
gTasks[taskId].func = sub_81DA10C;
|
||||
gTasks[taskId].func = Task_LinkContest_CalculateRound1Em;
|
||||
}
|
||||
|
||||
static void sub_81DA10C(u8 taskId)
|
||||
static void Task_LinkContest_CalculateRound1Em(u8 taskId)
|
||||
{
|
||||
sub_80DB09C(gSpecialVar_ContestCategory);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRound1Points, sub_81DA138);
|
||||
CalculateRound1Points(gSpecialVar_ContestCategory);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRound1Points, Task_LinkContest_CalculateTurnOrderEm);
|
||||
}
|
||||
|
||||
static void sub_81DA138(u8 taskId)
|
||||
static void Task_LinkContest_CalculateTurnOrderEm(u8 taskId)
|
||||
{
|
||||
SortContestants(FALSE);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateTurnOrder, sub_80F8714);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateTurnOrder, Task_LinkContest_FinalizeConnection);
|
||||
}
|
||||
|
||||
static void sub_81DA160(u8 taskId)
|
||||
static void Task_LinkContest_CommunicateMonsEm(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
@ -178,9 +184,9 @@ static void sub_81DA160(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81DA244(u8 taskId)
|
||||
static void Task_LinkContest_CommunicateRngEm(u8 taskId)
|
||||
{
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
@ -193,6 +199,7 @@ static void sub_81DA244(u8 taskId)
|
||||
case 0:
|
||||
if (GetMultiplayerId() == 0)
|
||||
{
|
||||
// Only the leader sends the RNG seed
|
||||
if (!IsLinkTaskFinished())
|
||||
return;
|
||||
|
||||
@ -201,10 +208,12 @@ static void sub_81DA244(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Other link members skip to waiting
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
// Wait to receive RNG data
|
||||
if (LinkContest_GetBlockReceived(0))
|
||||
{
|
||||
memcpy(&gRngValue, gBlockRecvBuffer[0], sizeof(gRngValue));
|
||||
@ -215,13 +224,13 @@ static void sub_81DA244(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81DA2E8(u8 taskId)
|
||||
static void Task_LinkContest_CommunicateLeaderIdsEm(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
u16 data[4];
|
||||
u16 var0;
|
||||
u16 data[CONTESTANT_COUNT];
|
||||
u16 leaderId;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
@ -234,8 +243,8 @@ static void sub_81DA2E8(u8 taskId)
|
||||
case 0:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
var0 = 0x6E;
|
||||
if (LinkContest_SendBlock(&var0, sizeof(var0)) == 1)
|
||||
leaderId = 0x6E;
|
||||
if (LinkContest_SendBlock(&leaderId, sizeof(leaderId)) == 1)
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
break;
|
||||
@ -254,13 +263,13 @@ static void sub_81DA2E8(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81DA3B8(u8 taskId)
|
||||
static void Task_LinkContest_CommunicateCategoryEm(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
u16 data[CONTESTANT_COUNT];
|
||||
u16 category;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
@ -293,11 +302,11 @@ static void sub_81DA3B8(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_81DA488(u8 taskId)
|
||||
static void Task_LinkContest_CommunicateAIMonsEm(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!sub_80FC670(&gTasks[taskId].data[12]))
|
||||
if (!LinkContest_TryLinkStandby(&gTasks[taskId].data[12]))
|
||||
return;
|
||||
|
||||
switch (gTasks[taskId].data[0])
|
||||
|
@ -151,14 +151,14 @@ static void Task_CreateConfetti(u8);
|
||||
static void SpriteCB_TextBoxSlideIn(struct Sprite *);
|
||||
static void SpriteCB_TextBoxSlideOut(struct Sprite *);
|
||||
static void SpriteCB_EndTextBoxSlideIn(struct Sprite *);
|
||||
static void sub_80F8508(u8);
|
||||
static void sub_80F8568(u8);
|
||||
static void sub_80F8584(u8);
|
||||
static void sub_80F85A0(u8);
|
||||
static void sub_80F85BC(u8);
|
||||
static void sub_80F86B8(u8);
|
||||
static void sub_80F878C(u8);
|
||||
static void sub_80F87B4(u8);
|
||||
static void Task_StartCommunication(u8);
|
||||
static void Task_StartCommunicateRngRS(u8);
|
||||
static void Task_StartCommunicateLeaderIdsRS(u8);
|
||||
static void Task_StartCommunicateCategoryRS(u8);
|
||||
static void Task_LinkContest_SetUpContestRS(u8);
|
||||
static void Task_LinkContest_CalculateTurnOrderRS(u8);
|
||||
static void Task_LinkContest_Disconnect(u8);
|
||||
static void Task_LinkContest_WaitDisconnect(u8);
|
||||
static void SpriteCB_Confetti(struct Sprite *sprite);
|
||||
|
||||
static const u16 sUnknown_0858D6B0[] = INCBIN_U16("graphics/unknown/unknown_58D6B0.gbapal");
|
||||
@ -602,7 +602,7 @@ static void Task_ShowContestResults(u8 taskId)
|
||||
case 2:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
gTasks[taskId].tState++;
|
||||
}
|
||||
return;
|
||||
@ -975,7 +975,7 @@ static void Task_TryDisconnectLinkPartners(u8 taskId)
|
||||
if (!gTasks[taskId].data[10])
|
||||
{
|
||||
ShowLinkResultsTextBox(gText_CommunicationStandby);
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gTasks[taskId].func = Task_WaitForLinkPartnersDisconnect;
|
||||
}
|
||||
}
|
||||
@ -2207,7 +2207,7 @@ void TryEnterContestMon(void)
|
||||
if (eligibility)
|
||||
{
|
||||
SetContestants(gSpecialVar_ContestCategory, gSpecialVar_ContestRank);
|
||||
sub_80DB09C(gSpecialVar_ContestCategory);
|
||||
CalculateRound1Points(gSpecialVar_ContestCategory);
|
||||
}
|
||||
|
||||
gSpecialVar_Result = eligibility;
|
||||
@ -2409,103 +2409,102 @@ void ContestLinkTransfer(u8 category)
|
||||
{
|
||||
u8 newTaskId;
|
||||
ScriptContext2_Enable();
|
||||
newTaskId = CreateTask(sub_80FC580, 0);
|
||||
SetTaskFuncWithFollowupFunc(newTaskId, sub_80FC580, sub_80F8508);
|
||||
newTaskId = CreateTask(Task_LinkContest_Init, 0);
|
||||
SetTaskFuncWithFollowupFunc(newTaskId, Task_LinkContest_Init, Task_StartCommunication);
|
||||
gTasks[newTaskId].data[9] = category;
|
||||
}
|
||||
|
||||
static void sub_80F8508(u8 taskId)
|
||||
static void Task_StartCommunication(u8 taskId)
|
||||
{
|
||||
if (gLinkContestFlags & LINK_CONTEST_FLAG_HAS_RS_PLAYER)
|
||||
{
|
||||
CreateContestMonFromParty(gContestMonPartyIndex);
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80FC6BC, sub_80F8568);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateMonsRS, Task_StartCommunicateRngRS);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateContestMonFromParty(gContestMonPartyIndex);
|
||||
gTasks[taskId].func = sub_81D9DE4;
|
||||
gTasks[taskId].func = Task_LinkContest_StartCommunicationEm;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80F8568(u8 taskId)
|
||||
static void Task_StartCommunicateRngRS(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80FC804, sub_80F8584);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRngRS, Task_StartCommunicateLeaderIdsRS);
|
||||
}
|
||||
|
||||
static void sub_80F8584(u8 taskId)
|
||||
static void Task_StartCommunicateLeaderIdsRS(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80FCE48, sub_80F85A0);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateLeaderIdsRS, Task_StartCommunicateCategoryRS);
|
||||
}
|
||||
|
||||
static void sub_80F85A0(u8 taskId)
|
||||
static void Task_StartCommunicateCategoryRS(u8 taskId)
|
||||
{
|
||||
SetTaskFuncWithFollowupFunc(taskId, sub_80FC894, sub_80F85BC);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateCategoryRS, Task_LinkContest_SetUpContestRS);
|
||||
}
|
||||
|
||||
static void sub_80F85BC(u8 taskId)
|
||||
static void Task_LinkContest_SetUpContestRS(u8 taskId)
|
||||
{
|
||||
u8 i;
|
||||
u8 sp0[4];
|
||||
u8 sp4[4];
|
||||
u8 categories[CONTESTANT_COUNT];
|
||||
u8 leaderIds[CONTESTANT_COUNT];
|
||||
|
||||
memset(sp0, 0, sizeof(sp0));
|
||||
memset(sp4, 0, sizeof(sp4));
|
||||
memset(categories, 0, sizeof(categories));
|
||||
memset(leaderIds, 0, sizeof(leaderIds));
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
sp0[i] = gTasks[taskId].data[i + 1];
|
||||
categories[i] = gTasks[taskId].data[i + 1];
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers;)
|
||||
{
|
||||
i++;
|
||||
if (i >= gNumLinkContestPlayers || sp0[0] != sp0[i])
|
||||
break;
|
||||
}
|
||||
// Ensure all players are doing the same category
|
||||
for (i = 0; i < gNumLinkContestPlayers && categories[0] == categories[i]; i++)
|
||||
;
|
||||
|
||||
if (i == gNumLinkContestPlayers)
|
||||
gSpecialVar_0x8004 = 0;
|
||||
gSpecialVar_0x8004 = FALSE; // Category choices the same
|
||||
else
|
||||
gSpecialVar_0x8004 = 1;
|
||||
gSpecialVar_0x8004 = TRUE; // Category choices differ
|
||||
|
||||
for (i = 0; i < gNumLinkContestPlayers; i++)
|
||||
sp4[i] = gTasks[taskId].data[i + 5];
|
||||
leaderIds[i] = gTasks[taskId].data[i + 5];
|
||||
|
||||
gUnknown_02039F2B = sub_80F86E0(sp4);
|
||||
sub_80DB09C(gSpecialVar_ContestCategory);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRound1Points, sub_80F86B8);
|
||||
gContestLinkLeaderIndex = LinkContest_GetLeaderIndex(leaderIds);
|
||||
CalculateRound1Points(gSpecialVar_ContestCategory);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateRound1Points, Task_LinkContest_CalculateTurnOrderRS);
|
||||
}
|
||||
|
||||
static void sub_80F86B8(u8 taskId)
|
||||
static void Task_LinkContest_CalculateTurnOrderRS(u8 taskId)
|
||||
{
|
||||
SortContestants(FALSE);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateTurnOrder, sub_80F8714);
|
||||
SetTaskFuncWithFollowupFunc(taskId, Task_LinkContest_CommunicateTurnOrder, Task_LinkContest_FinalizeConnection);
|
||||
}
|
||||
|
||||
u8 sub_80F86E0(u8 *arg0)
|
||||
u8 LinkContest_GetLeaderIndex(u8 *ids)
|
||||
{
|
||||
int i;
|
||||
u8 result = 0;
|
||||
u8 leaderIdx = 0;
|
||||
|
||||
for (i = 1; i < gNumLinkContestPlayers; i++)
|
||||
{
|
||||
if (arg0[result] < arg0[i])
|
||||
result = i;
|
||||
if (ids[leaderIdx] < ids[i])
|
||||
leaderIdx = i;
|
||||
}
|
||||
|
||||
return result;
|
||||
return leaderIdx;
|
||||
}
|
||||
|
||||
void sub_80F8714(u8 taskId)
|
||||
void Task_LinkContest_FinalizeConnection(u8 taskId)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gSpecialVar_0x8004 == 1)
|
||||
if (gSpecialVar_0x8004 == TRUE)
|
||||
{
|
||||
// Link partner data doesn't agree, disconnect
|
||||
if (IsLinkTaskFinished())
|
||||
gTasks[taskId].func = sub_80F878C;
|
||||
gTasks[taskId].func = Task_LinkContest_Disconnect;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Succesfully connected
|
||||
for (i = 0; i < CONTESTANT_COUNT; i++)
|
||||
StringGetEnd10(gContestMons[i].nickname);
|
||||
|
||||
@ -2516,13 +2515,13 @@ void sub_80F8714(u8 taskId)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80F878C(u8 taskId)
|
||||
static void Task_LinkContest_Disconnect(u8 taskId)
|
||||
{
|
||||
sub_800AC34();
|
||||
gTasks[taskId].func = sub_80F87B4;
|
||||
SetCloseLinkCallback();
|
||||
gTasks[taskId].func = Task_LinkContest_WaitDisconnect;
|
||||
}
|
||||
|
||||
static void sub_80F87B4(u8 taskId)
|
||||
static void Task_LinkContest_WaitDisconnect(u8 taskId)
|
||||
{
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
{
|
||||
|
@ -558,7 +558,7 @@ static void sub_8024BC8(u8 taskId)
|
||||
case 2:
|
||||
if (!sub_802A770())
|
||||
{
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
gUnknown_02022C98->unk0C++;
|
||||
}
|
||||
break;
|
||||
@ -671,7 +671,7 @@ static void sub_8024E38(void)
|
||||
gUnknown_02022C98->unk10++;
|
||||
break;
|
||||
case 1:
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
gUnknown_02022C98->unk10++;
|
||||
break;
|
||||
case 2:
|
||||
@ -690,7 +690,7 @@ static void sub_8024E38(void)
|
||||
case 4:
|
||||
if (++gUnknown_02022C98->unk30 > 5)
|
||||
{
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
gUnknown_02022C98->unk10++;
|
||||
}
|
||||
break;
|
||||
@ -1081,7 +1081,7 @@ static void sub_8025644(void)
|
||||
switch (gUnknown_02022C98->unk10)
|
||||
{
|
||||
case 0:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
sub_80292E0(7);
|
||||
gUnknown_02022C98->unk10++;
|
||||
break;
|
||||
|
@ -192,7 +192,7 @@ static u32 sub_81D4EE4(u8 *arg0, u16 *arg1)
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
sub_800ABF4(0);
|
||||
SetCloseLinkCallbackAndType(0);
|
||||
*arg0 = 5;
|
||||
break;
|
||||
case 5:
|
||||
@ -403,7 +403,7 @@ static void sub_81D5084(u8 taskId)
|
||||
break;
|
||||
case 15:
|
||||
data->unkE = EReader_IsReceivedDataValid((struct EReaderTrainerHillSet *)gDecompressionBuffer);
|
||||
sub_800ABF4(data->unkE);
|
||||
SetCloseLinkCallbackAndType(data->unkE);
|
||||
data->unk8 = 16;
|
||||
break;
|
||||
case 16:
|
||||
|
@ -197,7 +197,7 @@ static void Task_ReturnToFieldWirelessLink(u8 taskId)
|
||||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
@ -230,7 +230,7 @@ void Task_ReturnToFieldRecordMixing(u8 taskId)
|
||||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
@ -623,7 +623,7 @@ static void Task_ReturnToWorldFromLinkRoom(u8 taskId)
|
||||
case 1:
|
||||
if (!PaletteFadeActive() && BGMusicStopped())
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
data[0]++;
|
||||
}
|
||||
break;
|
||||
|
@ -3865,7 +3865,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
|
||||
case 7:
|
||||
if (IsLinkTaskFinished() == 1)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
break;
|
||||
@ -3878,7 +3878,7 @@ static void Task_LinkRetireStatusWithBattleTowerPartner(u8 taskId)
|
||||
case 9:
|
||||
if (gWirelessCommType == 0)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
}
|
||||
gBattleTypeFlags = sBattleTowerMultiBattleTypeFlags;
|
||||
EnableBothScriptContexts();
|
||||
|
158
src/link.c
158
src/link.c
@ -75,9 +75,9 @@ u16 gRecvCmds[MAX_RFU_PLAYERS][CMD_LENGTH];
|
||||
u32 gLinkStatus;
|
||||
bool8 gLinkDummy1; // Never read
|
||||
bool8 gLinkDummy2; // Never read
|
||||
bool8 gUnknown_030030EC[MAX_LINK_PLAYERS];
|
||||
bool8 gUnknown_030030F0[MAX_LINK_PLAYERS];
|
||||
u16 gUnknown_030030F4;
|
||||
bool8 gReadyToExitStandby[MAX_LINK_PLAYERS];
|
||||
bool8 gReadyToCloseLink[MAX_LINK_PLAYERS];
|
||||
u16 gReadyCloseLinkType; // Never read
|
||||
u8 gSuppressLinkErrorMessage;
|
||||
bool8 gWirelessCommType;
|
||||
bool8 gSavedLinkPlayerCount;
|
||||
@ -114,7 +114,7 @@ EWRAM_DATA struct {
|
||||
u8 lastSendQueueCount;
|
||||
u8 unk_06;
|
||||
} sLinkErrorBuffer = {};
|
||||
static EWRAM_DATA u16 sUnknown_02022B08 = 0;
|
||||
static EWRAM_DATA u16 sReadyCloseLinkAttempts = 0; // never read
|
||||
static EWRAM_DATA void *sLinkErrorBgTilemapBuffer = NULL;
|
||||
|
||||
// Static ROM declarations
|
||||
@ -135,12 +135,12 @@ static void LinkTest_prnthex(u32 pos, u8 a0, u8 a1, u8 a2);
|
||||
static void LinkCB_RequestPlayerDataExchange(void);
|
||||
static void Task_PrintTestData(u8 taskId);
|
||||
|
||||
static void sub_800AC80(void);
|
||||
static void sub_800ACAC(void);
|
||||
static void sub_800AD5C(void);
|
||||
static void sub_800AD88(void);
|
||||
static void sub_800AE30(void);
|
||||
static void sub_800AE5C(void);
|
||||
static void LinkCB_ReadyCloseLink(void);
|
||||
static void LinkCB_WaitCloseLink(void);
|
||||
static void LinkCB_ReadyCloseLinkWithJP(void);
|
||||
static void LinkCB_WaitCloseLinkWithJP(void);
|
||||
static void LinkCB_Standby(void);
|
||||
static void LinkCB_StandbyForAll(void);
|
||||
|
||||
static void CheckErrorStatus(void);
|
||||
static void CB2_PrintErrorMessage(void);
|
||||
@ -379,7 +379,7 @@ void OpenLink(void)
|
||||
sDummy1 = FALSE;
|
||||
gLinkDummy2 = FALSE;
|
||||
gLinkDummy1 = FALSE;
|
||||
gUnknown_030030F4 = 0;
|
||||
gReadyCloseLinkType = 0;
|
||||
CreateTask(Task_TriggerHandshake, 2);
|
||||
}
|
||||
else
|
||||
@ -390,8 +390,8 @@ void OpenLink(void)
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
gRemoteLinkPlayersNotReceived[i] = TRUE;
|
||||
gUnknown_030030F0[i] = FALSE;
|
||||
gUnknown_030030EC[i] = FALSE;
|
||||
gReadyToCloseLink[i] = FALSE;
|
||||
gReadyToExitStandby[i] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,7 +467,7 @@ static void LinkTestProcessKeyInput(void)
|
||||
}
|
||||
if (gMain.newKeys & SELECT_BUTTON)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
}
|
||||
if (gLinkTestDebugValuesEnabled)
|
||||
{
|
||||
@ -630,16 +630,16 @@ static void ProcessRecvCmds(u8 unused)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case LINKCMD_0x5FFF:
|
||||
gUnknown_030030F0[i] = TRUE;
|
||||
case LINKCMD_READY_CLOSE_LINK:
|
||||
gReadyToCloseLink[i] = TRUE;
|
||||
break;
|
||||
case LINKCMD_0x2FFE:
|
||||
gUnknown_030030EC[i] = TRUE;
|
||||
case LINKCMD_READY_EXIT_STANDBY:
|
||||
gReadyToExitStandby[i] = TRUE;
|
||||
break;
|
||||
case LINKCMD_0xAAAA:
|
||||
sub_800A418();
|
||||
break;
|
||||
case LINKCMD_0xCCCC:
|
||||
case LINKCMD_SEND_BLOCK_REQ:
|
||||
SendBlock(0, sBlockRequests[gRecvCmds[i][1]].address, sBlockRequests[gRecvCmds[i][1]].size);
|
||||
break;
|
||||
case LINKCMD_SEND_HELD_KEYS_2:
|
||||
@ -657,8 +657,8 @@ static void BuildSendCmd(u16 command)
|
||||
gSendCmd[0] = LINKCMD_SEND_LINK_TYPE;
|
||||
gSendCmd[1] = gLinkType;
|
||||
break;
|
||||
case LINKCMD_0x2FFE:
|
||||
gSendCmd[0] = LINKCMD_0x2FFE;
|
||||
case LINKCMD_READY_EXIT_STANDBY:
|
||||
gSendCmd[0] = LINKCMD_READY_EXIT_STANDBY;
|
||||
break;
|
||||
case LINKCMD_SEND_HELD_KEYS:
|
||||
gSendCmd[0] = LINKCMD_SEND_HELD_KEYS;
|
||||
@ -694,13 +694,13 @@ static void BuildSendCmd(u16 command)
|
||||
gSendCmd[0] = LINKCMD_0xAAAB;
|
||||
gSendCmd[1] = gSpecialVar_ItemId;
|
||||
break;
|
||||
case LINKCMD_0xCCCC:
|
||||
gSendCmd[0] = LINKCMD_0xCCCC;
|
||||
case LINKCMD_SEND_BLOCK_REQ:
|
||||
gSendCmd[0] = LINKCMD_SEND_BLOCK_REQ;
|
||||
gSendCmd[1] = gBlockRequestType;
|
||||
break;
|
||||
case LINKCMD_0x5FFF:
|
||||
gSendCmd[0] = LINKCMD_0x5FFF;
|
||||
gSendCmd[1] = gUnknown_030030F4;
|
||||
case LINKCMD_READY_CLOSE_LINK:
|
||||
gSendCmd[0] = LINKCMD_READY_CLOSE_LINK;
|
||||
gSendCmd[1] = gReadyCloseLinkType;
|
||||
break;
|
||||
case LINKCMD_0x5566:
|
||||
gSendCmd[0] = LINKCMD_0x5566;
|
||||
@ -1065,16 +1065,16 @@ bool8 SendBlock(u8 unused, const void *src, u16 size)
|
||||
return InitBlockSend(src, size);
|
||||
}
|
||||
|
||||
bool8 sub_800A4D8(u8 a0)
|
||||
bool8 SendBlockRequest(u8 blockReqType)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
return sub_8010100(a0);
|
||||
return Rfu_SendBlockRequest(blockReqType);
|
||||
}
|
||||
if (gLinkCallback == NULL)
|
||||
{
|
||||
gBlockRequestType = a0;
|
||||
BuildSendCmd(LINKCMD_0xCCCC);
|
||||
gBlockRequestType = blockReqType;
|
||||
BuildSendCmd(LINKCMD_SEND_BLOCK_REQ);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
@ -1423,70 +1423,70 @@ static u8 GetDummy2(void)
|
||||
return sDummy2;
|
||||
}
|
||||
|
||||
void sub_800ABF4(u16 a0)
|
||||
void SetCloseLinkCallbackAndType(u16 type)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
task_add_05_task_del_08FA224_when_no_RfuFunc();
|
||||
Rfu_SetCloseLinkCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gLinkCallback == NULL)
|
||||
{
|
||||
gLinkCallback = sub_800AC80;
|
||||
gLinkCallback = LinkCB_ReadyCloseLink;
|
||||
gLinkDummy1 = FALSE;
|
||||
gUnknown_030030F4 = a0;
|
||||
gReadyCloseLinkType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800AC34(void)
|
||||
void SetCloseLinkCallback(void)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
task_add_05_task_del_08FA224_when_no_RfuFunc();
|
||||
Rfu_SetCloseLinkCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gLinkCallback != NULL)
|
||||
{
|
||||
sUnknown_02022B08++;
|
||||
sReadyCloseLinkAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gLinkCallback = sub_800AC80;
|
||||
gLinkCallback = LinkCB_ReadyCloseLink;
|
||||
gLinkDummy1 = FALSE;
|
||||
gUnknown_030030F4 = 0;
|
||||
gReadyCloseLinkType = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800AC80(void)
|
||||
static void LinkCB_ReadyCloseLink(void)
|
||||
{
|
||||
if (gLastRecvQueueCount == 0)
|
||||
{
|
||||
BuildSendCmd(LINKCMD_0x5FFF);
|
||||
gLinkCallback = sub_800ACAC;
|
||||
BuildSendCmd(LINKCMD_READY_CLOSE_LINK);
|
||||
gLinkCallback = LinkCB_WaitCloseLink;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800ACAC(void)
|
||||
static void LinkCB_WaitCloseLink(void)
|
||||
{
|
||||
int i;
|
||||
unsigned count;
|
||||
u8 linkPlayerCount;
|
||||
|
||||
linkPlayerCount = GetLinkPlayerCount();
|
||||
// Wait for all players to be ready
|
||||
u8 linkPlayerCount = GetLinkPlayerCount();
|
||||
count = 0;
|
||||
for (i = 0; i < linkPlayerCount; i++)
|
||||
{
|
||||
if (gUnknown_030030F0[i])
|
||||
{
|
||||
if (gReadyToCloseLink[i])
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == linkPlayerCount)
|
||||
{
|
||||
// All ready, close link
|
||||
gBattleTypeFlags &= ~BATTLE_TYPE_20;
|
||||
gLinkVSyncDisabled = TRUE;
|
||||
CloseLink();
|
||||
@ -1495,37 +1495,38 @@ static void sub_800ACAC(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800AD10(void)
|
||||
// Used instead of SetCloseLinkCallback when disconnecting from an attempt to link with a foreign game
|
||||
void SetCloseLinkCallbackHandleJP(void)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
task_add_05_task_del_08FA224_when_no_RfuFunc();
|
||||
Rfu_SetCloseLinkCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gLinkCallback != NULL)
|
||||
{
|
||||
sUnknown_02022B08++;
|
||||
sReadyCloseLinkAttempts++;
|
||||
}
|
||||
else
|
||||
{
|
||||
gLinkCallback = sub_800AD5C;
|
||||
gLinkCallback = LinkCB_ReadyCloseLinkWithJP;
|
||||
gLinkDummy1 = FALSE;
|
||||
gUnknown_030030F4 = 0;
|
||||
gReadyCloseLinkType = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800AD5C(void)
|
||||
static void LinkCB_ReadyCloseLinkWithJP(void)
|
||||
{
|
||||
if (gLastRecvQueueCount == 0)
|
||||
{
|
||||
BuildSendCmd(LINKCMD_0x5FFF);
|
||||
gLinkCallback = sub_800AD88;
|
||||
BuildSendCmd(LINKCMD_READY_CLOSE_LINK);
|
||||
gLinkCallback = LinkCB_WaitCloseLinkWithJP;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800AD88(void)
|
||||
static void LinkCB_WaitCloseLinkWithJP(void)
|
||||
{
|
||||
int i;
|
||||
unsigned count;
|
||||
@ -1533,19 +1534,21 @@ static void sub_800AD88(void)
|
||||
|
||||
linkPlayerCount = GetLinkPlayerCount();
|
||||
count = 0;
|
||||
|
||||
// Wait for all non-foreign players to be ready
|
||||
for (i = 0; i < linkPlayerCount; i++)
|
||||
{
|
||||
// Rather than communicate with the foreign game
|
||||
// just assume they're ready to disconnect
|
||||
if (gLinkPlayers[i].language == LANGUAGE_JAPANESE)
|
||||
{
|
||||
count++;
|
||||
else if (gReadyToCloseLink[i])
|
||||
count++;
|
||||
}
|
||||
else if (gUnknown_030030F0[i])
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (count == linkPlayerCount)
|
||||
{
|
||||
// All ready, close link
|
||||
gBattleTypeFlags &= ~BATTLE_TYPE_20;
|
||||
gLinkVSyncDisabled = TRUE;
|
||||
CloseLink();
|
||||
@ -1554,50 +1557,47 @@ static void sub_800AD88(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800ADF8(void)
|
||||
void SetLinkStandbyCallback(void)
|
||||
{
|
||||
if (gWirelessCommType == TRUE)
|
||||
{
|
||||
sub_8010434();
|
||||
Rfu_SetLinkStandbyCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gLinkCallback == NULL)
|
||||
{
|
||||
gLinkCallback = sub_800AE30;
|
||||
gLinkCallback = LinkCB_Standby;
|
||||
}
|
||||
gLinkDummy1 = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800AE30(void)
|
||||
static void LinkCB_Standby(void)
|
||||
{
|
||||
if (gLastRecvQueueCount == 0)
|
||||
{
|
||||
BuildSendCmd(LINKCMD_0x2FFE);
|
||||
gLinkCallback = sub_800AE5C;
|
||||
BuildSendCmd(LINKCMD_READY_EXIT_STANDBY);
|
||||
gLinkCallback = LinkCB_StandbyForAll;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_800AE5C(void)
|
||||
static void LinkCB_StandbyForAll(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 linkPlayerCount;
|
||||
|
||||
linkPlayerCount = GetLinkPlayerCount();
|
||||
u8 linkPlayerCount = GetLinkPlayerCount();
|
||||
for (i = 0; i < linkPlayerCount; i++)
|
||||
{
|
||||
if (!gUnknown_030030EC[i])
|
||||
{
|
||||
if (!gReadyToExitStandby[i])
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// If true, all players ready to exit standby
|
||||
if (i == linkPlayerCount)
|
||||
{
|
||||
for (i = 0; i < MAX_LINK_PLAYERS; i++)
|
||||
{
|
||||
gUnknown_030030EC[i] = FALSE;
|
||||
}
|
||||
gReadyToExitStandby[i] = FALSE;
|
||||
|
||||
gLinkCallback = NULL;
|
||||
}
|
||||
}
|
||||
|
109
src/link_rfu_2.c
109
src/link_rfu_2.c
@ -148,10 +148,7 @@ static const u8 sUnknown_082ED6A5[] = {
|
||||
0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
|
||||
};
|
||||
|
||||
static const struct {
|
||||
u8 *buffer;
|
||||
u32 size;
|
||||
} sUnknown_082ED6B8[] = {
|
||||
static const struct BlockRequest sBlockRequests[] = {
|
||||
{ gBlockSendBuffer, 200 },
|
||||
{ gBlockSendBuffer, 200 },
|
||||
{ gBlockSendBuffer, 100 },
|
||||
@ -1072,15 +1069,15 @@ static void RfuHandleReceiveCommand(u8 unused)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RFU_COMMAND_0xA100:
|
||||
Rfu_InitBlockSend(sUnknown_082ED6B8[gRecvCmds[i][1]].buffer, (u16)sUnknown_082ED6B8[gRecvCmds[i][1]].size);
|
||||
case RFU_COMMAND_SEND_BLOCK_REQ:
|
||||
Rfu_InitBlockSend(sBlockRequests[gRecvCmds[i][1]].address, (u16)sBlockRequests[gRecvCmds[i][1]].size);
|
||||
break;
|
||||
case RFU_COMMAND_0x5F00:
|
||||
Rfu.unk_e4[i] = 1;
|
||||
case RFU_COMMAND_READY_CLOSE_LINK:
|
||||
Rfu.readyCloseLink[i] = TRUE;
|
||||
break;
|
||||
case RFU_COMMAND_0x6600:
|
||||
case RFU_COMMAND_READY_EXIT_STANDBY:
|
||||
if (Rfu.unk_100 == gRecvCmds[i][1])
|
||||
Rfu.unk_e9[i] = 1;
|
||||
Rfu.readyExitStandby[i] = TRUE;
|
||||
break;
|
||||
case RFU_COMMAND_0xED00:
|
||||
if (Rfu.parentChild == MODE_CHILD)
|
||||
@ -1194,9 +1191,9 @@ static void RfuPrepareSendBuffer(u16 command)
|
||||
gSendCmd[1] = Rfu.sendBlock.count;
|
||||
gSendCmd[2] = Rfu.sendBlock.owner + 0x80;
|
||||
break;
|
||||
case RFU_COMMAND_0xA100:
|
||||
case RFU_COMMAND_SEND_BLOCK_REQ:
|
||||
if (AreNoPlayersReceiving())
|
||||
gSendCmd[1] = Rfu.unk_5a;
|
||||
gSendCmd[1] = Rfu.blockRequestType;
|
||||
break;
|
||||
case RFU_COMMAND_0x7700:
|
||||
case RFU_COMMAND_0x7800:
|
||||
@ -1207,8 +1204,8 @@ static void RfuPrepareSendBuffer(u16 command)
|
||||
for (i = 0; i < RFU_CHILD_MAX; i++)
|
||||
buff[i] = Rfu.linkPlayerIdx[i];
|
||||
break;
|
||||
case RFU_COMMAND_0x6600:
|
||||
case RFU_COMMAND_0x5F00:
|
||||
case RFU_COMMAND_READY_EXIT_STANDBY:
|
||||
case RFU_COMMAND_READY_CLOSE_LINK:
|
||||
gSendCmd[1] = Rfu.unk_100;
|
||||
break;
|
||||
case RFU_COMMAND_0x4400:
|
||||
@ -1327,10 +1324,10 @@ static void SendLastBlock(void)
|
||||
Rfu.callback = NULL;
|
||||
}
|
||||
|
||||
bool8 sub_8010100(u8 blockRequestType)
|
||||
bool8 Rfu_SendBlockRequest(u8 type)
|
||||
{
|
||||
Rfu.unk_5a = blockRequestType;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0xA100);
|
||||
Rfu.blockRequestType = type;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_SEND_BLOCK_REQ);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1343,14 +1340,14 @@ static void sub_801011C(void)
|
||||
Rfu.callback = NULL;
|
||||
}
|
||||
|
||||
static void sub_8010148(void)
|
||||
static void DisconnectRfu(void)
|
||||
{
|
||||
rfu_REQ_disconnect(gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag);
|
||||
rfu_waitREQComplete();
|
||||
sub_801011C();
|
||||
}
|
||||
|
||||
static void sub_8010168(void)
|
||||
static void TryDisconnectRfu(void)
|
||||
{
|
||||
if (Rfu.parentChild == MODE_CHILD)
|
||||
{
|
||||
@ -1358,7 +1355,7 @@ static void sub_8010168(void)
|
||||
Rfu.unk_ce4 = 2;
|
||||
}
|
||||
else
|
||||
Rfu.callback = sub_8010148;
|
||||
Rfu.callback = DisconnectRfu;
|
||||
}
|
||||
|
||||
void LinkRfu_FatalError(void)
|
||||
@ -1368,131 +1365,137 @@ void LinkRfu_FatalError(void)
|
||||
Rfu.unk_ce3 = gRfuLinkStatus->connSlotFlag | gRfuLinkStatus->linkLossSlotFlag;
|
||||
}
|
||||
|
||||
static void sub_80101CC(void)
|
||||
// RFU equivalent of LinkCB_WaitCloseLink
|
||||
static void WaitAllReadyToCloseLink(void)
|
||||
{
|
||||
s32 i;
|
||||
u8 playerCount = Rfu.playerCount;
|
||||
s32 count = 0;
|
||||
|
||||
// Wait for all players to be ready
|
||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||
{
|
||||
if (Rfu.unk_e4[i])
|
||||
if (Rfu.readyCloseLink[i])
|
||||
count++;
|
||||
}
|
||||
if (count == playerCount)
|
||||
{
|
||||
// All ready, close link
|
||||
gBattleTypeFlags &= ~BATTLE_TYPE_20;
|
||||
if (Rfu.parentChild == MODE_CHILD)
|
||||
{
|
||||
Rfu.errorState = 3;
|
||||
sub_8010168();
|
||||
TryDisconnectRfu();
|
||||
}
|
||||
else
|
||||
Rfu.callback = sub_8010168;
|
||||
Rfu.callback = TryDisconnectRfu;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_801022C(void)
|
||||
static void SendReadyCloseLink(void)
|
||||
{
|
||||
if (gSendCmd[0] == 0 && Rfu.unk_ce8 == 0)
|
||||
{
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0x5F00);
|
||||
Rfu.callback = sub_80101CC;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_READY_CLOSE_LINK);
|
||||
Rfu.callback = WaitAllReadyToCloseLink;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8010264(u8 taskId)
|
||||
static void Task_TryReadyCloseLink(u8 taskId)
|
||||
{
|
||||
if (Rfu.callback == NULL)
|
||||
{
|
||||
Rfu.unk_cd9 = 1;
|
||||
Rfu.callback = sub_801022C;
|
||||
Rfu.callback = SendReadyCloseLink;
|
||||
DestroyTask(taskId);
|
||||
}
|
||||
}
|
||||
|
||||
void task_add_05_task_del_08FA224_when_no_RfuFunc(void)
|
||||
void Rfu_SetCloseLinkCallback(void)
|
||||
{
|
||||
if (!FuncIsActiveTask(sub_8010264))
|
||||
CreateTask(sub_8010264, 5);
|
||||
if (!FuncIsActiveTask(Task_TryReadyCloseLink))
|
||||
CreateTask(Task_TryReadyCloseLink, 5);
|
||||
}
|
||||
|
||||
static void sub_80102B8(void)
|
||||
static void SendReadyExitStandbyUntilAllReady(void)
|
||||
{
|
||||
u8 playerCount;
|
||||
u8 i;
|
||||
|
||||
if (GetMultiplayerId() != 0)
|
||||
{
|
||||
if (Rfu.recvQueue.count == 0 && Rfu.unk_fe > 60)
|
||||
if (Rfu.recvQueue.count == 0 && Rfu.resendExitStandbyTimer > 60)
|
||||
{
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
|
||||
Rfu.unk_fe = 0;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
|
||||
Rfu.resendExitStandbyTimer = 0;
|
||||
}
|
||||
}
|
||||
playerCount = GetLinkPlayerCount();
|
||||
for (i = 0; i < playerCount; i++)
|
||||
{
|
||||
if (Rfu.unk_e9[i] == 0)
|
||||
if (!Rfu.readyExitStandby[i])
|
||||
break;
|
||||
}
|
||||
if (i == playerCount)
|
||||
{
|
||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||
Rfu.unk_e9[i] = 0;
|
||||
Rfu.readyExitStandby[i] = FALSE;
|
||||
Rfu.unk_100++;
|
||||
Rfu.callback = NULL;
|
||||
}
|
||||
Rfu.unk_fe++;
|
||||
Rfu.resendExitStandbyTimer++;
|
||||
}
|
||||
|
||||
static void sub_8010358(void)
|
||||
static void LinkLeaderReadyToExitStandby(void)
|
||||
{
|
||||
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
|
||||
{
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
|
||||
Rfu.callback = sub_80102B8;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
|
||||
Rfu.callback = SendReadyExitStandbyUntilAllReady;
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_8010390(void)
|
||||
// RFU equivalent of LinkCB_Standby and LinkCB_StandbyForAll
|
||||
static void Rfu_LinkStandby(void)
|
||||
{
|
||||
u8 i;
|
||||
u8 playerCount;
|
||||
|
||||
if (GetMultiplayerId() != 0)
|
||||
{
|
||||
// Not link leader, send exit standby when ready
|
||||
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
|
||||
{
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
|
||||
Rfu.callback = sub_80102B8;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
|
||||
Rfu.callback = SendReadyExitStandbyUntilAllReady;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Link leader, wait for all members to send exit ready
|
||||
playerCount = GetLinkPlayerCount();
|
||||
for (i = 1; i < playerCount; i++)
|
||||
{
|
||||
if (Rfu.unk_e9[i] == 0)
|
||||
if (!Rfu.readyExitStandby[i])
|
||||
break;
|
||||
}
|
||||
if (i == playerCount)
|
||||
{
|
||||
if (Rfu.recvQueue.count == 0 && gSendCmd[0] == 0)
|
||||
{
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0x6600);
|
||||
Rfu.callback = sub_8010358;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_READY_EXIT_STANDBY);
|
||||
Rfu.callback = LinkLeaderReadyToExitStandby;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void sub_8010434(void)
|
||||
void Rfu_SetLinkStandbyCallback(void)
|
||||
{
|
||||
if (Rfu.callback == NULL)
|
||||
{
|
||||
Rfu.callback = sub_8010390;
|
||||
Rfu.unk_fe = 0;
|
||||
Rfu.callback = Rfu_LinkStandby;
|
||||
Rfu.resendExitStandbyTimer = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1724,8 +1727,8 @@ static void sub_801084C(u8 taskId)
|
||||
{
|
||||
if (AreNoPlayersReceiving())
|
||||
{
|
||||
Rfu.unk_5a = 0;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_0xA100);
|
||||
Rfu.blockRequestType = 0;
|
||||
RfuPrepareSendBuffer(RFU_COMMAND_SEND_BLOCK_REQ);
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ static void CB2_MysteryEventMenu(void)
|
||||
{
|
||||
if (GetLinkPlayerDataExchangeStatusTimed(2, 2) == EXCHANGE_DIFF_SELECTIONS)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
GetEventLoadMessage(gStringVar4, 1);
|
||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
||||
gMain.state = 13;
|
||||
@ -249,7 +249,7 @@ static void CB2_MysteryEventMenu(void)
|
||||
gMain.state++;
|
||||
break;
|
||||
case 10:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gMain.state++;
|
||||
break;
|
||||
case 11:
|
||||
|
@ -1284,7 +1284,7 @@ void task00_mystery_gift(u8 taskId)
|
||||
switch (mevent_client_do_exec(&data->curPromptWindowId))
|
||||
{
|
||||
case 6:
|
||||
task_add_05_task_del_08FA224_when_no_RfuFunc();
|
||||
Rfu_SetCloseLinkCallback();
|
||||
data->prevPromptWindowId = data->curPromptWindowId;
|
||||
data->state = 13;
|
||||
break;
|
||||
@ -1647,7 +1647,7 @@ void task00_mystery_gift(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 33:
|
||||
task_add_05_task_del_08FA224_when_no_RfuFunc();
|
||||
Rfu_SetCloseLinkCallback();
|
||||
StringCopy(gStringVar1, gLinkPlayers[1].name);
|
||||
data->state = 34;
|
||||
break;
|
||||
|
@ -1463,7 +1463,7 @@ static bool32 sub_802BC60(void)
|
||||
case 4:
|
||||
if (!gPaletteFade.active)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
gUnknown_02022CFC->unkA++;
|
||||
}
|
||||
break;
|
||||
|
@ -501,7 +501,7 @@ static void Task_SendPacket(u8 taskId)
|
||||
break;
|
||||
case 1:
|
||||
if (GetMultiplayerId() == 0)
|
||||
sub_800A4D8(1);
|
||||
SendBlockRequest(1);
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 2:
|
||||
@ -973,7 +973,7 @@ static void Task_DoRecordMixing(u8 taskId)
|
||||
case 4: // Wait 10 frames
|
||||
if (++task->data[1] > 10)
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
task->data[0] ++;
|
||||
}
|
||||
break;
|
||||
@ -1005,7 +1005,7 @@ static void Task_DoRecordMixing(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 8:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
task->data[0] ++;
|
||||
break;
|
||||
case 9:
|
||||
|
@ -912,7 +912,7 @@ void Task_LinkSave(u8 taskId)
|
||||
tState = 1;
|
||||
break;
|
||||
case 1:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
tState = 2;
|
||||
break;
|
||||
case 2:
|
||||
@ -949,7 +949,7 @@ void Task_LinkSave(u8 taskId)
|
||||
case 7:
|
||||
if (!tPartialSave)
|
||||
ClearContinueGameWarpStatus2();
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
tState = 8;
|
||||
break;
|
||||
case 8:
|
||||
@ -960,7 +960,7 @@ void Task_LinkSave(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case 9:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
tState = 10;
|
||||
break;
|
||||
case 10:
|
||||
|
@ -472,7 +472,7 @@ static void Task_LinkContestWaitForConnection(u8 taskId)
|
||||
case 0:
|
||||
if (IsLinkTaskFinished())
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
break;
|
||||
|
46
src/trade.c
46
src/trade.c
@ -246,9 +246,9 @@ static bool8 SendLinkData(const void *linkData, u32 size)
|
||||
}
|
||||
}
|
||||
|
||||
static void sub_80771AC(u8 a0)
|
||||
static void RequestLinkData(u8 type)
|
||||
{
|
||||
sub_800A4D8(a0);
|
||||
SendBlockRequest(type);
|
||||
}
|
||||
|
||||
static bool32 sub_80771BC(void)
|
||||
@ -295,9 +295,9 @@ static bool32 IsWirelessTrade(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void sub_8077288(u8 unused)
|
||||
static void SetTradeLinkStandbyCallback(u8 unused)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
}
|
||||
|
||||
static bool32 _IsLinkTaskFinished(void)
|
||||
@ -445,7 +445,7 @@ static void CB2_CreateTradeMenu(void)
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_801048C(TRUE);
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -825,7 +825,7 @@ static void LinkTradeWaitForFade(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800ABF4(32);
|
||||
SetCloseLinkCallbackAndType(32);
|
||||
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_START_LINK_TRADE;
|
||||
}
|
||||
}
|
||||
@ -983,7 +983,7 @@ static bool8 BufferTradeParties(void)
|
||||
case 3:
|
||||
if (id == 0)
|
||||
{
|
||||
sub_80771AC(1);
|
||||
RequestLinkData(1);
|
||||
}
|
||||
sTradeMenuData->bufferPartyState++;
|
||||
break;
|
||||
@ -1002,7 +1002,7 @@ static bool8 BufferTradeParties(void)
|
||||
case 7:
|
||||
if (id == 0)
|
||||
{
|
||||
sub_80771AC(1);
|
||||
RequestLinkData(1);
|
||||
}
|
||||
sTradeMenuData->bufferPartyState++;
|
||||
break;
|
||||
@ -1021,7 +1021,7 @@ static bool8 BufferTradeParties(void)
|
||||
case 11:
|
||||
if (id == 0)
|
||||
{
|
||||
sub_80771AC(1);
|
||||
RequestLinkData(1);
|
||||
}
|
||||
sTradeMenuData->bufferPartyState++;
|
||||
break;
|
||||
@ -1040,7 +1040,7 @@ static bool8 BufferTradeParties(void)
|
||||
case 15:
|
||||
if (id == 0)
|
||||
{
|
||||
sub_80771AC(3);
|
||||
RequestLinkData(3);
|
||||
}
|
||||
sTradeMenuData->bufferPartyState++;
|
||||
break;
|
||||
@ -1059,7 +1059,7 @@ static bool8 BufferTradeParties(void)
|
||||
case 19:
|
||||
if (id == 0)
|
||||
{
|
||||
sub_80771AC(4);
|
||||
RequestLinkData(4);
|
||||
}
|
||||
sTradeMenuData->bufferPartyState++;
|
||||
break;
|
||||
@ -1652,11 +1652,11 @@ static void CancelTrade_1(void)
|
||||
{
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800ABF4(12);
|
||||
SetCloseLinkCallbackAndType(12);
|
||||
}
|
||||
|
||||
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_CANCEL_TRADE_2;
|
||||
@ -1692,7 +1692,7 @@ static void LinkTradeWaitForQueue(void)
|
||||
{
|
||||
if (!sub_801048C(FALSE) && GetNumQueuedActions() == 0)
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
sTradeMenuData->tradeMenuFunc = TRADEMENUFUNC_START_LINK_TRADE;
|
||||
}
|
||||
}
|
||||
@ -4566,7 +4566,7 @@ static void CB2_SaveAndEndTrade(void)
|
||||
DrawTextOnTradeWindow(0, gStringVar4, 0);
|
||||
break;
|
||||
case 1:
|
||||
sub_8077288(0);
|
||||
SetTradeLinkStandbyCallback(0);
|
||||
gMain.state = 100;
|
||||
sTradeData->timer = 0;
|
||||
break;
|
||||
@ -4644,7 +4644,7 @@ static void CB2_SaveAndEndTrade(void)
|
||||
case 41:
|
||||
if (sTradeData->timer == 0)
|
||||
{
|
||||
sub_8077288(1);
|
||||
SetTradeLinkStandbyCallback(1);
|
||||
gMain.state = 42;
|
||||
}
|
||||
else
|
||||
@ -4663,7 +4663,7 @@ static void CB2_SaveAndEndTrade(void)
|
||||
if (++sTradeData->timer > 60)
|
||||
{
|
||||
gMain.state++;
|
||||
sub_8077288(2);
|
||||
SetTradeLinkStandbyCallback(2);
|
||||
}
|
||||
break;
|
||||
case 6:
|
||||
@ -4685,11 +4685,11 @@ static void CB2_SaveAndEndTrade(void)
|
||||
{
|
||||
if (gWirelessCommType && gMain.savedCallback == CB2_StartCreateTradeMenu)
|
||||
{
|
||||
sub_8077288(3);
|
||||
SetTradeLinkStandbyCallback(3);
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
}
|
||||
gMain.state++;
|
||||
}
|
||||
@ -4902,7 +4902,7 @@ static void CB2_SaveAndEndWirelessTrade(void)
|
||||
DrawTextOnTradeWindow(0, gStringVar4, 0);
|
||||
break;
|
||||
case 1:
|
||||
sub_8077288(0);
|
||||
SetTradeLinkStandbyCallback(0);
|
||||
gMain.state = 2;
|
||||
sTradeData->timer = 0;
|
||||
break;
|
||||
@ -4950,7 +4950,7 @@ static void CB2_SaveAndEndWirelessTrade(void)
|
||||
case 7:
|
||||
if (sTradeData->timer == 0)
|
||||
{
|
||||
sub_8077288(1);
|
||||
SetTradeLinkStandbyCallback(1);
|
||||
gMain.state = 8;
|
||||
}
|
||||
else
|
||||
@ -4969,7 +4969,7 @@ static void CB2_SaveAndEndWirelessTrade(void)
|
||||
if (++sTradeData->timer > 60)
|
||||
{
|
||||
gMain.state++;
|
||||
sub_8077288(2);
|
||||
SetTradeLinkStandbyCallback(2);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
@ -4983,7 +4983,7 @@ static void CB2_SaveAndEndWirelessTrade(void)
|
||||
case 11:
|
||||
if (!gPaletteFade.active && IsBGMStopped() == TRUE)
|
||||
{
|
||||
sub_8077288(3);
|
||||
SetTradeLinkStandbyCallback(3);
|
||||
gMain.state = 12;
|
||||
}
|
||||
break;
|
||||
|
@ -498,7 +498,7 @@ static void Task_TrainerCard(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case STATE_WAIT_LINK_PARTNER:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
DrawDialogueFrame(0, 1);
|
||||
AddTextPrinterParameterized(0, 1, gText_WaitingTrainerFinishReading, 0, 1, 255, 0);
|
||||
CopyWindowToVram(0, 3);
|
||||
|
@ -1483,7 +1483,7 @@ static void Task_ExchangeCards(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
if (GetMultiplayerId() == 0)
|
||||
sub_800A4D8(2);
|
||||
SendBlockRequest(2);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
@ -1759,7 +1759,7 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
data[0] = 3;
|
||||
}
|
||||
}
|
||||
@ -1795,7 +1795,7 @@ static void Task_RunScriptAndFadeToActivity(u8 taskId)
|
||||
DestroyTask(taskId);
|
||||
break;
|
||||
case 7:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
data[0] = 8;
|
||||
break;
|
||||
case 8:
|
||||
@ -2018,7 +2018,7 @@ static void Task_MEvent_Leader(u8 taskId)
|
||||
Free(data->field_8);
|
||||
Free(data->field_0);
|
||||
Free(data->field_4);
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
data->state++;
|
||||
break;
|
||||
case 17:
|
||||
@ -2188,7 +2188,7 @@ static void Task_CardOrNewsWithFriend(u8 taskId)
|
||||
break;
|
||||
case 11:
|
||||
data->state++;
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
break;
|
||||
case 12:
|
||||
if (IsLinkTaskFinished())
|
||||
@ -2367,7 +2367,7 @@ static void Task_CardOrNewsOverWireless(u8 taskId)
|
||||
break;
|
||||
case 13:
|
||||
data->state++;
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
break;
|
||||
case 14:
|
||||
if (IsLinkTaskFinished())
|
||||
@ -2714,7 +2714,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case UR_STATE_REQUEST_DECLINED:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
|
||||
break;
|
||||
case UR_STATE_SEND_TRADE_REQUST:
|
||||
@ -2763,7 +2763,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
if (PrintOnTextbox(&uroom->textState, gStringVar4))
|
||||
{
|
||||
uroom->state = UR_STATE_WAIT_FINISH_READING_CARD;
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
uroom->partnerYesNoResponse = 0;
|
||||
uroom->recvActivityRequest[0] = 0;
|
||||
}
|
||||
@ -2940,7 +2940,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
}
|
||||
break;
|
||||
case UR_STATE_DECLINE_ACTIVITY_REQUEST:
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
|
||||
break;
|
||||
case UR_STATE_CANCEL_REQUEST_PRINT_MSG:
|
||||
@ -2962,7 +2962,7 @@ static void Task_RunUnionRoom(u8 taskId)
|
||||
ScheduleFieldMessageWithFollowupState(UR_STATE_START_ACTIVITY_LINK, gStringVar4);
|
||||
break;
|
||||
case UR_STATE_START_ACTIVITY_LINK:
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
uroom->state = UR_STATE_START_ACTIVITY_WAIT_FOR_LINK;
|
||||
break;
|
||||
case UR_STATE_START_ACTIVITY_WAIT_FOR_LINK:
|
||||
@ -3231,7 +3231,7 @@ static bool32 UnionRoom_HandleContactFromOtherPlayer(struct WirelessLink_URoom *
|
||||
else if (id == 2) // No activity
|
||||
{
|
||||
uroom->state = UR_STATE_CANCEL_REQUEST_PRINT_MSG;
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void CB2_UnionRoomBattle(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
if (gBlockRecvBuffer[GetMultiplayerId()][0] == (ACTIVITY_DECLINE | IN_UNION_ROOM))
|
||||
{
|
||||
gMain.state = 6;
|
||||
@ -190,7 +190,7 @@ void CB2_UnionRoomBattle(void)
|
||||
case 50:
|
||||
if (!UpdatePaletteFade())
|
||||
{
|
||||
sub_800ADF8();
|
||||
SetLinkStandbyCallback();
|
||||
gMain.state++;
|
||||
}
|
||||
break;
|
||||
|
@ -1267,7 +1267,7 @@ static void Chat_Exit(void)
|
||||
case 5:
|
||||
if (IsLinkTaskFinished() && !sub_8011A9C())
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
sChat->exitDelayTimer = 0;
|
||||
sChat->funcState++;
|
||||
}
|
||||
@ -1302,7 +1302,7 @@ static void Chat_Drop(void)
|
||||
case 1:
|
||||
if (!IsDisplaySubtaskActive(0) && IsLinkTaskFinished() && !sub_8011A9C())
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
sChat->exitDelayTimer = 0;
|
||||
sChat->funcState++;
|
||||
}
|
||||
@ -1348,7 +1348,7 @@ static void Chat_Disbanded(void)
|
||||
case 2:
|
||||
if (IsDisplaySubtaskActive(0) != TRUE && IsLinkTaskFinished() && !sub_8011A9C())
|
||||
{
|
||||
sub_800AC34();
|
||||
SetCloseLinkCallback();
|
||||
sChat->exitDelayTimer = 0;
|
||||
sChat->funcState++;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user