mirror of
https://github.com/pret/pokefirered.git
synced 2026-05-14 08:11:03 -05:00
item_menu refactoring
This commit is contained in:
parent
cbc887c4d9
commit
ed7136cfc5
|
|
@ -9,6 +9,7 @@
|
|||
#define POCKET_TM_HM 4
|
||||
#define POCKET_BERRIES 5
|
||||
#define NUM_BAG_POCKETS 5
|
||||
#define NUM_BAG_POCKETS_NO_CASES 3 // number of pockets without considering TM case or berry pouch
|
||||
|
||||
#define ITEMS_POCKET 0
|
||||
#define KEYITEMS_POCKET 1
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include "global.h"
|
||||
#include "task.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/item.h"
|
||||
|
||||
// Exported type declarations
|
||||
|
||||
|
|
@ -15,8 +15,8 @@ struct BagStruct
|
|||
u8 location;
|
||||
bool8 bagOpen;
|
||||
u16 pocket;
|
||||
u16 itemsAbove[3];
|
||||
u16 cursorPos[3];
|
||||
u16 itemsAbove[NUM_BAG_POCKETS_NO_CASES];
|
||||
u16 cursorPos[NUM_BAG_POCKETS_NO_CASES];
|
||||
};
|
||||
|
||||
extern struct BagStruct gBagMenuState;
|
||||
|
|
|
|||
|
|
@ -18,9 +18,10 @@
|
|||
#include "reshow_battle_screen.h"
|
||||
#include "teachy_tv.h"
|
||||
#include "constants/battle_string_ids.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/moves.h"
|
||||
#include "constants/pokemon.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
struct PokedudeTextScriptHeader
|
||||
{
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
#include "quest_log.h"
|
||||
#include "strings.h"
|
||||
#include "constants/hold_effects.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/item.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
|
||||
|
|
@ -345,7 +345,7 @@ void ClearBag(void)
|
|||
{
|
||||
u16 i;
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS; i++)
|
||||
{
|
||||
ClearItemSlots(gBagPockets[i].itemSlots, gBagPockets[i].capacity);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,9 +32,10 @@
|
|||
#include "strings.h"
|
||||
#include "teachy_tv.h"
|
||||
#include "tm_case.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/quest_log.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
#define FREE_IF_SET(ptr) ({ if (ptr) Free(ptr); })
|
||||
|
||||
|
|
@ -48,8 +49,8 @@ struct BagMenuAlloc
|
|||
u16 contextMenuSelectedItem;
|
||||
u8 pocketScrollArrowsTask;
|
||||
u8 pocketSwitchArrowsTask;
|
||||
u8 nItems[3];
|
||||
u8 maxShowed[3];
|
||||
u8 nItems[NUM_BAG_POCKETS_NO_CASES];
|
||||
u8 maxShowed[NUM_BAG_POCKETS_NO_CASES];
|
||||
u8 data[4];
|
||||
};
|
||||
|
||||
|
|
@ -58,8 +59,8 @@ struct BagSlots
|
|||
struct ItemSlot bagPocket_Items[BAG_ITEMS_COUNT];
|
||||
struct ItemSlot bagPocket_KeyItems[BAG_KEYITEMS_COUNT];
|
||||
struct ItemSlot bagPocket_PokeBalls[BAG_POKEBALLS_COUNT];
|
||||
u16 itemsAbove[3];
|
||||
u16 cursorPos[3];
|
||||
u16 itemsAbove[NUM_BAG_POCKETS_NO_CASES];
|
||||
u16 cursorPos[NUM_BAG_POCKETS_NO_CASES];
|
||||
u16 registeredItem;
|
||||
u16 pocket;
|
||||
};
|
||||
|
|
@ -833,7 +834,7 @@ void ResetBagCursorPositions(void)
|
|||
u8 i;
|
||||
gBagMenuState.pocket = POCKET_ITEMS - 1;
|
||||
gBagMenuState.bagOpen = FALSE;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
{
|
||||
gBagMenuState.itemsAbove[i] = 0;
|
||||
gBagMenuState.cursorPos[i] = 0;
|
||||
|
|
@ -858,7 +859,7 @@ void PocketCalculateInitialCursorPosAndItemsAbove(u8 pocketId)
|
|||
static void CalculateInitialCursorPosAndItemsAbove(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
{
|
||||
PocketCalculateInitialCursorPosAndItemsAbove(i);
|
||||
}
|
||||
|
|
@ -869,7 +870,7 @@ static void UpdatePocketScrollPositions(void)
|
|||
u8 i;
|
||||
u8 j;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
{
|
||||
if (gBagMenuState.itemsAbove[i] > 3)
|
||||
{
|
||||
|
|
@ -1012,7 +1013,7 @@ void Pocket_CalculateNItemsAndMaxShowed(u8 pocketId)
|
|||
static void All_CalculateNItemsAndMaxShowed(void)
|
||||
{
|
||||
u8 i;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
Pocket_CalculateNItemsAndMaxShowed(i);
|
||||
}
|
||||
|
||||
|
|
@ -2067,7 +2068,7 @@ static void BackUpPlayerBag(void)
|
|||
memcpy(sBackupPlayerBag->bagPocket_PokeBalls, gSaveBlock1Ptr->bagPocket_PokeBalls, BAG_POKEBALLS_COUNT * sizeof(struct ItemSlot));
|
||||
sBackupPlayerBag->registeredItem = gSaveBlock1Ptr->registeredItem;
|
||||
sBackupPlayerBag->pocket = gBagMenuState.pocket;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
{
|
||||
sBackupPlayerBag->itemsAbove[i] = gBagMenuState.itemsAbove[i];
|
||||
sBackupPlayerBag->cursorPos[i] = gBagMenuState.cursorPos[i];
|
||||
|
|
@ -2087,7 +2088,7 @@ static void RestorePlayerBag(void)
|
|||
memcpy(gSaveBlock1Ptr->bagPocket_PokeBalls, sBackupPlayerBag->bagPocket_PokeBalls, BAG_POKEBALLS_COUNT * sizeof(struct ItemSlot));
|
||||
gSaveBlock1Ptr->registeredItem = sBackupPlayerBag->registeredItem;
|
||||
gBagMenuState.pocket = sBackupPlayerBag->pocket;
|
||||
for (i = 0; i < 3; i++)
|
||||
for (i = 0; i < NUM_BAG_POCKETS_NO_CASES; i++)
|
||||
{
|
||||
gBagMenuState.itemsAbove[i] = sBackupPlayerBag->itemsAbove[i];
|
||||
gBagMenuState.cursorPos[i] = sBackupPlayerBag->cursorPos[i];
|
||||
|
|
|
|||
|
|
@ -65,6 +65,7 @@
|
|||
#include "constants/easy_chat.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/item_effects.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/maps.h"
|
||||
#include "constants/moves.h"
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@
|
|||
#include "item_menu.h"
|
||||
#include "item_pc.h"
|
||||
#include "party_menu.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/field_weather.h"
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
#include "text_window.h"
|
||||
#include "tilemap_util.h"
|
||||
#include "trig.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/help_system.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
EWRAM_DATA struct PokemonStorageSystemData *gStorage = NULL;
|
||||
|
|
|
|||
|
|
@ -26,10 +26,11 @@
|
|||
#include "money.h"
|
||||
#include "quest_log.h"
|
||||
#include "script.h"
|
||||
#include "constants/songs.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/game_stat.h"
|
||||
#include "constants/field_weather.h"
|
||||
#include "constants/game_stat.h"
|
||||
#include "constants/item_menu.h"
|
||||
#include "constants/items.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
#define tItemCount data[1]
|
||||
#define tItemId data[5]
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@
|
|||
#include "graphics.h"
|
||||
#include "fieldmap.h"
|
||||
#include "strings.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/event_objects.h"
|
||||
#include "constants/field_effects.h"
|
||||
#include "constants/item_menu.h"
|
||||
|
||||
struct TeachyTvCtrlBlk
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user