Document item_use.c

This commit is contained in:
GriffinR 2019-12-21 19:01:38 -05:00
parent 026e1108b2
commit 749965d56b
26 changed files with 359 additions and 322 deletions

View file

@ -41,10 +41,10 @@ void sub_81C5924(void);
void sub_81C59BC(void);
void sub_81C4EFC(void);
void GoToBattlePyramidBagMenu(u8 a0, void (*callback)(void));
void sub_81C6714(u8 taskId);
void Task_CloseBattlePyramidBagMessage(u8 taskId);
void TryStoreHeldItemsInPyramidBag(void);
void ChooseItemsToTossFromPyramidBag(void);
void sub_81C5B14(u8 taskId);
void CloseBattlePyramidBagAndSetCallback(u8 taskId);
void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback)(u8 taskId));
#endif // GUARD_BATTLE_PYRAMID_BAG_H

View file

@ -3,7 +3,7 @@
// field 0 masks
#define ITEM0_X_ATTACK 0x0F
#define ITEM0_HIGH_CRIT 0x30 // For Dire Hit, works the same way as move Focus Energy.
#define ITEM0_DIRE_HIT 0x30 // Works the same way as the move Focus Energy.
#define ITEM0_SACRED_ASH 0x40
#define ITEM0_INFATUATION 0x80
@ -23,7 +23,7 @@
#define ITEM3_POISON 0x10
#define ITEM3_SLEEP 0x20
#define ITEM3_LEVEL_UP 0x40
#define ITEM3_MIST 0x80 // For Guard Specs, works the same way as move Mist.
#define ITEM3_GUARD_SPEC 0x80 // Works the same way as the move Mist.
#define ITEM3_STATUS_ALL (ITEM3_CONFUSION | ITEM3_PARALYSIS | ITEM3_FREEZE | ITEM3_BURN | ITEM3_POISON | ITEM3_SLEEP)

View file

@ -582,4 +582,9 @@ extern const u8 SecretBase_EventScript_ShrubUseSecretPower[];
// trainer hill
extern const u8 TrainerHill_EventScript_TrainerBattle[];
// Item Use
extern u8 BerryTree_EventScript_ItemUsePlantBerry[];
extern u8 BerryTree_EventScript_ItemUseWailmerPail[];
extern u8 BattleFrontier_OutsideEast_EventScript_WaterSudowoodo[];
#endif // GUARD_EVENT_SCRIPTS_H

View file

@ -63,5 +63,6 @@ bool32 sub_808D1B4(void);
bool32 sub_808D1E8(void);
void SetPlayerInvisibility(bool8 invisible);
u8 player_get_pos_including_state_based_drift(s16 *x, s16 *y);
void StartFishing(u8 taskId);
#endif // GUARD_FIELD_PLAYER_AVATAR_H

View file

@ -42,7 +42,7 @@ void copy_map_tileset2_to_vram_2(struct MapLayout const *mapLayout);
void copy_map_tileset1_to_vram(const struct MapLayout *);
void copy_map_tileset2_to_vram(const struct MapLayout *);
struct MapHeader const *const mapconnection_get_mapheader(struct MapConnection *connection);
struct MapConnection *sub_8088A8C(s16 x, s16 y);
struct MapConnection *GetConnectionAtCoords(s16 x, s16 y);
void SpriteCB_PokeballGlow(struct Sprite *);
void SpriteCB_PokecenterMonitor(struct Sprite *);

View file

