mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-11-16 11:37:40 +01:00
through sub_81CF278
This commit is contained in:
parent
f5e18718d9
commit
18f29c566a
@ -5,275 +5,6 @@
|
||||
|
||||
@ File centered around AllocSubstruct(7)
|
||||
|
||||
|
||||
|
||||
thumb_func_start sub_81CF0D0
|
||||
sub_81CF0D0: @ 81CF0D0
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x20]
|
||||
adds r0, 0x4
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF0D0
|
||||
|
||||
thumb_func_start sub_81CF0E0
|
||||
sub_81CF0E0: @ 81CF0E0
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x20]
|
||||
ldrh r0, [r0]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF0E0
|
||||
|
||||
thumb_func_start sub_81CF0F0
|
||||
sub_81CF0F0: @ 81CF0F0
|
||||
push {r4,lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
adds r4, r0, 0
|
||||
bl GetSelectedMatchCall
|
||||
ldr r1, [r4, 0x20]
|
||||
lsls r0, 2
|
||||
adds r1, r0
|
||||
ldrh r0, [r1, 0x6]
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF0F0
|
||||
|
||||
thumb_func_start sub_81CF10C
|
||||
sub_81CF10C: @ 81CF10C
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
ldr r0, [r0, 0x20]
|
||||
ldrh r0, [r0, 0x2]
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF10C
|
||||
|
||||
thumb_func_start sub_81CF11C
|
||||
sub_81CF11C: @ 81CF11C
|
||||
push {lr}
|
||||
ldr r2, =gUnknown_086233B4
|
||||
lsls r1, r0, 2
|
||||
adds r1, r2
|
||||
ldr r1, [r1]
|
||||
bl _call_via_r1
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81CF11C
|
||||
|
||||
thumb_func_start sub_81CF134
|
||||
sub_81CF134: @ 81CF134
|
||||
push {r4-r6,lr}
|
||||
sub sp, 0x4
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
adds r6, r0, 0
|
||||
ldr r0, [r6, 0x20]
|
||||
movs r1, 0
|
||||
strh r1, [r0]
|
||||
ldr r0, [r6, 0x20]
|
||||
strh r1, [r0, 0x2]
|
||||
ldr r1, =0xffffff00
|
||||
ldr r0, [sp]
|
||||
ands r0, r1
|
||||
movs r1, 0xE
|
||||
orrs r0, r1
|
||||
str r0, [sp]
|
||||
movs r5, 0
|
||||
_081CF158:
|
||||
movs r0, 0x64
|
||||
adds r1, r5, 0
|
||||
muls r1, r0
|
||||
ldr r0, =gPlayerParty
|
||||
adds r4, r1, r0
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x5
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
beq _081CF1AA
|
||||
adds r0, r4, 0
|
||||
movs r1, 0x6
|
||||
bl GetMonData
|
||||
cmp r0, 0
|
||||
bne _081CF1A4
|
||||
lsls r1, r5, 24
|
||||
lsrs r1, 16
|
||||
ldr r2, =0xffff00ff
|
||||
ldr r0, [sp]
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
str r0, [sp]
|
||||
ldr r1, [r6, 0x14]
|
||||
adds r0, r4, 0
|
||||
bl GetMonData
|
||||
lsls r0, 16
|
||||
ldr r2, =0x0000ffff
|
||||
ldr r1, [sp]
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
str r1, [sp]
|
||||
adds r0, r6, 0
|
||||
mov r1, sp
|
||||
bl sub_81CF2C4
|
||||
_081CF1A4:
|
||||
adds r5, 0x1
|
||||
cmp r5, 0x5
|
||||
ble _081CF158
|
||||
_081CF1AA:
|
||||
movs r0, 0x1
|
||||
add sp, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end sub_81CF134
|
||||
|
||||
thumb_func_start sub_81CF1C4
|
||||
sub_81CF1C4: @ 81CF1C4
|
||||
push {lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
movs r1, 0
|
||||
str r1, [r0, 0x10]
|
||||
str r1, [r0, 0xC]
|
||||
movs r0, 0x1
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF1C4
|
||||
|
||||
thumb_func_start sub_81CF1D8
|
||||
sub_81CF1D8: @ 81CF1D8
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0x4
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
adds r6, r0, 0
|
||||
ldr r5, [r6, 0xC]
|
||||
ldr r4, [r6, 0x10]
|
||||
movs r0, 0
|
||||
mov r8, r0
|
||||
cmp r5, 0xD
|
||||
bgt _081CF268
|
||||
_081CF1F4:
|
||||
cmp r4, 0x1D
|
||||
bgt _081CF260
|
||||
lsls r0, r5, 24
|
||||
lsrs r7, r0, 24
|
||||
_081CF1FC:
|
||||
adds r0, r5, 0
|
||||
adds r1, r4, 0
|
||||
bl CheckBoxMonSanityAt
|
||||
cmp r0, 0
|
||||
beq _081CF23A
|
||||
ldr r1, =0xffffff00
|
||||
ldr r0, [sp]
|
||||
ands r0, r1
|
||||
orrs r0, r7
|
||||
lsls r1, r4, 24
|
||||
lsrs r1, 24
|
||||
lsls r3, r1, 8
|
||||
ldr r2, =0xffff00ff
|
||||
ands r0, r2
|
||||
orrs r0, r3
|
||||
str r0, [sp]
|
||||
ldr r2, [r6, 0x14]
|
||||
adds r0, r7, 0
|
||||
bl GetBoxMonDataAt
|
||||
lsls r0, 16
|
||||
ldr r2, =0x0000ffff
|
||||
ldr r1, [sp]
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
str r1, [sp]
|
||||
adds r0, r6, 0
|
||||
mov r1, sp
|
||||
bl sub_81CF2C4
|
||||
_081CF23A:
|
||||
movs r0, 0x1
|
||||
add r8, r0
|
||||
adds r4, 0x1
|
||||
mov r0, r8
|
||||
cmp r0, 0xE
|
||||
ble _081CF25C
|
||||
str r5, [r6, 0xC]
|
||||
str r4, [r6, 0x10]
|
||||
movs r0, 0x3
|
||||
b _081CF26A
|
||||
.pool
|
||||
_081CF25C:
|
||||
cmp r4, 0x1D
|
||||
ble _081CF1FC
|
||||
_081CF260:
|
||||
movs r4, 0
|
||||
adds r5, 0x1
|
||||
cmp r5, 0xD
|
||||
ble _081CF1F4
|
||||
_081CF268:
|
||||
movs r0, 0x1
|
||||
_081CF26A:
|
||||
add sp, 0x4
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF1D8
|
||||
|
||||
thumb_func_start sub_81CF278
|
||||
sub_81CF278: @ 81CF278
|
||||
push {r4-r6,lr}
|
||||
movs r0, 0x7
|
||||
bl GetSubstructPtr
|
||||
adds r5, r0, 0
|
||||
ldr r0, [r5, 0x20]
|
||||
ldrh r6, [r0]
|
||||
ldrh r4, [r0, 0x6]
|
||||
movs r1, 0x1
|
||||
strh r1, [r0, 0x6]
|
||||
movs r3, 0x1
|
||||
cmp r3, r6
|
||||
bge _081CF2B8
|
||||
_081CF292:
|
||||
ldr r2, [r5, 0x20]
|
||||
lsls r0, r3, 2
|
||||
adds r1, r2, r0
|
||||
ldrh r0, [r1, 0x6]
|
||||
cmp r0, r4
|
||||
bne _081CF2AC
|
||||
subs r0, r3, 0x1
|
||||
lsls r0, 2
|
||||
adds r0, r2, r0
|
||||
ldrh r0, [r0, 0x6]
|
||||
strh r0, [r1, 0x6]
|
||||
adds r0, r3, 0x1
|
||||
b _081CF2B2
|
||||
_081CF2AC:
|
||||
adds r4, r0, 0
|
||||
adds r0, r3, 0x1
|
||||
strh r0, [r1, 0x6]
|
||||
_081CF2B2:
|
||||
adds r3, r0, 0
|
||||
cmp r3, r6
|
||||
blt _081CF292
|
||||
_081CF2B8:
|
||||
movs r0, 0x1
|
||||
str r0, [r5, 0x18]
|
||||
movs r0, 0x4
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81CF278
|
||||
|
||||
thumb_func_start sub_81CF2C4
|
||||
sub_81CF2C4: @ 81CF2C4
|
||||
push {r4-r7,lr}
|
||||
|
@ -7,16 +7,18 @@
|
||||
|
||||
typedef u32 (*LoopedTask)(s32 state);
|
||||
|
||||
struct PokenavMonList
|
||||
{
|
||||
u8 boxId;
|
||||
u8 monId;
|
||||
u16 unk6;
|
||||
};
|
||||
|
||||
struct PokenavSub18
|
||||
{
|
||||
u16 unk0;
|
||||
u16 unk2;
|
||||
struct PokenavMonList
|
||||
{
|
||||
u8 boxId;
|
||||
u8 monId;
|
||||
u16 unk6;
|
||||
} unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE];
|
||||
struct PokenavMonList unk4[TOTAL_BOXES_COUNT * IN_BOX_COUNT + PARTY_SIZE];
|
||||
};
|
||||
|
||||
// Return values of LoopedTask functions.
|
||||
|
@ -3,20 +3,39 @@
|
||||
#include "bg.h"
|
||||
#include "window.h"
|
||||
|
||||
u32 sub_81CF134(void);
|
||||
u32 sub_81CF1C4(void);
|
||||
u32 sub_81CF1D8(void);
|
||||
u32 sub_81CF278(void);
|
||||
u32 sub_81CF578(s32);
|
||||
u32 sub_81CF5F0(s32);
|
||||
u32 sub_81CF668(s32);
|
||||
u32 sub_81CF6E0(s32);
|
||||
u32 sub_81CF758(s32);
|
||||
u32 sub_81CF798(s32);
|
||||
struct PokenavSub7
|
||||
{
|
||||
u32 (*unk0)(struct PokenavSub7 *);
|
||||
u32 loopedTaskId;
|
||||
u8 fill1[4];
|
||||
s32 unkC;
|
||||
s32 unk10;
|
||||
u32 unk14;
|
||||
u32 unk18;
|
||||
u32 unk1C;
|
||||
struct PokenavSub18 *unkPtr;
|
||||
};
|
||||
|
||||
u32 sub_81CF010(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF030(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B8(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B0(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF11C(s32 state);
|
||||
u32 sub_81CF134(s32 state);
|
||||
u32 sub_81CF1C4(s32 state);
|
||||
u32 sub_81CF1D8(s32 state);
|
||||
u32 sub_81CF278(s32 state);
|
||||
u32 sub_81CF578(s32 state);
|
||||
u32 sub_81CF5F0(s32 state);
|
||||
u32 sub_81CF668(s32 state);
|
||||
u32 sub_81CF6E0(s32 state);
|
||||
u32 sub_81CF758(s32 state);
|
||||
u32 sub_81CF798(s32 state);
|
||||
void sub_81CF2C4(struct PokenavSub7 *structPtr, struct PokenavMonList *item);
|
||||
|
||||
const u32 gUnknown_086233A0[] = {0x16, 0x17, 0x18, 0x21, 0x2F};
|
||||
|
||||
u32 (*const gUnknown_086233B4[])(void) =
|
||||
const LoopedTask gUnknown_086233B4[] =
|
||||
{
|
||||
sub_81CF134,
|
||||
sub_81CF1C4,
|
||||
@ -77,23 +96,6 @@ const u8 gUnknown_086235BC[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_RED}{WHITE}{GRE
|
||||
const u8 gUnknown_086235C8[] = _("{COLOR_HIGHLIGHT_SHADOW}{LIGHT_GREEN}{WHITE}{BLUE}♀{COLOR_HIGHLIGHT_SHADOW}{DARK_GREY}{WHITE}{LIGHT_GREY}");
|
||||
const u8 gUnknown_086235D4[] = _("{UNK_SPACER}");
|
||||
|
||||
struct PokenavSub7
|
||||
{
|
||||
u32 (*unk0)(struct PokenavSub7 *);
|
||||
u32 loopedTaskId;
|
||||
u8 fill1[12];
|
||||
u32 unk14;
|
||||
u32 unk18;
|
||||
u32 unk1C;
|
||||
struct PokenavSub18 *unkPtr;
|
||||
};
|
||||
|
||||
u32 sub_81CF010(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF030(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B8(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF0B0(struct PokenavSub7 *structPtr);
|
||||
u32 sub_81CF11C(s32 state);
|
||||
|
||||
bool32 sub_81CEF3C(void)
|
||||
{
|
||||
struct PokenavSub7 *structPtr = AllocSubstruct(7, sizeof(struct PokenavSub7));
|
||||
@ -187,3 +189,124 @@ u32 sub_81CF0C0(void)
|
||||
struct PokenavSub7 *structPtr = GetSubstructPtr(7);
|
||||
return structPtr->unk18;
|
||||
}
|
||||
|
||||
struct PokenavMonList * sub_81CF0D0(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
return ptr->unkPtr->unk4;
|
||||
}
|
||||
|
||||
u16 sub_81CF0E0(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
return ptr->unkPtr->unk0;
|
||||
}
|
||||
|
||||
u16 sub_81CF0F0(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
s32 i = GetSelectedMatchCall();
|
||||
return ptr->unkPtr->unk4[i].unk6;
|
||||
}
|
||||
|
||||
u16 sub_81CF10C(void)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
return ptr->unkPtr->unk2;
|
||||
}
|
||||
|
||||
u32 sub_81CF11C(s32 state)
|
||||
{
|
||||
return gUnknown_086233B4[state](state);
|
||||
}
|
||||
|
||||
u32 sub_81CF134(s32 state)
|
||||
{
|
||||
s32 i;
|
||||
struct PokenavMonList item;
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
|
||||
ptr->unkPtr->unk0 = 0;
|
||||
ptr->unkPtr->unk2 = 0;
|
||||
item.boxId = 14;
|
||||
for (i = 0; i < PARTY_SIZE; i++)
|
||||
{
|
||||
struct Pokemon * pokemon = &gPlayerParty[i];
|
||||
if (!GetMonData(pokemon, MON_DATA_SANITY_HAS_SPECIES))
|
||||
return LT_INC_AND_CONTINUE;
|
||||
if (!GetMonData(pokemon, MON_DATA_SANITY_IS_EGG))
|
||||
{
|
||||
item.monId = i;
|
||||
item.unk6 = GetMonData(pokemon, ptr->unk14);
|
||||
sub_81CF2C4(ptr, &item);
|
||||
}
|
||||
}
|
||||
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
|
||||
u32 sub_81CF1C4(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
ptr->unk10 = 0;
|
||||
ptr->unkC = 0;
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
|
||||
u32 sub_81CF1D8(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
s32 boxId = ptr->unkC;
|
||||
s32 monId = ptr->unk10;
|
||||
s32 boxCount = 0;
|
||||
struct PokenavMonList item;
|
||||
|
||||
while (boxId < TOTAL_BOXES_COUNT)
|
||||
{
|
||||
while (monId < IN_BOX_COUNT)
|
||||
{
|
||||
if (CheckBoxMonSanityAt(boxId, monId))
|
||||
{
|
||||
item.boxId = boxId;
|
||||
item.monId = monId;
|
||||
item.unk6 = GetBoxMonDataAt(boxId, monId, ptr->unk14);
|
||||
sub_81CF2C4(ptr, &item);
|
||||
}
|
||||
boxCount++;
|
||||
monId++;
|
||||
if (boxCount > 14)
|
||||
{
|
||||
ptr->unkC = boxId;
|
||||
ptr->unk10 = monId;
|
||||
return LT_CONTINUE;
|
||||
}
|
||||
}
|
||||
monId = 0;
|
||||
boxId++;
|
||||
}
|
||||
|
||||
return LT_INC_AND_CONTINUE;
|
||||
}
|
||||
|
||||
u32 sub_81CF278(s32 state)
|
||||
{
|
||||
struct PokenavSub7 * ptr = (struct PokenavSub7 *)GetSubstructPtr(7);
|
||||
s32 r6 = ptr->unkPtr->unk0;
|
||||
s32 r4 = ptr->unkPtr->unk4[0].unk6;
|
||||
s32 i;
|
||||
ptr->unkPtr->unk4[0].unk6 = 1;
|
||||
for (i = 1; i < r6; i++)
|
||||
{
|
||||
if (ptr->unkPtr->unk4[i].unk6 == r4)
|
||||
{
|
||||
ptr->unkPtr->unk4[i].unk6 = ptr->unkPtr->unk4[i - 1].unk6;
|
||||
}
|
||||
else
|
||||
{
|
||||
r4 = ptr->unkPtr->unk4[i].unk6;
|
||||
ptr->unkPtr->unk4[i].unk6 = i + 1;
|
||||
}
|
||||
}
|
||||
ptr->unk18 = 1;
|
||||
return LT_FINISH;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user