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);
// 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;
mspeed = vlen(mvelocity);
nstyle = cvar("g_projectiles_newton_style");
- if(nstyle == 0)
+ if(nstyle == 0 || forceAbsolute)
{
// absolute velocity
outvelocity = mvelocity;
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");
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)
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
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;
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)
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 ??
}
{
float lag, dt, savetime, density;
entity pl, oldself;
+ float antilagging;
+
+ antilagging = (cvar("g_antilag_bullets") && (pSpeed >= cvar("g_antilag_bullets")));
entity proj;
proj = spawn();
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
other = proj; MUTATOR_CALLHOOK(EditProjectile);
- if(cvar("g_antilag_bullets"))
- if(pSpeed >= cvar("g_antilag_bullets"))
+ if(antilagging)
{
float eff;
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;
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)