@ -143,6 +143,16 @@ struct MapHeader
/* 0x1B */ u8 battleType;
};
// Flags for gMapHeader.flags, as defined in the map_header_flags macro
#define MAP_ALLOW_BIKE (1 << 0)
#define MAP_ALLOW_ESCAPE_ROPE (1 << 1)
#define MAP_ALLOW_RUN (1 << 2)
#define MAP_SHOW_MAP_NAME (1 << 3)
#define UNUSED_MAP_FLAGS (1 << 4 | 1 << 5 | 1 << 6 | 1 << 7)
#define SHOW_MAP_NAME_ENABLED ((gMapHeader.flags & (MAP_SHOW_MAP_NAME | UNUSED_MAP_FLAGS)) == MAP_SHOW_MAP_NAME)
struct EventObject
{
/*0x00*/ u32 active:1;

View file

@ -74,7 +74,7 @@ void QuizLadyOpenBagMenu(void);
void ApprenticeOpenBagMenu(void);
void sub_81AABB0(void);
void SetInitialScrollAndCursorPositions(u8 pocketId);
void bag_menu_mail_related(void);
void CB2_ReturnToBagMenuPocket(void);
void CB2_BagMenuFromStartMenu(void);
u8 GetItemListPosition(u8 pocketId);
bool8 UseRegisteredKeyItemOnField(void);
@ -84,9 +84,13 @@ void DoWallyTutorialBagMenu(void);
void ResetBagScrollPositions(void);
void ChooseBerrySetCallback(void (*callback)(void));
void CB2_ChooseBerry(void);
void unknown_ItemMenu_Confirm(u8 taskId);
void Task_FadeAndCloseBagMenu(u8 taskId);
void BagMenu_YesNo(u8, u8, const struct YesNoFuncTable*);
void sub_81AB9A8(u8 pocketId);
void BagMenu_InitListsMenu(u8 taskId);
void UpdatePocketItemList(u8 pocketId);
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId));
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
#endif //GUARD_item_menu_H

View file

@ -3,27 +3,13 @@
void ItemUseOutOfBattle_Mail(u8);
void ItemUseOutOfBattle_Bike(u8);
void ItemUseOnFieldCB_Bike(u8);
void ItemUseOutOfBattle_Rod(u8);
void ItemUseOnFieldCB_Rod(u8);
void ItemUseOutOfBattle_Itemfinder(u8);
void ItemUseOnFieldCB_Itemfinder(u8);
void RunItemfinderResults(u8);
void ExitItemfinder(u8);
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
void sub_80C9720(u8);
void sub_80C9838(u8, s16, s16);
u8 GetPlayerDirectionTowardsHiddenItem(s16, s16);
void SetPlayerDirectionTowardsItem(u8);
void DisplayItemRespondingMessageAndExitItemfinder(u8);
void RotatePlayerAndExitItemfinder(u8);
void ItemUseOutOfBattle_PokeblockCase(u8);
void ItemUseOutOfBattle_CoinCase(u8);
void ItemUseOutOfBattle_PowderJar(u8);
void ItemUseOutOfBattle_SSTicket(u8);
void sub_80C9D00(u8);
void ItemUseOutOfBattle_WailmerPail(u8);
void sub_80C9D74(u8);
void ItemUseOutOfBattle_Medicine(u8);
void ItemUseOutOfBattle_ReduceEV(u8);
void ItemUseOutOfBattle_SacredAsh(u8);
@ -31,25 +17,21 @@ void ItemUseOutOfBattle_PPRecovery(u8);
void ItemUseOutOfBattle_PPUp(u8);
void ItemUseOutOfBattle_RareCandy(u8);
void ItemUseOutOfBattle_TMHM(u8);
void sub_80C9EE4(u8);
void sub_80C9F10(u8);
void sub_80C9F80(u8);
void sub_80C9FC0(u8);
void ItemUseOutOfBattle_Repel(u8);
void ItemUseOutOfBattle_BlackWhiteFlute(u8);
void task08_080A1C44(u8);
u8 CanUseEscapeRopeOnCurrMap(void);
void ItemUseOutOfBattle_EscapeRope(u8);
void ItemUseOutOfBattle_BlackWhiteFlute(u8);
void ItemUseOutOfBattle_EvolutionStone(u8);
void ItemUseOutOfBattle_Berry(u8);
void ItemUseOutOfBattle_EnigmaBerry(u8);
void ItemUseOutOfBattle_CannotUse(u8);
void ItemUseInBattle_PokeBall(u8);
void ItemUseInBattle_StatIncrease(u8);
void ItemUseInBattle_Medicine(u8);
void ItemUseInBattle_PPRecovery(u8);
void ItemUseInBattle_Escape(u8);
void ItemUseOutOfBattle_EnigmaBerry(u8);
void ItemUseInBattle_EnigmaBerry(u8);
void ItemUseOutOfBattle_CannotUse(u8);
void Task_UseDigEscapeRopeOnField(u8 taskId);
u8 CanUseEscapeRopeOnCurrMap(void);
u8 CheckIfItemIsTMHMOrEvolutionStone(u16 itemId);
void ItemUseOutOfBattle_Berry(u8);
#endif // GUARD_ITEM_USE_H

