]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Show the particle effect of the muzzle flash at the gun's actual muzzle position...
authorMario <mario.mario@y7mail.com>
Fri, 24 Jan 2020 20:13:57 +0000 (06:13 +1000)
committerMario <mario.mario@y7mail.com>
Fri, 24 Jan 2020 20:13:57 +0000 (06:13 +1000)
24 files changed:
qcsrc/common/effects/all.qc
qcsrc/common/effects/all.qh
qcsrc/common/mutators/mutator/overkill/okhmg.qc
qcsrc/common/mutators/mutator/overkill/okmachinegun.qc
qcsrc/common/mutators/mutator/overkill/okrpc.qc
qcsrc/common/weapons/all.qc
qcsrc/common/weapons/all.qh
qcsrc/common/weapons/weapon/arc.qc
qcsrc/common/weapons/weapon/blaster.qc
qcsrc/common/weapons/weapon/crylink.qc
qcsrc/common/weapons/weapon/devastator.qc
qcsrc/common/weapons/weapon/electro.qc
qcsrc/common/weapons/weapon/fireball.qc
qcsrc/common/weapons/weapon/hagar.qc
qcsrc/common/weapons/weapon/hlac.qc
qcsrc/common/weapons/weapon/machinegun.qc
qcsrc/common/weapons/weapon/minelayer.qc
qcsrc/common/weapons/weapon/mortar.qc
qcsrc/common/weapons/weapon/rifle.qc
qcsrc/common/weapons/weapon/seeker.qc
qcsrc/common/weapons/weapon/shotgun.qc
qcsrc/common/weapons/weapon/vaporizer.qc
qcsrc/common/weapons/weapon/vortex.qc
qcsrc/server/g_hook.qc

index 9732be2e3bf65e82f125b176f8ed2f709d2879d6..7ea49bdcb825e666a04c19cc23c7ca7cfb3091ce 100644 (file)
@@ -51,7 +51,7 @@ bool Net_Write_Effect(entity this, entity client, int sf)
        return true;
 }
 
-void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
+void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, entity ignore)
 {
        if(!eff) { return; }
        if(!eff.eent_eff_trail && !eff_cnt) { return; } // effect has no count!
@@ -64,10 +64,15 @@ void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
        net_eff.eent_net_count = eff_cnt;
        net_eff.eent_eff_trail = eff.eent_eff_trail;
 
-       FOREACH_CLIENT(IS_REAL_CLIENT(it), Net_Write_Effect(net_eff, it, 0));
+       FOREACH_CLIENT(IS_REAL_CLIENT(it) && it != ignore && !(IS_SPEC(it) && it.enemy == ignore), Net_Write_Effect(net_eff, it, 0));
        delete(net_eff);
 }
 
+void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt)
+{
+       Send_Effect_Except(eff, eff_loc, eff_vel, eff_cnt, NULL);
+}
+
 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt)
 {
        // problem with this is, we might not have all the available effects for it
index 7581618375bd5bfc0b949b0b023435db4bebdd8e..da5ab498b8059160def04481e0710fc90d96156b 100644 (file)
@@ -3,6 +3,7 @@
 #include "effect.qh"
 
 #ifdef SVQC
+void Send_Effect_Except(entity eff, vector eff_loc, vector eff_vel, int eff_cnt, entity ignore);
 void Send_Effect(entity eff, vector eff_loc, vector eff_vel, int eff_cnt);
 void Send_Effect_(string eff_name, vector eff_loc, vector eff_vel, int eff_cnt);
 #endif
index a0a8962a7d02d899ca54f2ee2a483c08158a28b8..d17a475b074cde45f616e793b0fc2dc93b78b0e4 100644 (file)
@@ -40,7 +40,7 @@ void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity
 
        actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
 
-       Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        W_MachineGun_MuzzleFlash(actor, weaponentity);
        W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
index 17e71f06f8ea9b154f1b0da0881022601942b277..5b657d1e5bec02ad1fe69474d5b83281f1e8a415 100644 (file)
@@ -34,7 +34,7 @@ void W_OverkillMachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weap
 
        actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
 
-       Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        W_MachineGun_MuzzleFlash(actor, weaponentity);
        W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
index 362f14846f1368b07b0603e53292df50c6eb8b2e..db2803cee70e3d4975bfd372d426061fea0515ba 100644 (file)
@@ -91,7 +91,7 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent
 
        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);
