fix areas for emerald/hgss region map

This commit is contained in:
cawtds 2025-11-15 15:52:47 +01:00
parent dcc898d65b
commit f58c48d2b7
13 changed files with 212 additions and 200 deletions

View File

@ -1,7 +1,7 @@
#ifndef GUARD_CONFIG_POKEDEX_PLUS_HGSS_H
#define GUARD_CONFIG_POKEDEX_PLUS_HGSS_H
#define POKEDEX_PLUS_HGSS TRUE // If TRUE, enables the custom HGSS style Pokedex.
#define POKEDEX_PLUS_HGSS FALSE // If TRUE, enables the custom HGSS style Pokedex.
#define HGSS_DECAPPED FALSE // If TRUE, uses decapped gfx and strings.
#define HGSS_DARK_MODE FALSE // If TRUE, enables dark mode.
#define HGSS_HIDE_UNSEEN_EVOLUTION_NAMES FALSE // If TRUE, hides evolution mon names.
@ -9,4 +9,6 @@
#define HGSS_SORT_TMS_BY_NUM FALSE // If TRUE, sorts the TMS in HGSS Dex by TM number, rather than alphabetically.
#define HGSS_SHOW_EGG_MOVES_FOR_EVOS FALSE // If TRUE, shows Egg Moves for evolved Pokémon too.
#define POKEDEX_EMERALD FALSE // requires POKEDEX_PLUS_HGSS to be FALSE
#endif // GUARD_CONFIG_POKEDEX_PLUS_HGSS_H

View File

@ -102,7 +102,7 @@ struct PokedexEntry
u16 GetNationalPokedexCount(u8);
u16 GetKantoPokedexCount(u8);
bool16 HasAllMons(void);
s8 GetSetPokedexFlag(u16 nationalNum, u8 caseId);
s8 GetSetPokedexFlag(enum NationalDexOrder nationalDexNo, u8 caseID);
bool16 HasAllHoennMons(void);
bool16 HasAllKantoMons(void);
bool16 HasAllMons(void);

View File

@ -1,5 +1,5 @@
#ifndef GUARD_POKEDEX_H
#define GUARD_POKEDEX_H
#ifndef GUARD_POKEDEX_EMERALD_H
#define GUARD_POKEDEX_EMERALD_H
extern u8 gUnusedPokedexU8;
extern void (*gPokedexVBlankCB)(void);
@ -10,7 +10,6 @@ u16 GetHoennPokedexCount(u8 caseID);
u16 GetKantoPokedexCount(u8 caseID);
u8 DisplayCaughtMonDexPage(u16 species, bool32 isShiny, u32 personality);
u32 Pokedex_CreateCaughtMonSprite(u32 species, s32 x, s32 y);
s8 GetSetPokedexFlag(enum NationalDexOrder nationalDexNo, u8 caseID);
void DrawFootprint(u8 windowId, u16 species);
u16 CreateMonSpriteFromNationalDexNumber(enum NationalDexOrder nationalNum, s16 x, s16 y, u16 paletteSlot);
bool16 HasAllRegionalMons(void);
@ -23,4 +22,4 @@ void PrintMonMeasurements(u16 species, u32 owned);
u8* ConvertMonHeightToString(u32 height);
u8* ConvertMonWeightToString(u32 weight);
#endif // GUARD_POKEDEX_H
#endif // GUARD_POKEDEX_EMERALD_H

View File

