]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into Mario/csqc_muzzleflash
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index ff5488a79954dc87aba1e507953f58dfdc3ee735..10d5bd183c5432b96ae64dcca0d2a5d1b8d607b8 100644 (file)
 WepSet _WepSet_FromWeapon(int a)
 {
        a -= WEP_FIRST;
 WepSet _WepSet_FromWeapon(int a)
 {
        a -= WEP_FIRST;
-       if (Weapons_MAX > 24)
+       if (REGISTRY_MAX(Weapons) > 24)
                if (a >= 24)
                {
                        a -= 24;
                if (a >= 24)
                {
                        a -= 24;
-                       if (Weapons_MAX > 48)
+                       if (REGISTRY_MAX(Weapons) > 48)
                                if (a >= 24)
                                {
                                        a -= 24;
                                if (a >= 24)
                                {
                                        a -= 24;
@@ -76,8 +76,8 @@ WepSet _WepSet_FromWeapon(int a)
 #ifdef SVQC
        void WriteWepSet(float dst, WepSet w)
        {
 #ifdef SVQC
        void WriteWepSet(float dst, WepSet w)
        {
-               if (Weapons_MAX > 48) WriteInt72_t(dst, w);
-               else if (Weapons_MAX > 24) WriteInt48_t(dst, w);
+               if (REGISTRY_MAX(Weapons) > 48) WriteInt72_t(dst, w);
+               else if (REGISTRY_MAX(Weapons) > 24) WriteInt48_t(dst, w);
                else WriteInt24_t(dst, w.x);
        }
 #endif
                else WriteInt24_t(dst, w.x);
        }
 #endif
@@ -92,8 +92,8 @@ WepSet _WepSet_FromWeapon(int a)
        }
        WepSet ReadWepSet()
        {
        }
        WepSet ReadWepSet()
        {
-               if (Weapons_MAX > 48) return ReadInt72_t();
-               if (Weapons_MAX > 24) return ReadInt48_t();
+               if (REGISTRY_MAX(Weapons) > 48) return ReadInt72_t();
+               if (REGISTRY_MAX(Weapons) > 24) return ReadInt48_t();
                return ReadInt24_t() * '1 0 0';
        }
 #endif
                return ReadInt24_t() * '1 0 0';
        }
 #endif
@@ -107,7 +107,7 @@ string W_NameWeaponOrder_MapFunc(string s)
        int i = stof(s);
        if (s == "0" || i)
        {
        int i = stof(s);
        if (s == "0" || i)
        {
-               entity wi = Weapons_from(i);
+               entity wi = REGISTRY_GET(Weapons, i);
                if (wi != WEP_Null) return wi.netname;
        }
        return s;
                if (wi != WEP_Null) return wi.netname;
        }
        return s;
@@ -144,7 +144,7 @@ string W_NumberWeaponOrder(string order)
        return mapPriorityList(order, W_NumberWeaponOrder_MapFunc);
 }
 
        return mapPriorityList(order, W_NumberWeaponOrder_MapFunc);
 }
 
-float W_FixWeaponOrder_BuildImpulseList_buf[Weapons_MAX];
+float W_FixWeaponOrder_BuildImpulseList_buf[REGISTRY_MAX(Weapons)];
 string W_FixWeaponOrder_BuildImpulseList_order;
 void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
 {
 string W_FixWeaponOrder_BuildImpulseList_order;
 void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
 {
@@ -156,9 +156,9 @@ void W_FixWeaponOrder_BuildImpulseList_swap(int i, int j, entity pass)
 float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
 {
        int si = W_FixWeaponOrder_BuildImpulseList_buf[i];
 float W_FixWeaponOrder_BuildImpulseList_cmp(int i, int j, entity pass)
 {
        int si = W_FixWeaponOrder_BuildImpulseList_buf[i];
-       Weapon e1 = Weapons_from(si);
+       Weapon e1 = REGISTRY_GET(Weapons, si);
        int sj = W_FixWeaponOrder_BuildImpulseList_buf[j];
        int sj = W_FixWeaponOrder_BuildImpulseList_buf[j];
-       Weapon e2 = Weapons_from(sj);
+       Weapon e2 = REGISTRY_GET(Weapons, sj);
        int d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
        if (d != 0) return -d;  // high impulse first!
        return strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
        int d = (e1.impulse + 9) % 10 - (e2.impulse + 9) % 10;
        if (d != 0) return -d;  // high impulse first!
        return strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
@@ -577,10 +577,10 @@ NET_HANDLE(wframe, bool isNew)
                vector a = '0 0 0';
                switch(fr)
                {
                vector a = '0 0 0';
                switch(fr)
                {
+                       default:
                        case WFRAME_IDLE: a = wepent.anim_idle; break;
                        case WFRAME_FIRE1: a = wepent.anim_fire1; break;
                        case WFRAME_FIRE2: a = wepent.anim_fire2; break;
                        case WFRAME_IDLE: a = wepent.anim_idle; break;
                        case WFRAME_FIRE1: a = wepent.anim_fire1; break;
                        case WFRAME_FIRE2: a = wepent.anim_fire2; break;
-                       default:
                        case WFRAME_RELOAD: a = wepent.anim_reload; break;
                }
                a.z *= t;
                        case WFRAME_RELOAD: a = wepent.anim_reload; break;
                }
                a.z *= t;
@@ -660,13 +660,11 @@ CLIENT_COMMAND(weapon_find, "Show spawn locations of a weapon")
                        });
                }
                default:
                        });
                }
                default:
-               {
-                       LOG_INFOF("Incorrect parameters for ^2%s^7", "weapon_find");
-               }
+                       LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
                case CMD_REQUEST_USAGE:
                {
-                       LOG_INFO("Usage:^3 cl_cmd weapon_find weapon");
-                       LOG_INFO("  Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.");
+                       LOG_HELP("Usage:^3 cl_cmd weapon_find weapon");
+                       LOG_HELP("  Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.");
                        return;
                }
        }
                        return;
                }
        }