Merge pull request #359 from DizzyEggg/code_8045A00

Code 8045a00 - dungeon_items
This commit is contained in:
AnonymousRandomPerson
2025-03-13 15:50:41 -04:00
committed by GitHub
52 changed files with 1435 additions and 2794 deletions

View File

@@ -20,8 +20,8 @@ typedef struct unkStruct_203B230
MenuInputStructSub unk88;
} unkStruct_203B230;
bool8 sub_801B3C0(Item *item);
bool8 InitItemDescriptionWindow(Item *item);
u32 sub_801B410(void);
void sub_801B450(void);
void FreeItemDescriptionWindow(void);
#endif // GUARD_CODE_801B3C0_H

View File

@@ -13,9 +13,11 @@ enum DungeonAction
ACTION_PLACE_ITEM = 0x8,
// Some actions are different between the leader and AI-controlled Pokémon.
ACTION_PICK_UP_PLAYER = 0x9, // Picking up an item underfoot.
ACTION_UNKA = 0xA,
ACTION_THROW_ITEM_PLAYER = 0xB,
ACTION_SHOW_INFO = 0xC,
ACTION_EAT_BERRY_SEED_DRINK = 0xD,
ACTION_UNK10 = 0x10,
ACTION_USE_TM = 0x12,
ACTION_TALK_FIELD = 0x13, // Talking to another Pokémon by facing them and interacting.
ACTION_USE_MOVE_PLAYER = 0x14,
@@ -43,12 +45,16 @@ enum DungeonAction
ACTION_USE_ORB = 0x31,
ACTION_REGULAR_ATTACK = 0x32,
ACTION_UNSET_MOVE = 0x33,
ACTION_UNK34 = 0x34,
ACTION_UNK35 = 0x35,
ACTION_GIVE_ITEM = 0x36,
ACTION_TAKE_ITEM = 0x37,
ACTION_USE_ITEM = 0x38,
ACTION_SECOND_THOUGHTS = 0x39, // Happens with invalid actions, like attempting to eat a non-consumable item.
ACTION_UNK3A = 0x3A,
ACTION_SET_ITEM = 0x3C,
ACTION_UNSET_ITEM = 0x3D,
ACTION_UNK3E = 0x3E,
ACTION_PICK_UP_AI = 0x3F,
ACTION_THROW_ARC_PLAYER = 0x41, // Throwing Gravelerocks and Geo Pebbles.
NUM_DUNGEON_ACTIONS

View File

@@ -2,9 +2,33 @@
#define GUARD_DUNGEON_ITEMS_H
#include "structs/dungeon_entity.h"
#include "structs/str_position.h"
#include "structs/str_items.h"
void sub_8045BF8(u8 *buffer, Item *item);
void sub_8045C08(u8 *buffer, Item *item);
void sub_8045C18(u8 *buffer, Item *item);
#define FORCE_STICKY_RANDOM 0
#define FORCE_STICKY_ALWAYS 1
#define FORCE_STICKY_NEVER 2
void CreateItemWithStickyChance(Item *item, u8 itemID, u32 forceSticky);
void CreateFloorItems(void);
void PickUpItemFromPos(struct DungeonPos *pos, bool8 printMsg);
bool8 AddItemToDungeonAt(DungeonPos *pos, Item *item, bool8 a2);
bool8 RemoveItemFromDungeonAt(DungeonPos *pos, bool8 a2);
bool8 sub_80462AC(Entity * entity, u8 hallucinating, u8 a2, u8 a3, u8 a4);
const u8 *sub_80464AC(Item *item);
void sub_80464C8(Entity *entity, DungeonPos *pos, Item *item);
void sub_804652C(Entity *entity1, Entity *entity2, Item *item, bool8 a3, DungeonPos *pos);
void sub_8046860(Entity *entity, DungeonPos *pos, Item *item, s32 a4);
void sub_804687C(Entity *entity, DungeonPos *pos1, DungeonPos *pos2, Item *item, s32 count);
bool8 HasHeldItem(Entity *pokemon, u8 id);
void sub_8046CE4(Item *item, s32 param_2);
void sub_8046D20(void);
bool8 sub_8046F00(Item *item);
void ClearAllItemsWithFlag(s32 itemFlag);
void AllItemsToPlainSeed(void);
bool8 PlayerHasItemWithFlag(s32 itemFlag);
void CleanUpInventoryItems(void);
void ClearUnpaidFlagFromAllItems(void);
#endif

View File

@@ -6,6 +6,6 @@
bool8 sub_805FD3C(struct UnkMenuBitsStruct *a0);
bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1);
void sub_8060D24(UNUSED ActionContainer *a0);
void DungeonShowItemDescription(UNUSED ActionContainer *a0);
#endif

