Options menu: cleanup

This commit is contained in:
Martin Griffin 2022-08-21 15:10:18 +01:00
parent 2aa821176b
commit f4a2040843

View File

@ -16,7 +16,6 @@
#include "gba/m4a_internal.h"
#include "constants/rgb.h"
// Task data
#define tMenuSelection data[0]
#define tTextSpeed data[1]
#define tBattleSceneOff data[2]
@ -25,7 +24,6 @@
#define tButtonMode data[5]
#define tWindowFrameType data[6]
// Menu items
enum
{
MENUITEM_TEXTSPEED,
@ -38,7 +36,6 @@ enum
MENUITEM_COUNT,
};
// Window Ids
enum
{
WIN_HEADER,
@ -52,7 +49,6 @@ enum
#define YPOS_BUTTONMODE (MENUITEM_BUTTONMODE * 16)
#define YPOS_FRAMETYPE (MENUITEM_FRAMETYPE * 16)
// this file's functions
static void Task_OptionMenuFadeIn(u8 taskId);
static void Task_OptionMenuProcessInput(u8 taskId);
static void Task_OptionMenuSave(u8 taskId);
@ -138,7 +134,6 @@ static const struct BgTemplate sOptionMenuBgTemplates[] =
static const u16 sOptionMenuBg_Pal[] = {RGB(17, 18, 31)};
// code
static void MainCB2(void)
{
RunTasks();
@ -213,7 +208,7 @@ void CB2_InitOptionMenu(void)
gMain.state++;
break;
case 6:
PutWindowTilemap(0);
PutWindowTilemap(WIN_HEADER);
DrawHeaderText();
gMain.state++;
break;
@ -221,7 +216,7 @@ void CB2_InitOptionMenu(void)
gMain.state++;
break;
case 8:
PutWindowTilemap(1);
PutWindowTilemap(WIN_OPTIONS);
DrawOptionMenuTexts();
gMain.state++;
case 9:
@ -253,7 +248,7 @@ void CB2_InitOptionMenu(void)
break;
}
case 11:
BeginNormalPaletteFade(PALETTES_ALL, 0, 0x10, 0, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 16, 0, RGB_BLACK);
SetVBlankCallback(VBlankCB);
SetMainCallback2(MainCB2);
return;
@ -362,7 +357,7 @@ static void Task_OptionMenuSave(u8 taskId)
gSaveBlock2Ptr->optionsButtonMode = gTasks[taskId].tButtonMode;
gSaveBlock2Ptr->optionsWindowFrameType = gTasks[taskId].tWindowFrameType;
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 0x10, RGB_BLACK);
BeginNormalPaletteFade(PALETTES_ALL, 0, 0, 16, RGB_BLACK);
gTasks[taskId].func = Task_OptionMenuFadeOut;
}
@ -387,13 +382,13 @@ static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style)
u8 dst[16];
u16 i;
for (i = 0; *text != EOS && i <= 14; i++)
for (i = 0; *text != EOS && i < ARRAY_COUNT(dst) - 1; i++)
dst[i] = *(text++);
if (style != 0)
{
dst[2] = 4;
dst[5] = 5;
dst[2] = TEXT_COLOR_RED;
dst[5] = TEXT_COLOR_LIGHT_RED;
}
dst[i] = EOS;
@ -564,7 +559,7 @@ static void FrameType_DrawChoices(u8 selection)
{
text[i] = n % 10 + CHAR_0;
i++;
text[i] = 0x77;
text[i] = CHAR_SPACER;
i++;
}