doing some more decomp

This commit is contained in:
Seth Barberee
2022-10-18 18:45:08 -05:00
parent 18d8a1a381
commit 5ecb84bfbc
9 changed files with 115 additions and 210 deletions

View File

@@ -1033,195 +1033,4 @@ _08044B20: .4byte gDungeonGlobalData
_08044B24: .4byte 0x000135cc
thumb_func_end sub_8044AB4
thumb_func_start sub_8044B28
sub_8044B28:
push {r4,lr}
ldr r4, _08044B48
ldr r0, [r4]
ldrb r0, [r0, 0x4]
cmp r0, 0
bne _08044B76
bl GetLeaderEntity
cmp r0, 0
bne _08044B50
ldr r0, [r4]
ldr r1, _08044B4C
adds r0, r1
movs r1, 0x1
strb r1, [r0]
b _08044B76
.align 2, 0
_08044B48: .4byte gDungeonGlobalData
_08044B4C: .4byte 0x00000654
_08044B50:
ldr r0, [r4]
ldrb r2, [r0, 0x2]
cmp r2, 0x1
bne _08044B68
ldr r2, _08044B64
adds r1, r0, r2
movs r0, 0x2
strb r0, [r1]
b _08044B76
.align 2, 0
_08044B64: .4byte 0x00000654
_08044B68:
cmp r2, 0x2
beq _08044B70
movs r0, 0
b _08044B78
_08044B70:
ldr r1, _08044B80
adds r0, r1
strb r2, [r0]
_08044B76:
movs r0, 0x1
_08044B78:
pop {r4}
pop {r1}
bx r1
.align 2, 0
_08044B80: .4byte 0x00000654
thumb_func_end sub_8044B28
thumb_func_start sub_8044B84
sub_8044B84:
push {lr}
ldr r0, _08044B9C
ldr r0, [r0]
ldrb r0, [r0, 0x10]
cmp r0, 0
bne _08044BA0
bl sub_8044B28
lsls r0, 24
lsrs r0, 24
b _08044BA2
.align 2, 0
_08044B9C: .4byte gDungeonGlobalData
_08044BA0:
movs r0, 0x1
_08044BA2:
pop {r1}
bx r1
thumb_func_end sub_8044B84
thumb_func_start sub_8044BA8
sub_8044BA8:
push {r4,r5,lr}
lsls r0, 16
lsrs r4, r0, 16
lsls r1, 24
lsrs r5, r1, 24
cmp r4, 0x26
bne _08044BCC
bl sub_8043D10
lsls r0, 24
lsrs r0, 24
cmp r0, 0x2
bne _08044BCC
ldr r0, _08044BC8
b _08044C02
.align 2, 0
_08044BC8: .4byte gUnknown_80F91EC
_08044BCC:
ldr r1, _08044BEC
lsls r0, r4, 3
adds r4, r0, r1
ldr r0, [r4]
ldr r1, _08044BF0
bl strcmp
cmp r0, 0
beq _08044BE0
movs r0, 0x1
_08044BE0:
lsls r0, 24
cmp r0, 0
beq _08044BF4
ldr r0, [r4]
b _08044C04
.align 2, 0
_08044BEC: .4byte gUnknown_80F7C50
_08044BF0: .4byte gUnknown_80F697C
_08044BF4:
ldr r4, _08044C0C
adds r0, r5, 0
bl GetItemCategory
lsls r0, 3
adds r4, 0x4
adds r0, r4
_08044C02:
ldr r0, [r0]
_08044C04:
pop {r4,r5}
pop {r1}
bx r1
.align 2, 0
_08044C0C: .4byte gActions
thumb_func_end sub_8044BA8
thumb_func_start sub_8044C10
sub_8044C10:
push {r4,lr}
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sub_8083654
adds r2, r0, 0
adds r1, r2, 0
adds r1, 0x44
movs r3, 0
movs r0, 0
strh r0, [r1]
cmp r4, 0
beq _08044C44
adds r0, r2, 0
adds r0, 0x48
strb r3, [r0]
adds r0, 0x8
strb r3, [r0]
adds r1, 0x14
ldr r0, _08044C4C
strh r0, [r1]
adds r1, 0x2
movs r0, 0x1
negs r0, r0
strh r0, [r1]
_08044C44:
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08044C4C: .4byte 0x0000ffff
thumb_func_end sub_8044C10
thumb_func_start sub_8044C50
sub_8044C50:
push {r4,lr}
adds r4, r0, 0
lsls r4, 16
lsrs r4, 16
bl sub_8083654
adds r2, r0, 0
adds r0, 0x44
movs r1, 0
strh r4, [r0]
adds r0, 0x4
strb r1, [r0]
adds r0, 0x8
strb r1, [r0]
adds r1, r2, 0
adds r1, 0x58
ldr r0, _08044C84
strh r0, [r1]
adds r1, 0x2
movs r0, 0x1
negs r0, r0
strh r0, [r1]
pop {r4}
pop {r0}
bx r0
.align 2, 0
_08044C84: .4byte 0x0000ffff
thumb_func_end sub_8044C50
.align 2, 0

