diff --git a/data/scripts/cable_club.inc b/data/scripts/cable_club.inc index 3fcb25807..f20f47ba4 100644 --- a/data/scripts/cable_club.inc +++ b/data/scripts/cable_club.inc @@ -1032,7 +1032,7 @@ OldaleTown_PokemonCenter_2F_EventScript_27759F:: @ 827759F hideobjectat EVENT_OBJ_ID_PLAYER, MAP_PETALBURG_CITY closedoor 5, 1 waitdooranim - special sub_8018090 + special Script_ResetUnionRoomTrade special SetCableClubWarp warpteleport2 MAP_UNION_ROOM, 255, 7, 11 waitstate diff --git a/data/specials.inc b/data/specials.inc index 6a328ca9e..7e9f4e823 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -432,7 +432,7 @@ gSpecials:: @ 81DBA64 def_special BufferUnionRoomPlayerName def_special sub_801DC20 def_special sub_81B8958 - def_special sub_8018090 + def_special Script_ResetUnionRoomTrade def_special IsBadEggInParty def_special ValidateReceivedWonderCard def_special HasAtLeastOneBerry diff --git a/include/constants/trade.h b/include/constants/trade.h index dbaefcdc3..54e58f922 100644 --- a/include/constants/trade.h +++ b/include/constants/trade.h @@ -48,5 +48,10 @@ #define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_1 8 #define UR_TRADE_MSG_CANT_TRADE_WITH_PARTNER_2 9 +// Return values for CanRegisterMonForTradingBoard +#define CAN_REGISTER_MON 0 +#define CANT_REGISTER_MON 1 +#define CANT_REGISTER_EGG 2 + #endif //GUARD_CONSTANTS_TRADE_H diff --git a/include/party_menu.h b/include/party_menu.h index d76e50788..1ea9ea1d1 100644 --- a/include/party_menu.h +++ b/include/party_menu.h @@ -93,12 +93,12 @@ u8 GetCursorSelectionMonId(void); u8 sub_81B1360(void); void sub_81B1370(u8 taskId); u8* GetMonNickname(struct Pokemon *mon, u8 *dest); -u8 sub_81B1B5C(const u8* str, u8 b); +u8 DisplayPartyMenuMessage(const u8* str, u8 b); bool8 sub_81B1BD4(void); void sub_81B1F18(u8 taskId, u8 slot, s8 c, s16 HPDifference, TaskFunc func); u8 pokemon_ailments_get_primary(u32 status); u8 GetMonAilment(struct Pokemon *mon); -void display_pokemon_menu_message(u32 stringID); +void DisplayPartyMenuStdMessage(u32 stringID); void sub_81B47E0(u8 taskId); bool8 FieldCallback_PrepareFadeInFromMenu(void); void sub_81B58A8(void); diff --git a/include/trade.h b/include/trade.h index b415bfa4e..ec94780cb 100644 --- a/include/trade.h +++ b/include/trade.h @@ -16,7 +16,7 @@ extern const struct WindowTemplate gUnknown_0833900C; s32 sub_807A728(void); void sub_80773AC(void); void sub_807AE50(void); -int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16, u16, u8); +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); diff --git a/include/union_room.h b/include/union_room.h index 2fd8d421d..54f09cbeb 100644 --- a/include/union_room.h +++ b/include/union_room.h @@ -135,7 +135,7 @@ union UnkUnion_Main struct UnkStruct_URoom *uRoom; }; -struct TradeUnkStruct +struct UnionRoomTrade { u16 field_0; u16 type; diff --git a/src/data/union_room.h b/src/data/union_room.h index 26f507315..abe91b010 100644 --- a/src/data/union_room.h +++ b/src/data/union_room.h @@ -51,16 +51,12 @@ const u8 gText_5PlayerMode[] = _("5-PLAYER\nMODE"); const u8 *const gUnknown_082EDB60[][5] = { { gText_1PlayerNeeded, - gText_2PlayerMode, - NULL, - NULL, - NULL + gText_2PlayerMode }, { gText_3PlayersNeeded, gText_2PlayersNeeded, gText_1PlayerNeeded, - gText_4PlayerMode, - NULL + gText_4PlayerMode }, { gText_1PlayerNeeded, gText_2PlayerMode, @@ -77,8 +73,7 @@ const u8 *const gUnknown_082EDB60[][5] = { gText_1PlayerNeeded, gText_2PlayerMode, gText_3PlayerMode, - gText_4PlayerMode, - NULL + gText_4PlayerMode } }; @@ -196,55 +191,56 @@ const u8 *const unref_text_ptrs_union_room_2[][2] = { } }; -ALIGNED(4) const u8 gUnknown_082EE2E8[] = _("Somebody has contacted you.{PAUSE 60}"); -ALIGNED(4) const u8 gUnknown_082EE308[] = _("{STR_VAR_1} has contacted you.{PAUSE 60}"); +ALIGNED(4) const u8 sText_SomebodyHasContactedYou[] = _("Somebody has contacted you.{PAUSE 60}"); +ALIGNED(4) const u8 sText_XHasContactedYou[] = _("{STR_VAR_1} has contacted you.{PAUSE 60}"); -const u8 *const gUnknown_082EE324[] = { - gUnknown_082EE2E8, - gUnknown_082EE308 +static const u8 *const gUnknown_082EE324[] = { + sText_SomebodyHasContactedYou, + sText_XHasContactedYou }; -ALIGNED(4) const u8 gUnknown_082EE32C[] = _("Awaiting a response from\nthe other TRAINER…"); -ALIGNED(4) const u8 gUnknown_082EE358[] = _("Awaiting a response from\n{STR_VAR_1}…"); +ALIGNED(4) const u8 sUnionRoom_AwaitingResponseFromTrainer[] = _("Awaiting a response from\nthe other TRAINER…"); +ALIGNED(4) const u8 sUnionRoom_AwaitingResponseFromX[] = _("Awaiting a response from\n{STR_VAR_1}…"); -const u8 *const gUnknown_082EE378[] = { - gUnknown_082EE32C, - gUnknown_082EE358 +static const u8 *const sUnionRoomTexts_AwaitingResponse[] = { + sUnionRoom_AwaitingResponseFromTrainer, + sUnionRoom_AwaitingResponseFromX }; -ALIGNED(4) const u8 gUnionRoom_ShowTrainerCard[] = _("The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?"); -ALIGNED(4) const u8 gUnionRoom_BattleChallenge[] = _("The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?"); -ALIGNED(4) const u8 gUnionRoom_ChatInvitation[] = _("The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?"); -ALIGNED(4) const u8 gUnionRoom_OfferToTradeMon[] = _("There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?"); -ALIGNED(4) const u8 gUnionRoom_OfferToTradeEgg[] = _("There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?"); -ALIGNED(4) const u8 gUnionRoom_ChatDropped[] = _("The chat has been dropped.\p"); -ALIGNED(4) const u8 gUnionRoom_OfferDeclined1[] = _("You declined the offer.\p"); -ALIGNED(4) const u8 gUnionRoom_OfferDeclined2[] = _("You declined the offer.\p"); -ALIGNED(4) const u8 gUnionRoom_ChatEnded[] = _("The chat was ended.\p"); +ALIGNED(4) const u8 sText_ShowTrainerCard[] = _("The other TRAINER showed\nyou their TRAINER CARD.\pWould you like to show your\nTRAINER CARD?"); +ALIGNED(4) const u8 sText_BattleChallenge[] = _("The other TRAINER challenges you\nto battle.\pWill you accept the battle\nchallenge?"); +ALIGNED(4) const u8 sText_ChatInvitation[] = _("The other TRAINER invites you\nto chat.\pWill you accept the chat\ninvitation?"); +ALIGNED(4) const u8 sText_OfferToTradeMon[] = _("There is an offer to trade your\nregistered Lv. {SPECIAL_F7 0x00} {SPECIAL_F7 0x01}\pin exchange for a\nLv. {SPECIAL_F7 0x02} {SPECIAL_F7 0x03}.\pWill you accept this trade\noffer?"); +ALIGNED(4) const u8 sText_OfferToTradeEgg[] = _("There is an offer to trade your\nregistered EGG.\lWill you accept this trade offer?"); +ALIGNED(4) const u8 sText_ChatDropped[] = _("The chat has been dropped.\p"); +ALIGNED(4) const u8 sText_OfferDeclined1[] = _("You declined the offer.\p"); +ALIGNED(4) const u8 sText_OfferDeclined2[] = _("You declined the offer.\p"); +ALIGNED(4) const u8 sText_ChatEnded[] = _("The chat was ended.\p"); -const u8 *const unref_text_ptrs_union_room_3[] = { - gUnionRoom_ShowTrainerCard, - gUnionRoom_BattleChallenge, - gUnionRoom_ChatInvitation, - gUnionRoom_OfferToTradeMon +// Unused +static const u8 *const sUnionRoomTexts_Invitation[] = { + sText_ShowTrainerCard, + sText_BattleChallenge, + sText_ChatInvitation, + sText_OfferToTradeMon }; -ALIGNED(4) const u8 gUnknown_082EE5C0[] = _("Oh, hey! We're in a chat right now.\nWant to join us?"); -ALIGNED(4) const u8 gUnknown_082EE5F8[] = _("{STR_VAR_1}: Hey, {PLAYER}!\nWe're having a chat right now.\lWant to join us?"); -ALIGNED(4) const u8 gUnknown_082EE638[] = _("Oh, hi! We're having a chat now.\nWould you like to join us?"); -ALIGNED(4) const u8 gUnknown_082EE674[] = _("{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe're having a chat now.\lWould you like to join us?"); +ALIGNED(4) const u8 sText_JoinChatMale[] = _("Oh, hey! We're in a chat right now.\nWant to join us?"); +ALIGNED(4) const u8 sText_PlayerJoinChatMale[] = _("{STR_VAR_1}: Hey, {PLAYER}!\nWe're having a chat right now.\lWant to join us?"); +ALIGNED(4) const u8 sText_JoinChatFemale[] = _("Oh, hi! We're having a chat now.\nWould you like to join us?"); +ALIGNED(4) const u8 sText_PlayerJoinChatFemale[] = _("{STR_VAR_1}: Oh, hi, {PLAYER}!\nWe're having a chat now.\lWould you like to join us?"); -const u8 *const gUnknown_082EE6B8[][2] = { +const u8 *const sUnionRoomTexts_JoinChat[][GENDER_COUNT] = { { - gUnknown_082EE5C0, - gUnknown_082EE638 + sText_JoinChatMale, + sText_JoinChatFemale }, { - gUnknown_082EE5F8, - gUnknown_082EE674 + sText_PlayerJoinChatMale, + sText_PlayerJoinChatFemale } }; -ALIGNED(4) const u8 gUnknown_082EE6C8[] = _("……\nThe TRAINER appears to be busy…\p"); +ALIGNED(4) const u8 sText_TrainerAppearsBusy[] = _("……\nThe TRAINER appears to be busy…\p"); ALIGNED(4) const u8 gUnknown_082EE6EC[] = _("A battle, huh?\nAll right, just give me some time."); ALIGNED(4) const u8 gUnknown_082EE720[] = _("You want to chat, huh?\nSure, just wait a little."); ALIGNED(4) const u8 gUnknown_082EE754[] = _("Sure thing! As my “Greetings,”\nhere's my TRAINER CARD."); @@ -323,15 +319,15 @@ const u8 *const gUnknown_082EEB80[] = { gUnknown_082EEB4C }; -ALIGNED(4) const u8 gUnknown_082EEB88[] = _("Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p"); -ALIGNED(4) const u8 gUnknown_082EEBD0[] = _("If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p"); -ALIGNED(4) const u8 gUnknown_082EEC14[] = _("For a battle, you need two\nPOKéMON that are below Lv. 30.\p"); -ALIGNED(4) const u8 gUnknown_082EEC50[] = _("Oh, all right.\nCome see me anytime, okay?\p"); -ALIGNED(4) const u8 gUnknown_082EEC7C[] = _("Oh…\nPlease come by anytime.\p"); +ALIGNED(4) const u8 sText_TrainerBattleBusy[] = _("Whoops! Sorry, but I have to do\nsomething else.\lAnother time, okay?\p"); +ALIGNED(4) const u8 sText_NeedTwoMonsOfLevel30OrLower1[] = _("If you want to battle, you need\ntwo POKéMON that are below\lLv. 30.\p"); +ALIGNED(4) const u8 sText_NeedTwoMonsOfLevel30OrLower2[] = _("For a battle, you need two\nPOKéMON that are below Lv. 30.\p"); +ALIGNED(4) const u8 sText_DeclineBattleMale[] = _("Oh, all right.\nCome see me anytime, okay?\p"); +ALIGNED(4) const u8 sText_DeclineBattleFemale[] = _("Oh…\nPlease come by anytime.\p"); -const u8 *const gUnknown_082EEC9C[] = { - gUnknown_082EEC50, - gUnknown_082EEC7C +const u8 *const sUnionRoomTexts_DeclineBattle[GENDER_COUNT] = { + [MALE] = sText_DeclineBattleMale, + [FEMALE] = sText_DeclineBattleFemale }; ALIGNED(4) const u8 gUnknown_082EECA4[] = _("Oh, sorry!\nI just can't right this instant.\lLet's chat another time.\p"); @@ -351,13 +347,16 @@ ALIGNED(4) const u8 gUnknown_082EEE24[] = _("That's it!\nThis is the right move ALIGNED(4) const u8 gUnknown_082EEE4C[] = _("That's awesome!\nYou can battle that way?\p"); ALIGNED(4) const u8 gUnknown_082EEE78[] = _("You have exquisite timing for\nswitching POKéMON!\p"); -const u8 *const gUnknown_082EEEAC[][4] = { +const u8 *const gUnknown_082EEEAC[GENDER_COUNT][4] = { + [MALE] = { gUnknown_082EED44, gUnknown_082EED6C, gUnknown_082EED98, gUnknown_082EEDBC - }, { + }, + [FEMALE] = + { gUnknown_082EEDF4, gUnknown_082EEE24, gUnknown_082EEE4C, @@ -374,13 +373,16 @@ ALIGNED(4) const u8 gUnknown_082EEFA0[] = _("Ahaha!\nWhat is that about?\p"); ALIGNED(4) const u8 gUnknown_082EEFBC[] = _("Yes, that's exactly it!\nThat's what I meant.\p"); ALIGNED(4) const u8 gUnknown_082EEFEC[] = _("In other words…\nYes! That's right!\p"); -const u8 *const gUnknown_082EF010[][4] = { +const u8 *const gUnknown_082EF010[GENDER_COUNT][4] = { + [MALE] = { gUnknown_082EEECC, gUnknown_082EEEF0, gUnknown_082EEF2C, gUnknown_082EEF50 - }, { + }, + [FEMALE] = + { gUnknown_082EEF7C, gUnknown_082EEFA0, gUnknown_082EEFBC, @@ -393,65 +395,68 @@ ALIGNED(4) const u8 gUnknown_082EF06C[] = _("I hope I get to know you better!\p" ALIGNED(4) const u8 gUnknown_082EF090[] = _("We're showing each other our\nTRAINER CARDS to get acquainted.\p"); ALIGNED(4) const u8 gUnknown_082EF0D0[] = _("Glad to meet you.\nPlease don't be a stranger!\p"); -const u8 *const gUnknown_082EF100[][2] = { +const u8 *const gUnknown_082EF100[GENDER_COUNT][2] = { + [MALE] = { gUnknown_082EF030, gUnknown_082EF06C - }, { + }, + [FEMALE] = + { gUnknown_082EF090, gUnknown_082EF0D0 } }; -ALIGNED(4) const u8 gUnknown_082EF110[] = _("Yeahah!\nI really wanted this POKéMON!\p"); -ALIGNED(4) const u8 gUnknown_082EF138[] = _("Finally, a trade got me that\nPOKéMON I'd wanted a long time.\p"); -ALIGNED(4) const u8 gUnknown_082EF178[] = _("I'm trading POKéMON right now.\p"); -ALIGNED(4) const u8 gUnknown_082EF198[] = _("I finally got that POKéMON I\nwanted in a trade!\p"); +ALIGNED(4) const u8 sText_MaleTraded1[] = _("Yeahah!\nI really wanted this POKéMON!\p"); +ALIGNED(4) const u8 sText_MaleTraded2[] = _("Finally, a trade got me that\nPOKéMON I'd wanted a long time.\p"); +ALIGNED(4) const u8 sText_FemaleTraded1[] = _("I'm trading POKéMON right now.\p"); +ALIGNED(4) const u8 sText_FemaleTraded2[] = _("I finally got that POKéMON I\nwanted in a trade!\p"); -const u8 *const gUnknown_082EF1CC[][4] = { +const u8 *const sUnionRoomTexts_Traded[GENDER_COUNT][4] = { + [MALE] = { - gUnknown_082EF110, - gUnknown_082EF138, - NULL, - NULL - }, { - gUnknown_082EF178, - gUnknown_082EF198, - NULL, - NULL + sText_MaleTraded1, + sText_MaleTraded2 + }, + [FEMALE] = + { + sText_FemaleTraded1, + sText_FemaleTraded2 } }; -ALIGNED(4) const u8 gUnknown_082EF1EC[] = _("{STR_VAR_1} checked the\nTRADING BOARD.\p"); -ALIGNED(4) const u8 gUnknown_082EF20C[] = _("Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?"); -ALIGNED(4) const u8 gUnknown_082EF298[] = _("This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?"); -ALIGNED(4) const u8 unref_text_union_room_6[] = _("We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p"); -ALIGNED(4) const u8 unref_text_union_room_7[] = _("Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n"); -ALIGNED(4) const u8 gUnknown_082EF47C[] = _("Please choose the type of POKéMON\nthat you would like in the trade.\n"); -ALIGNED(4) const u8 gUnknown_082EF4C4[] = _("Which of your party POKéMON will\nyou offer in trade?\p"); -ALIGNED(4) const u8 gUnknown_082EF4FC[] = _("Registration has been canceled.\p"); -ALIGNED(4) const u8 gUnknown_082EF520[] = _("Registration has been completed.\p"); -ALIGNED(4) const u8 gUnknown_082EF544[] = _("The trade has been canceled.\p"); -ALIGNED(4) const u8 gUnknown_082EF564[] = _("Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?"); -ALIGNED(4) const u8 gUnknown_082EF590[] = _("Cancel the registration of your\nEGG?"); -ALIGNED(4) const u8 gUnknown_082EF5B8[] = _("The registration has been canceled.\p"); -ALIGNED(4) const u8 unref_text_union_room_8[] = _("TRAINERS wishing to make a trade\nwill be listed."); -ALIGNED(4) const u8 unref_text_union_room_9[] = _("Please choose the TRAINER with whom\nyou would like to trade POKéMON."); -ALIGNED(4) const u8 gUnknown_082EF65C[] = _("Would you like to ask {STR_VAR_1} to\nmake a trade?"); -ALIGNED(4) const u8 unref_text_union_room_10[] = _("Awaiting a response from\nthe other TRAINER…"); -ALIGNED(4) const u8 unref_text_union_room_11[] = _("You have not registered a POKéMON\nfor trading.\p"); -ALIGNED(4) const u8 gUnknown_082EF6E4[] = _("You don't have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p"); -ALIGNED(4) const u8 gUnknown_082EF718[] = _("You don't have an EGG that\n{STR_VAR_1} wants.\p"); -ALIGNED(4) const u8 gUnknown_082EF740[] = _("{STR_VAR_1} can't make a trade for\nyour POKéMON right now.\p"); -ALIGNED(4) const u8 gUnknown_082EF774[] = _("You can't make a trade for\n{STR_VAR_1}'s POKéMON right now.\p"); +ALIGNED(4) const u8 sText_XCheckedTradingBoard[] = _("{STR_VAR_1} checked the\nTRADING BOARD.\p"); +ALIGNED(4) const u8 sText_RegisterMonAtTradingBoard[] = _("Welcome to the TRADING BOARD.\pYou may register your POKéMON\nand offer it up for a trade.\pWould you like to register one of\nyour POKéMON?"); +ALIGNED(4) const u8 sText_TradingBoardInfo[] = _("This TRADING BOARD is used for\noffering a POKéMON for a trade.\pAll you need to do is register a\nPOKéMON for a trade.\pAnother TRAINER may offer a party\nPOKéMON in return for the trade.\pWe hope you will register POKéMON\nand trade them with many, many\lother TRAINERS.\pWould you like to register one of\nyour POKéMON?"); +ALIGNED(4) const u8 sText_ThankYouForRegistering[] = _("We have registered your POKéMON for\ntrade on the TRADING BOARD.\pThank you for using this service!\p"); // unused +ALIGNED(4) const u8 sText_NobodyHasRegistered[] = _("Nobody has registered any POKéMON\nfor trade on the TRADING BOARD.\p\n"); // unused +ALIGNED(4) const u8 sText_ChooseRequestedMonType[] = _("Please choose the type of POKéMON\nthat you would like in the trade.\n"); +ALIGNED(4) const u8 sText_WhichMonWillYouOffer[] = _("Which of your party POKéMON will\nyou offer in trade?\p"); +ALIGNED(4) const u8 sText_RegistrationCanceled[] = _("Registration has been canceled.\p"); +ALIGNED(4) const u8 sText_RegistraionCompleted[] = _("Registration has been completed.\p"); +ALIGNED(4) const u8 sText_TradeCanceled[] = _("The trade has been canceled.\p"); +ALIGNED(4) const u8 sText_CancelRegistrationOfMon[] = _("Cancel the registration of your\nLv. {STR_VAR_2} {STR_VAR_1}?"); +ALIGNED(4) const u8 sText_CancelRegistrationOfEgg[] = _("Cancel the registration of your\nEGG?"); +ALIGNED(4) const u8 sText_RegistrationCanceled2[] = _("The registration has been canceled.\p"); +ALIGNED(4) const u8 sText_TradeTrainersWillBeListed[] = _("TRAINERS wishing to make a trade\nwill be listed."); // unused +ALIGNED(4) const u8 sText_ChooseTrainerToTradeWith[] = _("Please choose the TRAINER with whom\nyou would like to trade POKéMON."); // unused +ALIGNED(4) const u8 sText_AskTrainerToMakeTrade[] = _("Would you like to ask {STR_VAR_1} to\nmake a trade?"); +ALIGNED(4) const u8 sText_AwaitingResponseFromTrainer[] = _("Awaiting a response from\nthe other TRAINER…"); // unused +ALIGNED(4) const u8 sText_NotRegisteredAMonForTrade[] = _("You have not registered a POKéMON\nfor trading.\p"); // unused +ALIGNED(4) const u8 sText_DontHaveTypeTrainerWants[] = _("You don't have a {STR_VAR_2}-type\nPOKéMON that {STR_VAR_1} wants.\p"); +ALIGNED(4) const u8 sText_DontHaveEggTrainerWants[] = _("You don't have an EGG that\n{STR_VAR_1} wants.\p"); +ALIGNED(4) const u8 sText_CantTradeMonRightNow[] = _("{STR_VAR_1} can't make a trade for\nyour POKéMON right now.\p"); +ALIGNED(4) const u8 sText_CantTradePartnersMonRightNow[] = _("You can't make a trade for\n{STR_VAR_1}'s POKéMON right now.\p"); -const u8 *const unref_text_ptrs_union_room_4[] = { - gUnknown_082EF740, - gUnknown_082EF774 +// unused +const u8 *const sUnionRoomTexts_CantTradeRightNow[] = { + sText_CantTradeMonRightNow, + sText_CantTradePartnersMonRightNow }; -ALIGNED(4) const u8 gUnknown_082EF7B0[] = _("Your trade offer was rejected.\p"); -ALIGNED(4) const u8 gUnknown_082EF7D0[] = _("EGG TRADE"); +ALIGNED(4) const u8 sText_TradeOfferRejected[] = _("Your trade offer was rejected.\p"); +ALIGNED(4) const u8 sText_EggTrade[] = _("EGG TRADE"); ALIGNED(4) const u8 gUnknown_082EF7DC[] = _("{DPAD_UPDOWN}CHOOSE {A_BUTTON}JOIN {B_BUTTON}CANCEL"); ALIGNED(4) const u8 gUnknown_082EF7F8[] = _("Please choose a TRAINER."); ALIGNED(4) const u8 gUnknown_082EF814[] = _("Please choose a TRAINER for\na SINGLE BATTLE."); diff --git a/src/fldeff_softboiled.c b/src/fldeff_softboiled.c index c18602c68..733263bbc 100644 --- a/src/fldeff_softboiled.c +++ b/src/fldeff_softboiled.c @@ -34,7 +34,7 @@ void sub_8161560(u8 taskId) gUnknown_0203CEC8.unkB = 0xA; gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.slotId; sub_81B0FCC(GetCursorSelectionMonId(), 0x1); - display_pokemon_menu_message(0x5); + DisplayPartyMenuStdMessage(5); gTasks[taskId].func = sub_81B1370; } @@ -47,7 +47,7 @@ void sub_81615A8(u8 taskId) if(pokemonIndex > 6) { gUnknown_0203CEC8.unkB = 0; - display_pokemon_menu_message(0x0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; return; } @@ -73,7 +73,7 @@ static void sub_81616C0(u8 taskId) { GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.unkA], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_8161724; } @@ -88,7 +88,7 @@ static void sub_8161724(u8 taskId) sub_81B0FCC(gUnknown_0203CEC8.unkA, 1); ClearStdWindowAndFrameToTransparent(0x6, FALSE); ClearWindowTilemap(0x6); - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } @@ -96,14 +96,14 @@ static void sub_8161784(u8 taskId) { if(sub_81B1BD4() == 1) return; - display_pokemon_menu_message(0x5); + DisplayPartyMenuStdMessage(5); gTasks[taskId].func = sub_81B1370; } static void sub_81617B8(u8 taskId) { PlaySE(SE_SELECT); - sub_81B1B5C(gText_CantBeUsedOnPkmn, 0); + DisplayPartyMenuMessage(gText_CantBeUsedOnPkmn, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_8161784; } diff --git a/src/link_rfu.c b/src/link_rfu.c index 390f71a08..a8b79c045 100644 --- a/src/link_rfu.c +++ b/src/link_rfu.c @@ -4255,11 +4255,11 @@ void sub_8010FA0(bool32 a0, bool32 a1) gUnknown_02022B14.unk_00.unk_00_5 = a1; } -void sub_8010FCC(u32 a0, u32 a1, u32 a2) +void sub_8010FCC(u32 type, u32 species, u32 level) { - gUnknown_02022B14.type = a0; - gUnknown_02022B14.species = a1; - gUnknown_02022B14.level = a2; + gUnknown_02022B14.type = type; + gUnknown_02022B14.species = species; + gUnknown_02022B14.level = level; } u8 sub_801100C(s32 a0) diff --git a/src/party_menu.c b/src/party_menu.c index 2495156b1..e2092a825 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -207,7 +207,7 @@ static void sub_81B5F98(u8, u8); static u8 GetPartyBoxPalBitfield(u8, u8); static bool8 PartyBoxPal_ParnterOrDisqualifiedInArena(u8); static u8 sub_81B8F38(u8); -static void c3_0811FAB4(u8); +static void Task_ClosePartyMenuAndSetCB2(u8); static void sub_81B9080(void); static void sub_81B4F88(void); static void sub_81B15D0(u8, s8*); @@ -215,7 +215,7 @@ static void sub_81B140C(u8, s8*); static u16 PartyMenuButtonHandler(s8*); static s8* sub_81B13EC(void); static bool8 sub_81B15A4(u8*); -static void sub_81B302C(u8*); +static void PartyMenuRemoveWindow(u8*); static void sub_81B9140(void); static void sub_81B6794(u8); static void sub_81B7E4C(u8); @@ -236,7 +236,7 @@ static void UpdateCurrentPartySelection(s8*, s8); static void SetNewPartySelectTarget1(s8*, s8); static void SetNewPartySelectTarget2(s8*, s8); static s8 sub_81B1B00(s8, s8); -static void sub_81B3300(const u8*); +static void PartyMenuPrintText(const u8*); static void sub_81B1B8C(u8); static void DisplayPartyPokemonHPCheck(struct Pokemon*, struct Struct203CEDC*, u8); static void DisplayPartyPokemonHPBarCheck(struct Pokemon*, struct Struct203CEDC*); @@ -1752,7 +1752,7 @@ static bool8 PartyMenuSetup(void) break; case 20: CreateTask(gUnknown_0203CEC4->task, 0); - display_pokemon_menu_message(gUnknown_0203CEC4->messageId); + DisplayPartyMenuStdMessage(gUnknown_0203CEC4->messageId); gMain.state++; break; case 21: @@ -2308,13 +2308,13 @@ static void sub_81B1288(struct Pokemon *partySlot, struct Pokemon *pokemon) Free(temp); } -static void sub_81B12C0(u8 taskId) +static void Task_ClosePartyMenu(u8 taskId) { BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); - gTasks[taskId].func = c3_0811FAB4; + gTasks[taskId].func = Task_ClosePartyMenuAndSetCB2; } -static void c3_0811FAB4(u8 taskId) +static void Task_ClosePartyMenuAndSetCB2(u8 taskId) { if (!gPaletteFade.active) { @@ -2388,7 +2388,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) case 7: if (sub_81B15A4((u8*)ptr)) { - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81615A8(taskId); } break; @@ -2398,7 +2398,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) if (gUnknown_0203CEC8.unk8_0 == 1) gUnknown_0203CEC4->exitCallback = sub_81B9140; - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); gUnknown_03006328(taskId, sub_81B6794); } break; @@ -2406,7 +2406,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) if (sub_81B15A4((u8*)ptr)) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B7E4C(taskId); } break; @@ -2414,7 +2414,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) if (sub_81B15A4((u8*)ptr)) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B8474(taskId); } break; @@ -2423,7 +2423,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) if (sub_81B15A4((u8*)ptr)) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B7FAC(taskId); } break; @@ -2433,7 +2433,7 @@ static void sub_81B140C(u8 taskId, s8 *ptr) break; case 8: PlaySE(SE_SELECT); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; case 10: if (sub_81B15A4((u8*)ptr)) @@ -2485,7 +2485,7 @@ static void sub_81B15D0(u8 taskId, s8 *ptr) gSpecialVar_0x8004 = 7; gUnknown_0203CEE8 = 0; *ptr = 7; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } break; } @@ -2503,9 +2503,9 @@ static bool8 sub_81B1660(u8 taskId) if (stringPtr == NULL) return FALSE; - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); StringExpandPlaceholders(gStringVar4, stringPtr); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B16D4; return TRUE; } @@ -2527,7 +2527,7 @@ static void sub_81B1708(u8 taskId) gUnknown_0203CEE8 = 0; gUnknown_0203CEC8.slotId = 7; sub_81B8558(); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; case MENU_B_PRESSED: PlaySE(SE_SELECT); @@ -2782,11 +2782,11 @@ u8* GetMonNickname(struct Pokemon *mon, u8 *dest) return StringGetEnd10(dest); } -u8 sub_81B1B5C(const u8* str, u8 b) +u8 DisplayPartyMenuMessage(const u8* str, u8 b) { u8 taskId; - sub_81B3300(str); + PartyMenuPrintText(str); taskId = CreateTask(sub_81B1B8C, 1); gTasks[taskId].data[0] = b; return taskId; @@ -2814,7 +2814,7 @@ static void sub_81B1BE8(u8 taskId) { if (sub_81221EC() != TRUE) { - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } } @@ -2831,7 +2831,7 @@ static void sub_81B1C1C(u8 taskId) } else { - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } } @@ -2842,7 +2842,7 @@ static void sub_81B1C84(struct Pokemon *mon, u16 item, u8 c, u8 unused) GetMonNickname(mon, gStringVar1); CopyItemName(item, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_PkmnWasGivenItem); - sub_81B1B5C(gStringVar4, c); + DisplayPartyMenuMessage(gStringVar4, c); schedule_bg_copy_tilemap_to_vram(2); } @@ -2851,7 +2851,7 @@ static void sub_81B1CD0(struct Pokemon *mon, u16 item, u8 c) GetMonNickname(mon, gStringVar1); CopyItemName(item, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_ReceivedItemFromPkmn); - sub_81B1B5C(gStringVar4, c); + DisplayPartyMenuMessage(gStringVar4, c); schedule_bg_copy_tilemap_to_vram(2); } @@ -2860,7 +2860,7 @@ static void sub_81B1D1C(struct Pokemon *mon, u16 item, u8 c) GetMonNickname(mon, gStringVar1); CopyItemName(item, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_SwitchPkmnItem); - sub_81B1B5C(gStringVar4, c); + DisplayPartyMenuMessage(gStringVar4, c); schedule_bg_copy_tilemap_to_vram(2); } @@ -2869,7 +2869,7 @@ static void sub_81B1D68(u16 item, u16 item2, u8 c) CopyItemName(item, gStringVar1); CopyItemName(item2, gStringVar2); StringExpandPlaceholders(gStringVar4, gText_SwitchedPkmnItem); - sub_81B1B5C(gStringVar4, c); + DisplayPartyMenuMessage(gStringVar4, c); schedule_bg_copy_tilemap_to_vram(2); } @@ -3046,12 +3046,12 @@ static void sub_81B21AC(u8 taskId, u8 slot) { PlaySE(SE_SELECT); gSpecialVar_0x8004 = slot; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } else { PlaySE(SE_HAZURE); - sub_81B1B5C(gText_PkmnCantParticipate, 0); + DisplayPartyMenuMessage(gText_PkmnCantParticipate, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B1C1C; } @@ -3059,7 +3059,7 @@ static void sub_81B21AC(u8 taskId, u8 slot) static void sub_81B2210(u8 taskId) { - sub_81B1B5C(gText_CancelParticipation, 1); + DisplayPartyMenuMessage(gText_CancelParticipation, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B2248; } @@ -3079,7 +3079,7 @@ static void sub_81B227C(u8 taskId) { case 0: gSpecialVar_0x8004 = 7; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; case MENU_B_PRESSED: PlaySE(SE_SELECT); @@ -3543,7 +3543,7 @@ static void DisplayPartyPokemonOtherText(u8 stringID, struct Struct203CEDC *ptr, AddTextPrinterParameterized3(ptr->windowId, 1, ptr->unk0->unk1C, ptr->unk0->unk1D, sFontColorTable[0], 0, sSelectionStringTable[stringID]); } -static void sub_81B302C(u8 *ptr) +static void PartyMenuRemoveWindow(u8 *ptr) { if (*ptr != 0xFF) { @@ -3554,12 +3554,12 @@ static void sub_81B302C(u8 *ptr) } } -void display_pokemon_menu_message(u32 stringID) +void DisplayPartyMenuStdMessage(u32 stringID) { u8 *windowPtr = &gUnknown_0203CEC4->windowId[1]; if (*windowPtr != 0xFF) - sub_81B302C(windowPtr); + PartyMenuRemoveWindow(windowPtr); if (stringID != 0x7F) { @@ -3660,7 +3660,7 @@ static u8 sub_81B31B0(u8 a) return gUnknown_0203CEC4->windowId[0]; } -static void sub_81B3300(const u8 *text) +static void PartyMenuPrintText(const u8 *text) { DrawStdFrameWithCustomTileAndPalette(6, FALSE, 0x4F, 13); gTextFlags.canABSpeedUpPrint = TRUE; @@ -3682,7 +3682,7 @@ static u8 sub_81B3364(void) static void sub_81B3394(void) { ClearWindowTilemap(gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); } static void sub_81B33B4(struct Pokemon *mons, u8 slotId, u8 b) @@ -3788,12 +3788,12 @@ static bool8 sub_81B3608(u8 taskId) u16 item; GetMonNickname(mon, gStringVar1); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); if (gUnknown_0203CEC8.unk8_0 != 12) { sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.slotId, sub_81B353C(mon)); sub_81B31B0(0); - display_pokemon_menu_message(21); + DisplayPartyMenuStdMessage(21); } else { @@ -3803,12 +3803,12 @@ static bool8 sub_81B3608(u8 taskId) sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.slotId, sub_81B353C(mon)); sub_81B31B0(1); CopyItemName(item, gStringVar2); - display_pokemon_menu_message(26); + DisplayPartyMenuStdMessage(26); } else { StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B469C; return FALSE; @@ -3845,11 +3845,11 @@ static void HandleMenuInput(u8 taskId) break; case MENU_B_PRESSED: PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[2]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[2]); sCursorOptions[gUnknown_0203CEC4->actions[gUnknown_0203CEC4->listSize - 1]].func(taskId); break; default: - sub_81B302C(&gUnknown_0203CEC4->windowId[2]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[2]); sCursorOptions[gUnknown_0203CEC4->actions[input]].func(taskId); break; } @@ -3860,7 +3860,7 @@ static void CursorCb_Summary(u8 taskId) { PlaySE(SE_SELECT); gUnknown_0203CEC4->exitCallback = sub_81B3828; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } static void sub_81B3828(void) @@ -3887,9 +3887,9 @@ static void CursorCb_Switch(u8 taskId) { PlaySE(SE_SELECT); gUnknown_0203CEC8.unkB = 8; - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - display_pokemon_menu_message(3); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + DisplayPartyMenuStdMessage(3); sub_81B0FCC(gUnknown_0203CEC8.slotId, 1); gUnknown_0203CEC8.unkA = gUnknown_0203CEC8.slotId; gTasks[taskId].func = sub_81B1370; @@ -4105,35 +4105,35 @@ static void swap_pokemon_and_oams(void) static void sub_81B407C(u8 taskId) { - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); gUnknown_0203CEC8.unkB = 0; sub_81B0FCC(gUnknown_0203CEC8.slotId, 0); gUnknown_0203CEC8.slotId = gUnknown_0203CEC8.unkA; sub_81B0FCC(gUnknown_0203CEC8.unkA, 1); - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } static void CursorCb_Cancel1(u8 taskId) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); if (gUnknown_0203CEC8.unk8_0 == 6) - display_pokemon_menu_message(15); + DisplayPartyMenuStdMessage(15); else - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } static void CursorCb_Item(u8 taskId) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.slotId, 8); sub_81B31B0(1); - display_pokemon_menu_message(24); + DisplayPartyMenuStdMessage(24); gTasks[taskId].data[0] = 0xFF; gTasks[taskId].func = HandleMenuInput; } @@ -4142,7 +4142,7 @@ static void CursorCb_Give(u8 taskId) { PlaySE(SE_SELECT); gUnknown_0203CEC4->exitCallback = sub_81B41C4; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } static void sub_81B41C4(void) @@ -4221,7 +4221,7 @@ static void sub_81B43DC(u8 taskId) { AddBagItem(gSpecialVar_ItemId, 1); pokemon_item_not_removed(gUnknown_0203CEFC); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); gTasks[taskId].func = sub_81B1C1C; } else if (ItemIsMail(gSpecialVar_ItemId)) @@ -4249,7 +4249,7 @@ static void sub_81B44FC(u8 taskId) if (sub_81B1BD4() != TRUE) { gUnknown_0203CEC4->exitCallback = sub_81B452C; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } @@ -4319,18 +4319,18 @@ static void CursorCb_TakeItem(u8 taskId) u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); switch (TryTakeMonItem(mon)) { case 0: GetMonNickname(mon, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); break; case 1: pokemon_item_not_removed(item); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); break; default: sub_81B1CD0(mon, item, 1); @@ -4346,20 +4346,20 @@ static void CursorCb_Toss(u8 taskId) u16 item = GetMonData(mon, MON_DATA_HELD_ITEM); PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); if (item == ITEM_NONE) { GetMonNickname(mon, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnNotHolding); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B469C; } else { CopyItemName(item, gStringVar1); StringExpandPlaceholders(gStringVar4, gText_ThrowAwayItem); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B48A8; } } @@ -4382,7 +4382,7 @@ static void sub_81B48DC(u8 taskId) case 0: CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar1); StringExpandPlaceholders(gStringVar4, gText_ItemThrownAway); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); gTasks[taskId].func = sub_81B4988; break; case MENU_B_PRESSED: @@ -4411,11 +4411,11 @@ static void sub_81B4988(u8 taskId) static void CursorCb_Mail(u8 taskId) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.slotId, 9); sub_81B31B0(2); - display_pokemon_menu_message(25); + DisplayPartyMenuStdMessage(25); gTasks[taskId].data[0] = 0xFF; gTasks[taskId].func = HandleMenuInput; } @@ -4424,7 +4424,7 @@ static void CursorCb_Read(u8 taskId) { PlaySE(SE_SELECT); gUnknown_0203CEC4->exitCallback = sub_81B4A98; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } static void sub_81B4A98(void) @@ -4441,9 +4441,9 @@ static void sub_81B4AE0(void) static void CursorCb_TakeMail(u8 taskId) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B1B5C(gText_SendMailToPC, 1); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + DisplayPartyMenuMessage(gText_SendMailToPC, 1); gTasks[taskId].func = sub_81B4B6C; } @@ -4463,19 +4463,19 @@ static void sub_81B4BA0(u8 taskId) case 0: if (TakeMailFromMon2(&gPlayerParty[gUnknown_0203CEC8.slotId]) != 0xFF) { - sub_81B1B5C(gText_MailSentToPC, 0); + DisplayPartyMenuMessage(gText_MailSentToPC, 0); gTasks[taskId].func = sub_81B469C; } else { - sub_81B1B5C(gText_PCMailboxFull, 0); + DisplayPartyMenuMessage(gText_PCMailboxFull, 0); gTasks[taskId].func = sub_81B1C1C; } break; case MENU_B_PRESSED: PlaySE(SE_SELECT); case 1: - sub_81B1B5C(gText_MailMessageWillBeLost, 1); + DisplayPartyMenuMessage(gText_MailMessageWillBeLost, 1); gTasks[taskId].func = sub_81B4C60; break; } @@ -4501,13 +4501,13 @@ static void sub_81B4C94(u8 taskId) if (AddBagItem(item, 1) == TRUE) { TakeMailFromMon(&gPlayerParty[gUnknown_0203CEC8.slotId]); - sub_81B1B5C(gText_MailTakenFromPkmn, 0); + DisplayPartyMenuMessage(gText_MailTakenFromPkmn, 0); gTasks[taskId].func = sub_81B469C; } else { pokemon_item_not_removed(item); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); gTasks[taskId].func = sub_81B1C1C; } break; @@ -4524,19 +4524,19 @@ static void CursorCb_Cancel2(u8 taskId) struct Pokemon *mon = &gPlayerParty[gUnknown_0203CEC8.slotId]; PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); sub_81B33B4(gPlayerParty, gUnknown_0203CEC8.slotId, sub_81B353C(mon)); if (gUnknown_0203CEC8.unk8_0 != 12) { sub_81B31B0(0); - display_pokemon_menu_message(21); + DisplayPartyMenuStdMessage(21); } else { sub_81B31B0(1); CopyItemName(GetMonData(mon, MON_DATA_HELD_ITEM), gStringVar2); - display_pokemon_menu_message(26); + DisplayPartyMenuStdMessage(26); } gTasks[taskId].data[0] = 0xFF; gTasks[taskId].func = HandleMenuInput; @@ -4545,15 +4545,15 @@ static void CursorCb_Cancel2(u8 taskId) static void CursorCb_SendMon(u8 taskId) { PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); if (sub_81B8A7C() == TRUE) { - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } else { - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); - sub_81B1B5C(gStringVar4, 1); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B1C1C; } } @@ -4563,8 +4563,8 @@ static void CursorCb_Enter(u8 taskId) u8 unk; u8 i; - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); unk = sub_81B8830(); for (i = 0; i < unk; i++) { @@ -4575,7 +4575,7 @@ static void CursorCb_Enter(u8 taskId) DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gUnknown_0203CEC8.slotId], 1); if (i == (unk - 1)) sub_81B4F88(); - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; return; } @@ -4583,7 +4583,7 @@ static void CursorCb_Enter(u8 taskId) ConvertIntToDecimalStringN(gStringVar1, unk, STR_CONV_MODE_LEFT_ALIGN, 1); StringExpandPlaceholders(gStringVar4, gText_NoMoreThanVar1Pkmn); PlaySE(SE_HAZURE); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B1C1C; } @@ -4600,8 +4600,8 @@ static void CursorCb_NoEntry(u8 taskId) u8 i, j; PlaySE(SE_SELECT); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); unk = sub_81B8830(); for (i = 0; i < unk; i++) { @@ -4619,40 +4619,41 @@ static void CursorCb_NoEntry(u8 taskId) if (gSelectedOrderFromParty[i] != 0) DisplayPartyPokemonOtherText(i + 2, &gUnknown_0203CEDC[gSelectedOrderFromParty[i] - 1], 1); } - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } static void CursorCb_Store(u8 taskId) { PlaySE(SE_SELECT); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } +// Register mon for the Trading Board in Union Room static void CursorCb_Register(u8 taskId) { u16 species2 = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_SPECIES2); u16 species = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_SPECIES); u8 obedience = GetMonData(&gPlayerParty[gUnknown_0203CEC8.slotId], MON_DATA_OBEDIENCE); - switch (sub_807A8D0(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), species2, species, obedience)) + switch (CanRegisterMonForTradingBoard(*(struct UnkLinkRfuStruct_02022B14Substruct *)sub_800F7DC(), species2, species, obedience)) { - case 1: + case CANT_REGISTER_MON: StringExpandPlaceholders(gStringVar4, gText_PkmnCantBeTradedNow); break; - case 2: + case CANT_REGISTER_EGG: StringExpandPlaceholders(gStringVar4, gText_EggCantBeTradedNow); break; default: PlaySE(SE_SELECT); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); return; } PlaySE(SE_HAZURE); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); StringAppend(gStringVar4, gText_PauseUntilPress); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B1C1C; } @@ -4667,23 +4668,23 @@ static void CursorCb_Trade1(u8 taskId) { StringExpandPlaceholders(gStringVar4, sUnionRoomTradeMessages[stringId - 1]); PlaySE(SE_HAZURE); - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); StringAppend(gStringVar4, gText_PauseUntilPress); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B1C1C; } else { PlaySE(SE_SELECT); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } static void CursorCb_Trade2(u8 taskId) { - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); switch (sub_807A918(gPlayerParty, gUnknown_0203CEC8.slotId)) { case 1: @@ -4699,13 +4700,13 @@ static void CursorCb_Trade2(u8 taskId) PlaySE(SE_SELECT); GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1); StringExpandPlaceholders(gStringVar4, gJPText_PutVar1IntoSpinner); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B53FC; return; } PlaySE(SE_HAZURE); StringAppend(gStringVar4, gText_PauseUntilPress); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B1C1C; } @@ -4723,7 +4724,7 @@ static void sub_81B5430(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { case 0: - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; case MENU_B_PRESSED: PlaySE(SE_SELECT); @@ -4742,14 +4743,14 @@ static void CursorCb_FieldMove(u8 taskId) if (sFieldMoveCursorCallbacks[fieldMove].fieldMoveFunc == NULL) return; - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); if (sub_81221AC() == TRUE || InUnionRoom() == TRUE) { if (fieldMove == FIELD_MOVE_MILK_DRINK || fieldMove == FIELD_MOVE_SOFT_BOILED) - display_pokemon_menu_message(13); + DisplayPartyMenuStdMessage(13); else - display_pokemon_menu_message(sFieldMoveCursorCallbacks[fieldMove].msgId); + DisplayPartyMenuStdMessage(sFieldMoveCursorCallbacks[fieldMove].msgId); gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; } @@ -4758,7 +4759,7 @@ static void CursorCb_FieldMove(u8 taskId) // All field moves before WATERFALL are HMs. if (fieldMove <= FIELD_MOVE_WATERFALL && FlagGet(FLAG_BADGE01_GET + fieldMove) != TRUE) { - sub_81B1B5C(gText_CantUseUntilNewBadge, 1); + DisplayPartyMenuMessage(gText_CantUseUntilNewBadge, 1); gTasks[taskId].func = sub_81B1C1C; } else if (sFieldMoveCursorCallbacks[fieldMove].fieldMoveFunc() == TRUE) @@ -4785,11 +4786,11 @@ static void CursorCb_FieldMove(u8 taskId) break; case FIELD_MOVE_FLY: gUnknown_0203CEC8.exitCallback = MCB2_FlyMap; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; default: gUnknown_0203CEC8.exitCallback = CB2_ReturnToField; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; } } @@ -4804,7 +4805,7 @@ static void CursorCb_FieldMove(u8 taskId) sub_81B57DC(); break; default: - display_pokemon_menu_message(sFieldMoveCursorCallbacks[fieldMove].msgId); + DisplayPartyMenuStdMessage(sFieldMoveCursorCallbacks[fieldMove].msgId); break; } gTasks[taskId].func = task_brm_cancel_1_on_keypad_a_or_b; @@ -4814,7 +4815,7 @@ static void CursorCb_FieldMove(u8 taskId) static void sub_81B5674(u8 taskId) { - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); gTasks[taskId].func = sub_81B56A4; } @@ -4833,7 +4834,7 @@ static void sub_81B56D8(u8 taskId) { case 0: gUnknown_0203CEC8.exitCallback = CB2_ReturnToField; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); break; case MENU_B_PRESSED: PlaySE(SE_SELECT); @@ -4876,9 +4877,9 @@ static void task_brm_cancel_1_on_keypad_a_or_b(u8 taskId) static void sub_81B57DC(void) { if (FlagGet(FLAG_SYS_USE_FLASH) == TRUE) - display_pokemon_menu_message(12); + DisplayPartyMenuStdMessage(12); else - display_pokemon_menu_message(13); + DisplayPartyMenuStdMessage(13); } static void hm_surf_run_dp02scr(void) @@ -4901,9 +4902,9 @@ static bool8 SetUpFieldMove_Surf(void) static void sub_81B5864(void) { if (TestPlayerAvatarFlags(PLAYER_AVATAR_FLAG_SURFING)) - display_pokemon_menu_message(9); + DisplayPartyMenuStdMessage(9); else - display_pokemon_menu_message(8); + DisplayPartyMenuStdMessage(8); } static bool8 SetUpFieldMove_Fly(void) @@ -5440,7 +5441,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) iTriedHonestlyIDid: gUnknown_0203CEE8 = 0; PlaySE(SE_SELECT); - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; return; @@ -5476,7 +5477,7 @@ void ItemUseCB_Medicine(u8 taskId, TaskFunc task) { GetMonNickname(mon, gStringVar1); GetMedicineItemEffectMessage(item); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; } @@ -5486,7 +5487,7 @@ static void sub_81B672C(u8 taskId) { GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); schedule_bg_copy_tilemap_to_vram(2); HandleBattleLowHpMusicChange(); gTasks[taskId].func = sub_81B6794; @@ -5498,7 +5499,7 @@ static void sub_81B6794(u8 taskId) { if (gUnknown_0203CEE8 == 0) gUnknown_0203CEC4->exitCallback = NULL; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } @@ -5517,7 +5518,7 @@ void sub_81B67C8(u8 taskId, TaskFunc task) { gUnknown_0203CEE8 = 0; PlaySE(SE_SELECT); - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; } @@ -5539,7 +5540,7 @@ void sub_81B67C8(u8 taskId, TaskFunc task) { StringExpandPlaceholders(gStringVar4, gText_PkmnAdoresBaseVar2Fell); } - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; } @@ -5624,7 +5625,7 @@ static void ether_effect_related_3(u8 taskId) } else { - sub_81B302C(&gUnknown_0203CEC4->windowId[1]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[1]); ether_effect_related_2(taskId); } } @@ -5648,7 +5649,7 @@ void dp05_ether(u8 taskId, TaskFunc task) else { PlaySE(SE_SELECT); - display_pokemon_menu_message(22); + DisplayPartyMenuStdMessage(22); sub_81B6A10(gUnknown_0203CEC8.slotId); gTasks[taskId].func = ether_effect_related_3; } @@ -5656,7 +5657,7 @@ void dp05_ether(u8 taskId, TaskFunc task) static void ether_effect_related_2(u8 taskId) { - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); gUnknown_0203CEC8.unkE = Menu_GetCursorPos(); ether_effect_related(taskId); } @@ -5665,8 +5666,8 @@ static void sub_81B6BB4(u8 taskId) { gTasks[taskId].func = sub_81B1370; gUnknown_0203CEC4->exitCallback = NULL; - sub_81B302C(&gUnknown_0203CEC4->windowId[0]); - display_pokemon_menu_message(5); + PartyMenuRemoveWindow(&gUnknown_0203CEC4->windowId[0]); + DisplayPartyMenuStdMessage(5); } static void ether_effect_related(u8 taskId) @@ -5681,7 +5682,7 @@ static void ether_effect_related(u8 taskId) { gUnknown_0203CEE8 = 0; PlaySE(SE_SELECT); - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B6794; } @@ -5694,7 +5695,7 @@ static void ether_effect_related(u8 taskId) move = GetMonData(mon, MON_DATA_MOVE1 + *moveslot); StringCopy(gStringVar1, gMoveNames[move]); GetMedicineItemEffectMessage(item); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B6794; } @@ -5703,7 +5704,7 @@ static void ether_effect_related(u8 taskId) void dp05_pp_up(u8 taskId, TaskFunc task) { PlaySE(SE_SELECT); - display_pokemon_menu_message(23); + DisplayPartyMenuStdMessage(23); sub_81B6A10(gUnknown_0203CEC8.slotId); gTasks[taskId].func = ether_effect_related_3; } @@ -5741,7 +5742,7 @@ bool8 MonKnowsMove(struct Pokemon *mon, u16 move) static void sub_81B6D74(const u8 *str) { StringExpandPlaceholders(gStringVar4, str); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); } @@ -5804,7 +5805,7 @@ static void sub_81B6EB4(u8 taskId) GetMonNickname(mon, gStringVar1); StringCopy(gStringVar2, gMoveNames[move[0]]); StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B6F60; } @@ -5828,7 +5829,7 @@ static void sub_81B6F98(u8 taskId) { if (gUnknown_0203CEC8.unk10 == 2) gSpecialVar_Result = TRUE; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } } @@ -5847,7 +5848,7 @@ static void sub_81B7028(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { case 0: - sub_81B1B5C(gText_WhichMoveToForget, 1); + DisplayPartyMenuMessage(gText_WhichMoveToForget, 1); gTasks[taskId].func = sub_81B7088; break; case MENU_B_PRESSED: @@ -5863,7 +5864,7 @@ static void sub_81B7088(u8 taskId) if (sub_81B1BD4() != TRUE) { gUnknown_0203CEC4->exitCallback = sub_81B70B8; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } @@ -5918,7 +5919,7 @@ static void sub_81B7230(u8 taskId) { StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); StringExpandPlaceholders(gStringVar4, gText_StopLearningMove2); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B7294; } @@ -5942,7 +5943,7 @@ static void sub_81B72C8(u8 taskId) GetMonNickname(mon, gStringVar1); StringCopy(gStringVar2, gMoveNames[gUnknown_0203CEC8.unkE]); StringExpandPlaceholders(gStringVar4, gText_MoveNotLearned); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); if (gUnknown_0203CEC8.unk10 == 1) { gTasks[taskId].func = sub_81B73E4; @@ -5993,7 +5994,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task) if (cannotUseEffect) { gUnknown_0203CEE8 = 0; - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; } @@ -6006,7 +6007,7 @@ void dp05_rare_candy(u8 taskId, TaskFunc task) GetMonNickname(mon, gStringVar1); ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3); StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B75D4; } @@ -6134,7 +6135,7 @@ static void sub_81B787C(u8 taskId) GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1); StringCopy(gStringVar2, gMoveNames[gMoveToLearn]); StringExpandPlaceholders(gStringVar4, gText_PkmnNeedsToReplaceMove); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gUnknown_0203CEC8.unkE = gMoveToLearn; gTasks[taskId].func = sub_81B6FF4; @@ -6145,7 +6146,7 @@ static void sub_81B7910(u8 taskId, u16 move) GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1); StringCopy(gStringVar2, gMoveNames[move]); StringExpandPlaceholders(gStringVar4, gText_PkmnLearnedMove3); - sub_81B1B5C(gStringVar4, 1); + DisplayPartyMenuMessage(gStringVar4, 1); schedule_bg_copy_tilemap_to_vram(2); gUnknown_0203CEC8.unkE = move; gTasks[taskId].func = sub_81B6F60; @@ -6213,7 +6214,7 @@ static void task_sacred_ash_party_loop(u8 taskId) if (gUnknown_0203CEC4->data[1] == 0) { gUnknown_0203CEE8 = 0; - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); } else @@ -6235,7 +6236,7 @@ static void sub_81B7C10(u8 taskId) { GetMonNickname(&gPlayerParty[gUnknown_0203CEC8.slotId], gStringVar1); StringExpandPlaceholders(gStringVar4, gText_PkmnHPRestoredByVar2); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task_sacred_ash_party_loop; } @@ -6247,7 +6248,7 @@ void sub_81B7C74(u8 taskId, TaskFunc task) if (ExecuteTableBasedItemEffect__(gUnknown_0203CEC8.slotId, gSpecialVar_ItemId, 0)) { gUnknown_0203CEE8 = 0; - sub_81B1B5C(gText_WontHaveEffect, 1); + DisplayPartyMenuMessage(gText_WontHaveEffect, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = task; } @@ -6396,7 +6397,7 @@ static void sub_81B8044(u8 taskId) { sub_81B83F0(gUnknown_0203CEC8.unkC); gUnknown_0203CEC4->exitCallback = sub_81B814C; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } else { @@ -6425,7 +6426,7 @@ static void sub_81B8104(u8 taskId) if (sub_81B1BD4() != TRUE) { sub_81B5C94(&gPlayerParty[slot], &gUnknown_0203CEDC[slot]); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } @@ -6495,13 +6496,13 @@ static void sub_81B82D4(u8 taskId) { sub_81B841C(item); pokemon_item_not_removed(gUnknown_0203CEFC); - sub_81B1B5C(gStringVar4, 0); + DisplayPartyMenuMessage(gStringVar4, 0); gTasks[taskId].func = sub_81B8104; } else if (ItemIsMail(item)) { gUnknown_0203CEC4->exitCallback = sub_81B814C; - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } else { @@ -6520,7 +6521,7 @@ static void sub_81B82D4(u8 taskId) static void sub_81B83B8(u8 taskId) { - sub_81B1B5C(gText_RemoveMailBeforeItem, 1); + DisplayPartyMenuMessage(gText_RemoveMailBeforeItem, 1); schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B8104; } @@ -6555,13 +6556,13 @@ static void sub_81B8474(u8 taskId) mail = &gSaveBlock1Ptr->mail[playerPCItemPageInfo.itemsAbove + 6 + playerPCItemPageInfo.cursorPos]; if (GetMonData(mon, MON_DATA_HELD_ITEM) != ITEM_NONE) { - sub_81B1B5C(gText_PkmnHoldingItemCantHoldMail, 1); + DisplayPartyMenuMessage(gText_PkmnHoldingItemCantHoldMail, 1); } else { GiveMailToMon2(mon, mail); ClearMailStruct(mail); - sub_81B1B5C(gText_MailTransferredFromMailbox, 1); + DisplayPartyMenuMessage(gText_MailTransferredFromMailbox, 1); } schedule_bg_copy_tilemap_to_vram(2); gTasks[taskId].func = sub_81B8104; @@ -6678,13 +6679,13 @@ static void sub_81B879C(u8 taskId) if (msgId != 0xFF) { PlaySE(SE_HAZURE); - display_pokemon_menu_message(msgId); + DisplayPartyMenuStdMessage(msgId); gTasks[taskId].func = sub_81B87E8; } else { PlaySE(SE_SELECT); - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } } @@ -6693,7 +6694,7 @@ static void sub_81B87E8(u8 taskId) if ((gMain.newKeys & A_BUTTON) || (gMain.newKeys & B_BUTTON)) { PlaySE(SE_SELECT); - display_pokemon_menu_message(0); + DisplayPartyMenuStdMessage(0); gTasks[taskId].func = sub_81B1370; } } @@ -7161,7 +7162,7 @@ static void sub_81B9240(u8 taskId) s16 *data = gTasks[taskId].data; if (++data[0] == 0x100) - sub_81B12C0(taskId); + Task_ClosePartyMenu(taskId); } static void sub_81B9270(u8 spriteId, s16 x) diff --git a/src/trade.c b/src/trade.c index e5752bab1..33b09436a 100644 --- a/src/trade.c +++ b/src/trade.c @@ -2558,31 +2558,24 @@ int GetUnionRoomTradeMessageId(struct UnkLinkRfuStruct_02022B14Substruct a0, str return UR_TRADE_MSG_NONE; } -int sub_807A8D0(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species2, u16 species, u8 isObedientBitSet) +int CanRegisterMonForTradingBoard(struct UnkLinkRfuStruct_02022B14Substruct a0, u16 species2, u16 species, u8 isObedientBitSet) { - u8 unk = a0.hasNationalDex; + bool8 hasNationalDex = a0.hasNationalDex; if (IsDeoxysOrMewUntradable(species, isObedientBitSet)) - { - return 1; - } + return CANT_REGISTER_MON; - if (unk) - { - return 0; - } + if (hasNationalDex) + return CAN_REGISTER_MON; + // Eggs can only be traded if the player has the National Dex if (species2 == SPECIES_EGG) - { - return 2; - } + return CANT_REGISTER_EGG; if (IsSpeciesInHoennDex(species2)) - { - return 0; - } + return CAN_REGISTER_MON; - return 1; + return CANT_REGISTER_MON; } // r6/r7 flip. Ugh. diff --git a/src/union_room.c b/src/union_room.c index 3f0bebbb5..382e6c595 100644 --- a/src/union_room.c +++ b/src/union_room.c @@ -58,7 +58,7 @@ EWRAM_DATA u32 gFiller_02022C34 = 0; EWRAM_DATA struct UnkLinkRfuStruct_02022B14Substruct gUnknown_02022C38 = {}; EWRAM_DATA u16 gUnionRoomOfferedSpecies = 0; EWRAM_DATA u8 gUnionRoomRequestedMonType = 0; -EWRAM_DATA struct TradeUnkStruct gUnknown_02022C40 = {}; +static EWRAM_DATA struct UnionRoomTrade sUnionRoomTrade = {}; // IWRAM vars static struct UnkStruct_Leader *gUnknown_03000DA0; @@ -96,8 +96,8 @@ void sub_8013BD8(struct UnkStruct_Group *arg0, s32 id); void sub_80173D4(void); void sub_80177B8(u8 arg0, u8 arg1, u8 arg2, struct UnkStruct_x20 *arg3, u8 arg4, u8 id); bool32 sub_8017678(struct UnkStruct_Shared *arg0, struct UnkStruct_Shared *arg1); -u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId); -void sub_801807C(struct TradeUnkStruct *arg0); +static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *arg0, u8 multiplayerId); +static void ResetUnionRoomTrade(struct UnionRoomTrade *arg0); void sub_801AC54(void); void sub_80149D8(void); void MG_DrawTextBorder(u8 windowId); @@ -105,8 +105,8 @@ s8 mevent_message_print_and_prompt_yes_no(u8 *textState, u8 *arg1, u8 arg2, cons bool32 sub_8016F1C(struct UnkLinkRfuStruct_02022B14 *arg0, s16 arg1); u8 sub_8016DF0(struct UnkStruct_Main4 *arg0, struct UnkStruct_Main4 *arg1, u32 arg2); void sub_8019F2C(void); -bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1); -void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1); +static bool32 RegisterTradeMonAndGetIsEgg(u32 monId, struct UnionRoomTrade *trade); +static void RegisterTradeMon(u32 monId, struct UnionRoomTrade *arg1); void sub_80181CC(void); bool32 sub_8017940(void); u8 sub_8016B00(void); @@ -122,7 +122,7 @@ void sub_801818C(bool32 arg0); s32 sub_8017178(u8 *arg0, u8 *arg1, u8 *arg2, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate); s32 sub_80172A0(u8 *arg0, u8 *arg1, u8 *arg2, u8 *arg3, const struct WindowTemplate *winTemplate, const struct ListMenuTemplate *menuTemplate, struct UnkStruct_Main0 *arg6); s32 sub_8017CB0(struct UnkStruct_x20 * arg, s32 arg1); -bool32 sub_8018024(void); +bool32 HasAtLeastTwoMonsOfLevel30OrLower(void); u32 sub_8017984(s32 arg0); void sub_8018220(u8 *unused, struct UnkStruct_URoom *arg1, bool8 arg2); void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender); @@ -601,11 +601,11 @@ void sub_8013078(u8 *dst, u8 caseId) { case 65: case 68: - StringExpandPlaceholders(dst, gUnionRoom_OfferDeclined1); + StringExpandPlaceholders(dst, sText_OfferDeclined1); break; case 69: case 72: - StringExpandPlaceholders(dst, gUnionRoom_OfferDeclined2); + StringExpandPlaceholders(dst, sText_OfferDeclined2); break; } } @@ -1282,7 +1282,7 @@ u8 sub_8013F78(void) void sub_8013F90(u8 taskId) { - u32 monId = sub_8018120(&gUnknown_02022C40, GetMultiplayerId()); + u32 monId = GetPartyPositionOfRegisteredMon(&sUnionRoomTrade, GetMultiplayerId()); switch (gTasks[taskId].data[0]) { @@ -1313,7 +1313,7 @@ void sub_8013F90(u8 taskId) gSelectedTradeMonPositions[TRADE_PARTNER] = PARTY_SIZE; gMain.savedCallback = CB2_ReturnToField; SetMainCallback2(sub_807AE50); - sub_801807C(&gUnknown_02022C40); + ResetUnionRoomTrade(&sUnionRoomTrade); DestroyTask(taskId); } break; @@ -2296,7 +2296,7 @@ void sub_80156E0(u8 taskId) break; case 2: sub_8010F84(0x40, 0, 0); - sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); + sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel); sub_800B488(); OpenLink(); sub_8011C84(); @@ -2307,22 +2307,22 @@ void sub_80156E0(u8 taskId) data->state = 3; break; case 3: - if ((sub_81B1360() == 8 || sub_81B1360() == 9) && gUnknown_02022C40.field_0 != 0) + if ((sub_81B1360() == 8 || sub_81B1360() == 9) && sUnionRoomTrade.field_0 != 0) { id = GetCursorSelectionMonId(); - switch (gUnknown_02022C40.field_0) + switch (sUnionRoomTrade.field_0) { case 1: sub_8011090(0x54, 0, 1); if (id >= PARTY_SIZE) { - sub_801807C(&gUnknown_02022C40); + ResetUnionRoomTrade(&sUnionRoomTrade); sub_8010FCC(0, 0, 0); - sub_801568C(gUnknown_082EF4FC); + sub_801568C(sText_RegistrationCanceled); } - else if (!sub_80180A0(GetCursorSelectionMonId(), &gUnknown_02022C40)) + else if (!RegisterTradeMonAndGetIsEgg(GetCursorSelectionMonId(), &sUnionRoomTrade)) { - sub_8015664(0x34, gUnknown_082EF47C); + sub_8015664(0x34, sText_ChooseRequestedMonType); } else { @@ -2331,21 +2331,21 @@ void sub_80156E0(u8 taskId) break; case 2: sub_80156C8(data); - taskData[1] = gUnknown_02022C40.field_8; + taskData[1] = sUnionRoomTrade.field_8; if (id >= PARTY_SIZE) { - sub_801568C(gUnknown_082EF544); + sub_801568C(sText_TradeCanceled); } else { sub_8011090(0x54, 0, 1); gUnknown_02022C2C = 0x44; - sub_80180E8(GetCursorSelectionMonId(), &gUnknown_02022C40); + RegisterTradeMon(GetCursorSelectionMonId(), &sUnionRoomTrade); data->state = 51; } break; } - gUnknown_02022C40.field_0 = 0; + sUnionRoomTrade.field_0 = 0; } else { @@ -2453,9 +2453,9 @@ void sub_80156E0(u8 taskId) case 1: case 2: if (sub_8011B90() == TRUE) - sub_801568C(gUnknown_082EE6C8); + sub_801568C(sText_TrainerAppearsBusy); else - sub_8015664(30, gUnknown_082EE6C8); + sub_8015664(30, sText_TrainerAppearsBusy); gUnknown_02022C2C = 0x40; break; @@ -2513,9 +2513,9 @@ void sub_80156E0(u8 taskId) { gUnknown_02022C2C = var5; gUnknown_02022C2D = (u32)(var5) >> 8; - if (gUnknown_02022C2C == 0x41 && !sub_8018024()) + if (gUnknown_02022C2C == 0x41 && !HasAtLeastTwoMonsOfLevel30OrLower()) { - sub_8015664(5, gUnknown_082EEBD0); + sub_8015664(5, sText_NeedTwoMonsOfLevel30OrLower1); } else { @@ -2528,7 +2528,7 @@ void sub_80156E0(u8 taskId) } break; case 28: - StringCopy(gStringVar4, gUnknown_082EEB88); + StringCopy(gStringVar4, sText_TrainerBattleBusy); data->state = 36; break; case 27: @@ -2547,15 +2547,15 @@ void sub_80156E0(u8 taskId) break; case 31: data->field_4C[0] = 0x44; - data->field_4C[1] = gUnknown_02022C40.species; - data->field_4C[2] = gUnknown_02022C40.level; + data->field_4C[1] = sUnionRoomTrade.species; + data->field_4C[2] = sUnionRoomTrade.level; sub_800FE50(data->field_4C); data->state = 29; break; case 29: if (gReceivedRemoteLinkPlayers == 0) { - StringCopy(gStringVar4, gUnknown_082EEB88); + StringCopy(gStringVar4, sText_TrainerBattleBusy); data->state = 28; } else @@ -2603,7 +2603,7 @@ void sub_80156E0(u8 taskId) { StringCopy(gStringVar1, gLinkPlayers[GetMultiplayerId() ^ 1].name); id = sub_800E540(gLinkPlayers[1].trainerId, gLinkPlayers[1].name); - StringExpandPlaceholders(gStringVar4, gUnknown_082EE378[id]); + StringExpandPlaceholders(gStringVar4, sUnionRoomTexts_AwaitingResponse[id]); data->state = 33; } else @@ -2627,7 +2627,7 @@ void sub_80156E0(u8 taskId) case 1: case -1: playerGender = sub_8017CF8(taskData[1], data->field_0); - sub_801568C(gUnknown_082EEC9C[playerGender]); + sub_801568C(sUnionRoomTexts_DeclineBattle[playerGender]); break; } break; @@ -2712,7 +2712,7 @@ void sub_80156E0(u8 taskId) if (sub_80168DC(data) && gMain.newKeys & B_BUTTON) { sub_8011DE0(1); - StringCopy(gStringVar4, gUnionRoom_ChatEnded); + StringCopy(gStringVar4, sText_ChatEnded); data->state = 36; } break; @@ -2733,12 +2733,12 @@ void sub_80156E0(u8 taskId) taskData[3] = 0; if (gUnknown_02022C2C == 0x41) { - if (!sub_8018024()) + if (!HasAtLeastTwoMonsOfLevel30OrLower()) { data->field_4C[0] = 0x52; sub_800FE50(data->field_4C); data->state = 10; - StringCopy(gStringVar4, gUnknown_082EEC14); + StringCopy(gStringVar4, sText_NeedTwoMonsOfLevel30OrLower2); } else { @@ -2828,19 +2828,19 @@ void sub_80156E0(u8 taskId) { if (sub_800F7DC()->species == SPECIES_EGG) { - StringCopy(gStringVar4, gUnknown_082EF590); + StringCopy(gStringVar4, sText_CancelRegistrationOfEgg); } else { StringCopy(gStringVar1, gSpeciesNames[sub_800F7DC()->species]); ConvertIntToDecimalStringN(gStringVar2, sub_800F7DC()->level, STR_CONV_MODE_LEFT_ALIGN, 3); - StringExpandPlaceholders(gStringVar4, gUnknown_082EF564); + StringExpandPlaceholders(gStringVar4, sText_CancelRegistrationOfMon); } sub_8015664(44, gStringVar4); } break; case 43: - if (PrintOnTextbox(&data->textState, gUnknown_082EF20C)) + if (PrintOnTextbox(&data->textState, sText_RegisterMonAtTradingBoard)) data->state = 47; break; case 47: @@ -2856,11 +2856,11 @@ void sub_80156E0(u8 taskId) { switch (var5) { - case 1: - sub_8015664(53, gUnknown_082EF4C4); + case 1: // REGISTER + sub_8015664(53, sText_WhichMonWillYouOffer); break; - case 2: - sub_8015664(47, gUnknown_082EF298); + case 2: // INFO + sub_8015664(47, sText_TradingBoardInfo); break; } } @@ -2873,7 +2873,7 @@ void sub_80156E0(u8 taskId) case 54: if (!gPaletteFade.active) { - gUnknown_02022C40.field_0 = 1; + sUnionRoomTrade.field_0 = 1; gFieldCallback = sub_80AF128; sub_81B8904(8, CB2_ReturnToField); } @@ -2886,20 +2886,20 @@ void sub_80156E0(u8 taskId) { case -2: case 18: - sub_801807C(&gUnknown_02022C40); + ResetUnionRoomTrade(&sUnionRoomTrade); sub_8010FCC(0, 0, 0); - sub_801568C(gUnknown_082EF4FC); + sub_801568C(sText_RegistrationCanceled); break; default: - gUnknown_02022C40.type = var5; + sUnionRoomTrade.type = var5; data->state = 55; break; } } break; case 55: - sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); - sub_801568C(gUnknown_082EF520); + sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel); + sub_801568C(sText_RegistraionCompleted); break; case 44: switch (sub_80170B8(&data->textState, FALSE)) @@ -2915,16 +2915,16 @@ void sub_80156E0(u8 taskId) } break; case 56: - if (PrintOnTextbox(&data->textState, gUnknown_082EF5B8)) + if (PrintOnTextbox(&data->textState, sText_RegistrationCanceled2)) { sub_8010FCC(0, 0, 0); - sub_801807C(&gUnknown_02022C40); + ResetUnionRoomTrade(&sUnionRoomTrade); sub_801818C(TRUE); data->state = 4; } break; case 45: - if (PrintOnTextbox(&data->textState, gUnknown_082EF1EC)) + if (PrintOnTextbox(&data->textState, sText_XCheckedTradingBoard)) data->state = 46; break; case 46: @@ -2948,18 +2948,18 @@ void sub_80156E0(u8 taskId) { case 0: sub_8018404(gStringVar1, &data->field_0->arr[var5]); - sub_8015664(49, gUnknown_082EF65C); + sub_8015664(49, sText_AskTrainerToMakeTrade); taskData[1] = var5; break; case 1: sub_8018404(gStringVar1, &data->field_0->arr[var5]); StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]); - sub_8015664(46, gUnknown_082EF6E4); + sub_8015664(46, sText_DontHaveTypeTrainerWants); break; case 2: sub_8018404(gStringVar1, &data->field_0->arr[var5]); StringCopy(gStringVar2, gTypeNames[data->field_0->arr[var5].unk.field_0.type]); - sub_8015664(46, gUnknown_082EF718); + sub_8015664(46, sText_DontHaveEggTrainerWants); break; } break; @@ -2980,16 +2980,16 @@ void sub_80156E0(u8 taskId) } break; case 50: - if (PrintOnTextbox(&data->textState, gUnknown_082EF4C4)) + if (PrintOnTextbox(&data->textState, sText_WhichMonWillYouOffer)) { - gUnknown_02022C40.field_0 = 2; + sUnionRoomTrade.field_0 = 2; memcpy(&gUnknown_02022C38, &data->field_0->arr[taskData[1]].unk.field_0.unk_00, sizeof(gUnknown_02022C38)); gUnionRoomRequestedMonType = data->field_0->arr[taskData[1]].unk.field_0.type; gUnionRoomOfferedSpecies = data->field_0->arr[taskData[1]].unk.field_0.species; gFieldCallback = sub_80AF128; sub_81B8904(9, CB2_ReturnToField); sub_80156B0(data); - gUnknown_02022C40.field_8 = taskData[1]; + sUnionRoomTrade.field_8 = taskData[1]; } break; case 51: @@ -3859,7 +3859,7 @@ s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender r2 = sub_800E540(ReadAsU16(r5->unk.field_0.unk_00.playerTrainerId), gStringVar1); if (r5->unk.field_0.unk_0a_0 == 0x45) { - StringExpandPlaceholders(gStringVar4, gUnknown_082EE6B8[r2][playerGender]); + StringExpandPlaceholders(gStringVar4, sUnionRoomTexts_JoinChat[r2][playerGender]); return 2; } else @@ -3881,7 +3881,7 @@ s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender StringExpandPlaceholders(gStringVar4, gUnknown_082EEEAC[playerGender][Random() % 4]); break; case 4: - StringExpandPlaceholders(gStringVar4, gUnknown_082EF1CC[playerGender][Random() % 2]); + StringExpandPlaceholders(gStringVar4, sUnionRoomTexts_Traded[playerGender][Random() % 2]); break; case 5: StringExpandPlaceholders(gStringVar4, gUnknown_082EF010[playerGender][Random() % 4]); @@ -3890,7 +3890,7 @@ s32 sub_80179D4(struct UnkStruct_Main0 *arg0, u8 arg1, u8 arg2, u32 playerGender StringExpandPlaceholders(gStringVar4, gUnknown_082EF100[playerGender][Random() % 2]); break; default: - StringExpandPlaceholders(gStringVar4, gUnknown_082EE6C8); + StringExpandPlaceholders(gStringVar4, sText_TrainerAppearsBusy); break; } return 0; @@ -3912,7 +3912,7 @@ void sub_8017B3C(u8 arg0, u8 arg1, struct UnkLinkRfuStruct_02022B14 * arg2, cons sub_80173E0(arg0, 1, str, 8, arg1, arg4); if (r8 == SPECIES_EGG) { - sub_80173E0(arg0, 1, gUnknown_082EF7D0, 0x44, arg1, arg4); + sub_80173E0(arg0, 1, sText_EggTrade, 0x44, arg1, arg4); } else { @@ -4023,7 +4023,7 @@ void sub_8017D9C(u8 *dst, s32 arg1, u32 playerGender) StringExpandPlaceholders(dst, gUnknown_082EED3C[playerGender]); break; case 0x44: - StringExpandPlaceholders(dst, gUnknown_082EF7B0); + StringExpandPlaceholders(dst, sText_TradeOfferRejected); break; case 0x48: StringExpandPlaceholders(dst, gUnknown_082EEB08[playerGender]); @@ -4059,16 +4059,16 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) switch (arg2[0]) { case 0x41: - StringExpandPlaceholders(dst, gUnionRoom_BattleChallenge); + StringExpandPlaceholders(dst, sText_BattleChallenge); result = 1; break; case 0x45: - StringExpandPlaceholders(dst, gUnionRoom_ChatInvitation); + StringExpandPlaceholders(dst, sText_ChatInvitation); result = 1; break; case 0x44: - ConvertIntToDecimalStringN(arg3->field_58 + 0x00, gUnknown_02022C40.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3); - StringCopy(arg3->field_58 + 0x10, gSpeciesNames[gUnknown_02022C40.playerSpecies]); + ConvertIntToDecimalStringN(arg3->field_58 + 0x00, sUnionRoomTrade.playerLevel, STR_CONV_MODE_LEFT_ALIGN, 3); + StringCopy(arg3->field_58 + 0x10, gSpeciesNames[sUnionRoomTrade.playerSpecies]); for (i = 0; i < 4; i++) { if (gUnknown_03007890->unk_14[i].unk_04 == 2) @@ -4081,7 +4081,7 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) } if (species == SPECIES_EGG) { - StringCopy(dst, gUnionRoom_OfferToTradeEgg); + StringCopy(dst, sText_OfferToTradeEgg); } else { @@ -4089,16 +4089,16 @@ s32 sub_8017EA0(u8 *dst, u32 gender, u16 *arg2, struct UnkStruct_URoom *arg3) { DynamicPlaceholderTextUtil_SetPlaceholderPtr(i, arg3->field_58 + 0x10 * i); } - DynamicPlaceholderTextUtil_ExpandPlaceholders(dst, gUnionRoom_OfferToTradeMon); + DynamicPlaceholderTextUtil_ExpandPlaceholders(dst, sText_OfferToTradeMon); } result = 1; break; case 0x48: - StringExpandPlaceholders(dst, gUnionRoom_ShowTrainerCard); + StringExpandPlaceholders(dst, sText_ShowTrainerCard); result = 1; break; case 0x40: - StringExpandPlaceholders(dst, gUnionRoom_ChatDropped); + StringExpandPlaceholders(dst, sText_ChatDropped); result = 2; break; } @@ -4131,14 +4131,14 @@ bool32 InUnionRoom(void) ? TRUE : FALSE; } -bool32 sub_8018024(void) +bool32 HasAtLeastTwoMonsOfLevel30OrLower(void) { s32 i; s32 count = 0; for (i = 0; i < gPlayerPartyCount; i++) { - if ( GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) <= 30 + if (GetMonData(&gPlayerParty[i], MON_DATA_LEVEL) <= 30 && GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2) != SPECIES_EGG) { count++; @@ -4146,16 +4146,12 @@ bool32 sub_8018024(void) } if (count > 1) - { return TRUE; - } else - { return FALSE; - } } -void sub_801807C(struct TradeUnkStruct *arg0) +static void ResetUnionRoomTrade(struct UnionRoomTrade *arg0) { arg0->field_0 = 0; arg0->type = 0; @@ -4167,34 +4163,30 @@ void sub_801807C(struct TradeUnkStruct *arg0) arg0->personality = 0; } -void sub_8018090(void) +void Script_ResetUnionRoomTrade(void) { - sub_801807C(&gUnknown_02022C40); + ResetUnionRoomTrade(&sUnionRoomTrade); } -bool32 sub_80180A0(u32 monId, struct TradeUnkStruct *arg1) +static bool32 RegisterTradeMonAndGetIsEgg(u32 monId, struct UnionRoomTrade *trade) { - arg1->playerSpecies = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); - arg1->playerLevel = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - arg1->playerPersonality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); - if (arg1->playerSpecies == SPECIES_EGG) - { + trade->playerSpecies = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); + trade->playerLevel = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + trade->playerPersonality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + if (trade->playerSpecies == SPECIES_EGG) return TRUE; - } else - { return FALSE; - } } -void sub_80180E8(u32 monId, struct TradeUnkStruct *arg1) +static void RegisterTradeMon(u32 monId, struct UnionRoomTrade *trade) { - arg1->species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); - arg1->level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); - arg1->personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); + trade->species = GetMonData(&gPlayerParty[monId], MON_DATA_SPECIES2); + trade->level = GetMonData(&gPlayerParty[monId], MON_DATA_LEVEL); + trade->personality = GetMonData(&gPlayerParty[monId], MON_DATA_PERSONALITY); } -u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId) +static u32 GetPartyPositionOfRegisteredMon(struct UnionRoomTrade *trade, u8 multiplayerId) { u16 response = 0; u16 species; @@ -4203,15 +4195,17 @@ u32 sub_8018120(struct TradeUnkStruct *arg0, u8 multiplayerId) u16 cur_species; s32 i; + // player if (multiplayerId == 0) { - species = arg0->playerSpecies; - personality = arg0->playerPersonality; + species = trade->playerSpecies; + personality = trade->playerPersonality; } + // partner else { - species = arg0->species; - personality = arg0->personality; + species = trade->species; + personality = trade->personality; } for (i = 0; i < gPlayerPartyCount; i++) @@ -4241,7 +4235,7 @@ void sub_801818C(bool32 arg0) gUnknown_02022C2C = 0; if (arg0) { - sub_8010FCC(gUnknown_02022C40.type, gUnknown_02022C40.playerSpecies, gUnknown_02022C40.playerLevel); + sub_8010FCC(sUnionRoomTrade.type, sUnionRoomTrade.playerSpecies, sUnionRoomTrade.playerLevel); sub_8011090(0x40, 0, 0); } }