sub_8123334

This commit is contained in:
PikalaxALT 2017-10-29 22:05:15 -04:00
parent 16c5a58f35
commit 1597284694
3 changed files with 132 additions and 210 deletions

View File

@ -5,122 +5,6 @@
.text
thumb_func_start sub_8123334
sub_8123334: @ 8123334
push {r4,r5,lr}
ldr r5, =gUnknown_0203A144
ldr r2, [r5]
adds r3, r2, 0
adds r3, 0x5E
adds r0, r2, 0
adds r0, 0x68
ldrh r0, [r0]
ldrh r1, [r3]
adds r0, r1
strh r0, [r3]
adds r1, r2, 0
adds r1, 0x5C
adds r0, r2, 0
adds r0, 0x6A
ldrh r0, [r0]
ldrh r2, [r1]
adds r0, r2
strh r0, [r1]
movs r4, 0
ldrsh r0, [r1, r4]
movs r2, 0
ldrsh r1, [r3, r2]
bl sub_812378C
ldr r2, [r5]
adds r1, r2, 0
adds r1, 0x6C
ldrh r0, [r1]
adds r0, 0x1
strh r0, [r1]
lsls r0, 16
lsrs r0, 16
cmp r0, 0x8
bne _08123410
adds r0, r2, 0
adds r0, 0x5C
movs r3, 0
ldrsh r1, [r0, r3]
adds r0, r1, 0
adds r0, 0x2C
cmp r0, 0
bge _0812338C
adds r0, 0x7
_0812338C:
asrs r0, 3
adds r0, 0x1
lsls r0, 16
lsrs r3, r0, 16
adds r0, r2, 0
adds r0, 0x5E
movs r4, 0
ldrsh r1, [r0, r4]
adds r0, r1, 0
adds r0, 0x34
cmp r0, 0
bge _081233A6
adds r0, 0x7
_081233A6:
asrs r0, 3
adds r0, 0x2
lsls r0, 16
lsrs r1, r0, 16
adds r4, r2, 0
adds r4, 0x64
adds r0, r2, 0
adds r0, 0x66
ldrh r2, [r4]
cmp r3, r2
bne _081233C2
ldrh r2, [r0]
cmp r1, r2
beq _081233F2
_081233C2:
strh r3, [r4]
strh r1, [r0]
adds r0, r3, 0
bl sub_812386C
lsls r0, 16
lsrs r4, r0, 16
adds r0, r4, 0
bl get_flagnr_blue_points
ldr r1, [r5]
strb r0, [r1, 0x2]
ldr r1, [r5]
ldrh r3, [r1]
cmp r4, r3
beq _081233EE
strh r4, [r1]
adds r0, r1, 0x4
ldrh r1, [r1]
movs r2, 0x10
bl GetMapName
_081233EE:
bl sub_8123FB0
_081233F2:
ldr r0, =gUnknown_0203A144
ldr r2, [r0]
adds r1, r2, 0
adds r1, 0x6C
movs r0, 0
strh r0, [r1]
ldr r0, =sub_8123254
str r0, [r2, 0x18]
movs r0, 0x3
b _08123412
.pool
_08123410:
movs r0, 0x2
_08123412:
pop {r4,r5}
pop {r1}
bx r1
thumb_func_end sub_8123334
thumb_func_start sub_8123418
sub_8123418: @ 8123418
push {r4-r6,lr}

View File

