diff --git a/asm/field_region_map.s b/asm/field_region_map.s index dd9a9e432c..2428f2984b 100644 --- a/asm/field_region_map.s +++ b/asm/field_region_map.s @@ -5,44 +5,4 @@ .text - thumb_func_start sub_8170428 -sub_8170428: @ 8170428 - push {r4,lr} - sub sp, 0xC - ldr r4, =gUnknown_0203BCD0 - ldr r0, [r4] - ldrb r0, [r0, 0xA] - cmp r0, 0 - beq _08170460 - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, [r4] - adds r2, 0xC - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0 - bl schedule_bg_copy_tilemap_to_vram - b _08170470 - .pool -_08170460: - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08170470: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_8170428 - .align 2, 0 @ Don't pad with nop. diff --git a/include/region_map.h b/include/region_map.h index 5eeb3a95f7..20756404cf 100644 --- a/include/region_map.h +++ b/include/region_map.h @@ -219,11 +219,66 @@ enum { MAPSEC_TRAINER_HILL }; +struct RegionMap { + u8 unk_00; + u8 unk_01; + bool8 unk_02; + u8 unk_03; + u8 mapSecName[0x14]; + u16 mapSecId; + u8 unk16; + u8 everGrandeCityArea; + u8 (*inputCallback)(void); + struct Sprite *cursorSprite; + struct Sprite *playerIconSprite; + s32 bg2x; + s32 bg2y; + u32 unk2C; // + u32 unk30; // Map rotation parameters + u32 unk34; // Likely a scrapped feature + u32 unk38; // + s32 unk3C; + s32 unk40; + s32 unk44; + s32 unk48; + s32 unk4C; + s32 unk50; + u16 cursorPosX; + u16 cursorPosY; + u16 cursorTileTag; + u16 cursorPaletteTag; + s16 scrollX; + s16 scrollY; + s16 unk60; + s16 unk62; + u16 unk64; + u16 unk66; + u16 unk68; + u16 unk6A; + u16 unk6C; + u16 unk6E; + u16 playerIconTileTag; + u16 playerIconPaletteTag; + u16 unk74; + u16 unk76; + bool8 zoomed; + u8 initStep; + s8 unk7A; + s8 cursorDeltaX; + s8 cursorDeltaY; + bool8 needUpdateVideoRegs; + bool8 blinkPlayerIcon; + bool8 playerIsInCave; + /*0x084*/ u8 filler80[0x100]; + /*0x184*/ u8 cursorSmallImage[0x100]; + /*0x284*/ u8 cursorLargeImage[0x600]; +}; // size = 0x884 + // Exported RAM declarations // Exported ROM declarations void GetMapName(u8 *, u16, u16); -void sub_8122CDC(void *data, u8 argument); +void sub_8122CDC(struct RegionMap *regionMap, u8 argument); void sub_8124288(u16 x, u16 y); void sub_81240D4(u16 x, u16 y); u8 sub_81230AC(void); diff --git a/src/field_region_map.c b/src/field_region_map.c index 399ae90701..f782680189 100644 --- a/src/field_region_map.c +++ b/src/field_region_map.c @@ -20,8 +20,8 @@ EWRAM_DATA struct { MainCallback callback; - u8 filler_004[0x4]; - u8 filler_008[0x884]; + u32 filler_004; + struct RegionMap regionMap; u16 state; } *gUnknown_0203BCD0 = NULL; @@ -31,7 +31,7 @@ static void sub_81701C4(void); static void sub_8170260(void); static void sub_8170274(void); static void sub_8170290(void); -void sub_8170428(void); +static void sub_8170428(void); // .rodata @@ -95,7 +95,7 @@ void sub_8170290(void) switch (gUnknown_0203BCD0->state) { case 0: - sub_8122CDC(gUnknown_0203BCD0->filler_008, 0); + sub_8122CDC(&gUnknown_0203BCD0->regionMap, 0); sub_8124288(0, 0); sub_81240D4(1, 1); gUnknown_0203BCD0->state ++; @@ -103,7 +103,7 @@ void sub_8170290(void) case 1: SetWindowBorderStyle(1, 0, 0x27, 0xd); offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38); - PrintTextOnWindow(1, 1, gText_Hoenn, offset, 1, 0, 0); + PrintTextOnWindow(1, 1, gText_Hoenn, offset, 1, 0, NULL); schedule_bg_copy_tilemap_to_vram(0); SetWindowBorderStyle(0, 0, 0x27, 0xd); sub_8170428(); @@ -153,3 +153,18 @@ void sub_8170290(void) break; } } + +static void sub_8170428(void) +{ + if (gUnknown_0203BCD0->regionMap.unk_02) + { + FillWindowPixelBuffer(0, 0x11); + PrintTextOnWindow(0, 1, gUnknown_0203BCD0->regionMap.mapSecName, 0, 1, 0, NULL); + schedule_bg_copy_tilemap_to_vram(0); + } + else + { + FillWindowPixelBuffer(0, 0x11); + CopyWindowToVram(0, 3); + } +}