diff --git a/asm/region_map.s b/asm/region_map.s index ff3696fc2..ebbda7b9b 100644 --- a/asm/region_map.s +++ b/asm/region_map.s @@ -5,141 +5,6 @@ .text - thumb_func_start sub_8124AD4 -sub_8124AD4: @ 8124AD4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - ldr r0, =0x0000086f - str r0, [sp, 0xC] - movs r1, 0 - mov r9, r1 - mov r2, sp - adds r2, 0x6 - str r2, [sp, 0x14] - mov r3, sp - adds r3, 0xA - str r3, [sp, 0x18] - mov r0, sp - adds r0, 0x8 - str r0, [sp, 0x10] - add r1, sp, 0x4 - mov r10, r1 -_08124AFE: - ldr r2, [sp, 0x18] - str r2, [sp] - mov r0, r9 - add r1, sp, 0x4 - mov r2, sp - adds r2, 0x6 - ldr r3, [sp, 0x10] - bl sub_8124630 - mov r3, r10 - ldrh r0, [r3] - adds r0, 0x1 - lsls r0, 3 - adds r0, 0x4 - strh r0, [r3] - mov r1, sp - ldrh r0, [r1, 0x6] - adds r0, 0x2 - lsls r0, 3 - adds r0, 0x4 - strh r0, [r1, 0x6] - ldr r2, [sp, 0x10] - ldrh r0, [r2] - cmp r0, 0x2 - bne _08124B38 - movs r7, 0x1 - b _08124B44 - .pool -_08124B38: - ldr r3, [sp, 0x18] - ldrh r0, [r3] - movs r7, 0 - cmp r0, 0x2 - bne _08124B44 - movs r7, 0x2 -_08124B44: - mov r0, r10 - movs r2, 0 - ldrsh r1, [r0, r2] - ldr r3, [sp, 0x14] - movs r0, 0 - ldrsh r2, [r3, r0] - ldr r0, =gUnknown_085A1F7C - movs r3, 0xA - bl CreateSprite - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x40 - beq _08124BB8 - ldr r1, =gSprites - mov r8, r1 - lsls r4, r5, 4 - adds r0, r4, r5 - lsls r6, r0, 2 - adds r2, r6, r1 - lsls r3, r7, 6 - ldrb r1, [r2, 0x1] - movs r0, 0x3F - ands r0, r1 - orrs r0, r3 - strb r0, [r2, 0x1] - ldr r0, [sp, 0xC] - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _08124B9C - mov r0, r8 - adds r0, 0x1C - adds r0, r6, r0 - ldr r1, =sub_8124CBC - str r1, [r0] - b _08124BA2 - .pool -_08124B9C: - adds r0, r7, 0x3 - lsls r0, 16 - lsrs r7, r0, 16 -_08124BA2: - adds r4, r5 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - lsls r1, r7, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - mov r2, r9 - strh r2, [r4, 0x2E] -_08124BB8: - ldr r0, [sp, 0xC] - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0xC] - mov r0, r9 - adds r0, 0x1 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - cmp r0, 0xF - bls _08124AFE - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8124AD4 - thumb_func_start sub_8124BE4 sub_8124BE4: @ 8124BE4 push {r4-r7,lr} diff --git a/src/region_map.c b/src/region_map.c index 07ddd7477..484f60347 100644 --- a/src/region_map.c +++ b/src/region_map.c @@ -76,13 +76,14 @@ static void UnhideRegionMapPlayerIcon(void); static void RegionMapPlayerIconSpriteCallback_Zoomed(struct Sprite *sprite); static void RegionMapPlayerIconSpriteCallback_Full(struct Sprite *sprite); static void RegionMapPlayerIconSpriteCallback(struct Sprite *sprite); -void sub_81248C0(void); -void sub_81248D4(void); -void sub_81248F4(void func(void)); +static void sub_81248C0(void); +static void sub_81248D4(void); +void sub_81248F4(void callback(void)); void sub_8124904(void); -void sub_8124A70(void); -void sub_8124AD4(void); +static void sub_8124A70(void); +static void sub_8124AD4(void); void sub_8124BE4(void); +void sub_8124CBC(struct Sprite *sprite); void sub_8124D14(void); // .rodata @@ -120,6 +121,7 @@ extern const struct { u16 flag; } gUnknown_085A1EDC[]; extern const struct SpritePalette gUnknown_085A1F10; +extern const struct SpriteTemplate gUnknown_085A1F7C; // .text @@ -1385,14 +1387,14 @@ void MCB2_FlyMap(void) } } -void sub_81248C0(void) +static void sub_81248C0(void) { LoadOam(); ProcessSpriteCopyRequests(); TransferPlttBuffer(); } -void sub_81248D4(void) +static void sub_81248D4(void) { gUnknown_0203A148->unk_000(); AnimateSprites(); @@ -1465,7 +1467,7 @@ void sub_8124904(void) } -void sub_8124A70(void) +static void sub_8124A70(void) { struct SpriteSheet sheet; @@ -1478,3 +1480,51 @@ void sub_8124A70(void) sub_8124AD4(); sub_8124BE4(); } + +static void sub_8124AD4(void) +{ + u16 canFlyFlag; + u16 i; + u16 x; + u16 y; + u16 width; + u16 height; + u16 shape; + u8 spriteId; + + canFlyFlag = FLAG_VISITED_LITTLEROOT_TOWN; + for (i = 0; i < 16; i ++) + { + sub_8124630(i, &x, &y, &width, &height); + x = (x + 1) * 8 + 4; + y = (y + 2) * 8 + 4; + if (width == 2) + { + shape = ST_OAM_H_RECTANGLE; + } + else if (height == 2) + { + shape = ST_OAM_V_RECTANGLE; + } + else + { + shape = ST_OAM_SQUARE; + } + spriteId = CreateSprite(&gUnknown_085A1F7C, x, y, 10); + if (spriteId != MAX_SPRITES) + { + gSprites[spriteId].oam.shape = shape; + if (FlagGet(canFlyFlag)) + { + gSprites[spriteId].callback = sub_8124CBC; + } + else + { + shape += 3; + } + StartSpriteAnim(&gSprites[spriteId], shape); + gSprites[spriteId].data0 = i; + } + canFlyFlag ++; + } +}