]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/weapons/all.qc
Merge branch 'bones_was_here/stepup_distance' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / all.qc
index 5de760d4854fd81422e9112c571723005e896aa5..6bf2d105f8d85c4c82299c9a216f3e20cd818062 100644 (file)
@@ -3,54 +3,50 @@
 #define WEAPONS_ALL_C
 
 #if defined(CSQC)
-       #include "../constants.qh"
-       #include "../stats.qh"
-       #include <lib/warpzone/anglestransform.qh>
-       #include <lib/warpzone/common.qh>
-       #include <lib/warpzone/client.qh>
-       #include "../util.qh"
-       #include <client/autocvars.qh>
-       #include "../deathtypes/all.qh"
-       #include <lib/csqcmodel/interpolate.qh>
-       #include "../physics/movetypes/movetypes.qh"
        #include <client/main.qh>
+       #include <common/constants.qh>
+       #include <common/deathtypes/all.qh>
+       #include <common/physics/movetypes/movetypes.qh>
+       #include <common/stats.qh>
+       #include <common/util.qh>
+       #include <common/weapons/calculations.qc>
+       #include <common/weapons/weapon/_mod.inc>
        #include <lib/csqcmodel/cl_model.qh>
+       #include <lib/csqcmodel/interpolate.qh>
+       #include <lib/warpzone/anglestransform.qh>
+       #include <lib/warpzone/client.qh>
+       #include <lib/warpzone/common.qh>
 #elif defined(MENUQC)
+       #include <common/weapons/weapon/_mod.inc>
 #elif defined(SVQC)
+       #include <common/constants.qh>
+       #include <common/deathtypes/all.qh>
        #include <common/items/_mod.qh>
+       #include <common/mapinfo.qh>
+       #include <common/monsters/_mod.qh>
+       #include <common/notifications/all.qh>
+       #include <common/stats.qh>
+       #include <common/teams.qh>
+       #include <common/util.qh>
+       #include <common/weapons/calculations.qc>
+       #include <common/weapons/config.qc>
+       #include <common/weapons/config.qh>
+       #include <common/weapons/weapon/_mod.inc>
+       #include <lib/csqcmodel/sv_model.qh>
        #include <lib/warpzone/anglestransform.qh>
        #include <lib/warpzone/common.qh>
-       #include <lib/warpzone/util_server.qh>
        #include <lib/warpzone/server.qh>
-       #include "../constants.qh"
-       #include "../stats.qh"
-       #include "../teams.qh"
-       #include <common/util.qh>
-       #include "../monsters/_mod.qh"
-       #include "config.qh"
-       #include <server/weapons/common.qh>
-       #include <server/weapons/csqcprojectile.qh>
-       #include <server/weapons/tracing.qh>
+       #include <lib/warpzone/util_server.qh>
+       #include <server/command/_mod.qh>
+       #include <server/hook.qh>
        #include <server/items/spawning.qh>
-       #include <server/autocvars.qh>
-       #include "../notifications/all.qh"
-       #include "../deathtypes/all.qh"
        #include <server/mutators/_mod.qh>
-       #include "../mapinfo.qh"
-       #include <server/command/_mod.qh>
-       #include <lib/csqcmodel/sv_model.qh>
        #include <server/portals.qh>
-#include <server/hook.qh>
-#endif
-#ifdef GAMEQC
-       #include "calculations.qc"
-#endif
-#ifdef SVQC
-       #include "config.qc"
+       #include <server/weapons/common.qh>
+       #include <server/weapons/csqcprojectile.qh>
+       #include <server/weapons/tracing.qh>
 #endif
 
-#include "weapon/_mod.inc"
-
 
 // WEAPON PLUGIN SYSTEM
 
@@ -65,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)
@@ -206,7 +202,8 @@ WepSet W_RandomWeapons(entity e, WepSet remaining, int n)
        return result;
 }
 
-string GetAmmoPicture(int ammotype)
+// TODO: registry handles for below functions
+string GetAmmoPicture(Resource ammotype)
 {
        switch (ammotype)
        {
@@ -220,7 +217,7 @@ string GetAmmoPicture(int ammotype)
        }
 }
 
