decomp another func and document a few more fields in gDungeon

This commit is contained in:
Seth Barberee 2023-04-08 19:38:28 -07:00
parent bdc4684e95
commit 870de4e482
3 changed files with 54 additions and 75 deletions

View File

@ -5,75 +5,6 @@
.text
thumb_func_start sub_8045C28
sub_8045C28:
push {r4-r7,lr}
adds r5, r0, 0
adds r6, r2, 0
lsls r1, 24
lsrs r4, r1, 24
adds r1, r4, 0
movs r2, 0
bl xxx_init_itemslot_8090A8C
movs r7, 0
adds r0, r4, 0
bl IsNotSpecialItem
lsls r0, 24
cmp r0, 0
beq _08045C72
cmp r6, 0
bne _08045C6C
movs r0, 0x64
bl DungeonRandInt
ldr r1, _08045C64
ldr r1, [r1]
ldr r2, _08045C68
adds r1, r2
ldrb r1, [r1]
cmp r0, r1
bge _08045C72
b _08045C76
.align 2, 0
_08045C64: .4byte gDungeon
_08045C68: .4byte 0x0001c57e
_08045C6C:
cmp r6, 0x1
bne _08045C72
movs r7, 0x1
_08045C72:
cmp r7, 0
beq _08045C7E
_08045C76:
ldrb r1, [r5]
movs r0, 0x8
orrs r0, r1
strb r0, [r5]
_08045C7E:
adds r0, r4, 0
bl GetItemCategory
lsls r0, 24
lsrs r0, 24
cmp r0, 0x6
bne _08045CA2
ldr r0, _08045CA8
ldr r0, [r0]
ldr r1, _08045CAC
adds r0, r1
ldrb r0, [r0]
lsls r1, r0, 2
adds r1, r0
lsls r1, 3
adds r0, r5, 0
bl sub_8046CE4
_08045CA2:
pop {r4-r7}
pop {r0}
bx r0
.align 2, 0
_08045CA8: .4byte gDungeon
_08045CAC: .4byte 0x0001c58b
thumb_func_end sub_8045C28
thumb_func_start sub_8045CB0
sub_8045CB0:
push {r4-r7,lr}

View File

@ -121,7 +121,9 @@ struct Dungeon
/* 0x37F8 */ bool8 plusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FA */ bool8 minusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FC */ bool8 decoyActive;
u8 fill37FD[0x3A08 - 0x37FD];
u8 fill37FD[0x3904 - 0x37FD];
/* 0x3904 */ u16 unk3904;
u8 fill3906[0x3A08 - 0x3906];
/* 0x3A08 */ u8 unk3A08;
u8 fill3A09[0x3A0D - 0x3A09];
/* 0x3A0D */ u8 unk3A0D;
@ -172,8 +174,12 @@ struct Dungeon
/* 0x1357C */ struct Entity *teamPokemon[MAX_TEAM_MEMBERS];
/* 0x1358C */ struct Entity *wildPokemon[DUNGEON_MAX_WILD_POKEMON];
/* 0x135CC */ struct Entity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon
/* 0x1361C */ struct Entity *clientPokemon[2]; // Not sure how large this array is.
u8 fill13624[0x17B2C - 0x13624];
/* 0x1361C */ struct Entity *clientPokemon[0x40];
/* 0x1371C */ struct Entity *unk1371C[0x40];
/* 0x1381C */ struct Entity teamPokemonEntities[MAX_TEAM_MEMBERS];
/* 0x139EC */ struct Entity wildPokemonEntities[DUNGEON_MAX_WILD_POKEMON];
/* 0x1412C */ struct Entity clientPokemonEntities[0x40];
/* 0x15E2C */ struct Entity unk15E2C[0x40];
/* 0x17B2C */ struct Entity *lightningRodPokemon;
/* 0x17B30 */ struct Entity *snatchPokemon;
/* 0x17B34 */ u8 fillunk1734[0x17B38 - 0x17B34];
@ -198,8 +204,12 @@ struct Dungeon
u8 unk18217;
u8 fill18218[0x1C578 - 0x18218];
u8 unk1C578;
u8 fill1C579[0x1CE98 - 0x1C579];
/* 0x1CE98 */ struct unkDungeonGlobal_unk1CE98_sub unk1CE98;
u8 fill1C579[0x1C57E - 0x1C579];
u8 unk1C57E;
u8 fill1C57F[0x1C58B - 0x1C57F];
u8 unk1C58B;
u8 fill1C58C[0x1CE98 - 0x1C58C];
struct unkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is
u32 unk1CEC8;
/* 0x1CECC */ struct DungeonMusicPlayer musPlayer;
};

View File

@ -1,6 +1,9 @@
#include "global.h"
#include "constants/item.h"
#include "dungeon_global_data.h"
#include "dungeon_util.h"
#include "dungeon_random.h"
#include "item.h"
extern u8 *gUnknown_80FE6F4[];
extern struct unkStruct_8090F58 gUnknown_80F699C;
@ -10,8 +13,9 @@ extern struct unkStruct_8090F58 gUnknown_80F6990;
extern struct EntityInfo* GetTrapData_1(struct Entity *entity);
extern void SetMessageArgument_2(u8 *, struct EntityInfo *, u32);
extern void GetTrapName(u8 *, u8);
extern bool8 IsNotSpecialItem(u8 id);
void sub_8045BF8(u8 *, struct Item *);
void sub_8046CE4(void *param_1,u32 param_2);
void sub_8045ACC(void)
{
@ -90,3 +94,37 @@ void sub_8045C18(u8 *buffer, struct Item *item)
{
sub_8090E14(buffer, item, &gUnknown_80F6990);
}
void sub_8045C28(struct Item *Item, u8 itemID, u32 param_3)
{
bool8 stickyFlag;
u32 total;
xxx_init_itemslot_8090A8C(Item,itemID,0);
stickyFlag = FALSE;
if (IsNotSpecialItem(itemID)) {
if (param_3 == 0) {
if (DungeonRandInt(100) >= gDungeon->unk1C57E)
{
goto _short;
}
else
{
goto _store;
}
}
else if (param_3 == 1) {
stickyFlag = TRUE;
}
}
_short:
if (stickyFlag)
_store:
Item->flags = Item->flags | ITEM_FLAG_STICKY;
if (GetItemCategory(itemID) == CATEGORY_POKE) {
// FIXME: total hack but too lazy to figure out array for now
total = (gDungeon->unk1C58B << 2) + gDungeon->unk1C58B;
total <<= 3;
sub_8046CE4(Item, total);
}
}