fixed softlocks / messages

This commit is contained in:
AgustinGDLV 2022-05-16 15:25:13 -07:00
parent 01665c0213
commit bd008e4c80
3 changed files with 24 additions and 9 deletions

View File

@ -498,6 +498,7 @@ extern const u8 gText_12PoofForgotMove[];
extern const u8 gText_StopLearningMove2[];
extern const u8 gText_MoveNotLearned[];
extern const u8 gText_PkmnElevatedToLvVar2[];
extern const u8 gText_PkmnGainedExp[];
extern const u8 gText_RemoveMailBeforeItem[];
extern const u8 gText_PkmnHoldingItemCantHoldMail[];
extern const u8 gText_MailTransferredFromMailbox[];

View File

@ -5004,17 +5004,29 @@ void ItemUseCB_RareCandy(u8 taskId, TaskFunc task)
}
else
{
sFinalLevel = GetMonData(mon, MON_DATA_LEVEL, NULL);
gPartyMenuUseExitCallback = TRUE;
PlayFanfareByFanfareNum(FANFARE_LEVEL_UP);
UpdateMonDisplayInfoAfterRareCandy(gPartyMenu.slotId, mon);
RemoveBagItem(gSpecialVar_ItemId, 1);
GetMonNickname(mon, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
DisplayPartyMenuMessage(gStringVar4, TRUE);
ScheduleBgCopyTilemapToVram(2);
sFinalLevel = GetMonData(mon, MON_DATA_LEVEL, NULL);
gTasks[taskId].func = Task_DisplayLevelUpStatsPg1;
if (sFinalLevel > sInitialLevel)
{
PlayFanfareByFanfareNum(FANFARE_LEVEL_UP);
ConvertIntToDecimalStringN(gStringVar2, GetMonData(mon, MON_DATA_LEVEL), STR_CONV_MODE_LEFT_ALIGN, 3);
StringExpandPlaceholders(gStringVar4, gText_PkmnElevatedToLvVar2);
DisplayPartyMenuMessage(gStringVar4, TRUE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = Task_DisplayLevelUpStatsPg1;
}
else
{
PlaySE(SE_USE_ITEM);
gPartyMenuUseExitCallback = FALSE;
StringExpandPlaceholders(gStringVar4, gText_PkmnGainedExp);
DisplayPartyMenuMessage(gStringVar4, FALSE);
ScheduleBgCopyTilemapToVram(2);
gTasks[taskId].func = task;
}
}
}
@ -5047,6 +5059,7 @@ static void Task_DisplayLevelUpStatsPg2(u8 taskId)
{
PlaySE(SE_SELECT);
DisplayLevelUpStatsPg2(taskId);
sInitialLevel += 1; // so the Pokemon doesn't learn a move meant for its previous level
gTasks[taskId].func = Task_TryLearnNewMoves;
}
}
@ -5077,7 +5090,7 @@ static void Task_TryLearnNewMoves(u8 taskId)
if (WaitFanfare(0) && ((JOY_NEW(A_BUTTON)) || (JOY_NEW(B_BUTTON))))
{
RemoveLevelUpStatsWindow();
for (; sInitialLevel < sFinalLevel; sInitialLevel++)
for (; sInitialLevel <= sFinalLevel; sInitialLevel++)
{
SetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_LEVEL, &sInitialLevel);
learnMove = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], TRUE);
@ -5107,7 +5120,7 @@ static void Task_TryLearnNewMoves(u8 taskId)
static void Task_TryLearningNextMove(u8 taskId)
{
u16 result;
for (; sInitialLevel < sFinalLevel; sInitialLevel++)
for (; sInitialLevel <= sFinalLevel; sInitialLevel++)
{
SetMonData(&gPlayerParty[gPartyMenu.slotId], MON_DATA_LEVEL, &sInitialLevel);
result = MonTryLearningNewMove(&gPlayerParty[gPartyMenu.slotId], FALSE);

View File

@ -417,6 +417,7 @@ const u8 gText_PkmnRegainhedHealth[] = _("{STR_VAR_1} regained health.{PAUSE_UNT
const u8 gText_PkmnBecameHealthy[] = _("{STR_VAR_1} became healthy.{PAUSE_UNTIL_PRESS}");
const u8 gText_MovesPPIncreased[] = _("{STR_VAR_1}'s PP increased.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnElevatedToLvVar2[] = _("{STR_VAR_1} was elevated to\nLv. {STR_VAR_2}.");
const u8 gText_PkmnGainedExp[] = _("{STR_VAR_1} gained EXP. POINTS.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnBaseVar2StatIncreased[] = _("{STR_VAR_1}'s base {STR_VAR_2}\nstat was raised.{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnFriendlyBaseVar2Fell[] = _("{STR_VAR_1} turned friendly.\nThe base {STR_VAR_2} fell!{PAUSE_UNTIL_PRESS}");
const u8 gText_PkmnAdoresBaseVar2Fell[] = _("{STR_VAR_1} adores you!\nThe base {STR_VAR_2} fell!{PAUSE_UNTIL_PRESS}");