Decompile heal location functions

This commit is contained in:
PikalaxALT 2017-10-28 20:55:01 -04:00
parent 6fcde15bb6
commit 00f4bba6d8
6 changed files with 49 additions and 94 deletions

View File

@ -1,83 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.syntax unified
.text
thumb_func_start sub_8122C5C
sub_8122C5C: @ 8122C5C
push {r4,lr}
lsls r0, 16
lsrs r4, r0, 16
lsls r1, 16
lsrs r1, 16
movs r3, 0
ldr r2, =gUnknown_0859F53C
_08122C6A:
movs r0, 0
ldrsb r0, [r2, r0]
cmp r0, r4
bne _08122C84
movs r0, 0x1
ldrsb r0, [r2, r0]
cmp r0, r1
bne _08122C84
adds r0, r3, 0x1
b _08122C8E
.pool
_08122C84:
adds r2, 0x8
adds r3, 0x1
cmp r3, 0x15
bls _08122C6A
movs r0, 0
_08122C8E:
pop {r4}
pop {r1}
bx r1
thumb_func_end sub_8122C5C
thumb_func_start sub_8122C94
sub_8122C94: @ 8122C94
push {lr}
lsls r0, 16
lsrs r0, 16
lsls r1, 16
lsrs r1, 16
bl sub_8122C5C
cmp r0, 0
beq _08122CB4
lsls r0, 3
ldr r1, =gUnknown_0859F534
adds r0, r1
b _08122CB6
.pool
_08122CB4:
movs r0, 0
_08122CB6:
pop {r1}
bx r1
thumb_func_end sub_8122C94
thumb_func_start sub_8122CBC
@ warpdata *sub_8122CBC(int a1)
sub_8122CBC: @ 8122CBC
push {lr}
cmp r0, 0
beq _08122CD4
cmp r0, 0x16
bhi _08122CD4
lsls r0, 3
ldr r1, =gUnknown_0859F534
adds r0, r1
b _08122CD6
.pool
_08122CD4:
movs r0, 0
_08122CD6:
pop {r1}
bx r1
thumb_func_end sub_8122CBC
.align 2, 0 @ Don't pad with nop.

View File

@ -11,4 +11,4 @@ gUnknown_0859F51C:: @ 859F51C
.incbin "baserom.gba", 0x59f51c, 0x8
gUnknown_0859F524:: @ 859F524
.incbin "baserom.gba", 0x59f524, 0x10
.incbin "baserom.gba", 0x59f524, 0x18

View File

@ -4,6 +4,9 @@
.section .rodata
.align 2, 0
gUnknown_0859F5EC:: @ 859F5EC
.incbin "graphics/unknown/unk_859f5ec.gbapal"
gUnknown_0859F60C:: @ 859F60C
.incbin "baserom.gba", 0x59f60c, 0x44

View File

@ -3,6 +3,11 @@
// Exported type declarations
struct UnkStruct_0859F534 {
const union AffineAnimCmd *const *const affineAnims;
void (* callback)(struct Sprite *sprite);
};
struct HealLocation
{
s8 group;

View File

@ -168,7 +168,6 @@ SECTIONS {
asm/menu_helpers.o(.text);
asm/dewford_trend.o(.text);
src/heal_location.o(.text);
asm/heal_location.o(.text);
asm/region_map.o(.text);
asm/cute_sketch.o(.text);
src/decoration.o(.text);

View File

@ -15,14 +15,6 @@
// .rodata
const struct {
const union AffineAnimCmd *const *const affineAnims;
void (* callback)(struct Sprite *sprite);
} gUnknown_0859F534 = {
gDummySpriteAffineAnimTable,
SpriteCallbackDummy
};
const struct HealLocation gUnknown_0859F53C[] = {
HEAL_LOCATION(LITTLEROOT_TOWN_BRENDANS_HOUSE_2F, 4, 2),
HEAL_LOCATION(LITTLEROOT_TOWN_MAYS_HOUSE_2F, 4, 2),
@ -48,6 +40,45 @@ const struct HealLocation gUnknown_0859F53C[] = {
HEAL_LOCATION(BATTLE_FRONTIER_OUTSIDE_EAST, 3, 52)
};
const u16 gUnknown_0859F5EC[] = INCBIN_U16("graphics/unknown/unk_859f5ec.gbapal");
#define NUM_HEAL_LOCATIONS (ARRAY_COUNT(gUnknown_0859F53C))
// .text
u32 sub_8122C5C(u16 mapGroup, u16 mapNum)
{
u32 i;
for (i = 0; i < NUM_HEAL_LOCATIONS; i ++)
{
if (gUnknown_0859F53C[i].group == mapGroup && gUnknown_0859F53C[i].map == mapNum)
{
return i + 1;
}
}
return 0;
}
const struct HealLocation *sub_8122C94(u16 mapGroup, u16 mapNum)
{
u32 loc;
loc = sub_8122C5C(mapGroup, mapNum);
if (loc == 0)
{
return NULL;
}
return &gUnknown_0859F53C[loc - 1];
}
const struct HealLocation *sub_8122CBC(u32 loc)
{
if (loc == 0)
{
return NULL;
}
if (loc > NUM_HEAL_LOCATIONS)
{
return NULL;
}
return &gUnknown_0859F53C[loc - 1];
}