@ -231,41 +231,41 @@ struct RegionMap {
/*0x003*/ u8 unk_003;
/*0x004*/ u8 mapSecName[0x14];
/*0x018*/ u8 (*inputCallback)(void);
/*0x01c*/ struct Sprite *unk_01c;
/*0x020*/ struct Sprite *unk_020;
/*0x01c*/ struct Sprite *cursorSprite;
/*0x020*/ struct Sprite *playerIconSprite;
/*0x024*/ u8 filler_024[0x30];
/*0x054*/ u16 unk_054;
/*0x056*/ u16 unk_056;
/*0x058*/ u16 unk_058;
/*0x05a*/ u16 unk_05a;
/*0x05c*/ s16 unk_05c;
/*0x05e*/ s16 unk_05e;
/*0x054*/ u16 cursorPosX;
/*0x056*/ u16 cursorPosY;
/*0x058*/ u16 cursorTileTag;
/*0x05a*/ u16 cursorPaletteTag;
/*0x05c*/ s16 scrollX;
/*0x05e*/ s16 scrollY;
/*0x060*/ u8 filler_060[0x4];
/*0x064*/ u16 unk_064;
/*0x066*/ u16 unk_066;
/*0x068*/ s16 unk_068;
/*0x06a*/ s16 unk_06a;
/*0x06c*/ u16 unk_06c;
/*0x068*/ s16 zoomedCursorDeltaY;
/*0x06a*/ s16 zoomedCursorDeltaX;
/*0x06c*/ u16 zoomedCursorMovementFrameCounter;
/*0x06e*/ u8 filler_06e[2];
/*0x070*/ u16 unk_070;
/*0x072*/ u16 unk_072;
/*0x070*/ u16 playerIconTileTag;
/*0x072*/ u16 playerIconPaletteTag;
/*0x074*/ u16 unk_074;
/*0x076*/ u16 unk_076;
/*0x078*/ u8 unk_078;
/*0x079*/ u8 unk_079;
/*0x07a*/ s8 unk_07a;
/*0x07b*/ s8 unk_07b;
/*0x07c*/ s8 unk_07c;
/*0x07d*/ u8 unk_07d;
/*0x07e*/ u8 unk_07e;
/*0x07f*/ u8 unk_07f;
/*0x080*/ u8 unk_080;
/*0x078*/ bool8 zoomed;
/*0x079*/ u8 initStep;
/*0x07a*/ s8 cursorMovementFrameCounter;
/*0x07b*/ s8 cursorDeltaX;
/*0x07c*/ s8 cursorDeltaY;
/*0x07d*/ bool8 unk_07d;
/*0x07e*/ bool8 blinkPlayerIcon;
/*0x07f*/ bool8 unk_07f;
/*0x080*/ u8 bgNum;
/*0x081*/ u8 unk_081;
/*0x082*/ u8 unk_082;
/*0x083*/ bool8 unk_083;
/*0x084*/ u8 filler_084[0x100];
/*0x184*/ u8 unk_184[0x100];
/*0x284*/ u8 unk_284[0x600];
/*0x184*/ u8 cursorSmallImage[0x100];
/*0x284*/ u8 cursorLargeImage[0x600];
}; // size = 0x884
enum

View File

