decomp sub_8048D50

This commit is contained in:
Seth Barberee 2022-05-29 12:03:10 -07:00
parent 7780e0eba6
commit 3a3a2b9c27
3 changed files with 32 additions and 53 deletions

View File

@ -723,56 +723,4 @@ _08048D40:
bx r1
thumb_func_end sub_8048B9C
thumb_func_start sub_8048D50
sub_8048D50:
push {r4,lr}
adds r4, r0, 0
adds r2, r1, 0
ldr r3, [r4, 0x70]
ldrb r1, [r2]
movs r0, 0x8
ands r0, r1
cmp r0, 0
beq _08048D78
ldr r0, _08048D70
adds r1, r2, 0
bl sub_8045BF8
ldr r0, _08048D74
b _08048D9A
.align 2, 0
_08048D70: .4byte gUnknown_202DE58
_08048D74: .4byte gUnknown_80FE3E8
_08048D78:
adds r0, r3, 0
adds r0, 0xEC
ldrb r0, [r0]
cmp r0, 0x1
bne _08048DB0
ldrb r0, [r2, 0x2]
bl IsEdibleItem
lsls r0, 24
cmp r0, 0
beq _08048DB0
ldr r0, _08048DA8
adds r1, r4, 0
movs r2, 0
bl SetMessageArgument
ldr r0, _08048DAC
_08048D9A:
ldr r1, [r0]
adds r0, r4, 0
bl SendMessage
movs r0, 0
b _08048DB2
.align 2, 0
_08048DA8: .4byte gAvailablePokemonNames
_08048DAC: .4byte gUnknown_80FDCA4
_08048DB0:
movs r0, 0x1
_08048DB2:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8048D50
.align 2, 0

View File

@ -118,6 +118,7 @@ bool8 AddHeldItemToInventory(struct HeldItem* slot);
bool8 IsNotMoneyOrUsedTMItem(u8 id);
s32 FindItemInInventory(u8 itemIndex);
bool8 IsHMItem(u8 id);
bool8 IsEdibleItem(u8 id);
void RestoreHeldItem(struct unkStruct_8094924*, struct HeldItem*);

View File

@ -1,7 +1,8 @@
#include "global.h"
#include "constants/status.h"
#include "code_80521D0.h"
#include "dungeon_random.h"
#include "item.h"
extern void sub_803E708(u32, u32);
extern void sub_80421C0(struct DungeonEntity *r0, u16 r1);
@ -12,6 +13,9 @@ extern void sub_8076210(struct DungeonEntity *, u32, u32, u32);
extern void sub_8077780(struct DungeonEntity *, u32, u32);
extern void sub_8076E20(struct DungeonEntity *, u32, u32, u32, u32, u32);
extern u8 gAvailablePokemonNames[];
extern u8 gUnknown_202DE58[];
extern u8 *gPtrMusicBoxPlayedCrumbledMessage[];
extern u8 *gPtrWishStoneCrumbledMessage[];
extern u8 *gPtrIcePartCrumbledMessage[];
@ -22,7 +26,33 @@ extern u32 gUnknown_8106A50;
extern s16 gUnknown_80F4FAC;
extern void sub_806F370(struct DungeonEntity *r0, struct DungeonEntity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32);
extern void sub_8051E7C(struct DungeonEntity *pokemon);
extern void sub_8045BF8(u8 *, struct ItemSlot *);
extern void SetMessageArgument(char[], struct DungeonEntity*, u32);
extern u8 *gUnknown_80FDCA4[];
extern u8 *gUnknown_80FE3E8[];
bool8 sub_8048D50(struct DungeonEntity * param_1,struct ItemSlot *param_2)
{
struct DungeonEntityData *iVar2;
iVar2 = param_1->entityData;
if ((param_2->itemFlags & ITEM_FLAG_STICKY) != 0) {
sub_8045BF8(gUnknown_202DE58,param_2);
SendMessage(param_1,*gUnknown_80FE3E8);
return FALSE;
}
else
{
if ((iVar2->muzzledStatus == MUZZLED_STATUS_MUZZLED) && (IsEdibleItem(param_2->itemIndex))) {
SetMessageArgument(gAvailablePokemonNames,param_1,0);
SendMessage(param_1,*gUnknown_80FDCA4);
return FALSE;
}
}
return TRUE;
}
void sub_8048DB8(struct DungeonEntity *pokemon, struct DungeonEntity *r1, u8 r2)
{