Continue trade doc

This commit is contained in:
GriffinR 2019-10-05 10:41:37 -04:00
parent dadb1cb9f1
commit 66a68159b1
13 changed files with 205 additions and 193 deletions

View File

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

View File

@ -9,8 +9,6 @@
#define INGAME_TRADE_HORSEA 2
#define INGAME_TRADE_MEOWTH 3
#define INGAME_TRADE_MAIL_LENGTH 9
#define PLAYER_MON_INVALID 0
#define PLAYER_MON_VALID 1
#define PARTNER_MON_INVALID 2
@ -53,5 +51,7 @@
#define CANT_REGISTER_MON 1
#define CANT_REGISTER_EGG 2
#define LINK_TRADE_TIMEOUT 300
#endif //GUARD_CONSTANTS_TRADE_H

View File

@ -128,7 +128,7 @@ struct UnkRfuStruct_Sub_Unused
struct UnkRfuStruct_2
{
/* 0x000 */ void (*unk_00)(void);
/* 0x000 */ void (*linkRfuCallback)(void);
/* 0x004 */ u16 unk_04;
/* 0x006 */ u8 filler_06[4];
/* 0x00a */ u16 unk_0a;
@ -224,7 +224,7 @@ void sub_800F804(void);
void sub_800F850(void);
u8 sub_800FCD8(void);
bool32 sub_800FE84(const u8 *src, size_t size);
void Rfu_set_zero(void);
void ClearLinkRfuCallback(void);
u8 sub_80104F4(void);
u8 rfu_get_multiplayer_id(void);
bool8 sub_8010100(u8 a0);

View File

@ -15,13 +15,13 @@ extern const struct WindowTemplate gUnknown_0833900C;
s32 sub_807A728(void);
void sub_80773AC(void);
void sub_807AE50(void);
void CB2_LinkTrade(void);
int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8);
int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, struct UnkLinkRfuStruct_02022B14Substruct a1, u16 a2, u16 a3, u8 a4, u16 a5, u8 a6);
int sub_807A918(struct Pokemon*, u16);
void sub_807B140(void);
void sub_807B154(void);
void sub_807F19C(void);
void InitTradeBg(void);
void DrawTextOnTradeWindow(u8, const u8 *, u8);
#endif //GUARD_TRADE_H

View File