View File

@@ -2907,7 +2907,7 @@ sub_805EFB4:
mov r8, r0
lsls r1, 24
lsrs r7, r1, 24
bl sub_8083654
bl GetLeaderEntityData
adds r6, r0, 0
cmp r7, 0
beq _0805EFE2
@@ -3146,7 +3146,7 @@ _0805F19C: .4byte gUnknown_80F9BB0
thumb_func_start sub_805F1A0
sub_805F1A0:
push {lr}
bl sub_8083654
bl GetLeaderEntityData
adds r0, 0x44
pop {r1}
bx r1
@@ -3155,7 +3155,7 @@ sub_805F1A0:
thumb_func_start sub_805F1AC
sub_805F1AC:
push {lr}
bl sub_8083654
bl GetLeaderEntityData
adds r0, 0x44
ldrh r0, [r0]
pop {r1}
@@ -3638,7 +3638,7 @@ _0805F5B0:
movs r2, 0x1
movs r3, 0x1
bl sub_804A728
bl sub_8083654
bl GetLeaderEntityData
adds r0, 0x48
strb r7, [r0]
movs r0, 0
@@ -3726,7 +3726,7 @@ _0805F65C:
cmp r0, 0
beq _0805F64E
_0805F676:
bl sub_8083654
bl GetLeaderEntityData
adds r0, 0x48
strb r7, [r0]
cmp r4, r7
@@ -7991,7 +7991,7 @@ _08061994:
subs r0, 0x1
cmp r0, r9
bge _08061994
bl sub_8083654
bl GetLeaderEntityData
ldrb r1, [r0, 0x9]
add r0, sp, 0x4
bl GetAvailTacticsforLvl

View File

@@ -5,15 +5,6 @@
.text
thumb_func_start sub_8083654
sub_8083654:
push {lr}
bl GetLeaderEntity
ldr r0, [r0, 0x70]
pop {r1}
bx r1
thumb_func_end sub_8083654
thumb_func_start sub_8083660
sub_8083660:
push {r4-r7,lr}

View File

@@ -35,7 +35,7 @@ struct DungeonGlobalData
u8 unkC;
u8 unkD[0xF - 0xD];
/* 0xF */ bool8 inputAllowed; // Whether the game is currently accepting input. Set to false while action animations play.
u8 fill10;
u8 unk10;
u8 unk11;
s16 unk12;
u8 fill14[0x16D - 0x14];
@@ -47,7 +47,9 @@ struct DungeonGlobalData
/* 0x57C */ u8 fill57C[0x644 - 0x57c];
/* 0x644 */ u8 unk644;
/* 0x645 */ u8 floorNumber;
u8 fill646[0x65C - 0x646];
u8 fill646[0x654 - 0x646];
u8 unk654;
u8 fill655[0x65C - 0x655];
u8 unk65C;
u8 fill65D[0x660 - 0x65D];
/* 0x660 */ s16 speedTurnCounter; // Handles turn order when Pokémon have different movement speeds.

