sub_8123FB0

This commit is contained in:
PikalaxALT 2017-10-30 22:35:28 -04:00
parent 4db83e0097
commit 853ced6687
4 changed files with 71 additions and 94 deletions

View File

@ -5,78 +5,6 @@
.text
thumb_func_start sub_8123FB0
sub_8123FB0: @ 8123FB0
push {r4-r6,lr}
ldr r0, =gRegionMap
ldr r1, [r0]
ldrh r0, [r1]
cmp r0, 0xD5
bne _08123FC8
movs r0, 0
strb r0, [r1, 0x3]
b _0812402E
.pool
_08123FC8:
adds r0, r1, 0
adds r0, 0x78
ldrb r0, [r0]
cmp r0, 0
bne _08123FD8
adds r0, r1, 0
adds r0, 0x54
b _08123FDC
_08123FD8:
adds r0, r1, 0
adds r0, 0x64
_08123FDC:
ldrh r4, [r0]
adds r0, 0x2
ldrh r5, [r0]
movs r6, 0
b _08124008
_08123FE6:
subs r0, r4, 0x1
lsls r0, 16
lsrs r4, r0, 16
adds r0, r4, 0
adds r1, r5, 0
bl GetRegionMapSectionIdAt
ldr r1, =gRegionMap
ldr r1, [r1]
lsls r0, 16
lsrs r0, 16
ldrh r1, [r1]
cmp r0, r1
bne _08124008
adds r0, r6, 0x1
lsls r0, 16
lsrs r6, r0, 16
_08124008:
cmp r4, 0x1
bhi _08123FE6
adds r0, r5, 0
bl sub_8124038
lsls r0, 24
cmp r0, 0
beq _08124028
subs r0, r5, 0x1
lsls r0, 16
lsrs r5, r0, 16
movs r4, 0x1D
b _08124008
.pool
_08124028:
ldr r0, =gRegionMap
ldr r0, [r0]
strb r6, [r0, 0x3]
_0812402E:
pop {r4-r6}
pop {r0}
bx r0
.pool
thumb_func_end sub_8123FB0
thumb_func_start sub_8124038
sub_8124038: @ 8124038
push {r4,r5,lr}

View File

