#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 "../t_items.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/autocvars.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
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)
{
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);
}
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);
this.spawnorigin += this.view_ofs; // offset the casings origin by the same amount
#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;
}
REGISTER_NET_TEMP(w_muzzleflash)
#ifdef SVQC
-void W_MuzzleFlash(entity actor, .entity weaponentity, entity eff, entity muzzlemodel, vector shotorg, vector shotdir)
+void W_MuzzleFlash(Weapon thiswep, entity actor, .entity weaponentity, vector shotorg, vector shotdir)
{
// don't show an exterior muzzle effect for the off-hand
if(weaponslot(weaponentity) == 0)
{
- Send_Effect_Except(eff, shotorg, shotdir * 1000, 1, actor);
+ Send_Effect_Except(thiswep.m_muzzleeffect, shotorg, shotdir * 1000, 1, actor);
- if(muzzlemodel != MDL_Null)
+ if(thiswep.m_muzzlemodel != MDL_Null)
{
- W_MuzzleFlash_Model(actor.exteriorweaponentity, muzzlemodel);
+ W_MuzzleFlash_Model(actor.exteriorweaponentity, thiswep.m_muzzlemodel);
W_MuzzleFlash_Model_AttachToShotorg(actor, weaponentity, actor.exteriorweaponentity.muzzle_flash, '5 0 0');
}
}
int channel = MSG_ONE;
msg_entity = it;
WriteHeader(channel, w_muzzleflash);
+ WriteByte(channel, thiswep.m_id);
WriteByte(channel, weaponslot(weaponentity));
- (Effects_COUNT >= 255)
- ? WriteShort(channel, eff.m_id)
- : WriteByte(channel, eff.m_id);
- (Models_COUNT >= 255)
- ? WriteShort(channel, muzzlemodel.m_id)
- : WriteByte(channel, muzzlemodel.m_id);
WriteVector(channel, shotorg);
});
}
NET_HANDLE(w_muzzleflash, bool isNew)
{
return = true;
- int slot = ReadByte();
- int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte();
- int net_modelname = (Models_COUNT >= 255) ? ReadShort() : ReadByte();
- vector sv_shotorg = ReadVector();
+ int weapon_id = ReadByte();
+ int slot = ReadByte();
+ vector sv_shotorg = ReadVector();
- entity eff = Effects_from(net_name);
- vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
+ Weapon thiswep = REGISTRY_GET(Weapons, weapon_id);
+ vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
vector forward, right, up;
MAKE_VECTORS(viewangles, forward, right, up);
{
// in third person mode, show the muzzle flash from the server side weapon position
// we don't have a view model to reference in this case
- pointparticles(eff, sv_shotorg, forward * 1000, 1);
+ pointparticles(thiswep.m_muzzleeffect, sv_shotorg, forward * 1000, 1);
return;
}
- if(!autocvar_r_drawviewmodel) return;
+ if(!autocvar_r_drawviewmodel) return;
- entity muzzlemodel = Models_from(net_modelname);
entity wepent = viewmodels[slot];
// get the local player entity to calculate shot origin
entity rlplayer = CSQCModel_server2csqc(player_localentnum - 1);
vector md = wepent.movedir_aligned;
vector vecs = ((md.x > 0) ? md : '0 0 0');
- vector dv = right * -vecs.y + up * vecs.z;
+ vector dv = forward * vecs.x + right * -vecs.y + up * vecs.z;
vector org = rlplayer.origin + rlplayer.view_ofs + dv;
- tracebox(org, '0 0 0', '0 0 0', org + forward * (vecs.x + 1), MOVE_NORMAL, rlplayer);
- org = trace_endpos - forward * 1;
- pointparticles(eff, org, forward * 1000, 1);
+ pointparticles(thiswep.m_muzzleeffect, org, forward * 1000, 1);
- if(muzzlemodel != MDL_Null)
+ if(thiswep.m_muzzlemodel != MDL_Null)
{
- W_MuzzleFlash_Model(wepent, muzzlemodel);
+ W_MuzzleFlash_Model(wepent, thiswep.m_muzzlemodel);
W_MuzzleFlash_Model_AttachToShotorg(wepent, wepent.muzzle_flash, '5 0 0');
}
}