@ -346,7 +346,6 @@ static void sub_80B2918(u8 taskId)
HideFieldMessageBox();
gTasks[taskId].func = sub_80B2CB0;
}
// EXCHANGE_STAT_4 or EXCHANGE_STAT_5 in sub_80B2478
else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
{
CloseLink();
@ -394,7 +393,6 @@ static void sub_80B2A08(u8 taskId)
HideFieldMessageBox();
gTasks[taskId].func = sub_80B2CB0;
}
// EXCHANGE_STAT_4 or EXCHANGE_STAT_5 in sub_80B2478
else if (gSpecialVar_Result == 7 || gSpecialVar_Result == 9)
{
CloseLink();
@ -1111,7 +1109,7 @@ static void sub_80B3894(u8 taskId)
case 0:
ScriptContext2_Enable();
FadeScreen(1, 0);
Rfu_set_zero();
ClearLinkRfuCallback();
data[0]++;
break;
case 1:

View File

@ -71,7 +71,7 @@ static const union AnimCmd *const gSpriteAnimTable_832DC34[] =
gSpriteAnim_832DC2C
};
static const struct SpriteSheet gUnknown_0832DC3C =
static const struct SpriteSheet sTradeButtonsSpriteSheet =
{
.data = gTradeButtons_Gfx,
.size = 0x800,
@ -168,7 +168,7 @@ static const struct SpritePalette gSpritePalette_TradeScreenText =
// 2 3 8 9
// 4 5 10 11
// 12
static const u8 gTradeNextSelectedMonTable[][4][6] =
static const u8 gTradeNextSelectedMonTable[(PARTY_SIZE * 2) + 1][4][6] =
{
{
{4, 2, 12, 12, 0, 0},
@ -250,7 +250,7 @@ static const u8 gTradeNextSelectedMonTable[][4][6] =
}
};
static const u8 gTradeMonSpriteCoords[][2] =
static const u8 gTradeMonSpriteCoords[(PARTY_SIZE * 2) + 1][2] =
{
// Your party
{1, 5 },
@ -271,7 +271,7 @@ static const u8 gTradeMonSpriteCoords[][2] =
{23, 18} // CANCEL
};
static const u8 gTradeLevelDisplayCoords[][6][2] =
static const u8 gTradeLevelDisplayCoords[][PARTY_SIZE][2] =
{
{
// Your party
@ -293,7 +293,7 @@ static const u8 gTradeLevelDisplayCoords[][6][2] =
}
};
static const u8 gTradeMonBoxCoords[][6][2] =
static const u8 gTradeMonBoxCoords[][PARTY_SIZE][2] =
{
{
// Your party
@ -598,8 +598,8 @@ static const u8 sTradeMenuPartyMonBoxDimensions[3][2] =
[TRADE_PARTNER] = {19, 3}
};
static const u16 sTradePal_Ball[] = INCBIN_U16("graphics/trade/ball.gbapal");
static const u8 sTradeGfx_Ball[] = INCBIN_U8("graphics/trade/ball.4bpp");
static const u16 sTradePal_PokeBall[] = INCBIN_U16("graphics/trade/pokeball.gbapal");
static const u8 sTradeGfx_PokeBall[] = INCBIN_U8("graphics/trade/pokeball.4bpp");
static const u8 sTradeGfx_PokeBallSymbol[] = INCBIN_U8("graphics/trade/pokeball_symbol.8bpp"); // unused?
static const u16 sTradeTilemap_Cable[] = INCBIN_U16("graphics/trade/cable_closeup_map.bin");
static const u16 sTradeTilemap_PokeBallSymbol[] = INCBIN_U16("graphics/trade/pokeball_symbol_map.bin"); // unused?
@ -704,16 +704,16 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_8338D0C[] =
gSpriteAffineAnim_8338CEC
};
static const struct SpriteSheet gUnknown_08338D18 =
static const struct SpriteSheet sPokeBallSpriteSheet =
{
.data = sTradeGfx_Ball,
.data = sTradeGfx_PokeBall,
.size = 0x600,
.tag = 5557
};
static const struct SpritePalette gUnknown_08338D20 =
static const struct SpritePalette sPokeBallSpritePalette =
{
.data = sTradePal_Ball,
.data = sTradePal_PokeBall,
.tag = 5558
};
@ -760,20 +760,20 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_8338D6C[] =
gSpriteAffineAnim_8338D54
};
static const struct SpriteSheet gUnknown_08338D70 =
static const struct SpriteSheet sGlow1SpriteSheet =
{
.data = sTradeGfx_Glow1,
.size = 0x200,
.tag = 5550
};
static const struct SpritePalette gUnknown_08338D78 =
static const struct SpritePalette sMiscTradeSpritePalette =
{
.data = sTradePal_Misc,
.tag = 5551
};
static const struct SpritePalette gUnknown_08338D80 =
static const struct SpritePalette sGbaSpritePalette =
{
.data = sTradePal_Gba,
.tag = 5555
@ -815,7 +815,7 @@ static const union AnimCmd *const gSpriteAnimTable_8338DB8[] =
gSpriteAnim_8338DB0
};
static const struct SpriteSheet gUnknown_08338DC0 =
static const struct SpriteSheet sGlow2SpriteSheet =
{
.data = sTradeGfx_Glow2,
.size = 0x300,
@ -851,7 +851,7 @@ static const union AnimCmd *const gSpriteAnimTable_8338DF0[] =
gSpriteAnim_8338DE8
};
static const struct SpriteSheet gUnknown_08338DF4 =
static const struct SpriteSheet sCableEndSpriteSheet =
{
.data = sTradeGfx_CableEnd,
.size = 0x100,
@ -912,7 +912,7 @@ static const union AnimCmd *const gSpriteAnimTable_8338E68[] =
gSpriteAnim_8338E40
};
static const struct SpriteSheet gUnknown_08338E6C =
static const struct SpriteSheet sGbaScreenSpriteSheet =
{
.data = sTradeGfx_GbaScreen,
.size = 0x1000,
@ -1022,7 +1022,7 @@ static const struct InGameTrade sIngameTrades[] =
}
};
static const u16 sIngameTradeMail[][INGAME_TRADE_MAIL_LENGTH + 1] =
static const u16 sIngameTradeMail[][MAIL_WORDS_COUNT + 1] =
{
{
EC_WORD_BE,
@ -1122,7 +1122,7 @@ static const struct BgTemplate gUnknown_08339014[] =
},
};
static const s8 gTradeBallVerticalVelocityTable[] =
static const s8 sTradeBallVerticalVelocityTable[] =
{
0, 0, 1, 0,
1, 0, 1, 1,

View File

@ -406,7 +406,7 @@ static void CB2_TradeEvolutionSceneLoadGraphics(void)
gMain.state++;
break;
case 2:
sub_807F19C();
InitTradeBg();
gMain.state++;
break;
case 3:

View File

@ -739,7 +739,7 @@ void ClearLinkCallback(void)
{
if (gWirelessCommType)
{
Rfu_set_zero();
ClearLinkRfuCallback();
}
else
{
@ -751,7 +751,7 @@ void ClearLinkCallback_2(void)
{
if (gWirelessCommType)
{
Rfu_set_zero();
ClearLinkRfuCallback();
}
else
{

View File

@ -3169,7 +3169,7 @@ bool32 sub_800F4F0(void)
sub_8011A64(2, 0x9000);
rfu_clearAllSlot();
gReceivedRemoteLinkPlayers = FALSE;
gUnknown_03005000.unk_00 = 0;
gUnknown_03005000.linkRfuCallback = NULL;
if (gUnknown_03005000.unk_ce4 == 1)
{
sub_8011A64(2, 0x9000);
@ -3264,17 +3264,17 @@ struct UnkLinkRfuStruct_02022B14 *sub_800F7DC(void)
bool32 IsSendingKeysToRfu(void)
{
return gUnknown_03005000.unk_00 == rfu_func_080F97B8;
return gUnknown_03005000.linkRfuCallback == rfu_func_080F97B8;
}
void sub_800F804(void)
{
gUnknown_03005000.unk_00 = rfu_func_080F97B8;
gUnknown_03005000.linkRfuCallback = rfu_func_080F97B8;
}
void Rfu_set_zero(void)
void ClearLinkRfuCallback(void)
{
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_800F820(void)
@ -3287,8 +3287,8 @@ void sub_800F820(void)
void sub_800F850(void)
{
if (gUnknown_03005000.unk_00 == NULL)
gUnknown_03005000.unk_00 = sub_800F820;
if (gUnknown_03005000.linkRfuCallback == NULL)
gUnknown_03005000.linkRfuCallback = sub_800F820;
}
static void sub_800F86C(u8 unused)
@ -3507,7 +3507,7 @@ void sub_800FE50(void *a0)
bool32 sub_800FE84(const u8 *src, size_t size)
{
bool8 r4;
if (gUnknown_03005000.unk_00 != NULL)
if (gUnknown_03005000.linkRfuCallback != NULL)
return FALSE;
if (gSendCmd[0] != 0)
return FALSE;
@ -3530,7 +3530,7 @@ bool32 sub_800FE84(const u8 *src, size_t size)
gUnknown_03005000.unk_6c.unk_04 = gBlockSendBuffer;
}
sub_800FD14(0x8800);
gUnknown_03005000.unk_00 = rfufunc_80F9F44;
gUnknown_03005000.linkRfuCallback = rfufunc_80F9F44;
gUnknown_03005000.unk_5b = 0;
return TRUE;
}
@ -3543,12 +3543,12 @@ static void rfufunc_80F9F44(void)
if (gUnknown_03005000.unk_0c == 1)
{
if (++gUnknown_03005000.unk_5b > 2)
gUnknown_03005000.unk_00 = sub_800FFB0;
gUnknown_03005000.linkRfuCallback = sub_800FFB0;
}
else
{
if ((gRecvCmds[GetMultiplayerId()][0] & 0xff00) == 0x8800)
gUnknown_03005000.unk_00 = sub_800FFB0;
gUnknown_03005000.linkRfuCallback = sub_800FFB0;
}
}
}
@ -3564,7 +3564,7 @@ static void sub_800FFB0(void)
if (gUnknown_03005000.unk_6c.unk_02 <= gUnknown_03005000.unk_6c.unk_00)
{
gUnknown_03005000.unk_6c.unk_10 = 0;
gUnknown_03005000.unk_00 = rfufunc_80FA020;
gUnknown_03005000.linkRfuCallback = rfufunc_80FA020;
}
}
@ -3586,11 +3586,11 @@ static void rfufunc_80FA020(void)
gUnknown_02022B44.unk_64++;
}
else
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
}
else
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
bool8 sub_8010100(u8 a0)
@ -3606,7 +3606,7 @@ void sub_801011C(void)
sub_800C048();
gReceivedRemoteLinkPlayers = 0;
gUnknown_03005000.unk_ef = 1;
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_8010148(void)
@ -3624,7 +3624,7 @@ void sub_8010168(void)
gUnknown_03005000.unk_ce4 = 2;
}
else
gUnknown_03005000.unk_00 = sub_8010148;
gUnknown_03005000.linkRfuCallback = sub_8010148;
}
void LinkRfu_FatalError(void)
@ -3654,7 +3654,7 @@ void sub_80101CC(void)
sub_8010168();
}
else
gUnknown_03005000.unk_00 = sub_8010168;
gUnknown_03005000.linkRfuCallback = sub_8010168;
}
}
@ -3663,16 +3663,16 @@ void sub_801022C(void)
if (gSendCmd[0] == 0 && gUnknown_03005000.unk_ce8 == 0)
{
sub_800FD14(0x5f00);
gUnknown_03005000.unk_00 = sub_80101CC;
gUnknown_03005000.linkRfuCallback = sub_80101CC;
}
}
void sub_8010264(u8 taskId)
{
if (gUnknown_03005000.unk_00 == NULL)
if (gUnknown_03005000.linkRfuCallback == NULL)
{
gUnknown_03005000.unk_cd9 = 1;
gUnknown_03005000.unk_00 = sub_801022C;
gUnknown_03005000.linkRfuCallback = sub_801022C;
DestroyTask(taskId);
}
}
@ -3708,7 +3708,7 @@ void sub_80102B8(void)
for (i = 0; i < MAX_RFU_PLAYERS; i++)
gUnknown_03005000.unk_e9[i] = 0;
gUnknown_03005000.unk_100++;
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
gUnknown_03005000.unk_fe++;
}
@ -3718,7 +3718,7 @@ void sub_8010358(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_80102B8;
gUnknown_03005000.linkRfuCallback = sub_80102B8;
}
}
@ -3732,7 +3732,7 @@ void sub_8010390(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_80102B8;
gUnknown_03005000.linkRfuCallback = sub_80102B8;
}
}
else
@ -3748,7 +3748,7 @@ void sub_8010390(void)
if (gUnknown_03005000.unk_124.unk_8c2 == 0 && gSendCmd[0] == 0)
{
sub_800FD14(0x6600);
gUnknown_03005000.unk_00 = sub_8010358;
gUnknown_03005000.linkRfuCallback = sub_8010358;
}
}
}
@ -3756,9 +3756,9 @@ void sub_8010390(void)
void sub_8010434(void)
{
if (gUnknown_03005000.unk_00 == NULL)
if (gUnknown_03005000.linkRfuCallback == NULL)
{
gUnknown_03005000.unk_00 = sub_8010390;
gUnknown_03005000.linkRfuCallback = sub_8010390;
gUnknown_03005000.unk_fe = 0;
}
}
@ -3804,13 +3804,13 @@ bool8 sub_8010500(void)
{
if (gUnknown_03005000.unk_f1 == 2)
return FALSE;
return gUnknown_03005000.unk_00 ? FALSE : TRUE;
return gUnknown_03005000.linkRfuCallback ? FALSE : TRUE;
}
static void sub_8010528(void)
{
if (gUnknown_03005000.unk_00)
gUnknown_03005000.unk_00();
if (gUnknown_03005000.linkRfuCallback)
gUnknown_03005000.linkRfuCallback();
}
bool8 sub_8010540(void)
@ -4345,12 +4345,12 @@ void sub_80111B0(bool32 a0)
void sub_80111DC(void)
{
sub_8011E94(gUnknown_03004140.unk_00, 1);
gUnknown_03005000.unk_00 = NULL;
gUnknown_03005000.linkRfuCallback = NULL;
}
void sub_80111FC(void)
{
gUnknown_03005000.unk_00 = sub_80111DC;
gUnknown_03005000.linkRfuCallback = sub_80111DC;
}
void sub_801120C(u8 a0, u8 unused1)

