MCB2_FlyMap

This commit is contained in:
PikalaxALT 2017-10-31 22:34:12 -04:00
parent f6d1e5a965
commit f61822535b
5 changed files with 118 additions and 216 deletions

View File

@ -9892,7 +9892,7 @@ _081B55E8:
.pool .pool
_081B5614: _081B5614:
ldr r1, =gUnknown_0203CEC8 ldr r1, =gUnknown_0203CEC8
ldr r0, =sub_8124690 ldr r0, =MCB2_FlyMap
b _081B5628 b _081B5628
.pool .pool
_081B5624: _081B5624:

View File

@ -5,215 +5,6 @@
.text .text
thumb_func_start sub_8124690
sub_8124690: @ 8124690
push {r4,lr}
sub sp, 0xC
ldr r0, =gMain
movs r1, 0x87
lsls r1, 3
adds r0, r1
ldrb r0, [r0]
cmp r0, 0xA
bls _081246A4
b _081248AA
_081246A4:
lsls r0, 2
ldr r1, =_081246B8
adds r0, r1
ldr r0, [r0]
mov pc, r0
.pool
.align 2, 0
_081246B8:
.4byte _081246E4
.4byte _08124766
.4byte _0812477C
.4byte _0812478C
.4byte _0812479C
.4byte _081247E4
.4byte _081247F8
.4byte _0812480C
.4byte _0812484C
.4byte _08124852
.4byte _0812486C
_081246E4:
movs r0, 0
bl SetVBlankCallback
movs r0, 0
movs r1, 0
bl SetGpuReg
movs r0, 0x10
movs r1, 0
bl SetGpuReg
movs r0, 0x12
movs r1, 0
bl SetGpuReg
movs r0, 0x14
movs r1, 0
bl SetGpuReg
movs r0, 0x16
movs r1, 0
bl SetGpuReg
movs r0, 0x1A
movs r1, 0
bl SetGpuReg
movs r0, 0x18
movs r1, 0
bl SetGpuReg
movs r0, 0x1C
movs r1, 0
bl SetGpuReg
movs r0, 0x1E
movs r1, 0
bl SetGpuReg
ldr r4, =gUnknown_0203A148
ldr r0, =0x00000a74
bl Alloc
str r0, [r4]
cmp r0, 0
bne _08124754
ldr r0, =sub_8086194
bl SetMainCallback2
b _081248AA
.pool
_08124754:
bl ResetPaletteFade
bl ResetSpriteData
bl FreeSpriteTileRanges
bl FreeAllSpritePalettes
b _0812489C
_08124766:
movs r0, 0
bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_085A1EE4
movs r0, 0x1
movs r2, 0x3
bl InitBgsFromTemplates
b _0812489C
.pool
_0812477C:
ldr r0, =gUnknown_085A1EF0
bl InitWindows
bl DeactivateAllTextPrinters
b _0812489C
.pool
_0812478C:
movs r0, 0
movs r1, 0x65
movs r2, 0xD0
bl sub_809882C
bl clear_scheduled_bg_copies_to_vram
b _0812489C
_0812479C:
ldr r4, =gUnknown_0203A148
ldr r0, [r4]
adds r0, 0x8
movs r1, 0
bl InitRegionMap
movs r0, 0
movs r1, 0
bl CreateRegionMapCursor
movs r0, 0x1
movs r1, 0x1
bl CreateRegionMapPlayerIcon
ldr r0, [r4]
ldrh r1, [r0, 0x8]
strh r1, [r0, 0x6]
ldr r1, =0x00000a4c
adds r0, r1
movs r1, 0
movs r2, 0x10
bl StringFill
ldr r1, =gUnknown_03001180
movs r0, 0x1
str r0, [r1]
bl sub_8124904
b _0812489C
.pool
_081247E4:
ldr r0, =gUnknown_085A1C58
ldr r1, =0x0600c000
bl LZ77UnCompVram
b _0812489C
.pool
_081247F8:
ldr r0, =gUnknown_085A1C90
ldr r1, =0x0600f000
bl LZ77UnCompVram
b _0812489C
.pool
_0812480C:
ldr r0, =gUnknown_085A1C38
movs r1, 0x10
movs r2, 0x20
bl LoadPalette
movs r0, 0x2
bl PutWindowTilemap
movs r0, 0x2
movs r1, 0
bl FillWindowPixelBuffer
ldr r2, =gText_FlyToWhere
movs r0, 0x1
str r0, [sp]
movs r0, 0
str r0, [sp, 0x4]
str r0, [sp, 0x8]
movs r0, 0x2
movs r1, 0x1
movs r3, 0
bl PrintTextOnWindow
movs r0, 0
bl schedule_bg_copy_tilemap_to_vram
b _0812489C
.pool
_0812484C:
bl sub_8124A70
b _0812489C
_08124852:
movs r0, 0x1
negs r0, r0
movs r1, 0x10
movs r2, 0
bl BlendPalettes
ldr r0, =sub_81248C0
bl SetVBlankCallback
b _0812489C
.pool
_0812486C:
movs r0, 0x50
movs r1, 0
bl SetGpuReg
movs r1, 0x82
lsls r1, 5
movs r0, 0
bl SetGpuRegBits
movs r0, 0
bl ShowBg
movs r0, 0x1
bl ShowBg
movs r0, 0x2
bl ShowBg
ldr r0, =sub_8124D14
bl sub_81248F4
ldr r0, =sub_81248D4
bl SetMainCallback2
_0812489C:
ldr r1, =gMain
movs r0, 0x87
lsls r0, 3
adds r1, r0
ldrb r0, [r1]
adds r0, 0x1
strb r0, [r1]
_081248AA:
add sp, 0xC
pop {r4}
pop {r0}
bx r0
.pool
thumb_func_end sub_8124690
thumb_func_start sub_81248C0 thumb_func_start sub_81248C0
sub_81248C0: @ 81248C0 sub_81248C0: @ 81248C0
push {lr} push {lr}

