From 82dc1e3e93810f74f7abd377f76c2f4ceab70976 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Sat, 15 Apr 2023 09:27:28 -0700 Subject: [PATCH 1/2] fixed dupe strings in battle item use --- data/battle_scripts_2.s | 12 ++++++------ src/item_use.c | 5 +++-- src/party_menu.c | 8 +------- 3 files changed, 10 insertions(+), 15 deletions(-) diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index dee482d1d3b8..71d88ae84b5f 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -49,14 +49,13 @@ BattleScript_UseItemMessage: BattleScript_ItemRestoreHP:: call BattleScript_UseItemMessage itemrestorehp - printstring STRINGID_ITEMRESTOREDSPECIESHEALTH - waitmessage B_WAIT_TIME_LONG jumpifbyte CMP_EQUAL, gBattleCommunication, TRUE, BattleScript_ItemRestoreHP_SendOutRevivedBattler bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER - updatestatusicon BS_ATTACKER + printstring STRINGID_ITEMRESTOREDSPECIESHEALTH + waitmessage B_WAIT_TIME_LONG end BattleScript_ItemRestoreHP_SendOutRevivedBattler: @@ -68,22 +67,22 @@ BattleScript_ItemRestoreHP_SendOutRevivedBattler: BattleScript_ItemCureStatus:: call BattleScript_UseItemMessage itemcurestatus + updatestatusicon BS_ATTACKER printstring STRINGID_ITEMCUREDSPECIESSTATUS waitmessage B_WAIT_TIME_LONG - updatestatusicon BS_ATTACKER end BattleScript_ItemHealAndCureStatus:: call BattleScript_UseItemMessage itemrestorehp curestatus BS_ATTACKER - printstring STRINGID_ITEMRESTOREDSPECIESHEALTH - waitmessage B_WAIT_TIME_LONG bichalfword gMoveResultFlags, MOVE_RESULT_NO_EFFECT orword gHitMarker, HITMARKER_IGNORE_SUBSTITUTE healthbarupdate BS_ATTACKER datahpupdate BS_ATTACKER updatestatusicon BS_ATTACKER + printstring STRINGID_ITEMRESTOREDSPECIESHEALTH + waitmessage B_WAIT_TIME_LONG end BattleScript_ItemIncreaseStat:: @@ -256,3 +255,4 @@ BattleScript_TrainerBSlideMsgRet:: BattleScript_TrainerBSlideMsgEnd2:: call BattleScript_TrainerBSlideMsgRet end2 + end2 diff --git a/src/item_use.c b/src/item_use.c index 8bcadfb2eb2e..26b48ac80b7c 100644 --- a/src/item_use.c +++ b/src/item_use.c @@ -1229,10 +1229,11 @@ void ItemUseInBattle_BagMenu(u8 taskId) { PlaySE(SE_SELECT); RemoveUsedItem(); + ScheduleBgCopyTilemapToVram(2); if (!InBattlePyramid()) - DisplayItemMessage(taskId, FONT_NORMAL, gStringVar4, Task_FadeAndCloseBagMenu); + gTasks[taskId].func = Task_FadeAndCloseBagMenu; else - DisplayItemMessageInBattlePyramid(taskId, gStringVar4, CloseBattlePyramidBag); + gTasks[taskId].func = CloseBattlePyramidBag; } } diff --git a/src/party_menu.c b/src/party_menu.c index dd46b106347d..95d64e54632e 100755 --- a/src/party_menu.c +++ b/src/party_menu.c @@ -4470,11 +4470,8 @@ void ItemUseCB_BattleScript(u8 taskId, TaskFunc task) gBattleStruct->itemPartyIndex[gBattlerInMenuId] = GetPartyIdFromBattleSlot(gPartyMenu.slotId); gPartyMenuUseExitCallback = TRUE; PlaySE(SE_SELECT); - CopyItemName(gSpecialVar_ItemId, gStringVar2); - StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); - DisplayPartyMenuMessage(gStringVar4, TRUE); - ScheduleBgCopyTilemapToVram(2); RemoveBagItem(gSpecialVar_ItemId, 1); + ScheduleBgCopyTilemapToVram(2); gTasks[taskId].func = task; } } @@ -4943,9 +4940,6 @@ static void TryUseItemOnMove(u8 taskId) gChosenMovePos = ptr->data1; gPartyMenuUseExitCallback = TRUE; RemoveBagItem(gSpecialVar_ItemId, 1); - CopyItemName(gSpecialVar_ItemId, gStringVar2); - StringExpandPlaceholders(gStringVar4, gText_PlayerUsedVar2); - DisplayPartyMenuMessage(gStringVar4, TRUE); ScheduleBgCopyTilemapToVram(2); gTasks[taskId].func = Task_ClosePartyMenuAfterText; } From d3a090020bb062d88c0c162bc62292e4debfcd95 Mon Sep 17 00:00:00 2001 From: AgustinGDLV Date: Sat, 15 Apr 2023 15:30:07 -0700 Subject: [PATCH 2/2] added code review --- data/battle_scripts_2.s | 1 - src/battle_message.c | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/data/battle_scripts_2.s b/data/battle_scripts_2.s index 71d88ae84b5f..9ffad7d84336 100644 --- a/data/battle_scripts_2.s +++ b/data/battle_scripts_2.s @@ -255,4 +255,3 @@ BattleScript_TrainerBSlideMsgRet:: BattleScript_TrainerBSlideMsgEnd2:: call BattleScript_TrainerBSlideMsgRet end2 - end2 diff --git a/src/battle_message.c b/src/battle_message.c index 7d10b19f11c7..640e7900da93 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -465,7 +465,7 @@ const u8 *const gPokeblockWasTooXStringTable[FLAVOR_COUNT] = [FLAVOR_SOUR] = sText_PokeblockWasTooSour }; -static const u8 sText_PlayerUsedItem[] = _("{B_PLAYER_NAME} used\n{B_LAST_ITEM}!"); +static const u8 sText_PlayerUsedItem[] = _("You used\n{B_LAST_ITEM}!"); static const u8 sText_WallyUsedItem[] = _("WALLY used\n{B_LAST_ITEM}!"); static const u8 sText_Trainer1UsedItem[] = _("{B_ATK_TRAINER_CLASS} {B_ATK_TRAINER_NAME}\nused {B_LAST_ITEM}!"); static const u8 sText_TrainerBlockedBall[] = _("The TRAINER blocked the BALL!"); @@ -783,9 +783,9 @@ static const u8 sText_ShellTrapDidntWork[] = _("{B_ATK_NAME_WITH_PREFIX}'s shell static const u8 sText_CouldntFullyProtect[] = _("{B_DEF_NAME_WITH_PREFIX} couldn't fully protect\nitself and got hurt!"); static const u8 sText_StockpiledEffectWoreOff[] = _("{B_ATK_NAME_WITH_PREFIX}'s stockpiled\neffect wore off!"); static const u8 sText_PkmnRevivedReadyToFight[] = _("{B_BUFF1} was revived and\nis ready to fight again!"); -static const u8 sText_ItemRestoredSpeciesHealth[] = _("{B_LAST_ITEM} restored\n{B_BUFF1}'s health!"); -static const u8 sText_ItemCuredSpeciesStatus[] = _("{B_LAST_ITEM} cured\n{B_BUFF1}'s status!"); -static const u8 sText_ItemRestoredSpeciesPP[] = _("{B_LAST_ITEM} restored\n{B_BUFF1}'s PP!"); +static const u8 sText_ItemRestoredSpeciesHealth[] = _("{B_BUFF1} had its\nHP restored!"); +static const u8 sText_ItemCuredSpeciesStatus[] = _("{B_BUFF1} had\nits status healed!"); +static const u8 sText_ItemRestoredSpeciesPP[] = _("{B_BUFF1} had its\nPP restored!"); const u8 *const gBattleStringsTable[BATTLESTRINGS_COUNT] = {