View File

@ -179,7 +179,7 @@ static void DisplayPartyPokemonGenderNidoranCheck(struct Pokemon *, struct Struc
static void DisplayPartyPokemonHPCheck(struct Pokemon *, struct Struct203CEDC *, u8);
static void DisplayPartyPokemonMaxHPCheck(struct Pokemon *, struct Struct203CEDC *, u8);
static void DisplayPartyPokemonHPBarCheck(struct Pokemon *, struct Struct203CEDC *);
static void DisplayPartyPokemonOtherText(u8, struct Struct203CEDC *, u8);
static void DisplayPartyPokemonSelectionText(u8, struct Struct203CEDC *, u8);
static u8 sub_81B8830(void);
static bool8 GetBattleEntryEligibility(struct Pokemon *);
static bool8 sub_81B218C(u8);
@ -1988,7 +1988,7 @@ static void DisplayPartyPokemonSelectData(u8 slot, u8 stringID)
DisplayPartyPokemonLevelCheck(mon, &gUnknown_0203CEDC[slot], 0);
DisplayPartyPokemonGenderNidoranCheck(mon, &gUnknown_0203CEDC[slot], 0);
}
DisplayPartyPokemonOtherText(stringID, &gUnknown_0203CEDC[slot], 0);
DisplayPartyPokemonSelectionText(stringID, &gUnknown_0203CEDC[slot], 0);
}
static void DisplayPartyPokemonSelectForBattle(u8 slot)
@ -3531,7 +3531,7 @@ static void DisplayPartyPokemonHPBar(u16 hp, u16 maxhp, struct Struct203CEDC *pt
CopyWindowToVram(ptr->windowId, 2);
}
static void DisplayPartyPokemonOtherText(u8 stringID, struct Struct203CEDC *ptr, u8 c)
static void DisplayPartyPokemonSelectionText(u8 stringID, struct Struct203CEDC *ptr, u8 c)
{
if (c != 0)
{
@ -4305,9 +4305,9 @@ static void sub_81B469C(u8 taskId)
if (gUnknown_0203CEC8.unk8_0 == 12)
{
if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE)
DisplayPartyPokemonOtherText(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
DisplayPartyPokemonSelectionText(11, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
else
DisplayPartyPokemonOtherText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
DisplayPartyPokemonSelectionText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
}
sub_81B1C1C(taskId);
}
@ -4403,7 +4403,7 @@ static void sub_81B4988(u8 taskId)
SetMonData(mon, MON_DATA_HELD_ITEM, &item);
sub_81B5C94(mon, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId]);
DisplayPartyPokemonOtherText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
DisplayPartyPokemonSelectionText(12, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
gTasks[taskId].func = sub_81B1C1C;
}
}
@ -4572,7 +4572,7 @@ static void CursorCb_Enter(u8 taskId)
{
PlaySE(SE_SELECT);
gSelectedOrderFromParty[i] = gUnknown_0203CEC8.slotId + 1;
DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
DisplayPartyPokemonSelectionText(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
if (i == (unk - 1))
sub_81B4F88();
DisplayPartyMenuStdMessage(0);
@ -4613,11 +4613,11 @@ static void CursorCb_NoEntry(u8 taskId)
break;
}
}
DisplayPartyPokemonOtherText(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
DisplayPartyPokemonSelectionText(1, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1);
for (i = 0; i < (unk - 1); i++)
{
if (gSelectedOrderFromParty[i] != 0)
DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1);
DisplayPartyPokemonSelectionText(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1);
}
DisplayPartyMenuStdMessage(0);
gTasks[taskId].func = sub_81B1370;

