-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Pushing B When Asked To Stop Learning Move Will Cancel Teaching The Move
voloved edited this page Jan 21, 2023
·
3 revisions
By devolov
Goal: It's annoying that when you press B when you don't want to learn a move, it asks you if you want to stop learning and if you press B again, it'll loop through asking again. This change in logic will cause pressing B when you don't want to learn a new move to give up on teaching it.
------------------------- src/battle_script_commands.c -------------------------
index 69dade961..93a0e90f1 100644
@@ -5540,9 +5540,9 @@ static void Cmd_yesnoboxstoplearningmove(void)
}
else if (JOY_NEW(B_BUTTON))
{
PlaySE(SE_SELECT);
- gBattlescriptCurrInstr = T1_READ_PTR(gBattlescriptCurrInstr + 1);
+ gBattlescriptCurrInstr += 5;
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
}
break;
}
Change logic for learning new move in party menu (such as using TMs or levelling up with Rare Candy):
------------------------------- src/party_menu.c -------------------------------
index a887592a0..58761d36c 100755
@@ -4959,8 +4959,11 @@ static void Task_HandleStopLearningMoveYesNoInput(u8 taskId)
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
switch (Menu_ProcessInputNoWrapClearOnChoose())
{
+ case MENU_B_PRESSED:
+ PlaySE(SE_SELECT);
+ // fallthrough
case 0:
GetMonNickname(mon, gStringVar1);
StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]);
StringExpandPlaceholders(gStringVar4, gText_MoveNotLearned);
@@ -4975,11 +4978,8 @@ static void Task_HandleStopLearningMoveYesNoInput(u8 taskId)
gSpecialVar_Result = FALSE;
gTasks[taskId].func = Task_ClosePartyMenuAfterText;
}
break;
- case MENU_B_PRESSED:
- PlaySE(SE_SELECT);
- // fallthrough
case 1:
GetMonNickname(mon, gStringVar1);
StringCopy(gStringVar2, gMoveNames[gPartyMenu.data1]);
DisplayLearnMoveMessage(gText_PkmnNeedsToReplaceMove);
----------------------------- src/move_relearner.c -----------------------------
index 3c8b06a78..2e28fb44e 100644
@@ -607,13 +607,13 @@ static void DoMoveRelearnerMain(void)
case MENU_STATE_CONFIRM_STOP_TEACHING:
{
s8 selection = Menu_ProcessInputNoWrapClearOnChoose();
- if (selection == 0)
+ if (selection == MENU_B_PRESSED || selection == 0)
{
sMoveRelearnerStruct->state = MENU_STATE_CHOOSE_SETUP_STATE;
}
- else if (selection == MENU_B_PRESSED || selection == 1)
+ else if (selection == 1)
{
// What's the point? It gets set to MENU_STATE_PRINT_TRYING_TO_LEARN_PROMPT, anyway.
if (sMoveRelearnerMenuSate.showContestInfo == FALSE)
{
Change logic at evolution scene where a move is learned right after evolving (including during trades):
---------------------------- src/evolution_scene.c ----------------------------
index 2fabcb426..5586bf198 100644
@@ -163,8 +163,9 @@ static void CB2_BeginEvolutionScene(void)
#define tLearnMoveYesState data[7]
#define tLearnMoveNoState data[8]
#define tEvoWasStopped data[9]
#define tPartyId data[10]
+#define tStopLearningMove data[11]
#define TASK_BIT_CAN_STOP (1 << 0)
#define TASK_BIT_LEARN_MOVE (1 << 7)
@@ -296,8 +297,9 @@ void EvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, bool8 canStopEvo, u
gTasks[id].tCanStop = canStopEvo;
gTasks[id].tLearnsFirstMove = TRUE;
gTasks[id].tEvoWasStopped = FALSE;
gTasks[id].tPartyId = partyId;
+ gTasks[id].tStopLearningMove = FALSE;
memcpy(&sEvoStructPtr->savedPalette, &gPlttBufferUnfaded[0x20], sizeof(sEvoStructPtr->savedPalette));
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_BG_ALL_ON | DISPCNT_OBJ_1D_MAP);
@@ -510,8 +512,9 @@ void TradeEvolutionScene(struct Pokemon *mon, u16 postEvoSpecies, u8 preEvoSprit
gTasks[id].tPostEvoSpecies = postEvoSpecies;
gTasks[id].tLearnsFirstMove = TRUE;
gTasks[id].tEvoWasStopped = FALSE;
gTasks[id].tPartyId = partyId;
+ gTasks[id].tStopLearningMove = FALSE;
gBattle_BG0_X = 0;
gBattle_BG0_Y = 0;
gBattle_BG1_X = 0;
@@ -873,8 +876,9 @@ static void Task_EvolutionScene(u8 taskId)
// "{mon} is trying to learn {move}"
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
+ gTasks[taskId].tStopLearningMove = FALSE;
gTasks[taskId].tLearnMoveState++;
}
break;
case MVSTATE_INTRO_MSG_2:
@@ -948,9 +952,16 @@ static void Task_EvolutionScene(u8 taskId)
{
// Equivalent to selecting NO
HandleBattleWindow(YESNOBOX_X_Y, WINDOW_CLEAR);
PlaySE(SE_SELECT);
- gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState;
+ if (gTasks[taskId].tStopLearningMove){
+ gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveYesState;
+ if (gTasks[taskId].tLearnMoveState == MVSTATE_SHOW_MOVE_SELECT)
+ BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
+ }
+ else{
+ gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState;
+ }
}
break;
case MVSTATE_SHOW_MOVE_SELECT:
if (!gPaletteFade.active)
@@ -1007,15 +1018,17 @@ static void Task_EvolutionScene(u8 taskId)
break;
case MVSTATE_ASK_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
+ gTasks[taskId].tStopLearningMove = TRUE;
gTasks[taskId].tLearnMoveYesState = MVSTATE_CANCEL;
gTasks[taskId].tLearnMoveNoState = MVSTATE_INTRO_MSG_1;
gTasks[taskId].tLearnMoveState = MVSTATE_PRINT_YES_NO;
break;
case MVSTATE_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]);
BattlePutTextOnWindow(gDisplayedStringBattle, B_WIN_MSG);
+ gTasks[taskId].tStopLearningMove = FALSE;
gTasks[taskId].tState = EVOSTATE_TRY_LEARN_MOVE;
break;
case MVSTATE_RETRY_AFTER_HM:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
@@ -1265,8 +1278,9 @@ static void Task_TradeEvolutionScene(u8 taskId)
// "{mon} is trying to learn {move}"
BufferMoveToLearnIntoBattleTextBuff2();
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_TRYTOLEARNMOVE1 - BATTLESTRINGS_TABLE_START]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
+ gTasks[taskId].tStopLearningMove = FALSE;
gTasks[taskId].tLearnMoveState++;
}
break;
case T_MVSTATE_INTRO_MSG_2:
@@ -1298,9 +1312,13 @@ static void Task_TradeEvolutionScene(u8 taskId)
sEvoCursorPos = 0;
}
break;
case T_MVSTATE_HANDLE_YES_NO:
- switch (Menu_ProcessInputNoWrapClearOnChoose())
+ var = Menu_ProcessInputNoWrapClearOnChoose();
+ if (var == MENU_B_PRESSED){
+ var = !gTasks[taskId].tStopLearningMove;
+ }
+ switch (var)
{
case 0: // YES
sEvoCursorPos = 0;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]);
@@ -1309,9 +1327,8 @@ static void Task_TradeEvolutionScene(u8 taskId)
if (gTasks[taskId].tLearnMoveState == T_MVSTATE_SHOW_MOVE_SELECT)
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
break;
case 1: // NO
- case MENU_B_PRESSED:
sEvoCursorPos = 1;
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_EMPTYSTRING3 - BATTLESTRINGS_TABLE_START]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
gTasks[taskId].tLearnMoveState = gTasks[taskId].tLearnMoveNoState;
@@ -1377,15 +1394,17 @@ static void Task_TradeEvolutionScene(u8 taskId)
break;
case T_MVSTATE_ASK_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_STOPLEARNINGMOVE - BATTLESTRINGS_TABLE_START]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
+ gTasks[taskId].tStopLearningMove = TRUE;
gTasks[taskId].tLearnMoveYesState = T_MVSTATE_CANCEL;
gTasks[taskId].tLearnMoveNoState = T_MVSTATE_INTRO_MSG_1;
gTasks[taskId].tLearnMoveState = T_MVSTATE_PRINT_YES_NO;
break;
case T_MVSTATE_CANCEL:
BattleStringExpandPlaceholdersToDisplayedString(gBattleStringsTable[STRINGID_DIDNOTLEARNMOVE - BATTLESTRINGS_TABLE_START]);
DrawTextOnTradeWindow(0, gDisplayedStringBattle, 1);
+ gTasks[taskId].tStopLearningMove = FALSE;
gTasks[taskId].tState = T_EVOSTATE_TRY_LEARN_MOVE;
break;
case T_MVSTATE_RETRY_AFTER_HM:
if (!IsTextPrinterActive(0) && !IsSEPlaying())
@@ -1406,8 +1425,9 @@ static void Task_TradeEvolutionScene(u8 taskId)
#undef tLearnMoveYesState
#undef tLearnMoveNoState
#undef tEvoWasStopped
#undef tPartyId
+#undef tStopLearningMove
static void EvoDummyFunc(void)
{
}