@ -573,32 +573,32 @@
{
"id": "MAPSEC_VIRIDIAN_FOREST",
"name": "VIRIDIAN FOREST",
"x": 0,
"y": 0,
"x": 4,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_MT_MOON",
"name": "MT. MOON",
"x": 0,
"y": 0,
"x": 9,
"y": 3,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_S_S_ANNE",
"name": "S.S. ANNE",
"x": 0,
"y": 0,
"x": 14,
"y": 9,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_UNDERGROUND_PATH",
"name": "UNDERGROUND PATH",
"x": 0,
"y": 0,
"x": 14,
"y": 7,
"width": 1,
"height": 1
},
@ -606,104 +606,104 @@
"id": "MAPSEC_UNDERGROUND_PATH_2",
"name": "UNDERGROUND PATH",
"name_clone": true,
"x": 0,
"y": 0,
"x": 12,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_DIGLETTS_CAVE",
"name": "DIGLETT'S CAVE",
"x": 0,
"y": 0,
"x": 15,
"y": 9,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_KANTO_VICTORY_ROAD",
"name": "VICTORY ROAD",
"x": 0,
"y": 0,
"x": 2,
"y": 4,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_ROCKET_HIDEOUT",
"name": "ROCKET HIDEOUT",
"x": 0,
"y": 0,
"x": 11,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_SILPH_CO",
"name": "SILPH CO.",
"x": 0,
"y": 0,
"x": 14,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_POKEMON_MANSION",
"name": "POKéMON MANSION",
"x": 0,
"y": 0,
"x": 4,
"y": 14,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_KANTO_SAFARI_ZONE",
"name": "SAFARI ZONE",
"x": 0,
"y": 0,
"x": 12,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_POKEMON_LEAGUE",
"name": "POKéMON LEAGUE",
"x": 0,
"y": 0,
"x": 2,
"y": 3,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_ROCK_TUNNEL",
"name": "ROCK TUNNEL",
"x": 0,
"y": 0,
"x": 18,
"y": 5,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_SEAFOAM_ISLANDS",
"name": "SEAFOAM ISLANDS",
"x": 0,
"y": 0,
"x": 8,
"y": 14,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_POKEMON_TOWER",
"name": "POKéMON TOWER",
"x": 0,
"y": 0,
"x": 18,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_CERULEAN_CAVE",
"name": "CERULEAN CAVE",
"x": 0,
"y": 0,
"x": 13,
"y": 3,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_POWER_PLANT",
"name": "POWER PLANT",
"x": 0,
"y": 0,
"x": 18,
"y": 4,
"width": 1,
"height": 1
},
@ -966,32 +966,32 @@
{
"id": "MAPSEC_MT_EMBER",
"name": "MT. EMBER",
"x": 0,
"y": 0,
"x": 2,
"y": 3,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_BERRY_FOREST",
"name": "BERRY FOREST",
"x": 0,
"y": 0,
"x": 14,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_ICEFALL_CAVE",
"name": "ICEFALL CAVE",
"x": 0,
"y": 0,
"x": 3,
"y": 4,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_ROCKET_WAREHOUSE",
"name": "ROCKET WAREHOUSE",
"x": 0,
"y": 0,
"x": 17,
"y": 11,
"width": 1,
"height": 1
},
@ -999,39 +999,39 @@
"id": "MAPSEC_TRAINER_TOWER_2",
"name": "TRAINER TOWER",
"name_clone": true,
"x": 0,
"y": 0,
"x": 5,
"y": 6,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_DOTTED_HOLE",
"name": "DOTTED HOLE",
"x": 0,
"y": 0,
"x": 16,
"y": 8,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_LOST_CAVE",
"name": "LOST CAVE",
"x": 0,
"y": 0,
"x": 18,
"y": 9,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_PATTERN_BUSH",
"name": "PATTERN BUSH",
"x": 0,
"y": 0,
"x": 17,
"y": 3,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_ALTERING_CAVE_FRLG",
"name": "ALTERING CAVE",
"x": 0,
"x": 15,
"y": 0,
"width": 1,
"height": 1
@ -1039,24 +1039,24 @@
{
"id": "MAPSEC_TANOBY_CHAMBERS",
"name": "TANOBY CHAMBERS",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_THREE_ISLE_PATH",
"name": "THREE ISLE PATH",
"x": 0,
"y": 0,
"x": 18,
"y": 13,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_TANOBY_KEY",
"name": "TANOBY KEY",
"x": 0,
"y": 0,
"x": 6,
"y": 9,
"width": 1,
"height": 1
},
@ -1071,56 +1071,56 @@
{
"id": "MAPSEC_MONEAN_CHAMBER",
"name": "MONEAN CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_LIPTOO_CHAMBER",
"name": "LIPTOO CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_WEEPTH_CHAMBER",
"name": "WEEPTH CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_DILFORD_CHAMBER",
"name": "DILFORD CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_SCUFIB_CHAMBER",
"name": "SCUFIB CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_RIXY_CHAMBER",
"name": "RIXY CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},
{
"id": "MAPSEC_VIAPOIS_CHAMBER",
"name": "VIAPOIS CHAMBER",
"x": 0,
"y": 0,
"x": 9,
"y": 12,
"width": 1,
"height": 1
},

View File

@ -2,7 +2,7 @@
#include "pokedex.h"
#include "pokedex_screen.h"
s8 GetSetPokedexFlag(u16 nationalDexNo, u8 caseID)
s8 GetSetPokedexFlag(enum NationalDexOrder nationalDexNo, u8 caseID)
{
return DexScreen_GetSetPokedexFlag(nationalDexNo, caseID, 0);
}

View File

@ -98,7 +98,7 @@ static const struct Subsprite *const sSubsprites[] = {
[MARKER_LARGE_V] = &sSubsprite_LargeVertical
};
static const s8 sAreaMarkers[][4] = {
const s8 sAreaMarkers[][4] = {
// Marker, x, y
[DEX_AREA_NONE] = {},
[DEX_AREA_PALLET_TOWN] = { MARKER_CIRCULAR, 54, 44 },

View File

@ -14,6 +14,7 @@
#include "m4a.h"
#include "overworld.h"
#include "palette.h"
#include "pokedex.h"
#include "pokedex_emerald.h"
#include "pokedex_emerald_area_screen.h"
#include "pokedex_emerald_cry_screen.h"
@ -286,11 +287,11 @@ static u8* ReplaceDecimalSeparator(const u8* originalString);
static void PrintOwnedMonMeasurements(u16 species);
static void PrintOwnedMonHeight(u16 species);
static void PrintOwnedMonWeight(u16 species);
static u8* ConvertMonHeightToImperialString(u32 height);
static u8* ConvertMonHeightToMetricString(u32 height);
// static u8* ConvertMonHeightToImperialString(u32 height);
// static u8* ConvertMonHeightToMetricString(u32 height);
// static u8* ConvertMonWeightToImperialString(u32 weight);
// static u8* ConvertMonWeightToMetricString(u32 weight);
static u8* ConvertMeasurementToMetricString(u32 num, u32* index);
// static u8* ConvertMeasurementToMetricString(u32 num, u32* index);
static void ResetOtherVideoRegisters(u16);
static u8 PrintCryScreenSpeciesName(u8, u16, u8, u8);
static void PrintDecimalNum(u8 windowId, u16 num, u8 left, u8 top);
@ -4381,48 +4382,48 @@ static void PrintOwnedMonWeight(u16 species)
// return ConvertMonWeightToMetricString(weight);
// }
static u8* ConvertMonHeightToImperialString(u32 height)
{
u8* heightString = Alloc(WEIGHT_HEIGHT_STR_MEM);
u32 inches, feet, index = 0;
// static u8* ConvertMonHeightToImperialString(u32 height)
// {
// u8* heightString = Alloc(WEIGHT_HEIGHT_STR_MEM);
// u32 inches, feet, index = 0;
inches = (height * 10000) / CM_PER_INCH_FACTOR;
if (inches % 10 >= 5)
inches += 10;
feet = inches / INCHES_IN_FOOT_FACTOR;
inches = (inches - (feet * INCHES_IN_FOOT_FACTOR)) / 10;
// inches = (height * 10000) / CM_PER_INCH_FACTOR;
// if (inches % 10 >= 5)
// inches += 10;
// feet = inches / INCHES_IN_FOOT_FACTOR;
// inches = (inches - (feet * INCHES_IN_FOOT_FACTOR)) / 10;
heightString[index++] = EXT_CTRL_CODE_BEGIN;
heightString[index++] = EXT_CTRL_CODE_CLEAR_TO;
if (feet / 10 == 0)
{
heightString[index++] = INCHES_IN_ONE_AND_HALF_FOOT;
heightString[index++] = feet + CHAR_0;
}
else
{
heightString[index++] = INCHES_IN_FOOT;
heightString[index++] = feet / 10 + CHAR_0;
heightString[index++] = (feet % 10) + CHAR_0;
}
heightString[index++] = CHAR_SGL_QUOTE_RIGHT;
heightString[index++] = (inches / 10) + CHAR_0;
heightString[index++] = (inches % 10) + CHAR_0;
heightString[index++] = CHAR_DBL_QUOTE_RIGHT;
heightString[index++] = EOS;
// heightString[index++] = EXT_CTRL_CODE_BEGIN;
// heightString[index++] = EXT_CTRL_CODE_CLEAR_TO;
// if (feet / 10 == 0)
// {
// heightString[index++] = INCHES_IN_ONE_AND_HALF_FOOT;
// heightString[index++] = feet + CHAR_0;
// }
// else
// {
// heightString[index++] = INCHES_IN_FOOT;
// heightString[index++] = feet / 10 + CHAR_0;
// heightString[index++] = (feet % 10) + CHAR_0;
// }
// heightString[index++] = CHAR_SGL_QUOTE_RIGHT;
// heightString[index++] = (inches / 10) + CHAR_0;
// heightString[index++] = (inches % 10) + CHAR_0;
// heightString[index++] = CHAR_DBL_QUOTE_RIGHT;
// heightString[index++] = EOS;
return heightString;
}
// return heightString;
// }
static u8* ConvertMonHeightToMetricString(u32 height)
{
u32 index = 0;
u8* heightString = ConvertMeasurementToMetricString(height, &index);
// static u8* ConvertMonHeightToMetricString(u32 height)
// {
// u32 index = 0;
// u8* heightString = ConvertMeasurementToMetricString(height, &index);
heightString[index++] = CHAR_m;
heightString[index++] = EOS;
return heightString;
}
// heightString[index++] = CHAR_m;
// heightString[index++] = EOS;
// return heightString;
// }
// static u8* ConvertMonWeightToImperialString(u32 weight)
// {
@ -4492,43 +4493,43 @@ static u8* ConvertMonHeightToMetricString(u32 height)
// return weightString;
// }
static u8* ConvertMeasurementToMetricString(u32 num, u32* index)
{
u8* string = Alloc(WEIGHT_HEIGHT_STR_MEM);
bool32 outputted = FALSE;
u32 result;
// static u8* ConvertMeasurementToMetricString(u32 num, u32* index)
// {
// u8* string = Alloc(WEIGHT_HEIGHT_STR_MEM);
// bool32 outputted = FALSE;
// u32 result;
result = num / 1000;
if (result == 0)
{
string[(*index)++] = CHAR_SPACER;
outputted = FALSE;
}
else
{
string[(*index)++] = CHAR_0 + result;
outputted = TRUE;
}
// result = num / 1000;
// if (result == 0)
// {
// string[(*index)++] = CHAR_SPACER;
// outputted = FALSE;
// }
// else
// {
// string[(*index)++] = CHAR_0 + result;
// outputted = TRUE;
// }
result = (num % 1000) / 100;
if (result == 0 && !outputted)
{
string[(*index)++] = CHAR_SPACER;
outputted = FALSE;
}
else
{
string[(*index)++] = CHAR_0 + result;
outputted = TRUE;
}
// result = (num % 1000) / 100;
// if (result == 0 && !outputted)
// {
// string[(*index)++] = CHAR_SPACER;
// outputted = FALSE;
// }
// else
// {
// string[(*index)++] = CHAR_0 + result;
// outputted = TRUE;
// }
string[(*index)++] = CHAR_0 + ((num % 1000) % 100) / 10;
string[(*index)++] = CHAR_DEC_SEPARATOR;
string[(*index)++] = CHAR_0 + ((num % 1000) % 100) % 10;
string[(*index)++] = CHAR_SPACE;
// string[(*index)++] = CHAR_0 + ((num % 1000) % 100) / 10;
// string[(*index)++] = CHAR_DEC_SEPARATOR;
// string[(*index)++] = CHAR_0 + ((num % 1000) % 100) % 10;
// string[(*index)++] = CHAR_SPACE;
return string;
}
// return string;
// }
static void ResetOtherVideoRegisters(u16 regBits)
{

View File

@ -157,11 +157,6 @@ static const u16 sFeebasData[][3] =
{NUM_SPECIES}
};
static const mapsec_u16_t sLandmarkData[][2] =
{
{MAPSEC_NONE}
};
#include "data/pokedex_emerald_area_glow.h"
static const struct PokedexAreaMapTemplate sPokedexAreaMapTemplate =
@ -400,12 +395,12 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
// return;
// }
// Don't highlight the area if it's an undiscovered landmark (e.g. Sky Pillar)
for (i = 0; sLandmarkData[i][0] != MAPSEC_NONE; i++)
{
if (regionMapSectionId == sLandmarkData[i][0] && !FlagGet(sLandmarkData[i][1]))
return;
}
// // Don't highlight the area if it's an undiscovered landmark (e.g. Sky Pillar)
// for (i = 0; sLandmarkData[i] != MAPSEC_NONE; i++)
// {
// if (regionMapSectionId == sLandmarkData[i])
// return;
// }
// Check if this special area is already being tracked
for (i = 0; i < sPokedexAreaScreen->numSpecialAreas; i++)
@ -413,7 +408,7 @@ static void SetSpecialMapHasMon(u16 mapGroup, u16 mapNum)
if (sPokedexAreaScreen->specialAreaRegionMapSectionIds[i] == regionMapSectionId)
break;
}
DebugPrintfLevel(MGBA_LOG_ERROR, "special area mapsec: %u", regionMapSectionId);
if (i == sPokedexAreaScreen->numSpecialAreas)
{
// New special area
@ -941,6 +936,9 @@ static void ResetPokedexAreaMapBg(void)
SetBgAttribute(3, BG_ATTR_PALETTEMODE, 0);
}
extern const s8 sAreaMarkers[][4];
extern const u16 sDexAreas_Kanto[55][2];
// Creates the circular sprites to highlight special areas (like caves) where a Pokémon can be found
static void CreateAreaMarkerSprites(void)
{
@ -956,7 +954,7 @@ static void CreateAreaMarkerSprites(void)
numSprites = 0;
for (i = 0; i < sPokedexAreaScreen->numSpecialAreas; i++)
{
mapSecId = sPokedexAreaScreen->specialAreaRegionMapSectionIds[i];
mapSecId = sPokedexAreaScreen->specialAreaRegionMapSectionIds[i] - KANTO_MAPSEC_START;
x = 8 * (gRegionMapEntries[mapSecId].x + 1) + 4;
y = 8 * (gRegionMapEntries[mapSecId].y) + 28;
x += 4 * (gRegionMapEntries[mapSecId].width - 1);

View File

@ -22,6 +22,7 @@
#include "overworld.h"
#include "palette.h"
#include "party_menu.h"
#include "pokedex.h"
#include "pokedex_emerald.h"
#include "pokedex_plus_hgss.h"
#include "pokedex_emerald_area_screen.h"
@ -127,10 +128,10 @@ extern const u16 gPokedexOrder_Weight[];
// static .rodata strings
static const u8 sText_No0000[] = _("0000");
static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/caught_marker.4bpp");
static const u8 sCaughtBall_Gfx[] = INCBIN_U8("graphics/pokedex/emerald/caught_ball.4bpp");
static const u8 sText_TenDashes[] = _("----------");
ALIGNED(4) static const u8 sExpandedPlaceholder_PokedexDescription[] = _("");
static const u16 sSizeScreenSilhouette_Pal[] = INCBIN_U16("graphics/pokedex/silhouette_sprite_pal.gbapal");
static const u16 sSizeScreenSilhouette_Pal[] = INCBIN_U16("graphics/pokedex/emerald/size_silhouette.gbapal");
static const u8 sText_Stats_Buttons[] = _("{A_BUTTON}TOGGLE {DPAD_UPDOWN}MOVES");
static const u8 sText_Stats_Buttons_Decapped[] = _("{A_BUTTON}Toggle {DPAD_UPDOWN}Moves");

View File

@ -12,6 +12,7 @@
#include "pokedex_screen.h"
#include "data.h"
#include "pokedex.h"
#include "pokedex_emerald.h"
#include "pokedex_plus_hgss.h"
#include "trainer_pokemon_sprites.h"
#include "decompress.h"
@ -961,6 +962,12 @@ void CB2_OpenPokedexFromStartMenu(void)
CB2_OpenPokedexPlusHGSS();
return;
}
if (POKEDEX_EMERALD)
{
CB2_OpenPokedex();
return;
}
DexScreen_LoadResources();
ClearGpuRegBits(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_WIN1_ON);

View File

@ -232,7 +232,6 @@ struct PlayerIcon
struct Sprite *sprite;
u16 tileTag;
u16 palTag;
u16 tiles[0x40];
}; // size = 0x8C
struct MapIconSprite
@ -388,10 +387,13 @@ static void InitFlyMap(void);
static void FreeFlyMap(u8);
static void SetFlyWarpDestination(u16);
const u32 gPlayerIcon_Red[] = INCBIN_U32("graphics/region_map/player_icon_red.4bpp");
const u32 gPlayerIcon_Leaf[] = INCBIN_U32("graphics/region_map/player_icon_leaf.4bpp");
const u16 gPlayerIcon_RedPal[] = INCBIN_U16("graphics/region_map/player_icon_red.gbapal");
const u16 gPlayerIcon_LeafPal[] = INCBIN_U16("graphics/region_map/player_icon_leaf.gbapal");
static const u16 sTopBar_Pal[] = INCBIN_U16("graphics/region_map/top_bar.gbapal"); // Palette for the top bar and dynamic text color
static const u16 sMapCursor_Pal[] = INCBIN_U16("graphics/region_map/cursor.gbapal");
static const u16 sPlayerIcon_RedPal[] = INCBIN_U16("graphics/region_map/player_icon_red.gbapal");
static const u16 sPlayerIcon_LeafPal[] = INCBIN_U16("graphics/region_map/player_icon_leaf.gbapal");
static const u16 sMiscIcon_Pal[] = INCBIN_U16("graphics/region_map/misc_icon.gbapal"); // For dungeon and fly icons
static const u16 sRegionMap_Pal[] = INCBIN_U16("graphics/region_map/region_map.gbapal");
static const u16 sUnusedPalette[] = { RGB(0, 0, 31), RGB(0, 12, 31), RGB_WHITE, RGB_WHITE };
@ -400,8 +402,6 @@ static const u16 sMapEdge_Pal[] = INCBIN_U16("graphics/region_map/map_edge.gbapa
static const u32 sSwitchMapCursorLeft_Gfx[] = INCBIN_U32("graphics/region_map/switch_map_cursor_left.4bpp.lz");
static const u32 sSwitchMapCursorRight_Gfx[] = INCBIN_U32("graphics/region_map/switch_map_cursor_right.4bpp.lz");
static const u32 sMapCursor_Gfx[] = INCBIN_U32("graphics/region_map/cursor.4bpp.lz");
static const u32 sPlayerIcon_Red[] = INCBIN_U32("graphics/region_map/player_icon_red.4bpp.lz");
static const u32 sPlayerIcon_Leaf[] = INCBIN_U32("graphics/region_map/player_icon_leaf.4bpp.lz");
static const u32 sRegionMap_Gfx[] = INCBIN_U32("graphics/region_map/region_map.4bpp.lz");
static const u32 sMapEdge_Gfx[] = INCBIN_U32("graphics/region_map/map_edge.4bpp.lz");
static const u32 sSwitchMapMenu_Gfx[] = INCBIN_U32("graphics/region_map/switch_map_menu.4bpp.lz");
@ -3358,10 +3358,6 @@ static u8 GetSelectedMapSection(u8 whichMap, u8 layer, s16 y, s16 x)
static void CreatePlayerIcon(u16 tileTag, u16 palTag)
{
sPlayerIcon = AllocZeroed(sizeof(struct PlayerIcon));
if (gSaveBlock2Ptr->playerGender == FEMALE)
DecompressDataWithHeaderWram(sPlayerIcon_Leaf, sPlayerIcon->tiles);
else
DecompressDataWithHeaderWram(sPlayerIcon_Red, sPlayerIcon->tiles);
sPlayerIcon->tileTag = tileTag;
sPlayerIcon->palTag = palTag;
sPlayerIcon->x = GetMapCursorX();
@ -3373,12 +3369,12 @@ static void CreatePlayerIconSprite(void)
{
u8 spriteId;
struct SpriteSheet spriteSheet = {
.data = sPlayerIcon->tiles,
.size = sizeof(sPlayerIcon->tiles),
.data = gPlayerIcon_Red,
.size = sizeof(gPlayerIcon_Red),
.tag = sPlayerIcon->tileTag
};
struct SpritePalette spritePalette = {
.data = sPlayerIcon_RedPal,
.data = gPlayerIcon_RedPal,
.tag = sPlayerIcon->palTag
};
struct SpriteTemplate template = {
@ -3391,8 +3387,11 @@ static void CreatePlayerIconSprite(void)
.callback = SpriteCallbackDummy
};
if (gSaveBlock2Ptr->playerGender == FEMALE)
spritePalette.data = sPlayerIcon_LeafPal;
if (gSaveBlock2Ptr->playerGender == FEMALE) {
spriteSheet.data = gPlayerIcon_Leaf;
spriteSheet.size = sizeof(gPlayerIcon_Leaf);
spritePalette.data = gPlayerIcon_LeafPal;
}
LoadSpriteSheet(&spriteSheet);
LoadSpritePalette(&spritePalette);
@ -3857,7 +3856,7 @@ static void ClearOrDrawTopBar(bool8 clear)
}
}
void CB2_OpenFlyMapEmerald(void)
void CB2_OpenFlyMap(void)
{
InitFlyMap();
InitRegionMap(REGIONMAP_TYPE_FLY);

View File

@ -128,6 +128,11 @@ static const u8 sRegionMapPlayerIcon_BrendanGfx[] = INCBIN_U8("graphics/pokenav/
static const u16 sRegionMapPlayerIcon_MayPal[] = INCBIN_U16("graphics/pokenav/region_map/may_icon.gbapal");
static const u8 sRegionMapPlayerIcon_MayGfx[] = INCBIN_U8("graphics/pokenav/region_map/may_icon.4bpp");
extern const u32 gPlayerIcon_Red[];
extern const u32 gPlayerIcon_Leaf[];
extern const u16 gPlayerIcon_RedPal[];
extern const u16 gPlayerIcon_LeafPal[];
#include "data/region_map/region_map_layout.h"
// #include "data/region_map/region_map_entries.h"
extern const struct RegionMapLocation gRegionMapEntries[];
@ -1304,26 +1309,26 @@ static void InitMapBasedOnPlayerLocation(void)
xOnMap = x;
dimensionScale = mapWidth / gRegionMapEntries[sRegionMap->mapSecId].width;
dimensionScale = mapWidth / gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].width;
if (dimensionScale == 0)
{
dimensionScale = 1;
}
x /= dimensionScale;
if (x >= gRegionMapEntries[sRegionMap->mapSecId].width)
if (x >= gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].width)
{
x = gRegionMapEntries[sRegionMap->mapSecId].width - 1;
x = gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].width - 1;
}
dimensionScale = mapHeight / gRegionMapEntries[sRegionMap->mapSecId].height;
dimensionScale = mapHeight / gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].height;
if (dimensionScale == 0)
{
dimensionScale = 1;
}
y /= dimensionScale;
if (y >= gRegionMapEntries[sRegionMap->mapSecId].height)
if (y >= gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].height)
{
y = gRegionMapEntries[sRegionMap->mapSecId].height - 1;
y = gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].height - 1;
}
switch (sRegionMap->mapSecId)
@ -1359,8 +1364,8 @@ static void InitMapBasedOnPlayerLocation(void)
// GetMarineCaveCoords(&sRegionMap->cursorPosX, &sRegionMap->cursorPosY);
// return;
}
sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId].x + x + MAPCURSOR_X_MIN;
sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId].y + y + MAPCURSOR_Y_MIN;
sRegionMap->cursorPosX = gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].x + x + MAPCURSOR_X_MIN;
sRegionMap->cursorPosY = gRegionMapEntries[sRegionMap->mapSecId - KANTO_MAPSEC_START].y + y + MAPCURSOR_Y_MIN;
}
// static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
@ -1730,8 +1735,8 @@ static void UNUSED ClearUnkCursorSpriteData(void)
void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag)
{
u8 spriteId;
struct SpriteSheet sheet = {sRegionMapPlayerIcon_BrendanGfx, 0x80, tileTag};
struct SpritePalette palette = {sRegionMapPlayerIcon_BrendanPal, paletteTag};
struct SpriteSheet sheet = {gPlayerIcon_Red, 0x80, tileTag};
struct SpritePalette palette = {gPlayerIcon_RedPal, paletteTag};
struct SpriteTemplate template = {tileTag, paletteTag, &sRegionMapPlayerIconOam, sRegionMapPlayerIconAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy};
if (IsEventIslandMapSecId(gMapHeader.regionMapSectionId))
@ -1741,8 +1746,8 @@ void CreateRegionMapPlayerIcon(u16 tileTag, u16 paletteTag)
}
if (gSaveBlock2Ptr->playerGender == FEMALE)
{
sheet.data = sRegionMapPlayerIcon_MayGfx;
palette.data = sRegionMapPlayerIcon_MayPal;
sheet.data = gPlayerIcon_Red;
palette.data = gPlayerIcon_RedPal;
}
LoadSpriteSheet(&sheet);
LoadSpritePalette(&palette);
@ -1905,10 +1910,10 @@ u8 *GetMapNameHandleAquaHideout(u8 *dest, mapsec_u16_t mapSecId)
static void GetMapSecDimensions(mapsec_u16_t mapSecId, u16 *x, u16 *y, u16 *width, u16 *height)
{
*x = gRegionMapEntries[mapSecId].x;
*y = gRegionMapEntries[mapSecId].y;
*width = gRegionMapEntries[mapSecId].width;
*height = gRegionMapEntries[mapSecId].height;
*x = gRegionMapEntries[mapSecId - KANTO_MAPSEC_START].x;
*y = gRegionMapEntries[mapSecId - KANTO_MAPSEC_START].y;
*width = gRegionMapEntries[mapSecId - KANTO_MAPSEC_START].width;
*height = gRegionMapEntries[mapSecId - KANTO_MAPSEC_START].height;
}
bool8 IsRegionMapZoomed(void)
@ -1928,7 +1933,7 @@ bool32 IsEventIslandMapSecId(mapsec_u8_t mapSecId)
return FALSE;
}
void CB2_OpenFlyMap(void)
void CB2_OpenFlyMapEmerald(void)
{
switch (gMain.state)
{

View File

@ -23,7 +23,7 @@ static bool32 IsSpeciesInEncounterTable(const struct WildPokemonInfo * pokemon,
static u16 GetMapSecIdFromWildMonHeader(const struct WildPokemonHeader * header);
static bool32 FindDexAreaByMapSec(u16 mapSecId, const u16 (*lut)[2], s32 count, s32 * lutIdx_p, u16 * tableIdx_p);
static const u16 sDexAreas_Kanto[][2] = {
const u16 sDexAreas_Kanto[55][2] = {
{ MAPSEC_PALLET_TOWN, DEX_AREA_PALLET_TOWN },
{ MAPSEC_VIRIDIAN_CITY, DEX_AREA_VIRIDIAN_CITY },
{ MAPSEC_PEWTER_CITY, DEX_AREA_PEWTER_CITY },