sub_8170290

This commit is contained in:
PikalaxALT 2017-10-29 10:58:33 -04:00
parent 0a060ae254
commit 929638f572
4 changed files with 81 additions and 180 deletions

View File

@ -5,182 +5,6 @@
.text .text
thumb_func_start sub_8170290
sub_8170290: @ 8170290
push {r4,r5,lr}
sub sp, 0xC
ldr r1, =gUnknown_0203BCD0
ldr r0, [r1]
ldr r2, =0x0000088c
adds r0, r2
ldrh r0, [r0]
adds r4, r1, 0
cmp r0, 0x6
bls _081702A6
b _08170416
_081702A6:
lsls r0, 2
ldr r1, =_081702BC
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081702BC:
.4byte _081702D8
.4byte _08170300
.4byte _08170358
.4byte _08170380
.4byte _08170394
.4byte _081703C0
.4byte _081703E8
_081702D8:
ldr r0, [r4]
adds r0, 0x8
movs r1, 0
bl sub_8122CDC
movs r0, 0
movs r1, 0
bl sub_8124288
movs r0, 0x1
movs r1, 0x1
bl sub_81240D4
ldr r1, [r4]
ldr r0, =0x0000088c
adds r1, r0
b _081703D8
.pool
_08170300:
movs r0, 0x1
movs r1, 0
movs r2, 0x27
movs r3, 0xD
bl SetWindowBorderStyle
ldr r5, =gText_Hoenn
movs r0, 0x1
adds r1, r5, 0
movs r2, 0x38
bl GetStringCenterAlignXOffset
adds r3, r0, 0
lsls r3, 24
lsrs r3, 24
movs r0, 0x1
str r0, [sp]
movs r4, 0
str r4, [sp, 0x4]
str r4, [sp, 0x8]
movs r1, 0x1
adds r2, r5, 0
bl PrintTextOnWindow
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
movs r0, 0
movs r1, 0
movs r2, 0x27
movs r3, 0xD
bl SetWindowBorderStyle
bl sub_8170428
movs r0, 0x1
negs r0, r0
str r4, [sp]
movs r1, 0
movs r2, 0x10
movs r3, 0
b _081703CC
.pool
_08170358:
movs r1, 0x82
lsls r1, 5
movs r0, 0
bl SetGpuRegBits
movs r0, 0
bl ShowBg
movs r0, 0x2
bl ShowBg
ldr r0, =gUnknown_0203BCD0
ldr r1, [r0]
ldr r0, =0x0000088c
adds r1, r0
b _081703D8
.pool
_08170380:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
cmp r0, 0
bne _08170416
ldr r1, [r4]
b _081703D4
.pool
_08170394:
bl sub_81230AC
lsls r0, 24
lsrs r0, 24
cmp r0, 0x3
bne _081703A6
bl sub_8170428
b _08170416
_081703A6:
cmp r0, 0x3
blt _08170416
cmp r0, 0x5
bgt _08170416
ldr r0, =gUnknown_0203BCD0
ldr r1, [r0]
ldr r0, =0x0000088c
adds r1, r0
b _081703D8
.pool
_081703C0:
movs r0, 0x1
negs r0, r0
movs r1, 0
str r1, [sp]
movs r2, 0
movs r3, 0x10
_081703CC:
bl BeginNormalPaletteFade
ldr r0, =gUnknown_0203BCD0
ldr r1, [r0]
_081703D4:
ldr r2, =0x0000088c
adds r1, r2
_081703D8:
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
b _08170416
.pool
_081703E8:
ldr r0, =gPaletteFade
ldrb r1, [r0, 0x7]
movs r0, 0x80
ands r0, r1
lsls r0, 24
lsrs r5, r0, 24
cmp r5, 0
bne _08170416
bl sub_812305C
ldr r4, =gUnknown_0203BCD0
ldr r0, [r4]
ldr r0, [r0]
bl SetMainCallback2
ldr r0, [r4]
cmp r0, 0
beq _08170412
bl Free
str r5, [r4]
_08170412:
bl FreeAllWindowBuffers
_08170416:
add sp, 0xC
pop {r4,r5}
pop {r0}
bx r0
.pool
thumb_func_end sub_8170290
thumb_func_start sub_8170428 thumb_func_start sub_8170428
sub_8170428: @ 8170428 sub_8170428: @ 8170428
push {r4,lr} push {r4,lr}

View File

