mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 03:04:15 +01:00
Use window constants in region_map
This commit is contained in:
parent
1f225286d5
commit
4af1044439
@ -21,7 +21,8 @@ enum {
|
||||
MAPSECTYPE_ROUTE,
|
||||
MAPSECTYPE_CITY_CANFLY,
|
||||
MAPSECTYPE_CITY_CANTFLY,
|
||||
MAPSECTYPE_BATTLE_FRONTIER
|
||||
MAPSECTYPE_BATTLE_FRONTIER,
|
||||
NUM_MAPSEC_TYPES
|
||||
};
|
||||
|
||||
struct RegionMap {
|
||||
|
@ -53,7 +53,12 @@ enum {
|
||||
TAG_FLY_ICON,
|
||||
};
|
||||
|
||||
// Static type declarations
|
||||
// Window IDs for the fly map
|
||||
enum {
|
||||
WIN_MAPSEC_NAME,
|
||||
WIN_MAPSEC_NAME_TALL, // For fly destinations with subtitles (just Ever Grande)
|
||||
WIN_FLY_TO_WHERE,
|
||||
};
|
||||
|
||||
struct MultiNameFlyDest
|
||||
{
|
||||
@ -386,7 +391,7 @@ static const struct BgTemplate sFlyMapBgTemplates[] =
|
||||
|
||||
static const struct WindowTemplate sFlyMapWindowTemplates[] =
|
||||
{
|
||||
{
|
||||
[WIN_MAPSEC_NAME] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 17,
|
||||
.tilemapTop = 17,
|
||||
@ -395,7 +400,7 @@ static const struct WindowTemplate sFlyMapWindowTemplates[] =
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x01
|
||||
},
|
||||
{
|
||||
[WIN_MAPSEC_NAME_TALL] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 17,
|
||||
.tilemapTop = 15,
|
||||
@ -404,7 +409,7 @@ static const struct WindowTemplate sFlyMapWindowTemplates[] =
|
||||
.paletteNum = 15,
|
||||
.baseBlock = 0x19
|
||||
},
|
||||
{
|
||||
[WIN_FLY_TO_WHERE] = {
|
||||
.bg = 0,
|
||||
.tilemapLeft = 1,
|
||||
.tilemapTop = 18,
|
||||
@ -1404,7 +1409,7 @@ void CreateRegionMapCursor(u16 tileTag, u16 paletteTag)
|
||||
}
|
||||
LoadSpriteSheet(&sheet);
|
||||
LoadSpritePalette(&palette);
|
||||
spriteId = CreateSprite(&template, 0x38, 0x48, 0);
|
||||
spriteId = CreateSprite(&template, 56, 72, 0);
|
||||
if (spriteId != MAX_SPRITES)
|
||||
{
|
||||
sRegionMap->cursorSprite = &gSprites[spriteId];
|
||||
@ -1713,9 +1718,9 @@ void CB2_OpenFlyMap(void)
|
||||
break;
|
||||
case 7:
|
||||
LoadPalette(sRegionMapFramePal, 0x10, sizeof(sRegionMapFramePal));
|
||||
PutWindowTilemap(2);
|
||||
FillWindowPixelBuffer(2, PIXEL_FILL(0));
|
||||
AddTextPrinterParameterized(2, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL);
|
||||
PutWindowTilemap(WIN_FLY_TO_WHERE);
|
||||
FillWindowPixelBuffer(WIN_FLY_TO_WHERE, PIXEL_FILL(0));
|
||||
AddTextPrinterParameterized(WIN_FLY_TO_WHERE, FONT_NORMAL, gText_FlyToWhere, 0, 1, 0, NULL);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
gMain.state++;
|
||||
break;
|
||||
@ -1768,7 +1773,7 @@ static void DrawFlyDestTextWindow(void)
|
||||
bool32 namePrinted;
|
||||
const u8 *name;
|
||||
|
||||
if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType <= MAPSECTYPE_BATTLE_FRONTIER)
|
||||
if (sFlyMap->regionMap.mapSecType > MAPSECTYPE_NONE && sFlyMap->regionMap.mapSecType < NUM_MAPSEC_TYPES)
|
||||
{
|
||||
namePrinted = FALSE;
|
||||
for (i = 0; i < ARRAY_COUNT(sMultiNameFlyDestinations); i++)
|
||||
@ -1779,11 +1784,11 @@ static void DrawFlyDestTextWindow(void)
|
||||
{
|
||||
StringLength(sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec]);
|
||||
namePrinted = TRUE;
|
||||
ClearStdWindowAndFrameToTransparent(0, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(1, FALSE, 101, 13);
|
||||
AddTextPrinterParameterized(1, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME_TALL, FALSE, 101, 13);
|
||||
AddTextPrinterParameterized(WIN_MAPSEC_NAME_TALL, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
name = sMultiNameFlyDestinations[i].name[sFlyMap->regionMap.posWithinMapSec];
|
||||
AddTextPrinterParameterized(1, FONT_NORMAL, name, GetStringRightAlignXOffset(FONT_NORMAL, name, 96), 17, 0, NULL);
|
||||
AddTextPrinterParameterized(WIN_MAPSEC_NAME_TALL, FONT_NORMAL, name, GetStringRightAlignXOffset(FONT_NORMAL, name, 96), 17, 0, NULL);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
sDrawFlyDestTextWindow = TRUE;
|
||||
}
|
||||
@ -1794,15 +1799,15 @@ static void DrawFlyDestTextWindow(void)
|
||||
{
|
||||
if (sDrawFlyDestTextWindow == TRUE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(1, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
|
||||
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME_TALL, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 101, 13);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Window is already drawn, just empty it
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
||||
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
|
||||
}
|
||||
AddTextPrinterParameterized(0, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
AddTextPrinterParameterized(WIN_MAPSEC_NAME, FONT_NORMAL, sFlyMap->regionMap.mapSecName, 0, 1, 0, NULL);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
sDrawFlyDestTextWindow = FALSE;
|
||||
}
|
||||
@ -1812,11 +1817,11 @@ static void DrawFlyDestTextWindow(void)
|
||||
// Selection is on MAPSECTYPE_NONE, draw empty fly destination text window
|
||||
if (sDrawFlyDestTextWindow == TRUE)
|
||||
{
|
||||
ClearStdWindowAndFrameToTransparent(1, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(0, FALSE, 101, 13);
|
||||
ClearStdWindowAndFrameToTransparent(WIN_MAPSEC_NAME_TALL, FALSE);
|
||||
DrawStdFrameWithCustomTileAndPalette(WIN_MAPSEC_NAME, FALSE, 101, 13);
|
||||
}
|
||||
FillWindowPixelBuffer(0, PIXEL_FILL(1));
|
||||
CopyWindowToVram(0, COPYWIN_GFX);
|
||||
FillWindowPixelBuffer(WIN_MAPSEC_NAME, PIXEL_FILL(1));
|
||||
CopyWindowToVram(WIN_MAPSEC_NAME, COPYWIN_GFX);
|
||||
ScheduleBgCopyTilemapToVram(0);
|
||||
sDrawFlyDestTextWindow = FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user