From 84257f628f8813521fa48917babd7fc121616180 Mon Sep 17 00:00:00 2001 From: terencehill Date: Mon, 4 Feb 2019 18:13:44 +0100 Subject: [PATCH] Shorten a few names --- qcsrc/common/ent_cs.qc | 4 +- qcsrc/lib/net.qh | 4 +- qcsrc/lib/stats.qh | 2 +- qcsrc/menu/xonotic/keybinder.qc | 73 +++++++++++++++------------------ 4 files changed, 37 insertions(+), 46 deletions(-) diff --git a/qcsrc/common/ent_cs.qc b/qcsrc/common/ent_cs.qc index 0a972277e..c32b45339 100644 --- a/qcsrc/common/ent_cs.qc +++ b/qcsrc/common/ent_cs.qc @@ -10,12 +10,12 @@ REGISTRY(EntCSProps, BITS(16) - 1) REGISTER_REGISTRY(EntCSProps) REGISTRY_SORT(EntCSProps) REGISTRY_CHECK(EntCSProps) -STATIC_INIT(RegisterEntCSProps_renumber) { FOREACH(EntCSProps, true, it.m_id = i); } +STATIC_INIT(EntCSProps_renumber) { FOREACH(EntCSProps, true, it.m_id = i); } // these entcs_props ids need to be referenced directly int ENTCS_PROP_ENTNUM_id = 0; int ENTCS_PROP_ORIGIN_id = 0; -STATIC_INIT(RegisterEntCSProps_setglobalids) +STATIC_INIT(EntCSProps_setglobalids) { FOREACH(EntCSProps, true, { if (it.registered_id == "ENTCS_PROP_ENTNUM") diff --git a/qcsrc/lib/net.qh b/qcsrc/lib/net.qh index 7495fb135..2994ea164 100644 --- a/qcsrc/lib/net.qh +++ b/qcsrc/lib/net.qh @@ -44,7 +44,7 @@ REGISTRY(TempEntities, BITS(8) - 80) REGISTER_REGISTRY(TempEntities) REGISTRY_SORT(TempEntities) REGISTRY_CHECK(TempEntities) -STATIC_INIT(RegisterTempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + i); } +STATIC_INIT(TempEntities_renumber) { FOREACH(TempEntities, true, it.m_id = 80 + i); } @@ -76,7 +76,7 @@ REGISTRY(LinkedEntities, BITS(8) - 1) REGISTER_REGISTRY(LinkedEntities) REGISTRY_SORT(LinkedEntities) REGISTRY_CHECK(LinkedEntities) -STATIC_INIT(RegisterLinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1 + i); } +STATIC_INIT(LinkedEntities_renumber) { FOREACH(LinkedEntities, true, it.m_id = 1 + i); } diff --git a/qcsrc/lib/stats.qh b/qcsrc/lib/stats.qh index b11fedec9..b57f41af2 100644 --- a/qcsrc/lib/stats.qh +++ b/qcsrc/lib/stats.qh @@ -131,7 +131,7 @@ REGISTRY(Stats, 256 - STATS_ENGINE_RESERVE) REGISTER_REGISTRY(Stats) REGISTRY_SORT(Stats) REGISTRY_CHECK(Stats) -STATIC_INIT(RegisterStats_renumber) +STATIC_INIT(Stats_renumber) { FOREACH(Stats, true, { it.m_id = STATS_ENGINE_RESERVE + i; diff --git a/qcsrc/menu/xonotic/keybinder.qc b/qcsrc/menu/xonotic/keybinder.qc index 8c0468ea0..69734ef18 100644 --- a/qcsrc/menu/xonotic/keybinder.qc +++ b/qcsrc/menu/xonotic/keybinder.qc @@ -10,19 +10,19 @@ const string KEY_NOT_BOUND_CMD = "// not bound"; const int MAX_KEYS_PER_FUNCTION = 2; const int MAX_KEYBINDS = 256; -string Xonotic_KeyBinds_Functions[MAX_KEYBINDS]; -string Xonotic_KeyBinds_Descriptions[MAX_KEYBINDS]; -int Xonotic_KeyBinds_Count = -1; +string KeyBinds_Functions[MAX_KEYBINDS]; +string KeyBinds_Descriptions[MAX_KEYBINDS]; +int KeyBinds_Count = -1; -void Xonotic_KeyBinds_Read() +void KeyBinds_Read() { - Xonotic_KeyBinds_Count = 0; + KeyBinds_Count = 0; #define KEYBIND_DEF(func, desc) MACRO_BEGIN \ - if((Xonotic_KeyBinds_Count < MAX_KEYBINDS)) { \ - Xonotic_KeyBinds_Functions[Xonotic_KeyBinds_Count] = strzone(func); \ - Xonotic_KeyBinds_Descriptions[Xonotic_KeyBinds_Count] = strzone(desc); \ - ++Xonotic_KeyBinds_Count; \ + if((KeyBinds_Count < MAX_KEYBINDS)) { \ + KeyBinds_Functions[KeyBinds_Count] = strzone(func); \ + KeyBinds_Descriptions[KeyBinds_Count] = strzone(desc); \ + ++KeyBinds_Count; \ } \ MACRO_END @@ -59,7 +59,7 @@ void Xonotic_KeyBinds_Read() for(int imp = 1; imp <= 9; ++imp) { - string w_list = ""; + string w_list = ""; ADD_TO_W_LIST(!(it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_HIDDEN) && !(it.spawnflags & WEP_FLAG_SUPERWEAPON)); ADD_TO_W_LIST((it.spawnflags & WEP_FLAG_SUPERWEAPON) && !(it.spawnflags & WEP_FLAG_HIDDEN)); ADD_TO_W_LIST((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) && !(it.spawnflags & WEP_FLAG_HIDDEN)); @@ -157,10 +157,10 @@ void XonoticKeyBinder_configureXonoticKeyBinder(entity me) void XonoticKeyBinder_loadKeyBinds(entity me) { bool force_initial_selection = false; - if(Xonotic_KeyBinds_Count < 0) // me.handle not loaded yet? + if(KeyBinds_Count < 0) // me.handle not loaded yet? force_initial_selection = true; - Xonotic_KeyBinds_Read(); - me.nItems = Xonotic_KeyBinds_Count; + KeyBinds_Read(); + me.nItems = KeyBinds_Count; if(force_initial_selection) me.setSelected(me, 0); } @@ -184,9 +184,7 @@ void XonoticKeyBinder_resizeNotify(entity me, vector relOrigin, vector relSize, } void KeyBinder_Bind_Change(entity btn, entity me) { - string func; - - func = Xonotic_KeyBinds_Functions[me.selectedItem]; + string func = KeyBinds_Functions[me.selectedItem]; if(func == "") return; @@ -198,7 +196,6 @@ void XonoticKeyBinder_keyGrabbed(entity me, int key, bool ascii) { int n, j, nvalid; float k; - string func; me.keyGrabButton.forcePressed = 0; me.clearButton.disabled = 0; @@ -213,7 +210,7 @@ void XonoticKeyBinder_keyGrabbed(entity me, int key, bool ascii) return; } - func = Xonotic_KeyBinds_Functions[me.selectedItem]; + string func = KeyBinds_Functions[me.selectedItem]; if(func == "") return; @@ -242,28 +239,26 @@ void XonoticKeyBinder_keyGrabbed(entity me, int key, bool ascii) } void XonoticKeyBinder_destroy(entity me) { - if(Xonotic_KeyBinds_Count < 0) + if(KeyBinds_Count < 0) return; for(int i = 0; i < MAX_KEYBINDS; ++i) { - strfree(Xonotic_KeyBinds_Functions[i]); - strfree(Xonotic_KeyBinds_Descriptions[i]); + strfree(KeyBinds_Functions[i]); + strfree(KeyBinds_Descriptions[i]); } - Xonotic_KeyBinds_Count = 0; + KeyBinds_Count = 0; } void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandPress, string theCommandRelease) { - string func, descr; - if(!me.userbindEditDialog) return; - func = Xonotic_KeyBinds_Functions[me.selectedItem]; + string func = KeyBinds_Functions[me.selectedItem]; if(func == "") return; - descr = Xonotic_KeyBinds_Descriptions[me.selectedItem]; + string descr = KeyBinds_Descriptions[me.selectedItem]; if(substring(descr, 0, 1) != "$") return; descr = substring(descr, 1, strlen(descr) - 1); @@ -275,16 +270,14 @@ void XonoticKeyBinder_editUserbind(entity me, string theName, string theCommandP } void KeyBinder_Bind_Edit(entity btn, entity me) { - string func, descr; - if(!me.userbindEditDialog) return; - func = Xonotic_KeyBinds_Functions[me.selectedItem]; + string func = KeyBinds_Functions[me.selectedItem]; if(func == "") return; - descr = Xonotic_KeyBinds_Descriptions[me.selectedItem]; + string descr = KeyBinds_Descriptions[me.selectedItem]; if(substring(descr, 0, 1) != "$") return; descr = substring(descr, 1, strlen(descr) - 1); @@ -297,9 +290,8 @@ void KeyBinder_Bind_Edit(entity btn, entity me) void KeyBinder_Bind_Clear(entity btn, entity me) { float n, j, k; - string func; - func = Xonotic_KeyBinds_Functions[me.selectedItem]; + string func = KeyBinds_Functions[me.selectedItem]; if(func == "") return; @@ -334,23 +326,23 @@ void XonoticKeyBinder_setSelected(entity me, int i) { if(i > me.previouslySelected) { - while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == "")) + while((i < me.nItems - 1) && (KeyBinds_Functions[i] == "")) ++i; } - while((i > 0) && (Xonotic_KeyBinds_Functions[i] == "")) + while((i > 0) && (KeyBinds_Functions[i] == "")) --i; - while((i < me.nItems - 1) && (Xonotic_KeyBinds_Functions[i] == "")) + while((i < me.nItems - 1) && (KeyBinds_Functions[i] == "")) ++i; } if(me.pressed == 3) // released the mouse - fall back to last valid item { - if(Xonotic_KeyBinds_Functions[i] == "") + if(KeyBinds_Functions[i] == "") i = me.previouslySelected; } - if(Xonotic_KeyBinds_Functions[i] != "") + if(KeyBinds_Functions[i] != "") me.previouslySelected = i; if(me.userbindEditButton) - me.userbindEditButton.disabled = (substring(Xonotic_KeyBinds_Descriptions[i], 0, 1) != "$"); + me.userbindEditButton.disabled = (substring(KeyBinds_Descriptions[i], 0, 1) != "$"); SUPER(XonoticKeyBinder).setSelected(me, i); } float XonoticKeyBinder_keyDown(entity me, int key, bool ascii, float shift) @@ -381,11 +373,10 @@ void XonoticKeyBinder_drawListBoxItem(entity me, int i, vector absSize, bool isS float k; vector theColor; float theAlpha; - string func, descr; float extraMargin; - descr = Xonotic_KeyBinds_Descriptions[i]; - func = Xonotic_KeyBinds_Functions[i]; + string descr = KeyBinds_Descriptions[i]; + string func = KeyBinds_Functions[i]; if(func == "") { -- 2.39.2