mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2025-03-19 12:08:34 +01:00
Use window constants in mystery_event_menu
This commit is contained in:
parent
fb87616e9d
commit
7d4fddd56b
@ -20,6 +20,11 @@
|
|||||||
#include "decompress.h"
|
#include "decompress.h"
|
||||||
#include "constants/rgb.h"
|
#include "constants/rgb.h"
|
||||||
|
|
||||||
|
enum {
|
||||||
|
WIN_MSG,
|
||||||
|
WIN_LOADING,
|
||||||
|
};
|
||||||
|
|
||||||
static void CB2_MysteryEventMenu(void);
|
static void CB2_MysteryEventMenu(void);
|
||||||
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed);
|
static void PrintMysteryMenuText(u8 windowId, const u8 *text, u8 x, u8 y, s32 speed);
|
||||||
|
|
||||||
@ -40,7 +45,7 @@ static const struct BgTemplate sBgTemplates[] =
|
|||||||
|
|
||||||
static const struct WindowTemplate sWindowTemplates[] =
|
static const struct WindowTemplate sWindowTemplates[] =
|
||||||
{
|
{
|
||||||
{
|
[WIN_MSG] = {
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 4,
|
.tilemapLeft = 4,
|
||||||
.tilemapTop = 15,
|
.tilemapTop = 15,
|
||||||
@ -49,7 +54,7 @@ static const struct WindowTemplate sWindowTemplates[] =
|
|||||||
.paletteNum = 14,
|
.paletteNum = 14,
|
||||||
.baseBlock = 20
|
.baseBlock = 20
|
||||||
},
|
},
|
||||||
{
|
[WIN_LOADING] = {
|
||||||
.bg = 0,
|
.bg = 0,
|
||||||
.tilemapLeft = 7,
|
.tilemapLeft = 7,
|
||||||
.tilemapTop = 6,
|
.tilemapTop = 6,
|
||||||
@ -87,7 +92,7 @@ void CB2_InitMysteryEventMenu(void)
|
|||||||
s32 i;
|
s32 i;
|
||||||
|
|
||||||
DeactivateAllTextPrinters();
|
DeactivateAllTextPrinters();
|
||||||
for (i = 0; i < 2; i++)
|
for (i = 0; i < (int)ARRAY_COUNT(sWindowTemplates) - 1; i++)
|
||||||
FillWindowPixelBuffer(i, PIXEL_FILL(0));
|
FillWindowPixelBuffer(i, PIXEL_FILL(0));
|
||||||
|
|
||||||
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
|
FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x1E, 0x14);
|
||||||
@ -131,9 +136,9 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
switch (gMain.state)
|
switch (gMain.state)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
DrawStdFrameWithCustomTileAndPalette(0, TRUE, 1, 0xD);
|
DrawStdFrameWithCustomTileAndPalette(WIN_MSG, TRUE, 1, 0xD);
|
||||||
PutWindowTilemap(0);
|
PutWindowTilemap(WIN_MSG);
|
||||||
CopyWindowToVram(0, COPYWIN_FULL);
|
CopyWindowToVram(WIN_MSG, COPYWIN_FULL);
|
||||||
ShowBg(0);
|
ShowBg(0);
|
||||||
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
|
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
@ -141,12 +146,12 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
case 1:
|
case 1:
|
||||||
if (!gPaletteFade.active)
|
if (!gPaletteFade.active)
|
||||||
{
|
{
|
||||||
PrintMysteryMenuText(0, gText_LinkStandby2, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gText_LinkStandby2, 1, 2, 1);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(WIN_MSG))
|
||||||
{
|
{
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
gLinkType = LINKTYPE_MYSTERY_EVENT;
|
gLinkType = LINKTYPE_MYSTERY_EVENT;
|
||||||
@ -154,10 +159,10 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if ((gLinkStatus & 0x20) && (gLinkStatus & 0x1C) > 4)
|
if ((gLinkStatus & LINK_STAT_MASTER) && (gLinkStatus & LINK_STAT_PLAYER_COUNT) > 4)
|
||||||
{
|
{
|
||||||
PlaySE(SE_PIN);
|
PlaySE(SE_PIN);
|
||||||
PrintMysteryMenuText(0, gText_PressAToLoadEvent, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gText_PressAToLoadEvent, 1, 2, 1);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
if (JOY_NEW(B_BUTTON))
|
if (JOY_NEW(B_BUTTON))
|
||||||
@ -168,7 +173,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(WIN_MSG))
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
@ -178,10 +183,10 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
{
|
{
|
||||||
PlaySE(SE_SELECT);
|
PlaySE(SE_SELECT);
|
||||||
CheckShouldAdvanceLinkState();
|
CheckShouldAdvanceLinkState();
|
||||||
DrawStdFrameWithCustomTileAndPalette(1, TRUE, 1, 0xD);
|
DrawStdFrameWithCustomTileAndPalette(WIN_LOADING, TRUE, 1, 0xD);
|
||||||
PrintMysteryMenuText(1, gText_LoadingEvent, 1, 2, 0);
|
PrintMysteryMenuText(WIN_LOADING, gText_LoadingEvent, 1, 2, 0);
|
||||||
PutWindowTilemap(1);
|
PutWindowTilemap(WIN_LOADING);
|
||||||
CopyWindowToVram(1, COPYWIN_FULL);
|
CopyWindowToVram(WIN_LOADING, COPYWIN_FULL);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
else if (JOY_NEW(B_BUTTON))
|
else if (JOY_NEW(B_BUTTON))
|
||||||
@ -194,7 +199,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -207,19 +212,19 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
{
|
{
|
||||||
SetCloseLinkCallback();
|
SetCloseLinkCallback();
|
||||||
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
else if (CheckLanguageMatch())
|
else if (CheckLanguageMatch())
|
||||||
{
|
{
|
||||||
PrintMysteryMenuText(0, gText_DontRemoveCableTurnOff, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gText_DontRemoveCableTurnOff, 1, 2, 1);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CloseLink();
|
CloseLink();
|
||||||
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -232,7 +237,7 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 7:
|
case 7:
|
||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(WIN_MSG))
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
@ -260,11 +265,11 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 12:
|
case 12:
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
break;
|
break;
|
||||||
case 13:
|
case 13:
|
||||||
if (!IsTextPrinterActive(0))
|
if (!IsTextPrinterActive(WIN_MSG))
|
||||||
{
|
{
|
||||||
gMain.state++;
|
gMain.state++;
|
||||||
sUnused = 0;
|
sUnused = 0;
|
||||||
@ -287,11 +292,11 @@ static void CB2_MysteryEventMenu(void)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gLinkStatus & 0x40 && !IsLinkMaster())
|
if (gLinkStatus & LINK_STAT_CONN_ESTABLISHED && !IsLinkMaster())
|
||||||
{
|
{
|
||||||
CloseLink();
|
CloseLink();
|
||||||
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
GetEventLoadMessage(gStringVar4, MEVENT_STATUS_LOAD_ERROR);
|
||||||
PrintMysteryMenuText(0, gStringVar4, 1, 2, 1);
|
PrintMysteryMenuText(WIN_MSG, gStringVar4, 1, 2, 1);
|
||||||
gMain.state = 13;
|
gMain.state = 13;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user