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
+2 -2
View File
@@ -19,7 +19,7 @@ static void sub_801B480(void);
static void sub_801B51C(void);
static void sub_801B590(void);
bool8 sub_801B3C0(Item *item)
bool8 InitItemDescriptionWindow(Item *item)
{
ResetSprites(TRUE);
sUnknown_203B230 = MemoryAlloc(sizeof(unkStruct_203B230),8);
@@ -52,7 +52,7 @@ u32 sub_801B410(void)
return 0;
}
void sub_801B450(void)
void FreeItemDescriptionWindow(void)
{
if (sUnknown_203B230 != NULL) {
MemoryFree(sUnknown_203B230);
+2 -2
View File
@@ -244,7 +244,7 @@ store:
sub_8012D60(&sUnknown_203B234->unk28, sUnknown_203B234->unkCC, 0, 0, sUnknown_203B234->menuAction, 2);
break;
case 11:
sub_801B3C0(&sUnknown_203B234->unk20);
InitItemDescriptionWindow(&sUnknown_203B234->unk20);
break;
case 12:
sub_801A9E0();
@@ -470,7 +470,7 @@ static void sub_801BEAC(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
sub_801B748(9);
case 0:
case 1:
+2 -2
View File
@@ -159,7 +159,7 @@ static void sub_8022A10(void)
sub_8012D60(&sUnknown_203B294->unkA4, sUnknown_80DC584, 0, 0, 3, 1);
break;
case 4:
sub_801B3C0(&sUnknown_203B294->item);
InitItemDescriptionWindow(&sUnknown_203B294->item);
break;
case 5:
CreateDialogueBoxAndPortrait(sDoesNotAppearHungry, 0, 0, 0x301);
@@ -446,7 +446,7 @@ static void sub_80230E8(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
sub_8022924(1);
case 1:
case 0:
+8 -8
View File
@@ -93,7 +93,7 @@ void sub_803D4D0(void)
gDungeon->unk1CEC8 = GetDungeonFloorCount(gDungeon->unk644.dungeonLocation.id);
gDungeon->unk14 = sub_80902C8(gDungeon->unk644.dungeonLocation.id);
gDungeon->unk1C574 = ((struct UnkDataFileStruct *)(file->data))->unk4[strPtr->unk0];
gDungeon->floorProperties = ((struct UnkDataFileStruct *)(file->data))->unk4[strPtr->unk0];
for (i = 0; i < 20; i++) {
gDungeon->unk1CD70[i] = ((struct UnkDataFileStruct *)(file->data))->unk10[strPtr->unk4][i];
@@ -127,12 +127,12 @@ void sub_803D4D0(void)
arrId = 0;
for (j = 0; j < NUM_ITEM_CATEGORIES; j++) {
gDungeon->unk1C590[i].categoryValues[arrId] = spArray[arrId];
gDungeon->itemSpawns[i].categoryValues[arrId] = spArray[arrId];
arrId++;
}
for (j = 0; j < NUMBER_OF_ITEM_IDS; j++) {
gDungeon->unk1C590[i].itemValues[j] = spArray[arrId];
gDungeon->itemSpawns[i].itemValues[j] = spArray[arrId];
arrId++;
}
}
@@ -152,28 +152,28 @@ u8 sub_803D6FC(void)
return 16;
}
u8 sub_803D73C(s32 a0)
u8 GetRandomFloorItem(s32 spawnType)
{
s32 i;
s32 rand = DungeonRandInt(10000);
u8 category = NUM_ITEM_CATEGORIES;
for (i = 0; i < NUM_ITEM_CATEGORIES; i++) {
if (gDungeon->unk1C590[a0].categoryValues[i] != 0 && gDungeon->unk1C590[a0].categoryValues[i] >= rand) {
if (gDungeon->itemSpawns[spawnType].categoryValues[i] != 0 && gDungeon->itemSpawns[spawnType].categoryValues[i] >= rand) {
category = i;
break;
}
}
if (category == NUM_ITEM_CATEGORIES)
return 105;
return ITEM_POKE;
rand = DungeonRandInt(10000);
for (i = 0; i < NUMBER_OF_ITEM_IDS; i++) {
if (gDungeon->unk1C590[a0].itemValues[i] != 0 && GetItemCategory(i) == category && gDungeon->unk1C590[a0].itemValues[i] >= rand) {
if (gDungeon->itemSpawns[spawnType].itemValues[i] != 0 && GetItemCategory(i) == category && gDungeon->itemSpawns[spawnType].itemValues[i] >= rand) {
return i;
}
}
return 105;
return ITEM_POKE;
}
s32 sub_803D808(UnkDungeonGlobal_unk1CD98 *strPtr, s32 id)
+1 -1
View File
@@ -694,7 +694,7 @@ void sub_803F27C(bool8 a0)
gUnknown_202EDFC = 0xFFFF;
if (!a0) {
strPtr->visibilityRange = gDungeon->unk1C574.unk16 & 3;
strPtr->visibilityRange = gDungeon->floorProperties.unk16 & 3;
if (strPtr->visibilityRange == 0) {
strPtr->unk1820C = 1;
}
+10 -15
View File
@@ -41,6 +41,7 @@
#include "dungeon_serializer.h"
#include "dungeon_config.h"
#include "dungeon_map.h"
#include "dungeon_items.h"
extern void sub_800EE5C(s32);
extern void sub_800EF64(void);
@@ -60,8 +61,6 @@ EWRAM_INIT DungeonPos gPlayerDotMapPosition = {100, 100};
static EWRAM_INIT struct UnkStruct_203B414 *sUnknown_203B414 = NULL;
EWRAM_INIT Dungeon *gDungeon = NULL;
EWRAM_INIT u8 *gSerializedData_203B41C = NULL;
EWRAM_INIT u8 gUnknown_203B420[8] = {0x15, 0x00, 0x16, 0x00, 0x15, 0x00, 0x16, 0x00}; // Could be a different file?
EWRAM_INIT u8 gUnknown_203B428[8] = {0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x02}; // Could be a different file?
struct UnkStruct_80F6624
{
@@ -263,10 +262,8 @@ extern void sub_803E250(void);
extern void sub_803E830(void);
extern void sub_803E214(void);
extern void nullsub_56(void);
extern void sub_8047104(void);
extern void sub_8068F28(void);
extern void sub_806C1D8(void);
extern void sub_804700C(void);
extern void IncrementThievingSuccesses(void);
extern void sub_803E13C(void);
extern void sub_80841EC(void);
@@ -313,7 +310,6 @@ extern void sub_806B168(void);
extern void sub_806B6C4(void);
extern void sub_806A338(void);
extern void sub_8051E3C(void);
extern void sub_8045CB0(void);
extern void sub_807FA18(void);
extern void sub_806A974(void);
extern void sub_806CF60(void);
@@ -327,7 +323,6 @@ extern void sub_803EAF0(u32, u32);
extern void sub_806A914(bool8 a0, bool8 a1, bool8 showRunAwayEffect);
extern void sub_803F4A0(Entity *a0);
extern void sub_8083AB0(s16 param_0, Entity * target, Entity * entity);
extern void sub_8046F84(s32 itemFlag);
extern bool8 sub_8083C50(void);
extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void ResetMonEntityData(EntityInfo *, u32);
@@ -405,7 +400,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
gDungeon->unk644.unk16 = r8->unkC;
gDungeon->unk644.canRecruit = r8->unkA;
gDungeon->unk644.unk15 = r8->unkB;
gDungeon->unk644.unk17 = r8->unkD;
gDungeon->unk644.hasInventory = r8->unkD;
gDungeon->unk644.unk19 = r8->unkE;
StopDungeonBGM();
sub_803D4AC();
@@ -562,9 +557,9 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
gDungeon->unk644.unk40 = 99;
gDungeon->unk644.unk42 = 99;
gDungeon->weather.weather = 0;
gDungeon->tileset = gDungeon->unk1C574.unk2;
gDungeon->unk3A10 = gDungeon->unk1C574.unk3;
gDungeon->fixedRoomNumber = gDungeon->unk1C574.unk12;
gDungeon->tileset = gDungeon->floorProperties.unk2;
gDungeon->unk3A10 = gDungeon->floorProperties.unk3;
gDungeon->fixedRoomNumber = gDungeon->floorProperties.unk12;
sub_807E5E4(0);
sub_80842F0();
}
@@ -618,7 +613,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
gDungeon->unk17B40 = 0;
if (!r6) {
sub_807FA18();
sub_8045CB0();
CreateFloorItems();
gDungeon->unk644.unk50 = gDungeon->unk644.unk48;
gDungeon->unk644.unk4C = 0;
sub_8051E3C();
@@ -793,13 +788,13 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
SaveDungeonState(gSerializedData_203B41C, 0x4800);
}
else {
sub_8046F84(ITEM_FLAG_IN_SHOP);
ClearAllItemsWithFlag(ITEM_FLAG_IN_SHOP);
}
sub_806C1D8();
if (gDungeon->unk644.unk10 == 1) {
if (gDungeon->unk644.unk2A != 0) {
sub_804700C();
AllItemsToPlainSeed();
}
check = TRUE;
}
@@ -915,7 +910,7 @@ void RunDungeon(UnkStruct_RunDungeon *r8)
nullsub_56();
CloseDungeonMapFile();
if (r8->unk7C == 1 || r8->unk7C == 4 || r8->unk7C == 2) {
sub_8047104();
CleanUpInventoryItems();
}
if (r8->unk7C == 1 || r8->unk7C == -2 || r8->unk7C == 4 || r8->unk7C == -1 || r8->unk7C == 2) {
if (r8->unk7C == 1 || r8->unk7C == 4 || r8->unk7C == 2) {
@@ -1023,7 +1018,7 @@ void sub_8043D60(void)
}
}
sub_8046F84(ITEM_FLAG_IN_SHOP);
ClearAllItemsWithFlag(ITEM_FLAG_IN_SHOP);
}
bool8 sub_8043ED0(bool8 a0)
+8 -17
View File
@@ -5,13 +5,7 @@
#include "dungeon_generation.h"
#include "code_8044CC8.h"
#include "items.h"
// size: 0x8
typedef struct ItemText
{
u8 *desc;
u8 *useText;
} ItemText;
#include "structs/str_item_text.h"
// size: 0x8
typedef struct unkStr_80F7C54
@@ -20,13 +14,10 @@ typedef struct unkStr_80F7C54
u8 *text;
} unkStr_80F7C54;
EWRAM_DATA unkStruct_202EE44 gDungeonSubMenu[10] = {0};
extern s32 gDungeonSubMenuItemsCount;
extern const ItemText gActions[];
extern u16 gUnknown_80F6964[NUM_ITEM_CATEGORIES];
extern u8 gUnknown_80F697C[];
extern u8 *gUnknown_80F7C50[10];
@@ -34,8 +25,8 @@ extern const unkStr_80F7C54 gUnknown_80F7C54[65];
extern u8 *gUnknown_80F91EC[];
extern bool8 sub_8045888(Entity *);
extern u8 GetFloorType(void);
void sub_80460F8(DungeonPos *, Item *, u32);
bool8 sub_80461C8(DungeonPos *, u32);
void AddItemToDungeonAt(DungeonPos *, Item *, u32);
bool8 RemoveItemFromDungeonAt(DungeonPos *, u32);
Item * sub_8044CC8(Entity *param_1, ActionParameter *param_2, UNUSED s32 a3)
{
@@ -83,7 +74,7 @@ bool8 sub_8044D40(ActionContainer *param_1,s32 index)
if (puVar1->actionUseIndex != 0x80) {
return FALSE;
}
sub_80461C8(&puVar1->itemPos,1);
RemoveItemFromDungeonAt(&puVar1->itemPos,1);
}
return TRUE;
}
@@ -118,7 +109,7 @@ void sub_8044DF0(Entity *entity, s32 index, u32 unused)
info = GetEntInfo(entity);
item = sub_8044D90(entity,index,unused);
if ((info->action).actionParameters[0].actionUseIndex == 0x80) {
sub_80461C8(&(info->action).actionParameters[0].itemPos,1);
RemoveItemFromDungeonAt(&(info->action).actionParameters[0].itemPos,1);
}
else {
item->id = ITEM_NOTHING;
@@ -143,10 +134,10 @@ void sub_8044E24(Entity *entity,int index,u32 unused)
if (info->action.actionParameters[index].actionUseIndex == 0x80) {
item = *itemPtr;
pos = &info->action.actionParameters[index].itemPos;
sub_80461C8(pos,1);
RemoveItemFromDungeonAt(pos,1);
item.quantity = itemPtr->id - 125;
item.id = ITEM_TM_USED_TM;
sub_80460F8(pos,&item,1);
AddItemToDungeonAt(pos,&item,1);
}
else {
itemPtr->quantity = itemPtr->id - 125;
@@ -160,7 +151,7 @@ void sub_8044E24(Entity *entity,int index,u32 unused)
}
// Similar to sub_8044BA8
u8 *GetDungeonSubMenuItemString(s32 param_1)
const u8 *GetDungeonSubMenuItemString(s32 param_1)
{
u16 actionId = gDungeonSubMenu[param_1].actionId;
+9 -114
View File
@@ -5,20 +5,21 @@
#include "dungeon_map_access.h"
#include "dungeon_random.h"
#include "dungeon_util.h"
#include "dungeon_leader.h"
#include "dungeon_message.h"
#include "dungeon_music.h"
#include "dungeon_map.h"
#include "dungeon_ai_targeting.h"
#include "string_format.h"
#include "items.h"
#include "trap.h"
#include "status_checks_1.h"
#include "structs/map.h"
#include "structs/str_dungeon.h"
#include "trap.h"
extern u8 *gUnknown_80FE6F4[];
extern struct unkStruct_8090F58 gUnknown_80F699C;
extern struct unkStruct_8090F58 gUnknown_80F69A8;
extern struct unkStruct_8090F58 gUnknown_80F6990;
void sub_8045BF8(u8 *, Item *);
extern u32 sub_803D73C(u32);
void sub_80460F8(DungeonPos *, Item *, u32);
extern u8 *gUnknown_80FE6F4[];
void sub_8045ACC(void)
{
@@ -82,109 +83,3 @@ void SubstitutePlaceholderStringTags(u8 *buffer, Entity *entity, u32 param_3)
break;
}
}
void sub_8045BF8(u8 *buffer, Item *item)
{
sub_8090E14(buffer, item, &gUnknown_80F699C);
}
void sub_8045C08(u8 *buffer, Item *item)
{
sub_8090E14(buffer, item, &gUnknown_80F69A8);
}
void sub_8045C18(u8 *buffer, Item *item)
{
sub_8090E14(buffer, item, &gUnknown_80F6990);
}
void sub_8045C28(Item *item, u8 itemID, u32 param_3)
{
bool8 stickyFlag;
xxx_init_itemslot_8090A8C(item,itemID,0);
stickyFlag = FALSE;
if (IsNotSpecialItem(itemID)) {
if (param_3 == 0) {
if (DungeonRandInt(100) < gDungeon->unk1C574.unkA)
stickyFlag = TRUE;
else
stickyFlag = FALSE;
}
else if (param_3 == 1) {
stickyFlag = TRUE;
}
}
if (stickyFlag) {
item->flags |= ITEM_FLAG_STICKY;
}
if (GetItemCategory(itemID) == CATEGORY_POKE) {
sub_8046CE4(item, gDungeon->unk1C574.unk17 * 40);
}
}
void sub_8045CB0(void)
{
bool8 shopFlag;
u8 itemID;
u32 x;
int y;
int yCounter;
const Tile *tile;
u32 uVar5;
int xCounter;
Item item;
DungeonPos pos;
u32 flag;
x = DungeonRandInt(DUNGEON_MAX_SIZE_X);
y = DungeonRandInt(DUNGEON_MAX_SIZE_Y);
gDungeon->numItems = 0;
for(yCounter = 0; yCounter < DUNGEON_MAX_SIZE_Y; yCounter++)
{
y++;
if (y == DUNGEON_MAX_SIZE_Y) {
y = 0;
}
for(xCounter = 0; xCounter < DUNGEON_MAX_SIZE_X; xCounter++)
{
x++;
flag = ITEM_FLAG_IN_SHOP;
if (x == DUNGEON_MAX_SIZE_X) {
x = 0;
}
tile = GetTile(x,y);
if (((tile->terrainType & TERRAIN_TYPE_STAIRS) == 0) && ((tile->spawnOrVisibilityFlags & 2) != 0)) {
shopFlag = FALSE;
pos.x = x;
pos.y = y;
if (tile->terrainType & TERRAIN_TYPE_SHOP) {
shopFlag = TRUE;
uVar5 = 1;
}
else
{
if ((tile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) == 0) {
uVar5 = 3;
}
else {
uVar5 = -(tile->terrainType & TERRAIN_TYPE_IN_MONSTER_HOUSE) >> 0x1f & 2;
}
}
itemID = sub_803D73C(uVar5);
if (!CanSellItem(itemID)) {
shopFlag = 0;
}
sub_8045C28(&item,itemID,0);
if (shopFlag) {
item.flags |= flag;
}
sub_80460F8(&pos,&item,1);
}
}
}
}
+9 -13
View File
@@ -92,19 +92,15 @@ extern Item *sub_8044D90(Entity *, s32, u32);
void sub_8045BF8(u8 *, Item *);
u8 sub_8048D50();
void SetActionUnusableInDungeonSubMenu(u16 param_1);
u8 * sub_80464AC();
void AddActionToDungeonSubMenu(u16 param_1, u8 param_2);
void sub_8044DF0();
void sub_8042208(Entity *pokemon, u8 r1);
void sub_803E708();
void sub_80479B8();
u8 sub_80460F8(DungeonPos *, Item *, u32);
extern void sub_807AB38(Entity *, u32);
extern Entity * sub_8044DA4(Entity *param_1,int param_2);
extern void sub_806A6E8(Entity *);
extern void sub_8044DF0(Entity *, u32, u32);
extern void sub_8045DB4(DungeonPos *, u32);
extern bool8 sub_80461C8(DungeonPos *, u32);
extern bool32 sub_8055A00(Entity *attacker, s32 firstMoveId, s32 var_34, s32 itemId, s32 arg_0);
extern bool8 sub_8044B28(void);
Entity *sub_806773C(Entity *entity);
@@ -119,7 +115,7 @@ extern Entity * sub_80696A8(Entity *target);
void HandlePickUpPlayerAction(Entity *entity)
{
GetEntInfo(entity)->action.actionParameters[0].actionUseIndex = 1;
sub_8045DB4(&entity->pos,0);
PickUpItemFromPos(&entity->pos,0);
}
void HandleSetItemAction(Entity *param_1, bool8 param_2)
@@ -228,7 +224,7 @@ void HandleGiveItemAction(Entity *param_1)
item2.flags &= ~(ITEM_FLAG_SET);
sub_8044DF0(param_1,0,100);
if (bVar3) {
sub_80460F8(&param_1->pos,&item1,1);
AddItemToDungeonAt(&param_1->pos,&item1,1);
}
else {
AddItemToInventory(&item1);
@@ -386,7 +382,7 @@ void HandlePlaceItemAction(Entity *entity)
else {
item->flags &= ~(ITEM_FLAG_SET);
sub_8045BF8(gFormatBuffer_Items[0],item);
if (sub_80460F8(&entity->pos,item,1) == 0) {
if (AddItemToDungeonAt(&entity->pos,item,1) == 0) {
LogMessageByIdWithPopupCheckUser(entity,*gUnknown_80F8E04);
}
else {
@@ -432,9 +428,9 @@ void sub_8066E14(Entity *entity)
newItems[0].flags &= ~(ITEM_FLAG_SET);
newItems[1].flags &= ~(ITEM_FLAG_SET);
sub_80461C8(&info->action.actionParameters[0].itemPos,1);
RemoveItemFromDungeonAt(&info->action.actionParameters[0].itemPos,1);
ZeroOutItem(item[1]);
if (!sub_80460F8(&info->action.actionParameters[0].itemPos,&newItems[1],1)) {
if (!AddItemToDungeonAt(&info->action.actionParameters[0].itemPos,&newItems[1],1)) {
LogMessageByIdWithPopupCheckUser(entity,*gNothingCanBePutDownHere);
}
else {
@@ -484,9 +480,9 @@ void sub_8066FA4(Entity *entity)
newItems[0].flags &= ~(ITEM_FLAG_SET);
newItems[1].flags &= ~(ITEM_FLAG_SET);
sub_80461C8(&entity->pos,1);
RemoveItemFromDungeonAt(&entity->pos,1);
ZeroOutItem(item[0]);
if (!sub_80460F8(&entity->pos, &newItems[0],1)) {
if (!AddItemToDungeonAt(&entity->pos, &newItems[0],1)) {
LogMessageByIdWithPopupCheckUser(entity,*gNothingCanBePutDownHere);
}
else {
@@ -564,7 +560,7 @@ void sub_80671A0(Entity *entity)
if (info->action.actionParameters[0].actionUseIndex == 0x80) {
item = NULL;
sub_80461C8(&info->action.actionParameters[0].itemPos, 1);
RemoveItemFromDungeonAt(&info->action.actionParameters[0].itemPos, 1);
}
r7 = TRUE;
@@ -581,7 +577,7 @@ void sub_80671A0(Entity *entity)
else {
if (info->action.actionParameters[0].actionUseIndex == 0x80) {
newItem.quantity--;
sub_80460F8(&info->action.actionParameters[0].itemPos, &newItem, 1);
AddItemToDungeonAt(&info->action.actionParameters[0].itemPos, &newItem, 1);
}
else {
item->quantity--;
+3 -3
View File
@@ -66,7 +66,7 @@ extern DungeonPos gUnknown_202EE0C;
extern void sub_803F4A0(Entity *a0);
extern bool8 sub_80860A8(u8 id);
extern u8 gUnknown_202F32C;
extern u8 sub_803D73C(s32 a0);
extern u8 GetRandomFloorItem(s32 a0);
extern void DeletePokemonDungeonSprite(s32 id);
extern void sub_80429E8(Entity *r0);
extern s32 sub_803DA20(s32 param_1);
@@ -1407,9 +1407,9 @@ bool8 sub_806B8CC(s16 _species, s32 x, s32 y, PokemonStruct2 *monPtr, Entity **a
&& (entityInfo->abilities[0] == ABILITY_PICKUP || entityInfo->abilities[1] == ABILITY_PICKUP)
&& !ItemExists(&entityInfo->heldItem))
{
u32 pickUpItem = sub_803D73C(0);
u32 pickUpItem = GetRandomFloorItem(0);
if (pickUpItem != ITEM_POKE) {
xxx_init_itemslot_8090A8C(&entityInfo->heldItem, pickUpItem, 0);
ItemIdToSlot(&entityInfo->heldItem, pickUpItem, 0);
entityInfo->unkF3 = TRUE;
}
}
+1 -2
View File
@@ -282,7 +282,6 @@ extern void sub_806A390(Entity *r0);
extern void sub_806F63C(Entity *r0);
extern void sub_8078084(Entity * pokemon);
extern void sub_800DBBC(void);
extern void sub_8045C28(Item *Item, u8 itemID, u32 param_3);
extern void sub_80464C8(Entity *, DungeonPos *, Item *);
extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon);
extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *);
@@ -869,7 +868,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc
if (reviverSeed != NULL) {
sub_8042148(target);
sub_8045C28(reviverSeed, ITEM_PLAIN_SEED, 2);
CreateItemWithStickyChance(reviverSeed, ITEM_PLAIN_SEED, FORCE_STICKY_NEVER);
target->unk22 = 0;
targetData->HP = targetData->maxHPStat;
targetData->unk158 = 0;
+5 -6
View File
@@ -42,7 +42,6 @@ extern void sub_8067110(Entity *);
extern void sub_80671A0(Entity *);
extern void sub_8073D14(Entity *);
extern void sub_8045BF8(u8 *, Item *);
extern bool8 sub_80461C8(DungeonPos *, u32);
extern void sub_805229C(void);
extern void sub_807E8F0(Entity *);
extern void sub_80444F4(Entity *pokemon);
@@ -147,7 +146,7 @@ void sub_8073D14(Entity *entity)
}
AddToTeamMoney(GetMoneyValue(groundItem));
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
sub_80461C8(&entity->pos, 1);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem);
}
else {
@@ -156,7 +155,7 @@ void sub_8073D14(Entity *entity)
Item *carriedItems[INVENTORY_SIZE + 1]; // plus held
s32 newQuantity;
if (gDungeon->unk644.unk17 && !_entityInfo->isNotTeamMember) {
if (gDungeon->unk644.hasInventory && !_entityInfo->isNotTeamMember) {
for (i = 0; i < INVENTORY_SIZE; i++) {
carriedItems[i] = &gTeamInventoryRef->teamItems[i];
inventoryIds[i] = i;
@@ -209,7 +208,7 @@ void sub_8073D14(Entity *entity)
carriedItems[newInventoryId]->flags |= ITEM_FLAG_STICKY;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
sub_80461C8(&entity->pos, 1);
RemoveItemFromDungeonAt(&entity->pos, 1);
PlaySoundEffect(0x14A);
if (inventoryIds[newInventoryId] <= -1)
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
@@ -240,7 +239,7 @@ void sub_8073D14(Entity *entity)
if (inventoryIds[i] <= -1) {
_entityInfo->heldItem = *groundItem;
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
sub_80461C8(&entity->pos, 1);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItem2);
}
else if (AddItemToInventory(groundItem)) {
@@ -249,7 +248,7 @@ void sub_8073D14(Entity *entity)
}
else {
sub_8045BF8(gFormatBuffer_Items[0], groundItem);
sub_80461C8(&entity->pos, 1);
RemoveItemFromDungeonAt(&entity->pos, 1);
DisplayDungeonLoggableMessageTrue(entity, gMonPickedUpItemToolbox);
}
}
+5 -5
View File
@@ -53,7 +53,7 @@ extern struct DungeonPos *gUnknown_8107178[3];
extern void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s32 param_4,s32 param_5); // TODO: param_4 should be s16
extern void sub_804216C(Entity *pokemon, Entity *target, u32 r2);
extern void sub_80461C8(DungeonPos *, u32);
extern void RemoveItemFromDungeonAt(DungeonPos *, u32);
extern void sub_804218C(Entity *pokemon, Entity *target);
EWRAM_INIT u32 gUnknown_203B444[3] = {0x28, 0x28, 0x50};
@@ -74,7 +74,7 @@ void sub_807BB78(Entity *pokemon);
extern void sub_803F580(u32);
bool8 sub_808384C(DungeonPos *, DungeonPos *);
u8 sub_8083660(DungeonPos *);
void sub_80460F8(DungeonPos *, Item *, u32);
void AddItemToDungeonAt(DungeonPos *, Item *, u32);
void sub_80462AC(Entity * ,u32, u32, u8, u32);
extern void ShowDungeonMapAtPos(s32, s32);
@@ -502,7 +502,7 @@ void HandleTrawlOrbAction(Entity *user, Entity *target)
for (i = 0; i < itemsCount; i++) {
if (EntityIsValid(&itemEntities[i])) {
sub_80461C8(&itemEntities[i].pos, 1);
RemoveItemFromDungeonAt(&itemEntities[i].pos, 1);
ShowDungeonMapAtPos(itemEntities[i].pos.x, itemEntities[i].pos.y);
itemVelocity[i].x = (((targetTilePos[i].x * 24 + 4) * 256) - itemEntities[i].pixelPos.x) / 60;
itemVelocity[i].y = (((targetTilePos[i].y * 24 + 4) * 256) - itemEntities[i].pixelPos.y) / 60;
@@ -533,7 +533,7 @@ void HandleTrawlOrbAction(Entity *user, Entity *target)
for (i = 0; i < itemsCount; i++) {
if (targetTilePos[i].x >= 0) {
sub_80460F8(&targetTilePos[i], GetItemData(&itemEntities[i]), 1);
AddItemToDungeonAt(&targetTilePos[i], GetItemData(&itemEntities[i]), 1);
ShowDungeonMapAtPos(targetTilePos[i].x, targetTilePos[i].y);
hasTrawled = TRUE;
}
@@ -834,7 +834,7 @@ void HandleExplosion(Entity *pokemon,Entity *target,DungeonPos *param_3,s32 para
}
entity2 = tile->object;
if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_ITEM)) {
sub_80461C8(&pos, 0);
RemoveItemFromDungeonAt(&pos, 0);
}
entity2 = tile->monster;
if (((entity2 != NULL) && (entity2 != target)) && (GetEntityType(entity2) == ENTITY_MONSTER)) {
+4 -4
View File
@@ -38,7 +38,7 @@ extern u8 gUnknown_203B40D;
extern OpenedFile *gUnknown_202ECA0;
extern void sub_804178C(u32);
extern bool8 sub_80461C8(DungeonPos *, u32);
extern bool8 RemoveItemFromDungeonAt(DungeonPos *, u32);
extern void sub_80429D8(Entity *r0);
extern s32 GetMonsterApparentID(Entity *pokemon, s32 id);
extern void sub_803E874(bool8 r10, s32 r9);
@@ -46,7 +46,7 @@ extern void GetWeatherName(u8 *dst, u8 weatherId);
extern s32 CalculateStatusTurns(Entity *target, const s16 *turnRange, bool8 factorCurerSkills);
extern void sub_80838EC(u8 *a);
extern bool8 sub_8044B28(void);
extern void sub_80460F8(DungeonPos *, Item *, u32);
extern void AddItemToDungeonAt(DungeonPos *, Item *, u32);
void sub_807E7FC(bool8 arg0);
void sub_807EFFC(bool8 arg0);
@@ -498,11 +498,11 @@ void sub_807EFFC(bool8 arg0)
Item *itemPtr = GetItemData(tile->object);
if (!ItemInShop(itemPtr)) {
Item item = *itemPtr;
sub_80461C8(&pos, 1);
RemoveItemFromDungeonAt(&pos, 1);
if (CanSellItem(item.id)) {
item.flags |= ITEM_FLAG_IN_SHOP;
}
sub_80460F8(&pos, &item, 1);
AddItemToDungeonAt(&pos, &item, 1);
}
}
}
+3 -3
View File
@@ -128,8 +128,8 @@ static void sub_803A5A0(void)
sub_803A690();
break;
case 4:
xxx_init_itemslot_8090A8C(&item, sUnknown_203B3F0->id, 0);
sub_801B3C0(&item);
ItemIdToSlot(&item, sUnknown_203B3F0->id, 0);
InitItemDescriptionWindow(&item);
break;
case 5:
break;
@@ -239,7 +239,7 @@ static void sub_803A86C(void)
break;
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
sub_803A504(1);
break;
}
+2 -8
View File
@@ -13,19 +13,13 @@
#include "dungeon_pokemon_attributes.h"
#include "pokemon.h"
#include "items.h"
#include "structs/str_item_text.h"
extern u8 *gUnknown_80F91EC[];
extern u8 *gUnknown_80F7C50[];
extern u8 gUnknown_80F697C[];
extern s16 gSpeedTurns[2][0x19];
typedef struct ItemText
{
u8 *desc;
u8 *useText;
} ItemText;
extern const ItemText gActions[];
extern void sub_8071B48(void);
extern void sub_8043ED0(u32);
extern u8 GetFloorType(void);
@@ -195,7 +189,7 @@ bool8 sub_8044B84(void)
}
}
u8 *sub_8044BA8(u16 actionId, u8 id)
const u8 *sub_8044BA8(u16 actionId, u8 id)
{
if (actionId == ACTION_STAIRS && GetFloorType() == FLOOR_TYPE_RESCUE) {
return *gUnknown_80F91EC;
+9 -12
View File
@@ -388,10 +388,7 @@ extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32);
extern void sub_807EAA0(u32, u32);
extern void sub_8072008(Entity *, Entity *, s16, u32, u32);
extern void sub_8085374(void);
extern void sub_8045C28(Item *, u8 , u8 *);
extern void sub_8046860(Entity *, DungeonPos *, Item *, u32);
extern u32 sub_803D73C(u32);
extern void sub_80460F8(DungeonPos *, Item *, u8);
extern u32 GetRandomFloorItem(u32);
extern u8 sub_8044B28(void);
extern bool8 sub_8085B80(struct_8085B80 *);
@@ -3548,7 +3545,7 @@ void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x2E) && (param_1 == 0x17)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
xxx_init_itemslot_8090A8C(&item,ITEM_ROCK_PART,0);
ItemIdToSlot(&item,ITEM_ROCK_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regirock's body
@@ -3571,7 +3568,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x2F) && (param_1 == 0x18)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
xxx_init_itemslot_8090A8C(&item,ITEM_ICE_PART,0);
ItemIdToSlot(&item,ITEM_ICE_PART,0);
sub_80464C8(GetLeader(),param_3,&item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Regice's body
@@ -3593,7 +3590,7 @@ void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3)
if (!sub_8098100(0x22) && (param_2 == 0x30) && (param_1 == 0x19)) {
sub_808B1CC(ITEM_NOTHING);
if (!sub_8098100(0x1d)) {
xxx_init_itemslot_8090A8C(&item,ITEM_STEEL_PART,0);
ItemIdToSlot(&item,ITEM_STEEL_PART,0);
sub_80464C8(GetLeader(),param_3, &item);
DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT);
// Something fell from Registeel's body
@@ -3716,9 +3713,9 @@ void sub_808B1CC(u8 itemID)
tile->terrainType = tile->terrainType | TERRAIN_TYPE_STAIRS;
if (((itemID != ITEM_NOTHING) && (sub_80860A8(itemID) == 0)) &&
(sub_80860A8(ITEM_MUSIC_BOX) == 0)) {
xxx_init_itemslot_8090A8C(&item,itemID,0);
ItemIdToSlot(&item,itemID,0);
pos.y--;
sub_80460F8(&pos,&item,1);
AddItemToDungeonAt(&pos,&item,1);
}
sub_8049ED4();
ShowWholeRevealedDungeonMap();
@@ -3925,7 +3922,7 @@ void JirachiWish(void)
{
for(index = 0; index < 9; index++)
{
sub_8045C28(&moneyItems[index], ITEM_POKE, 0);
CreateItemWithStickyChance(&moneyItems[index], ITEM_POKE, 0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
@@ -3950,7 +3947,7 @@ void JirachiWish(void)
{
for(index = 0; index < 9; index++)
{
sub_8045C28(&items[index], sub_803D73C(0),0);
CreateItemWithStickyChance(&items[index], GetRandomFloorItem(0),0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
pos.y = (jirachiEntity->pos.y + DungeonRandInt(3) + -1);
@@ -4006,7 +4003,7 @@ void JirachiWish(void)
for(index = 0; index < 4; index++)
{
sub_8045C28(&strengthItems[index],gUnknown_81074FC[DungeonRandInt(8)],0);
CreateItemWithStickyChance(&strengthItems[index],gUnknown_81074FC[DungeonRandInt(8)],0);
}
pos.x = (jirachiEntity->pos.x + DungeonRandInt(3) - 1);
+5 -5
View File
@@ -21,7 +21,7 @@
extern const u8 gUnknown_80F6DCC[];
extern struct FileArchive gDungeonFileArchive;
extern void sub_80460F8(DungeonPos *, Item *, u32);
extern void AddItemToDungeonAt(DungeonPos *, Item *, u32);
extern s32 sub_803DA20(s16 species);
extern void sub_8049840(void);
extern void sub_80429FC(DungeonPos *r0);
@@ -171,7 +171,7 @@ void GenerateFloor(void)
s32 x, y;
s32 spawnAttempts;
bool8 secondaryGen = FALSE;
FloorProperties *floorProps = &gDungeon->unk1C574;
FloorProperties *floorProps = &gDungeon->floorProperties;
gDungeon->unk13568 = OpenFileAndGetFileDataPtr(gUnknown_80F6DCC, &gDungeonFileArchive);
sHasKecleonShop = FALSE;
@@ -6094,10 +6094,10 @@ static void sub_805193C(u8 itemId, s32 x, s32 y, s32 quantity, u32 itemFlags)
DungeonPos pos = {x, y};
if (sub_805210C(itemId)) {
xxx_init_itemslot_8090A8C(&item, ITEM_LINK_CABLE, 0);
ItemIdToSlot(&item, ITEM_LINK_CABLE, 0);
}
else {
xxx_init_itemslot_8090A8C(&item, itemId, 0);
ItemIdToSlot(&item, itemId, 0);
}
item.flags |= itemFlags;
@@ -6105,7 +6105,7 @@ static void sub_805193C(u8 itemId, s32 x, s32 y, s32 quantity, u32 itemFlags)
item.quantity = quantity;
}
sub_80460F8(&pos, &item, 1);
AddItemToDungeonAt(&pos, &item, 1);
}
// s16 species memes strike again. Will the fix ever be discovered?
+860 -203
View File
File diff suppressed because it is too large Load Diff
+50 -52
View File
@@ -68,16 +68,14 @@ extern void PlayDungeonStartButtonSE(void);
extern void PlayDungeonCancelSE(void);
extern void PlayDungeonConfirmationSE(void);
extern void sub_806A6E8(Entity *);
extern bool8 sub_8047084(s32 itemFlag);
extern void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4);
extern void sub_8045DB4(DungeonPos *, u32);
bool8 sub_807EF48(void);
void sub_806A2BC(Entity *a0, u8 a1);
bool8 sub_80701A4(Entity *a0);
void sub_803E708(s32 a0, s32 a1);
void sub_8075680(u32);
void sub_8094C88(void);
void sub_8047158(void);
void ClearUnpaidFlagFromAllItems(void);
void sub_806A914(u8 a0, u8 a1, u8 a2);
void SetLeaderActionToNothing(u8 a0);
u16 GetLeaderActionId(void);
@@ -186,7 +184,7 @@ void DungeonHandlePlayerInput(void)
ShowDungeonStairsMenu(GetLeader());
ResetRepeatTimers();
ResetUnusedInputStruct();
if (GetLeaderActionId() != 0) {
if (GetLeaderActionId() != ACTION_NOTHING) {
return;
}
}
@@ -584,7 +582,7 @@ void DungeonHandlePlayerInput(void)
}
else {
DungeonRunFrameActions(0xF);
sub_8047158();
ClearUnpaidFlagFromAllItems();
ShowMainMenu((r6.a0_16 == 0), r6.a0_24);
ResetRepeatTimers();
ResetUnusedInputStruct();
@@ -1047,7 +1045,7 @@ void sub_805EE30(void)
case ENTITY_ITEM: {
Item *item = GetItemData(tileObject);
if (!(item->flags & ITEM_FLAG_IN_SHOP)) {
sub_8045DB4(&leader->pos, 1);
PickUpItemFromPos(&leader->pos, 1);
}
else {
gDungeon->unk5C0 = 4;
@@ -1111,7 +1109,7 @@ void sub_805F02C(void)
if (r8->isTeamLeader) {
DisplayDungeonLoggableMessageTrue(r7, gUnknown_80F9BD8);
}
else if (sub_8047084(ITEM_FLAG_IN_SHOP) || sub_807EF48()) {
else if (PlayerHasItemWithFlag(ITEM_FLAG_IN_SHOP) || sub_807EF48()) {
DisplayDungeonLoggableMessageTrue(r7, gUnknown_80F9C08);
}
else if (gDungeon->unk644.unk2A) {
@@ -1204,7 +1202,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
while (1) {
if (r10 < 0) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
gTeamMenuChosenId = -1;
PrintOnMainMenu(printAll);
sub_806A2BC(GetLeader(), 0);
@@ -1242,7 +1240,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
if (chosenOption == MAIN_MENU_ITEMS) {
u16 action;
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
var_34.a0_8 = 0;
var_34.a0_16 = 1;
var_34.a0_24 = 0;
@@ -1251,75 +1249,75 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
r10 = -1;
}
if (sub_805FD3C(&var_34) && ShowDungeonItemsMenu(GetLeader(), &var_34)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
action = GetLeaderActionId();
if (action == 12) {
if (action == ACTION_SHOW_INFO) {
sub_8044D90(GetLeader(), 0, 12)->flags |= ITEM_FLAG_UNPAID;
sub_8060D24(GetLeaderActionContainer());
SetLeaderActionToNothing(1);
DungeonShowItemDescription(GetLeaderActionContainer());
SetLeaderActionToNothing(TRUE);
}
else if (action == 53) {
else if (action == ACTION_UNK35) {
item = sub_8044D90(GetLeader(), 0, 13);
if (!sub_8048A68(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
else if (action == 16) {
else if (action == ACTION_UNK10) {
item = sub_8044D90(GetLeader(), 0, 14);
if (!sub_8048950(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
else if (action == 44) {
else if (action == ACTION_USE_LINK_BOX) {
item = sub_8044D90(GetLeader(), 0, 15);
if (!sub_8048B9C(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
else if (action == 60) {
else if (action == ACTION_SET_ITEM) {
HandleSetItemAction(GetLeader(), TRUE);
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
sub_803E708(0x50, 0x4D);
sub_8052210(0);
break;
}
else if (action == 61) {
else if (action == ACTION_UNSET_ITEM) {
HandleUnsetItemAction(GetLeader(), TRUE);
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
sub_803E708(0x50, 0x4D);
sub_8052210(0);
break;
}
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
else if (chosenOption == MAIN_MENU_TEAM) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
if (ShowDungeonTeamMenu(GetLeader())) {
r10 = -1;
}
if (GetLeaderActionId() == ACTION_CHECK_SUMMARY) {
ShowDungeonSummaryOrIQMenu(GetLeaderActionContainer(), FALSE);
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_TALK_MENU) {
sub_806752C(GetLeaderActionContainer());
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == 0x34) {
else if (GetLeaderActionId() == ACTION_UNK34) {
sub_8067768(GetLeaderActionContainer());
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_CHANGE_TACTICS) {
ShowDungeonTacticsMenu(GetLeaderActionContainer());
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_VIEW_IQ) {
ShowDungeonSummaryOrIQMenu(GetLeaderActionContainer(), TRUE);
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
else if (GetLeaderActionId() == ACTION_CHECK_MOVES) {
s32 i, count;
@@ -1331,7 +1329,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
if (EntityIsValid(teamMon)) {
if (i == GetLeaderActionContainer()->actionParameters[0].actionUseIndex) {
gTeamMenuChosenId = count;
if (GetLeaderActionId() != 0) {
if (GetLeaderActionId() != ACTION_NOTHING) {
sub_806A2BC(teamMon, 0);
}
break;
@@ -1341,7 +1339,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
}
}
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
else if (chosenOption == MAIN_MENU_MOVES) {
@@ -1349,7 +1347,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
Entity *currEntity;
currMonId = 0;
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
Entity *teamMon = gDungeon->teamPokemon[i];
if (EntityIsValid(teamMon)) {
@@ -1441,7 +1439,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
}
sub_806A2BC(GetLeader(), 0);
ChangeDungeonCameraPos(&GetLeader()->pos, 0, 1, 1);
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
else if (chosenOption == MAIN_MENU_GROUND) {
@@ -1452,7 +1450,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
if (GetEntityType(tileObject) == ENTITY_ITEM) {
u16 action;
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
var_30.a0_8 = 0;
var_30.a0_16 = 1;
var_30.a0_24 = 1;
@@ -1462,47 +1460,47 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
ASM_MATCH_TRICK(leader);
}
if (sub_805FD3C(&var_30) && ShowDungeonItemsMenu(GetLeader(), &var_30)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
action = GetLeaderActionId();
if (action == 0xC) {
if (action == ACTION_SHOW_INFO) {
sub_8044D90(GetLeader(), 0, 0x10)->flags |= ITEM_FLAG_UNPAID;
sub_8060D24(GetLeaderActionContainer());
SetLeaderActionToNothing(1);
DungeonShowItemDescription(GetLeaderActionContainer());
SetLeaderActionToNothing(TRUE);
}
else if (action == 0x35) {
else if (action == ACTION_UNK35) {
item = sub_8044D90(GetLeader(), 0, 0x11);
if (!sub_8048A68(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
else if (action == 0x10) {
else if (action == ACTION_UNK10) {
item = sub_8044D90(GetLeader(), 0, 0x12);
if (!sub_8048950(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
else if (action == 0x2C) {
else if (action == ACTION_USE_LINK_BOX) {
item = sub_8044D90(GetLeader(), 0, 0x13);
if (!sub_8048B9C(GetLeader(), item)) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
}
}
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
else if (GetEntityType(tileObject) == ENTITY_TRAP) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
ShowDungeonTileMenu(GetLeader());
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
}
else if (tile->terrainType & TERRAIN_TYPE_STAIRS) {
SetLeaderActionToNothing(1);
SetLeaderActionToNothing(TRUE);
ShowDungeonStairsMenu(GetLeader());
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
}
else {
@@ -1516,7 +1514,7 @@ static void ShowMainMenu(bool8 fromBPress, bool8 a1)
ShowDungeonOthersMenu();
if (gDungeon->unk4)
break;
if (GetLeaderActionId() != 0)
if (GetLeaderActionId() != ACTION_NOTHING)
break;
r10 = -1;
}
+78 -79
View File
@@ -36,7 +36,6 @@ extern void PlayDungeonConfirmationSE(void);
extern void sub_806A2BC(Entity *a0, u8 a1);
extern void SetLeaderActionToNothing(u8 a0);
extern void sub_803E708(s32 a0, s32 a1);
extern void sub_8047158(void);
extern Item *sub_8044D90(Entity *, s32, u32);
extern bool8 sub_8070F14(Entity * pokemon, s32 direction);
bool8 sub_805EC2C(Entity *a0, s32 x, s32 y);
@@ -83,7 +82,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 a2, bool8 a3, Wind
static s32 sub_8060800(WindowHeader *a0, s32 a1);
static bool8 sub_8060860(s32 a0);
static void sub_8060890(DungeonPos *a0);
static void sub_8060900(Entity *a0);
static void SetSubMenuActions(Entity *a0);
static void ChosenSubMenuToAction(ActionContainer *a0);
static s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4);
@@ -111,7 +110,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
{
s32 i, i_r6;
s32 r8;
s32 r9 = 0;
s32 inputAction = 0;
u8 var_34 = 1;
u8 var_30 = 0;
@@ -162,7 +161,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
s32 id;
Entity *r4;
r9 = 0;
inputAction = 0;
for (i = 0; i < INVENTORY_SIZE; i++) {
Item *item = &gTeamInventoryRef->teamItems[i];
if (item->flags & ITEM_FLAG_EXISTS && item->flags & ITEM_FLAG_UNPAID) {
@@ -235,7 +234,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
s16 arr[10];
PlaySoundEffect(0x132);
sub_8047158();
ClearUnpaidFlagFromAllItems();
ConvertMoneyItemToMoney();
sUnknown_202F240 = 0;
r3 = sub_8060D64(arr, var_30, var_34, var_28, a0);
@@ -262,46 +261,46 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
if ((gRealInputs.pressed & A_BUTTON) || gDungeonMenu.unk28.a_button) {
PlayDungeonConfirmationSE();
sub_8060890(&a0->pos);
r9 = 1;
inputAction = 1;
break;
}
if (gRealInputs.pressed & START_BUTTON) {
PlayDungeonStartButtonSE();
sub_8060890(&a0->pos);
r9 = 3;
inputAction = 3;
break;
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r9 = 2;
inputAction = 2;
break;
}
}
else {
sub_8060890(&a0->pos);
r9 = 1;
inputAction = 1;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x14);
if (sUnknown_202F248[gDungeonMenu.unk1E] <= 1 && !(gTeamInventoryRef->teamItems[0].flags & ITEM_FLAG_EXISTS)) {
r9 = 2;
inputAction = 2;
}
if (r9 == 2) {
if (inputAction == 2) {
sub_803EAF0(0, NULL);
r9 = 1;
inputAction = 1;
break;
}
else if (r9 == 0) {
else if (inputAction == 0) {
continue;
}
else if (r9 == 3) {
else if (inputAction == 3) {
SetMonsterActionFields(&a0Info->action, 0xC);
a0Info->action.actionParameters[0] = sUnknownActionUnk4;
sub_803EAF0(0, NULL);
r9 = 0;
inputAction = 0;
break;
}
else {
@@ -309,11 +308,11 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
if (var_2C != 0) {
a0Info->action.actionParameters[1] = sUnknownActionUnk4;
sub_803EAF0(0, NULL);
r9 = 0;
inputAction = 0;
break;
}
sub_8060900(a0);
SetSubMenuActions(a0);
sub_8060800(&header, gDungeonMenu.unk1E);
CreateDungeonMenuSubWindow(&windows.id[0], 0x16);
while (1) {
@@ -331,27 +330,27 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
if (CanSubMenuItemBeChosen(gDungeonMenu.menuIndex)) {
PlayDungeonConfirmationSE();
ChosenSubMenuToAction(&a0Info->action);
r9 = 0;
inputAction = 0;
break;
}
PlayDungeonCancelSE();
}
if ((gRealInputs.pressed & B_BUTTON) || gDungeonMenu.unk28.b_button) {
PlayDungeonCancelSE();
r9 = 1;
inputAction = 1;
break;
}
}
AddMenuCursorSprite(&gDungeonMenu);
DungeonRunFrameActions(0x14);
gDungeon->unk181e8.unk18212 = 0;
if (r9 != 1 || var_30 != 0) {
if (a0Info->action.action == 0x37 || a0Info->action.action == 0x38 || a0Info->action.action == 0x3E) {
if (inputAction != 1 || var_30 != 0) {
if (a0Info->action.action == ACTION_TAKE_ITEM || a0Info->action.action == ACTION_USE_ITEM || a0Info->action.action == ACTION_UNK3E) {
// Hm...
int newAction = sUnknownActionUnk4.actionUseIndex - 0x90;
a0Info->action.actionParameters[0].actionUseIndex = newAction;
sub_803EAF0(0, 0);
r9 = 0;
inputAction = 0;
break;
}
else if (a0Info->action.action == ACTION_GIVE_ITEM) {
@@ -359,7 +358,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
if (ShowDungeonToWhichMonMenu(&teamId, WHICH_MENU_ITEMS) != NULL) {
a0Info->action.actionParameters[1].actionUseIndex = teamId;
sub_803EAF0(0, 0);
r9 = 0;
inputAction = 0;
break;
}
sub_803EAF0(0, NULL);
@@ -367,7 +366,7 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
}
else {
sub_803EAF0(0, 0);
r9 = 0;
inputAction = 0;
break;
}
}
@@ -378,12 +377,12 @@ bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1)
sub_803E708(2, 0x61);
sub_804AA60();
sub_803E708(2, 0x61);
return r9;
return inputAction;
}
static const struct unkStruct_8090F58 gUnknown_8106B60 = {1, 1, 0, 80, 1};
static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, bool8 a3, WindowTemplates *windows, WindowHeader *a5)
static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, bool8 a3, WindowTemplates *windows, WindowHeader *header)
{
s32 i, x, y;
s32 r10;
@@ -401,7 +400,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b
EntityInfo *a1Info;
a1Info = GetEntInfo(a1);
r10 = sub_8060800(a5, a0);
r10 = sub_8060800(header, a0);
gDungeonMenu.menuIndex = sUnknown_202F240;
gDungeonMenu.unk1A = 0;
gDungeonMenu.unk1E = a0;
@@ -416,7 +415,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b
case 1:
windows->id[0].unk10 = 0x10;
windows->id[0].height = 0x10;
a5->width = 0xC;
header->width = 0xC;
gDungeonMenu.firstEntryY = 0x10;
gDungeonMenu.unk1C = 0xA;
gDungeon->unk181e8.unk18212 = 1;
@@ -424,7 +423,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b
case 2:
windows->id[0].unk10 = 4;
windows->id[0].height = 4;
a5->width = 6;
header->width = 6;
gDungeonMenu.firstEntryY = 0x12;
gDungeonMenu.unk1C = 1;
break;
@@ -432,7 +431,7 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b
default:
windows->id[0].unk10 = 4;
windows->id[0].height = 4;
a5->width = 0xC;
header->width = 0xC;
gDungeonMenu.firstEntryY = 0x12;
gDungeonMenu.unk1C = 1;
break;
@@ -541,9 +540,9 @@ static void PrintOnDungeonItemsMenu(s32 a0, Entity *a1, bool8 showWhichWindow, b
}
}
static s32 sub_8060800(WindowHeader *a0, s32 a1)
static s32 sub_8060800(WindowHeader *header, s32 a1)
{
s32 i, r1, r2, r3;
s32 i, r1, count, currId;
r1 = 0;
for (i = 0; i < sUnknown_202F258; i++) {
@@ -553,19 +552,19 @@ static s32 sub_8060800(WindowHeader *a0, s32 a1)
}
if (sUnknown_202F248[a1] <= 1) {
r3 = a1;
r2 = r1;
currId = a1;
count = r1;
r1 = 0;
}
else {
r3 = a1 - r1;
r2 = sUnknown_202F258 - r1;
currId = a1 - r1;
count = sUnknown_202F258 - r1;
}
if (a0 != NULL) {
a0->count = r2;
a0->currId = r3;
a0->f3 = 0;
if (header != NULL) {
header->count = count;
header->currId = currId;
header->f3 = 0;
}
return r1;
@@ -602,7 +601,7 @@ static void sub_8060890(DungeonPos *a0)
sUnknownActionUnk4.itemPos.y = a0->y;
}
static void sub_8060900(Entity *a0)
static void SetSubMenuActions(Entity *a0)
{
u16 val_sub8044DC8;
Item *item = sub_8044CC8(a0, &sUnknownActionUnk4, 0xA);
@@ -611,25 +610,25 @@ static void sub_8060900(Entity *a0)
gDungeonSubMenuItemsCount = 0;
if (sUnknownActionUnk4.actionUseIndex < 144) {
if (sUnknownActionUnk4.actionUseIndex == 128) {
AddActionToDungeonSubMenu(9, item->id);
AddActionToDungeonSubMenu(ACTION_PICK_UP_PLAYER, item->id);
if (GetItemCategory(item->id) != CATEGORY_POKE) {
bool32 r2 = 0;
if (gDungeon->unk644.unk17 != 0) {
bool32 noSpace = FALSE;
if (gDungeon->unk644.hasInventory) {
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS) {
r2 = TRUE;
noSpace = TRUE;
}
}
else if (a0Info->heldItem.flags & ITEM_FLAG_EXISTS) {
r2 = TRUE;
noSpace = TRUE;
}
if (r2) {
SetActionUnusableInDungeonSubMenu(9);
if (noSpace) {
SetActionUnusableInDungeonSubMenu(ACTION_PICK_UP_PLAYER);
}
}
}
if (sUnknownActionUnk4.actionUseIndex == 128 && gDungeon->unk644.unk17 != 0) {
AddActionToDungeonSubMenu(10, item->id);
if (sUnknownActionUnk4.actionUseIndex == 128 && gDungeon->unk644.hasInventory) {
AddActionToDungeonSubMenu(ACTION_UNKA, item->id);
}
val_sub8044DC8 = sub_8044DC8(item);
if (val_sub8044DC8 != 0) {
@@ -648,10 +647,10 @@ static void sub_8060900(Entity *a0)
s32 i;
if (ItemSet(item)) {
AddActionToDungeonSubMenu(0x3D, item->id);
AddActionToDungeonSubMenu(ACTION_UNSET_ITEM, item->id);
}
else {
AddActionToDungeonSubMenu(0x3C, item->id);
AddActionToDungeonSubMenu(ACTION_SET_ITEM, item->id);
}
for (i = 0; i < INVENTORY_SIZE; i++) {
@@ -659,8 +658,8 @@ static void sub_8060900(Entity *a0)
&& ItemSet(&gTeamInventoryRef->teamItems[i])
&& ItemSticky(&gTeamInventoryRef->teamItems[i]))
{
SetActionUnusableInDungeonSubMenu(0x3C);
SetActionUnusableInDungeonSubMenu(0x3D);
SetActionUnusableInDungeonSubMenu(ACTION_SET_ITEM);
SetActionUnusableInDungeonSubMenu(ACTION_UNSET_ITEM);
break;
}
}
@@ -671,7 +670,7 @@ static void sub_8060900(Entity *a0)
s32 i;
bool32 r8 = FALSE;
AddActionToDungeonSubMenu(0x36, item->id);
AddActionToDungeonSubMenu(ACTION_GIVE_ITEM, item->id);
for (i = 0; i < MAX_TEAM_MEMBERS; i++) {
Entity *teamMon = gDungeon->teamPokemon[i];
if (EntityIsValid(teamMon)) {
@@ -684,48 +683,48 @@ static void sub_8060900(Entity *a0)
}
}
if (!r8) {
SetActionUnusableInDungeonSubMenu(0x36);
SetActionUnusableInDungeonSubMenu(ACTION_GIVE_ITEM);
}
}
}
else if (gDungeon->unk644.unk17) {
else if (gDungeon->unk644.hasInventory) {
if (gTeamInventoryRef->teamItems[INVENTORY_SIZE - 1].flags & ITEM_FLAG_EXISTS) {
AddActionToDungeonSubMenu(0x3E, item->id);
AddActionToDungeonSubMenu(ACTION_UNK3E, item->id);
}
else {
AddActionToDungeonSubMenu(0x37, item->id);
AddActionToDungeonSubMenu(ACTION_TAKE_ITEM, item->id);
}
if (CheckVariousConditions(a0)) {
SetActionUnusableInDungeonSubMenu(0x37);
SetActionUnusableInDungeonSubMenu(0x3E);
SetActionUnusableInDungeonSubMenu(ACTION_TAKE_ITEM);
SetActionUnusableInDungeonSubMenu(ACTION_UNK3E);
}
}
if (sUnknownActionUnk4.actionUseIndex <= 20) {
Entity *tileEntity = GetTile(a0->pos.x, a0->pos.y)->object;
if (tileEntity == NULL) {
AddActionToDungeonSubMenu(8, item->id);
AddActionToDungeonSubMenu(ACTION_PLACE_ITEM, item->id);
}
else if (GetEntityType(tileEntity) == ENTITY_ITEM) {
AddActionToDungeonSubMenu(0x3A, item->id);
AddActionToDungeonSubMenu(ACTION_UNK3A, item->id);
}
}
if (GetItemCategory(item->id) == CATEGORY_THROWN_LINE) {
AddActionToDungeonSubMenu(0x27, item->id);
AddActionToDungeonSubMenu(ACTION_THROW_STRAIGHT_PLAYER, item->id);
}
else if (GetItemCategory(item->id) == CATEGORY_THROWN_ARC) {
AddActionToDungeonSubMenu(0x41, item->id);
AddActionToDungeonSubMenu(ACTION_THROW_ARC_PLAYER, item->id);
}
else {
AddActionToDungeonSubMenu(0xB, item->id);
AddActionToDungeonSubMenu(ACTION_THROW_ITEM_PLAYER, item->id);
}
if (!MonsterCanThrowItems(a0Info)) {
SetActionUnusableInDungeonSubMenu(0x27);
SetActionUnusableInDungeonSubMenu(0x41);
SetActionUnusableInDungeonSubMenu(0xB);
SetActionUnusableInDungeonSubMenu(ACTION_THROW_STRAIGHT_PLAYER);
SetActionUnusableInDungeonSubMenu(ACTION_THROW_ARC_PLAYER);
SetActionUnusableInDungeonSubMenu(ACTION_THROW_ITEM_PLAYER);
}
}
else {
@@ -749,17 +748,17 @@ static void sub_8060900(Entity *a0)
if (GetItemCategory(item->id) == CATEGORY_TMS_HMS) r5 = TRUE;
if (GetItemCategory(item->id) == CATEGORY_ORBS) r5 = TRUE;
if (gDungeon->unk644.unk17) {
if (gDungeon->unk644.hasInventory) {
if (r4) {
AddActionToDungeonSubMenu(0x3E, item->id);
AddActionToDungeonSubMenu(ACTION_UNK3E, item->id);
}
else {
AddActionToDungeonSubMenu(0x37, item->id);
AddActionToDungeonSubMenu(ACTION_TAKE_ITEM, item->id);
}
if (r6) {
SetActionUnusableInDungeonSubMenu(0x37);
SetActionUnusableInDungeonSubMenu(0x3E);
SetActionUnusableInDungeonSubMenu(ACTION_TAKE_ITEM);
SetActionUnusableInDungeonSubMenu(ACTION_UNK3E);
}
}
@@ -784,7 +783,7 @@ static void sub_8060900(Entity *a0)
}
}
AddActionToDungeonSubMenu(0xC, item->id);
AddActionToDungeonSubMenu(ACTION_SHOW_INFO, item->id);
sub_8045064();
}
@@ -797,17 +796,17 @@ static void ChosenSubMenuToAction(ActionContainer *a0)
a0->actionParameters[1].itemPos.y = 0;
}
void sub_8060D24(UNUSED ActionContainer *a0)
void DungeonShowItemDescription(UNUSED ActionContainer *a0)
{
Item *item = sub_8044D90(GetLeader(), 0, 0xB);
DungeonShowWindows(NULL, 0);
sub_801B3C0(item);
InitItemDescriptionWindow(item);
do {
DungeonRunFrameActions(0x16);
} while (sub_801B410() == 0);
sub_801B450();
FreeItemDescriptionWindow();
sub_803EAF0(0, NULL);
}
@@ -816,7 +815,7 @@ static s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4)
s32 i;
s32 count = 0;
if (gDungeon->unk644.unk17 && !a1) {
if (gDungeon->unk644.hasInventory && !a1) {
if (gTeamInventoryRef->teamItems[0].flags & ITEM_FLAG_EXISTS) {
a0[count++] = 0;
}
+2 -5
View File
@@ -55,9 +55,7 @@ extern void PlayDungeonCancelSE(void);
extern void PlayDungeonConfirmationSE(void);
extern void PlayDungeonCursorSE(u8 param_1);
extern void sub_806A6E8(Entity *);
extern bool8 sub_8047084(s32 itemFlag);
extern void HandleTrap(Entity *pokemon, DungeonPos *pos, int param_3, char param_4);
extern void sub_8045DB4(DungeonPos *, u32);
bool8 sub_807EF48(void);
void sub_806A2BC(Entity *a0, u8 a1);
bool8 sub_805E874(void);
@@ -70,7 +68,6 @@ void ShowDungeonOthersMenu(void);
void sub_8075680(u32);
void sub_8094C88(void);
void sub_8040A84(void);
void sub_8047158(void);
void sub_806A914(u8 a0, u8 a1, u8 a2);
void SetLeaderActionToNothing(u8 a0);
u16 GetLeaderActionId(void);
@@ -86,7 +83,7 @@ bool8 sub_805EF60(Entity *a0, EntityInfo *a1);
bool8 sub_8070F80(Entity * pokemon, s32 direction);
void PrintOnMainMenu(bool8 printAll);
bool8 ShowDungeonItemsMenu(Entity * a0, struct UnkMenuBitsStruct *a1);
void sub_8060D24(UNUSED ActionContainer *a0);
void DungeonShowItemDescription(UNUSED ActionContainer *a0);
bool8 ShowDungeonTeamMenu(Entity *a0);
void ActionShowMoveInfo(ActionContainer *a0);
void ActionToggleMoveUsableForAi(ActionContainer *a0);
@@ -201,7 +198,7 @@ bool8 ShowDungeonTeamMenu(Entity *a0)
}
}
if (!gDungeon->unk644.unk17) {
if (!gDungeon->unk644.hasInventory) {
windows.id[0].type = WINDOW_TYPE_NORMAL;
windows.id[0].pos.y++;
}
+2 -2
View File
@@ -134,7 +134,7 @@ static Entity* sub_80828E0(s16 id, s16 apparentID, s32 index);
static Entity* sub_8082A08(s32 id, s32 apparentID, s32 index);
// These externs are from other files
extern void sub_80460F8(DungeonPos *, Item *, u32);
extern void AddItemToDungeonAt(DungeonPos *, Item *, u32);
void SaveDungeonState(u8 *buffer, u32 bufLen)
{
@@ -877,7 +877,7 @@ static void ReadDungeonItems(DataSerializer *seri)
ReadTilePos(seri, &pos);
if (item.flags & ITEM_FLAG_EXISTS)
sub_80460F8(&pos, &item, 0);
AddItemToDungeonAt(&pos, &item, 0);
}
}
+2 -2
View File
@@ -202,7 +202,7 @@ void sub_8027274(void)
break;
case 0xd:
HeldItemToSlot(&slot, &sUnknown_203B2BC->itemToGive);
sub_801B3C0(&slot);
InitItemDescriptionWindow(&slot);
break;
case 0xe:
unk_CopyMoves4To8(sUnknown_203B2BC->moves,sUnknown_203B2BC->pokeStruct->moves);
@@ -625,7 +625,7 @@ void sub_8027C84()
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
SetFriendAreaActionMenuState(0xB);
case 0:
case 1:
+2 -2
View File
@@ -219,7 +219,7 @@ void sub_8025518(void)
break;
case FRIEND_LIST_MENU_STATE_INFO:
HeldItemToSlot(&item, &gUnknown_203B2B4->item1);
sub_801B3C0(&item);
InitItemDescriptionWindow(&item);
break;
case FRIEND_LIST_MENU_STATE_ITEM_GIVEN:
gUnknown_203B2B4->fallbackState = 2;
@@ -560,7 +560,7 @@ void sub_8025D90(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
SetFriendListMenuState(0xC);
case 0:
case 1:
+4 -4
View File
@@ -693,7 +693,7 @@ void CleanFriendRescueMenu(void)
sub_802F2C0();
sub_8030DE4();
sub_802453C();
sub_801B450();
FreeItemDescriptionWindow();
}
}
@@ -2470,7 +2470,7 @@ void sub_8034B88(void)
RestoreUnkTextStruct_8006518(&gUnknown_203B33C->unk3BC);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&gUnknown_203B33C->item);
InitItemDescriptionWindow(&gUnknown_203B33C->item);
SetFriendRescueMenuState(0x61);
break;
}
@@ -2482,7 +2482,7 @@ void sub_8034C38(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
ResetUnusedInputStruct();
ShowWindows(&gUnknown_203B33C->unk3BC, TRUE, TRUE);
sub_801CB5C(TRUE);
@@ -2519,7 +2519,7 @@ void sub_8034C98(void)
RestoreUnkTextStruct_8006518(&gUnknown_203B33C->unk3BC);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&gUnknown_203B33C->item);
InitItemDescriptionWindow(&gUnknown_203B33C->item);
SetFriendRescueMenuState(0x61);
break;
case 5:
+26 -27
View File
@@ -98,33 +98,32 @@ bool8 IsThrowableItem(u8 id)
return TRUE;
}
void xxx_init_itemslot_8090A8C(Item *slot, u8 id, u8 param_3)
void ItemIdToSlot(Item *slot, u8 id, u8 makeSticky)
{
u32 uVar3;
u32 uVar4;
if (id != ITEM_NOTHING) {
slot->flags = ITEM_FLAG_EXISTS;
slot->id = id;
if (IsThrowableItem(id)) {
s32 min = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT);
s32 max = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT);
slot->quantity = RandRange(min, max);
}
else if (GetItemCategory(id) == CATEGORY_POKE) {
slot->quantity = 1;
}
else {
slot->quantity = 0;
}
if (id != ITEM_NOTHING) {
slot->flags = ITEM_FLAG_EXISTS;
slot->id = id;
if (IsThrowableItem(id)) {
uVar3 = GetSpawnAmountRange(id, MIN_SPAWN_AMOUNT);
uVar4 = GetSpawnAmountRange(id, MAX_SPAWN_AMOUNT);
slot->quantity = RandRange(uVar3, uVar4);
if (makeSticky) {
slot->flags |= ITEM_FLAG_STICKY;
}
}
else if (GetItemCategory(id) == CATEGORY_POKE)
slot->quantity = 1;
else
else {
slot->flags = 0;
slot->id = ITEM_NOTHING;
slot->quantity = 0;
if (param_3 != 0)
slot->flags |= ITEM_FLAG_STICKY;
}
else {
slot->flags = 0;
slot->id = ITEM_NOTHING;
slot->quantity = 0;
}
}
}
void xxx_init_helditem_8090B08(BulkItem *held, u8 id)
@@ -265,7 +264,7 @@ s32 GetItemOrder(u8 id)
return gItemParametersData[id].order;
}
u8 GetItemPalette(u8 id)
s32 GetItemPalette(u8 id)
{
return gItemParametersData[id].palette;
}
@@ -299,7 +298,7 @@ void BufferItemName(u8* dest, u8 id, struct unkStruct_8090F58* a2)
Item unkItem;
strncpy(acStack104, gItemParametersData[id].name, 80);
xxx_init_itemslot_8090A8C(&unkItem, id, 0);
ItemIdToSlot(&unkItem, id, 0);
unkItem.quantity = 1;
sub_8090F58(dest, acStack104, &unkItem, a2);
}
@@ -548,7 +547,7 @@ void ClearItemSlotAt(u32 index)
bool8 sub_809124C(u8 id, u8 param_3)
{
Item temp;
xxx_init_itemslot_8090A8C(&temp, id, param_3);
ItemIdToSlot(&temp, id, param_3);
return AddItemToInventory(&temp);
}
@@ -1201,7 +1200,7 @@ u8 sub_8091E94(s32 a0, s32 a1, s32 a2)
{
s32 id, i, arrId;
u8 foundCategory, ret;
struct UnkDungeonGlobal_unk1C590 data;
struct ItemSpawns data;
s16 rawArray[NUM_ITEM_CATEGORIES + NUMBER_OF_ITEM_IDS];
const u16 *ptr = gUnknown_8108E58[a0 - 1];
+5 -5
View File
@@ -323,7 +323,7 @@ static void sub_8016FF8(void)
break;
case 16:
case 26:
sub_801B3C0(&gKangaskhanStorageWork->storedItem);
InitItemDescriptionWindow(&gKangaskhanStorageWork->storedItem);
break;
case 27:
sub_80177F8();
@@ -669,14 +669,14 @@ static void sub_8017B88(void)
UpdateKangaskhanStorageState(28);
else {
gKangaskhanStorageWork->id = sub_801CB24();
xxx_init_itemslot_8090A8C(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
ItemIdToSlot(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
gKangaskhanStorageWork->storedItem.quantity = 1;
UpdateKangaskhanStorageState(25);
}
break;
case 4:
gKangaskhanStorageWork->id = sub_801CB24();
xxx_init_itemslot_8090A8C(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
ItemIdToSlot(&gKangaskhanStorageWork->storedItem, gKangaskhanStorageWork->id, 0);
gKangaskhanStorageWork->storedItem.quantity = 1;
UpdateKangaskhanStorageState(26);
break;
@@ -785,7 +785,7 @@ static void sub_8017DC0(void)
break;
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateKangaskhanStorageState(14);
break;
}
@@ -800,7 +800,7 @@ static void sub_8017DDC(void)
break;
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateKangaskhanStorageState(23);
break;
}
+6 -6
View File
@@ -168,7 +168,7 @@ static void sub_8018100(void)
sub_8012D60(&sUnknown_203B20C->unk70, sUnknown_203B20C->unk20, 0, sUnknown_203B20C->unk60, sUnknown_203B20C->menuAction2, 2);
break;
case 7:
sub_801B3C0(&sUnknown_203B20C->item);
InitItemDescriptionWindow(&sUnknown_203B20C->item);
break;
case 10:
sub_801C8C4(1, 3, 0, 10);
@@ -202,7 +202,7 @@ static void sub_8018100(void)
sub_8012D60(&sUnknown_203B20C->unk70, sUnknown_203B20C->unk20, 0, sUnknown_203B20C->unk60, sUnknown_203B20C->menuAction3, 2);
break;
case 14:
sub_801B3C0(&sUnknown_203B20C->item);
InitItemDescriptionWindow(&sUnknown_203B20C->item);
break;
case KANGASKHAN_STORAGE_2_INIT:
default:
@@ -447,14 +447,14 @@ static void sub_80186F8(void)
}
else {
sUnknown_203B20C->id = sub_801CB24();
xxx_init_itemslot_8090A8C(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
ItemIdToSlot(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
sUnknown_203B20C->item.quantity = 1;
UpdateKangaskhanStorage2State(13);
}
break;
case 4:
sUnknown_203B20C->id = sub_801CB24();
xxx_init_itemslot_8090A8C(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
ItemIdToSlot(&sUnknown_203B20C->item, sUnknown_203B20C->id, 0);
sUnknown_203B20C->item.quantity = 1;
UpdateKangaskhanStorage2State(14);
break;
@@ -606,7 +606,7 @@ static void sub_8018AC8(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateKangaskhanStorage2State(5);
break;
case 0:
@@ -621,7 +621,7 @@ static void sub_8018AE4(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateKangaskhanStorage2State(11);
break;
case 0:
+5 -5
View File
@@ -394,7 +394,7 @@ static void UpdateKecleonStoreDialogue(void)
break;
case KECLEON_STORE_BUY_ITEM_INFO:
case KECLEON_STORE_SELL_ITEM_INFO:
sub_801B3C0(&sKecleonBrosWork1->soldItem);
InitItemDescriptionWindow(&sKecleonBrosWork1->soldItem);
break;
case KECLEON_STORE_SELL_ITEM_RECEIPT:
if (GetNumberOfFilledInventorySlots() == 0 || gTeamInventoryRef->teamMoney >= MAX_TEAM_MONEY) {
@@ -699,7 +699,7 @@ static void sub_80199CC(void)
item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex);
}
xxx_init_itemslot_8090A8C(&sKecleonBrosWork1->soldItem, item->id, 0);
ItemIdToSlot(&sKecleonBrosWork1->soldItem, item->id, 0);
sKecleonBrosWork1->soldItem.quantity = item->quantity;
sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem);
SetKecleonBrosState(20);
@@ -714,7 +714,7 @@ static void sub_80199CC(void)
item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex);
}
xxx_init_itemslot_8090A8C(&sKecleonBrosWork1->soldItem, item->id, 0);
ItemIdToSlot(&sKecleonBrosWork1->soldItem, item->id, 0);
sKecleonBrosWork1->soldItem.quantity = item->quantity;
sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem);
SetKecleonBrosState(KECLEON_STORE_BUY_ITEM_INFO);
@@ -831,7 +831,7 @@ static void sub_8019D30(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
SetKecleonBrosState(19);
break;
case 0:
@@ -845,7 +845,7 @@ static void sub_8019D4C(void)
switch (sub_801B410()) {
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
SetKecleonBrosState(27);
break;
case 0:
+3 -3
View File
@@ -268,7 +268,7 @@ static void UpdateLuminousCaveDialogue(void)
break;
case 9:
case 14:
sub_801B3C0(&sLuminousCaveWork->chosenItem);
InitItemDescriptionWindow(&sLuminousCaveWork->chosenItem);
break;
case LUMINOUS_CAVE_LACK_WHAT_NEEDED:
sLuminousCaveWork->fallbackState = LUMINOUS_CAVE_GIVE_ITEM_1;
@@ -671,7 +671,7 @@ static void sub_80251CC(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateLuminousCaveState(0x7);
break;
case 0:
@@ -686,7 +686,7 @@ static void sub_80251E8(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
UpdateLuminousCaveState(0xC);
break;
case 0:
+1 -3
View File
@@ -116,9 +116,7 @@ void sub_8075900(Entity *pokemon, u8 r1);
extern u8 sub_8044B28(void);
extern void sub_807EC28(bool8);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_804652C(Entity *, Entity *, Item *, u32, DungeonPos *);
extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
extern void sub_8045C28(Item *, u8 , u8);
static void sub_805A7D4(Entity *, Entity *, Item *, DungeonPos *);
extern void MudWaterSportEffect(u32);
extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32);
@@ -2391,7 +2389,7 @@ bool8 PayDayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4)
if (!EntityIsValid(target)) {
pos.x = 0;
pos.y = 0;
sub_8045C28(&item,ITEM_POKE,2);
CreateItemWithStickyChance(&item,ITEM_POKE,2);
sub_805A7D4(pokemon,target,&item,&pos);
}
}
+2 -2
View File
@@ -229,7 +229,7 @@ void HandlePartyListMenuCallback(void)
break;
case 0x15:
HeldItemToSlot(&item,&sUnknown_203B2B8->item1);
sub_801B3C0(&item);
InitItemDescriptionWindow(&item);
break;
case PARTY_LIST_STATE_MOVES:
unk_CopyMoves4To8(sUnknown_203B2B8->moves,sUnknown_203B2B8->pokeStruct->moves);
@@ -699,7 +699,7 @@ void sub_8026CF0(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
SetPartyListMenuState(PARTY_LIST_STATE_GIVE_ITEM_1);
break;
case 0:
+4 -5
View File
@@ -36,8 +36,7 @@
extern void sub_807F43C(Entity *, Entity *);
extern void HandleOneRoomOrb(Entity *, Entity *);
extern u32 sub_803D73C(u32);
extern void sub_8045C28(Item *, u8 , u8);
extern u32 GetRandomFloorItem(u32);
extern void sub_80464C8(Entity *, DungeonPos *, Item *);
extern void sub_8068FE0(Entity *, u32, Entity *r2);
extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
@@ -524,13 +523,13 @@ bool8 RecycleMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param
{
Item *item = &gTeamInventoryRef->teamItems[i];
if (item->id == ITEM_TM_USED_TM) {
xxx_init_itemslot_8090A8C(item, item->quantity + 0x7d,0);
ItemIdToSlot(item, item->quantity + 0x7d,0);
isTMRecycled = TRUE;
}
}
}
if (ItemExists(&entityInfo->heldItem) && (entityInfo->heldItem.id == ITEM_TM_USED_TM)) {
xxx_init_itemslot_8090A8C(&entityInfo->heldItem,entityInfo->heldItem.quantity + 0x7D,0);
ItemIdToSlot(&entityInfo->heldItem,entityInfo->heldItem.quantity + 0x7D,0);
isTMRecycled = TRUE;
}
}
@@ -1133,7 +1132,7 @@ bool8 ItemizeOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4)
else
{
target->isVisible = FALSE;
sub_8045C28(&stack, sub_803D73C(0), 0);
CreateItemWithStickyChance(&stack, GetRandomFloorItem(0), 0);
sub_80464C8(pokemon, &posStruct, &stack);
sub_8068FE0(target, 0x218, pokemon);
return TRUE;
+4 -4
View File
@@ -411,7 +411,7 @@ void CleanThankYouMailPelipper(void)
MemoryFree(sUnknown_203B2C4);
sUnknown_203B2C4 = NULL;
sub_8030DE4();
sub_801B450();
FreeItemDescriptionWindow();
sub_803084C();
sub_801CBB8();
sub_80155F0();
@@ -663,7 +663,7 @@ void sub_802A28C(void)
RestoreUnkTextStruct_8006518(&sUnknown_203B2C4->unk3BC);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&sUnknown_203B2C4->unk41C);
InitItemDescriptionWindow(&sUnknown_203B2C4->unk41C);
SetThankYouMailMenuState(SHOW_ITEM_TO_SEND_INFO);
break;
}
@@ -675,7 +675,7 @@ void sub_802A33C(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
ResetUnusedInputStruct();
ShowWindows(&sUnknown_203B2C4->unk3BC, TRUE, TRUE);
sub_801CB5C(TRUE);
@@ -714,7 +714,7 @@ void sub_802A39C(void)
RestoreUnkTextStruct_8006518(&sUnknown_203B2C4->unk3BC);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&sUnknown_203B2C4->unk41C);
InitItemDescriptionWindow(&sUnknown_203B2C4->unk41C);
SetThankYouMailMenuState(SHOW_ITEM_TO_SEND_INFO);
break;
case CANCEL_ACTION:
+3 -3
View File
@@ -179,7 +179,7 @@ void sub_80365AC(void)
RestoreUnkTextStruct_8006518(&sTradeItemsMenu->unk1E4);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&sTradeItemsMenu->itemToSend);
InitItemDescriptionWindow(&sTradeItemsMenu->itemToSend);
SetTradeItemMenu(TRADE_ITEMS_ITEM_INFO);
break;
}
@@ -203,7 +203,7 @@ void sub_8036674(void)
RestoreUnkTextStruct_8006518(&sTradeItemsMenu->unk1E4);
ResetUnusedInputStruct();
ShowWindows(NULL, TRUE, TRUE);
sub_801B3C0(&sTradeItemsMenu->itemToSend);
InitItemDescriptionWindow(&sTradeItemsMenu->itemToSend);
SetTradeItemMenu(TRADE_ITEMS_ITEM_INFO);
break;
case 7:
@@ -222,7 +222,7 @@ void sub_8036728(void)
{
case 2:
case 3:
sub_801B450();
FreeItemDescriptionWindow();
ResetUnusedInputStruct();
ShowWindows(&sTradeItemsMenu->unk1E4, TRUE, TRUE);
sub_801CB5C(TRUE);
+2 -5
View File
@@ -57,16 +57,13 @@ extern u32 gUnknown_8106A4C;
extern u32 gUnknown_8106A50;
void sub_806A9B4(Entity *, u32);
void sub_80461C8(DungeonPos *, u32);
void ShowDungeonMapAtPos(s32, s32);
s16 sub_803D970(u32);
bool8 sub_806AA0C(s32, s32);
void sub_80421EC(DungeonPos *, u32);
extern void sub_804687C(Entity *, DungeonPos *, DungeonPos *, Item *, u32);
bool8 sub_8045888(Entity *);
u8 GetFloorType(void);
void sub_8068FE0(Entity *, u32, Entity *);
void sub_8045C28(Item *, u8 , u8);
void sub_8045BF8(u8 *, Item *);
void DealDamageToEntity(Entity *,s16,u32,u32);
void sub_806F480(Entity *, u32);
@@ -503,7 +500,7 @@ void HandleGrimyTrap(Entity *pokemon, Entity *target)
if (((GetItemCategory(itemStack[index]->id) == CATEGORY_FOOD_GUMMIES) && (itemStack[index]->id != ITEM_GRIMY_FOOD)) &&
(DungeonRandInt(100) < gGrimyTrapActivateChance)) {
badFoodCount++;
sub_8045C28(itemStack[index], ITEM_GRIMY_FOOD, 2);
CreateItemWithStickyChance(itemStack[index], ITEM_GRIMY_FOOD, 2);
}
}
if (badFoodCount == 1) {
@@ -767,7 +764,7 @@ void HandlePokemonTrap(Entity *param_1,DungeonPos *pos)
local_50.unk4 = 0;
local_50.unk10 = 0;
if (sub_806B7F8(&local_50, TRUE) != 0) {
sub_80461C8(&local_50.pos,0);
RemoveItemFromDungeonAt(&local_50.pos,0);
counter++;
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ u8 GetApparentWeather(Entity *pokemon)
void sub_807E5AC(void)
{
u8 weather;
weather = gDungeon->unk1C574.unk4;
weather = gDungeon->floorProperties.unk4;
if(weather == WEATHER_COUNT)
weather = DungeonRandInt(WEATHER_COUNT);
sub_807E5E4(weather);
+1 -1
View File
@@ -168,7 +168,7 @@ void CleanWonderMailMenu(void)
MemoryFree(gUnknown_203B3E8);
gUnknown_203B3E8 = NULL;
sub_8030DE4(); // Frees 203B324
sub_801B450(); // Frees 203B230
FreeItemDescriptionWindow(); // Frees 203B230
sub_803084C(); // Frees 203B320
sub_801CBB8(); // Frees 203B244
sub_80155F0(); // Frees 203B1FC