From 03898b0b4ccae0e4af5c2fd9c77f612012b03a67 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Thu, 18 Nov 2010 14:21:06 +0100 Subject: [PATCH] fix the bug that antilagged bullets get newtonian projectile direction adjustment applied... as this is just wrong --- qcsrc/server/cl_impulse.qc | 2 +- qcsrc/server/cl_weaponsystem.qc | 14 +++++++------- qcsrc/server/g_hook.qc | 2 +- qcsrc/server/mutators/gamemode_keyhunt.qc | 4 ++-- qcsrc/server/nexball.qc | 2 +- qcsrc/server/w_common.qc | 8 +++++--- qcsrc/server/w_crylink.qc | 4 ++-- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index bce1f51cd..491d8a26c 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -89,7 +89,7 @@ void ImpulseCommands (void) break; case 17: if (!g_minstagib) - W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE); + W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750, FALSE), '0 0 0', TRUE); break; case 18: W_NextWeapon (1); diff --git a/qcsrc/server/cl_weaponsystem.qc b/qcsrc/server/cl_weaponsystem.qc index fc6edb265..04666c47f 100644 --- a/qcsrc/server/cl_weaponsystem.qc +++ b/qcsrc/server/cl_weaponsystem.qc @@ -1270,7 +1270,7 @@ void weapon_boblayer1(float spd, vector org) // VorteX: haste can be added here }; -vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity) +vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity, float forceAbsolute) { vector mdirection; float mspeed; @@ -1284,7 +1284,7 @@ vector W_CalculateProjectileVelocity(vector pvelocity, vector mvelocity) mspeed = vlen(mvelocity); nstyle = cvar("g_projectiles_newton_style"); - if(nstyle == 0) + if(nstyle == 0 || forceAbsolute) { // absolute velocity outvelocity = mvelocity; @@ -1577,7 +1577,7 @@ float mspercallsum; float mspercallsstyle; float mspercallcount; #endif -void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread) +void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float pSpeed, float pUpSpeed, float pZSpeed, float spread, float forceAbsolute) { if(missile.owner == world) error("Unowned missile"); @@ -1602,13 +1602,13 @@ void W_SetupProjectileVelocityEx(entity missile, vector dir, vector upDir, float print("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n"); #endif - missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, pSpeed * dir); + missile.velocity = W_CalculateProjectileVelocity(missile.owner.velocity, pSpeed * dir, forceAbsolute); } void W_SetupProjectileVelocity(entity missile, float pSpeed, float spread) { - W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread); + W_SetupProjectileVelocityEx(missile, w_shotdir, v_up, pSpeed, 0, 0, spread, FALSE); } -#define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread")) -#define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread")) +#define W_SETUPPROJECTILEVELOCITY_UP(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), cvar(#s "_speed_up"), cvar(#s "_speed_z"), cvar(#s "_spread"), FALSE) +#define W_SETUPPROJECTILEVELOCITY(m,s) W_SetupProjectileVelocityEx(m, w_shotdir, v_up, cvar(#s "_speed"), 0, 0, cvar(#s "_spread"), FALSE) diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 88e1ced88..08cb128ab 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -363,7 +363,7 @@ void FireGrapplingHook (void) missile.state = 0; // not latched onto anything - W_SetupProjectileVelocityEx(missile, v_forward, v_up, cvar("g_balance_grapplehook_speed_fly"), 0, 0, 0); + W_SetupProjectileVelocityEx(missile, v_forward, v_up, cvar("g_balance_grapplehook_speed_fly"), 0, 0, 0, FALSE); missile.angles = vectoangles (missile.velocity); //missile.glow_color = 250; // 244, 250 diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index 2b6f54780..ca2865a21 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -677,7 +677,7 @@ void kh_Key_Think() // runs all the time bprint(self.owner.netname, "^7 dropped the ", self.netname, "\n"); sound(self.owner, CHAN_AUTO, kh_sound_drop, VOL_BASE, ATTN_NORM); makevectors(self.owner.v_angle); - self.velocity = W_CalculateProjectileVelocity(self.owner.velocity, cvar("g_balance_keyhunt_throwvelocity") * v_forward); + self.velocity = W_CalculateProjectileVelocity(self.owner.velocity, cvar("g_balance_keyhunt_throwvelocity") * v_forward, FALSE); kh_Key_AssignTo(self, world); self.pushltime = time + cvar("g_balance_keyhunt_protecttime"); self.kh_dropperteam = self.team; @@ -828,7 +828,7 @@ void kh_Key_DropAll(entity player, float suicide) // runs whenever a player dies bprint(player.netname, "^7 died and lost the ", key.netname, "\n"); kh_Key_AssignTo(key, world); makevectors('-1 0 0' * (45 + 45 * random()) + '0 360 0' * random()); - key.velocity = W_CalculateProjectileVelocity(player.velocity, cvar("g_balance_keyhunt_dropvelocity") * v_forward); + key.velocity = W_CalculateProjectileVelocity(player.velocity, cvar("g_balance_keyhunt_dropvelocity") * v_forward, FALSE); key.pusher = mypusher; key.pushltime = time + cvar("g_balance_keyhunt_protecttime"); if(suicide) diff --git a/qcsrc/server/nexball.qc b/qcsrc/server/nexball.qc index 099349cae..a01d70f14 100644 --- a/qcsrc/server/nexball.qc +++ b/qcsrc/server/nexball.qc @@ -652,7 +652,7 @@ void W_Nexball_Attack (float t) mul = 2 - mul; mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power } - DropBall (ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * cvar("g_balance_nexball_primary_speed") * mul)); + DropBall (ball, w_shotorg, W_CalculateProjectileVelocity(self.velocity, w_shotdir * cvar("g_balance_nexball_primary_speed") * mul, FALSE)); //TODO: use the speed_up cvar too ?? } diff --git a/qcsrc/server/w_common.qc b/qcsrc/server/w_common.qc index 0b405ba77..3995a4815 100644 --- a/qcsrc/server/w_common.qc +++ b/qcsrc/server/w_common.qc @@ -341,6 +341,9 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f { float lag, dt, savetime, density; entity pl, oldself; + float antilagging; + + antilagging = (cvar("g_antilag_bullets") && (pSpeed >= cvar("g_antilag_bullets"))); entity proj; proj = spawn(); @@ -356,7 +359,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f proj.movetype = MOVETYPE_FLY; proj.think = SUB_Remove; proj.nextthink = time + lifetime; // min(pLifetime, vlen(world.maxs - world.mins) / pSpeed); - W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread); + W_SetupProjectileVelocityEx(proj, dir, v_up, pSpeed, 0, 0, spread, antilagging); proj.angles = vectoangles(proj.velocity); proj.dmg_radius = cvar("g_ballistics_materialconstant") / bulletconstant; // so: bulletconstant = bullet mass / area of bullet circle @@ -373,8 +376,7 @@ void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, f other = proj; MUTATOR_CALLHOOK(EditProjectile); - if(cvar("g_antilag_bullets")) - if(pSpeed >= cvar("g_antilag_bullets")) + if(antilagging) { float eff; diff --git a/qcsrc/server/w_crylink.qc b/qcsrc/server/w_crylink.qc index 55d794fa3..4891bc2b9 100644 --- a/qcsrc/server/w_crylink.qc +++ b/qcsrc/server/w_crylink.qc @@ -347,7 +347,7 @@ void W_Crylink_Attack (void) s_z = v_forward_y; } s = s * cvar("g_balance_crylink_primary_spread") * g_weaponspreadfactor; - W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0); + W_SetupProjectileVelocityEx(proj, w_shotdir + right * s_y + up * s_z, v_up, cvar("g_balance_crylink_primary_speed"), 0, 0, 0, FALSE); proj.touch = W_Crylink_Touch; proj.think = W_Crylink_Fadethink; @@ -429,7 +429,7 @@ void W_Crylink_Attack2 (void) setorigin (proj, w_shotorg); setsize(proj, '0 0 0', '0 0 0'); - W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread") * g_weaponspreadfactor), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0, 0); + W_SetupProjectileVelocityEx(proj, (w_shotdir + (((counter + 0.5) / shots) * 2 - 1) * v_right * cvar("g_balance_crylink_secondary_spread") * g_weaponspreadfactor), v_up, cvar("g_balance_crylink_secondary_speed"), 0, 0, 0, FALSE); proj.touch = W_Crylink_Touch2; proj.think = W_Crylink_Fadethink; if(counter == (shots - 1) / 2) -- 2.39.2