Sync cable club
This commit is contained in:
@@ -36,7 +36,7 @@ void HandleLinkBattleSetup(void)
|
||||
SetWirelessCommType1();
|
||||
if (!gReceivedRemoteLinkPlayers)
|
||||
OpenLink();
|
||||
CreateTask(Task_WaitForReceivedRemoteLinkPlayers5SecondTimeout, 0);
|
||||
CreateTask(Task_WaitForLinkPlayerConnection, 0);
|
||||
CreateTasksForSendRecvLinkBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -440,7 +440,7 @@ static void UpdateBattleOutcomeOnTrainerCards(s32 battlerId)
|
||||
}
|
||||
}
|
||||
|
||||
void TryRecordLinkBattleOutcome(s32 battlerId)
|
||||
void UpdatePlayerLinkBattleRecords(s32 battlerId)
|
||||
{
|
||||
if (gSaveBlock1Ptr->location.mapGroup != MAP_GROUP(UNION_ROOM) || gSaveBlock1Ptr->location.mapNum != MAP_NUM(UNION_ROOM))
|
||||
{
|
||||
|
||||
+384
-325
File diff suppressed because it is too large
Load Diff
@@ -173,7 +173,7 @@ static void Task_ReturnToFieldCableLink(u8 taskId)
|
||||
switch (task->data[0])
|
||||
{
|
||||
case 0:
|
||||
task->data[1] = CreateTask_ReestablishLinkInCableClubRoom();
|
||||
task->data[1] = CreateTask_ReestablishCableClubLink();
|
||||
task->data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
#include "global.h"
|
||||
#include "field_message_box.h"
|
||||
#include "gflib.h"
|
||||
#include "new_menu_helpers.h"
|
||||
#include "quest_log.h"
|
||||
#include "script.h"
|
||||
#include "text_window.h"
|
||||
|
||||
enum
|
||||
{
|
||||
FIELD_MESSAGE_BOX_HIDDEN,
|
||||
FIELD_MESSAGE_BOX_UNUSED,
|
||||
FIELD_MESSAGE_BOX_NORMAL,
|
||||
FIELD_MESSAGE_BOX_AUTO_SCROLL,
|
||||
};
|
||||
|
||||
static EWRAM_DATA u8 sMessageBoxType = 0;
|
||||
|
||||
static void ExpandStringAndStartDrawFieldMessageBox(const u8 *str);
|
||||
|
||||
+18
-18
@@ -163,11 +163,11 @@ static const u16 sLinkTestFontPal[] = INCBIN_U16("graphics/interface/link_test_f
|
||||
static const u16 sLinkTestFontGfx[] = INCBIN_U16("graphics/interface/link_test_font.4bpp");
|
||||
|
||||
static const struct BlockRequest sBlockRequests[] = {
|
||||
{gBlockSendBuffer, 200},
|
||||
{gBlockSendBuffer, 200},
|
||||
{gBlockSendBuffer, 100},
|
||||
{gBlockSendBuffer, 220},
|
||||
{gBlockSendBuffer, 40}
|
||||
[BLOCK_REQ_SIZE_NONE] = { gBlockSendBuffer, 200 },
|
||||
[BLOCK_REQ_SIZE_200] = { gBlockSendBuffer, 200 },
|
||||
[BLOCK_REQ_SIZE_100] = { gBlockSendBuffer, 100 },
|
||||
[BLOCK_REQ_SIZE_220] = { gBlockSendBuffer, 220 },
|
||||
[BLOCK_REQ_SIZE_40] = { gBlockSendBuffer, 40 }
|
||||
};
|
||||
static const char sASCIIGameFreakInc[] = "GameFreak inc.";
|
||||
static const char sASCIITestPrint[] = "TEST PRINT\n"
|
||||
@@ -788,8 +788,8 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
|
||||
cmpVal = GetLinkPlayerCount_2();
|
||||
if (lower > cmpVal || cmpVal > upper)
|
||||
{
|
||||
sPlayerDataExchangeStatus = EXCHANGE_STAT_6;
|
||||
return EXCHANGE_STAT_6;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_WRONG_NUM_PLAYERS;
|
||||
return sPlayerDataExchangeStatus;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -815,10 +815,10 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
|
||||
sPlayerDataExchangeStatus = EXCHANGE_COMPLETE;
|
||||
break;
|
||||
case 1:
|
||||
sPlayerDataExchangeStatus = EXCHANGE_STAT_4;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_PLAYER_NOT_READY;
|
||||
break;
|
||||
case 2:
|
||||
sPlayerDataExchangeStatus = EXCHANGE_STAT_5;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_PARTNER_NOT_READY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -829,7 +829,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int lower, int upper)
|
||||
}
|
||||
else
|
||||
{
|
||||
sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_DIFF_SELECTIONS;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -862,7 +862,7 @@ bool8 IsLinkPlayerDataExchangeComplete(void)
|
||||
else
|
||||
{
|
||||
retval = FALSE;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_IN_PROGRESS;
|
||||
sPlayerDataExchangeStatus = EXCHANGE_DIFF_SELECTIONS;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
@@ -999,7 +999,7 @@ bool8 SendBlock(u8 unused, const void *src, u16 size)
|
||||
return InitBlockSend(src, size);
|
||||
}
|
||||
|
||||
bool8 Link_PrepareCmd0xCCCC_Rfu0xA100(u8 blockRequestType)
|
||||
bool8 SendBlockRequest(u8 blockRequestType)
|
||||
{
|
||||
if (gWirelessCommType == 1)
|
||||
{
|
||||
@@ -1195,7 +1195,7 @@ void SetLinkDebugValues(u32 seed, u32 flags)
|
||||
gLinkDebugFlags = flags;
|
||||
}
|
||||
|
||||
u8 sub_800A8A4(void)
|
||||
u8 GetSavedLinkPlayerCountAsBitFlags(void)
|
||||
{
|
||||
int i;
|
||||
u8 flags;
|
||||
@@ -1208,7 +1208,7 @@ u8 sub_800A8A4(void)
|
||||
return flags;
|
||||
}
|
||||
|
||||
u8 sub_800A8D4(void)
|
||||
u8 GetLinkPlayerCountAsBitFlags(void)
|
||||
{
|
||||
int i;
|
||||
u8 flags;
|
||||
@@ -1221,11 +1221,11 @@ u8 sub_800A8D4(void)
|
||||
return flags;
|
||||
}
|
||||
|
||||
void sub_800A900(u8 a0)
|
||||
void SaveLinkPlayers(u8 numPlayers)
|
||||
{
|
||||
int i;
|
||||
|
||||
gSavedLinkPlayerCount = a0;
|
||||
gSavedLinkPlayerCount = numPlayers;
|
||||
gSavedMultiplayerId = GetMultiplayerId();
|
||||
for (i = 0; i < MAX_RFU_PLAYERS; i++)
|
||||
{
|
||||
@@ -1265,7 +1265,7 @@ bool8 sub_800A95C(void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void sub_800A9A4(void)
|
||||
void CheckLinkPlayersMatchSaved(void)
|
||||
{
|
||||
u8 i;
|
||||
|
||||
@@ -1280,7 +1280,7 @@ void sub_800A9A4(void)
|
||||
}
|
||||
}
|
||||
|
||||
void sub_800AA24(void)
|
||||
void ResetLinkPlayerCount(void)
|
||||
{
|
||||
gSavedLinkPlayerCount = 0;
|
||||
gSavedMultiplayerId = 0;
|
||||
|
||||
+6
-6
@@ -168,11 +168,11 @@ static const u8 sNumTrailingZeroes[] = {
|
||||
};
|
||||
|
||||
static const struct BlockRequest sBlockRequests[] = {
|
||||
{ gBlockSendBuffer, 200 },
|
||||
{ gBlockSendBuffer, 200 },
|
||||
{ gBlockSendBuffer, 100 },
|
||||
{ gBlockSendBuffer, 220 },
|
||||
{ gBlockSendBuffer, 40 }
|
||||
[BLOCK_REQ_SIZE_NONE] = { gBlockSendBuffer, 200 },
|
||||
[BLOCK_REQ_SIZE_200] = { gBlockSendBuffer, 200 },
|
||||
[BLOCK_REQ_SIZE_100] = { gBlockSendBuffer, 100 },
|
||||
[BLOCK_REQ_SIZE_220] = { gBlockSendBuffer, 220 },
|
||||
[BLOCK_REQ_SIZE_40] = { gBlockSendBuffer, 40 }
|
||||
};
|
||||
|
||||
static const u16 sAcceptedSerialNos[] = {
|
||||
@@ -1709,7 +1709,7 @@ static void sub_80FA834(u8 taskId)
|
||||
{
|
||||
if (AreNoPlayersReceiving())
|
||||
{
|
||||
Rfu.cmdA100_blockRequestType = 0;
|
||||
Rfu.cmdA100_blockRequestType = BLOCK_REQ_SIZE_NONE;
|
||||
RfuPrepareSendBuffer(RFUCMD_SEND_BLOCK_REQ);
|
||||
gTasks[taskId].data[0]++;
|
||||
}
|
||||
|
||||
+1
-1
@@ -961,7 +961,7 @@ bool32 MEventHandleReceivedWonderCard(u16 flagId)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void MEvent_RecordIdOfWonderCardSenderByEventType(u32 eventId, u32 trainerId)
|
||||
void MysteryGift_TryIncrementStat(u32 eventId, u32 trainerId)
|
||||
{
|
||||
if (sReceivedWonderCardIsValid)
|
||||
{
|
||||
|
||||
@@ -592,7 +592,7 @@ static void WindowFunc_ClearDialogWindowAndFrame(u8 bg, u8 tilemapLeft, u8 tilem
|
||||
FillBgTilemapBufferRect(bg, 0, tilemapLeft - 2, tilemapTop - 1, width + 4, height + 2, STD_WINDOW_PALETTE_NUM);
|
||||
}
|
||||
|
||||
void sub_80F771C(bool8 copyToVram)
|
||||
void EraseFieldMessageBox(bool8 copyToVram)
|
||||
{
|
||||
FillBgTilemapBufferRect(0, 0, 0, 0, 0x20, 0x20, 0x11);
|
||||
if (copyToVram == TRUE)
|
||||
|
||||
+6
-5
@@ -47,6 +47,7 @@
|
||||
#include "trainer_pokemon_sprites.h"
|
||||
#include "vs_seeker.h"
|
||||
#include "wild_encounter.h"
|
||||
#include "constants/cable_club.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/region_map_sections.h"
|
||||
#include "constants/songs.h"
|
||||
@@ -2979,14 +2980,14 @@ static u16 KeyInterCB_SendNothing_2(u32 key)
|
||||
u32 GetCableClubPartnersReady(void)
|
||||
{
|
||||
if (IsAnyPlayerInLinkState(PLAYER_LINK_STATE_EXITING_ROOM) == TRUE)
|
||||
return 2;
|
||||
return CABLE_SEAT_FAILED;
|
||||
if (sPlayerKeyInterceptCallback == KeyInterCB_Ready && sPlayerLinkStates[gLocalLinkPlayerId] != PLAYER_LINK_STATE_READY)
|
||||
return 0;
|
||||
return CABLE_SEAT_WAITING;
|
||||
if (sPlayerKeyInterceptCallback == KeyInterCB_DoNothingAndKeepAlive && sPlayerLinkStates[gLocalLinkPlayerId] == PLAYER_LINK_STATE_BUSY)
|
||||
return 2;
|
||||
return CABLE_SEAT_FAILED;
|
||||
if (AreAllPlayersInLinkState(PLAYER_LINK_STATE_READY) != FALSE)
|
||||
return 1;
|
||||
return 0;
|
||||
return CABLE_SEAT_SUCCESS;
|
||||
return CABLE_SEAT_WAITING;
|
||||
}
|
||||
|
||||
static bool32 IsAnyPlayerExitingCableClub(void)
|
||||
|
||||
+5
-5
@@ -1168,11 +1168,11 @@ const u8 gText_CommErrorEllipsis[] = _("Communication error…");
|
||||
const u8 gText_MoveCloserToLinkPartner[] = _("Move closer to your link partner(s).\nAvoid obstacles between partners.");
|
||||
const u8 gText_ABtnRegistrationCounter[] = _("A Button: Registration Counter");
|
||||
const u8 gText_ABtnTitleScreen[] = _("A Button: Title Screen");
|
||||
const u8 gUnknown_841DF82[] = _("{STR_VAR_1}P LINK");
|
||||
const u8 gUnknown_841DF8B[] = _("BRONZE");
|
||||
const u8 gUnknown_841DF92[] = _("COPPER");
|
||||
const u8 gUnknown_841DF99[] = _("SILVER");
|
||||
const u8 gUnknown_841DFA0[] = _("GOLD");
|
||||
const u8 gText_NumPlayerLink[] = _("{STR_VAR_1}P LINK");
|
||||
const u8 gText_BronzeCard[] = _("BRONZE");
|
||||
const u8 gText_CopperCard[] = _("COPPER");
|
||||
const u8 gText_SilverCard[] = _("SILVER");
|
||||
const u8 gText_GoldCard[] = _("GOLD");
|
||||
const u8 gText_HelpSystemControls_A_Next[] = _("{A_BUTTON}NEXT");
|
||||
const u8 gText_HelpSystemControls_PickOkEnd[] = _("{DPAD_UPDOWN}PICK {A_BUTTON}OK {B_BUTTON}END");
|
||||
const u8 gText_HelpSystemControls_AorBtoCancel[] = _("{A_BUTTON}{B_BUTTON}CANCEL");
|
||||
|
||||
+6
-16
@@ -767,7 +767,7 @@ static void CB2_ReturnFromLinkTrade2(void)
|
||||
gMain.state++;
|
||||
}
|
||||
if (gWirelessCommType == 0)
|
||||
CreateTask(Task_WaitForReceivedRemoteLinkPlayers5SecondTimeout, 1);
|
||||
CreateTask(Task_WaitForLinkPlayerConnection, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1346,9 +1346,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
break;
|
||||
case 3:
|
||||
if (id == 0)
|
||||
{
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(1);
|
||||
}
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_200);
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
break;
|
||||
case 4:
|
||||
@@ -1365,9 +1363,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
break;
|
||||
case 7:
|
||||
if (id == 0)
|
||||
{
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(1);
|
||||
}
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_200);
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
break;
|
||||
case 8:
|
||||
@@ -1384,9 +1380,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
break;
|
||||
case 11:
|
||||
if (id == 0)
|
||||
{
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(1);
|
||||
}
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_200);
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
break;
|
||||
case 12:
|
||||
@@ -1403,9 +1397,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
break;
|
||||
case 15:
|
||||
if (id == 0)
|
||||
{
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(3);
|
||||
}
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_220);
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
break;
|
||||
case 16:
|
||||
@@ -1422,9 +1414,7 @@ static bool8 shedinja_maker_maybe(void)
|
||||
break;
|
||||
case 19:
|
||||
if (id == 0)
|
||||
{
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(4);
|
||||
}
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_40);
|
||||
sTradeMenuResourcesPtr->state++;
|
||||
break;
|
||||
case 20:
|
||||
|
||||
+1
-3
@@ -2583,9 +2583,7 @@ static void CB2_HandleTradeEnded(void)
|
||||
IncrementGameStat(GAME_STAT_POKEMON_TRADES);
|
||||
}
|
||||
if (gWirelessCommType)
|
||||
{
|
||||
MEvent_RecordIdOfWonderCardSenderByEventType(2, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
|
||||
}
|
||||
MysteryGift_TryIncrementStat(CARD_STAT_NUM_TRADES, gLinkPlayers[GetMultiplayerId() ^ 1].trainerId);
|
||||
SetContinueGameWarpStatusToDynamicWarp();
|
||||
LinkFullSave_Init();
|
||||
gMain.state++;
|
||||
|
||||
+2
-2
@@ -1794,11 +1794,11 @@ static void Task_ExchangeCards(u8 taskId)
|
||||
{
|
||||
case 0:
|
||||
if (GetMultiplayerId() == 0)
|
||||
Link_PrepareCmd0xCCCC_Rfu0xA100(2);
|
||||
SendBlockRequest(BLOCK_REQ_SIZE_100);
|
||||
gTasks[taskId].data[0]++;
|
||||
break;
|
||||
case 1:
|
||||
if (GetBlockReceivedStatus() == sub_800A8D4())
|
||||
if (GetBlockReceivedStatus() == GetLinkPlayerCountAsBitFlags())
|
||||
{
|
||||
s32 i;
|
||||
u16 *recvBuff;
|
||||
|
||||
Reference in New Issue
Block a user