X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fmenu%2Fxonotic%2Fkeybinder.qc;h=2d093a2ed5fe23078604a10fdfdbe5606d9a2966;hb=f34fd47ee0a7f283ab60592a17399ec5a500416c;hp=9ce18c6b0a97357bc97e28b7fcefdb897d605ed5;hpb=7f5ad47610dc8b5580cc96ae961a57cca96e6975;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 9ce18c6b0..2d093a2ed 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -1,42 +1,10 @@ -#ifndef KEYBINDER_H -#define KEYBINDER_H -#include "listbox.qc" -CLASS(XonoticKeyBinder, XonoticListBox) - METHOD(XonoticKeyBinder, configureXonoticKeyBinder, void(entity)); - ATTRIB(XonoticKeyBinder, rowsPerItem, int, 1) - METHOD(XonoticKeyBinder, drawListBoxItem, void(entity, int, vector, bool, bool)); - METHOD(XonoticKeyBinder, doubleClickListBoxItem, void(entity, float, vector)); - METHOD(XonoticKeyBinder, resizeNotify, void(entity, vector, vector, vector, vector)); - METHOD(XonoticKeyBinder, showNotify, void(entity)); - METHOD(XonoticKeyBinder, setSelected, void(entity, float)); - METHOD(XonoticKeyBinder, keyDown, float(entity, float, float, float)); - METHOD(XonoticKeyBinder, keyGrabbed, void(entity, float, float)); - METHOD(XonoticKeyBinder, destroy, void(entity)); - - ATTRIB(XonoticKeyBinder, realFontSize, vector, '0 0 0') - ATTRIB(XonoticKeyBinder, realUpperMargin, float, 0) - ATTRIB(XonoticKeyBinder, columnFunctionOrigin, float, 0) - ATTRIB(XonoticKeyBinder, columnFunctionSize, float, 0) - ATTRIB(XonoticKeyBinder, columnKeysOrigin, float, 0) - ATTRIB(XonoticKeyBinder, columnKeysSize, float, 0) - - METHOD(XonoticKeyBinder, loadKeyBinds, void(entity)); - ATTRIB(XonoticKeyBinder, previouslySelected, int, -1) - ATTRIB(XonoticKeyBinder, inMouseHandler, float, 0) - ATTRIB(XonoticKeyBinder, userbindEditButton, entity, NULL) - ATTRIB(XonoticKeyBinder, keyGrabButton, entity, NULL) - ATTRIB(XonoticKeyBinder, clearButton, entity, NULL) - ATTRIB(XonoticKeyBinder, userbindEditDialog, entity, NULL) - METHOD(XonoticKeyBinder, editUserbind, void(entity, string, string, string)); -ENDCLASS(XonoticKeyBinder) -entity makeXonoticKeyBinder(); -void KeyBinder_Bind_Change(entity btn, entity me); -void KeyBinder_Bind_Clear(entity btn, entity me); -void KeyBinder_Bind_Edit(entity btn, entity me); -void KeyBinder_Bind_Reset_All(entity btn, entity me); -#endif - -#ifdef IMPLEMENTATION +#include "keybinder.qh" + +#include +.int flags; + +#include "button.qh" +#include "dialog_settings_input_userbind.qh" const string KEY_NOT_BOUND_CMD = "// not bound"; @@ -73,10 +41,10 @@ void Xonotic_KeyBinds_Read() KEYBIND_DEF("+fire2" , _("secondary fire")); KEYBIND_DEF("" , ""); KEYBIND_DEF("" , _("Weapon switching")); - KEYBIND_DEF("weapprev" , _("previous")); - KEYBIND_DEF("weapnext" , _("next")); - KEYBIND_DEF("weaplast" , _("previously used")); - KEYBIND_DEF("weapbest" , _("best")); + KEYBIND_DEF("weapprev" , CTX(_("WEAPON^previous"))); + KEYBIND_DEF("weapnext" , CTX(_("WEAPON^next"))); + KEYBIND_DEF("weaplast" , CTX(_("WEAPON^previously used"))); + KEYBIND_DEF("weapbest" , CTX(_("WEAPON^best"))); KEYBIND_DEF("reload" , _("reload")); int i; @@ -91,9 +59,9 @@ void Xonotic_KeyBinds_Read() for(int imp = 1; imp <= 9; ++imp) { string w_list = ""; - ADD_TO_W_LIST(!(it.flags & WEP_FLAG_MUTATORBLOCKED) && !(it.flags & WEP_FLAG_SUPERWEAPON)); - ADD_TO_W_LIST(it.flags & WEP_FLAG_SUPERWEAPON); - ADD_TO_W_LIST(it.flags & WEP_FLAG_MUTATORBLOCKED); + ADD_TO_W_LIST(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_TYPE_OTHER) && !(it.spawnflags & WEP_FLAG_HIDDEN) && !(it.spawnflags & WEP_FLAG_SUPERWEAPON)); + ADD_TO_W_LIST((it.spawnflags & WEP_FLAG_SUPERWEAPON) && !(it.spawnflags & WEP_TYPE_OTHER) && !(it.spawnflags & WEP_FLAG_HIDDEN)); + ADD_TO_W_LIST((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_TYPE_OTHER) && !(it.spawnflags & WEP_FLAG_HIDDEN)); if(w_list) KEYBIND_DEF(strcat("weapon_group_", itos(imp)), substring(w_list, 0, -4)); if(imp == 0) @@ -477,4 +445,3 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS draw_CenterText(me.realUpperMargin * eY + (me.columnKeysOrigin + 0.5 * me.columnKeysSize) * eX, s, me.realFontSize, theColor, theAlpha, 0); } } -#endif