region_map.c through sub_8122CF8

This commit is contained in:
PikalaxALT 2017-10-29 19:33:53 -04:00
parent c0a229f108
commit 76bb397e83
6 changed files with 79 additions and 149 deletions

View File

@ -5,95 +5,6 @@
.text
thumb_func_start sub_8122CDC
sub_8122CDC: @ 8122CDC
push {lr}
lsls r2, r1, 24
lsrs r2, 24
movs r1, 0
bl sub_8122CF8
_08122CE8:
bl sub_8122DB0
lsls r0, 24
cmp r0, 0
bne _08122CE8
pop {r0}
bx r0
thumb_func_end sub_8122CDC
thumb_func_start sub_8122CF8
sub_8122CF8: @ 8122CF8
push {r4,r5,lr}
adds r4, r1, 0
lsls r2, 24
lsrs r2, 24
ldr r3, =gUnknown_0203A144
str r0, [r3]
movs r1, 0x79
adds r1, r0
mov r12, r1
movs r1, 0
mov r5, r12
strb r1, [r5]
adds r0, 0x78
strb r2, [r0]
ldr r1, [r3]
cmp r2, 0x1
bne _08122D28
ldr r0, =sub_8123254
b _08122D2A
.pool
_08122D28:
ldr r0, =sub_81230C4
_08122D2A:
str r0, [r1, 0x18]
cmp r4, 0
beq _08122D64
ldr r1, [r3]
ldr r0, [r4]
lsls r0, 30
lsrs r0, 30
adds r1, 0x80
strb r0, [r1]
ldr r1, [r3]
ldr r0, [r4]
lsls r0, 28
lsrs r0, 30
adds r1, 0x81
strb r0, [r1]
ldr r1, [r3]
ldr r0, [r4]
lsls r0, 23
lsrs r0, 27
adds r1, 0x82
strb r0, [r1]
ldr r0, [r3]
adds r0, 0x83
movs r1, 0x1
strb r1, [r0]
b _08122D80
.pool
_08122D64:
ldr r0, [r3]
adds r0, 0x80
movs r1, 0x2
strb r1, [r0]
ldr r0, [r3]
adds r0, 0x81
strb r1, [r0]
ldr r0, [r3]
adds r0, 0x82
movs r1, 0x1C
strb r1, [r0]
ldr r0, [r3]
adds r0, 0x83
strb r4, [r0]
_08122D80:
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_8122CF8
thumb_func_start sub_8122D88
sub_8122D88: @ 8122D88
push {r4,lr}

View File

@ -219,66 +219,35 @@ enum {
MAPSEC_TRAINER_HILL
};
struct UnkStruct_8122CF8 {
u32 unk_0_0:2;
u32 unk_0_2:2;
u32 unk_0_4:5;
};
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];
/*0x000*/ u8 unk_00;
/*0x001*/ u8 unk_01;
/*0x002*/ bool8 unk_02;
/*0x003*/ u8 unk_03;
/*0x004*/ u8 mapSecName[0x14];
/*0x018*/ u8 (*inputCallback)(void);
/*0x01c*/ u8 filler_01c[0x5c];
/*0x078*/ u8 unk_078;
/*0x079*/ bool8 unk_079;
/*0x07a*/ u8 filler_07a[6];
/*0x080*/ u8 unk_080;
/*0x081*/ u8 unk_081;
/*0x082*/ u8 unk_082;
/*0x083*/ bool8 unk_083;
/*0x084*/ u8 filler_084[0x800];
}; // size = 0x884
// Exported RAM declarations
// Exported ROM declarations
void GetMapName(u8 *, u16, u16);
void sub_8122CDC(struct RegionMap *regionMap, u8 argument);
void sub_8122CDC(struct RegionMap *regionMap, bool8 argument);
void sub_8124288(u16 x, u16 y);
void sub_81240D4(u16 x, u16 y);
u8 sub_81230AC(void);

View File

@ -168,6 +168,7 @@ SECTIONS {
asm/menu_helpers.o(.text);
asm/dewford_trend.o(.text);
src/heal_location.o(.text);
src/region_map.o(.text);
asm/region_map.o(.text);
asm/cute_sketch.o(.text);
src/decoration.o(.text);

View File

@ -120,7 +120,7 @@ void sub_8170290(void)
switch (gUnknown_0203BCD0->state)
{
case 0:
sub_8122CDC(&gUnknown_0203BCD0->regionMap, 0);
sub_8122CDC(&gUnknown_0203BCD0->regionMap, FALSE);
sub_8124288(0, 0);
sub_81240D4(1, 1);
gUnknown_0203BCD0->state ++;

54
src/region_map.c Normal file
View File

@ -0,0 +1,54 @@
// Includes
#include "global.h"
#include "region_map.h"
// Static type declarations
struct UnkStruct_0203A148 {
u8 filler_000[0xa74];
};
// Static RAM declarations
EWRAM_DATA struct RegionMap *gUnknown_0203A144 = NULL;
EWRAM_DATA struct UnkStruct_0203A148 *gUnknown_0203A148 = NULL;
// Static ROM declarations
void sub_8122CF8(struct RegionMap *regionMap, struct UnkStruct_8122CF8 *arg1, bool8 arg2);
bool8 sub_8122DB0(void);
u8 sub_8123254(void);
u8 sub_81230C4(void);
// .rodata
// .text
void sub_8122CDC(struct RegionMap *regionMap, bool8 argument)
{
sub_8122CF8(regionMap, NULL, argument);
while (sub_8122DB0());
}
void sub_8122CF8(struct RegionMap *regionMap, struct UnkStruct_8122CF8 *arg1, bool8 arg2)
{
gUnknown_0203A144 = regionMap;
gUnknown_0203A144->unk_079 = 0;
gUnknown_0203A144->unk_078 = arg2;
gUnknown_0203A144->inputCallback = arg2 == TRUE ? sub_8123254 : sub_81230C4;
if (arg1 != NULL)
{
gUnknown_0203A144->unk_080 = arg1->unk_0_0;
gUnknown_0203A144->unk_081 = arg1->unk_0_2;
gUnknown_0203A144->unk_082 = arg1->unk_0_4;
gUnknown_0203A144->unk_083 = TRUE;
}
else
{
gUnknown_0203A144->unk_080 = 2;
gUnknown_0203A144->unk_081 = 2;
gUnknown_0203A144->unk_082 = 28;
gUnknown_0203A144->unk_083 = FALSE;
}
}

View File

@ -1113,12 +1113,7 @@ gUnknown_0203A138: @ 203A138
gUnknown_0203A140: @ 203A140
.space 0x4
gUnknown_0203A144: @ 203A144
.space 0x4
gUnknown_0203A148: @ 203A148
.space 0x4
.include "src/region_map.o"
.include "src/decoration.o"
.align 2