diff options
author | GriffinR <griffin.richards@comcast.net> | 2019-09-13 01:15:32 -0400 |
---|---|---|
committer | huderlem <huderlem@gmail.com> | 2019-09-17 16:50:42 -0500 |
commit | 1be131f843da200ecc37d511f64304015a1f03f6 (patch) | |
tree | ab76dd0b3401a358551dc6c96c96699b4cb9eadf | |
parent | 6ab192e7393a23ef811a83bdc7e631eafdf368b9 (diff) |
Dynamic ordering for options menu
-rw-r--r-- | src/option_menu.c | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/option_menu.c b/src/option_menu.c index 3ffb2738f..a92b8af03 100644 --- a/src/option_menu.c +++ b/src/option_menu.c @@ -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) |