Skip to content

Commit 2647727

Browse files
authored
Allow modders to tune Comms Styling (#6776)
This PR adds two new localization strings, which allow modders to change how the numbers in the comms menu are displayed, and it incorporates styling for the comms selection controls from #6736, too. Tested and works as expected.
1 parent 821d161 commit 2647727

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

code/hud/hudsquadmsg.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ char Squad_msg_title[256] = "";
107107
mmode_item MsgItems[MAX_MENU_ITEMS];
108108
int Num_menu_items = -1; // number of items for a message menu
109109

110-
int First_menu_item= -1; // index of first item in the menu. This tracks what element of comms options collection is displayed as first option, and displays the next 9 options. Changes only by +/- MAX_MENU_ITEMS (10)
110+
int First_menu_item = -1; // index of first item in the menu. This tracks what element of comms options collection is displayed as first option, and displays the next 9 options. Changes only by +/- MAX_MENU_ITEMS (10)
111111
int Selected_menu_item = First_menu_item; //!< index of selected item in the menu. Possible index range: 0 - 9, assuming MAX_MENU_ITEMS == 10, and First_menu_item gets initialized
112112
SCP_string Lua_sqd_msg_cat;
113113

@@ -556,17 +556,17 @@ void hud_squadmsg_selection_select() {
556556
if (Player->flags & PLAYER_FLAGS_MSG_MODE)
557557
{
558558
//Check if selected option is even active
559-
if (!(MsgItems[Selected_menu_item + First_menu_item].active))
560-
{
561-
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
562-
}
563-
else
559+
if ((MsgItems[Selected_menu_item + First_menu_item].active > 0))
564560
{
565561
Msg_key_used = 1;
566562
Msg_key = Selected_menu_item + 2; //+1 because menu items on actual menu start from 1, not 0
567563
//Another +1 because methods that use this later do -1. I'm not sure why they do that, but it works
568564
Selected_menu_item = 0; //Reset this value, so the position will reset at the next window
569565
}
566+
else
567+
{
568+
gamesnd_play_iface(InterfaceSounds::GENERAL_FAIL);
569+
}
570570
}
571571
}
572572

@@ -2965,13 +2965,13 @@ void HudGaugeSquadMessage::render(float /*frametime*/, bool config)
29652965

29662966
if (MsgItems[First_menu_item + i].active >= 0) {
29672967
// first print an icon to indicate selected item
2968+
item_num = (i + 1) % MAX_MENU_DISPLAY;
29682969
if (isSelectedItem) {
2969-
renderString(sx, sy, EG_SQ1 + i, ">>", scale, config);
2970+
renderPrintfWithGauge(sx, sy, EG_SQ1 + i, scale, config, XSTR(">>", 1887), item_num); //allow modders to change string and add number
29702971
}
29712972
// or do the number
29722973
else {
2973-
item_num = (i + 1) % MAX_MENU_DISPLAY;
2974-
renderPrintfWithGauge(sx, sy, EG_SQ1 + i, scale, config, NOX("%1d."), item_num);
2974+
renderPrintfWithGauge(sx, sy, EG_SQ1 + i, scale, config, XSTR("%1d.", 1886), item_num);
29752975
}
29762976

29772977
// then the text

code/localization/localize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bool *Lcl_unexpected_tstring_check = nullptr;
6464
// NOTE: with map storage of XSTR strings, the indexes no longer need to be contiguous,
6565
// but internal strings should still increment XSTR_SIZE to avoid collisions.
6666
// retail XSTR_SIZE = 1570
67-
// #define XSTR_SIZE 1886 // This is the next available ID
67+
// #define XSTR_SIZE 1888 // This is the next available ID
6868

6969
// struct to allow for strings.tbl-determined x offset
7070
// offset is 0 for english, by default

0 commit comments

Comments
 (0)