mirror of
https://github.com/nzp-team/quakec.git
synced 2025-02-07 17:11:02 +00:00
CLIENT: Use gun_kick and ADS positions for muzzleflashes
This commit is contained in:
parent
fcadbeb7c5
commit
f385a04712
2 changed files with 17 additions and 8 deletions
|
@ -929,6 +929,8 @@ float() alphafade =
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DEG2RAD(x) (x * M_PI / 180.f)
|
||||||
|
|
||||||
noref void() CSQC_Parse_Event =
|
noref void() CSQC_Parse_Event =
|
||||||
{
|
{
|
||||||
local float first = readbyte();
|
local float first = readbyte();
|
||||||
|
@ -950,22 +952,23 @@ noref void() CSQC_Parse_Event =
|
||||||
|
|
||||||
if(entnum == player_localentnum)
|
if(entnum == player_localentnum)
|
||||||
{
|
{
|
||||||
makevectors(view_angles);
|
// originally was view_angles, but thats only what is reported
|
||||||
|
// to the server, weapon kick is NOT reported, so offset continued
|
||||||
|
// to grow.
|
||||||
|
makevectors(getproperty(VF_ANGLES));
|
||||||
local vector offset = vmodel.origin + vmodel_muzzleoffset;
|
local vector offset = vmodel.origin + vmodel_muzzleoffset;
|
||||||
local vector muzzlepos;
|
local vector muzzlepos, muzzle_offset;
|
||||||
muzzlepos = getviewprop(VF_ORIGIN);
|
muzzlepos = getviewprop(VF_ORIGIN);
|
||||||
|
|
||||||
local vector muzzle_offset = GetWeaponFlash_Offset(getstatf(STAT_ACTIVEWEAPON))/1000;
|
muzzle_offset = GetWeaponFlash_Offset(getstatf(STAT_ACTIVEWEAPON))/1000;
|
||||||
|
|
||||||
// Firing from the left? Use the other position instead
|
// Firing from the left? Use the other position instead
|
||||||
if (side == 0 && IsDualWeapon(getstatf(STAT_ACTIVEWEAPON)))
|
if (side == 0 && IsDualWeapon(getstatf(STAT_ACTIVEWEAPON)))
|
||||||
muzzle_offset = WepDef_GetLeftFlashOffset(getstatf(STAT_ACTIVEWEAPON))/1000;
|
muzzle_offset = WepDef_GetLeftFlashOffset(getstatf(STAT_ACTIVEWEAPON))/1000;
|
||||||
|
|
||||||
// ADS offset
|
// ADS offset
|
||||||
if(getstatf(STAT_WEAPONZOOM) == 1)
|
if(getstatf(STAT_WEAPONZOOM) == 1) {
|
||||||
{
|
muzzle_offset += GetWeaponADSOfs_PSP(weapon)/1000;
|
||||||
muzzle_offset += GetWeaponADSPos(weapon);
|
|
||||||
muzzle_offset[0] -= 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
muzzlepos += v_forward * muzzle_offset_z;
|
muzzlepos += v_forward * muzzle_offset_z;
|
||||||
|
@ -973,6 +976,13 @@ noref void() CSQC_Parse_Event =
|
||||||
muzzlepos += v_up * muzzle_offset_y;
|
muzzlepos += v_up * muzzle_offset_y;
|
||||||
mzlflash.alpha = 1;
|
mzlflash.alpha = 1;
|
||||||
|
|
||||||
|
// Scale the muzzleflash to meet viewmodel FOV
|
||||||
|
// FTE doesnt support vector scaling :(
|
||||||
|
// float afov = cvar("fov");
|
||||||
|
// float vfov = cvar("r_viewmodel_default_fov");
|
||||||
|
// float ascale = 1.0 / tan(DEG2RAD(afov/2.0)) * vfov / 90.0;
|
||||||
|
// mzlflash.scale = ascale;
|
||||||
|
|
||||||
if (cvar("nzp_particles") && cvar("r_drawviewmodel")) {
|
if (cvar("nzp_particles") && cvar("r_drawviewmodel")) {
|
||||||
float index = rint(random() * 2);
|
float index = rint(random() * 2);
|
||||||
if (IsPapWeapon(getstatf(STAT_ACTIVEWEAPON)))
|
if (IsPapWeapon(getstatf(STAT_ACTIVEWEAPON)))
|
||||||
|
|
|
@ -4081,7 +4081,6 @@ float(float weapon, float value, float mag_not_reserve) W_IsLowAmmo =
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PSP Specific!!
|
|
||||||
vector(float wep) GetWeaponRecoil =
|
vector(float wep) GetWeaponRecoil =
|
||||||
{
|
{
|
||||||
vector guaranteed = '0 0 0';
|
vector guaranteed = '0 0 0';
|
||||||
|
|
Loading…
Reference in a new issue