-string GetAmmoName(int ammotype)
+string GetAmmoName(Resource ammotype)
 {
        switch (ammotype)
        {
@@ -234,7 +231,7 @@ string GetAmmoName(int ammotype)
        }
 }
 
-entity GetAmmoItem(int ammotype)
+entity GetAmmoItem(Resource ammotype)
 {
        switch (ammotype)
        {
@@ -245,31 +242,14 @@ entity GetAmmoItem(int ammotype)
                case RES_PLASMA:  return ITEM_Plasma;
                case RES_FUEL:    return ITEM_JetpackFuel;
        }
-       LOG_WARNF("Invalid ammo type %d ", ammotype);
+       LOG_WARNF("Invalid ammo type %d ", ammotype.m_id);
        return NULL;
        // WEAPONTODO: use this generic func to reduce duplication ?
        // GetAmmoPicture  GetAmmoName  notif_arg_item_wepammo  ammo_pickupevalfunc ?
 }
 
-#ifdef SVQC
-int GetAmmoConsumptionPrimary(string netname)
-// Returns ammo consumed per shot by the primary/default fire mode
-// Returns 0 if the netname has no ammo cvar
-{
-       switch (netname)
-       {
-               case "arc":        return autocvar_g_balance_arc_beam_ammo;
-               case "devastator": return autocvar_g_balance_devastator_ammo;
-               case "machinegun": return autocvar_g_balance_machinegun_sustained_ammo;
-               case "minelayer":  return autocvar_g_balance_minelayer_ammo;
-               case "seeker":     return autocvar_g_balance_seeker_tag_ammo;
-               default:           return cvar(strcat("g_balance_", netname, "_primary_ammo"));
-       }
-}
-#endif
-
 #ifdef CSQC
-int GetAmmoTypeFromNum(int i)
+Resource GetAmmoTypeFromNum(int i)
 {
        switch (i)
        {
@@ -283,7 +263,7 @@ int GetAmmoTypeFromNum(int i)
        }
 }
 
-int GetAmmoStat(int ammotype)
+int GetAmmoStat(Resource ammotype)
 {
        switch (ammotype)
        {
@@ -692,8 +672,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;
                }
        }
@@ -847,3 +827,35 @@ NET_HANDLE(w_muzzleflash, bool isNew)
 #endif
 
 #endif
+
+#ifdef SVQC
+string W_FixWeaponOrder_ForceComplete_AndBuildImpulseList(entity this, string wo)
+{
+       string o = W_FixWeaponOrder_ForceComplete(wo);
+       strcpy(CS_CVAR(this).weaponorder_byimpulse, W_FixWeaponOrder_BuildImpulseList(o));
+       return o;
+}
+#endif
+
+#ifdef CSQC
+REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
+REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
+#endif
+
+#ifdef GAMEQC
+REPLICATE(cvar_cl_gunalign, int, "cl_gunalign");
+REPLICATE(cvar_cl_weapon_switch_reload, bool, "cl_weapon_switch_reload");
+REPLICATE(cvar_cl_weapon_switch_fallback_to_impulse, bool, "cl_weapon_switch_fallback_to_impulse");
+REPLICATE(cvar_cl_weaponimpulsemode, int, "cl_weaponimpulsemode");
+REPLICATE(cvar_cl_weaponpriority, string, "cl_weaponpriority", W_FixWeaponOrder_ForceComplete_AndBuildImpulseList);
+REPLICATE(cvar_cl_weaponpriorities[0], string, "cl_weaponpriority0", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[1], string, "cl_weaponpriority1", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[2], string, "cl_weaponpriority2", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[3], string, "cl_weaponpriority3", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[4], string, "cl_weaponpriority4", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[5], string, "cl_weaponpriority5", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[6], string, "cl_weaponpriority6", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[7], string, "cl_weaponpriority7", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[8], string, "cl_weaponpriority8", W_FixWeaponOrder_AllowIncomplete);
+REPLICATE(cvar_cl_weaponpriorities[9], string, "cl_weaponpriority9", W_FixWeaponOrder_AllowIncomplete);
+#endif