SERVER: Add ability to display left weapon muzzle flash

This commit is contained in:
cypress 2023-10-27 14:35:44 -04:00
parent 70e811a675
commit e3eafffcb9
3 changed files with 30 additions and 5 deletions

View file

@ -957,16 +957,16 @@ noref void() CSQC_Parse_Event =
local vector muzzle_offset = GetWeaponFlash_Offset(getstatf(STAT_ACTIVEWEAPON))/1000;
// Firing from the left? Use the other position instead
if (side == 0 && IsDualWeapon(getstatf(STAT_ACTIVEWEAPON)))
muzzle_offset = WepDef_GetLeftFlashOffset(getstatf(STAT_ACTIVEWEAPON))/1000;
// ADS offset
if(getstatf(STAT_WEAPONZOOM) == 1)
{
muzzle_offset += GetWeaponADSPos(weapon);
muzzle_offset[0] -= 2;
}
// Firing from the left? Flip x-axis for muzzleflash
if (side == 0 && IsDualWeapon(getstatf(STAT_ACTIVEWEAPON)))
muzzle_offset[0] = -muzzle_offset[0];
muzzlepos += v_forward * muzzle_offset_z;
muzzlepos += v_right * muzzle_offset_x;
@ -981,8 +981,11 @@ noref void() CSQC_Parse_Event =
pointparticles(particleeffectnum(strcat("muzzle.muzzle_part", ftos(index))), muzzlepos, norm*24, 1);
}
}
if (GetFiretype(getstatf(STAT_ACTIVEWEAPON)) == FIRETYPE_GRENADE)
return;
if(traceent == 0 && GetFiretype(getstatf(STAT_ACTIVEWEAPON)) != 3)
if(traceent == 0)
{
if (cvar("nzp_particles"))
pointparticles(particleeffectnum("weapons.impact"), pos, norm*24, 1);

View file

@ -51,4 +51,21 @@ void(float side) W_FireGrenade =
nade.origin = self.origin + self.view_ofs;
setorigin(nade, nade.origin);
#ifdef FTE
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
WriteByte(MSG_MULTICAST, EVENT_PISTOLFIRE);
WriteEntity(MSG_MULTICAST, self);
WriteFloat(MSG_MULTICAST, side);
WriteCoord(MSG_MULTICAST, 0);
WriteCoord(MSG_MULTICAST, 0);
WriteCoord(MSG_MULTICAST, 0);
WriteCoord(MSG_MULTICAST, 0);
WriteCoord(MSG_MULTICAST, 0);
WriteCoord(MSG_MULTICAST, 0);
WriteEntity(MSG_MULTICAST, world);
multicast(self.origin, MULTICAST_PHS);
#endif // FTE
}

View file

@ -1203,6 +1203,11 @@ void(float side) W_Fire =
// REFORMAT THIS
#ifndef FTE
if (side == S_LEFT)
self.Flash_Offset = WepDef_GetLeftFlashOffset(self.weapon);
else
self.Flash_Offset = GetWeaponFlash_Offset(self.weapon);
self.effects = self.effects | EF_MUZZLEFLASH;
#else