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