View File

@@ -2,5 +2,6 @@
#define GUARD_DUNGEON_LEADER_H
struct DungeonEntity* GetLeaderEntity();
struct DungeonEntityData* GetLeaderEntityData(void);
#endif

View File

@@ -88,7 +88,7 @@ s32 GetItemBuyPrice(u8 itemIndex);
s32 GetItemSellPrice(u8 itemIndex);
s32 GetItemOrder(u8 itemIndex);
u8 GetItemPalette(u8 itemIndex);
u8 GetItemCategory(u8 itemIndex);
u32 GetItemCategory(u8 itemIndex);
u32 GetItemUnkThrow(u8 itemIndex, u32 r1);
u8 *GetItemDescription(u8 itemIndex);
bool8 GetItemAIFlag(u8 itemIndex, u32 r1);

View File

@@ -3,7 +3,104 @@
#include "constants/dungeon_action.h"
#include "dungeon_entity.h"
#include "dungeon_global_data.h"
#include "dungeon_leader.h"
#include "pokemon.h"
#include "item.h"
extern u8 *gUnknown_80F91EC[];
extern u8 *gUnknown_80F7C50[];
extern u8 gUnknown_80F697C[];
struct ItemText
{
u8 *desc;
u8 *useText;
};
extern const struct ItemText gActions[];
extern u8 sub_8043D10(void);
extern bool8 sub_8044B28(void);
bool8 sub_8044B28(void)
{
if (gDungeonGlobalData->unk4 == 0) {
if (GetLeaderEntity() == NULL) {
gDungeonGlobalData->unk654 = 1;
}
else if (gDungeonGlobalData->unk2 == 1) {
gDungeonGlobalData->unk654 = 2;
}
else if (gDungeonGlobalData->unk2 != 2) {
return FALSE;
}
else {
gDungeonGlobalData->unk654 = 2;
}
}
return TRUE;
}
bool8 sub_8044B84(void)
{
if(gDungeonGlobalData->unk10 != 0)
{
return TRUE;
}
else {
return sub_8044B28();
}
}
u8 *sub_8044BA8(u16 param_1, u8 itemIndex)
{
u32 uVar3;
u32 uVar4;
if ((param_1 == 0x26) && (sub_8043D10() == 2)) {
return *gUnknown_80F91EC;
}
else {
uVar3 = uVar4 = strcmp(gUnknown_80F7C50[param_1 << 1], gUnknown_80F697C);
if (uVar3 != 0) {
uVar4 = 1;
}
if ((u8)(uVar4) == 0) {
return gActions[GetItemCategory(itemIndex)].useText;
}
else
{
return gUnknown_80F7C50[param_1 << 1];
}
}
}
void sub_8044C10(u8 param_1)
{
struct DungeonEntityData * entityData = GetLeaderEntityData();
entityData->action.action = DUNGEON_ACTION_NONE;
if(param_1)
{
entityData->action.actionUseIndex = 0;
entityData->action.unkC = 0;
entityData->itemTargetPosition.x = -1;
entityData->itemTargetPosition.y = -1;
}
}
void sub_8044C50(u16 action)
{
struct DungeonEntityData * entityData = GetLeaderEntityData();
entityData->action.action = action;
entityData->action.actionUseIndex = 0;
entityData->action.unkC = 0;
entityData->itemTargetPosition.x = -1;
entityData->itemTargetPosition.y = -1;
}
void ResetAction(struct DungeonActionContainer *actionPointer)
{

View File

@@ -25,3 +25,8 @@ struct DungeonEntity* GetLeaderEntity()
}
return leader;
}
struct DungeonEntityData* GetLeaderEntityData(void)
{
return GetLeaderEntity()->entityData;
}

View File

@@ -281,7 +281,7 @@ u8 GetItemPalette(u8 itemIndex)
return gItemParametersData[itemIndex].palette;
}
u8 GetItemCategory(u8 itemIndex)
u32 GetItemCategory(u8 itemIndex)
{
return gItemParametersData[itemIndex].category;
}