From 65d3b583748bf1a8e03bc55baa31760bd5bdc384 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 15 Nov 2021 10:57:06 -0500 Subject: [PATCH] Add PARTY_NOTHING_CHOSEN --- data/maps/BattleFrontier_Lounge1/scripts.inc | 4 ++-- data/maps/BattleFrontier_Lounge5/scripts.inc | 2 +- data/maps/BattleFrontier_Lounge6/scripts.inc | 2 +- data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc | 2 +- data/maps/FortreeCity_House1/scripts.inc | 2 +- data/maps/LilycoveCity_ContestLobby/scripts.inc | 2 +- data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc | 2 +- data/maps/PacifidlogTown_House3/scripts.inc | 2 +- data/maps/RustboroCity_House1/scripts.inc | 2 +- data/maps/SlateportCity_NameRatersHouse/scripts.inc | 4 ++-- data/maps/SootopolisCity_LotadAndSeedotHouse/scripts.inc | 4 ++-- data/script_cmd_table.inc | 2 +- data/scripts/contest_hall.inc | 2 +- data/scripts/day_care.inc | 2 +- include/constants/party_menu.h | 2 ++ include/mail.h | 2 +- src/mail_data.c | 3 ++- src/party_menu.c | 8 ++++---- 18 files changed, 26 insertions(+), 23 deletions(-) diff --git a/data/maps/BattleFrontier_Lounge1/scripts.inc b/data/maps/BattleFrontier_Lounge1/scripts.inc index 0455d577c..4447e1032 100644 --- a/data/maps/BattleFrontier_Lounge1/scripts.inc +++ b/data/maps/BattleFrontier_Lounge1/scripts.inc @@ -14,9 +14,9 @@ BattleFrontier_Lounge1_EventScript_Breeder:: BattleFrontier_Lounge1_EventScript_ChooseMonToShowBreeder:: special ChoosePartyMon waitstate - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_ne BattleFrontier_Lounge1_EventScript_ShowMonToBreeder - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq BattleFrontier_Lounge1_EventScript_CancelMonSelect end diff --git a/data/maps/BattleFrontier_Lounge5/scripts.inc b/data/maps/BattleFrontier_Lounge5/scripts.inc index 61ac0cb9e..d680156f3 100644 --- a/data/maps/BattleFrontier_Lounge5/scripts.inc +++ b/data/maps/BattleFrontier_Lounge5/scripts.inc @@ -11,7 +11,7 @@ BattleFrontier_Lounge5_EventScript_NatureGirl:: waitstate lock faceplayer - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq BattleFrontier_Lounge5_EventScript_NatureGirlNoneShown specialvar VAR_RESULT, ScriptGetPartyMonSpecies compare VAR_RESULT, SPECIES_EGG diff --git a/data/maps/BattleFrontier_Lounge6/scripts.inc b/data/maps/BattleFrontier_Lounge6/scripts.inc index f88c69324..678ea6e33 100644 --- a/data/maps/BattleFrontier_Lounge6/scripts.inc +++ b/data/maps/BattleFrontier_Lounge6/scripts.inc @@ -15,7 +15,7 @@ BattleFrontier_Lounge6_EventScript_Trader:: special ChoosePartyMon waitstate copyvar VAR_0x800A, VAR_0x8004 - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq BattleFrontier_Lounge6_EventScript_DeclineTrade copyvar VAR_0x8005, VAR_0x800A specialvar VAR_RESULT, GetTradeSpecies diff --git a/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc b/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc index 945d61646..096f13877 100644 --- a/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc +++ b/data/maps/FallarborTown_MoveRelearnersHouse/scripts.inc @@ -27,7 +27,7 @@ FallarborTown_MoveRelearnersHouse_EventScript_ChooseMon:: msgbox FallarborTown_MoveRelearnersHouse_Text_TutorWhichMon, MSGBOX_DEFAULT special ChooseMonForMoveRelearner waitstate - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq FallarborTown_MoveRelearnersHouse_EventScript_ComeBackWithHeartScale special IsSelectedMonEgg compare VAR_RESULT, TRUE diff --git a/data/maps/FortreeCity_House1/scripts.inc b/data/maps/FortreeCity_House1/scripts.inc index e25334ee9..111a1b7c8 100644 --- a/data/maps/FortreeCity_House1/scripts.inc +++ b/data/maps/FortreeCity_House1/scripts.inc @@ -15,7 +15,7 @@ FortreeCity_House1_EventScript_Trader:: special ChoosePartyMon waitstate copyvar VAR_0x800A, VAR_0x8004 - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq FortreeCity_House1_EventScript_DeclineTrade copyvar VAR_0x8005, VAR_0x800A specialvar VAR_RESULT, GetTradeSpecies diff --git a/data/maps/LilycoveCity_ContestLobby/scripts.inc b/data/maps/LilycoveCity_ContestLobby/scripts.inc index 7bfa1419a..c572fdc02 100644 --- a/data/maps/LilycoveCity_ContestLobby/scripts.inc +++ b/data/maps/LilycoveCity_ContestLobby/scripts.inc @@ -724,7 +724,7 @@ LilycoveCity_ContestLobby_EventScript_ChooseLinkContestMon:: msgbox LilycoveCity_ContestLobby_Text_EnterWhichPokemon3, MSGBOX_DEFAULT setvar VAR_CONTEST_RANK, 0 choosecontestmon - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelLinkContest special TryEnterContestMon compare VAR_RESULT, CANT_ENTER_CONTEST diff --git a/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc b/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc index ff340c9f3..eead1f675 100644 --- a/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc +++ b/data/maps/LilycoveCity_MoveDeletersHouse/scripts.inc @@ -18,7 +18,7 @@ LilycoveCity_MoveDeletersHouse_EventScript_ChooseMonAndMoveToForget:: msgbox LilycoveCity_MoveDeletersHouse_Text_WhichMonShouldForget, MSGBOX_DEFAULT special ChoosePartyMon waitstate - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq LilycoveCity_MoveDeletersHouse_EventScript_ComeAgain special IsSelectedMonEgg compare VAR_RESULT, TRUE diff --git a/data/maps/PacifidlogTown_House3/scripts.inc b/data/maps/PacifidlogTown_House3/scripts.inc index c53ef0519..a2f70e2cc 100644 --- a/data/maps/PacifidlogTown_House3/scripts.inc +++ b/data/maps/PacifidlogTown_House3/scripts.inc @@ -15,7 +15,7 @@ PacifidlogTown_House3_EventScript_Trader:: special ChoosePartyMon waitstate copyvar VAR_0x800A, VAR_0x8004 - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq PacifidlogTown_House3_EventScript_DeclineTrade copyvar VAR_0x8005, VAR_0x800A specialvar VAR_RESULT, GetTradeSpecies diff --git a/data/maps/RustboroCity_House1/scripts.inc b/data/maps/RustboroCity_House1/scripts.inc index 0b7de48bc..3d64f72a7 100644 --- a/data/maps/RustboroCity_House1/scripts.inc +++ b/data/maps/RustboroCity_House1/scripts.inc @@ -15,7 +15,7 @@ RustboroCity_House1_EventScript_Trader:: special ChoosePartyMon waitstate copyvar VAR_0x800A, VAR_0x8004 - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq RustboroCity_House1_EventScript_DeclineTrade copyvar VAR_0x8005, VAR_0x800A specialvar VAR_RESULT, GetTradeSpecies diff --git a/data/maps/SlateportCity_NameRatersHouse/scripts.inc b/data/maps/SlateportCity_NameRatersHouse/scripts.inc index 87ed2d07f..3242050e7 100644 --- a/data/maps/SlateportCity_NameRatersHouse/scripts.inc +++ b/data/maps/SlateportCity_NameRatersHouse/scripts.inc @@ -15,9 +15,9 @@ SlateportCity_NameRatersHouse_EventScript_ChooseMonToRate:: msgbox SlateportCity_NameRatersHouse_Text_CritiqueWhichMonNickname, MSGBOX_DEFAULT special ChoosePartyMon waitstate - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_ne SlateportCity_NameRatersHouse_EventScript_RateMonNickname - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq SlateportCity_NameRatersHouse_EventScript_DeclineNameRate end diff --git a/data/maps/SootopolisCity_LotadAndSeedotHouse/scripts.inc b/data/maps/SootopolisCity_LotadAndSeedotHouse/scripts.inc index ab087696e..5620bb3e4 100644 --- a/data/maps/SootopolisCity_LotadAndSeedotHouse/scripts.inc +++ b/data/maps/SootopolisCity_LotadAndSeedotHouse/scripts.inc @@ -9,7 +9,7 @@ SootopolisCity_LotadAndSeedotHouse_EventScript_SeedotBrother:: special ChoosePartyMon waitstate copyvar VAR_RESULT, VAR_0x8004 - compare VAR_RESULT, 255 + compare VAR_RESULT, PARTY_NOTHING_CHOSEN goto_if_eq SootopolisCity_LotadAndSeedotHouse_EventScript_CancelShowSeedot special CompareSeedotSize compare VAR_RESULT, 1 @@ -58,7 +58,7 @@ SootopolisCity_LotadAndSeedotHouse_EventScript_LotadBrother:: special ChoosePartyMon waitstate copyvar VAR_RESULT, VAR_0x8004 - compare VAR_RESULT, 255 + compare VAR_RESULT, PARTY_NOTHING_CHOSEN goto_if_eq SootopolisCity_LotadAndSeedotHouse_EventScript_CancelShowLotad special CompareLotadSize compare VAR_RESULT, 1 diff --git a/data/script_cmd_table.inc b/data/script_cmd_table.inc index dcc0da9f7..566ac3b36 100644 --- a/data/script_cmd_table.inc +++ b/data/script_cmd_table.inc @@ -207,7 +207,7 @@ gScriptCmdTable:: .4byte ScrCmd_nop1 @ 0xcc .4byte ScrCmd_setmoneventlegal @ 0xcd .4byte ScrCmd_checkmoneventlegal @ 0xce - .4byte ScrCmd_gotoram @ 0xcf + .4byte ScrCmd_gotowondercardscript @ 0xcf .4byte ScrCmd_nop1 @ 0xd0 .4byte ScrCmd_warpspinenter @ 0xd1 .4byte ScrCmd_setmonmetlocation @ 0xd2 diff --git a/data/scripts/contest_hall.inc b/data/scripts/contest_hall.inc index 17364559b..13f31e9bd 100644 --- a/data/scripts/contest_hall.inc +++ b/data/scripts/contest_hall.inc @@ -103,7 +103,7 @@ LilycoveCity_ContestLobby_EventScript_CancelEnterContest:: LilycoveCity_ContestLobby_EventScript_ChooseContestMon:: msgbox LilycoveCity_ContestLobby_Text_EnterWhichPokemon1, MSGBOX_DEFAULT choosecontestmon - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq LilycoveCity_ContestLobby_EventScript_CancelEnterContest special TryEnterContestMon compare VAR_RESULT, CANT_ENTER_CONTEST diff --git a/data/scripts/day_care.inc b/data/scripts/day_care.inc index 8d529d5e1..ba61fb004 100644 --- a/data/scripts/day_care.inc +++ b/data/scripts/day_care.inc @@ -107,7 +107,7 @@ Route117_PokemonDayCare_EventScript_GiveMonToRaise:: fadescreen FADE_TO_BLACK special ChooseSendDaycareMon waitstate - compare VAR_0x8004, 255 + compare VAR_0x8004, PARTY_NOTHING_CHOSEN goto_if_eq Route117_PokemonDayCare_EventScript_ComeAgain specialvar VAR_RESULT, CountPartyAliveNonEggMons_IgnoreVar0x8004Slot compare VAR_RESULT, 0 diff --git a/include/constants/party_menu.h b/include/constants/party_menu.h index e31debb49..f95bfa90f 100644 --- a/include/constants/party_menu.h +++ b/include/constants/party_menu.h @@ -1,6 +1,8 @@ #ifndef GUARD_CONSTANTS_PARTY_MENU_H #define GUARD_CONSTANTS_PARTY_MENU_H +#define PARTY_NOTHING_CHOSEN 0xFF + #define AILMENT_NONE 0 #define AILMENT_PSN 1 #define AILMENT_PRZ 2 diff --git a/include/mail.h b/include/mail.h index 8236811cb..68c532b31 100644 --- a/include/mail.h +++ b/include/mail.h @@ -27,7 +27,7 @@ u16 MailSpeciesToSpecies(u16 mailSpecies, u16 *buffer); u8 GiveMailToMon(struct Pokemon *mon, struct Mail *mail); void TakeMailFromMon(struct Pokemon *mon); void ClearMailItemId(u8 mailId); -u8 TakeMailFromMon2(struct Pokemon *mon); +u8 TakeMailFromMonAndSave(struct Pokemon *mon); bool8 ItemIsMail(u16 itemId); #endif // GUARD_MAIL_H diff --git a/src/mail_data.c b/src/mail_data.c index 683bd854e..ca50a687e 100644 --- a/src/mail_data.c +++ b/src/mail_data.c @@ -157,7 +157,7 @@ void ClearMailItemId(u8 mailId) gSaveBlock1Ptr->mail[mailId].itemId = ITEM_NONE; } -u8 TakeMailFromMon2(struct Pokemon *mon) +u8 TakeMailFromMonAndSave(struct Pokemon *mon) { u8 i; u8 newHeldItem[2]; @@ -179,6 +179,7 @@ u8 TakeMailFromMon2(struct Pokemon *mon) } } + // No space to save mail return MAIL_NONE; } diff --git a/src/party_menu.c b/src/party_menu.c index 43f522034..ad8d78ad3 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -3343,7 +3343,7 @@ static void Task_HandleSendMailToPCYesNoInput(u8 taskId) switch (Menu_ProcessInputNoWrapClearOnChoose()) { case 0: // Yes, send to PC - if (TakeMailFromMon2(&gPlayerParty[gPartyMenu.slotId]) != 0xFF) + if (TakeMailFromMonAndSave(&gPlayerParty[gPartyMenu.slotId]) != MAIL_NONE) { DisplayPartyMenuMessage(gText_MailSentToPC, FALSE); gTasks[taskId].func = Task_UpdateHeldItemSprite; @@ -6133,7 +6133,7 @@ static void BufferMonSelection(void) { gSpecialVar_0x8004 = GetCursorSelectionMonId(); if (gSpecialVar_0x8004 >= PARTY_SIZE) - gSpecialVar_0x8004 = 0xFF; + gSpecialVar_0x8004 = PARTY_NOTHING_CHOSEN; gFieldCallback2 = CB2_FadeFromPartyMenu; SetMainCallback2(CB2_ReturnToField); } @@ -6176,7 +6176,7 @@ static void CB2_ChooseContestMon(void) { gContestMonPartyIndex = GetCursorSelectionMonId(); if (gContestMonPartyIndex >= PARTY_SIZE) - gContestMonPartyIndex = 0xFF; + gContestMonPartyIndex = PARTY_NOTHING_CHOSEN; gSpecialVar_0x8004 = gContestMonPartyIndex; gFieldCallback2 = CB2_FadeFromPartyMenu; SetMainCallback2(CB2_ReturnToField); @@ -6221,7 +6221,7 @@ static void CB2_ChooseMonForMoveRelearner(void) { gSpecialVar_0x8004 = GetCursorSelectionMonId(); if (gSpecialVar_0x8004 >= PARTY_SIZE) - gSpecialVar_0x8004 = 0xFF; + gSpecialVar_0x8004 = PARTY_NOTHING_CHOSEN; else gSpecialVar_0x8005 = GetNumberOfRelearnableMoves(&gPlayerParty[gSpecialVar_0x8004]); gFieldCallback2 = CB2_FadeFromPartyMenu;