View file

@ -28,7 +28,6 @@ void DrawDialogueFrame(u8 windowId, bool8 copyToVram);
void ClearStdWindowAndFrame(u8 windowId, bool8 copyToVram);
u16 AddTextPrinterParameterized2(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextPrinterTemplate *, u16), u8 fgColor, u8 bgColor, u8 shadowColor);
void PrintPlayerNameOnWindow(u8, const u8*, u16, u16);
void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback);
void ClearDialogWindowAndFrame(u8 windowId, bool8 copyToVram);
void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram);
void DisplayYesNoMenuDefaultYes(void);

View file

@ -342,7 +342,7 @@ bool8 ExecuteTableBasedItemEffect(struct Pokemon *mon, u16 item, u8 partyIndex,
bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 moveIndex, u8 e);
bool8 HealStatusConditions(struct Pokemon *mon, u32 battlePartyId, u32 healMask, u8 battlerId);
u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit);
u8 *sub_806CF78(u16 itemId);
u8 *UseStatIncreaseItem(u16 itemId);
u8 GetNature(struct Pokemon *mon);
u8 GetNatureFromPersonality(u32 personality);
u16 GetEvolutionTargetSpecies(struct Pokemon *mon, u8 type, u16 evolutionItem);

View file

@ -787,9 +787,9 @@ static u8 GetAI_ItemType(u8 itemId, const u8 *itemEffect) // NOTE: should take u
return AI_ITEM_HEAL_HP;
else if (itemEffect[3] & ITEM3_STATUS_ALL)
return AI_ITEM_CURE_CONDITION;
else if (itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
else if (itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK) || itemEffect[1] != 0 || itemEffect[2] != 0)
return AI_ITEM_X_STAT;
else if (itemEffect[3] & ITEM3_MIST)
else if (itemEffect[3] & ITEM3_GUARD_SPEC)
return AI_ITEM_GUARD_SPECS;
else
return AI_ITEM_NOT_RECOGNIZABLE;
@ -907,7 +907,7 @@ static bool8 ShouldUseItem(void)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x8;
if (itemEffects[2] & ITEM2_X_ACCURACY)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x20;
if (itemEffects[0] & ITEM0_HIGH_CRIT)
if (itemEffects[0] & ITEM0_DIRE_HIT)
*(gBattleStruct->AI_itemFlags + gActiveBattler / 2) |= 0x80;
shouldUse = TRUE;
break;

View file

