Implement Pokemon Box Link functionality (#3837)

* Implement Pokemon Box Link functionality

* Update item_use.c

* Update item_use.c

* Can only use box link if the map allows escape

* Revert "Can only use box link if the map allows escape"

This reverts commit be5b46b6c4.

* Overworld_IsEscapingAllowed

---------

Co-authored-by: Alex <93446519+AlexOn1ine@users.noreply.github.com>
This commit is contained in:
kittenchilly 2023-12-28 04:47:00 -06:00 committed by GitHub
parent c57b1548a0
commit 28f17772ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 2 deletions

View file

@ -64,3 +64,11 @@ EventScript_AccessHallOfFame::
waitstate
goto EventScript_AccessPC
end
EventScript_AccessPokemonBoxLink::
playse SE_PC_LOGIN
msgbox gText_StorageSystemOpened, MSGBOX_DEFAULT
special ShowPokemonStorageSystemPC
waitstate
goto EventScript_TurnOffPC
end

View file

@ -515,6 +515,7 @@ extern const u8 MauvilleCity_PokemonCenter_1F_Text_HotSpringsStory[];
extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_PC[];
extern const u8 LittlerootTown_MaysHouse_2F_EventScript_PC[];
extern const u8 EventScript_PC[];
extern const u8 EventScript_AccessPokemonBoxLink[];
extern const u8 EventScript_TestSignpostMsg[];
extern const u8 EventScript_HiddenItemScript[];
extern const u8 EventScript_TV[];

View file

@ -7,6 +7,7 @@ void ItemUseOutOfBattle_Rod(u8);
void ItemUseOutOfBattle_Itemfinder(u8);
void ItemUseOutOfBattle_PokeblockCase(u8);
void ItemUseOutOfBattle_CoinCase(u8);
void ItemUseOutOfBattle_PokemonBoxLink(u8);
void ItemUseOutOfBattle_PowderJar(u8);
void ItemUseOutOfBattle_SSTicket(u8);
void ItemUseOutOfBattle_WailmerPail(u8);

View file

@ -10186,8 +10186,8 @@ const struct Item gItems[] =
"Storage System."),
.importance = 1,
.pocket = POCKET_KEY_ITEMS,
.type = ITEM_USE_BAG_MENU,
.fieldUseFunc = ItemUseOutOfBattle_CannotUse, // Todo
.type = ITEM_USE_FIELD,
.fieldUseFunc = ItemUseOutOfBattle_PokemonBoxLink,
},
[ITEM_COIN_CASE] =

View file

@ -58,6 +58,7 @@ static u8 GetDirectionToHiddenItem(s16, s16);
static void PlayerFaceHiddenItem(u8);
static void CheckForHiddenItemsInMapConnection(u8);
static void Task_OpenRegisteredPokeblockCase(u8);
static void Task_AccessPokemonBoxLink(u8);
static void ItemUseOnFieldCB_Bike(u8);
static void ItemUseOnFieldCB_Rod(u8);
static void ItemUseOnFieldCB_Itemfinder(u8);
@ -680,6 +681,18 @@ static void Task_OpenRegisteredPokeblockCase(u8 taskId)
}
}
void ItemUseOutOfBattle_PokemonBoxLink(u8 taskId)
{
sItemUseOnFieldCB = Task_AccessPokemonBoxLink;
SetUpItemUseOnFieldCallback(taskId);
}
static void Task_AccessPokemonBoxLink(u8 taskId)
{
ScriptContext_SetupScript(EventScript_AccessPokemonBoxLink);
DestroyTask(taskId);
}
void ItemUseOutOfBattle_CoinCase(u8 taskId)
{
ConvertIntToDecimalStringN(gStringVar1, GetCoins(), STR_CONV_MODE_LEFT_ALIGN, 4);