Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions code/hud/hudsquadmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions code/mod_table/mod_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:")) {
Comment thread
Goober5000 marked this conversation as resolved.
stuff_boolean(&Always_show_selected_item_in_comms_gauge);
}

optional_string("#SEXP SETTINGS");

if (optional_string("$Loop SEXPs Then Arguments:")) {
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions code/mod_table/mod_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading