Sync trade

This commit is contained in:
GriffinR
2022-12-05 13:28:40 -05:00
parent cf66ec69cd
commit 5621d29866
14 changed files with 1213 additions and 1152 deletions
+1 -1
View File
@@ -258,7 +258,7 @@ void InitAnimBgTilemapBuffer(u32 bgId, const void *src);
void AnimLoadCompressedBgTilemap(u32 bgId, const u32 *src);
u8 GetBattleBgPaletteNum(void);
void ToggleBg3Mode(bool8 arg0);
void TradeMenuBouncePartySprites(struct Sprite *sprite);
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite);
void InitSpriteDataForLinearTranslation(struct Sprite *sprite);
void InitAnimLinearTranslation(struct Sprite *sprite);
void StartAnimLinearTranslation(struct Sprite *sprite);
+6 -71
View File
@@ -20,21 +20,13 @@
#define INGAME_TRADE_TANGELA 7
#define INGAME_TRADE_SEEL 8
// Flag IDs for sending link data
#define INITIATE_TRADE 1
#define CANCEL_TRADE 2
#define WANTS_TO_TRADE 1
#define WANTS_TO_CANCEL 2
#define READY_FINISH_TRADE 1
#define FINISH_TRADE 2
// Return values for CanTradeSelectedMon and CanSpinTradeMon
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_EGG_YET2 5
#define CAN_TRADE_MON 0
#define CANT_TRADE_LAST_MON 1
#define CANT_TRADE_NATIONAL 2
#define CANT_TRADE_EGG_YET 3
#define CANT_TRADE_INVALID_MON 4
#define CANT_TRADE_PARTNER_EGG_YET 5
// Return values for CheckValidityOfTradeMons
#define PLAYER_MON_INVALID 0
@@ -46,63 +38,6 @@
#define TRADE_PLAYER_NOT_READY 1
#define TRADE_PARTNER_NOT_READY 2
// Indexes for sTradeActionTexts
#define TRADE_TEXT_CANCEL 0
#define TRADE_TEXT_CHOOSE_MON 1
#define TRADE_TEXT_SUMMARY 2
#define TRADE_TEXT_TRADE 3
#define TRADE_TEXT_CANCEL_TRADE 4
#define TRADE_TEXT_JP_QUIT 5
// Checked to confirm DrawTradeMenuParty has reached final state
#define DRAW_PARTY_FINISH 5
// Message indexes for sTradeMessages
#define TRADE_MSG_STANDBY 0
#define TRADE_MSG_CANCELED 1
#define TRADE_MSG_ONLY_MON1 2
#define TRADE_MSG_ONLY_MON2 3
#define TRADE_MSG_WAITING_FOR_FRIEND 4
#define TRADE_MSG_FRIEND_WANTS_TO_TRADE 5
#define TRADE_MSG_MON_CANT_BE_TRADED 6
#define TRADE_MSG_EGG_CANT_BE_TRADED 7
#define TRADE_MSG_FRIENDS_MON_CANT_BE_TRADED 8
// IDs for QueueAction
#define QUEUE_SEND_DATA 0
#define QUEUE_STANDBY 1
#define QUEUE_ONLY_MON1 2
#define QUEUE_ONLY_MON2 3
#define QUEUE_UNUSED1 4
#define QUEUE_UNUSED2 5
#define QUEUE_MON_CANT_BE_TRADED 6
#define QUEUE_EGG_CANT_BE_TRADED 7
#define QUEUE_FRIENDS_MON_CANT_BE_TRADED 8
#define QUEUE_DELAY_MSG 3
#define QUEUE_DELAY_DATA 5
// IDs for CallTradeMenuFunc
#define TRADEMENUFUNC_MAIN_MENU 0
#define TRADEMENUFUNC_SELECTED_MON 1
#define TRADEMENUFUNC_SHOW_MON_SUMMARY 2
#define TRADEMENUFUNC_CONFIRM_OR_CANCEL_TRADE 3
#define TRADEMENUFUNC_CANCEL_TRADE_PROMPT 4
#define TRADEMENUFUNC_UNUSED_5 5
#define TRADEMENUFUNC_BOTH_MONS_SELECTED 6
#define TRADEMENUFUNC_CONFIRM_TRADE_PROMPT 7
#define TRADEMENUFUNC_REDRAW_MAIN_MENU 8
#define TRADEMENUFUNC_LINK_TRADE_FADE_OUT 9
#define TRADEMENUFUNC_LINK_TRADE_WAIT_FADE 10
#define TRADEMENUFUNC_CANCEL_TRADE_1 11
#define TRADEMENUFUNC_CANCEL_TRADE_2 12
#define TRADEMENUFUNC_START_LINK_TRADE 13
#define TRADEMENUFUNC_DELAY_TRADE_CONFIRM 14
#define TRADEMENUFUNC_UNUSED_15 15
#define TRADEMENUFUNC_LINK_TRADE_WAIT_QUEUE 16
#define TRADEMENUFUNC_PARTNER_MON_INVALID 17
#define TRADEMENUFUNC_STANDBY 100
// Message indexes for sUnionRoomTradeMessages
#define UR_TRADE_MSG_NONE 0
#define UR_TRADE_MSG_NOT_MON_PARTNER_WANTS 1
+3 -3
View File
@@ -4822,10 +4822,10 @@ extern const u8 gMonIcon_QuestionMark[];
// trade
extern const u16 gTradeMenu_Pal[];
extern const u16 gTradeButtons_Pal[];
extern const u16 gTradeCursor_Pal[];
extern const u16 gTradeMenu_Gfx[];
extern const u16 gUnknown_8E9E9FC[];
extern const u16 gTradeButtons_Gfx[];
extern const u16 gTradeMenu_Tilemap[];
extern const u16 gTradeCursor_Gfx[];
extern const u16 gTradeMenuMonBox_Tilemap[];
// mon_markings
+1 -1
View File
@@ -84,7 +84,7 @@ struct RfuGameCompatibilityData
u16 hasNews:1;
u16 hasCard:1;
u16 unknown:1; // Never read
u16 isChampion:1;
u16 canLinkNationally:1;
u16 hasNationalDex:1;
u16 gameClear:1;
u16 version:4;
+1 -1
View File
@@ -41,7 +41,7 @@ void DestroyYesNoMenu(void);
s8 Menu_ProcessInputNoWrapClearOnChoose(void);
void CreateYesNoMenu(const struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos);
void AddItemMenuActionTextPrinters(u8 windowId, u8 fontId, u8 left, u8 top, u8 letterSpacing, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, const u8 *orderArray);
void UnionRoomAndTradeMenuPrintOptions(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
void PrintMenuTable(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
void MultichoiceList_PrintItems(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs, u8 letterSpacing, u8 lineSpacing);
void PrintTextArray(u8 windowId, u8 fontId, u8 left, u8 top, u8 lineHeight, u8 itemCount, const struct MenuAction *strs);
s8 Menu_ProcessInputNoWrapAround_other(void);
+1 -1
View File
@@ -14,7 +14,7 @@ extern const u8 gText_GenderlessSymbol[];
extern const u16 gTradeOrHatchMonShadowTilemap[];
void CB2_StartCreateTradeMenu(void);
s32 Trade_CalcLinkPlayerCompatibilityParam(void);
s32 GetGameProgressForLinkTrade(void);
s32 CanRegisterMonForTradingBoard(struct RfuGameCompatibilityData rfuPlayer, u16 species2, u16 species, u8 isEventLegal);
s32 GetUnionRoomTradeMessageId(struct RfuGameCompatibilityData rfuPlayer, struct RfuGameCompatibilityData rfuPartner, u16 playerSpecies2, u16 partnerSpecies, u8 requestedType, u16 playerSpecies, u8 isEventLegal);
void CB2_ReturnToTradeMenuFromSummary(void);
+1 -1
View File
@@ -965,7 +965,7 @@ void ToggleBg3Mode(bool8 largeScreenSize)
}
}
void TradeMenuBouncePartySprites(struct Sprite *sprite)
void Trade_MoveSelectedMonToTarget(struct Sprite *sprite)
{
sprite->data[1] = sprite->x;
sprite->data[3] = sprite->y;
+3 -3
View File
@@ -1237,11 +1237,11 @@ const u16 gMonMarkingsMenu_Pal[] = INCBIN_U16("graphics/misc/markings2.gbapal");
const u16 gMonMarkingsMenu_Gfx[] = INCBIN_U16("graphics/misc/markings2.4bpp");
const u16 gTradeMenu_Pal[] = INCBIN_U16("graphics/trade/menu.gbapal");
const u16 gTradeButtons_Pal[] = INCBIN_U16("graphics/trade/unknown_DDB444.gbapal");
const u16 gTradeCursor_Pal[] = INCBIN_U16("graphics/trade/unknown_DDB444.gbapal");
const u16 gTradeMenu_Gfx[] = INCBIN_U16("graphics/trade/menu.4bpp");
const u16 gTradeButtons_Gfx[] = INCBIN_U16("graphics/trade/buttons.4bpp");
const u16 gTradeCursor_Gfx[] = INCBIN_U16("graphics/trade/buttons.4bpp");
const u16 gUnknown_8E9E9DC[] = INCBIN_U16("graphics/unused/unused_DDCEE4.bin");
const u16 gUnknown_8E9E9FC[] = INCBIN_U16("graphics/trade/unknown_DDCF04.bin");
const u16 gTradeMenu_Tilemap[] = INCBIN_U16("graphics/trade/unknown_DDCF04.bin");
const u16 gTradeMenuMonBox_Tilemap[] = INCBIN_U16("graphics/trade/menu_mon_box.bin");
const u16 gFameCheckerBgPals[] = INCBIN_U16("graphics/fame_checker/bg.gbapal");
+1 -1
View File
@@ -764,7 +764,7 @@ u8 GetLinkPlayerDataExchangeStatusTimed(int minPlayers, int maxPlayers)
{
if (gLinkPlayers[0].linkType == LINKTYPE_TRADE_SETUP)
{
switch (Trade_CalcLinkPlayerCompatibilityParam())
switch (GetGameProgressForLinkTrade())
{
case TRADE_BOTH_PLAYERS_READY:
sPlayerDataExchangeStatus = EXCHANGE_COMPLETE;
+1 -1
View File
@@ -667,7 +667,7 @@ void InitHostRfuGameData(struct RfuGameData *data, u8 activity, bool32 startedAc
data->compatibility.hasNews = FALSE;
data->compatibility.hasCard = FALSE;
data->compatibility.unknown = FALSE;
data->compatibility.isChampion = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
data->compatibility.canLinkNationally = FlagGet(FLAG_SYS_CAN_LINK_WITH_RS);
data->compatibility.hasNationalDex = IsNationalPokedexEnabled();
data->compatibility.gameClear = FlagGet(FLAG_SYS_GAME_CLEAR);
}
+1 -1
View File
@@ -469,7 +469,7 @@ void MultichoiceList_PrintItems(u8 windowId, u8 fontId, u8 left, u8 top, u8 line
CopyWindowToVram(windowId, COPYWIN_GFX);
}
void UnionRoomAndTradeMenuPrintOptions(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs)
void PrintMenuTable(u8 windowId, u8 fontId, u8 lineHeight, u8 itemCount, const struct MenuAction *strs)
{
u8 left = GetMenuCursorDimensionByFont(fontId, 0);
+1191 -1065
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1176,7 +1176,7 @@ static u32 IsTryingToTradeAcrossVersionTooSoon(struct WirelessLink_Group * data,
{
if (!(gSaveBlock2Ptr->specialSaveWarpFlags & CHAMPION_SAVEWARP))
return UR_TRADE_PLAYER_NOT_READY;
else if (partner->rfu.data.compatibility.isChampion)
else if (partner->rfu.data.compatibility.canLinkNationally)
return UR_TRADE_READY;
}
else
+1 -1
View File
@@ -1195,7 +1195,7 @@ static void PrintKeyboardSwapTextsOnWin3(void)
{
FillWindowPixelBuffer(3, PIXEL_FILL(1));
DrawTextBorderOuter(3, 1, 13);
UnionRoomAndTradeMenuPrintOptions(3, FONT_NORMAL, 14, 5, sKeyboardSwapTexts);
PrintMenuTable(3, FONT_NORMAL, 14, 5, sKeyboardSwapTexts);
Menu_InitCursor(3, FONT_NORMAL, 0, 0, 14, 5, GetCurrentKeyboardPage());
PutWindowTilemap(3);
}