Sniper rifle tweaks: removed "new" autorifle, added a #define NO_AUTORIFLE

(which is going to be the default, don't whine). Old autorifle still there
and working as it was.

Sniper rifle now takes 5 shells per shot, OTR or not.
W_FireSniperRifle fixed so it's not squaring the damage (ARGH)
Added a damage cap on legshots.
Sniper rifle reload time lengthened.
This commit is contained in:
Finny Merrill 2003-12-02 03:20:33 +00:00
parent cbbb790bb6
commit 6e03505c11
9 changed files with 114 additions and 77 deletions

34
defs.qh
View file

@ -632,31 +632,35 @@
/*==================================================*/
// WK -- Removed "weapons" to free up space for shootable things
// We can remove some more by giving the weapons a weapon mode (like the rifle)
#define WEAP_HOOK 1
#define WEAP_HOOK 1
#define WEAP_MEDIKIT 4
#define WEAP_SPANNER 8
#define WEAP_AXE 16
#define WEAP_AXE 16
#define WEAP_SNIPER_RIFLE 32
#define WEAP_AUTO_RIFLE 64
#ifndef NO_AUTORIFLE
# define WEAP_AUTO_RIFLE 64
#endif
#define WEAP_SHOTGUN 128
#define WEAP_SUPER_SHOTGUN 256
#define WEAP_NAILGUN 512
#define WEAP_LIGHT_ASSAULT 1024
#define WEAP_GRENADE_LAUNCHER 2048
#define WEAP_GRENADE_LAUNCHER 2048
#define WEAP_FLAMETHROWER 4096
#define WEAP_ROCKET_LAUNCHER 8192
#define WEAP_ROCKET_LAUNCHER 8192
#define WEAP_INCENDIARY 16384
#define WEAP_ASSAULT_CANNON 32768
#define WEAP_LIGHTNING 65536
#define WEAP_DAEDALUS 131072
//#define WEAP_DETPACK 131072 DONT MAKE ANY AMMOTYPES USE THIS NUMBER!
#define WEAP_TRANQ 262144
#define WEAP_LASER 524288
#define WEAP_MAUSER 1048576
#define WEAP_TRANQ 262144
#define WEAP_LASER 524288
#define WEAP_MAUSER 1048576
#define WEAP_AIRF 2097152 //- OfN - airfist
#define WEAP_LASERCANNON 4194304 //- OfN - LASER CANNON
#define WEAP_SNG 8388608
#define WEAP_AIRF 2097152 //- OfN - airfist
#define WEAP_LASERCANNON 4194304 //- OfN - LASER CANNON
#define WEAP_SNG 8388608
//MAX 24 BITS OF PRECISION IN FLOAT!
/*====================================================*/
@ -892,7 +896,13 @@
#define PC_SNIPER_INITARMORTYPE 0.3
#define PC_SNIPER_ARMORCLASSES 3 // AT_SAVESHOT | AT_SAVEMELEE
#define PC_SNIPER_INITARMORCLASS 1
#define PC_SNIPER_WEAPONS WEAP_SNIPER_RIFLE | WEAP_AUTO_RIFLE | WEAP_AXE | WEAP_NAILGUN
#ifndef NO_AUTORIFLE
# define PC_SNIPER_WEAPONS WEAP_SNIPER_RIFLE | WEAP_AUTO_RIFLE | WEAP_AXE | WEAP_NAILGUN
#else
# define PC_SNIPER_WEAPONS WEAP_SNIPER_RIFLE | WEAP_AXE | WEAP_NAILGUN
#endif
#define PC_SNIPER_MAXAMMO_SHOT 75
#define PC_SNIPER_MAXAMMO_NAIL 100
#define PC_SNIPER_MAXAMMO_CELL 150

View file

@ -511,10 +511,12 @@ void() JudokaRearm =
te = find(te, netname, "reloadtimer");
}
////Fix double weapons
#ifndef NO_AUTORIFLE
if (self.current_weapon == WEAP_SNIPER_RIFLE) {
self.owner.weapons_carried = self.owner.weapons_carried | WEAP_AUTO_RIFLE;
self.enemy.weapons_carried = self.enemy.weapons_carried - (self.enemy.weapons_carried & WEAP_AUTO_RIFLE);
}
#endif
////Fix weird weapons
if (self.current_weapon == WEAP_ASSAULT_CANNON && self.enemy.current_weapon == WEAP_ASSAULT_CANNON) {
oself = self;
@ -617,8 +619,10 @@ void() JobJudoka =
self.job = self.job | JOB_ACTIVE;
//Simplify the dual-weapon problem
#ifndef NO_AUTORIFLE
if (trace_ent.current_weapon == WEAP_AUTO_RIFLE)
trace_ent.current_weapon = WEAP_SNIPER_RIFLE;
#endif
//If already reloading, remove that timer
te = find(NIL, netname, "reloadtimer");
@ -670,10 +674,12 @@ void() JobJudoka =
tWeapon.heat = 1;
//Fix double weapons
#ifndef NO_AUTORIFLE
if (trace_ent.current_weapon == WEAP_SNIPER_RIFLE) {
self.weapons_carried = self.weapons_carried | WEAP_AUTO_RIFLE;
trace_ent.weapons_carried = trace_ent.weapons_carried - (trace_ent.weapons_carried & WEAP_AUTO_RIFLE);
}
#endif
if (trace_ent.current_weapon == WEAP_MEDIKIT) {
self.health = self.max_health; //You heal yourself. :)
}

View file

@ -2747,7 +2747,9 @@ void(float inp) Menu_PrimaryWeapon_Input =
{
PrintRefund(PRICE);
self.weapons_carried = self.weapons_carried - WEAP_SNIPER_RIFLE;
#ifndef NO_AUTORIFLE
self.weapons_carried = self.weapons_carried - WEAP_AUTO_RIFLE;
#endif
self.maxammo_shells = self.maxammo_shells - 75;
}
else if (self.money >= PRICE) {

View file

@ -37,7 +37,8 @@
#define SCRAG_DMG 29 // damage the scrag does
#define WAYPOINT_LIFE 240 // 120 after this amount of seconds any unused waypoint will be removed
#define OTR_DMGFACTOR 0.6 // *damage facter for the OTR armed sniper rifle (MUST BE GREATER THAN 1!!!) no
#define OTR_DMGFACTOR 0.6 // How much damage OTR does normally (should not be more than 1)
#define OTR_IGNFACTOR 0.3 // How much armor-piercing damage OTR does (this + dmgfactor should be slightly <1)
#define SENTRY_UNLOCKTIME 2.5 // (must be greater than 1.1) time for the sentries to begin to rotate after they have no target (+/- 1 second)
#define HAX_UNSTABLEDIST 300 // distance at which enemy hacks take longer cause of "unstable connection"
#define WAYPOINT_AI_LIFE 10 // life for grunty ai created waypoints - last seen enemy mark
@ -45,8 +46,8 @@
#define MINE_SCANRATE 0.6 // mines look again for nearby enemy after this time - it was 1 which caused high ping players to not trigger mines sometimes walking around them fast
#define EXPBODY_DMG 200 // damage exp. body does /was 140 GR this was really really wimpy
#define MINE_DMG 200 // was 240 /215
#define SNIPER_DMG 90 // was charge up. Makes more sense for sniper bullets to do constant damage.
#define OTR_DMG 50 // extra damage done by OTR (always ignores armor)
#define SNIPER_DMG 200 // was charge up. Makes more sense for sniper bullets to do constant damage.
#define SNIPER_MAXLEG 50 // Max damage sniper rifle can do with legshot
#define BERSERKER_HP_COST 30

View file

@ -55,7 +55,7 @@ Defines for the compilable options within TF.
#define NEVER_TEAMFRAGS #ON // teamfrags options always off (i didn't realise people wouldn't like it)
#define ALWAYS_TEAMFRAGS #OFF // teamfrags options always on
#define CHECK_SPEEDS #ON // makes sure players aren't moving too fast
#define SNIPER_RIFLE_RELOAD_TIME 1.5 // seconds
#define SNIPER_RIFLE_RELOAD_TIME 2 // seconds
#define STOP_MOUSE_MOVEMENT #ON // stops players from moving forward/back with the mouse, and cheating with it.
#define RESPAWN_DELAY_TIME 5 // this is the respawn delay, if the RESPAWN_DELAY option is
// turned on with temp1. QuakeWorld servers can use

View file

@ -55,7 +55,7 @@ Defines for the compilable options within TF.
#define NEVER_TEAMFRAGS ON // teamfrags options always off (i didn't realise people wouldn't like it)
#define ALWAYS_TEAMFRAGS OFF // teamfrags options always on
#define CHECK_SPEEDS ON // makes sure players aren't moving too fast
#define SNIPER_RIFLE_RELOAD_TIME 1.5 // seconds
#define SNIPER_RIFLE_RELOAD_TIME 2 // seconds
#define STOP_MOUSE_MOVEMENT ON // stops players from moving forward/back with the mouse, and cheating with it.
#define RESPAWN_DELAY_TIME 5 // this is the respawn delay, if the RESPAWN_DELAY option is
// turned on with temp1. QuakeWorld servers can use

View file

@ -299,9 +299,11 @@ void() player_shot4 = [$shotatt4, player_shot5 ] {self.weaponframe=4;};
void() player_shot5 = [$shotatt5, player_shot6 ] {self.weaponframe=5;};
void() player_shot6 = [$shotatt6, player_run ] {self.weaponframe=6;};
#ifndef NO_AUTORIFLE
void() player_autorifle1 = [$shotatt1, player_autorifle2 ] {self.weaponframe=1; muzzleflash(); };
void() player_autorifle2 = [$shotatt2, player_autorifle3 ] {self.weaponframe=2;};
void() player_autorifle3 = [$shotatt6, player_run ] {self.weaponframe=6;};
#endif
void() player_axe1 = [$axatt1, player_axe2 ] {self.weaponframe=1;};
void() player_axe2 = [$axatt2, player_axe3 ] {self.weaponframe=2;};

View file

@ -30,17 +30,19 @@ void() TeamFortress_SniperWeapon =
if (!((self.weapons_carried & WEAP_SNIPER_RIFLE) && (self.weapons_carried & WEAP_AUTO_RIFLE)))
return;
if (self.ammo_shells < 1)
if (self.ammo_shells < 5)
{ // don't have the ammo
sprint (self, PRINT_HIGH, "not enough ammo.\n");
return;
}
#ifndef NO_AUTORIFLE
if (self.current_weapon == WEAP_SNIPER_RIFLE)
{
self.current_weapon = WEAP_AUTO_RIFLE;
}
else
#endif
{
self.current_weapon = WEAP_SNIPER_RIFLE;
}

View file

@ -1219,7 +1219,7 @@ TeamFortress : W_FireSniperRifle
void() W_FireSniperRifle =
{
local vector dir, src;
local float dam_mult, zdif, use_this;
local float dam_mult, zdif, use_this, ign_mult = 0;
local vector angle;
sound (self ,CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
@ -1246,7 +1246,7 @@ void() W_FireSniperRifle =
dir = v_forward; //XXX is this correct?
use_this = FALSE;
traceline (src, src + dir*8092, FALSE, self);
traceline (src, src + dir*8092, FALSE, self);
if (trace_fraction != 1.0) {
if (trace_ent) {
if (trace_ent.classname == "player") {
@ -1273,13 +1273,15 @@ void() W_FireSniperRifle =
if (!dam_mult)
dam_mult = SNIPER_DMG;
//- OfN - float factor to handle OTR bullets difference
if (self.cutf_items & CUTF_OTR && self.ammo_shells > 2) {
self.currentammo = self.ammo_shells = self.ammo_shells - 3;
} else
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
if (self.cutf_items & CUTF_OTR)
{
ign_mult=dam_mult*OTR_IGNFACTOR;
dam_mult=dam_mult*OTR_DMGFACTOR;
}
dam_mult=dam_mult*OTR_DMGFACTOR;
self.ammo_shells -= 5;
W_SetCurrentAmmo();
if (trace_ent) {
if (trace_ent.classname == "player") {
@ -1306,7 +1308,14 @@ void() W_FireSniperRifle =
trace_ent.head_shot_vector = '0 0 0';
if (zdif < 0) {
// leg shot doesn't hurt very much
dam_mult = 0.40;
dam_mult *= 0.40;
ign_mult *= 0.40;
if ((dam_mult + ign_mult) > SNIPER_MAXLEG)
{
dam_mult *= (dam_mult + ign_mult) / SNIPER_MAXLEG;
ign_mult *= (dam_mult + ign_mult) / SNIPER_MAXLEG;
}
if (trace_ent.armorvalue < 0.8)
trace_ent.leg_damage++;
@ -1322,20 +1331,17 @@ void() W_FireSniperRifle =
//GR red armor has leg protection
if (trace_ent.armortype >= 0.7 && trace_ent.armorvalue > 0) {
if (self.cutf_items & CUTF_OTR) // otr does extra damage to armored
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, SNIPER_DMG * dam_mult, 0, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, ign_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, dam_mult, 0, TF_TD_SHOT);
} else {
if (self.cutf_items & CUTF_OTR)
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, 0);
TF_T_Damage (trace_ent, self, self, SNIPER_DMG * dam_mult, TF_TD_IGNOREARMOUR,0);
TF_T_Damage (trace_ent, self, self, dam_mult + ign_mult, TF_TD_IGNOREARMOUR,0);
}
if (trace_ent.health > 0) {
if (self.cutf_items & CUTF_OTR) {
if (self.cutf_items & CUTF_OTR) {
sprint(trace_ent, PRINT_MEDIUM, "Leg injury! That was OTR stuff!\n");
sprint(self, PRINT_MEDIUM, "OTR Leg shot - that'll slow him down!\n");
} else { //- not OTR..
} else { //- not OTR..
sprint(trace_ent, PRINT_MEDIUM, "Leg injury!\n");
sprint(self, PRINT_MEDIUM, "Leg shot - that'll slow him down!\n");
}
@ -1344,7 +1350,8 @@ void() W_FireSniperRifle =
return;
} else if (zdif > 20) {
// head shot
dam_mult = 2;
dam_mult *= 2;
ign_mult *= 2;
stuffcmd(trace_ent, "bf\n");
@ -1352,13 +1359,10 @@ void() W_FireSniperRifle =
deathmsg = DMSG_SNIPERHEADSHOT;
if (trace_ent.armortype > 0.5 && trace_ent.armorvalue > 0)
{
if (self.cutf_items & CUTF_OTR) // OTR does extra damage to armored
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, SNIPER_DMG * dam_mult, 0, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, ign_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
TF_T_Damage (trace_ent, self, self, dam_mult, 0, TF_TD_SHOT);
} else {
if (self.cutf_items & CUTF_OTR)
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, 0);
TF_T_Damage (trace_ent, self, self, SNIPER_DMG * dam_mult, TF_TD_IGNOREARMOUR, 0);
TF_T_Damage (trace_ent, self, self, dam_mult + ign_mult, TF_TD_IGNOREARMOUR, 0);
}
if (trace_ent.health > 0) {
@ -1369,17 +1373,13 @@ void() W_FireSniperRifle =
sprint(trace_ent, PRINT_MEDIUM, "Head injury!\n");
sprint(self, PRINT_MEDIUM, "Head shot - that's gotta hurt!\n");
}
}
}
return;
} else
deathmsg = DMSG_SNIPERRIFLE;
if (self.cutf_items & CUTF_OTR) {
if (trace_ent.armorvalue > 0)
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
else
TF_T_Damage (trace_ent, self, self, OTR_DMG * dam_mult, TF_TD_IGNOREARMOUR, 0);
}
TF_T_Damage (trace_ent, self, self, ign_mult, TF_TD_IGNOREARMOUR, TF_TD_SHOT);
}
}
@ -1394,6 +1394,7 @@ void() W_FireSniperRifle =
Multi_Finish (FALSE);
};
#ifndef NO_AUTORIFLE
/*
===================================
TeamFortress : W_FireAutoRifle
@ -1402,34 +1403,22 @@ TeamFortress : W_FireAutoRifle
// same as sniper rifle
void() W_FireAutoRifle =
{
local string st = infokey(NIL, "oldrifle");
local vector dir;
if (!(st == "yes" || st == "y" || st == "on" || st == "1")) {
if (self.heat < 50)
self.heat = 50;
sound (self ,CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
W_FireSniperRifle();
KickPlayer(-1, self);
self.heat += 200;
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
if (self.heat > 600)
self.heat = 600;
} else {
local vector dir;
sound (self ,CHAN_WEAPON, "weapons/sniper.wav", 1, ATTN_NORM);
KickPlayer(-1, self);
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
makevectors(self.v_angle);
dir = v_forward;
deathmsg = DMSG_AUTORIFLE;
FireSniperBullet (dir, 8);
}
makevectors(self.v_angle);
dir = v_forward;
deathmsg = DMSG_AUTORIFLE;
FireSniperBullet (dir, 8);
};
#endif
/*
================
TeamFortress : W_FireAssaultCannon
@ -2368,6 +2357,7 @@ void() W_SetCurrentAmmo =
}
self.items = self.items | IT_SHELLS;
self.weapon = IT_SHOTGUN;
#ifndef NO_AUTORIFLE
} else if (self.current_weapon == WEAP_AUTO_RIFLE) {
self.currentammo = self.ammo_shells;
if (!(self.tfstate & TFSTATE_RELOADING)) {
@ -2376,6 +2366,7 @@ void() W_SetCurrentAmmo =
}
self.items = self.items | IT_SHELLS;
self.weapon = IT_SUPER_SHOTGUN;
#endif
} else if (self.current_weapon == WEAP_ASSAULT_CANNON) {
self.currentammo = self.ammo_shells;
if (!(self.tfstate & TFSTATE_RELOADING)) {
@ -2541,6 +2532,9 @@ float() W_CheckNoAmmo =
} else if (self.current_weapon == WEAP_DAEDALUS) {
if (self.currentammo >= 5)
return TRUE;
} else if (self.current_weapon == WEAP_SNIPER_RIFLE) {
if (self.currentammo >= 5)
return TRUE;
} else if (self.currentammo > 0)
return TRUE;
@ -2772,7 +2766,9 @@ void() player_light1;
void() player_light_assault1;
void() player_rocket1;
#ifndef NO_AUTORIFLE
void() player_autorifle1;
#endif
void() player_assaultcannon1;
void() player_assaultcannonup1;
void() player_assaultcannondown1;
@ -2933,10 +2929,12 @@ void() W_Attack =
W_FireSniperRifle();
Attack_Finished(SNIPER_RIFLE_RELOAD_TIME);
}
#ifndef NO_AUTORIFLE
} else if (self.current_weapon == WEAP_AUTO_RIFLE) {
player_autorifle1();
W_FireAutoRifle();
Attack_Finished(0.1);
#endif
} else if (self.current_weapon == WEAP_ASSAULT_CANNON) {
// Need 4 cells to power up the Assault Cannon
if (self.ammo_cells < 4) {
@ -3050,8 +3048,10 @@ void() W_PrintWeaponMessage =
sprint(self, PRINT_MEDIUM, "Pipebomb mode\n");
} else if (self.current_weapon == WEAP_SNIPER_RIFLE)
sprint(self, PRINT_MEDIUM, "Sniper Rifle ready\n");
#ifndef NO_AUTORIFLE
else if (self.current_weapon == WEAP_AUTO_RIFLE)
sprint(self, PRINT_MEDIUM, "Rifle on fully auto\n");
#endif
else if (self.current_weapon == WEAP_TRANQ)
sprint(self, PRINT_MEDIUM, "Tranquiliser gun selected\n");
else if (self.current_weapon == WEAP_MEDIKIT)
@ -3186,13 +3186,18 @@ void() W_ChangeWeapon =
am = 1;
}
} else if (self.impulse == 3) {
if (!((it & WEAP_AUTO_RIFLE && self.ammo_shells > 0) || (it & WEAP_SUPER_SHOTGUN && self.ammo_shells >1)))
if (!(
#ifndef NO_AUTORIFLE
(it & WEAP_AUTO_RIFLE && self.ammo_shells > 0) ||
#endif
(it & WEAP_SUPER_SHOTGUN && self.ammo_shells >1)))
have_weapon = FALSE;
loopck = 0;
while (!usable && have_weapon) {
loopck = (loopck + 1);
if (loopck >= 10)
have_weapon = FALSE;
#ifndef NO_AUTORIFLE
if (fl == WEAP_AUTO_RIFLE) {
fl = WEAP_SUPER_SHOTGUN;
if (it & WEAP_SUPER_SHOTGUN && self.ammo_shells > 1)
@ -3202,6 +3207,13 @@ void() W_ChangeWeapon =
if (it & WEAP_AUTO_RIFLE && self.ammo_shells > 0)
usable = 1;
}
#else
fl = WEAP_SUPER_SHOTGUN;
if (it & WEAP_SUPER_SHOTGUN && self.ammo_cells > 1)
usable = 1;
else
have_weapon = FALSE;
#endif
}
if (fl == WEAP_SUPER_SHOTGUN) {
@ -3473,13 +3485,15 @@ void() CycleWeaponCommand =
am = 1;
} else if (self.current_weapon == WEAP_TRANQ) {
self.current_weapon = WEAP_SNIPER_RIFLE;
if (self.ammo_shells < 1)
if (self.ammo_shells < 5)
am = 1;
} else if (self.current_weapon == WEAP_SNIPER_RIFLE) {
#ifndef NO_AUTORIFLE
self.current_weapon = WEAP_AUTO_RIFLE;
if (self.ammo_shells < 1)
am = 1;
} else if (self.current_weapon == WEAP_AUTO_RIFLE) {
#endif
self.current_weapon = WEAP_MAUSER;
if (self.ammo_nails < 1)
am = 1;
@ -4102,8 +4116,6 @@ void() W_WeaponFrame =
player_run ();
}
if (self.current_weapon == WEAP_AUTO_RIFLE) // BUG BUG BUG! GIVES ADVANTAGE TO HIGH FPSERS
self.heat -= 1000 * frametime;
// check for attack
if (self.button0 && !(self.fire_held_down)) {
if ((self.current_menu == MENU_CLASSHELP) || (self.current_menu == MENU_CLASSHELP2)) {
@ -4112,7 +4124,9 @@ void() W_WeaponFrame =
Attack_Finished(0.2);
} else if (self.current_weapon == WEAP_SNIPER_RIFLE) {
if (self.tfstate & TFSTATE_AIMING) {
if (self.height > 30) {
if (!W_CheckNoAmmo())
self.tfstate &= ~TFSTATE_AIMING;
else if (self.height > 30) {
self.height = self.height - 5;
TF_zoom(self.height);
}
@ -4120,7 +4134,7 @@ void() W_WeaponFrame =
tv = self.velocity;
tv_z = 0;
if (vlen(tv) <= WEAP_SNIPER_RIFLE_MAX_MOVE) {
if (vlen(tv) <= WEAP_SNIPER_RIFLE_MAX_MOVE && W_CheckNoAmmo()) {
// create the laser sight
SniperSight_Create(0);
self.heat = 30; // damage done