From e470ed9ccda7874f3280bef37141a6b3ef8b1f46 Mon Sep 17 00:00:00 2001 From: mcmartin Date: Tue, 8 Feb 2005 08:07:26 +0000 Subject: [PATCH] Modified controls so that category and option selection is consistent git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1523 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/sc2code/setupmenu.c | 49 +++++++------------------------------ 1 file changed, 9 insertions(+), 40 deletions(-) diff --git a/sc2/src/sc2code/setupmenu.c b/sc2/src/sc2code/setupmenu.c index f45dc6858..a1173f682 100644 --- a/sc2/src/sc2code/setupmenu.c +++ b/sc2/src/sc2code/setupmenu.c @@ -442,54 +442,28 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState) if (PulsedInputState.key[KEY_MENU_UP]) { - opt -= 3; - if (opt < 0) + cat--; + if (cat < 0) { - cat--; - if (cat < 0) - { - cat = NUM_OPTS-1; - } - /* Preserve column if possible */ - opt = (menu[cat].numopts - (menu[cat].numopts % 3)) + ((opt + 3) % 3); - if (opt >= menu[cat].numopts) - { - opt = menu[cat].numopts - 1; - } + cat = NUM_OPTS-1; } + /* Preserve column if possible */ + opt = menu[cat].selected; } else if (PulsedInputState.key[KEY_MENU_DOWN]) { - opt += 3; - if ((opt - (opt % 3)) >= menu[cat].numopts) + cat++; + if (cat >= NUM_OPTS) { - cat++; - if (cat >= NUM_OPTS) - { - cat = 0; - } - /* Preserve column if possible */ - opt = opt % 3; - if (opt >= menu[cat].numopts) - { - opt = menu[cat].numopts - 1; - } - } - else if (opt >= menu[cat].numopts) - { - opt = menu[cat].numopts - 1; + cat = 0; } + opt = menu[cat].selected; } else if (PulsedInputState.key[KEY_MENU_LEFT]) { opt--; if (opt < 0) { - cat--; - if (cat < 0) - { - cat = NUM_OPTS-1; - } opt = menu[cat].numopts - 1; } } @@ -498,11 +472,6 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState) opt++; if (opt >= menu[cat].numopts) { - cat++; - if (cat >= NUM_OPTS) - { - cat = 0; - } opt = 0; } }