-       Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
        PROJECTILE_MAKETRIGGER(missile);
 
        missile.owner = missile.realowner = actor;
@@ -124,6 +124,7 @@ void W_OverkillRocketPropelledChainsaw_Attack(Weapon thiswep, entity actor, .ent
 
        CSQCProjectile(missile, true, PROJECTILE_RPC, false);
 
+       // TODO: move to client
        setmodel(flash, MDL_RPC_MUZZLEFLASH); // precision set below
        SUB_SetFade (flash, time, 0.1);
        flash.effects = EF_ADDITIVE | EF_FULLBRIGHT | EF_LOWPRECISION;
index b8d2428f3ff24ac9c30d6d1b26930bd2012a7b42..ff5488a79954dc87aba1e507953f58dfdc3ee735 100644 (file)
@@ -673,6 +673,57 @@ CLIENT_COMMAND(weapon_find, "Show spawn locations of a weapon")
 }
 #endif
 
+REGISTER_NET_TEMP(w_muzzleflash)
+
+#ifdef SVQC
+void W_MuzzleFlash(entity actor, .entity weaponentity, entity eff, vector shotorg, vector shotdir)
+{
+       Send_Effect_Except(eff, shotorg, shotdir * 1000, 1, actor);
+
+       FOREACH_CLIENT(it == actor || (IS_SPEC(it) && it.enemy == actor),
+       {
+               if(!IS_REAL_CLIENT(it))
+                       continue;
+               int channel = MSG_ONE;
+               msg_entity = it;
+               WriteHeader(channel, w_muzzleflash);
+               WriteByte(channel, weaponslot(weaponentity));
+               (Effects_COUNT >= 255)
+               ? WriteShort(channel, eff.m_id)
+               : WriteByte(channel, eff.m_id);
+       });
+}
+#elif defined(CSQC)
+NET_HANDLE(w_muzzleflash, bool isNew)
+{
+       return = true;
+    int slot = ReadByte();
+    int net_name = (Effects_COUNT >= 255) ? ReadShort() : ReadByte();
+
+    if(!autocvar_r_drawviewmodel || autocvar_chase_active) return;
+       entity wepent = viewmodels[slot];
+       entity eff = Effects_from(net_name);
+
+       vector viewangles = getpropertyvec(VF_CL_VIEWANGLES);
+       vector forward, right, up;
+       MAKE_VECTORS(viewangles, forward, right, up);
+
+       // get the local player entity to calculate shot origin
+       entity rlplayer = CSQCModel_server2csqc(player_localentnum - 1);
+       if(!rlplayer)
+               rlplayer = csqcplayer; // fall back to the global
+
+       vector md = wepent.movedir;
+       vector vecs = ((md.x > 0) ? md : '0 0 0');
+       vector dv = 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);
+}
+#endif
+
 
 #endif
 
index 26b40084bfe82b4013862d1d6c4fae03621c74ff..7487ada17131aaff908f69a1bc2029c1d2d146ac 100644 (file)
@@ -394,4 +394,8 @@ REPLICATE(cvar_cl_accuracy_data_receive, bool, "cl_accuracy_data_receive");
 #ifdef SVQC
 void wframe_send(entity actor, entity weaponentity, int wepframe, float attackrate, bool restartanim);
 #endif
+
+#ifdef SVQC
+void W_MuzzleFlash(entity actor, .entity weaponentity, entity eff, vector shotorg, vector shotdir);
+#endif
 #endif
index ae2dbf07dfeda4f47c1b70d63ce7322364251c88..838d2aa8a86359c9600a0013b9ba90c608c9375f 100644 (file)
@@ -131,7 +131,7 @@ void W_Arc_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
 
        W_SetupShot(actor, weaponentity, false, 2, SND_LASERGUN_FIRE, CH_WEAPON_A, WEP_CVAR(arc, bolt_damage), WEP_ARC.m_id | HITTYPE_SECONDARY);
 
