From f6d1e5a96506b5d370180682105e5ae2d5aed083 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Tue, 31 Oct 2017 22:05:23 -0400 Subject: [PATCH] through sub_8124668 --- asm/region_map.s | 57 -------------------------------------------- include/region_map.h | 2 +- src/region_map.c | 34 ++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 60 deletions(-) diff --git a/asm/region_map.s b/asm/region_map.s index 55d6996a8c..a62dbe0808 100644 --- a/asm/region_map.s +++ b/asm/region_map.s @@ -5,63 +5,6 @@ .text - thumb_func_start sub_8124630 -sub_8124630: @ 8124630 - push {r4,r5,lr} - ldr r5, [sp, 0xC] - lsls r0, 16 - ldr r4, =gRegionMapEntries - lsrs r0, 13 - adds r0, r4 - ldrb r4, [r0] - strh r4, [r1] - ldrb r1, [r0, 0x1] - strh r1, [r2] - ldrb r1, [r0, 0x2] - strh r1, [r3] - ldrb r0, [r0, 0x3] - strh r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8124630 - - thumb_func_start sub_8124658 -sub_8124658: @ 8124658 - ldr r0, =gRegionMap - ldr r0, [r0] - adds r0, 0x78 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_8124658 - - thumb_func_start sub_8124668 -sub_8124668: @ 8124668 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - movs r1, 0 - ldr r3, =gUnknown_085A1C34 -_08124672: - adds r0, r1, r3 - ldrb r0, [r0] - cmp r2, r0 - bne _08124684 - movs r0, 0x1 - b _0812468C - .pool -_08124684: - adds r1, 0x1 - cmp r1, 0x2 - bls _08124672 - movs r0, 0 -_0812468C: - pop {r1} - bx r1 - thumb_func_end sub_8124668 - thumb_func_start sub_8124690 sub_8124690: @ 8124690 push {r4,lr} diff --git a/include/region_map.h b/include/region_map.h index 5eb3901d0c..1db8110839 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -309,6 +309,6 @@ u16 GetRegionMapSectionIdAt(u16 x, u16 y); void CreateRegionMapPlayerIcon(u16 x, u16 y); void CreateRegionMapCursor(u16 tileTag, u16 paletteTag); u8 *GetMapName(u8 *, u16, u16); -bool32 sub_8124668(u16 mapSecId); +bool32 sub_8124668(u8 mapSecId); #endif //GUARD_REGION_MAP_H diff --git a/src/region_map.c b/src/region_map.c index cd0f0b87c6..38419180d7 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -32,8 +32,10 @@ struct UnkStruct_0203A148 { struct RegionMapLocation { - u8 x, y; - u8 width, height; + u8 x; + u8 y; + u8 width; + u8 height; const u8 *name; }; @@ -89,6 +91,7 @@ extern const struct SpritePalette gUnknown_085A1C00; extern const struct SpriteTemplate gUnknown_085A1C08; extern const struct OamData gUnknown_085A1C20; extern const union AnimCmd *const gUnknown_085A1C30[]; +extern const u8 gUnknown_085A1C34[]; // .text @@ -1234,3 +1237,30 @@ u8 *sub_8124610(u8 *dest, u16 mapSecId) return sub_81245DC(dest, mapSecId); } } + +void sub_8124630(u16 mapSecId, u16 *x, u16 *y, u16 *width, u16 *height) +{ + *x = gRegionMapEntries[mapSecId].x; + *y = gRegionMapEntries[mapSecId].y; + *width = gRegionMapEntries[mapSecId].width; + *height = gRegionMapEntries[mapSecId].height; +} + +bool8 sub_8124658(void) +{ + return gRegionMap->zoomed; +} + +bool32 sub_8124668(u8 mapSecId) +{ + u32 i; + + for (i = 0; i < 3; i ++) + { + if (mapSecId == gUnknown_085A1C34[i]) + { + return TRUE; + } + } + return FALSE; +}