summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2017-10-30 22:35:28 -0400
committerPikalaxALT <pikalaxalt@gmail.com>2017-10-30 22:35:28 -0400
commit853ced668731a5107be87bbe69aa8d1891504865 (patch)
tree3172097c6f8f8394a089a7f0fdf9688059bea41f /src
parent4db83e00971029fe97282496f76432e3c88d1ba7 (diff)
sub_8123FB0
Diffstat (limited to 'src')
-rw-r--r--src/region_map.c81
-rw-r--r--src/tv.c4
2 files changed, 67 insertions, 18 deletions
diff --git a/src/region_map.c b/src/region_map.c
index a5a84a187..8e31168d6 100644
--- a/src/region_map.c
+++ b/src/region_map.c
@@ -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;
+}
diff --git a/src/tv.c b/src/tv.c
index 305bfeda9..87aa6e01a 100644
--- a/src/tv.c
+++ b/src/tv.c
@@ -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)
{