From 01e522e6e7534f245f9257ef4161c6432ad86eb6 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Fri, 11 Feb 2011 12:24:13 +0100 Subject: [PATCH] Controls.select_weapon_count needs to be incremented differently to get non-0 when we want to select the laser type weapon; Readded jumping from first to last item in newmenu and vice versa --- CHANGELOG.txt | 4 ++++ main/gamecntl.c | 3 ++- main/kconfig.c | 6 +++--- main/newmenu.c | 11 +++++++++++ 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 512a1a288..db7b91dfd 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,9 @@ D1X-Rebirth Changelog +20110211 +-------- +main/gamecntl.c, main/kconfig.c, main/newmenu.c: Controls.select_weapon_count needs to be incremented differently to get non-0 when we want to select the laser type weapon; Readded jumping from first to last item in newmenu and vice versa + 20110210 -------- main/automap.c, main/gauges.c, main/gauges.h, main/kconfig.c, main/newmenu.c, main/newmenu.h: Fixed broken FlightSim indicator on Automap; Fixed Assert for using mouse buttons in kconfig (which can react to UP and DOWN states); Added scrolling support for menus flagged tiny_mode and all_text diff --git a/main/gamecntl.c b/main/gamecntl.c index fd856226c..5d9940d36 100644 --- a/main/gamecntl.c +++ b/main/gamecntl.c @@ -198,8 +198,9 @@ void do_weapon_n_item_stuff() CycleSecondary (); Controls.cycle_secondary_count = 0; } - if (Controls.select_weapon_count) + if (Controls.select_weapon_count > 0) { + Controls.select_weapon_count--; do_weapon_select(Controls.select_weapon_count>4?Controls.select_weapon_count-5:Controls.select_weapon_count,Controls.select_weapon_count>4?1:0); Controls.select_weapon_count = 0; } diff --git a/main/kconfig.c b/main/kconfig.c index 41bf7c3e7..d14be7592 100644 --- a/main/kconfig.c +++ b/main/kconfig.c @@ -1164,7 +1164,7 @@ void kconfig_read_controls(d_event *event, int automap_flag) for (i = 0, j = 0; i < 28; i += 3, j++) if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_key_get_raw(event)) { - Controls.select_weapon_count = j; + Controls.select_weapon_count = j+1; break; } break; @@ -1191,7 +1191,7 @@ void kconfig_read_controls(d_event *event, int automap_flag) for (i = 1, j = 0; i < 29; i += 3, j++) if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_joystick_get_button(event)) { - Controls.select_weapon_count = j; + Controls.select_weapon_count = j+1; break; } break; @@ -1218,7 +1218,7 @@ void kconfig_read_controls(d_event *event, int automap_flag) for (i = 2, j = 0; i < 30; i += 3, j++) if (kc_d1x[i].value < 255 && kc_d1x[i].value == event_mouse_get_button(event)) { - Controls.select_weapon_count = j; + Controls.select_weapon_count = j+1; break; } break; diff --git a/main/newmenu.c b/main/newmenu.c index 6b6377d15..f4ee440b1 100644 --- a/main/newmenu.c +++ b/main/newmenu.c @@ -570,6 +570,17 @@ void newmenu_scroll(newmenu *menu, int amount) if (first == last) // nothing to do for us return; + if (menu->citem == last && amount == 1) // if citem == last item and we want to go down one step, go to first item + { + newmenu_scroll(menu, -menu->nitems); + return; + } + if (menu->citem == first && amount == -1) // if citem == first item and we want to go up one step, go to last item + { + newmenu_scroll(menu, menu->nitems); + return; + } + i = 0; if (amount > 0) // down the list {