View File

@ -1559,8 +1559,8 @@ void sub_80C6D80(const u8 *string, void *dst, u8 zero1, u8 zero2, s32 arg4)
txtColor[0] = TEXT_COLOR_TRANSPARENT;
else
txtColor[0] = zero2;
txtColor[1] = 0xF;
txtColor[2] = 0xE;
txtColor[1] = TEXT_DYNAMIC_COLOR_6;
txtColor[2] = TEXT_DYNAMIC_COLOR_5;
AddTextPrinterParameterized4(windowId, 1, 0, 1, 0, 0, txtColor, -1, string);
val = arg4;

View File

@ -71,8 +71,14 @@ struct InGameTrade {
/*0x38*/ u16 requestedSpecies;
};
static EWRAM_DATA u8 *sTradeStringAllocBuffer = NULL;
static EWRAM_DATA u8 *sTradeStringBuffer[14] = {NULL};
static EWRAM_DATA u8 *sMessageBoxAllocBuffer = NULL;
// Bytes 0-2 are used for the player's name box
// Bytes 3-5 are used for the partner's name box
// Bytes 6-7 are used for the Cancel box
// Bytes 8-13 are used for the Choose a Pokemon box
static EWRAM_DATA u8 *sMessageBoxTileBuffers[14] = {NULL};
EWRAM_DATA struct MailStruct gTradeMail[PARTY_SIZE] = {0};
EWRAM_DATA u8 gSelectedTradeMonPositions[2] = {0};
static EWRAM_DATA struct {
@ -104,7 +110,7 @@ static EWRAM_DATA struct {
/*0x007E*/ u8 partnerCursorPosition;
/*0x007F*/ u8 unused_7F;
/*0x0080*/ u16 linkData[20];
/*0x00A8*/ u8 unk_A8; //state var for sub_807A1F0
/*0x00A8*/ u8 unk_A8; // used as a timer and state var for sub_807A1F0
/*0x00A9*/ u8 unk_A9[11]; //ribbons
/*0x00B4*/ u8 filler_B4[0x8D0-0xB4];
/*0x08D0*/ struct {
@ -122,9 +128,9 @@ static EWRAM_DATA struct {
/*0x72*/ u8 unk_72;
/*0x73*/ u8 unk_73;
/*0x74*/ u16 linkData[10];
/*0x88*/ u8 unk_88;
/*0x89*/ u8 unk_89;
/*0x8A*/ u16 unk_8A;
/*0x88*/ u8 alwaysZero_88;
/*0x89*/ u8 alwaysZero_89;
/*0x8A*/ u16 linkTimeoutCounter;
/*0x8C*/ u16 neverRead_8C;
/*0x8E*/ u8 pokePicSpriteIdxs[2];
/*0x90*/ u8 unk_90; //sprite id
@ -153,7 +159,7 @@ static EWRAM_DATA struct {
/*0xF4*/ u16 cachedMapMusic;
/*0xF6*/ u8 textColors[3];
/*0xF9*/ u8 filler_F9;
/*0xFA*/ bool8 isCableLink;
/*0xFA*/ bool8 isCableTrade;
/*0xFB*/ u8 unk_FB;
/*0xFC*/ u8 unk_FC;
/*0xFD*/ u8 unk_FD;
@ -199,19 +205,19 @@ static void sub_807AA7C(struct Sprite *sprite);
static void sub_807AABC(struct Sprite *sprite);
static void sub_807AAE0(struct Sprite *sprite);
static void sub_807AB04(struct Sprite *sprite);
static void sub_807B170(void);
static void InitTradeBgInternal(void);
static void sub_807B60C(void);
static void sub_807B62C(u8);
static void sub_807BA94(void);
static void LoadTradeSequenceSpriteSheetsAndPalettes(void);
static void SetTradeSceneStrings(void);
static bool8 sub_807BBC8(void);
static bool8 sub_807BBEC(void);
static bool8 sub_807CFC8(void);
static bool8 AnimateTradeSequence(void);
static bool8 AnimateTradeSequenceCable(void);
static bool8 AnimateTradeSequenceWireless(void);
static void sub_807E55C(struct Sprite *sprite);
static void sub_807E5D8(struct Sprite *sprite);
static void sub_807E64C(struct Sprite *sprite);
static void sub_807E6AC(struct Sprite *sprite);
static void sub_807E784(void);
static void BuffeInGameTradeMonName(void);
static void SetInGameTradeMail(struct MailStruct *mail, const struct InGameTrade *trade);
static void sub_807EA2C(void);
static void sub_807EACC(void);
@ -376,11 +382,11 @@ static void sub_80773D0(void)
case 0:
sTradeData = AllocZeroed(sizeof(*sTradeData));
InitTradeMenu();
sTradeStringAllocBuffer = AllocZeroed(14 * 256);
sMessageBoxAllocBuffer = AllocZeroed(14 * 256);
for (i = 0; i < 14; i++)
for (i = 0; i < (int)ARRAY_COUNT(sMessageBoxTileBuffers); i++)
{
sTradeStringBuffer[i] = &sTradeStringAllocBuffer[i * 256];
sMessageBoxTileBuffers[i] = &sMessageBoxAllocBuffer[i * 256];
}
gMain.state++;
@ -522,11 +528,11 @@ static void sub_80773D0(void)
gMain.state++;
break;
case 10:
sub_80C6D80(gSaveBlock2Ptr->playerName, sTradeStringBuffer[0], 0, 0, 3);
sub_80C6D80(gSaveBlock2Ptr->playerName, sMessageBoxTileBuffers[0], 0, 0, 3);
id = GetMultiplayerId();
sub_80C6D80(gLinkPlayers[id ^ 1].name, sTradeStringBuffer[3], 0, 0, 3);
sub_80C6D80(sTradeActionTexts[TRADE_ACTION_TEXT_CANCEL], sTradeStringBuffer[6], 0, 0, 2);
sub_807A308(sTradeActionTexts[TRADE_ACTION_TEXT_CHOOSE_MON], sTradeStringBuffer[8], 24);
sub_80C6D80(gLinkPlayers[id ^ 1].name, sMessageBoxTileBuffers[3], 0, 0, 3);
sub_80C6D80(sTradeActionTexts[TRADE_ACTION_TEXT_CANCEL], sMessageBoxTileBuffers[6], 0, 0, 2);
sub_807A308(sTradeActionTexts[TRADE_ACTION_TEXT_CHOOSE_MON], sMessageBoxTileBuffers[8], 24);
gMain.state++;
sTradeData->unk_A8 = 0;
break;
@ -709,11 +715,11 @@ static void sub_8077B74(void)
gMain.state++;
break;
case 10:
sub_80C6D80(gSaveBlock2Ptr->playerName, sTradeStringBuffer[0], 0, 0, 3);
sub_80C6D80(gSaveBlock2Ptr->playerName, sMessageBoxTileBuffers[0], 0, 0, 3);
id = GetMultiplayerId();
sub_80C6D80(gLinkPlayers[id ^ 1].name, sTradeStringBuffer[3], 0, 0, 3);
sub_80C6D80(sTradeActionTexts[TRADE_ACTION_TEXT_CANCEL], sTradeStringBuffer[6], 0, 0, 2);
sub_807A308(sTradeActionTexts[TRADE_ACTION_TEXT_CHOOSE_MON], sTradeStringBuffer[8], 24);
sub_80C6D80(gLinkPlayers[id ^ 1].name, sMessageBoxTileBuffers[3], 0, 0, 3);
sub_80C6D80(sTradeActionTexts[TRADE_ACTION_TEXT_CANCEL], sMessageBoxTileBuffers[6], 0, 0, 2);
sub_807A308(sTradeActionTexts[TRADE_ACTION_TEXT_CHOOSE_MON], sMessageBoxTileBuffers[8], 24);
gMain.state++;
sTradeData->unk_A8 = 0;
break;
@ -844,27 +850,29 @@ static void sub_80781C8(void)
{
gMain.savedCallback = sub_80773AC;
// Wireless Link Trade
if (gWirelessCommType)
{
if (sub_8010500())
{
Free(sTradeStringAllocBuffer);
Free(sMessageBoxAllocBuffer);
FreeAllWindowBuffers();
Free(sTradeData);
gMain.callback1 = NULL;
DestroyWirelessStatusIndicatorSprite();
SetMainCallback2(sub_807AE50);
SetMainCallback2(CB2_LinkTrade);
}
}
// Cable Link Trade
else
{
if (!gReceivedRemoteLinkPlayers)
{
Free(sTradeStringAllocBuffer);
Free(sMessageBoxAllocBuffer);
FreeAllWindowBuffers();
Free(sTradeData);
gMain.callback1 = NULL;
SetMainCallback2(sub_807AE50);
SetMainCallback2(CB2_LinkTrade);
}
}
}
@ -1299,7 +1307,7 @@ static void sub_8078C34(void)
sub_80789FC();
}
static u8 sub_8078C6C(u8 oldPosition, u8 direction)
static u8 GetNewTradeMenuPosition(u8 oldPosition, u8 direction)
{
int i;
u8 newPosition = 0;
@ -1318,9 +1326,9 @@ static u8 sub_8078C6C(u8 oldPosition, u8 direction)
static void TradeMenuMoveCursor(u8 *cursorPosition, u8 direction)
{
u8 newPosition = sub_8078C6C(*cursorPosition, direction);
u8 newPosition = GetNewTradeMenuPosition(*cursorPosition, direction);
if (newPosition == 12) // CANCEL
if (newPosition == (PARTY_SIZE * 2)) // CANCEL
{
StartSpriteAnim(&gSprites[sTradeData->cursorSpriteIdx], 1);
gSprites[sTradeData->cursorSpriteIdx].pos1.x = 224;
@ -1356,7 +1364,7 @@ static void sub_8078D78(void)
}
}
static void sub_8078DBC(void)
static void TradeMenuProcessInput(void)
{
if (gMain.newAndRepeatedKeys & DPAD_UP)
{
@ -1406,7 +1414,7 @@ static void sub_8078DBC(void)
}
}
static void sub_8078EF8(void)
static void ReturnToTradeMenu(void)
{
sub_8079F74();
sTradeData->unk_6F = 0;
@ -1420,7 +1428,7 @@ static void TradeMenuProcessInput_SelectedMon(void)
{
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
sub_8078EF8();
ReturnToTradeMenu();
break;
case MENU_NOTHING_CHOSEN:
break;
@ -1454,12 +1462,12 @@ static void TradeMenuProcessInput_SelectedMon(void)
}
}
static void sub_8079034(void)
static void ReturnToTradeMenuAfterButtonPress(void)
{
if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON))
{
PlaySE(SE_SELECT);
sub_8078EF8();
ReturnToTradeMenu();
}
}
@ -1582,7 +1590,7 @@ static void sub_807929C(void)
{
int i;
for (i = 0; i < sTradeData->partyCounts[TRADE_PARTNER] - 4; i++)
for (i = 0; i < sTradeData->partyCounts[1] - 4; i++)
{
PutWindowTilemap(i + 12);
CopyWindowToVram(i + 12, 1);
@ -1603,7 +1611,7 @@ static void sub_80792E4(void)
case 1:
case MENU_B_PRESSED:
PlaySE(SE_SELECT);
sub_8078EF8();
ReturnToTradeMenu();
break;
}
}
@ -1687,7 +1695,7 @@ static void sub_80794CC(void)
{
if (sub_80771BC() && sub_807A09C() == 0)
{
Free(sTradeStringAllocBuffer);
Free(sMessageBoxAllocBuffer);
Free(sTradeData);
FreeAllWindowBuffers();
DestroyWirelessStatusIndicatorSprite();
@ -1698,7 +1706,7 @@ static void sub_80794CC(void)
{
if (!gReceivedRemoteLinkPlayers)
{
Free(sTradeStringAllocBuffer);
Free(sMessageBoxAllocBuffer);
Free(sTradeData);
FreeAllWindowBuffers();
SetMainCallback2(CB2_ReturnToFieldFromMultiplayer);
@ -1730,7 +1738,7 @@ static void sub_80795AC(void)
switch (sTradeData->unk_6F)
{
case 0:
sub_8078DBC();
TradeMenuProcessInput();
break;
case 1:
TradeMenuProcessInput_SelectedMon();
@ -1772,7 +1780,7 @@ static void sub_80795AC(void)
Wait2SecondsAndCreateYesNoMenu();
break;
case 15:
sub_8079034();
ReturnToTradeMenuAfterButtonPress();
break;
case 16:
sub_8079550();
@ -2015,7 +2023,11 @@ static void sub_8079E44(u8 whichParty)
for (i = 0; i < sTradeData->partyCounts[whichParty]; i++)
{
DrawTradeMenuPartyMonInfo(whichParty, i, gTradeLevelDisplayCoords[whichParty][i][0], gTradeLevelDisplayCoords[whichParty][i][1], gTradeMonBoxCoords[whichParty][i][0], gTradeMonBoxCoords[whichParty][i][1]);
DrawTradeMenuPartyMonInfo(whichParty, i,
gTradeLevelDisplayCoords[whichParty][i][0],
gTradeLevelDisplayCoords[whichParty][i][1],
gTradeMonBoxCoords[whichParty][i][0],
gTradeMonBoxCoords[whichParty][i][1]);
}
}
#else
@ -2203,9 +2215,9 @@ static bool8 sub_807A1F0(void)
{
struct SpriteSheet sheet;
if (sTradeData->unk_A8 < 14)
if (sTradeData->unk_A8 < (int)ARRAY_COUNT(sMessageBoxTileBuffers))
{
sheet.data = sTradeStringBuffer[sTradeData->unk_A8];
sheet.data = sMessageBoxTileBuffers[sTradeData->unk_A8];
sheet.size = 0x100;
sheet.tag = 200 + sTradeData->unk_A8;
}
@ -2233,7 +2245,7 @@ static bool8 sub_807A1F0(void)
sTradeData->unk_A8++;
break;
case 16:
LoadSpriteSheet(&gUnknown_0832DC3C);
LoadSpriteSheet(&sTradeButtonsSpriteSheet);
sTradeData->unk_A8++;
break;
case 17:
@ -2350,6 +2362,7 @@ static void sub_807A5B0(void)
}
}
//TODO:
static u32 sub_807A5F4(struct Pokemon *playerParty, int partyCount, int monIdx)
{
int i, sum;
@ -2860,7 +2873,7 @@ static void sub_807AB04(struct Sprite *sprite)
}
}
static void sub_807AB28(void)
static void SetTradeBGAffine(void)
{
struct BgAffineDstData affine;
@ -2875,7 +2888,7 @@ static void sub_807AB28(void)
SetGpuReg(REG_OFFSET_BG2Y_H, affine.dy >> 16);
}
static void sub_807ABCC(void)
static void SetTradeGpuRegs(void)
{
u16 dispcnt;
@ -2890,42 +2903,42 @@ static void sub_807ABCC(void)
}
else
{
sub_807AB28();
SetTradeBGAffine();
}
}
static void sub_807AC24(void)
static void VBlankCB_Trade(void)
{
sub_807ABCC();
SetTradeGpuRegs();
LoadOam();
ProcessSpriteCopyRequests();
TransferPlttBuffer();
}
static void sub_807AC3C(void)
static void ClearLinkTimeoutCounter(void)
{
sTradeWindowData->unk_8A = 0;
sTradeWindowData->unk_88 = 0;
sTradeWindowData->unk_89 = 0;
sTradeWindowData->linkTimeoutCounter = 0;
sTradeWindowData->alwaysZero_88 = 0;
sTradeWindowData->alwaysZero_89 = 0;
}
static void sub_807AC64(void)
static void CheckForLinkTimeout(void)
{
if (sTradeWindowData->unk_88 == sTradeWindowData->unk_89)
sTradeWindowData->unk_8A++;
if (sTradeWindowData->alwaysZero_88 == sTradeWindowData->alwaysZero_89)
sTradeWindowData->linkTimeoutCounter++;
else
sTradeWindowData->unk_8A = 0;
sTradeWindowData->linkTimeoutCounter = 0;
if (sTradeWindowData->unk_8A > 300)
if (sTradeWindowData->linkTimeoutCounter > LINK_TRADE_TIMEOUT)
{
CloseLink();
SetMainCallback2(CB2_LinkError);
sTradeWindowData->unk_8A = 0;
sTradeWindowData->unk_89 = 0;
sTradeWindowData->unk_88 = 0;
sTradeWindowData->linkTimeoutCounter = 0;
sTradeWindowData->alwaysZero_89 = 0;
sTradeWindowData->alwaysZero_88 = 0;
}
sTradeWindowData->unk_89 = sTradeWindowData->unk_88;
sTradeWindowData->alwaysZero_89 = sTradeWindowData->alwaysZero_88;
}
static u32 TradeGetMultiplayerId(void)
@ -2978,7 +2991,7 @@ static void sub_807ACFC(u8 whichParty, u8 a1)
}
}
void sub_807AE50(void)
void CB2_LinkTrade(void)
{
switch (gMain.state)
{
@ -2993,9 +3006,9 @@ void sub_807AE50(void)
ResetTasks();
ResetSpriteData();
FreeAllSpritePalettes();
SetVBlankCallback(sub_807AC24);
sub_807B170();
sub_807AC3C();
SetVBlankCallback(VBlankCB_Trade);
InitTradeBgInternal();
ClearLinkTimeoutCounter();
gMain.state++;
sTradeWindowData->neverRead_8C = 0;
sTradeWindowData->state = 0;
@ -3012,7 +3025,7 @@ void sub_807AE50(void)
case 1:
if (!gReceivedRemoteLinkPlayers)
{
sTradeWindowData->isCableLink = TRUE;
sTradeWindowData->isCableTrade = TRUE;
OpenLink();
gMain.state++;
sTradeWindowData->timer = 0;
@ -3042,7 +3055,7 @@ void sub_807AE50(void)
}
else
{
sub_807AC64();
CheckForLinkTimeout();
}
}
else
@ -3051,7 +3064,7 @@ void sub_807AE50(void)
}
break;
case 4:
sub_807AC64();
CheckForLinkTimeout();
if (gReceivedRemoteLinkPlayers == TRUE && IsLinkPlayerDataExchangeComplete() == TRUE)
gMain.state++;
break;
@ -3076,9 +3089,9 @@ void sub_807AE50(void)
gMain.state++;
break;
case 9:
sub_807BA94();
LoadSpriteSheet(&gUnknown_08338D18);
LoadSpritePalette(&gUnknown_08338D20);
LoadTradeSequenceSpriteSheetsAndPalettes();
LoadSpriteSheet(&sPokeBallSpriteSheet);
LoadSpritePalette(&sPokeBallSpritePalette);
gMain.state++;
break;
case 10:
@ -3123,7 +3136,7 @@ void sub_807B154(void)
CopyWindowToVram(0, 3);
}
static void sub_807B170(void)
static void InitTradeBgInternal(void)
{
SetGpuReg(REG_OFFSET_DISPCNT, 0);
ResetBgsAndClearDma3BusyFlags(0);
@ -3164,8 +3177,8 @@ static void CB2_InGameTrade(void)
ResetTasks();
ResetSpriteData();
FreeAllSpritePalettes();
SetVBlankCallback(sub_807AC24);
sub_807B170();
SetVBlankCallback(VBlankCB_Trade);
InitTradeBgInternal();
sTradeWindowData->isLinkTrade = FALSE;
sTradeWindowData->neverRead_8C = 0;
sTradeWindowData->state = 0;
@ -3201,9 +3214,9 @@ static void CB2_InGameTrade(void)
gMain.state++;
break;
case 9:
sub_807BA94();
LoadSpriteSheet(&gUnknown_08338D18);
LoadSpritePalette(&gUnknown_08338D20);
LoadTradeSequenceSpriteSheetsAndPalettes();
LoadSpriteSheet(&sPokeBallSpriteSheet);
LoadSpritePalette(&sPokeBallSpritePalette);
gMain.state++;
break;
case 10:
@ -3299,7 +3312,7 @@ static void sub_807B5B8(void)
static void sub_807B60C(void)
{
sub_807BBC8();
AnimateTradeSequence();
RunTasks();
RunTextPrinters();
AnimateSprites();
@ -3343,7 +3356,7 @@ static void sub_807B62C(u8 a0)
BGCNT_SCREENBASE(18) |
BGCNT_TXT256x512);
if (sTradeWindowData->isCableLink)
if (sTradeWindowData->isCableTrade)
{
DmaCopy16Defvars(3, sTradeTilemap_GbaCable, (void *) BG_SCREEN_ADDR(5), 0x1000);
}
@ -3361,7 +3374,7 @@ static void sub_807B62C(u8 a0)
case 2:
sTradeWindowData->bg1vofs = 0;
sTradeWindowData->bg1hofs = 0;
if (!sTradeWindowData->isCableLink)
if (!sTradeWindowData->isCableTrade)
{
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_1 |
DISPCNT_OBJ_1D_MAP |
@ -3409,7 +3422,7 @@ static void sub_807B62C(u8 a0)
DmaCopyLarge16(3, sTradeAffine_Gba, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000);
if (sTradeWindowData->isCableLink)
if (sTradeWindowData->isCableTrade)
{
DmaCopy16Defvars(3, sTradeAffineMap_GbaCable, (void *) BG_SCREEN_ADDR(18), 0x100);
}
@ -3442,7 +3455,7 @@ static void sub_807B62C(u8 a0)
DmaCopyLarge16(3, sTradeAffine_Gba, (void *) BG_CHAR_ADDR(1), 0x2840, 0x1000);
if (sTradeWindowData->isCableLink)
if (sTradeWindowData->isCableTrade)
{
DmaCopy16Defvars(3, sTradeAffineMap_GbaCable, (void *) BG_SCREEN_ADDR(18), 0x100);
}
@ -3467,14 +3480,14 @@ static void sub_807B62C(u8 a0)
}
}
static void sub_807BA94(void)
static void LoadTradeSequenceSpriteSheetsAndPalettes(void)
{
LoadSpriteSheet(&gUnknown_08338D70);
LoadSpriteSheet(&gUnknown_08338DC0);
LoadSpriteSheet(&gUnknown_08338DF4);
LoadSpriteSheet(&gUnknown_08338E6C);
LoadSpritePalette(&gUnknown_08338D78);
LoadSpritePalette(&gUnknown_08338D80);
LoadSpriteSheet(&sGlow1SpriteSheet);
LoadSpriteSheet(&sGlow2SpriteSheet);
LoadSpriteSheet(&sCableEndSpriteSheet);
LoadSpriteSheet(&sGbaScreenSpriteSheet);
LoadSpritePalette(&sMiscTradeSpritePalette);
LoadSpritePalette(&sGbaSpritePalette);
}
/// Buffers "[Pokemon] will be sent to [Trainer]" strings
@ -3503,19 +3516,20 @@ static void SetTradeSceneStrings(void)
}
}
static bool8 sub_807BBC8(void)
// returns TRUE if it was a link trade, FALSE if it was an in-game trade
static bool8 AnimateTradeSequence(void)
{
if (sTradeWindowData->isCableLink)
if (sTradeWindowData->isCableTrade)
{
return sub_807BBEC();
return AnimateTradeSequenceCable();
}
else
{
return sub_807CFC8();
return AnimateTradeSequenceWireless();
}
}
static bool8 sub_807BBEC(void)
static bool8 AnimateTradeSequenceCable(void)
{
u16 evoTarget;
@ -3615,7 +3629,7 @@ static bool8 sub_807BBEC(void)
case 24:
if (++sTradeWindowData->timer > 20)
{
sub_807AB28();
SetTradeBGAffine();
sTradeWindowData->unk_91 = CreateSprite(&gSpriteTemplate_8338E74, 120, 80, 0);
sTradeWindowData->state++;
}
@ -3822,7 +3836,7 @@ static bool8 sub_807BBEC(void)
sTradeWindowData->bg1vofs = 348;
sTradeWindowData->state++;
}
if (sTradeWindowData->bg1vofs == 328 && sTradeWindowData->isCableLink)
if (sTradeWindowData->bg1vofs == 328 && sTradeWindowData->isCableTrade)
{
sTradeWindowData->unk_92 = CreateSprite(&gSpriteTemplate_8338DFC, 128, 65, 0);
gSprites[sTradeWindowData->unk_92].callback = sub_807AAE0;
@ -4000,14 +4014,14 @@ static bool8 sub_807BBEC(void)
FREE_AND_SET_NULL(sTradeWindowData);
}
SetMainCallback2(CB2_ReturnToField);
sub_807E784();
BuffeInGameTradeMonName();
}
break;
}
return FALSE;
}
static bool8 sub_807CFC8(void)
static bool8 AnimateTradeSequenceWireless(void)
{
u16 evoTarget;
@ -4515,7 +4529,7 @@ static bool8 sub_807CFC8(void)
FREE_AND_SET_NULL(sTradeWindowData);
}
SetMainCallback2(CB2_ReturnToField);
sub_807E784();
BuffeInGameTradeMonName();
}
break;
}
@ -4600,7 +4614,7 @@ static void sub_807E55C(struct Sprite *sprite)
static void sub_807E5D8(struct Sprite *sprite)
{
sprite->pos2.y += gTradeBallVerticalVelocityTable[sprite->data[0]];
sprite->pos2.y += sTradeBallVerticalVelocityTable[sprite->data[0]];
if (sprite->data[0] == 22)
PlaySE(SE_KON);
if (++ sprite->data[0] == 44)
@ -4618,7 +4632,7 @@ static void sub_807E64C(struct Sprite *sprite)
StartSpriteAffineAnim(sprite, 1);
if (++ sprite->data[1] > 20)
{
sprite->pos2.y -= gTradeBallVerticalVelocityTable[sprite->data[0]];
sprite->pos2.y -= sTradeBallVerticalVelocityTable[sprite->data[0]];
if (++ sprite->data[0] == 23)
{
DestroySprite(sprite);
@ -4646,7 +4660,7 @@ static void sub_807E6AC(struct Sprite *sprite)
PlaySE(SE_KON3);
if (sprite->data[0] == 0x6b)
PlaySE(SE_KON4);
sprite->pos2.y += gTradeBallVerticalVelocityTable[sprite->data[0]];
sprite->pos2.y += sTradeBallVerticalVelocityTable[sprite->data[0]];
if (++sprite->data[0] == 0x6c)
sprite->callback = SpriteCallbackDummy;
}
@ -4660,7 +4674,7 @@ u16 GetInGameTradeSpeciesInfo(void)
return inGameTrade->requestedSpecies;
}
static void sub_807E784(void)
static void BuffeInGameTradeMonName(void)
{
u8 nickname[32];
const struct InGameTrade *inGameTrade = &sIngameTrades[gSpecialVar_0x8004];
@ -4720,7 +4734,7 @@ static void _CreateInGameTradePokemon(u8 whichPlayerMon, u8 whichInGameTrade)
static void SetInGameTradeMail(struct MailStruct *mail, const struct InGameTrade *trade) {
s32 i;
for (i = 0; i < INGAME_TRADE_MAIL_LENGTH; i++)
for (i = 0; i < MAIL_WORDS_COUNT; i++)
{
mail->words[i] = sIngameTradeMail[trade->mailNum][i];
}
@ -4750,7 +4764,7 @@ void CreateInGameTradePokemon(void)
static void sub_807EA2C(void)
{
if (sub_807BBC8() == TRUE)
if (AnimateTradeSequence() == TRUE)
{
DestroySprite(&gSprites[sTradeWindowData->pokePicSpriteIdxs[TRADE_PLAYER]]);
FreeSpriteOamMatrix(&gSprites[sTradeWindowData->pokePicSpriteIdxs[TRADE_PARTNER]]);
@ -5007,9 +5021,9 @@ static void CheckPartnersMonForRibbons(void)
FlagSet(FLAG_SYS_RIBBON_GET);
}
void sub_807F19C(void)
void InitTradeBg(void)
{
sub_807B170();
InitTradeBgInternal();
}
void DrawTextOnTradeWindow(u8 windowId, const u8 *str, u8 speed)

View File

@ -1312,7 +1312,7 @@ void sub_8013F90(u8 taskId)
gSelectedTradeMonPositions[TRADE_PLAYER] = monId;
gSelectedTradeMonPositions[TRADE_PARTNER] = PARTY_SIZE;
gMain.savedCallback = CB2_ReturnToField;
SetMainCallback2(sub_807AE50);
SetMainCallback2(CB2_LinkTrade);
ResetUnionRoomTrade(&sUnionRoomTrade);
DestroyTask(taskId);
}