@ -93,7 +93,7 @@ enum {
MAPSEC_INSIDE_OF_TRUCK,
MAPSEC_SKY_PILLAR,
MAPSEC_SECRET_BASE,
MAPSEC_NONE,
MAPSEC_UNK_0x57,
MAPSEC_PALLET_TOWN,
MAPSEC_VIRIDIAN_CITY,
MAPSEC_PEWTER_CITY,
@ -219,7 +219,7 @@ enum {
MAPSEC_ALTERING_CAVE_2,
MAPSEC_NAVEL_ROCK2,
MAPSEC_TRAINER_HILL,
MAPSEC_NONE2
MAPSEC_NONE
};
struct RegionMap {
@ -250,8 +250,8 @@ struct RegionMap {
/*0x05e*/ s16 scrollY;
/*0x060*/ s16 unk_060;
/*0x062*/ s16 unk_062;
/*0x064*/ u16 unk_064;
/*0x066*/ u16 unk_066;
/*0x064*/ u16 zoomedCursorPosX;
/*0x066*/ u16 zoomedCursorPosY;
/*0x068*/ s16 zoomedCursorDeltaY;
/*0x06a*/ s16 zoomedCursorDeltaX;
/*0x06c*/ u16 zoomedCursorMovementFrameCounter;

View File

@ -53,8 +53,9 @@ static u8 get_flagnr_blue_points(u16 mapSecId);
u16 sub_8123EB4(u16 mapSecId);
static u16 sub_8123F04(void);
static void sub_8123F30(u16 *x, u16 *y);
void sub_8123FB0(void);
bool32 sub_8123F74(u8 mapSecId);
static bool32 sub_8123F74(u8 mapSecId);
static void sub_8123FB0(void);
bool8 sub_8124038(u16 y);
void sub_8124238(void);
void sub_81243B0(void);
void sub_81243DC(void);
@ -168,8 +169,8 @@ bool8 sub_8122DB0(void)
{
gRegionMap->scrollX = gRegionMap->cursorPosX * 8 - 0x34;
gRegionMap->scrollY = gRegionMap->cursorPosY * 8 - 0x44;
gRegionMap->unk_064 = gRegionMap->cursorPosX;
gRegionMap->unk_066 = gRegionMap->cursorPosY;
gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX;
gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY;
CalcZoomScrollParams(gRegionMap->scrollX, gRegionMap->scrollY, 0x38, 0x48, 0x80, 0x80, 0);
}
break;
@ -360,10 +361,10 @@ static u8 MoveRegionMapCursor_Zoomed(void)
{
x = (gRegionMap->scrollX + 0x2c) / 8 + 1;
y = (gRegionMap->scrollY + 0x34) / 8 + 2;
if (x != gRegionMap->unk_064 || y != gRegionMap->unk_066)
if (x != gRegionMap->zoomedCursorPosX || y != gRegionMap->zoomedCursorPosY)
{
gRegionMap->unk_064 = x;
gRegionMap->unk_066 = y;
gRegionMap->zoomedCursorPosX = x;
gRegionMap->zoomedCursorPosY = y;
mapSecId = GetRegionMapSectionIdAt(x, y);
gRegionMap->iconDrawType = get_flagnr_blue_points(mapSecId);
if (mapSecId != gRegionMap->mapSecId)
@ -392,8 +393,8 @@ void sub_8123418(void)
gRegionMap->unk_062 = gRegionMap->cursorPosY * 8 - 0x44;
gRegionMap->unk_044 = (gRegionMap->unk_060 << 8) / 16;
gRegionMap->unk_048 = (gRegionMap->unk_062 << 8) / 16;
gRegionMap->unk_064 = gRegionMap->cursorPosX;
gRegionMap->unk_066 = gRegionMap->cursorPosY;
gRegionMap->zoomedCursorPosX = gRegionMap->cursorPosX;
gRegionMap->zoomedCursorPosY = gRegionMap->cursorPosY;
gRegionMap->unk_04c = 0x10000;
gRegionMap->unk_050 = -0x800;
}
@ -405,8 +406,8 @@ void sub_8123418(void)
gRegionMap->unk_062 = 0;
gRegionMap->unk_044 = -(gRegionMap->unk_03c / 16);
gRegionMap->unk_048 = -(gRegionMap->unk_040 / 16);
gRegionMap->cursorPosX = gRegionMap->unk_064;
gRegionMap->cursorPosY = gRegionMap->unk_066;
gRegionMap->cursorPosX = gRegionMap->zoomedCursorPosX;
gRegionMap->cursorPosY = gRegionMap->zoomedCursorPosY;
gRegionMap->unk_04c = 0x8000;
gRegionMap->unk_050 = 0x800;
}
@ -537,7 +538,7 @@ u16 GetRegionMapSectionIdAt(u16 x, u16 y)
{
if (y < MAPCURSOR_Y_MIN || y > MAPCURSOR_Y_MAX || x < MAPCURSOR_X_MIN || x > MAPCURSOR_X_MAX)
{
return MAPSEC_NONE2;
return MAPSEC_NONE;
}
y -= MAPCURSOR_Y_MIN;
x -= MAPCURSOR_X_MIN;
@ -617,7 +618,7 @@ static void sub_81238AC(void)
case 8:
gRegionMap->mapSecId = gMapHeader.regionMapSectionId;
if (gRegionMap->mapSecId != MAPSEC_NONE)
if (gRegionMap->mapSecId != MAPSEC_UNK_0x57)
{
r4 = &gSaveBlock1Ptr->warp4;
mapHeader = get_mapheader_by_bank_and_number(r4->mapGroup, r4->mapNum);
@ -775,7 +776,7 @@ static u8 get_flagnr_blue_points(u16 mapSecId)
{
switch (mapSecId)
{
case MAPSEC_NONE2:
case MAPSEC_NONE:
return MAPSECTYPE_NONE;
case MAPSEC_LITTLEROOT_TOWN:
return FlagGet(FLAG_VISITED_LITTLEROOT_TOWN) ? MAPSECTYPE_CITY_CANFLY : MAPSECTYPE_CITY_CANTFLY;
@ -834,7 +835,7 @@ u16 sub_8123EB4(u16 mapSecId)
return sub_8123F04();
}
}
for (i = 0; gUnknown_085A1B24[i][0] != MAPSEC_NONE2; i ++)
for (i = 0; gUnknown_085A1B24[i][0] != MAPSEC_NONE; i ++)
{
if (gUnknown_085A1B24[i][0] == mapSecId)
{
@ -870,7 +871,7 @@ static void sub_8123F30(u16 *x, u16 *y)
*y = gUnknown_085A1BAC[idx].y + MAPCURSOR_Y_MIN;
}
bool32 sub_8123F74(u8 mapSecId)
static bool32 sub_8123F74(u8 mapSecId)
{
int i;
@ -888,3 +889,51 @@ u16 sub_8123F9C(u16 mapSecId)
{
return sub_8123EB4(mapSecId);
}
static void sub_8123FB0(void)
{
u16 x;
u16 y;
u16 unk_003;
if (gRegionMap->mapSecId == MAPSEC_NONE)
{
gRegionMap->unk_003 = 0;
return;
}
if (!gRegionMap->zoomed)
{
x = gRegionMap->cursorPosX;
y = gRegionMap->cursorPosY;
}
else
{
x = gRegionMap->zoomedCursorPosX;
y = gRegionMap->zoomedCursorPosY;
}
unk_003 = 0;
while (1)
{
if (x <= MAPCURSOR_X_MIN)
{
if (sub_8124038(y))
{
y --;
x = MAPCURSOR_X_MAX + 1;
}
else
{
break;
}
}
else
{
x --;
if (GetRegionMapSectionIdAt(x, y) == gRegionMap->mapSecId)
{
unk_003 ++;
}
}
}
gRegionMap->unk_003 = unk_003;
}

View File

@ -6435,7 +6435,7 @@ void DoTVShowTodaysRivalTrainer(void)
case MAPSEC_SECRET_BASE:
sTVShowState = 8;
break;
case MAPSEC_NONE:
case MAPSEC_UNK_0x57:
switch (show->rivalTrainer.mapDataId)
{
case 0x115 ... 0x117:
@ -6633,7 +6633,7 @@ void DoTVShowHoennTreasureInvestigators(void)
{
case 0:
StringCopy(gStringVar1, ItemId_GetItem(show->treasureInvestigators.item)->name);
if (show->treasureInvestigators.location == MAPSEC_NONE)
if (show->treasureInvestigators.location == MAPSEC_UNK_0x57)
{
switch (show->treasureInvestigators.mapDataId)
{