Use window constants in wireless_communication_status_screen

This commit is contained in:
GriffinR
2022-09-29 13:31:01 -04:00
parent 81defb5986
commit 2cd07d80b8

View File

@@ -27,12 +27,20 @@ enum {
COLORMODE_WHITE_DGRAY, COLORMODE_WHITE_DGRAY,
}; };
#define GROUPTYPE_TRADE 0 enum {
#define GROUPTYPE_BATTLE 1 WIN_TITLE,
#define GROUPTYPE_UNION 2 WIN_GROUP_NAMES,
#define GROUPTYPE_TOTAL 3 WIN_GROUP_COUNTS,
#define GROUPTYPE_NONE -1 };
#define NUM_GROUPTYPES 4
enum {
GROUPTYPE_NONE = -1,
GROUPTYPE_TRADE,
GROUPTYPE_BATTLE,
GROUPTYPE_UNION,
GROUPTYPE_TOTAL,
NUM_GROUPTYPES
};
struct WirelessCommunicationStatusScreen struct WirelessCommunicationStatusScreen
{ {
@@ -70,7 +78,7 @@ static const struct BgTemplate sBgTemplates[] = {
}; };
static const struct WindowTemplate sWindowTemplates[] = { static const struct WindowTemplate sWindowTemplates[] = {
{ [WIN_TITLE] = {
.bg = 0, .bg = 0,
.tilemapLeft = 3, .tilemapLeft = 3,
.tilemapTop = 0, .tilemapTop = 0,
@@ -78,7 +86,8 @@ static const struct WindowTemplate sWindowTemplates[] = {
.height = 3, .height = 3,
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x0001 .baseBlock = 0x0001
}, { },
[WIN_GROUP_NAMES] = {
.bg = 0, .bg = 0,
.tilemapLeft = 3, .tilemapLeft = 3,
.tilemapTop = 4, .tilemapTop = 4,
@@ -86,7 +95,8 @@ static const struct WindowTemplate sWindowTemplates[] = {
.height = 15, .height = 15,
.paletteNum = 15, .paletteNum = 15,
.baseBlock = 0x0049 .baseBlock = 0x0049
}, { },
[WIN_GROUP_COUNTS] = {
.bg = 0, .bg = 0,
.tilemapLeft = 24, .tilemapLeft = 24,
.tilemapTop = 4, .tilemapTop = 4,
@@ -233,19 +243,17 @@ static void WCSS_CyclePalette(s16 * counter, s16 * palIdx)
static void PrintHeaderTexts(void) static void PrintHeaderTexts(void)
{ {
s32 i; s32 i;
FillWindowPixelBuffer(0, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_TITLE, PIXEL_FILL(0));
FillWindowPixelBuffer(1, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_GROUP_NAMES, PIXEL_FILL(0));
FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_GROUP_COUNTS, PIXEL_FILL(0));
WCSS_AddTextPrinterParameterized(0, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN); WCSS_AddTextPrinterParameterized(WIN_TITLE, FONT_NORMAL, sHeaderTexts[0], GetStringCenterAlignXOffset(FONT_NORMAL, sHeaderTexts[0], 0xC0), 6, COLORMODE_GREEN);
for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++) for (i = 0; i < (int)ARRAY_COUNT(*sHeaderTexts) - 1; i++)
{ WCSS_AddTextPrinterParameterized(WIN_GROUP_NAMES, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY);
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_WHITE_LGRAY); WCSS_AddTextPrinterParameterized(WIN_GROUP_NAMES, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED);
} PutWindowTilemap(WIN_TITLE);
WCSS_AddTextPrinterParameterized(1, FONT_NORMAL, sHeaderTexts[i + 1], 0, 30 * i + 8, COLORMODE_RED); CopyWindowToVram(WIN_TITLE, COPYWIN_GFX);
PutWindowTilemap(0); PutWindowTilemap(WIN_GROUP_NAMES);
CopyWindowToVram(0, COPYWIN_GFX); CopyWindowToVram(WIN_GROUP_NAMES, COPYWIN_GFX);
PutWindowTilemap(1);
CopyWindowToVram(1, COPYWIN_GFX);
} }
#define tState data[0] #define tState data[0]
@@ -268,24 +276,22 @@ static void Task_WirelessCommunicationScreen(u8 taskId)
break; break;
case 2: case 2:
if (!gPaletteFade.active) if (!gPaletteFade.active)
{
gTasks[taskId].tState++; gTasks[taskId].tState++;
}
break; break;
case 3: case 3:
if (UpdateCommunicationCounts(sStatusScreen->groupCounts, sStatusScreen->prevGroupCounts, sStatusScreen->activities, sStatusScreen->rfuTaskId)) if (UpdateCommunicationCounts(sStatusScreen->groupCounts, sStatusScreen->prevGroupCounts, sStatusScreen->activities, sStatusScreen->rfuTaskId))
{ {
FillWindowPixelBuffer(2, PIXEL_FILL(0)); FillWindowPixelBuffer(WIN_GROUP_COUNTS, PIXEL_FILL(0));
for (i = 0; i < NUM_GROUPTYPES; i++) for (i = 0; i < NUM_GROUPTYPES; i++)
{ {
ConvertIntToDecimalStringN(gStringVar4, sStatusScreen->groupCounts[i], STR_CONV_MODE_RIGHT_ALIGN, 2); ConvertIntToDecimalStringN(gStringVar4, sStatusScreen->groupCounts[i], STR_CONV_MODE_RIGHT_ALIGN, 2);
if (i != GROUPTYPE_TOTAL) if (i != GROUPTYPE_TOTAL)
WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY); WCSS_AddTextPrinterParameterized(WIN_GROUP_COUNTS, FONT_NORMAL, gStringVar4, 12, 30 * i + 8, COLORMODE_WHITE_LGRAY);
else else
WCSS_AddTextPrinterParameterized(2, FONT_NORMAL, gStringVar4, 12, 98, COLORMODE_RED); WCSS_AddTextPrinterParameterized(WIN_GROUP_COUNTS, FONT_NORMAL, gStringVar4, 12, 98, COLORMODE_RED);
} }
PutWindowTilemap(2); PutWindowTilemap(WIN_GROUP_COUNTS);
CopyWindowToVram(2, COPYWIN_FULL); CopyWindowToVram(WIN_GROUP_COUNTS, COPYWIN_FULL);
} }
if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON)) if (JOY_NEW(A_BUTTON) || JOY_NEW(B_BUTTON))
{ {