@ -67,7 +67,7 @@ static void sub_81C700C(void);
static void sub_81C6E98(void);
static void sub_81C6F20(void);
static void sub_81C6404(void);
static void sub_81C6E1C(void);
static void CloseBattlePyramidBagTextWindow(void);
static bool8 sub_81C5238(void);
static bool8 sub_81C5078(void);
static void ShowItemImage(u16 itemId, u8 itemSpriteArrayId);
@ -809,7 +809,7 @@ static void sub_81C5AB8(u8 y, u8 arg1)
PrintOnWindow_Font1(0, gText_SelectorArrow2, 0, y, 0, 0, 0, arg1);
}
void sub_81C5B14(u8 taskId)
void CloseBattlePyramidBagAndSetCallback(u8 taskId)
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 0x10, RGB_BLACK);
gTasks[taskId].func = sub_81C5B4C;
@ -862,7 +862,7 @@ static void Task_HandlePyramidBagInput(u8 taskId)
case LIST_CANCEL:
PlaySE(SE_SELECT);
gSpecialVar_ItemId = 0;
sub_81C5B14(taskId);
CloseBattlePyramidBagAndSetCallback(taskId);
break;
default:
PlaySE(SE_SELECT);
@ -1043,7 +1043,7 @@ static void BagAction_UseOnField(u8 taskId)
|| ItemIsMail(gSpecialVar_ItemId) == TRUE)
{
sub_81C61A8();
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, sub_81C6714);
DisplayItemMessageInBattlePyramid(taskId, gText_DadsAdvice, Task_CloseBattlePyramidBagMessage);
}
else if (ItemId_GetFieldFunc(gSpecialVar_ItemId) != NULL)
{
@ -1203,7 +1203,7 @@ static void BagAction_Give(u8 taskId)
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
{
gPyramidBagResources->callback2 = CB2_ChooseMonToGiveItem;
sub_81C5B14(taskId);
CloseBattlePyramidBagAndSetCallback(taskId);
}
else
{
@ -1223,15 +1223,15 @@ static void sub_81C66EC(u8 taskId)
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
sub_81C6714(taskId);
Task_CloseBattlePyramidBagMessage(taskId);
}
}
void sub_81C6714(u8 taskId)
void Task_CloseBattlePyramidBagMessage(u8 taskId)
{
s16 *data = gTasks[taskId].data;
sub_81C6E1C();
CloseBattlePyramidBagTextWindow();
PrintItemDescription(data[1]);
sub_81C5A98(data[0], 0);
SetTaskToMainPyramidBagInputHandler(taskId);
@ -1242,7 +1242,7 @@ static void sub_81C674C(u8 taskId)
if (!itemid_80BF6D8_mail_related(gSpecialVar_ItemId))
DisplayItemMessageInBattlePyramid(taskId, gText_CantWriteMail, sub_81C66EC);
else if (!ItemId_GetImportance(gSpecialVar_ItemId))
sub_81C5B14(taskId);
CloseBattlePyramidBagAndSetCallback(taskId);
else
sub_81C66AC(taskId);
}
@ -1462,7 +1462,7 @@ void DisplayItemMessageInBattlePyramid(u8 taskId, const u8 *str, void (*callback
schedule_bg_copy_tilemap_to_vram(1);
}
static void sub_81C6E1C(void)
static void CloseBattlePyramidBagTextWindow(void)
{
ClearDialogWindowAndFrameToTransparent(2, FALSE);
// This ClearWindowTilemap call is redundant, since ClearDialogWindowAndFrameToTransparent already calls it.

View file

@ -527,7 +527,7 @@ static void Task_CloseBerryTagScreen(u8 taskId)
DestroyFlavorCircleSprites();
Free(sBerryTag);
FreeAllWindowBuffers();
SetMainCallback2(bag_menu_mail_related);
SetMainCallback2(CB2_ReturnToBagMenuPocket);
DestroyTask(taskId);
}
}

View file