@ -223,5 +223,10 @@ enum {
// Exported ROM declarations // Exported ROM declarations
void GetMapName(u8 *, u16, u16); void GetMapName(u8 *, u16, u16);
void sub_8122CDC(void *data, u8 argument);
void sub_8124288(u16 x, u16 y);
void sub_81240D4(u16 x, u16 y);
u8 sub_81230AC(void);
void sub_812305C(void);
#endif //GUARD_REGION_MAP_H #endif //GUARD_REGION_MAP_H

View File

@ -70,5 +70,6 @@ extern const u8 gText_Cushion[];
extern const u8 gText_Decorate[]; extern const u8 gText_Decorate[];
extern const u8 gText_PutAway[]; extern const u8 gText_PutAway[];
extern const u8 gText_Toss2[]; extern const u8 gText_Toss2[];
extern const u8 gText_Hoenn[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H

View File

@ -10,6 +10,9 @@
#include "text_window.h" #include "text_window.h"
#include "palette.h" #include "palette.h"
#include "menu.h" #include "menu.h"
#include "strings.h"
#include "international_string_util.h"
#include "region_map.h"
// Static type declarations // Static type declarations
@ -17,8 +20,9 @@
EWRAM_DATA struct { EWRAM_DATA struct {
MainCallback callback; MainCallback callback;
u8 filler_004[0x888]; u8 filler_004[0x4];
u16 unk_88c; u8 filler_008[0x884];
u16 state;
} *gUnknown_0203BCD0 = NULL; } *gUnknown_0203BCD0 = NULL;
// Static ROM declarations // Static ROM declarations
@ -26,7 +30,8 @@ EWRAM_DATA struct {
static void sub_81701C4(void); static void sub_81701C4(void);
static void sub_8170260(void); static void sub_8170260(void);
static void sub_8170274(void); static void sub_8170274(void);
void sub_8170290(void); static void sub_8170290(void);
void sub_8170428(void);
// .rodata // .rodata
@ -39,7 +44,7 @@ void sub_817018C(MainCallback callback)
{ {
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
gUnknown_0203BCD0 = malloc(sizeof(*gUnknown_0203BCD0)); gUnknown_0203BCD0 = malloc(sizeof(*gUnknown_0203BCD0));
gUnknown_0203BCD0->unk_88c = 0; gUnknown_0203BCD0->state = 0;
gUnknown_0203BCD0->callback = callback; gUnknown_0203BCD0->callback = callback;
SetMainCallback2(sub_81701C4); SetMainCallback2(sub_81701C4);
} }
@ -82,3 +87,69 @@ static void sub_8170274(void)
UpdatePaletteFade(); UpdatePaletteFade();
do_scheduled_bg_tilemap_copies_to_vram(); do_scheduled_bg_tilemap_copies_to_vram();
} }
void sub_8170290(void)
{
u8 offset;
switch (gUnknown_0203BCD0->state)
{
case 0:
sub_8122CDC(gUnknown_0203BCD0->filler_008, 0);
sub_8124288(0, 0);
sub_81240D4(1, 1);
gUnknown_0203BCD0->state ++;
break;
case 1:
SetWindowBorderStyle(1, 0, 0x27, 0xd);
offset = GetStringCenterAlignXOffset(1, gText_Hoenn, 0x38);
PrintTextOnWindow(1, 1, gText_Hoenn, offset, 1, 0, 0);
schedule_bg_copy_tilemap_to_vram(0);
SetWindowBorderStyle(0, 0, 0x27, 0xd);
sub_8170428();
BeginNormalPaletteFade(-1, 0, 16, 0, 0);
gUnknown_0203BCD0->state ++;
break;
case 2:
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
ShowBg(0);
ShowBg(2);
gUnknown_0203BCD0->state ++;
break;
case 3:
if (!gPaletteFade.active)
{
gUnknown_0203BCD0->state ++;
}
break;
case 4:
switch (sub_81230AC())
{
case 3:
sub_8170428();
break;
case 4:
case 5:
gUnknown_0203BCD0->state ++;
break;
}
break;
case 5:
BeginNormalPaletteFade(-1, 0, 0, 16, 0);
gUnknown_0203BCD0->state ++;
break;
case 6:
if (!gPaletteFade.active)
{
sub_812305C();
SetMainCallback2(gUnknown_0203BCD0->callback);
if (gUnknown_0203BCD0 != NULL)
{
free(gUnknown_0203BCD0);
gUnknown_0203BCD0 = NULL;
}
FreeAllWindowBuffers();
}
break;
}
}