actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
- W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, MDL_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
if (autocvar_g_casings >= 2) // casing code
{
/* modelname */ ATTRIB(OverkillHeavyMachineGun, mdl, string, "ok_hmg");
#ifdef GAMEQC
/* model */ ATTRIB(OverkillHeavyMachineGun, m_model, Model, MDL_HMG_ITEM);
+/* flash mdl */ ATTRIB(OverkillHeavyMachineGun, m_muzzlemodel, Model, MDL_MACHINEGUN_MUZZLEFLASH);
+/* flash eff */ ATTRIB(OverkillHeavyMachineGun, m_muzzleeffect, entity, EFFECT_MACHINEGUN_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(OverkillHeavyMachineGun, w_crosshair, string, "gfx/crosshairuzi");
/* crosshair */ ATTRIB(OverkillHeavyMachineGun, w_crosshair_size, float, 0.6);
actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
- W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, MDL_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
if(autocvar_g_casings >= 2) // casing code
{
/* modelname */ ATTRIB(OverkillMachineGun, mdl, string, "ok_mg");
#ifdef GAMEQC
/* model */ ATTRIB(OverkillMachineGun, m_model, Model, MDL_OK_MG_ITEM);
+/* flash mdl */ ATTRIB(OverkillMachineGun, m_muzzlemodel, Model, MDL_MACHINEGUN_MUZZLEFLASH);
+/* flash eff */ ATTRIB(OverkillMachineGun, m_muzzleeffect, entity, EFFECT_MACHINEGUN_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(OverkillMachineGun, w_crosshair, string, "gfx/crosshairuzi");
/* crosshair */ ATTRIB(OverkillMachineGun, w_crosshair_size, float, 0.6);
W_DecreaseAmmo(thiswep, actor, WEP_CVAR_PRI(okrpc, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(okrpc, damage), thiswep.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, MDL_RPC_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
PROJECTILE_MAKETRIGGER(missile);
missile.owner = missile.realowner = actor;
/* modelname */ ATTRIB(OverkillRocketPropelledChainsaw, mdl, string, "ok_rl");
#ifdef GAMEQC
/* model */ ATTRIB(OverkillRocketPropelledChainsaw, m_model, Model, MDL_RPC_ITEM);
+/* flash mdl */ ATTRIB(OverkillRocketPropelledChainsaw, m_muzzlemodel, Model, MDL_RPC_MUZZLEFLASH);
+/* flash eff */ ATTRIB(OverkillRocketPropelledChainsaw, m_muzzleeffect, entity, EFFECT_ROCKET_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(OverkillRocketPropelledChainsaw, w_crosshair, string, "gfx/crosshairrocketlauncher");
/* crosshair */ ATTRIB(OverkillRocketPropelledChainsaw, w_crosshair_size, float, 0.6);
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 weapon_id = ReadByte();
int slot = ReadByte();
- int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte();
- int net_modelname = (Models_COUNT >= 255) ? ReadShort() : ReadByte();
vector sv_shotorg = ReadVector();
- entity eff = Effects_from(net_name);
+ 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;
- 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);
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');
}
}
#include "calculations.qh"
#include "projectiles.qh"
#include <common/models/all.qh>
+#include <common/effects/all.qh>
#endif
#include <common/util.qh>
#endif
#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);
#endif
#endif
ATTRIB(Weapon, wpcolor, vector, '0 0 0');
/** M: modelname : name of model (without g_ v_ or h_ prefixes) */
ATTRIB(Weapon, mdl, string, "");
+#ifdef GAMEQC
/** M: model MDL_id_ITEM */
ATTRIB(Weapon, m_model, entity);
+ /** M: flash model MDL_id_MUZZLEFLASH */
+ ATTRIB(Weapon, m_muzzlemodel, entity, MDL_Null);
+ /** M: flash effect EFFECT_id_MUZZLEFLASH */
+ ATTRIB(Weapon, m_muzzleeffect, entity);
+#endif
/** M: crosshair : per-weapon crosshair: "CrosshairImage Size" */
ATTRIB(Weapon, w_crosshair, string, "gfx/crosshairmoustache");
/** A: crosshair : per-weapon crosshair size (argument two of "crosshair" field) */
W_SetupShot(actor, weaponentity, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), WEP_ARC.m_id | HITTYPE_SECONDARY);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ARC_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
missile = new(missile);
missile.owner = missile.realowner = actor;
/* modelname */ ATTRIB(Arc, mdl, string, "arc");
#ifdef GAMEQC
/* model */ ATTRIB(Arc, m_model, Model, MDL_ARC_ITEM);
+/* flash mdl */ ATTRIB(Arc, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Arc, m_muzzleeffect, entity, EFFECT_ARC_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Arc, w_crosshair, string, "gfx/crosshairhlac");
/* crosshair */ ATTRIB(Arc, w_crosshair_size, float, 0.7);
vector s_forward = v_forward * cos(atk_shotangle * DEG2RAD) + v_up * sin(atk_shotangle * DEG2RAD);
W_SetupShot_Dir(actor, weaponentity, s_forward, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_B, atk_damage, atk_deathtype);
- W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(WEP_BLASTER, actor, weaponentity, w_shotorg, w_shotdir);
entity missile = new(blasterbolt);
missile.owner = missile.realowner = actor;
/* modelname */ ATTRIB(Blaster, mdl, string, "laser");
#ifdef GAMEQC
/* model */ ATTRIB(Blaster, m_model, Model, MDL_BLASTER_ITEM);
+/* flash mdl */ ATTRIB(Blaster, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Blaster, m_muzzleeffect, entity, EFFECT_BLASTER_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Blaster, w_crosshair, string, "gfx/crosshairlaser");
/* crosshair */ ATTRIB(Blaster, w_crosshair_size, float, 0.5);
up = v_up;
shots = WEP_CVAR_PRI(crylink, shots);
- W_MuzzleFlash(actor, weaponentity, EFFECT_CRYLINK_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
proj = prevproj = firstproj = NULL;
for(counter = 0; counter < shots; ++counter)
{
up = v_up;
shots = WEP_CVAR_SEC(crylink, shots);
- W_MuzzleFlash(actor, weaponentity, EFFECT_CRYLINK_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
proj = prevproj = firstproj = NULL;
for(counter = 0; counter < shots; ++counter)
{
/* modelname */ ATTRIB(Crylink, mdl, string, "crylink");
#ifdef GAMEQC
/* model */ ATTRIB(Crylink, m_model, Model, MDL_CRYLINK_ITEM);
+/* flash mdl */ ATTRIB(Crylink, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Crylink, m_muzzleeffect, entity, EFFECT_CRYLINK_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Crylink, w_crosshair, string, "gfx/crosshaircrylink");
/* crosshair */ ATTRIB(Crylink, w_crosshair_size, float, 0.5);
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(devastator, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 5, SND_ROCKET_FIRE, CH_WEAPON_A, WEP_CVAR(devastator, damage), thiswep.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, MDL_DEVASTATOR_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
missile.weaponentity_fld = weaponentity;
/* modelname */ ATTRIB(Devastator, mdl, string, "rl");
#ifdef GAMEQC
/* model */ ATTRIB(Devastator, m_model, Model, MDL_DEVASTATOR_ITEM);
+/* flash mdl */ ATTRIB(Devastator, m_muzzlemodel, Model, MDL_DEVASTATOR_MUZZLEFLASH);
+/* flash eff */ ATTRIB(Devastator, m_muzzleeffect, entity, EFFECT_ROCKET_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Devastator, w_crosshair, string, "gfx/crosshairrocketlauncher");
/* crosshair */ ATTRIB(Devastator, w_crosshair_size, float, 0.7);
thiswep.m_id
);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
proj = new(electro_bolt);
proj.owner = proj.realowner = actor;
w_shotdir = v_forward; // no TrueAim for grenades please
- W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
entity proj = new(electro_orb);
proj.owner = proj.realowner = actor;
/* modelname */ ATTRIB(Electro, mdl, string, "electro");
#ifdef GAMEQC
/* model */ ATTRIB(Electro, m_model, Model, MDL_ELECTRO_ITEM);
+/* flash mdl */ ATTRIB(Electro, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Electro, m_muzzleeffect, entity, EFFECT_ELECTRO_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Electro, w_crosshair, string, "gfx/crosshairelectro");
/* crosshair */ ATTRIB(Electro, w_crosshair_size, float, 0.6);
{
W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 2, SND_FIREBALL_FIRE2, CH_WEAPON_A, WEP_CVAR_PRI(fireball, damage) + WEP_CVAR_PRI(fireball, bfgdamage), WEP_FIREBALL.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
entity proj = new(plasma_prim);
proj.owner = proj.realowner = actor;
{
W_SetupShot_ProjectileSize(actor, weaponentity, '-16 -16 -16', '16 16 16', false, 0, SND_Null, 0, 0, WEP_FIREBALL.m_id); // TODO: probably doesn't need deathtype, just a prefire effect
w_shotorg += f_diff.x * v_up + f_diff.y * v_right;
- W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_PRE_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
}
void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire)
traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, actor);
w_shotorg = trace_endpos;
- W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(WEP_FIREBALL, actor, weaponentity, w_shotorg, w_shotdir);
proj = new(grenade);
proj.owner = proj.realowner = actor;
/* modelname */ ATTRIB(Fireball, mdl, string, "fireball");
#ifdef GAMEQC
/* model */ ATTRIB(Fireball, m_model, Model, MDL_FIREBALL_ITEM);
+/* flash mdl */ ATTRIB(Fireball, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Fireball, m_muzzleeffect, entity, EFFECT_FIREBALL_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Fireball, w_crosshair, string, "gfx/crosshairfireball");
/* crosshair */ //ATTRIB(Fireball, w_crosshair_size, float, 0.65);
W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage), thiswep.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
missile = new(missile);
missile.owner = missile.realowner = actor;
W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage), thiswep.m_id | HITTYPE_SECONDARY);
- W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
missile = new(missile);
missile.owner = missile.realowner = actor;
shots = actor.(weaponentity).hagar_load;
W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage) * shots, thiswep.m_id | HITTYPE_SECONDARY);
- W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
forward = v_forward;
right = v_right;
/* modelname */ ATTRIB(Hagar, mdl, string, "hagar");
#ifdef GAMEQC
/* model */ ATTRIB(Hagar, m_model, Model, MDL_HAGAR_ITEM);
+/* flash mdl */ ATTRIB(Hagar, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Hagar, m_muzzleeffect, entity, EFFECT_HAGAR_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Hagar, w_crosshair, string, "gfx/crosshairhagar");
/* crosshair */ ATTRIB(Hagar, w_crosshair_size, float, 0.8);
spread = spread * WEP_CVAR_PRI(hlac, spread_crouchmod);
W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hlac, damage), thiswep.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
if(!autocvar_g_norecoil)
{
actor.punchangle_x = random() - 0.5;
spread = spread * WEP_CVAR_SEC(hlac, spread_crouchmod);
W_SetupShot(actor, weaponentity, false, 3, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hlac, damage), thiswep.m_id | HITTYPE_SECONDARY);
- W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
missile = new(hlacbolt);
missile.owner = missile.realowner = actor;
/* modelname */ ATTRIB(HLAC, mdl, string, "hlac");
#ifdef GAMEQC
/* model */ ATTRIB(HLAC, m_model, Model, MDL_HLAC_ITEM);
+/* flash mdl */ ATTRIB(HLAC, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(HLAC, m_muzzleeffect, entity, EFFECT_BLASTER_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(HLAC, w_crosshair, string, "gfx/crosshairhlac");
/* crosshair */ ATTRIB(HLAC, w_crosshair_size, float, 0.6);
/* modelname */ ATTRIB(Hook, mdl, string, "hookgun");
#ifdef GAMEQC
/* model */ ATTRIB(Hook, m_model, Model, MDL_HOOK_ITEM);
+/* flash mdl */ ATTRIB(Hook, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Hook, m_muzzleeffect, entity, EFFECT_HOOK_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Hook, w_crosshair, string, "gfx/crosshairhook");
/* crosshair */ ATTRIB(Hook, w_crosshair_size, float, 0.5);
else
fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, sustained_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), deathtype, EFFECT_BULLET);
- W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, MDL_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
// casing code
if(autocvar_g_casings >= 2)
actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
- W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, MDL_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
if(autocvar_g_casings >= 2) // casing code
{
fireBullet(actor, weaponentity, w_shotorg, w_shotdir, WEP_CVAR(machinegun, burst_spread), WEP_CVAR(machinegun, solidpenetration), WEP_CVAR(machinegun, sustained_damage), WEP_CVAR(machinegun, sustained_force), thiswep.m_id, EFFECT_BULLET);
- W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, MDL_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
if(autocvar_g_casings >= 2) // casing code
{
/* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
#ifdef GAMEQC
/* model */ ATTRIB(MachineGun, m_model, Model, MDL_MACHINEGUN_ITEM);
+/* flash mdl */ ATTRIB(MachineGun, m_muzzlemodel, Model, MDL_MACHINEGUN_MUZZLEFLASH);
+/* flash eff */ ATTRIB(MachineGun, m_muzzleeffect, entity, EFFECT_MACHINEGUN_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(MachineGun, w_crosshair, string, "gfx/crosshairuzi");
/* crosshair */ ATTRIB(MachineGun, w_crosshair_size, float, 0.6);
W_DecreaseAmmo(thiswep, actor, WEP_CVAR(minelayer, ammo), weaponentity);
W_SetupShot_ProjectileSize(actor, weaponentity, '-4 -4 -4', '4 4 4', false, 5, SND_MINE_FIRE, CH_WEAPON_A, WEP_CVAR(minelayer, damage), thiswep.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, MDL_MINELAYER_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
entity mine = WarpZone_RefSys_SpawnSameRefSys(actor);
mine.weaponentity_fld = weaponentity;
/* modelname */ ATTRIB(MineLayer, mdl, string, "minelayer");
#ifdef GAMEQC
/* model */ ATTRIB(MineLayer, m_model, Model, MDL_MINELAYER_ITEM);
+/* flash mdl */ ATTRIB(MineLayer, m_muzzlemodel, Model, MDL_MINELAYER_MUZZLEFLASH);
+/* flash eff */ ATTRIB(MineLayer, m_muzzleeffect, entity, EFFECT_ROCKET_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(MineLayer, w_crosshair, string, "gfx/crosshairminelayer");
/* crosshair */ ATTRIB(MineLayer, w_crosshair_size, float, 0.9);
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(mortar, damage), thiswep.m_id);
w_shotdir = v_forward; // no TrueAim for grenades please
- W_MuzzleFlash(actor, weaponentity, EFFECT_GRENADE_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
entity gren = new(grenade);
gren.owner = gren.realowner = actor;
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', false, 4, SND_GRENADE_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(mortar, damage), thiswep.m_id | HITTYPE_SECONDARY);
w_shotdir = v_forward; // no TrueAim for grenades please
- W_MuzzleFlash(actor, weaponentity, EFFECT_GRENADE_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
gren = new(grenade);
gren.owner = gren.realowner = actor;
/* modelname */ ATTRIB(Mortar, mdl, string, "gl");
#ifdef GAMEQC
/* model */ ATTRIB(Mortar, m_model, Model, MDL_MORTAR_ITEM);
+/* flash mdl */ ATTRIB(Mortar, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Mortar, m_muzzleeffect, entity, EFFECT_GRENADE_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Mortar, w_crosshair, string, "gfx/crosshairgrenadelauncher");
/* crosshair */ ATTRIB(Mortar, w_crosshair_size, float, 0.7);
W_SetupShot(actor, weaponentity, true, 2, pSound, CH_WEAPON_A, pDamage * pShots, deathtype);
- W_MuzzleFlash(actor, weaponentity, EFFECT_RIFLE_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir * 2);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir * 2);
if(PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) // if zoomed, shoot from the eye
{
/* modelname */ ATTRIB(Rifle, mdl, string, "campingrifle");
#ifdef GAMEQC
/* model */ ATTRIB(Rifle, m_model, Model, MDL_RIFLE_ITEM);
+/* flash mdl */ ATTRIB(Rifle, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Rifle, m_muzzleeffect, entity, EFFECT_RIFLE_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Rifle, w_crosshair, string, "gfx/crosshairrifle");
/* crosshair */ ATTRIB(Rifle, w_crosshair_size, float, 0.6);
makevectors(actor.v_angle);
W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_SEEKER_FIRE, CH_WEAPON_A, 0, ((m_target != NULL) ? thiswep.m_id | HITTYPE_SECONDARY : thiswep.m_id));
w_shotorg += f_diff;
- W_MuzzleFlash(actor, weaponentity, EFFECT_SEEKER_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
//actor.detornator = false;
W_SetupShot_ProjectileSize(actor, weaponentity, '-2 -2 -2', '2 2 2', false, 2, SND_FLAC_FIRE, CH_WEAPON_A, WEP_CVAR(seeker, flac_damage), thiswep.m_id | HITTYPE_SECONDARY);
w_shotorg += f_diff;
- W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ // uses hagar effects!
+ W_MuzzleFlash(WEP_HAGAR, actor, weaponentity, w_shotorg, w_shotdir);
missile = new(missile);
missile.owner = missile.realowner = actor;
/* modelname */ ATTRIB(Seeker, mdl, string, "seeker");
#ifdef GAMEQC
/* model */ ATTRIB(Seeker, m_model, Model, MDL_SEEKER_ITEM);
+/* flash mdl */ ATTRIB(Seeker, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Seeker, m_muzzleeffect, entity, EFFECT_SEEKER_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Seeker, w_crosshair, string, "gfx/crosshairseeker");
/* crosshair */ ATTRIB(Seeker, w_crosshair_size, float, 0.8);
if(lag && bullets > 0)
antilag_restore_all(actor);
- W_MuzzleFlash(actor, weaponentity, EFFECT_SHOTGUN_MUZZLEFLASH, MDL_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
// casing code
if(autocvar_g_casings >= 1)
/* modelname */ ATTRIB(Shotgun, mdl, string, "shotgun");
#ifdef GAMEQC
/* model */ ATTRIB(Shotgun, m_model, Model, MDL_SHOTGUN_ITEM);
+/* flash mdl */ ATTRIB(Shotgun, m_muzzlemodel, Model, MDL_SHOTGUN_MUZZLEFLASH);
+/* flash eff */ ATTRIB(Shotgun, m_muzzleeffect, entity, EFFECT_SHOTGUN_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Shotgun, w_crosshair, string, "gfx/crosshairshotgun");
/* crosshair */ ATTRIB(Shotgun, w_crosshair_size, float, 0.65);
FireRailgunBullet(actor, weaponentity, w_shotorg, w_shotorg + w_shotdir * max_shot_distance, vaporizer_damage, WEP_CVAR_PRI(vaporizer, force), 0, 0, 0, 0, thiswep.m_id);
// do this now, as goodhits is disabled below
- W_MuzzleFlash(actor, weaponentity, EFFECT_VORTEX_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, normalize(v - w_shotorg));
SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
if(yoda && flying)
W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_CRYLINK_FIRE, CH_WEAPON_A, autocvar_g_rm_laser_damage, WEP_ELECTRO.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ // uses electro effects
+ W_MuzzleFlash(WEP_ELECTRO, actor, weaponentity, w_shotorg, w_shotdir);
while(counter < total)
{
W_SetupShot_ProjectileSize (actor, weaponentity, '0 0 -3', '0 0 -3', false, 2, SND_ELECTRO_FIRE2, CH_WEAPON_A, autocvar_g_rm_laser_damage, WEP_ELECTRO.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ // uses electro effects
+ W_MuzzleFlash(WEP_ELECTRO, actor, weaponentity, w_shotorg, w_shotdir);
while(counter < total)
{
/* modelname */ ATTRIB(Vaporizer, mdl, string, "minstanex");
#ifdef GAMEQC
/* model */ ATTRIB(Vaporizer, m_model, Model, MDL_VAPORIZER_ITEM);
+/* flash mdl */ ATTRIB(Vaporizer, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Vaporizer, m_muzzleeffect, entity, EFFECT_VORTEX_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Vaporizer, w_crosshair, string, "gfx/crosshairminstanex");
/* crosshair */ ATTRIB(Vaporizer, w_crosshair_size, float, 0.6);
actor.vortex_lasthit = damage_goodhits;
- //beam and muzzle flash done on client
- W_MuzzleFlash(actor, weaponentity, EFFECT_VORTEX_MUZZLEFLASH, MDL_Null, w_shotorg, w_shotdir);
+ //beam done on client
+ vector v = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+ W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, normalize(v - w_shotorg));
SendCSQCVortexBeamParticle(charge);
W_DecreaseAmmo(thiswep, actor, myammo, weaponentity);
/* modelname */ ATTRIB(Vortex, mdl, string, "nex");
#ifdef GAMEQC
/* model */ ATTRIB(Vortex, m_model, Model, MDL_VORTEX_ITEM);
+/* flash mdl */ ATTRIB(Vortex, m_muzzlemodel, Model, MDL_Null);
+/* flash eff */ ATTRIB(Vortex, m_muzzleeffect, entity, EFFECT_VORTEX_MUZZLEFLASH);
#endif
/* crosshair */ ATTRIB(Vortex, w_crosshair, string, "gfx/crosshairnex");
/* crosshair */ ATTRIB(Vortex, w_crosshair_size, float, 0.65);
vector oldmovedir = actor.(weaponentity).movedir;
actor.(weaponentity).movedir = vs;
W_SetupShot_ProjectileSize(actor, weaponentity, '-3 -3 -3', '3 3 3', true, 0, SND_HOOK_FIRE, CH_WEAPON_B, 0, WEP_HOOK.m_id);
- W_MuzzleFlash(actor, weaponentity, EFFECT_HOOK_MUZZLEFLASH, MDL_Null, w_shotorg, '0 0 0');
+ W_MuzzleFlash(WEP_HOOK, actor, weaponentity, w_shotorg, '0 0 0');
actor.(weaponentity).movedir = oldmovedir;
entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);