View File

@ -60,5 +60,6 @@ bool32 sub_8087598(void);
void c2_exit_to_overworld_1_continue_scripts_restart_music(void); void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
void warp_in(void); void warp_in(void);
u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum); u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum);
void sub_8086194(void);
#endif //GUARD_ROM4_H #endif //GUARD_ROM4_H

View File

@ -74,5 +74,6 @@ extern const u8 gText_Hoenn[];
extern const u8 gText_Ferry[]; extern const u8 gText_Ferry[];
extern const u8 gText_SecretBase[]; extern const u8 gText_SecretBase[];
extern const u8 gText_Hideout[]; extern const u8 gText_Hideout[];
extern const u8 gText_FlyToWhere[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H

View File

@ -3,6 +3,7 @@
#include "global.h" #include "global.h"
#include "main.h" #include "main.h"
#include "menu.h" #include "menu.h"
#include "malloc.h"
#include "gpu_regs.h" #include "gpu_regs.h"
#include "palette.h" #include "palette.h"
#include "trig.h" #include "trig.h"
@ -15,6 +16,7 @@
#include "string_util.h" #include "string_util.h"
#include "strings.h" #include "strings.h"
#include "text.h" #include "text.h"
#include "text_window.h"
#include "region_map.h" #include "region_map.h"
#define MAP_WIDTH 28 #define MAP_WIDTH 28
@ -26,10 +28,6 @@
// Static type declarations // Static type declarations
struct UnkStruct_0203A148 {
u8 filler_000[0xa74];
};
struct RegionMapLocation struct RegionMapLocation
{ {
u8 x; u8 x;
@ -42,7 +40,15 @@ struct RegionMapLocation
// Static RAM declarations // Static RAM declarations
EWRAM_DATA struct RegionMap *gRegionMap = NULL; EWRAM_DATA struct RegionMap *gRegionMap = NULL;
EWRAM_DATA struct UnkStruct_0203A148 *gUnknown_0203A148 = NULL; EWRAM_DATA struct {
/*0x000*/ u8 filler_000[0x6];
/*0x006*/ u16 mapSecId;
/*0x008*/ struct RegionMap regionMap;
/*0x88c*/ u8 filler_88c[0x1c0];
/*0xa4c*/ u8 unk_a4c[0x28];
} *gUnknown_0203A148 = NULL; // a74
IWRAM_DATA bool32 gUnknown_03001180;
// Static ROM declarations // Static ROM declarations
@ -68,6 +74,12 @@ static void UnhideRegionMapPlayerIcon(void);
static void RegionMapPlayerIconSpriteCallback_Zoomed(struct Sprite *sprite); static void RegionMapPlayerIconSpriteCallback_Zoomed(struct Sprite *sprite);
static void RegionMapPlayerIconSpriteCallback_Full(struct Sprite *sprite); static void RegionMapPlayerIconSpriteCallback_Full(struct Sprite *sprite);
static void RegionMapPlayerIconSpriteCallback(struct Sprite *sprite); static void RegionMapPlayerIconSpriteCallback(struct Sprite *sprite);
void sub_81248C0(void);
void sub_81248D4(void);
void sub_81248F4(void func(void));
void sub_8124904(void);
void sub_8124A70(void);
void sub_8124D14(void);
// .rodata // .rodata
@ -92,6 +104,11 @@ extern const struct SpriteTemplate gUnknown_085A1C08;
extern const struct OamData gUnknown_085A1C20; extern const struct OamData gUnknown_085A1C20;
extern const union AnimCmd *const gUnknown_085A1C30[]; extern const union AnimCmd *const gUnknown_085A1C30[];
extern const u8 gUnknown_085A1C34[]; extern const u8 gUnknown_085A1C34[];
extern const struct BgTemplate gUnknown_085A1EE4[];
extern const struct WindowTemplate gUnknown_085A1EF0[];
extern const u8 gUnknown_085A1C58[];
extern const u8 gUnknown_085A1C90[];
extern const u16 gUnknown_085A1C38[];
// .text // .text
@ -142,7 +159,7 @@ bool8 sub_8122DB0(void)
} }
else else
{ {
LZ77UnCompVram(gUnknown_0859F77C, (u16 *)BG_SCREEN_ADDR(16)); LZ77UnCompVram(gUnknown_0859F77C, (u16 *)BG_CHAR_ADDR(2));
} }
break; break;
case 1: case 1:
@ -1264,3 +1281,95 @@ bool32 sub_8124668(u8 mapSecId)
} }
return FALSE; return FALSE;
} }
void MCB2_FlyMap(void)
{
switch (gMain.state)
{
case 0:
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
SetGpuReg(REG_OFFSET_BG1HOFS, 0);
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG2VOFS, 0);
SetGpuReg(REG_OFFSET_BG2HOFS, 0);
SetGpuReg(REG_OFFSET_BG3HOFS, 0);
SetGpuReg(REG_OFFSET_BG3VOFS, 0);
gUnknown_0203A148 = malloc(sizeof(*gUnknown_0203A148));
if (gUnknown_0203A148 == NULL)
{
SetMainCallback2(sub_8086194);
}
else
{
ResetPaletteFade();
ResetSpriteData();
FreeSpriteTileRanges();
FreeAllSpritePalettes();
gMain.state ++;
}
break;
case 1:
ResetBgsAndClearDma3BusyFlags(0);
InitBgsFromTemplates(1, gUnknown_085A1EE4, 3);
gMain.state ++;
break;
case 2:
InitWindows(gUnknown_085A1EF0);
DeactivateAllTextPrinters();
gMain.state ++;
break;
case 3:
sub_809882C(0, 0x65, 0xd0);
clear_scheduled_bg_copies_to_vram();
gMain.state ++;
break;
case 4:
InitRegionMap(&gUnknown_0203A148->regionMap, FALSE);
CreateRegionMapCursor(0, 0);
CreateRegionMapPlayerIcon(1, 1);
gUnknown_0203A148->mapSecId = gUnknown_0203A148->regionMap.mapSecId;
StringFill(gUnknown_0203A148->unk_a4c, CHAR_SPACE, 16);
gUnknown_03001180 = TRUE;
sub_8124904();
gMain.state ++;
break;
case 5:
LZ77UnCompVram(gUnknown_085A1C58, (u16 *)BG_CHAR_ADDR(3));
gMain.state ++;
break;
case 6:
LZ77UnCompVram(gUnknown_085A1C90, (u16 *)BG_SCREEN_ADDR(30));
gMain.state ++;
break;
case 7:
LoadPalette(gUnknown_085A1C38, 0x10, 0x20);
PutWindowTilemap(2);
FillWindowPixelBuffer(2, 0x00);
PrintTextOnWindow(2, 1, gText_FlyToWhere, 0, 1, 0, NULL);
schedule_bg_copy_tilemap_to_vram(0);
gMain.state ++;
break;
case 8:
sub_8124A70();
gMain.state ++;
break;
case 9:
BlendPalettes(-1, 16, 0);
SetVBlankCallback(sub_81248C0);
gMain.state ++;
break;
case 10:
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON);
ShowBg(0);
ShowBg(1);
ShowBg(2);
sub_81248F4(sub_8124D14);
SetMainCallback2(sub_81248D4);
gMain.state ++;
break;
}
}