mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 03:04:15 +01:00
Added ability to use pokeballs on field
This commit is contained in:
parent
87e2a5dc74
commit
5af3affc59
@ -37,6 +37,7 @@ void ItemUseInBattle_PartyMenuChooseMove(u8 taskId);
|
||||
void Task_UseDigEscapeRopeOnField(u8 taskId);
|
||||
u8 CanUseDigOrEscapeRopeOnCurMap(void);
|
||||
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
|
||||
void ItemUseOutOfBattle_PokeBall(u8);
|
||||
|
||||
enum {
|
||||
BALL_THROW_UNABLE_TWO_MONS,
|
||||
|
@ -96,5 +96,6 @@ void MoveDeleterForgetMove(void);
|
||||
void BufferMoveDeleterNicknameAndMove(void);
|
||||
void GetNumMovesSelectedMonHas(void);
|
||||
void MoveDeleterChooseMoveToForget(void);
|
||||
void ItemUseCB_PokeBall(u8 taskId, TaskFunc task);
|
||||
|
||||
#endif // GUARD_PARTY_MENU_H
|
||||
|
@ -41,6 +41,7 @@ const struct Item gItems[] =
|
||||
.description = sPokeBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_POKE_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -52,6 +53,7 @@ const struct Item gItems[] =
|
||||
.description = sGreatBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_GREAT_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -63,6 +65,7 @@ const struct Item gItems[] =
|
||||
.description = sUltraBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_ULTRA_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -74,6 +77,7 @@ const struct Item gItems[] =
|
||||
.description = sMasterBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_MASTER_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -85,6 +89,7 @@ const struct Item gItems[] =
|
||||
.description = sPremierBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_PREMIER_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -96,6 +101,7 @@ const struct Item gItems[] =
|
||||
.description = sHealBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_HEAL_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -107,6 +113,7 @@ const struct Item gItems[] =
|
||||
.description = sNetBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_NET_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -118,6 +125,7 @@ const struct Item gItems[] =
|
||||
.description = sNestBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_NEST_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -129,6 +137,7 @@ const struct Item gItems[] =
|
||||
.description = sDiveBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_DIVE_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -140,6 +149,7 @@ const struct Item gItems[] =
|
||||
.description = sDuskBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_DUSK_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -151,6 +161,7 @@ const struct Item gItems[] =
|
||||
.description = sTimerBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_TIMER_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -162,6 +173,7 @@ const struct Item gItems[] =
|
||||
.description = sQuickBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_QUICK_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -173,6 +185,7 @@ const struct Item gItems[] =
|
||||
.description = sRepeatBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_REPEAT_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -184,6 +197,7 @@ const struct Item gItems[] =
|
||||
.description = sLuxuryBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_LUXURY_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -195,6 +209,7 @@ const struct Item gItems[] =
|
||||
.description = sLevelBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_LEVEL_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -206,6 +221,7 @@ const struct Item gItems[] =
|
||||
.description = sLureBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_LURE_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -217,6 +233,7 @@ const struct Item gItems[] =
|
||||
.description = sMoonBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_MOON_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -228,6 +245,7 @@ const struct Item gItems[] =
|
||||
.description = sFriendBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_FRIEND_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -239,6 +257,7 @@ const struct Item gItems[] =
|
||||
.description = sLoveBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_LOVE_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -250,6 +269,7 @@ const struct Item gItems[] =
|
||||
.description = sFastBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_FAST_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -261,6 +281,7 @@ const struct Item gItems[] =
|
||||
.description = sHeavyBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_HEAVY_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -272,6 +293,7 @@ const struct Item gItems[] =
|
||||
.description = sDreamBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_DREAM_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -283,6 +305,7 @@ const struct Item gItems[] =
|
||||
.description = sSafariBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_SAFARI_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -294,6 +317,7 @@ const struct Item gItems[] =
|
||||
.description = sSportBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_SPORT_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -305,6 +329,7 @@ const struct Item gItems[] =
|
||||
.description = sParkBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_PARK_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -316,6 +341,7 @@ const struct Item gItems[] =
|
||||
.description = sBeastBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_BEAST_BALL - FIRST_BALL,
|
||||
},
|
||||
@ -327,6 +353,7 @@ const struct Item gItems[] =
|
||||
.description = sCherishBallDesc,
|
||||
.pocket = POCKET_POKE_BALLS,
|
||||
.type = ITEM_USE_BAG_MENU,
|
||||
.fieldUseFunc = ItemUseOutOfBattle_PokeBall,
|
||||
.battleUsage = EFFECT_ITEM_THROW_BALL,
|
||||
.secondaryId = ITEM_CHERISH_BALL - FIRST_BALL,
|
||||
},
|
||||
|
@ -295,7 +295,7 @@ static const u8 sContextMenuItems_KeyItemsPocket[] = {
|
||||
};
|
||||
|
||||
static const u8 sContextMenuItems_BallsPocket[] = {
|
||||
ACTION_GIVE, ACTION_DUMMY,
|
||||
ACTION_USE, ACTION_GIVE,
|
||||
ACTION_TOSS, ACTION_CANCEL
|
||||
};
|
||||
|
||||
|
@ -1351,3 +1351,10 @@ void ItemUseOutOfBattle_CannotUse(u8 taskId)
|
||||
}
|
||||
|
||||
#undef tUsingRegisteredKeyItem
|
||||
|
||||
void ItemUseOutOfBattle_PokeBall(u8 taskId)
|
||||
{
|
||||
gItemUseCB = ItemUseCB_PokeBall;
|
||||
gBagMenu->newScreenCallback = CB2_ShowPartyMenuForItemUse;
|
||||
Task_FadeAndCloseBagMenu(taskId);
|
||||
}
|
||||
|
@ -6964,3 +6964,32 @@ void IsLastMonThatKnowsSurf(void)
|
||||
gSpecialVar_Result = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
void ItemUseCB_PokeBall(u8 taskId, TaskFunc task)
|
||||
{
|
||||
struct Pokemon *mon = &gPlayerParty[gPartyMenu.slotId];
|
||||
u16 currBall = GetMonData(mon, MON_DATA_POKEBALL);
|
||||
u16 newBall = gSpecialVar_ItemId;
|
||||
static const u8 sText_MonBallWasChanged[] = _("{STR_VAR_1} was put in the {STR_VAR_2}.{PAUSE_UNTIL_PRESS}");
|
||||
|
||||
if (currBall == newBall)
|
||||
{
|
||||
gPartyMenuUseExitCallback = FALSE;
|
||||
DisplayPartyMenuMessage(gText_WontHaveEffect, TRUE);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
}
|
||||
else
|
||||
{
|
||||
GetMonNickname(mon, gStringVar1);
|
||||
CopyItemName(newBall, gStringVar2);
|
||||
PlaySE(SE_SELECT);
|
||||
gPartyMenuUseExitCallback = TRUE;
|
||||
SetMonData(mon, MON_DATA_POKEBALL, &newBall);
|
||||
StringExpandPlaceholders(gStringVar4, sText_MonBallWasChanged);
|
||||
DisplayPartyMenuMessage(gStringVar4, TRUE);
|
||||
ScheduleBgCopyTilemapToVram(2);
|
||||
gTasks[taskId].func = task;
|
||||
RemoveBagItem(newBall, 1);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user