summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2019-12-23 13:33:06 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2019-12-23 13:33:06 -0500
commit59581b3c574453ee38e86020adb5745d21471ef4 (patch)
tree3aabcfe637ca39a9c39c4df67a96ab65b03624dc /src
parentf1d821ecc28d8355b83fae6f0a2a890992c6929f (diff)
region_map through sub_80BFFD0
Diffstat (limited to 'src')
-rw-r--r--src/data/text/map_section_names.h109
-rw-r--r--src/region_map.c160
2 files changed, 269 insertions, 0 deletions
diff --git a/src/data/text/map_section_names.h b/src/data/text/map_section_names.h
new file mode 100644
index 000000000..5a18fa7c9
--- /dev/null
+++ b/src/data/text/map_section_names.h
@@ -0,0 +1,109 @@
+const u8 gMapSecName_PalletTown[] = _("PALLET TOWN");
+const u8 gMapSecName_ViridianCity[] = _("VIRIDIAN CITY");
+const u8 gMapSecName_PewterCity[] = _("PEWTER CITY");
+const u8 gMapSecName_CeruleanCity[] = _("CERULEAN CITY");
+const u8 gMapSecName_LavenderTown[] = _("LAVENDER TOWN");
+const u8 gMapSecName_VermilionCity[] = _("VERMILION CITY");
+const u8 gMapSecName_CeladonCity[] = _("CELADON CITY");
+const u8 gMapSecName_FuchsiaCity[] = _("FUCHSIA CITY");
+const u8 gMapSecName_CinnabarIsland[] = _("CINNABAR ISLAND");
+const u8 gMapSecName_IndigoPlateau[] = _("INDIGO PLATEAU");
+const u8 gMapSecName_SaffronCity[] = _("SAFFRON CITY");
+const u8 gMapSecName_Route4[] = _("ROUTE 4");
+const u8 gMapSecName_Route10[] = _("ROUTE 10");
+const u8 gMapSecName_Route1[] = _("ROUTE 1");
+const u8 gMapSecName_Route2[] = _("ROUTE 2");
+const u8 gMapSecName_Route3[] = _("ROUTE 3");
+const u8 gMapSecName_Route4_2[] = _("ROUTE 4");
+const u8 gMapSecName_Route5[] = _("ROUTE 5");
+const u8 gMapSecName_Route6[] = _("ROUTE 6");
+const u8 gMapSecName_Route7[] = _("ROUTE 7");
+const u8 gMapSecName_Route8[] = _("ROUTE 8");
+const u8 gMapSecName_Route9[] = _("ROUTE 9");
+const u8 gMapSecName_Route10_2[] = _("ROUTE 10");
+const u8 gMapSecName_Route11[] = _("ROUTE 11");
+const u8 gMapSecName_Route12[] = _("ROUTE 12");
+const u8 gMapSecName_Route13[] = _("ROUTE 13");
+const u8 gMapSecName_Route14[] = _("ROUTE 14");
+const u8 gMapSecName_Route15[] = _("ROUTE 15");
+const u8 gMapSecName_Route16[] = _("ROUTE 16");
+const u8 gMapSecName_Route17[] = _("ROUTE 17");
+const u8 gMapSecName_Route18[] = _("ROUTE 18");
+const u8 gMapSecName_Route19[] = _("ROUTE 19");
+const u8 gMapSecName_Route20[] = _("ROUTE 20");
+const u8 gMapSecName_Route21[] = _("ROUTE 21");
+const u8 gMapSecName_Route22[] = _("ROUTE 22");
+const u8 gMapSecName_Route23[] = _("ROUTE 23");
+const u8 gMapSecName_Route24[] = _("ROUTE 24");
+const u8 gMapSecName_Route25[] = _("ROUTE 25");
+const u8 gMapSecName_ViridianForest[] = _("VIRIDIAN FOREST");
+const u8 gMapSecName_MtMoon[] = _("MT. MOON");
+const u8 gMapSecName_SSAnne[] = _("S.S. ANNE");
+const u8 gMapSecName_UndergroundPath[] = _("UNDERGROUND PATH");
+const u8 gMapSecName_UndergroundPath_2[] = _("UNDERGROUND PATH");
+const u8 gMapSecName_DiglettsCave[] = _("DIGLETT'S CAVE");
+const u8 gMapSecName_VictoryRoad[] = _("VICTORY ROAD");
+const u8 gMapSecName_RocketHideout[] = _("ROCKET HIDEOUT");
+const u8 gMapSecName_SilphCo[] = _("SILPH CO.");
+const u8 gMapSecName_PokemonMansion[] = _("POKéMON MANSION");
+const u8 gMapSecName_SafariZone[] = _("SAFARI ZONE");
+const u8 gMapSecName_PokemonLeague[] = _("POKéMON LEAGUE");
+const u8 gMapSecName_RockTunnel[] = _("ROCK TUNNEL");
+const u8 gMapSecName_SeafoamIslands[] = _("SEAFOAM ISLANDS");
+const u8 gMapSecName_PokemonTower[] = _("POKéMON TOWER");
+const u8 gMapSecName_CeruleanCave[] = _("CERULEAN CAVE");
+const u8 gMapSecName_PowerPlant[] = _("POWER PLANT");
+const u8 gMapSecName_OneIsland[] = _("ONE ISLAND");
+const u8 gMapSecName_TwoIsland[] = _("TWO ISLAND");
+const u8 gMapSecName_ThreeIsland[] = _("THREE ISLAND");
+const u8 gMapSecName_FourIsland[] = _("FOUR ISLAND");
+const u8 gMapSecName_FiveIsland[] = _("FIVE ISLAND");
+const u8 gMapSecName_SevenIsland[] = _("SEVEN ISLAND");
+const u8 gMapSecName_SixIsland[] = _("SIX ISLAND");
+const u8 gMapSecName_KindleRoad[] = _("KINDLE ROAD");
+const u8 gMapSecName_TreasureBeach[] = _("TREASURE BEACH");
+const u8 gMapSecName_CapeBrink[] = _("CAPE BRINK");
+const u8 gMapSecName_BondBridge[] = _("BOND BRIDGE");
+const u8 gMapSecName_ThreeIslePort[] = _("THREE ISLE PORT");
+const u8 gMapSecName_SeviiIsle6[] = _("SEVII ISLE 6");
+const u8 gMapSecName_SeviiIsle7[] = _("SEVII ISLE 7");
+const u8 gMapSecName_SeviiIsle8[] = _("SEVII ISLE 8");
+const u8 gMapSecName_SeviiIsle9[] = _("SEVII ISLE 9");
+const u8 gMapSecName_ResortGorgeous[] = _("RESORT GORGEOUS");
+const u8 gMapSecName_WaterLabyrinth[] = _("WATER LABYRINTH");
+const u8 gMapSecName_FiveIsleMeadow[] = _("FIVE ISLE MEADOW");
+const u8 gMapSecName_MemorialPillar[] = _("MEMORIAL PILLAR");
+const u8 gMapSecName_OutcastIsland[] = _("OUTCAST ISLAND");
+const u8 gMapSecName_GreenPath[] = _("GREEN PATH");
+const u8 gMapSecName_WaterPath[] = _("WATER PATH");
+const u8 gMapSecName_RuinValley[] = _("RUIN VALLEY");
+const u8 gMapSecName_TrainerTower[] = _("TRAINER TOWER");
+const u8 gMapSecName_CanyonEntrance[] = _("CANYON ENTRANCE");
+const u8 gMapSecName_SevaultCanyon[] = _("SEVAULT CANYON");
+const u8 gMapSecName_TanobyRuins[] = _("TANOBY RUINS");
+const u8 gMapSecName_SeviiIsle22[] = _("SEVII ISLE 22");
+const u8 gMapSecName_SeviiIsle23[] = _("SEVII ISLE 23");
+const u8 gMapSecName_SeviiIsle24[] = _("SEVII ISLE 24");
+const u8 gMapSecName_NavelRock[] = _("NAVEL ROCK");
+const u8 gMapSecName_MtEmber[] = _("MT. EMBER");
+const u8 gMapSecName_BerryForest[] = _("BERRY FOREST");
+const u8 gMapSecName_IcefallCave[] = _("ICEFALL CAVE");
+const u8 gMapSecName_RocketWarehouse[] = _("ROCKET WAREHOUSE");
+const u8 gMapSecName_TrainerTower_2[] = _("TRAINER TOWER");
+const u8 gMapSecName_DottedHole[] = _("DOTTED HOLE");
+const u8 gMapSecName_LostCave[] = _("LOST CAVE");
+const u8 gMapSecName_PatternBush[] = _("PATTERN BUSH");
+const u8 gMapSecName_AlteringCave[] = _("ALTERING CAVE");
+const u8 gMapSecName_TanobyChambers[] = _("TANOBY CHAMBERS");
+const u8 gMapSecName_ThreeIslePath[] = _("THREE ISLE PATH");
+const u8 gMapSecName_TanobyKey[] = _("TANOBY KEY");
+const u8 gMapSecName_BirthIsland[] = _("BIRTH ISLAND");
+const u8 gMapSecName_MoneanChamber[] = _("MONEAN CHAMBER");
+const u8 gMapSecName_LiptooChamber[] = _("LIPTOO CHAMBER");
+const u8 gMapSecName_WeepthChamber[] = _("WEEPTH CHAMBER");
+const u8 gMapSecName_DilfordChamber[] = _("DILFORD CHAMBER");
+const u8 gMapSecName_ScufibChamber[] = _("SCUFIB CHAMBER");
+const u8 gMapSecName_RixyChamber[] = _("RIXY CHAMBER");
+const u8 gMapSecName_ViapoisChamber[] = _("VIAPOIS CHAMBER");
+const u8 gMapSecName_EmberSpa[] = _("EMBER SPA");
+const u8 gMapSecName_CeladonDept[] = _("CELADON DEPT.");
diff --git a/src/region_map.c b/src/region_map.c
new file mode 100644
index 000000000..97bcd476b
--- /dev/null
+++ b/src/region_map.c
@@ -0,0 +1,160 @@
+#include "global.h"
+#include "palette.h"
+#include "task.h"
+#include "malloc.h"
+#include "overworld.h"
+#include "event_data.h"
+#include "region_map.h"
+#include "constants/flags.h"
+#include "constants/region_map.h"
+
+struct UnkStruct_20399D4
+{
+ u8 filler_0000[0x4796];
+ u8 field_4796;
+ u8 field_4797[4];
+ u8 field_479B;
+ u8 field_479C;
+ u8 filler_479D[3];
+ u8 field_47A0;
+ u8 filler_47A1[3];
+ u8 field_47A4;
+ u8 filler_47A5[3];
+ u8 field_47A8;
+ u8 filler_47A9[15];
+ TaskFunc field_47B8;
+ MainCallback field_47BC;
+};
+
+EWRAM_DATA struct UnkStruct_20399D4 * gUnknown_20399D4 = NULL;
+EWRAM_DATA void * gUnknown_20399D8 = NULL;
+EWRAM_DATA void * gUnknown_20399DC = NULL;
+EWRAM_DATA void * gUnknown_20399E0 = NULL;
+EWRAM_DATA void * gUnknown_20399E4 = NULL;
+EWRAM_DATA void * gUnknown_20399E8 = NULL;
+EWRAM_DATA void * gUnknown_20399EC = NULL;
+EWRAM_DATA void * gUnknown_20399F0[3] = {};
+EWRAM_DATA void * gUnknown_20399FC = NULL;
+
+static void sub_80BFFD0(void);
+void sub_80C0100(void);
+void sub_80C04E4(u8 taskId);
+void sub_80C4F08(u8 taskId);
+
+#include "data/text/map_section_names.h"
+
+extern const u16 gUnknown_83EF2DC[];
+extern const u8 sSeviiMapsecs[3][30];
+extern const u8 gUnknown_83F1B00[3][4];
+
+static void RegionMap_DarkenPalette(u16 *pal, u16 size, u16 tint)
+{
+ int i;
+ int r, g, b;
+
+ for (i = 0; i < size; i++)
+ {
+ r = (*pal) & 0x1F;
+ g = ((*pal) >> 5) & 0x1F;
+ b = ((*pal) >> 10) & 0x1F;
+
+ r = (((r << 8) / 100) * tint) >> 8;
+ g = (((g << 8) / 100) * tint) >> 8;
+ b = (((b << 8) / 100) * tint) >> 8;
+
+ *pal = RGB2(r, g, b);
+ pal++;
+ }
+}
+
+void sub_80BFEA0(void)
+{
+ u16 pal[16];
+ CpuCopy16(&gUnknown_83EF2DC[0x20], pal, sizeof(pal));
+ RegionMap_DarkenPalette(pal, NELEMS(pal), 95);
+ LoadPalette(pal, 0x20, 0x20);
+ LoadPalette(&gUnknown_83EF2DC[0x2F], 0x2F, sizeof(u16));
+}
+
+void sub_80BFEDC(u8 kind)
+{
+ gUnknown_20399D4 = AllocZeroed(sizeof(struct UnkStruct_20399D4));
+ if (gUnknown_20399D4 == NULL)
+ {
+ SetMainCallback2(CB2_ReturnToField);
+ }
+ else
+ {
+ gUnknown_2031DE0 = TRUE;
+ gUnknown_20399D4->field_4796 = kind;
+ gUnknown_20399D4->field_47A0 = 0;
+ gUnknown_20399D4->field_47A4 = 0;
+ gUnknown_20399D4->field_47A8 = 0;
+ sub_80BFFD0();
+ SetMainCallback2(sub_80C0100);
+ }
+}
+
+void sub_80BFF50(u8 kind, MainCallback cb)
+{
+ gUnknown_20399D4 = AllocZeroed(sizeof(struct UnkStruct_20399D4));
+ if (gUnknown_20399D4 == NULL)
+ {
+ SetMainCallback2(CB2_ReturnToField);
+ }
+ else
+ {
+ gUnknown_2031DE0 = TRUE;
+ gUnknown_20399D4->field_4796 = kind;
+ gUnknown_20399D4->field_47A0 = 0;
+ gUnknown_20399D4->field_47A4 = 0;
+ gUnknown_20399D4->field_47A8 = 0;
+ gUnknown_20399D4->field_47BC = cb;
+ sub_80BFFD0();
+ SetMainCallback2(sub_80C0100);
+ }
+}
+
+static void sub_80BFFD0(void)
+{
+ u8 i;
+ u8 j;
+ u8 r7;
+
+ switch (gUnknown_20399D4->field_4796)
+ {
+ default:
+ case 0:
+ case 1:
+ gUnknown_20399D4->field_47B8 = sub_80C04E4;
+ break;
+ case 2:
+ gUnknown_20399D4->field_47B8 = sub_80C4F08;
+ break;
+ }
+ for (i = 0; i < 4; i++)
+ {
+ gUnknown_20399D4->field_4797[i] = gUnknown_83F1B00[gUnknown_20399D4->field_4796][i];
+ }
+ if (!FlagGet(FLAG_SYS_SEVII_MAP_123))
+ gUnknown_20399D4->field_4797[0] = FALSE;
+ r7 = 0;
+ j = 0;
+ if (gMapHeader.regionMapSectionId >= MAPSECS_SEVII_123)
+ {
+ while (r7 == 0)
+ {
+ for (i = 0; sSeviiMapsecs[j][i] != MAPSEC_NONE; i++)
+ {
+ if (gMapHeader.regionMapSectionId == sSeviiMapsecs[j][i])
+ {
+ r7 = j + 1;
+ break;
+ }
+ }
+ j++;
+ }
+ }
+ gUnknown_20399D4->field_479B = r7;
+ gUnknown_20399D4->field_479C = r7;
+}