#define WEAPONS_ALL_C
#if defined(CSQC)
- #include <client/defs.qh>
- #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 <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/csqcprojectile.qh>
- #include <server/weapons/tracing.qh>
- #include <server/items/spawning.qh>
- #include <server/autocvars.qh>
- #include <server/constants.qh>
- #include <server/defs.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/g_hook.qh>
-#endif
-#ifdef GAMEQC
- #include "calculations.qc"
-#endif
-#ifdef SVQC
- #include "config.qc"
+ #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/server.qh>
+ #include <lib/warpzone/util_server.qh>
+ #include <server/command/_mod.qh>
+ #include <server/hook.qh>
+ #include <server/items/spawning.qh>
+ #include <server/mutators/_mod.qh>
+ #include <server/portals.qh>
+ #include <server/weapons/common.qh>
+ #include <server/weapons/csqcprojectile.qh>
+ #include <server/weapons/tracing.qh>
#endif
-#include "weapon/_mod.inc"
-
// WEAPON PLUGIN SYSTEM
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)
return s;
}
-string W_UndeprecateName(string s)
-{
- switch (s)
- {
- case "nex": return "vortex";
- case "rocketlauncher": return "devastator";
- case "laser": return "blaster";
- case "minstanex": return "vaporizer";
- case "grenadelauncher": return "mortar";
- case "uzi": return "machinegun";
- case "hmg": return "okhmg";
- case "rpc": return "okrpc";
- default: return s;
- }
-}
string W_NameWeaponOrder(string order)
{
return mapPriorityList(order, W_NameWeaponOrder_MapFunc);
string W_NumberWeaponOrder_MapFunc(string s)
{
if (s == "0" || stof(s)) return s;
- s = W_UndeprecateName(s);
- FOREACH(Weapons, it != WEP_Null && it.netname == s, return ftos(i));
+ FOREACH(Weapons, it != WEP_Null && (it.netname == s || it.m_deprecated_netname == s), return ftos(i));
return s;
}
string W_NumberWeaponOrder(string order)
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, " "),
- sprintf(" %d ", si), 0)
- -
- strstrofs(strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " "),
- sprintf(" %d ", sj), 0)
- ; // low char index first!
+ string s = strcat(" ", W_FixWeaponOrder_BuildImpulseList_order, " ");
+ return strstrofs(s, sprintf(" %d ", si), 0)
+ - strstrofs(s, sprintf(" %d ", sj), 0); // low char index first!
}
string W_FixWeaponOrder_BuildImpulseList(string o)
{
return result;
}
-string GetAmmoPicture(int ammotype)
+// TODO: registry handles for below functions
+string GetAmmoPicture(Resource ammotype)
{
switch (ammotype)
{
}
}
-string GetAmmoName(int ammotype)
+string GetAmmoName(Resource ammotype)
{
switch (ammotype)
{
}
}
+entity GetAmmoItem(Resource 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.m_id);
+ return NULL;
+ // WEAPONTODO: use this generic func to reduce duplication ?
+ // GetAmmoPicture GetAmmoName notif_arg_item_wepammo ammo_pickupevalfunc ?
+}
+
#ifdef CSQC
-int GetAmmoTypeFromNum(int i)
+Resource GetAmmoTypeFromNum(int i)
{
switch (i)
{
}
}
-int GetAmmoStat(int ammotype)
+int GetAmmoStat(Resource ammotype)
{
switch (ammotype)
{
* this.origin, this.angles
* this.weaponchild
* this.movedir, this.view_ofs, this.movedir_aligned
+ * this.spawnorigin (SVQC only)
* attachment stuff
* anim stuff
* to free:
if (this.weaponchild) delete(this.weaponchild);
this.weaponchild = NULL;
this.movedir = '0 0 0';
+#ifdef SVQC
this.spawnorigin = '0 0 0';
+#endif
this.oldorigin = '0 0 0';
this.anim_fire1 = '0 1 0.01';
this.anim_fire2 = '0 1 0.01';
this.movedir = '0 0 0';
}
}
+#ifdef SVQC
{
int idx = 0;
// v_ model attached to invisible h_ model
if (this.weaponchild
- && ((idx = gettagindex(this.weaponchild, "shell")) || (idx = gettagindex(this.weaponchild, "tag_shell"))))
+ && ((idx = gettagindex(this.weaponchild, "shell")) || (idx = gettagindex(this.weaponchild, "tag_shell"))))
{
this.spawnorigin = gettaginfo(this.weaponchild, idx);
}
this.spawnorigin = this.movedir;
}
}
+#endif
if (v_shot_idx)
{
this.oldorigin = '0 0 0'; // use regular attachment
vector v = this.movedir;
this.movedir = shotorg_adjust(v, false, false, algn);
this.movedir_aligned = shotorg_adjust(v, false, true, algn);
- this.view_ofs = shotorg_adjust(v, false, true, algn) - v;
+ this.view_ofs = this.movedir_aligned - v;
}
int compressed_shotorg = compressShotOrigin(this.movedir);
// make them match perfectly
#ifdef SVQC
- // null during init
- if (this.owner) STAT(SHOTORG, this.owner) = compressed_shotorg;
- this.movedir = decompressShotOrigin(compressed_shotorg);
-#else
- this.movedir = decompressShotOrigin(compressed_shotorg);
+ // null during init
+ if (this.owner) STAT(SHOTORG, this.owner) = compressed_shotorg;
#endif
+ this.movedir = decompressShotOrigin(compressed_shotorg);
+#ifdef SVQC
this.spawnorigin += this.view_ofs; // offset the casings origin by the same amount
+#endif
// check if an instant weapon switch occurred
setorigin(this, this.view_ofs);
#ifdef CSQC
NET_HANDLE(wframe, bool isNew)
{
- int fr = ReadByte();
+ WFRAME fr = ReadByte();
float t = ReadFloat();
- int slot = ReadByte();
+ int slot = ReadByte();
bool restartanim = ReadByte();
entity wepent = viewmodels[slot];
if(fr == WFRAME_IDLE)
case WS_DROP:
wepent.weapon_switchdelay = wepent.activeweapon.switchdelay_drop;
break;
- default:
- wepent.weapon_switchdelay = 0;
- break;
+ default:
+ wepent.weapon_switchdelay = 0;
+ break;
}
return true;
}
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;
}
}
{
return = true;
int weapon_id = ReadByte();
- int slot = ReadByte();
- vector sv_shotorg = ReadVector();
+ int slot = ReadByte();
+ vector sv_shotorg = ReadVector();
Weapon thiswep = REGISTRY_GET(Weapons, weapon_id);
- vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
+ vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
vector forward, right, up;
MAKE_VECTORS(viewangles, forward, right, up);
pointparticles(thiswep.m_muzzleeffect, sv_shotorg, forward * 1000, 1);
return;
}
- if(!autocvar_r_drawviewmodel) return;
+ if(!autocvar_r_drawviewmodel) return;
entity wepent = viewmodels[slot];
// get the local player entity to calculate shot origin
#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