#ifdef INTERFACE
CLASS(XonoticKeyBinder) EXTENDS(XonoticListBox)
METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity))
- ATTRIB(XonoticKeyBinder, rowsPerItem, float, 1)
+ ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1)
METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, float, vector, float))
METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector))
METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector))
ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0)
ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0)
- ATTRIB(XonoticKeyBinder, previouslySelected, float, -1)
+ ATTRIB(XonoticKeyBinder, previouslySelected, int, -1)
ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0)
ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL)
ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL)
const string KEY_NOT_BOUND_CMD = "// not bound";
-const float MAX_KEYS_PER_FUNCTION = 2;
-const float MAX_KEYBINDS = 256;
+const int MAX_KEYS_PER_FUNCTION = 2;
+const int MAX_KEYBINDS = 256;
string Xonotic_KeyBinds_Functions[MAX_KEYBINDS];
string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS];
-var float Xonotic_KeyBinds_Count = -1;
+int Xonotic_KeyBinds_Count = -1;
void Xonotic_KeyBinds_Read()
{
- float fh;
+ int fh;
string s;
Xonotic_KeyBinds_Count = 0;
}
void replace_bind(string from, string to)
{
- float n, j, k;
+ int n, j;
+ float k; // not sure if float or int
n = tokenize(findkeysforcommand(from, 0)); // uses '...' strings
for(j = 0; j < n; ++j)
{
{
SUPER(XonoticKeyBinder).resizeNotify(me, relOrigin, relSize, absOrigin, absSize);
- me.realFontSize_y = me.fontSize / (absSize_y * me.itemHeight);
- me.realFontSize_x = me.fontSize / (absSize_x * (1 - me.controlWidth));
- me.realUpperMargin = 0.5 * (1 - me.realFontSize_y);
+ me.realFontSize_y = me.fontSize / (absSize.y * me.itemHeight);
+ me.realFontSize_x = me.fontSize / (absSize.x * (1 - me.controlWidth));
+ me.realUpperMargin = 0.5 * (1 - me.realFontSize.y);
me.columnFunctionOrigin = 0;
- me.columnKeysSize = me.realFontSize_x * 12;
- me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize_x;
- me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize_x;
+ me.columnKeysSize = me.realFontSize.x * 12;
+ me.columnFunctionSize = 1 - me.columnKeysSize - 2 * me.realFontSize.x;
+ me.columnKeysOrigin = me.columnFunctionOrigin + me.columnFunctionSize + me.realFontSize.x;
if(me.userbindEditButton)
me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[me.selectedItem], 0, 1) != "$");
me.clearButton.disabled = 1;
keyGrabber = me;
}
-void XonoticKeyBinder_keyGrabbed(entity me, float key, float ascii)
+void XonoticKeyBinder_keyGrabbed(entity me, int key, bool ascii)
{
- float n, j, k, nvalid;
+ int n, j, nvalid;
+ float k;
string func;
me.keyGrabButton.forcePressed = 0;
localcmd("\nbind \"", keynumtostring(k), "\" \"", KEY_NOT_BOUND_CMD, "\"\n");
}
}
+ m_play_click_sound(MENU_SOUND_SELECT);
localcmd("\nbind \"", keynumtostring(key), "\" \"", func, "\"\n");
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
cvar_set("_hud_showbinds_reload", "1");
//localcmd("\nunbind \"", keynumtostring(k), "\"\n");
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
cvar_set("_hud_showbinds_reload", "1");
}
void KeyBinder_Bind_Reset_All(entity btn, entity me)
{
localcmd("unbindall\n");
- localcmd("exec binds-default.cfg\n");
+ localcmd("exec binds-xonotic.cfg\n");
localcmd("-zoom\n"); // to make sure we aren't in togglezoom'd state
cvar_set("_hud_showbinds_reload", "1");
}
{
KeyBinder_Bind_Change(NULL, me);
}
-void XonoticKeyBinder_setSelected(entity me, float i)
+void XonoticKeyBinder_setSelected(entity me, int i)
{
// handling of "unselectable" items
i = floor(0.5 + bound(0, i, me.nItems - 1));
me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[i], 0, 1) != "$");
SUPER(XonoticKeyBinder).setSelected(me, i);
}
-float XonoticKeyBinder_keyDown(entity me, float key, float ascii, float shift)
+float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift)
{
- float r;
- r = 1;
+ bool r = true;
switch(key)
{
case K_ENTER:
}
return r;
}
-void XonoticKeyBinder_drawListBoxItem(entity me, float i, vector absSize, float isSelected)
+void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isSelected)
{
string s;
- float j, k, n;
+ int j, n;
+ float k;
vector theColor;
float theAlpha;
string func, descr;
}
theAlpha = SKINALPHA_KEYGRABBER_KEYS;
theColor = SKINCOLOR_KEYGRABBER_KEYS;
- extraMargin = me.realFontSize_x * 0.5;
+ extraMargin = me.realFontSize.x * 0.5;
}
if(substring(descr, 0, 1) == "$")