seta hud_panel_centerprint_align "" "text alignment: 0 left, 0.5 center, 1 right"
seta hud_panel_centerprint_flip "" "invert messages order"
seta hud_panel_centerprint_fontscale "" "scale the text font by this amount"
+seta hud_panel_centerprint_fontscale_bold "" "scale the bold text font by this amount"
seta hud_panel_centerprint_time "" "message duration (NOTE: certain messages have a fixed duration)"
seta hud_panel_centerprint_fade_in "" "how long a message takes to fade in"
seta hud_panel_centerprint_fade_out "" "how long a message takes to fade out (this time is included in the message duration and can't be > 5)"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
seta hud_panel_centerprint_align "0.5"
seta hud_panel_centerprint_flip "0"
seta hud_panel_centerprint_fontscale "1"
+seta hud_panel_centerprint_fontscale_bold "1.8"
seta hud_panel_centerprint_time "3"
seta hud_panel_centerprint_fade_in "0.2"
seta hud_panel_centerprint_fade_out "0.5"
float autocvar_hud_panel_centerprint_fade_minfontsize = 0;
bool autocvar_hud_panel_centerprint_flip;
float autocvar_hud_panel_centerprint_fontscale;
+float autocvar_hud_panel_centerprint_fontscale_bold;
float autocvar_hud_panel_centerprint_time;
bool autocvar_hud_panel_chat;
bool autocvar_hud_panel_engineinfo;
HUD_Write_Cvar("hud_panel_centerprint_align");
HUD_Write_Cvar("hud_panel_centerprint_flip");
HUD_Write_Cvar("hud_panel_centerprint_fontscale");
+ HUD_Write_Cvar("hud_panel_centerprint_fontscale_bold");
HUD_Write_Cvar("hud_panel_centerprint_time");
HUD_Write_Cvar("hud_panel_centerprint_fade_in");
HUD_Write_Cvar("hud_panel_centerprint_fade_out");
#include <client/miscfunctions.qh>
// CenterPrint (#16)
+// These are the functions that draw the text at the center of the screen (e.g. frag messages and server MOTDs).
+// Usually local_notification_centerprint_generic() is called, which in turn calls centerprint_generic(), which
+// uses some kind of macro magic to call HUD_CenterPrint, which draws them on screen using drawcolorcodedstring().
const int CENTERPRINT_MAX_MSGS = 10;
const int CENTERPRINT_MAX_ENTRIES = 50;
strfree(centerprint_messages[i]);
}
}
+
float hud_configure_cp_generation_time;
void HUD_CenterPrint ()
{
panel_size -= '2 2 0' * panel_bg_padding;
}
+ bool is_bold;
+ string centerprint_message;
int entries;
float height;
vector fontsize;
- // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES);
- // height = panel_size_y/entries;
- // fontsize = '1 1 0' * height;
- height = vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale;
- fontsize = '1 1 0' * height;
- entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES);
int i, j, k, n, g;
float a, sz, align, current_msg_posY = 0, msg_size;
align = bound(0, autocvar_hud_panel_centerprint_align, 1);
for (g=0, i=0, j=cpm_index; i<CENTERPRINT_MAX_MSGS; ++i, ++j)
{
+ // if the notification starts with ^BOLD make it bold (e.g. frag messages);
+ is_bold = (substring(centerprint_messages[j], 0, 5) == BOLD_OPERATOR);
+ // remove ^BOLD so it doesn't get printed onscreen
+ centerprint_message = is_bold ? strzone(substring(centerprint_messages[j], 5, -1)) : strzone(centerprint_messages[j]);
+
+ // entries = bound(1, floor(CENTERPRINT_MAX_ENTRIES * 4 * panel_size_y/panel_size_x), CENTERPRINT_MAX_ENTRIES);
+ // height = panel_size_y/entries;
+ // fontsize = '1 1 0' * height;
+ height = (is_bold) ? vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale_bold : vid_conheight/50 * autocvar_hud_panel_centerprint_fontscale;
+ fontsize = '1 1 0' * height;
+ entries = bound(1, floor(panel_size.y/height), CENTERPRINT_MAX_ENTRIES);
+
if (j == CENTERPRINT_MAX_MSGS)
j = 0;
if (centerprint_expire_time[j] == -1)
drawfontscale = hud_scale * sz;
if (centerprint_countdown_num[j])
- n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_messages[j]), "\n");
+ n = tokenizebyseparator(strreplace("^COUNT", count_seconds(centerprint_countdown_num[j]), centerprint_message), "\n");
else
- n = tokenizebyseparator(centerprint_messages[j], "\n");
+ n = tokenizebyseparator(centerprint_message, "\n");
if (autocvar_hud_panel_centerprint_flip)
{
if (align)
pos.x = panel_pos.x + (panel_size.x - stringwidth(ts, true, fontsize) * sz) * align;
if (a > 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
+ if (is_bold) draw_beginBoldFont();
drawcolorcodedstring(pos + eY * 0.5 * (1 - sz * hud_scale.x) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
+ if (is_bold) draw_endBoldFont();
pos.y += fontsize.y;
}
else
return;
}
}
+
+ // free up memory
+ strunzone(centerprint_message);
}
drawfontscale = hud_scale;
if (all_messages_expired)
#define VERBOSE_MURDER(type) strcat(MURDER_##type, "^BG%s")
- #define MURDER_FRAG _("^K3%sYou fragged ^BG%s")
- #define MURDER_FRAG2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG strcat(BOLD_OPERATOR, _("^K3%sYou fragged ^BG%s"))
+ #define MURDER_FRAG2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED _("^K1%sYou were fragged by ^BG%s")
#define MURDER_FRAGGED2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG, MURDER_FRAG2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED), VERBOSE_MURDER(FRAGGED2) )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG), VERBOSE_MURDER(FRAG2) )
- #define MURDER_FRAG_FIRE _("^K3%sYou burned ^BG%s")
- #define MURDER_FRAG_FIRE2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG_FIRE strcat(BOLD_OPERATOR, _("^K3%sYou burned ^BG%s"))
+ #define MURDER_FRAG_FIRE2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED_FIRE _("^K1%sYou were burned by ^BG%s")
#define MURDER_FRAGGED_FIRE2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG_FIRE, MURDER_FRAG_FIRE2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FIRE_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED_FIRE), VERBOSE_MURDER(FRAGGED_FIRE2) )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FIRE_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG_FIRE), VERBOSE_MURDER(FRAG_FIRE2) )
- #define MURDER_FRAG_FREEZE _("^K3%sYou froze ^BG%s")
- #define MURDER_FRAG_FREEZE2 _("^K3%sYou scored against ^BG%s")
+ #define MURDER_FRAG_FREEZE strcat(BOLD_OPERATOR, _("^K3%sYou froze ^BG%s"))
+ #define MURDER_FRAG_FREEZE2 strcat(BOLD_OPERATOR, _("^K3%sYou scored against ^BG%s"))
#define MURDER_FRAGGED_FREEZE _("^K1%sYou were frozen by ^BG%s")
#define MURDER_FRAGGED_FREEZE2 _("^K1%sYou were scored against by ^BG%s")
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_FRAG_FREEZE, MURDER_FRAG_FREEZE2 )
MSG_CENTER_NOTIF(DEATH_MURDER_FRAGGED_FREEZE_VERBOSE, N_ENABLE, 1, 4, "spree_cen s1 frag_stats", CPID_Null, "0 0", VERBOSE_MURDER(FRAGGED_FREEZE), VERBOSE_MURDER(FRAGGED_FREEZE2))
MSG_CENTER_NOTIF(DEATH_MURDER_FRAG_FREEZE_VERBOSE, N_ENABLE, 1, 2, "spree_cen s1 frag_ping", CPID_Null, "0 0", VERBOSE_MURDER(FRAG_FREEZE), VERBOSE_MURDER(FRAG_FREEZE2) )
- #define MURDER_TYPEFRAG _("^K1%sYou typefragged ^BG%s")
- #define MURDER_TYPEFRAG2 _("^K1%sYou scored against ^BG%s^K1 while they were typing")
+ #define MURDER_TYPEFRAG strcat(BOLD_OPERATOR, _("^K1%sYou typefragged ^BG%s"))
+ #define MURDER_TYPEFRAG2 strcat(BOLD_OPERATOR, _("^K1%sYou scored against ^BG%s^K1 while they were typing"))
#define MURDER_TYPEFRAGGED _("^K1%sYou were typefragged by ^BG%s")
#define MURDER_TYPEFRAGGED2 _("^K1%sYou were scored against by ^BG%s^K1 while typing")
MSG_CENTER_NOTIF(DEATH_MURDER_TYPEFRAG, N_ENABLE, 1, 1, "spree_cen s1", CPID_Null, "0 0", MURDER_TYPEFRAG, MURDER_TYPEFRAG2 )
#include <client/autocvars.qh>
#endif
+// Operator for bold notifications
+#define BOLD_OPERATOR "^BOLD"
+
/** main types/groups of notifications */
ENUMCLASS(MSG)
/** "Global" AND "personal" announcer messages */
if(!this.superweapons_finished)
this.superweapons_finished = autocvar_g_balance_superweapons_time;
+ string str;
int n = tokenize_console(this.netname);
if(argv(0) == "give")
{
- this.netname = substring(this.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
+ str = substring(this.netname, argv_start_index(1), argv_end_index(-1) - argv_start_index(1));
}
else
{
itemprefix = valueprefix = string_null;
}
- this.netname = "";
- this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_AMMO), "unlimited_weapon_ammo");
- this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons");
- this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.strength_finished * boolean(this.items & ITEM_Strength.m_itemid), "strength");
- this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.invincible_finished * boolean(this.items & ITEM_Shield.m_itemid), "invincible");
- this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, this.superweapons_finished * boolean(this.items & IT_SUPERWEAPON), "superweapons");
- this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_Jetpack.m_itemid), "jetpack");
- this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, boolean(this.items & ITEM_JetpackRegen.m_itemid), "fuel_regen");
- if(GetResource(this, RES_SHELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_SHELLS)), "shells");
- if(GetResource(this, RES_BULLETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_BULLETS)), "nails");
- if(GetResource(this, RES_ROCKETS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_ROCKETS)), "rockets");
- if(GetResource(this, RES_CELLS) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_CELLS)), "cells");
- if(GetResource(this, RES_PLASMA) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_PLASMA)), "plasma");
- if(GetResource(this, RES_FUEL) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_FUEL)), "fuel");
- if(GetResource(this, RES_HEALTH) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_HEALTH)), "health");
- if(GetResource(this, RES_ARMOR) != 0) this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, GetResource(this, RES_ARMOR)), "armor");
+ str = "";
+ str = sprintf("%s %s%d %s", str, itemprefix, boolean(this.items & IT_UNLIMITED_AMMO), "unlimited_weapon_ammo");
+ str = sprintf("%s %s%d %s", str, itemprefix, boolean(this.items & IT_UNLIMITED_SUPERWEAPONS), "unlimited_superweapons");
+ str = sprintf("%s %s%d %s", str, valueprefix, this.strength_finished * boolean(this.items & ITEM_Strength.m_itemid), "strength");
+ str = sprintf("%s %s%d %s", str, valueprefix, this.invincible_finished * boolean(this.items & ITEM_Shield.m_itemid), "invincible");
+ str = sprintf("%s %s%d %s", str, valueprefix, this.superweapons_finished * boolean(this.items & IT_SUPERWEAPON), "superweapons");
+ str = sprintf("%s %s%d %s", str, itemprefix, boolean(this.items & ITEM_Jetpack.m_itemid), "jetpack");
+ str = sprintf("%s %s%d %s", str, itemprefix, boolean(this.items & ITEM_JetpackRegen.m_itemid), "fuel_regen");
+ float res;
+ res = GetResource(this, RES_SHELLS); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "shells");
+ res = GetResource(this, RES_BULLETS); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "nails");
+ res = GetResource(this, RES_ROCKETS); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "rockets");
+ res = GetResource(this, RES_CELLS); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "cells");
+ res = GetResource(this, RES_PLASMA); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "plasma");
+ res = GetResource(this, RES_FUEL); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "fuel");
+ res = GetResource(this, RES_HEALTH); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "health");
+ res = GetResource(this, RES_ARMOR); if(res != 0) str = sprintf("%s %s%d %s", str, valueprefix, max(0, res), "armor");
// HACK: buffs share a single timer, so we need to include enabled buffs AFTER disabled ones to avoid loss
- FOREACH(Buffs, it != BUFF_Null && !(STAT(BUFFS, this) & it.m_itemid), this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname));
- FOREACH(Buffs, it != BUFF_Null && (STAT(BUFFS, this) & it.m_itemid), this.netname = sprintf("%s %s%d %s", this.netname, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname));
- FOREACH(Weapons, it != WEP_Null, this.netname = sprintf("%s %s%d %s", this.netname, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname));
+ FOREACH(Buffs, it != BUFF_Null && !(STAT(BUFFS, this) & it.m_itemid), str = sprintf("%s %s%d %s", str, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname));
+ FOREACH(Buffs, it != BUFF_Null && (STAT(BUFFS, this) & it.m_itemid), str = sprintf("%s %s%d %s", str, valueprefix, max(0, STAT(BUFF_TIME, this)), it.netname));
+ FOREACH(Weapons, it != WEP_Null, str = sprintf("%s %s%d %s", str, itemprefix, !!(STAT(WEAPONS, this) & (it.m_wepset)), it.netname));
}
- this.netname = strzone(this.netname);
- //print(this.netname, "\n");
+ this.netname = strzone(str);
n = tokenize_console(this.netname);
for(int j = 0; j < n; ++j)
string KeyBinds_Descriptions[MAX_KEYBINDS];
int KeyBinds_Count = -1;
-void KeyBinds_Read()
+void KeyBinds_BuildList()
{
KeyBinds_Count = 0;
#define KEYBIND_HEADER(str) KEYBIND_DEF("", str)
#define KEYBIND_IS_SPECIAL(func) (substring(func, 0 ,1) == "*")
- #define KEYBIND_SPECIAL_DEF(key) KEYBIND_DEF(strcat("*", key), "")
+ #define KEYBIND_SPECIAL_DEF(key, desc) KEYBIND_DEF(strcat("*", key), desc)
KEYBIND_HEADER(_("Moving"));
KEYBIND_DEF("+forward" , _("forward"));
KEYBIND_DEF("reload" , _("reload"));
KEYBIND_DEF("dropweapon" , _("drop weapon / throw nade"));
- int i;
-
#define ADD_TO_W_LIST(pred) \
FOREACH(Weapons, it != WEP_Null, { \
if (it.impulse != imp) continue; \
KEYBIND_DEF("spec" , _("enter spectator mode"));
KEYBIND_EMPTY_LINE();
- KEYBIND_HEADER(_("Communicate"));
+ KEYBIND_HEADER(_("Communication"));
KEYBIND_DEF("messagemode" , _("public chat"));
KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("+con_chat_maximize" , _("show chat history"));
// display the hardcoded shortcut to open the console as it works for all
// non-English keyboard layouts, unlike default keys (` and ~)
KEYBIND_DEF("toggleconsole" , _("enter console"));
- KEYBIND_SPECIAL_DEF(strcat(translate_key("SHIFT"), "+", translate_key("ESCAPE")));
+ string console_shortcut = strcat(translate_key("SHIFT"), "+", translate_key("ESCAPE"));
+ KEYBIND_SPECIAL_DEF(console_shortcut, _("enter console"));
KEYBIND_DEF("disconnect" , _("disconnect"));
KEYBIND_DEF("menu_showquitdialog" , _("quit"));
KEYBIND_EMPTY_LINE();
KEYBIND_HEADER(_("Teamplay"));
- KEYBIND_DEF("messagemode2" , _("team chat"));
KEYBIND_DEF("team_auto" , _("auto-join team"));
KEYBIND_DEF("menu_showteamselect" , _("team menu"));
- KEYBIND_DEF("+use" , _("drop key / drop flag"));
+ KEYBIND_DEF("spec" , _("spectate"));
KEYBIND_EMPTY_LINE();
KEYBIND_HEADER(_("Misc"));
- KEYBIND_DEF("kill" , _("respawn"));
+ KEYBIND_DEF("+use" , _("drop key/flag, exit vehicle"));
+ KEYBIND_DEF("kill" , _("suicide / respawn"));
KEYBIND_DEF("quickmenu" , _("quick menu"));
- KEYBIND_DEF("menu_showsandboxtools" , _("sandbox menu"));
- KEYBIND_DEF("wpeditor_menu" , _("waypoint editor menu"));
- KEYBIND_DEF("+button8" , _("drag object"));
KEYBIND_EMPTY_LINE();
KEYBIND_HEADER(_("User defined"));
- for(i = 1; i <= 32; ++i)
+ for(int i = 1; i <= 32; ++i)
KEYBIND_DEF(strcat("+userbind ", itos(i)), strcat("$userbind", itos(i)));
+ KEYBIND_EMPTY_LINE();
+
+ KEYBIND_HEADER(_("Development"));
+ KEYBIND_DEF("menu_showsandboxtools" , _("sandbox menu"));
+ KEYBIND_DEF("+button8" , _("drag object (sandbox)"));
+ KEYBIND_DEF("wpeditor_menu" , _("waypoint editor menu"));
+
#undef KEYBIND_DEF
}
bool force_initial_selection = false;
if(KeyBinds_Count < 0) // me.handle not loaded yet?
force_initial_selection = true;
- KeyBinds_Read();
+ KeyBinds_BuildList();
me.nItems = KeyBinds_Count;
if(force_initial_selection)
me.setSelected(me, 0);
{
k = stof(argv(j));
if(k != -1)
- //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ {
+ // bind to empty cmd instead of using unbind so it gets saved in config and overrides any default binds
localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
+ }
}
}
m_play_click_sound(MENU_SOUND_SELECT);
{
k = stof(argv(j));
if(k != -1)
- //localcmd("\nunbind \"", keynumtostring(k), "\"\n");
+ {
+ // bind to empty cmd instead of using unbind so it gets saved in config and overrides any default binds
localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
+ }
}
m_play_click_sound(MENU_SOUND_CLEAR);
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected, bool isFocused)
{
- string s;
- int j, n;
- float k;
vector theColor;
float theAlpha;
float extraMargin;
if(func == "")
{
- theAlpha = 1;
theColor = SKINCOLOR_KEYGRABBER_TITLES;
theAlpha = SKINALPHA_KEYGRABBER_TITLES;
extraMargin = 0;
if(substring(descr, 0, 1) == "$")
{
- s = substring(descr, 1, strlen(descr) - 1);
+ string s = substring(descr, 1, strlen(descr) - 1);
descr = cvar_string(strcat(s, "_description"));
if(descr == "")
descr = s;
theAlpha *= SKINALPHA_DISABLED;
}
- s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
+ string s = draw_TextShortenToWidth(descr, me.columnFunctionSize, 0, me.realFontSize);
draw_Text(me.realUpperMargin * eY + extraMargin * eX, s, me.realFontSize, theColor, theAlpha, 0);
if (func == "")
s = substring(func, 1, -1);
else
{
- n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
- for(j = 0; j < n; ++j)
+ bool joy_active = cvar("joy_active");
+ int n = tokenize(findkeysforcommand(func, 0)); // uses '...' strings
+ for(int j = 0; j < n; ++j)
{
- k = stof(argv(j));
+ float k = stof(argv(j));
if(k != -1)
{
+ string key = keynumtostring(k);
+ if (!joy_active && startsWith(key, "JOY"))
+ continue;
if(s != "")
s = strcat(s, ", ");
- s = strcat(s, translate_key(keynumtostring(k)));
+ s = strcat(s, translate_key(key));
}
}
}