From defe7ea25b8d1cc20b5c302104854db5666e6fcc Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 9 Jun 2018 22:15:07 +1000 Subject: [PATCH] Fix dual wielding devastator and mortar, enable vortex and rifle in dual wielding now that aiming is offset --- qcsrc/common/weapons/weapon/devastator.qc | 10 +++++++++- qcsrc/common/weapons/weapon/devastator.qh | 2 +- qcsrc/common/weapons/weapon/fireball.qc | 1 - qcsrc/common/weapons/weapon/mortar.qh | 2 +- qcsrc/common/weapons/weapon/rifle.qh | 2 +- qcsrc/common/weapons/weapon/vortex.qh | 2 +- qcsrc/server/weapons/tracing.qc | 5 ++++- 7 files changed, 17 insertions(+), 7 deletions(-) diff --git a/qcsrc/common/weapons/weapon/devastator.qc b/qcsrc/common/weapons/weapon/devastator.qc index 0a046389c..c53e110fd 100644 --- a/qcsrc/common/weapons/weapon/devastator.qc +++ b/qcsrc/common/weapons/weapon/devastator.qc @@ -235,11 +235,19 @@ void W_Devastator_Think(entity this) else f = 1; + vector md = this.realowner.(weaponentity).movedir; + vector vecs = ((md.x > 0) ? md : '0 0 0'); + + vector dv = v_right * -vecs.y + v_up * vecs.z; + + if(!W_DualWielding(this.realowner)) + dv = '0 0 0'; // don't override! + velspeed = vlen(this.velocity); makevectors(this.realowner.v_angle); desireddir = WarpZone_RefSys_TransformVelocity(this.realowner, this, v_forward); - desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs); + desiredorigin = WarpZone_RefSys_TransformOrigin(this.realowner, this, this.realowner.origin + this.realowner.view_ofs + dv); olddir = normalize(this.velocity); // now it gets tricky... we want to move like some curve to approximate the target direction diff --git a/qcsrc/common/weapons/weapon/devastator.qh b/qcsrc/common/weapons/weapon/devastator.qh index 0e8d8b2fb..e858d54e4 100644 --- a/qcsrc/common/weapons/weapon/devastator.qh +++ b/qcsrc/common/weapons/weapon/devastator.qh @@ -4,7 +4,7 @@ CLASS(Devastator, Weapon) /* spawnfunc */ ATTRIB(Devastator, m_canonical_spawnfunc, string, "weapon_devastator"); /* ammotype */ ATTRIB(Devastator, ammo_type, int, RESOURCE_ROCKETS); /* impulse */ ATTRIB(Devastator, impulse, int, 9); -/* flags */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Devastator, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH); /* rating */ ATTRIB(Devastator, bot_pickupbasevalue, float, 8000); /* color */ ATTRIB(Devastator, wpcolor, vector, '1 1 0'); /* modelname */ ATTRIB(Devastator, mdl, string, "rl"); diff --git a/qcsrc/common/weapons/weapon/fireball.qc b/qcsrc/common/weapons/weapon/fireball.qc index ef2eb91ca..ee4b2e084 100644 --- a/qcsrc/common/weapons/weapon/fireball.qc +++ b/qcsrc/common/weapons/weapon/fireball.qc @@ -155,7 +155,6 @@ void W_Fireball_Attack1(entity actor, .entity weaponentity) PROJECTILE_MAKETRIGGER(proj); proj.projectiledeathtype = WEP_FIREBALL.m_id; proj.weaponentity_fld = weaponentity; - proj.weaponentity_fld = weaponentity; setorigin(proj, w_shotorg); set_movetype(proj, MOVETYPE_FLY); diff --git a/qcsrc/common/weapons/weapon/mortar.qh b/qcsrc/common/weapons/weapon/mortar.qh index 2161d468b..affec0dbc 100644 --- a/qcsrc/common/weapons/weapon/mortar.qh +++ b/qcsrc/common/weapons/weapon/mortar.qh @@ -4,7 +4,7 @@ CLASS(Mortar, Weapon) /* spawnfunc */ ATTRIB(Mortar, m_canonical_spawnfunc, string, "weapon_mortar"); /* ammotype */ ATTRIB(Mortar, ammo_type, int, RESOURCE_ROCKETS); /* impulse */ ATTRIB(Mortar, impulse, int, 4); -/* flags */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Mortar, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_FLAG_CANCLIMB | WEP_TYPE_SPLASH); /* rating */ ATTRIB(Mortar, bot_pickupbasevalue, float, 7000); /* color */ ATTRIB(Mortar, wpcolor, vector, '1 0 0'); /* modelname */ ATTRIB(Mortar, mdl, string, "gl"); diff --git a/qcsrc/common/weapons/weapon/rifle.qh b/qcsrc/common/weapons/weapon/rifle.qh index 87bc4d7ec..560354c05 100644 --- a/qcsrc/common/weapons/weapon/rifle.qh +++ b/qcsrc/common/weapons/weapon/rifle.qh @@ -4,7 +4,7 @@ CLASS(Rifle, Weapon) /* spawnfunc */ ATTRIB(Rifle, m_canonical_spawnfunc, string, "weapon_rifle"); /* ammotype */ ATTRIB(Rifle, ammo_type, int, RESOURCE_BULLETS); /* impulse */ ATTRIB(Rifle, impulse, int, 7); -/* flags */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Rifle, spawnflags, int, WEP_FLAG_MUTATORBLOCKED | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS); /* rating */ ATTRIB(Rifle, bot_pickupbasevalue, float, 7000); /* color */ ATTRIB(Rifle, wpcolor, vector, '0.5 1 0'); /* modelname */ ATTRIB(Rifle, mdl, string, "campingrifle"); diff --git a/qcsrc/common/weapons/weapon/vortex.qh b/qcsrc/common/weapons/weapon/vortex.qh index cc975cceb..8a11b2e13 100644 --- a/qcsrc/common/weapons/weapon/vortex.qh +++ b/qcsrc/common/weapons/weapon/vortex.qh @@ -4,7 +4,7 @@ CLASS(Vortex, Weapon) /* spawnfunc */ ATTRIB(Vortex, m_canonical_spawnfunc, string, "weapon_vortex"); /* ammotype */ ATTRIB(Vortex, ammo_type, int, RESOURCE_CELLS); /* impulse */ ATTRIB(Vortex, impulse, int, 7); -/* flags */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_NODUAL); +/* flags */ ATTRIB(Vortex, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN); /* rating */ ATTRIB(Vortex, bot_pickupbasevalue, float, 8000); /* color */ ATTRIB(Vortex, wpcolor, vector, '0.5 1 1'); /* modelname */ ATTRIB(Vortex, mdl, string, "nex"); diff --git a/qcsrc/server/weapons/tracing.qc b/qcsrc/server/weapons/tracing.qc index a3898c627..46c26b2e8 100644 --- a/qcsrc/server/weapons/tracing.qc +++ b/qcsrc/server/weapons/tracing.qc @@ -81,7 +81,10 @@ void W_SetupShot_Dir_ProjectileSize_Range(entity ent, .entity weaponentity, vect tracebox(w_shotorg, mi, ma, w_shotorg + v_forward * (vecs.x + nudge), MOVE_NORMAL, ent); w_shotorg = trace_endpos - v_forward * nudge; // calculate the shotdir from the chosen shotorg - w_shotdir = normalize(w_shotend - w_shotorg); + if(W_DualWielding(ent)) + w_shotdir = s_forward; + else + w_shotdir = normalize(w_shotend - w_shotorg); //vector prevdir = w_shotdir; //vector prevorg = w_shotorg; -- 2.39.2