diff --git a/code/hud/hudsquadmsg.cpp b/code/hud/hudsquadmsg.cpp index 25ecd057561..20956c15a55 100644 --- a/code/hud/hudsquadmsg.cpp +++ b/code/hud/hudsquadmsg.cpp @@ -222,7 +222,7 @@ void hud_squadmsg_start() MsgItems.clear(); First_menu_item = 0; Selected_menu_item = First_menu_item; // make first menu item a selected object - Display_selector = false; + Display_selector = Always_show_selected_item_in_comms_gauge; Squad_msg_mode = SM_MODE_TYPE_SELECT; // start off at the base state Msg_mode_timestamp = _timestamp(DEFAULT_MSG_TIMEOUT); // initialize our timer to bogus value @@ -496,8 +496,18 @@ void hud_squadmsg_selection_move( bool up ) { //The selection moves +/-1 through the whole menu, wrapping around at either end. //First_menu_item and Selected_menu_item are just the page and the offset within the page. int num_items = sz2i(MsgItems.size()); + int step = up ? -1 : 1; int selected_index = First_menu_item + Selected_menu_item; - selected_index = (selected_index + (up ? -1 : 1) + num_items) % num_items; + + //skip over any hidden items (such as when using Hide_main_rearm_items_in_comms_gauge). + //bound the search by the item count so a fully hidden menu does not loop forever. + for (int i = 0; i < num_items; i++) { + selected_index = (selected_index + step + num_items) % num_items; + + //stop once we land on a visible item + if (MsgItems[selected_index].active >= 0) + break; + } Selected_menu_item = selected_index % MAX_MENU_DISPLAY; First_menu_item = selected_index - Selected_menu_item; diff --git a/code/mod_table/mod_table.cpp b/code/mod_table/mod_table.cpp index 222d5278fd4..cebd454ea26 100644 --- a/code/mod_table/mod_table.cpp +++ b/code/mod_table/mod_table.cpp @@ -174,6 +174,7 @@ bool Use_new_scanning_behavior; bool Lua_API_returns_nil_instead_of_invalid_object; bool Dont_show_callsigns_in_escort_list; bool Hide_main_rearm_items_in_comms_gauge; +bool Always_show_selected_item_in_comms_gauge; bool Fix_scripted_velocity; color Overhead_line_colors[MAX_SHIP_SECONDARY_BANKS]; bool Preload_briefing_icon_models; @@ -499,6 +500,10 @@ void parse_mod_table(const char *filename) stuff_boolean(&Hide_main_rearm_items_in_comms_gauge); } + if (optional_string("$Always show selected item in Comms Gauge:")) { + stuff_boolean(&Always_show_selected_item_in_comms_gauge); + } + optional_string("#SEXP SETTINGS"); if (optional_string("$Loop SEXPs Then Arguments:")) { @@ -1941,6 +1946,7 @@ void mod_table_reset() Use_new_scanning_behavior = false; Lua_API_returns_nil_instead_of_invalid_object = false; Dont_show_callsigns_in_escort_list = false; + Always_show_selected_item_in_comms_gauge = false; Hide_main_rearm_items_in_comms_gauge = false; Fix_scripted_velocity = false; // These colors were taken from missionscreencommon.cpp line 591 which diff --git a/code/mod_table/mod_table.h b/code/mod_table/mod_table.h index d74e35b0395..ea1a9be939a 100644 --- a/code/mod_table/mod_table.h +++ b/code/mod_table/mod_table.h @@ -194,6 +194,7 @@ extern bool Use_new_scanning_behavior; extern bool Lua_API_returns_nil_instead_of_invalid_object; extern bool Dont_show_callsigns_in_escort_list; extern bool Hide_main_rearm_items_in_comms_gauge; +extern bool Always_show_selected_item_in_comms_gauge; extern bool Fix_scripted_velocity; extern color Overhead_line_colors[MAX_SHIP_SECONDARY_BANKS]; extern bool Preload_briefing_icon_models;