]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'master' into z411/srestart
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index b0e3b58a0e407def36ec652e0c9dfb09ef5710c4..7ef3cc1e8d7a5ee18ff37591f899d635d8e0ee6d 100644 (file)
@@ -3,7 +3,6 @@
 #define WEAPONS_ALL_C
 
 #if defined(CSQC)
-       #include <client/autocvars.qh>
        #include <client/main.qh>
        #include <common/constants.qh>
        #include <common/deathtypes/all.qh>
@@ -38,7 +37,6 @@
        #include <lib/warpzone/common.qh>
        #include <lib/warpzone/server.qh>
        #include <lib/warpzone/util_server.qh>
-       #include <server/autocvars.qh>
        #include <server/command/_mod.qh>
        #include <server/hook.qh>
        #include <server/items/spawning.qh>
@@ -63,11 +61,11 @@ WepSet _WepSet_FromWeapon(int a)
                                if (a >= 24)
                                {
                                        a -= 24;
-                                       return '0 0 1' * (2 ** a);
+                                       return '0 0 1' * BIT(a);
                                }
-                       return '0 1 0' * (2 ** a);
+                       return '0 1 0' * BIT(a);
                }
-       return '1 0 0' * (2 ** a);
+       return '1 0 0' * BIT(a);
 }
 #ifdef SVQC
        void WriteWepSet(float dst, WepSet w)
@@ -232,6 +230,23 @@ string GetAmmoName(int ammotype)
        }
 }
 
+entity GetAmmoItem(int ammotype)
+{
+       switch (ammotype)
+       {
+               case RES_SHELLS:  return ITEM_Shells;
+               case RES_BULLETS: return ITEM_Bullets;
+               case RES_ROCKETS: return ITEM_Rockets;
+               case RES_CELLS:   return ITEM_Cells;
+               case RES_PLASMA:  return ITEM_Plasma;
+               case RES_FUEL:    return ITEM_JetpackFuel;
+       }
+       LOG_WARNF("Invalid ammo type %d ", ammotype);
+       return NULL;
+       // WEAPONTODO: use this generic func to reduce duplication ?
+       // GetAmmoPicture  GetAmmoName  notif_arg_item_wepammo  ammo_pickupevalfunc ?
+}
+
 #ifdef CSQC
 int GetAmmoTypeFromNum(int i)
 {
@@ -656,8 +671,8 @@ CLIENT_COMMAND(weapon_find, "Show spawn locations of a weapon")
                        LOG_INFOF("Incorrect parameters for ^2%s^7", argv(0));
                case CMD_REQUEST_USAGE:
                {
-                       LOG_HELP("Usage:^3 cl_cmd weapon_find weapon");
-                       LOG_HELP("  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;
                }
        }