View File

@@ -6,6 +6,7 @@
#include "structs/str_pokemon.h"
#include "structs/str_status_text.h"
extern ItemDataEntry *gItemParametersData;
extern TeamInventory *gTeamInventoryRef;
void LoadItemParameters(void);
@@ -13,7 +14,7 @@ TeamInventory *GetMoneyItemsInfo(void);
void InitializeMoneyItems(void);
s32 GetNumberOfFilledInventorySlots(void);
bool8 IsThrowableItem(u8 id);
void xxx_init_itemslot_8090A8C(Item *param_1,u8 id,u8 param_3);
void ItemIdToSlot(Item *param_1,u8 id,u8 param_3);
void xxx_init_helditem_8090B08(BulkItem *param_1,u8 id);
void HeldItemToSlot(Item *param_1, BulkItem *param_2);
void SlotToHeldItem(BulkItem *held, Item *slot);
@@ -25,7 +26,7 @@ s32 GetStackSellPrice(Item *param_1);
s32 GetItemBuyPrice(u8 id);
s32 GetItemSellPrice(u8 id);
s32 GetItemOrder(u8 id);
u8 GetItemPalette(u8 id);
s32 GetItemPalette(u8 id);
u32 GetItemActionType(u8 id);
u32 GetSpawnAmountRange(u8 id, u32 r1);
u8 *GetItemDescription(u8 id);

View File

@@ -113,7 +113,7 @@ static inline void SetTerrainWall(Tile *tile)
SetTerrainType(tile, TERRAIN_TYPE_WALL);
}
static inline u32 GetTerrainType(const Tile *tile)
static inline s32 GetTerrainType(const Tile *tile)
{
return tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY);
}

View File

@@ -127,7 +127,7 @@ typedef struct FloorProperties
u8 kecleonShopChance; // Percentage chance 0-100%
u8 monsterHouseChance; // Percentage chance 0-100%
u8 mazeRoomChance; // Percentage chance 0-100%
u8 unkA;
u8 itemStickyChance; // Percentage chance 0-100%
bool8 allowDeadEnds;
u8 secondaryStructuresBudget; // Maximum number of secondary structures that can be generated
u8 roomFlags; // See ROOM_FLAG_
@@ -146,11 +146,19 @@ typedef struct FloorProperties
u8 unk1A;
} FloorProperties;
typedef struct UnkDungeonGlobal_unk1C590
enum {
ITEM_SPAWN_NORMAL,
ITEM_SPAWN_IN_SHOP,
ITEM_SPAWN_IN_MONSTER_HOUSE,
ITEM_SPAWN_WALL,
ITEM_SPAWN_TYPES_COUNT
};
typedef struct ItemSpawns
{
s16 categoryValues[NUM_ITEM_CATEGORIES];
s16 itemValues[NUMBER_OF_ITEM_IDS];
} UnkDungeonGlobal_unk1C590;
} ItemSpawns;
typedef struct UnkDungeonGlobal_unk1CD98
{
@@ -252,7 +260,7 @@ typedef struct unkDungeon644
/* 0x14 */ bool8 canRecruit;
/* 0x15 */ u8 unk15;
/* 0x16 */ u8 unk16;
/* 0x17 */ u8 unk17;
/* 0x17 */ bool8 hasInventory;
/* 0x18 */ u8 unk18;
/* 0x19 */ u8 unk19;
/* 0x1A */ u8 fill1A[2];
@@ -480,8 +488,8 @@ typedef struct Dungeon
/* 0x1BDD4 */ struct UnkStructDungeon1BDD4 unk1BDD4;
/* 0x1BE14 */ struct MessageLogString messageLogStrings[MESSAGE_LOG_STRINGS_COUNT];
/* 0x1C570 */ DungeonLocation unk1C570;
/* 0x1C574 */ FloorProperties unk1C574;
/* 0x1C590 */ UnkDungeonGlobal_unk1C590 unk1C590[4];
/* 0x1C574 */ FloorProperties floorProperties;
/* 0x1C590 */ ItemSpawns itemSpawns[ITEM_SPAWN_TYPES_COUNT];
u16 unk1CD70[20];
UnkDungeonGlobal_unk1CD98 unk1CD98[32];
UnkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is

View File

@@ -0,0 +1,13 @@
#ifndef GUARD_STR_ITEM_TEXT_H
#define GUARD_STR_ITEM_TEXT_H
// size: 0x8
typedef struct ItemText
{
const u8 *desc;
const u8 *useText;
} ItemText;
extern const ItemText gActions[];
#endif