-       Send_Effect(EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ARC_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        missile = new(missile);
        missile.owner = missile.realowner = actor;
index 310ea19a1b53e9e0caee892f20736d27281f43d3..350268efccaac1878f17dd12a81b188a2f933ece 100644 (file)
@@ -55,7 +55,7 @@ void W_Blaster_Attack(
        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);
-       Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        entity missile = new(blasterbolt);
        missile.owner = missile.realowner = actor;
index a69f43fbd3f7afbdd01bca9d88707ee5255c5729..680d961ca7b131a4b0132cdfad1fa64cd508e5a3 100644 (file)
@@ -307,7 +307,7 @@ void W_Crylink_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        up = v_up;
 
        shots = WEP_CVAR_PRI(crylink, shots);
-       Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
        proj = prevproj = firstproj = NULL;
        for(counter = 0; counter < shots; ++counter)
        {
@@ -420,7 +420,7 @@ void W_Crylink_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        up = v_up;
 
        shots = WEP_CVAR_SEC(crylink, shots);
-       Send_Effect(EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, shots);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_CRYLINK_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
        proj = prevproj = firstproj = NULL;
        for(counter = 0; counter < shots; ++counter)
        {
index fce84c3b8eb88cc3d0b36a37861a361e5810f103..d55bca147fa90a1ac81dd1165412134f4dc52d93 100644 (file)
@@ -308,7 +308,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int
        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);
-       Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);
        missile.weaponentity_fld = weaponentity;
@@ -352,6 +352,7 @@ void W_Devastator_Attack(Weapon thiswep, entity actor, .entity weaponentity, int
        CSQCProjectile(missile, WEP_CVAR(devastator, guiderate) == 0 && WEP_CVAR(devastator, speedaccel) == 0, PROJECTILE_ROCKET, false); // because of fly sound
 
        // muzzle flash for 1st person view
+       // TODO: handle on the client side
        entity flash = spawn();
        setmodel(flash, MDL_DEVASTATOR_MUZZLEFLASH); // precision set below
        SUB_SetFade(flash, time, 0.1);
index 69ccc4251bff69dbd7dacb70975cdf1966c62434..f2bcc6013aa91ef9d8567e7e7101327fe64c529a 100644 (file)
@@ -227,7 +227,7 @@ void W_Electro_Attack_Bolt(Weapon thiswep, entity actor, .entity weaponentity)
                thiswep.m_id
        );
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        proj = new(electro_bolt);
        proj.owner = proj.realowner = actor;
@@ -378,7 +378,7 @@ void W_Electro_Attack_Orb(Weapon thiswep, entity actor, .entity weaponentity)
 
        w_shotdir = v_forward; // no TrueAim for grenades please
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        entity proj = new(electro_orb);
        proj.owner = proj.realowner = actor;
index 6b52ba32abba8d81cf8a0714e820af6895c197b4..3e36d7e69b74e157e1e16c6b80b7ddbefbd0e30a 100644 (file)
@@ -137,7 +137,7 @@ void W_Fireball_Attack1(entity actor, .entity weaponentity)
 {
        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);
 
-       Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        entity proj = new(plasma_prim);
        proj.owner = proj.realowner = actor;
@@ -176,7 +176,7 @@ void W_Fireball_AttackEffect(entity actor, .entity weaponentity, float i, vector
 {
        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;
-       Send_Effect(EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_PRE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 }
 
 void W_Fireball_Attack1_Frame4(Weapon thiswep, entity actor, .entity weaponentity, int fire)
@@ -275,7 +275,7 @@ void W_Fireball_Attack2(entity actor, .entity weaponentity)
        traceline(w_shotorg, w_shotorg + f_diff_x * v_up + f_diff_y * v_right, MOVE_NORMAL, actor);
        w_shotorg = trace_endpos;
 
-       Send_Effect(EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_FIREBALL_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        proj = new(grenade);
        proj.owner = proj.realowner = actor;
index 0ffa0c74d973b92f00f9c5fb4b06b22a522f0704..260f3425f773278c5cd3e1880e4f358b09ee5557 100644 (file)
@@ -83,7 +83,7 @@ void W_Hagar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
 
        W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(hagar, damage), thiswep.m_id);
 
-       Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        missile = new(missile);
        missile.owner = missile.realowner = actor;
@@ -129,7 +129,7 @@ void W_Hagar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
 
        W_SetupShot(actor, weaponentity, false, 2, SND_HAGAR_FIRE, CH_WEAPON_A, WEP_CVAR_SEC(hagar, damage), thiswep.m_id | HITTYPE_SECONDARY);
 
-       Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        missile = new(missile);
        missile.owner = missile.realowner = actor;
@@ -185,7 +185,7 @@ void W_Hagar_Attack2_Load_Release(Weapon thiswep, entity actor, .entity weaponen
 
        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);
-       Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        forward = v_forward;
        right = v_right;
index 6511d22b572b4fab5938c035aea73d2e18dec6a2..71c2c73202bf10a65bbd2a02967a4ab20269ccb1 100644 (file)
@@ -31,7 +31,7 @@ void W_HLAC_Attack(Weapon thiswep, entity actor, .entity weaponentity)
         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);
-       Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
        if(!autocvar_g_norecoil)
        {
                actor.punchangle_x = random() - 0.5;
@@ -81,7 +81,7 @@ void W_HLAC_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
         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);
-       Send_Effect(EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_BLASTER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        missile = new(hlacbolt);
        missile.owner = missile.realowner = actor;
index 86de79f600603d02f84bab06858b5dc533b42508..94128ea44d17c52b0ef472a71c8d9bbef655cc94 100644 (file)
@@ -55,7 +55,7 @@ void W_MachineGun_Attack(Weapon thiswep, int deathtype, entity actor, .entity we
        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);
 
-       Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        W_MachineGun_MuzzleFlash(actor, weaponentity);
        W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
@@ -131,7 +131,7 @@ void W_MachineGun_Attack_Auto(Weapon thiswep, entity actor, .entity weaponentity
 
        actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
 
-       Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        W_MachineGun_MuzzleFlash(actor, weaponentity);
        W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
@@ -157,7 +157,7 @@ void W_MachineGun_Attack_Burst(Weapon thiswep, entity actor, .entity weaponentit
 
        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);
 
-       Send_Effect(EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_MACHINEGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        W_MachineGun_MuzzleFlash(actor, weaponentity);
        W_AttachToShotorg(actor, weaponentity, actor.(weaponentity).muzzle_flash, '5 0 0');
index 7f60c5b571d90c84b9d8ff52717c19462300d89d..63662bddb9dccf17dfa04d904cb5ef3cf36bdfc8 100644 (file)
@@ -273,7 +273,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        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);
-       Send_Effect(EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ROCKET_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        mine = WarpZone_RefSys_SpawnSameRefSys(actor);
        mine.weaponentity_fld = weaponentity;
@@ -318,6 +318,7 @@ void W_MineLayer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        CSQCProjectile(mine, true, PROJECTILE_MINE, true);
 
        // muzzle flash for 1st person view
+       // TODO: handle on the client
        flash = spawn();
        setmodel(flash, MDL_MINELAYER_MUZZLEFLASH); // precision set below
        SUB_SetFade(flash, time, 0.1);
index 904f0c12838ff37b775847a0f4541d560406abd9..089075ee20a4bdece42ef01796afba3f7ce60fbe 100644 (file)
@@ -154,7 +154,7 @@ void W_Mortar_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        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
 
-       Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        entity gren = new(grenade);
        gren.owner = gren.realowner = actor;
@@ -206,7 +206,7 @@ void W_Mortar_Attack2(Weapon thiswep, entity actor, .entity weaponentity)
        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
 
-       Send_Effect(EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_GRENADE_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        gren = new(grenade);
        gren.owner = gren.realowner = actor;
index 7daf4ec40803c445f109569a9a8e73e532beb4e6..f5c8b7f001e0a51ff37d61a4f9a05655ce44f635 100644 (file)
@@ -10,7 +10,7 @@ void W_Rifle_FireBullet(Weapon thiswep, .entity weaponentity, float pSpread, flo
 
        W_SetupShot(actor, weaponentity, true, 2, pSound, CH_WEAPON_A, pDamage * pShots, deathtype);
 
-       Send_Effect(EFFECT_RIFLE_MUZZLEFLASH, w_shotorg, w_shotdir * 2000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_RIFLE_MUZZLEFLASH, w_shotorg, w_shotdir * 2000);
 
        if(PHYS_INPUT_BUTTON_ZOOM(actor) | PHYS_INPUT_BUTTON_ZOOMSCRIPT(actor)) // if zoomed, shoot from the eye
        {
index d7ba289f5ca7ee9f1e92669a9fd5098b93791771..a82762fa4009213b8cedc901288a91b26cc80a56 100644 (file)
@@ -171,7 +171,7 @@ void W_Seeker_Fire_Missile(Weapon thiswep, entity actor, .entity weaponentity, v
        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;
-       Send_Effect(EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_SEEKER_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        //actor.detornator         = false;
 
@@ -269,7 +269,7 @@ void W_Seeker_Fire_Flac(Weapon thiswep, entity actor, .entity weaponentity)
        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;
 
-       Send_Effect(EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_HAGAR_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        missile                                 = new(missile);
        missile.owner                   = missile.realowner = actor;
index b8cae5fd5da0d66c0216c9806c788b1752cfab8d..0fdb620b288bb2087d491f6144d2e541f5022044 100644 (file)
@@ -31,7 +31,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float
        if(lag && bullets > 0)
                antilag_restore_all(actor);
 
-       Send_Effect(EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, ammocount);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_SHOTGUN_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
        // casing code
        if(autocvar_g_casings >= 1)
@@ -42,6 +42,7 @@ void W_Shotgun_Attack(Weapon thiswep, entity actor, .entity weaponentity, float
        }
 
        // muzzle flash for 1st person view
+       // TODO: handle on the client
        entity flash = spawn();
        setmodel(flash, MDL_SHOTGUN_MUZZLEFLASH); // precision set below
        setthink(flash, SUB_Remove);
index dbf24c7964d94ff229b30ac068d4a0d315a251ba..6fdd7261be846e3a699a0e4372889338fd05abf7 100644 (file)
@@ -86,7 +86,7 @@ NET_HANDLE(TE_CSQC_VAPORBEAMPARTICLE, bool isNew)
        this.sv_entnum = myowner;
        this.team = ReadByte() - 1;
 
-       pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
+       //pointparticles(EFFECT_VORTEX_MUZZLEFLASH, this.vorg1, normalize(this.vorg2 - this.vorg1) * 1000, 1);
 
        if(autocvar_cl_vaporizerbeam_particle)
        {
@@ -128,6 +128,7 @@ void W_Vaporizer_Attack(Weapon thiswep, entity actor, .entity weaponentity)
        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, w_shotorg, w_shotdir * 1000);
        SendCSQCVaporizerBeamParticle(actor, damage_goodhits);
 
        if(yoda && flying)
@@ -187,7 +188,7 @@ void W_RocketMinsta_Attack2(entity actor, .entity weaponentity)
 
        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);
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
     while(counter < total)
        {
@@ -239,7 +240,7 @@ void W_RocketMinsta_Attack3 (entity actor, .entity weaponentity)
 
        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);
 
-       Send_Effect(EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000, 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_ELECTRO_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
 
     while(counter < total)
        {
index 46fd4d8c0887639b8b8c32e8b116c0f60ff4538e..12fb5bde276e54a75d4a3bc421a402eb3e6e35c9 100644 (file)
@@ -55,7 +55,7 @@ NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE, bool isNew)
     vector endpos = ReadVector();
        charge = ReadByte() / 255.0;
 
-       pointparticles(EFFECT_VORTEX_MUZZLEFLASH, shotorg, normalize(endpos - shotorg) * 1000, 1);
+       //pointparticles(EFFECT_VORTEX_MUZZLEFLASH, shotorg, normalize(endpos - shotorg) * 1000, 1);
 
        //draw either the old v2.3 beam or the new beam
        charge = sqrt(charge); // divide evenly among trail spacing and alpha
@@ -152,6 +152,7 @@ void W_Vortex_Attack(Weapon thiswep, entity actor, .entity weaponentity, float i
        actor.vortex_lasthit = damage_goodhits;
 
        //beam and muzzle flash done on client
+    W_MuzzleFlash(actor, weaponentity, EFFECT_VORTEX_MUZZLEFLASH, w_shotorg, w_shotdir * 1000);
        SendCSQCVortexBeamParticle(charge);
 
        W_DecreaseAmmo(thiswep, actor, myammo, weaponentity);
index aa970f4be3626a6ef4187417ad8c6f4a3f84769a..72d1467411ece1957d11bd00556c94c1fb84c86c 100644 (file)
@@ -364,7 +364,7 @@ void FireGrapplingHook(entity actor, .entity weaponentity)
        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);
-       Send_Effect(EFFECT_HOOK_MUZZLEFLASH, w_shotorg, '0 0 0', 1);
+       W_MuzzleFlash(actor, weaponentity, EFFECT_HOOK_MUZZLEFLASH, w_shotorg, '0 0 0');
        actor.(weaponentity).movedir = oldmovedir;
 
        entity missile = WarpZone_RefSys_SpawnSameRefSys(actor);