@ -1056,7 +1056,7 @@ void Bike_HandleBumpySlopeJump(void)
bool32 IsRunningDisallowed(u8 metatile)
{
if (!(gMapHeader.flags & 4) || IsRunningDisallowedByMetatile(metatile) == TRUE)
if (!(gMapHeader.flags & MAP_ALLOW_RUN) || IsRunningDisallowedByMetatile(metatile) == TRUE)
return TRUE;
else
return FALSE;

View file

@ -236,7 +236,7 @@ const u8 gItemEffect_PPMax[9] = {
};
const u8 gItemEffect_GuardSpec[8] = {
[3] = ITEM3_MIST,
[3] = ITEM3_GUARD_SPEC,
[5] = ITEM5_FRIENDSHIP_LOW | ITEM5_FRIENDSHIP_MID,
[6] = 1,
[7] = 1,

View file

@ -14,6 +14,7 @@
#include "graphics.h"
#include "international_string_util.h"
#include "item_icon.h"
#include "item_menu.h"
#include "list_menu.h"
#include "main.h"
#include "menu.h"

View file

@ -859,7 +859,7 @@ int sub_8088A4C(struct MapConnection *connection, int x, int y)
return FALSE;
}
struct MapConnection *sub_8088A8C(s16 x, s16 y)
struct MapConnection *GetConnectionAtCoords(s16 x, s16 y)
{
int count;
struct MapConnection *connection;

View file

@ -57,7 +57,7 @@ static void sub_8135780(void)
}
else
{
taskId = CreateTask(task08_080A1C44, 8);
taskId = CreateTask(Task_UseDigEscapeRopeOnField, 8);
gTasks[taskId].data[0] = 0;
}
}

View file

