Dynamic ordering for options menu

This commit is contained in:
GriffinR 2019-09-13 01:15:32 -04:00 committed by huderlem
parent 6ab192e739
commit 1be131f843

View File

@ -48,6 +48,13 @@ enum
WIN_OPTIONS
};
#define YPOS_TEXTSPEED (MENUITEM_TEXTSPEED * 16)
#define YPOS_BATTLESCENE (MENUITEM_BATTLESCENE * 16)
#define YPOS_BATTLESTYLE (MENUITEM_BATTLESTYLE * 16)
#define YPOS_SOUND (MENUITEM_SOUND * 16)
#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);
@ -280,12 +287,12 @@ static void Task_OptionMenuProcessInput(u8 taskId)
if (gTasks[taskId].data[TD_MENUSELECTION] > 0)
gTasks[taskId].data[TD_MENUSELECTION]--;
else
gTasks[taskId].data[TD_MENUSELECTION] = 6;
gTasks[taskId].data[TD_MENUSELECTION] = MENUITEM_CANCEL;
HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]);
}
else if (gMain.newKeys & DPAD_DOWN)
{
if (gTasks[taskId].data[TD_MENUSELECTION] <= 5)
if (gTasks[taskId].data[TD_MENUSELECTION] <= MENUITEM_CANCEL - 1)
gTasks[taskId].data[TD_MENUSELECTION]++;
else
gTasks[taskId].data[TD_MENUSELECTION] = 0;
@ -431,7 +438,7 @@ static void TextSpeed_DrawChoices(u8 selection)
styles[2] = 0;
styles[selection] = 1;
DrawOptionMenuChoice(gText_TextSpeedSlow, 104, 0, styles[0]);
DrawOptionMenuChoice(gText_TextSpeedSlow, 104, YPOS_TEXTSPEED, styles[0]);
widthSlow = GetStringWidth(1, gText_TextSpeedSlow, 0);
widthMid = GetStringWidth(1, gText_TextSpeedMid, 0);
@ -439,9 +446,9 @@ static void TextSpeed_DrawChoices(u8 selection)
widthMid -= 94;
xMid = (widthSlow - widthMid - widthFast) / 2 + 104;
DrawOptionMenuChoice(gText_TextSpeedMid, xMid, 0, styles[1]);
DrawOptionMenuChoice(gText_TextSpeedMid, xMid, YPOS_TEXTSPEED, styles[1]);
DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), 0, styles[2]);
DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), YPOS_TEXTSPEED, styles[2]);
}
static u8 BattleScene_ProcessInput(u8 selection)
@ -463,8 +470,8 @@ static void BattleScene_DrawChoices(u8 selection)
styles[1] = 0;
styles[selection] = 1;
DrawOptionMenuChoice(gText_BattleSceneOn, 104, 16, styles[0]);
DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), 16, styles[1]);
DrawOptionMenuChoice(gText_BattleSceneOn, 104, YPOS_BATTLESCENE, styles[0]);
DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), YPOS_BATTLESCENE, styles[1]);
}
static u8 BattleStyle_ProcessInput(u8 selection)
@ -486,8 +493,8 @@ static void BattleStyle_DrawChoices(u8 selection)
styles[1] = 0;
styles[selection] = 1;
DrawOptionMenuChoice(gText_BattleStyleShift, 104, 32, styles[0]);
DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), 32, styles[1]);
DrawOptionMenuChoice(gText_BattleStyleShift, 104, YPOS_BATTLESTYLE, styles[0]);
DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), YPOS_BATTLESTYLE, styles[1]);
}
static u8 Sound_ProcessInput(u8 selection)
@ -510,8 +517,8 @@ static void Sound_DrawChoices(u8 selection)
styles[1] = 0;
styles[selection] = 1;
DrawOptionMenuChoice(gText_SoundMono, 104, 48, styles[0]);
DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), 48, styles[1]);
DrawOptionMenuChoice(gText_SoundMono, 104, YPOS_SOUND, styles[0]);
DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), YPOS_SOUND, styles[1]);
}
static u8 FrameType_ProcessInput(u8 selection)
@ -568,8 +575,8 @@ static void FrameType_DrawChoices(u8 selection)
text[i] = EOS;
DrawOptionMenuChoice(gText_FrameType, 104, 80, 0);
DrawOptionMenuChoice(text, 128, 80, 1);
DrawOptionMenuChoice(gText_FrameType, 104, YPOS_FRAMETYPE, 0);
DrawOptionMenuChoice(text, 128, YPOS_FRAMETYPE, 1);
}
static u8 ButtonMode_ProcessInput(u8 selection)
@ -605,7 +612,7 @@ static void ButtonMode_DrawChoices(u8 selection)
styles[2] = 0;
styles[selection] = 1;
DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, 64, styles[0]);
DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, YPOS_BUTTONMODE, styles[0]);
widthNormal = GetStringWidth(1, gText_ButtonTypeNormal, 0);
widthLR = GetStringWidth(1, gText_ButtonTypeLR, 0);
@ -613,9 +620,9 @@ static void ButtonMode_DrawChoices(u8 selection)
widthLR -= 94;
xLR = (widthNormal - widthLR - widthLA) / 2 + 104;
DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, 64, styles[1]);
DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, YPOS_BUTTONMODE, styles[1]);
DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), 64, styles[2]);
DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), YPOS_BUTTONMODE, styles[2]);
}
static void DrawTextOption(void)