@ -31,6 +31,7 @@ void sub_8123FB0(void);
u8 _swiopen(void);
u8 sub_8123334(void);
u16 sub_812386C(u16 x, u16 y);
void sub_812378C(s16 x, s16 y);
// .rodata
@ -51,19 +52,19 @@ void sub_8122CDC(struct RegionMap *regionMap, u8 argument)
void sub_8122CF8(struct RegionMap *regionMap, struct UnkStruct_8122CF8 *arg1, u8 arg2)
{
gUnknown_0203A144 = regionMap;
gUnknown_0203A144->unk_079 = 0;
gUnknown_0203A144->unk_078 = arg2;
gUnknown_0203A144->initStep = 0;
gUnknown_0203A144->zoomed = arg2;
gUnknown_0203A144->inputCallback = arg2 == TRUE ? sub_8123254 : sub_81230C4;
if (arg1 != NULL)
{
gUnknown_0203A144->unk_080 = arg1->unk_0_0;
gUnknown_0203A144->bgNum = 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->bgNum = 2;
gUnknown_0203A144->unk_081 = 2;
gUnknown_0203A144->unk_082 = 28;
gUnknown_0203A144->unk_083 = FALSE;
@ -74,18 +75,18 @@ void sub_8122D88(struct RegionMap *regionMap)
{
gUnknown_0203A144 = regionMap;
sub_81238AC();
gUnknown_0203A144->unk_074 = gUnknown_0203A144->unk_054;
gUnknown_0203A144->unk_076 = gUnknown_0203A144->unk_056;
gUnknown_0203A144->unk_074 = gUnknown_0203A144->cursorPosX;
gUnknown_0203A144->unk_076 = gUnknown_0203A144->cursorPosY;
}
bool8 sub_8122DB0(void)
{
switch (gUnknown_0203A144->unk_079)
switch (gUnknown_0203A144->initStep)
{
case 0:
if (gUnknown_0203A144->unk_083)
{
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->unk_080, gUnknown_0859F77C, 0, 0, 0);
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->bgNum, gUnknown_0859F77C, 0, 0, 0);
}
else
{
@ -97,7 +98,7 @@ bool8 sub_8122DB0(void)
{
if (!free_temp_tile_data_buffers_if_possible())
{
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->unk_080, gUnknown_085A04E0, 0, 0, 1);
decompress_and_copy_tile_data_to_vram(gUnknown_0203A144->bgNum, gUnknown_085A04E0, 0, 0, 1);
}
}
else
@ -112,54 +113,54 @@ bool8 sub_8122DB0(void)
}
break;
case 3:
LZ77UnCompWram(gUnknown_0859F60C, gUnknown_0203A144->unk_184);
LZ77UnCompWram(gUnknown_0859F60C, gUnknown_0203A144->cursorSmallImage);
break;
case 4:
LZ77UnCompWram(gUnknown_0859F650, gUnknown_0203A144->unk_284);
LZ77UnCompWram(gUnknown_0859F650, gUnknown_0203A144->cursorLargeImage);
break;
case 5:
sub_81238AC();
gUnknown_0203A144->unk_074 = gUnknown_0203A144->unk_054;
gUnknown_0203A144->unk_076 = gUnknown_0203A144->unk_056;
gUnknown_0203A144->unk_074 = gUnknown_0203A144->cursorPosX;
gUnknown_0203A144->unk_076 = gUnknown_0203A144->cursorPosY;
gUnknown_0203A144->mapSecId = sub_8123EB4(gUnknown_0203A144->mapSecId);
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(gUnknown_0203A144->mapSecId);
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
break;
case 6:
if (gUnknown_0203A144->unk_078 == 0)
if (gUnknown_0203A144->zoomed == FALSE)
{
sub_81236C4(0, 0, 0, 0, 0x100, 0x100, 0);
}
else
{
gUnknown_0203A144->unk_05c = gUnknown_0203A144->unk_054 * 8 - 0x34;
gUnknown_0203A144->unk_05e = gUnknown_0203A144->unk_056 * 8 - 0x44;
gUnknown_0203A144->unk_064 = gUnknown_0203A144->unk_054;
gUnknown_0203A144->unk_066 = gUnknown_0203A144->unk_056;
sub_81236C4(gUnknown_0203A144->unk_05c, gUnknown_0203A144->unk_05e, 0x38, 0x48, 0x80, 0x80, 0);
gUnknown_0203A144->scrollX = gUnknown_0203A144->cursorPosX * 8 - 0x34;
gUnknown_0203A144->scrollY = gUnknown_0203A144->cursorPosY * 8 - 0x44;
gUnknown_0203A144->unk_064 = gUnknown_0203A144->cursorPosX;
gUnknown_0203A144->unk_066 = gUnknown_0203A144->cursorPosY;
sub_81236C4(gUnknown_0203A144->scrollX, gUnknown_0203A144->scrollY, 0x38, 0x48, 0x80, 0x80, 0);
}
break;
case 7:
sub_8123FB0();
sub_81237B4();
gUnknown_0203A144->unk_01c = NULL;
gUnknown_0203A144->unk_020 = NULL;
gUnknown_0203A144->unk_07a = 0;
gUnknown_0203A144->unk_07e = 0;
gUnknown_0203A144->cursorSprite = NULL;
gUnknown_0203A144->playerIconSprite = NULL;
gUnknown_0203A144->cursorMovementFrameCounter = 0;
gUnknown_0203A144->blinkPlayerIcon = FALSE;
if (gUnknown_0203A144->unk_083)
{
SetBgAttribute(gUnknown_0203A144->unk_080, BG_CTRL_ATTR_MAPBASEINDEX, 2);
SetBgAttribute(gUnknown_0203A144->unk_080, BG_CTRL_ATTR_VISIBLE, gUnknown_0203A144->unk_081);
SetBgAttribute(gUnknown_0203A144->unk_080, BG_CTRL_ATTR_CHARBASEINDEX, gUnknown_0203A144->unk_082);
SetBgAttribute(gUnknown_0203A144->unk_080, BG_CTRL_ATTR_PRIORITY, 1);
SetBgAttribute(gUnknown_0203A144->unk_080, BG_CTRL_ATTR_SCREENSIZE, 1);
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_MAPBASEINDEX, 2);
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_VISIBLE, gUnknown_0203A144->unk_081);
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_CHARBASEINDEX, gUnknown_0203A144->unk_082);
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_PRIORITY, 1);
SetBgAttribute(gUnknown_0203A144->bgNum, BG_CTRL_ATTR_SCREENSIZE, 1);
}
gUnknown_0203A144->unk_079 ++;
gUnknown_0203A144->initStep ++;
return FALSE;
default:
return FALSE;
}
gUnknown_0203A144->unk_079 ++;
gUnknown_0203A144->initStep ++;
return TRUE;
}
@ -171,17 +172,17 @@ void sub_8123030(u16 a0, u32 a1)
void sub_812305C(void)
{
if (gUnknown_0203A144->unk_01c != NULL)
if (gUnknown_0203A144->cursorSprite != NULL)
{
DestroySprite(gUnknown_0203A144->unk_01c);
FreeSpriteTilesByTag(gUnknown_0203A144->unk_058);
FreeSpritePaletteByTag(gUnknown_0203A144->unk_05a);
DestroySprite(gUnknown_0203A144->cursorSprite);
FreeSpriteTilesByTag(gUnknown_0203A144->cursorTileTag);
FreeSpritePaletteByTag(gUnknown_0203A144->cursorPaletteTag);
}
if (gUnknown_0203A144->unk_020 != NULL)
if (gUnknown_0203A144->playerIconSprite != NULL)
{
DestroySprite(gUnknown_0203A144->unk_020);
FreeSpriteTilesByTag(gUnknown_0203A144->unk_070);
FreeSpritePaletteByTag(gUnknown_0203A144->unk_072);
DestroySprite(gUnknown_0203A144->playerIconSprite);
FreeSpriteTilesByTag(gUnknown_0203A144->playerIconTileTag);
FreeSpritePaletteByTag(gUnknown_0203A144->playerIconPaletteTag);
}
}
@ -195,26 +196,26 @@ u8 sub_81230C4(void)
u8 input;
input = INPUT_EVENT_NONE;
gUnknown_0203A144->unk_07b = 0;
gUnknown_0203A144->unk_07c = 0;
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->unk_056 > 2)
gUnknown_0203A144->cursorDeltaX = 0;
gUnknown_0203A144->cursorDeltaY = 0;
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->cursorPosY > 2)
{
gUnknown_0203A144->unk_07c = -1;
gUnknown_0203A144->cursorDeltaY = -1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->unk_056 < 16)
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->cursorPosY < 16)
{
gUnknown_0203A144->unk_07c = +1;
gUnknown_0203A144->cursorDeltaY = +1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->unk_054 > 1)
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->cursorPosX > 1)
{
gUnknown_0203A144->unk_07b = -1;
gUnknown_0203A144->cursorDeltaX = -1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->unk_054 < 28)
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->cursorPosX < 28)
{
gUnknown_0203A144->unk_07b = +1;
gUnknown_0203A144->cursorDeltaX = +1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.newKeys & A_BUTTON)
@ -227,7 +228,7 @@ u8 sub_81230C4(void)
}
if (input == INPUT_EVENT_MOVE_START)
{
gUnknown_0203A144->unk_07a = 4;
gUnknown_0203A144->cursorMovementFrameCounter = 4;
gUnknown_0203A144->inputCallback = _swiopen;
}
return input;
@ -237,27 +238,27 @@ u8 _swiopen(void)
{
u16 mapSecId;
if (gUnknown_0203A144->unk_07a != 0)
if (gUnknown_0203A144->cursorMovementFrameCounter != 0)
{
return INPUT_EVENT_MOVE_CONT;
}
if (gUnknown_0203A144->unk_07b > 0)
if (gUnknown_0203A144->cursorDeltaX > 0)
{
gUnknown_0203A144->unk_054 ++;
gUnknown_0203A144->cursorPosX ++;
}
if (gUnknown_0203A144->unk_07b < 0)
if (gUnknown_0203A144->cursorDeltaX < 0)
{
gUnknown_0203A144->unk_054 --;
gUnknown_0203A144->cursorPosX --;
}
if (gUnknown_0203A144->unk_07c > 0)
if (gUnknown_0203A144->cursorDeltaY > 0)
{
gUnknown_0203A144->unk_056 ++;
gUnknown_0203A144->cursorPosY ++;
}
if (gUnknown_0203A144->unk_07c < 0)
if (gUnknown_0203A144->cursorDeltaY < 0)
{
gUnknown_0203A144->unk_056 --;
gUnknown_0203A144->cursorPosY --;
}
mapSecId = sub_812386C(gUnknown_0203A144->unk_054, gUnknown_0203A144->unk_056);
mapSecId = sub_812386C(gUnknown_0203A144->cursorPosX, gUnknown_0203A144->cursorPosY);
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(mapSecId);
if (mapSecId != gUnknown_0203A144->mapSecId)
{
@ -274,26 +275,26 @@ u8 sub_8123254(void)
u8 input;
input = INPUT_EVENT_NONE;
gUnknown_0203A144->unk_06a = 0;
gUnknown_0203A144->unk_068 = 0;
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->unk_05e > -0x34)
gUnknown_0203A144->zoomedCursorDeltaX = 0;
gUnknown_0203A144->zoomedCursorDeltaY = 0;
if (gMain.heldKeys & DPAD_UP && gUnknown_0203A144->scrollY > -0x34)
{
gUnknown_0203A144->unk_068 = -1;
gUnknown_0203A144->zoomedCursorDeltaY = -1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->unk_05e < 0x3c)
if (gMain.heldKeys & DPAD_DOWN && gUnknown_0203A144->scrollY < 0x3c)
{
gUnknown_0203A144->unk_068 = +1;
gUnknown_0203A144->zoomedCursorDeltaY = +1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->unk_05c > -0x2c)
if (gMain.heldKeys & DPAD_LEFT && gUnknown_0203A144->scrollX > -0x2c)
{
gUnknown_0203A144->unk_06a = -1;
gUnknown_0203A144->zoomedCursorDeltaX = -1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->unk_05c < 0xac)
if (gMain.heldKeys & DPAD_RIGHT && gUnknown_0203A144->scrollX < 0xac)
{
gUnknown_0203A144->unk_06a = +1;
gUnknown_0203A144->zoomedCursorDeltaX = +1;
input = INPUT_EVENT_MOVE_START;
}
if (gMain.newKeys & A_BUTTON)
@ -307,7 +308,44 @@ u8 sub_8123254(void)
if (input == INPUT_EVENT_MOVE_START)
{
gUnknown_0203A144->inputCallback = sub_8123334;
gUnknown_0203A144->unk_06c = 0;
gUnknown_0203A144->zoomedCursorMovementFrameCounter = 0;
}
return input;
}
u8 sub_8123334(void)
{
u16 x;
u16 y;
u16 mapSecId;
gUnknown_0203A144->scrollY += gUnknown_0203A144->zoomedCursorDeltaY;
gUnknown_0203A144->scrollX += gUnknown_0203A144->zoomedCursorDeltaX;
sub_812378C(gUnknown_0203A144->scrollX, gUnknown_0203A144->scrollY);
gUnknown_0203A144->zoomedCursorMovementFrameCounter ++;
if (gUnknown_0203A144->zoomedCursorMovementFrameCounter == 8)
{
x = (gUnknown_0203A144->scrollX + 0x2c) / 8 + 1;
y = (gUnknown_0203A144->scrollY + 0x34) / 8 + 2;
if (x != gUnknown_0203A144->unk_064 || y != gUnknown_0203A144->unk_066)
{
gUnknown_0203A144->unk_064 = x;
gUnknown_0203A144->unk_066 = y;
mapSecId = sub_812386C(x, y);
gUnknown_0203A144->unk_002 = get_flagnr_blue_points(mapSecId);
if (mapSecId != gUnknown_0203A144->mapSecId)
{
gUnknown_0203A144->mapSecId = mapSecId;
GetMapName(gUnknown_0203A144->mapSecName, gUnknown_0203A144->mapSecId, 16);
}
sub_8123FB0();
}
gUnknown_0203A144->zoomedCursorMovementFrameCounter = 0;
gUnknown_0203A144->inputCallback = sub_8123254;
return INPUT_EVENT_MOVE_END;
}
else
{
return INPUT_EVENT_MOVE_CONT;
}
}