@ -136,7 +136,7 @@ void ItemMenu_Give(u8 taskId);
void ItemMenu_Cancel(u8 taskId);
void ItemMenu_UseInBattle(u8 taskId);
void ItemMenu_CheckTag(u8 taskId);
void unknown_ItemMenu_Confirm(u8 taskId);
void Task_FadeAndCloseBagMenu(u8 taskId);
void unknown_ItemMenu_Show(u8 taskId);
void unknown_ItemMenu_Give2(u8 taskId);
void unknown_ItemMenu_Confirm2(u8 taskId);
@ -216,7 +216,7 @@ const struct MenuAction sItemMenuActions[] = {
{gMenuText_Walk, ItemMenu_UseOutOfBattle},
{gMenuText_Deselect, ItemMenu_Register},
{gMenuText_CheckTag, ItemMenu_CheckTag},
{gMenuText_Confirm, unknown_ItemMenu_Confirm},
{gMenuText_Confirm, Task_FadeAndCloseBagMenu},
{gMenuText_Show, unknown_ItemMenu_Show},
{gMenuText_Give2, unknown_ItemMenu_Give2},
{gMenuText_Confirm, unknown_ItemMenu_Confirm2},
@ -241,7 +241,7 @@ const TaskFunc gUnknown_08614054[] = {
unknown_item_menu_type,
item_menu_type_2,
DisplaySellItemAskString,
unknown_ItemMenu_Confirm,
Task_FadeAndCloseBagMenu,
unknown_item_menu_type,
DisplayDepositItemAskString,
unknown_item_menu_type,
@ -942,7 +942,7 @@ void FreeBagItemListBuffers(void)
Free(gBagMenu);
}
void unknown_ItemMenu_Confirm(u8 taskId)
void Task_FadeAndCloseBagMenu(u8 taskId)
{
BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = TaskCloseBagMenu_2;
@ -966,7 +966,7 @@ void TaskCloseBagMenu_2(u8 taskId)
}
}
void sub_81AB9A8(u8 pocketId)
void UpdatePocketItemList(u8 pocketId)
{
u16 i;
struct BagPocket *pocket = &gBagPockets[pocketId];
@ -997,7 +997,7 @@ void sub_81ABA6C(void)
{
u8 i;
for (i = 0; i < POCKETS_COUNT; i++)
sub_81AB9A8(i);
UpdatePocketItemList(i);
}
void SetInitialScrollAndCursorPositions(u8 pocketId)
@ -1041,7 +1041,7 @@ void BagMenu_InitListsMenu(u8 taskId)
u16* cursorPos = &gBagPositionStruct.cursorPosition[gBagPositionStruct.pocket];
bag_menu_RemoveBagItem_message_window(4);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gBagPositionStruct.pocket);
UpdatePocketItemList(gBagPositionStruct.pocket);
SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket);
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
@ -1117,7 +1117,7 @@ void Task_BagMenu(u8 taskId)
}
PlaySE(SE_SELECT);
gSpecialVar_ItemId = select;
gTasks[taskId].func = unknown_ItemMenu_Confirm;
gTasks[taskId].func = Task_FadeAndCloseBagMenu;
break;
default: // A_BUTTON
PlaySE(SE_SELECT);
@ -1744,7 +1744,7 @@ void Task_ActuallyToss(u8 taskId)
PlaySE(SE_SELECT);
RemoveBagItem(gSpecialVar_ItemId, data[8]);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gBagPositionStruct.pocket);
UpdatePocketItemList(gBagPositionStruct.pocket);
SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket);
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
@ -1784,7 +1784,7 @@ void ItemMenu_Give(u8 taskId)
else
{
gBagMenu->mainCallback2 = CB2_ChooseMonToGiveItem;
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
}
else
@ -1817,7 +1817,7 @@ void sub_81AD350(u8 taskId)
void ItemMenu_CheckTag(u8 taskId)
{
gBagMenu->mainCallback2 = DoBerryTagScreen;
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
void ItemMenu_Cancel(u8 taskId)
@ -1841,7 +1841,7 @@ void ItemMenu_UseInBattle(u8 taskId)
}
}
void bag_menu_mail_related(void)
void CB2_ReturnToBagMenuPocket(void)
{
GoToBagMenu(RETURN_LOCATION_UNCHANGED, POCKETS_COUNT, NULL);
}
@ -1860,7 +1860,7 @@ void item_menu_type_2(u8 taskId)
}
else if (gBagPositionStruct.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId))
{
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
else
{
@ -1873,11 +1873,13 @@ void item_menu_type_b(u8 taskId)
if (ItemIsMail(gSpecialVar_ItemId) == TRUE)
DisplayItemMessage(taskId, 1, gText_CantWriteMail, sub_81AD350);
else if (gBagPositionStruct.pocket != KEYITEMS_POCKET && !ItemId_GetImportance(gSpecialVar_ItemId))
gTasks[taskId].func = unknown_ItemMenu_Confirm;
gTasks[taskId].func = Task_FadeAndCloseBagMenu;
else
BagMenu_PrintItemCantBeHeld(taskId);
}
#define tUsingRegisteredKeyItem data[3]
bool8 UseRegisteredKeyItemOnField(void)
{
u8 taskId;
@ -1896,16 +1898,20 @@ bool8 UseRegisteredKeyItemOnField(void)
sub_808BCF4();
gSpecialVar_ItemId = gSaveBlock1Ptr->registeredItem;
taskId = CreateTask(ItemId_GetFieldFunc(gSaveBlock1Ptr->registeredItem), 8);
gTasks[taskId].data[3] = 1;
gTasks[taskId].tUsingRegisteredKeyItem = TRUE;
return TRUE;
}
else
{
gSaveBlock1Ptr->registeredItem = ITEM_NONE;
}
}
ScriptContext1_SetupScript(EventScript_SelectWithoutRegisteredItem);
return TRUE;
}
#undef tUsingRegisteredKeyItem
void DisplaySellItemAskString(u8 taskId)
{
s16* data = gTasks[taskId].data;
@ -2012,7 +2018,7 @@ void sub_81AD8C8(u8 taskId)
RemoveBagItem(gSpecialVar_ItemId, data[8]);
AddMoney(&gSaveBlock1Ptr->money, (ItemId_GetPrice(gSpecialVar_ItemId) / 2) * data[8]);
DestroyListMenuTask(data[0], scrollPos, cursorPos);
sub_81AB9A8(gBagPositionStruct.pocket);
UpdatePocketItemList(gBagPositionStruct.pocket);
SetInitialScrollAndCursorPositions(gBagPositionStruct.pocket);
LoadBagItemListBuffers(gBagPositionStruct.pocket);
data[0] = ListMenuInit(&gMultiuseListMenuTemplate, *scrollPos, *cursorPos);
@ -2186,7 +2192,7 @@ void Task_WallyTutorialBagMenu(u8 taskId)
BagMenu_RemoveSomeWindow();
DestroyListMenuTask(data[0], 0, 0);
RestoreBagAfterWallyTutorial();
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
break;
default:
data[8]++;
@ -2200,7 +2206,7 @@ void unknown_ItemMenu_Show(u8 taskId)
gSpecialVar_0x8005 = gSpecialVar_ItemId;
gSpecialVar_Result = 1;
BagMenu_RemoveSomeWindow();
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
void CB2_ApprenticeExitBagMenu(void)
@ -2214,7 +2220,7 @@ void unknown_ItemMenu_Give2(u8 taskId)
RemoveBagItem(gSpecialVar_ItemId, 1);
gSpecialVar_Result = 1;
BagMenu_RemoveSomeWindow();
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
void CB2_FavorLadyExitBagMenu(void)
@ -2227,7 +2233,7 @@ void unknown_ItemMenu_Confirm2(u8 taskId)
{
gSpecialVar_Result = 1;
BagMenu_RemoveSomeWindow();
unknown_ItemMenu_Confirm(taskId);
Task_FadeAndCloseBagMenu(taskId);
}
void CB2_QuizLadyExitBagMenu(void)

File diff suppressed because it is too large Load diff

View file

@ -978,7 +978,7 @@ static u16 GetCenterScreenMetatileBehavior(void)
bool32 Overworld_IsBikingAllowed(void)
{
if (!(gMapHeader.flags & 1))
if (!(gMapHeader.flags & MAP_ALLOW_BIKE))
return FALSE;
else
return TRUE;
@ -1702,7 +1702,7 @@ void sub_80861E8(void)
static void sub_8086204(void)
{
if ((gMapHeader.flags & 0xF8) == 8 && SecretBaseMapPopupEnabled() == TRUE)
if (SHOW_MAP_NAME_ENABLED && SecretBaseMapPopupEnabled() == TRUE)
ShowMapNamePopup();
FieldCB_WarpExitFadeFromBlack();
}
@ -1948,7 +1948,7 @@ static bool32 load_map_stuff(u8 *state, u32 a2)
(*state)++;
break;
case 11:
if ((gMapHeader.flags & 0xF8) == 8 && SecretBaseMapPopupEnabled() == TRUE)
if (SHOW_MAP_NAME_ENABLED && SecretBaseMapPopupEnabled() == TRUE)
ShowMapNamePopup();
(*state)++;
break;

View file

@ -5186,7 +5186,7 @@ u8 GetItemEffectType(u16 item)
else
itemEffect = gItemEffectTable[item - ITEM_POTION];
if ((itemEffect[0] & (ITEM0_HIGH_CRIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_MIST))
if ((itemEffect[0] & (ITEM0_DIRE_HIT | ITEM0_X_ATTACK)) || itemEffect[1] || itemEffect[2] || (itemEffect[3] & ITEM3_GUARD_SPEC))
return ITEM_EFFECT_X_ITEM;
else if (itemEffect[0] & ITEM0_SACRED_ASH)
return ITEM_EFFECT_SACRED_ASH;

View file

@ -451,7 +451,7 @@ void OpenPokeblockCase(u8 caseId, void (*callback)(void))
sPokeblockMenu->pokeblockOptionsIds = sActionsWhenGivingToLady;
sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsWhenGivingToLady);
break;
default:
default: // PBLOCK_CASE_FIELD
sPokeblockMenu->pokeblockOptionsIds = sActionsOnField;
sPokeblockMenu->optionsNo = ARRAY_COUNT(sActionsOnField);
break;

View file

@ -2043,7 +2043,8 @@ static const u8 sGetMonDataEVConstants[] =
MON_DATA_SPATK_EV
};
static const u8 gUnknown_08329EC8[] =
// For stat-raising items
static const u8 sStatsToRaise[] =
{
STAT_ATK, STAT_ATK, STAT_SPEED, STAT_DEF, STAT_SPATK, STAT_ACC
};
@ -4691,7 +4692,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
gBattleMons[battlerId].status2 &= ~STATUS2_INFATUATION;
retVal = FALSE;
}
if ((itemEffect[cmdIndex] & ITEM0_HIGH_CRIT)
if ((itemEffect[cmdIndex] & ITEM0_DIRE_HIT)
&& !(gBattleMons[gActiveBattler].status2 & STATUS2_FOCUS_ENERGY))
{
gBattleMons[gActiveBattler].status2 |= STATUS2_FOCUS_ENERGY;
@ -4745,7 +4746,7 @@ bool8 PokemonUseItemEffects(struct Pokemon *mon, u16 item, u8 partyIndex, u8 mov
}
break;
case 3:
if ((itemEffect[cmdIndex] & ITEM3_MIST)
if ((itemEffect[cmdIndex] & ITEM3_GUARD_SPEC)
&& gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer == 0)
{
gSideTimers[GetBattlerSide(gActiveBattler)].mistTimer = 5;
@ -5285,15 +5286,15 @@ u8 GetItemEffectParamOffset(u16 itemId, u8 effectByte, u8 effectBit)
return offset;
}
static void sub_806CF24(s32 arg0)
static void BufferStatRoseMessage(s32 arg0)
{
gBattlerTarget = gBattlerInMenuId;
StringCopy(gBattleTextBuff1, gStatNamesTable[gUnknown_08329EC8[arg0]]);
StringCopy(gBattleTextBuff1, gStatNamesTable[sStatsToRaise[arg0]]);
StringCopy(gBattleTextBuff2, gText_StatRose);
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnsStatChanged2);
}
u8 *sub_806CF78(u16 itemId)
u8 *UseStatIncreaseItem(u16 itemId)
{
int i;
const u8 *itemEffect;
@ -5314,13 +5315,14 @@ u8 *sub_806CF78(u16 itemId)
for (i = 0; i < 3; i++)
{
if (itemEffect[i] & 0xF)
sub_806CF24(i * 2);
if (itemEffect[i] & 0xF0)
if (itemEffect[i] & (ITEM0_X_ATTACK | ITEM1_X_SPEED | ITEM2_X_SPATK))
BufferStatRoseMessage(i * 2);
if (itemEffect[i] & (ITEM0_DIRE_HIT | ITEM1_X_DEFEND | ITEM2_X_ACCURACY))
{
if (i)
if (i != 0) // Dire Hit is the only ITEM0 above
{
sub_806CF24(i * 2 + 1);
BufferStatRoseMessage(i * 2 + 1);
}
else
{
@ -5330,7 +5332,7 @@ u8 *sub_806CF78(u16 itemId)
}
}
if (itemEffect[3] & ITEM3_MIST)
if (itemEffect[3] & ITEM3_GUARD_SPEC)
{
gBattlerAttacker = gBattlerInMenuId;
BattleStringExpandPlaceholdersToDisplayedString(gText_PkmnShroudedInMist);

View file

@ -997,7 +997,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
break;
case MAP_TYPE_UNDERGROUND:
case MAP_TYPE_UNUSED_2:
if (gMapHeader.flags & 0x02)
if (gMapHeader.flags & MAP_ALLOW_ESCAPE_ROPE)
{
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->escapeWarp.mapGroup, gSaveBlock1Ptr->escapeWarp.mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId;

View file

@ -16,6 +16,7 @@
#include "fldeff.h"
#include "fldeff_misc.h"
#include "international_string_util.h"
#include "item_menu.h"
#include "link.h"
#include "list_menu.h"
#include "main.h"