Module dpmod: Change committed

havoc at icculus.org havoc at icculus.org
Fri Sep 20 01:59:23 EDT 2002


Commiter   : havoc
CVSROOT    : /cvs/cvsroot/twilight
Module     : dpmod
Commit time: 2002-09-20 05:59:22 UTC

Log message:

many weapon changes
plasma now has sort of a 'charge' behavior - if you stop firing the charge is reset to 8 cells, if you keep firing it depletes the charge, when it runs out it has to reload (takes just .2 seconds - 2 shots worth of time), if firing in sniper mode it depletes the entire remaining charge (presumably this is a full charge, since it's unlikely you would zoom in while firing rapidly)
rocket launcher can load up to 3 rockets (hold altfire until it has loaded 2, or 3, use primary to fire them)
rocket launcher now has a new death message for multiple rocket attacks - '* met a rocket storm from *'
grenade launcher primary fire is now impact grenades, altfire is proximity grenades
W_GenericFireCode has been split into W_GenericRapidFireCode (which keeps the existing behavior) and W_GenericSlowFireCode (which has none of the weird attack_finished hacking or other nuisances)
some cruft removed
some code cleaning
grenades no longer have momentum of player firing them (absolute velocity instead of relative)

Modified files:
     qc/rocket.qc qc/w_common.qc qc/w_dbshotgun.qc qc/w_defs.qc
     qc/w_grapple.qc qc/w_grenade.qc qc/w_nailgun.qc qc/w_pistol.qc
     qc/w_plasmarifle.qc qc/w_rocket.qc qc/w_shotgun.qc
     qc/w_supernailgun.qc

------=MIME.33d64e87d9f4aff31fabc741ddc3083a
Content-Type: text/plain; name="dpmod.20020920.055922.havoc.diff"
Content-Disposition: attachment; filename="dpmod.20020920.055922.havoc.diff"
Content-Transfer-Encoding: 8bit

Index: dpmod/qc/rocket.qc
diff -u dpmod/qc/rocket.qc:1.1.1.1 dpmod/qc/rocket.qc:1.2
--- dpmod/qc/rocket.qc:1.1.1.1	Thu Sep 19 15:08:24 2002
+++ dpmod/qc/rocket.qc	Fri Sep 20 01:59:12 2002
@@ -81,7 +81,7 @@
 	}
 	self.angles = vectoangles(self.velocity);
 	p = pointcontents(self.origin);
-	if ((self.owner.button3 && self.owner.weapon == IT_WEAPON7) || time > self.cnt || p == CONTENT_SOLID || p == CONTENT_LAVA)
+	if (/*(self.owner.button3 && self.owner.weapon == IT_WEAPON7) || */time > self.cnt || p == CONTENT_SOLID || p == CONTENT_LAVA)
 	{
 		MissileExplode();
 		return;
Index: dpmod/qc/w_common.qc
diff -u dpmod/qc/w_common.qc:1.1.1.1 dpmod/qc/w_common.qc:1.2
--- dpmod/qc/w_common.qc:1.1.1.1	Thu Sep 19 15:07:36 2002
+++ dpmod/qc/w_common.qc	Fri Sep 20 01:59:12 2002
@@ -69,10 +69,8 @@
 
 .float notfiring;
 
-void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericFireCode =
+void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericRapidFireCode =
 {
-	local   float   nextshotdelay;
-
 	if (time < self.attack_finished) // still busy with the last shot
 		return;
 
@@ -84,20 +82,35 @@
 		self.attack_finished = time;
 	self.notfiring = FALSE;
 
-	if (firingsound != "")
-		sound (self, CHAN_WEAPON, firingsound, 1, ATTN_NORM);
-	SuperDamageSound();
-
 	// wake up monsters
 	self.show_hostile = time + 1;
 	weaponwakeup(self.origin, self);
+	SuperDamageSound();
+	if (firingsound != "")
+		sound (self, CHAN_WEAPON, firingsound, 1, ATTN_NORM);
 
 	while (time >= self.attack_finished && !stopfiring)
 	{
 		self.attack_finished = self.attack_finished + nextshotdelay;
 		uniquefunc();
 	}
+};
+
+void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericSlowFireCode =
+{
+	if (time < self.attack_finished) // still busy with the last shot
+		return;
+	
+	// wake up monsters
+	self.show_hostile = time + 1;
+	weaponwakeup(self.origin, self);
+	fightdone = time + 1; // delay stuff until fighting is over
+	SuperDamageSound();
+	if (firingsound != "")
+		sound (self, CHAN_WEAPON, firingsound, 1, ATTN_NORM);
 
+	self.attack_finished = time + nextshotdelay;
+	uniquefunc();
 };
 
 float(float haveammo) W_CheckNoAmmo =
@@ -114,8 +127,6 @@
 
 float(float w, float hasammo, float request, void() setupfunc, void() activefunc, void() raisefunc, vector(vector srcvec, vector dstvec) aimfunc, float() ratingfunc, string wname) weapongeneric =
 {
-	local string s;
-	local vector v;
 	if (request == WR_SETUP)
 	{
 		setupfunc();
Index: dpmod/qc/w_dbshotgun.qc
diff -u dpmod/qc/w_dbshotgun.qc:1.1.1.1 dpmod/qc/w_dbshotgun.qc:1.2
--- dpmod/qc/w_dbshotgun.qc:1.1.1.1	Thu Sep 19 15:08:09 2002
+++ dpmod/qc/w_dbshotgun.qc	Fri Sep 20 01:59:12 2002
@@ -62,14 +62,12 @@
 void() W_DBShotgunSingleFireCode =
 {
 	W_DBShotgunFireShell(Obituary_DBShotgunSingle);
-	stopfiring = TRUE;
 };
 
 void() W_DBShotgunDoubleFireCode =
 {
 	while (self.wload >= 1)
 		W_DBShotgunFireShell(Obituary_DBShotgunDouble);
-	stopfiring = TRUE;
 };
 
 /*
@@ -80,9 +78,7 @@
 
 void() W_DBShotgunMineFireCode =
 {
-	stopfiring = TRUE;
 	self.wfiretime = time;
-
 	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 	w_muzzleflash(shotorg, 3);
 	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 200, 250, MINE_PROXIMITY | MINE_DETONATEONBUTTON3, 2.5, "DBSHOTGUNMINE", Obituary_DBShotgunMine);
@@ -112,9 +108,7 @@
 
 void() W_DBShotgunGrenadeFireCode =
 {
-	stopfiring = TRUE;
 	self.wfiretime = time;
-
 	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 	w_muzzleflash(shotorg, 3);
 	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 200, 250, GRENADE_IMPACT, 2.5, "DBSHOTGUNGRENADE", Obituary_DBShotgunGrenade);
@@ -127,8 +121,7 @@
 void() w_dbshotgunraise2;
 void() w_dbshotgun =
 {
-	local string s;
-	local vector a, v;
+	local vector v;
 
 	if (self.wload > self.ammo_shells)
 		self.wload = self.ammo_shells;
@@ -136,17 +129,17 @@
 	if (self.button0)
 	{
 		if (self.wload > 0)
-			W_GenericFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunDoubleFireCode);
-			//W_GenericFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunSingleFireCode);
+			W_GenericSlowFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunDoubleFireCode);
+			//W_GenericSlowFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunSingleFireCode);
 	}
 	else if (self.button3)
 	{
 		/*
 		if (self.wload > 0)
-			W_GenericFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunDoubleFireCode);
+			W_GenericSlowFireCode("weapons/shotgn2.wav", 0.2, W_DBShotgunDoubleFireCode);
 		*/
 		if (self.ammo_rockets > 0)
-			W_GenericFireCode("weapons/grenade.wav", 0.8, W_DBShotgunGrenadeFireCode);
+			W_GenericSlowFireCode("weapons/grenade.wav", 0.8, W_DBShotgunGrenadeFireCode);
 	}
 	else
 		self.notfiring = TRUE;
Index: dpmod/qc/w_defs.qc
diff -u dpmod/qc/w_defs.qc:1.1.1.1 dpmod/qc/w_defs.qc:1.2
--- dpmod/qc/w_defs.qc:1.1.1.1	Thu Sep 19 15:07:24 2002
+++ dpmod/qc/w_defs.qc	Fri Sep 20 01:59:12 2002
@@ -22,10 +22,11 @@
 
 .float  switchweapon; // desired weapon (current weapon will switch to it when idle)
 
-float   stopfiring; // used by w_genericfirecode system
+float   stopfiring; // used by W_GenericRapidFireCode system
 
 vector  shotorg, shotdir;
-void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericFireCode;
+void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericRapidFireCode;
+void(string firingsound, float nextshotdelay, void() uniquefunc) W_GenericSlowFireCode;
 float(float minrange, float preferredrange, float baserating) genericweaponrating;
 
 float(float w, float request) setweapon;
Index: dpmod/qc/w_grapple.qc
diff -u dpmod/qc/w_grapple.qc:1.1.1.1 dpmod/qc/w_grapple.qc:1.2
--- dpmod/qc/w_grapple.qc:1.1.1.1	Thu Sep 19 15:07:48 2002
+++ dpmod/qc/w_grapple.qc	Fri Sep 20 01:59:12 2002
@@ -169,8 +169,7 @@
 void() W_GrappleFireCode =
 {
 	self.wfiretime = time;
-	self.effects = self.effects | EF_MUZZLEFLASH;
-	self.punchangle_x = -2;
+	w_muzzleflash(shotorg, 1);
 	FireGrapple(self, shotorg, shotdir);
 };
 
@@ -186,12 +185,10 @@
 	if (self.button0) // fire
 	{
 		if (!self.grapple)
-			W_GenericFireCode("weapons/sgun1.wav", 0.5, W_GrappleFireCode);
+			W_GenericSlowFireCode("weapons/sgun1.wav", 0.5, W_GrappleFireCode);
 	}
 	// else if (self.button3)
 		// FIXME: add chainsaw
-	else
-		self.notfiring = TRUE;
 
 	if (self.wfiretime)
 	{
Index: dpmod/qc/w_grenade.qc
diff -u dpmod/qc/w_grenade.qc:1.1.1.1 dpmod/qc/w_grenade.qc:1.2
--- dpmod/qc/w_grenade.qc:1.1.1.1	Thu Sep 19 15:07:16 2002
+++ dpmod/qc/w_grenade.qc	Fri Sep 20 01:59:12 2002
@@ -28,98 +28,44 @@
 		Obituary_Fallback(targ, attacker, dmsg, dtype);
 };
 
-void() W_GrenadeFireCode =
+void() W_GrenadeFireImpact =
 {
-	//local vector v;
-	//local float c;
 	stopfiring = TRUE;
 	self.wfiretime = time;
-	self.wburst = self.wburst - 1;
-//	self.punchangle_x = -2;
+	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	w_muzzleflash(shotorg, 3);
+	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200/* + self.velocity*/, self, 150, 200, GRENADE_IMPACT, 25, "GRENADE", Obituary_Grenade);
+};
 
+void() W_GrenadeFireProximity =
+{
+	stopfiring = TRUE;
+	self.wfiretime = time;
 	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
-//	self.effects = self.effects | EF_MUZZLEFLASH;
 	w_muzzleflash(shotorg, 3);
-	/*
-	c = 1;
-	v = '0 0 0';
-	while (c > 0)
-	{
-		c = c - 1;
-		if (self.button3)
-			v = randomvec() * 150;
-		LaunchGrenade(shotorg, shotdir * 2000 + v_up * 0 + v + self.velocity, self, 150, 120, GRENADE_IMPACT + GRENADE_IMMUNETODAMAGE, 5, "GRENADE", Obituary_Grenade);
-	}
-	*/
-	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 60, 120, GRENADE_TENWARHEAD + GRENADE_PROXIMITY + GRENADE_DETONATEONBUTTON3, 5, "GRENADE", Obituary_Grenade);
-	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 120, 120, GRENADE_PROXIMITY + GRENADE_DETONATEONBUTTON3, 2.5, "GRENADE", Obituary_Grenade);
-	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 100, 250, GRENADE_PROXIMITY, 15, "GRENADE", Obituary_Grenade);
-	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 200, 250, GRENADE_PROXIMITY, 15, "GRENADE", Obituary_Grenade);
-	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 220, 250, GRENADE_IMPACT, 2.5, "GRENADE", Obituary_Grenade);
+	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200/* + self.velocity*/, self, 100, 150, GRENADE_PROXIMITY, 5, "GRENADE", Obituary_Grenade);
 };
 
-//.float grenadetracetime;
 void() w_grenadedrop1;
 void() w_grenadedrop2;
 void() w_grenaderaise1;
 void() w_grenaderaise2;
 void() w_grenade =
 {
-	local vector v;
 	local float c;
 	if (widle(w_grenadedrop1))
 		return;
 
 	if (self.button0)
 	{
-		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireCode);
-	}
-	else
-	{
-		self.notfiring = TRUE;
-	}
-	/*
-	if (self.wburst > 0)
-	{
-		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.05, W_GrenadeFireCode);
-	}
-	else if (self.button0)
-	{
 		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireCode);
+			W_GenericSlowFireCode("weapons/grenade.wav", 0.5, W_GrenadeFireImpact);
 	}
 	else if (self.button3)
 	{
-		self.wburst = 10;
-		//if (self.ammo_rockets >= 1)
-		//	W_GenericFireCode("weapons/grenade.wav", 0.05, W_GrenadeFireCode);
-	}
-	else
-	{
-		self.notfiring = TRUE;
-	}
-
-	if (time > self.grenadetracetime)
-	{
-		self.grenadetracetime = time + 0.1;
-		c = 4;
-		newmis = spawn();
-		newmis.solid = SOLID_BBOX;
-		newmis.movetype = MOVETYPE_TOSS;
-		newmis.owner = self;
-		while (c > 0)
-		{
-			c = c - 1;
-			newmis.velocity = self.velocity + shotdir * 2000 + v_up * 0 + randomvec() * 150;
-			setorigin(newmis, shotorg);
-			tracetoss(newmis, self);
-			particle(trace_endpos, '0 0 0', 232, 30);
-		}
-		remove(newmis);
+		if (self.ammo_rockets >= 1)
+			W_GenericSlowFireCode("weapons/grenade.wav", 0.8, W_GrenadeFireProximity);
 	}
-	*/
 
 	if (self.wfiretime)
 	{
Index: dpmod/qc/w_nailgun.qc
diff -u dpmod/qc/w_nailgun.qc:1.1.1.1 dpmod/qc/w_nailgun.qc:1.2
--- dpmod/qc/w_nailgun.qc:1.1.1.1	Thu Sep 19 15:07:34 2002
+++ dpmod/qc/w_nailgun.qc	Fri Sep 20 01:59:12 2002
@@ -44,29 +44,6 @@
 	if (self.ammo_nails < 1) {stopfiring = TRUE;return;}
 };
 
-/*
-void(entity targ, entity attacker, string dmsg, float dtype) Obituary_NailgunGrenade =
-{
-	if (dtype == DTYPE_PLAYER)
-	{
-		deathstring1 = targ.netname;
-		deathstring3 = attacker.netname;
-		if (targ.bodyhealth < 1) // gib
-		{
-			deathstring2 = " ate one of ";
-			deathstring4 = "'s porcupines";
-		}
-		else
-		{
-			deathstring2 = " was torn up by ";
-			deathstring4 = "'s nail grenade";
-		}
-	}
-	else
-		Obituary_Fallback(targ, attacker, dmsg, dtype);
-};
-*/
-
 void(entity targ, entity attacker, string dmsg, float dtype) Obituary_NailgunMine =
 {
 	if (dtype == DTYPE_PLAYER)
@@ -98,68 +75,14 @@
 
 void() W_NailgunGrenadeFireCode =
 {
-	stopfiring = TRUE;
 	self.wfiretime = time;
-
 	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
 	w_muzzleflash(shotorg, 3);
 	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 80, 300, GRENADE_IMPACT, 2.5, "NAILGUNGRENADE", Obituary_NailgunGrenade);
-	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 200, 70, MINE_LASERTRIP | MINE_DETONATEONBUTTON3, 60, "LASERTRIPMINE", Obituary_NailgunMine);
-};
-
-/*
-void(entity targ, entity attacker, string dmsg, float dtype) Obituary_ProximityMine =
-{
-	Obituary_Fallback(targ, attacker, dmsg, dtype);
-};
-
-void() W_NailgunMineFireCode =
-{
-	stopfiring = TRUE;
-	self.wfiretime = time;
-
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
-	w_muzzleflash(shotorg, 3);
-	//LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 300, 60, MINE_LASERTRIP | MINE_DETONATEONBUTTON3, 60, "LASERTRIPMINE", Obituary_LaserTripMine);
-	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 100, 120, MINE_PROXIMITY | MINE_TENWARHEAD | MINE_DETONATEONBUTTON3, 60, "PROXIMITYMIRV", Obituary_ProximityMine);
+	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 200, 70, MINE_LASERTRIP, 60, "LASERTRIPMINE", Obituary_NailgunMine);
 };
-*/
 
-/*
-void(entity targ, entity attacker, string dmsg, float dtype) Obituary_NailgunRocket =
-{
-	if (dtype == DTYPE_PLAYER)
-	{
-		deathstring1 = targ.netname;
-		deathstring3 = attacker.netname;
-		if (targ.bodyhealth < 1) // gib
-		{
-			deathstring2 = " was torn asunder by ";
-			deathstring4 = "'s rocket";
-		}
-		else
-		{
-			deathstring2 = "'s world was rocked by ";
-			deathstring4 = "";
-		}
-	}
-	else
-		Obituary_Fallback(targ, attacker, dmsg, dtype);
-}
 
-void() W_NailgunRocketFireCode =
-{
-	if (self.ammo_rockets < 0.2) {stopfiring = TRUE;return;}
-	fightdone = time + 1; // delay stuff until fighting is over
-	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 0.2;
-	w_muzzleflash(shotorg, 1);
-	LaunchMissile(shotorg, shotdir, self, 30, 60, "NAILGUNROCKET", Obituary_NailgunRocket);
-	if (self.ammo_rockets < 0.2) {stopfiring = TRUE;return;}
-};
-*/
-
-
 void() w_nailgundrop1;
 void() w_nailgundrop2;
 void() w_nailgunraise1;
@@ -172,29 +95,15 @@
 	if (self.button0)
 	{
 		if (self.ammo_nails >= 1)
-			W_GenericFireCode("weapons/rocket1i.wav", 0.1, W_NailgunFireCode);
-	}
-	/*
-	else if (self.button3)
-	{
-		if (self.ammo_rockets >= 0.2)
-			W_GenericFireCode("weapons/sgun1.wav", 0.2, W_NailgunRocketFireCode);
+			W_GenericRapidFireCode("weapons/rocket1i.wav", 0.1, W_NailgunFireCode);
 	}
-	*/
-	/*
-	else if (self.button3)
-	{
-		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.5, W_NailgunMineFireCode);
-	}
-	*/
-	else if (self.button3)
+	else
 	{
+		self.notfiring = TRUE;
+		if (self.button3)
 		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.8, W_NailgunGrenadeFireCode);
+			W_GenericSlowFireCode("weapons/grenade.wav", 0.8, W_NailgunGrenadeFireCode);
 	}
-	else
-		self.notfiring = TRUE;
 
 	if ((time - self.wfiretime) < 0.15)
 		self.weaponframe = self.wframe;
Index: dpmod/qc/w_pistol.qc
diff -u dpmod/qc/w_pistol.qc:1.1.1.1 dpmod/qc/w_pistol.qc:1.2
--- dpmod/qc/w_pistol.qc:1.1.1.1	Thu Sep 19 15:07:54 2002
+++ dpmod/qc/w_pistol.qc	Fri Sep 20 01:59:12 2002
@@ -18,7 +18,10 @@
 	w_muzzleflash(shotorg, 1);
 	ejectcasing(shotorg, shotdir, v_right * 150 + v_up * 50, 50, 0);
 	bullet_type = 4;
-	FireBullets(1, 30, 30, shotdir * 7000, 0.0125, "PISTOL", DT_NAIL, Obituary_Pistol);
+	if (self.button3)
+		FireBullets(1, 30, 30, shotdir * 7000, 0.05, "PISTOL", DT_NAIL, Obituary_Pistol);
+	else
+		FireBullets(1, 30, 30, shotdir * 7000, 0.0125, "PISTOL", DT_NAIL, Obituary_Pistol);
 };
 
 void() w_pistoldrop1;
@@ -31,9 +34,9 @@
 		return;
 
 	if (self.button0)
-		W_GenericFireCode("weapons/rocket1i.wav", 0.3, W_PistolFireCode);
-	else
-		self.notfiring = TRUE;
+		W_GenericSlowFireCode("weapons/rocket1i.wav", 0.4, W_PistolFireCode);
+	else if (self.button3)
+		W_GenericSlowFireCode("weapons/rocket1i.wav", 0.2, W_PistolFireCode);
 
 	if (self.wfiretime)
 	{
Index: dpmod/qc/w_plasmarifle.qc
diff -u dpmod/qc/w_plasmarifle.qc:1.1.1.1 dpmod/qc/w_plasmarifle.qc:1.2
--- dpmod/qc/w_plasmarifle.qc:1.1.1.1	Thu Sep 19 15:08:14 2002
+++ dpmod/qc/w_plasmarifle.qc	Fri Sep 20 01:59:12 2002
@@ -12,42 +12,25 @@
 		Obituary_Fallback(targ, attacker, dmsg, dtype);
 };
 
-void() W_PlasmaRifleFireCode =
+void() W_PlasmaRifleFireRapid =
 {
 	local vector dir;
-	local float cells;
-
-	if (self.ammo_cells < 1)
-	{
-		stopfiring = TRUE;
-		return;
-	}
-
-	cells = floor(self.wload);
-	if (cells > self.ammo_cells)
-		cells = self.ammo_cells;
-	self.wload = 0;
-	self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+	self.wload = self.wload - 1;
+	self.currentammo = self.ammo_cells = self.ammo_cells - 1;
 	self.wfiretime = time;
-
-	if (self.viewzoom < 1)
-	{
-		dir = shotdir;
-
-		//FireBullets(self, self, shotorg, 4, 1, cells * 30, cells * 30, dir * 10000, 0, "PLASMARIFLE", DT_NAIL, Obituary_PlasmaRifle);
-		FirePlasma(self, shotorg, dir, cells * 30, 105, '0 0 0', "PLASMARIFLE", Obituary_PlasmaRifle);
-	}
-	else
-	{
-		dir = shotdir + randomvec() * 0.03;
-		w_muzzleflash(shotorg, 1);
-
-		//FireBullets(self, self, shotorg, 4, 1, cells * 30, cells * 30, dir * 10000, 0, "PLASMARIFLE", DT_NAIL, Obituary_PlasmaRifle);
-		FirePlasma(self, shotorg, dir, cells * 30, 45, '0 0 0', "PLASMARIFLE", Obituary_PlasmaRifle);
-	}
+	dir = shotdir + randomvec() * 0.03;
+	w_muzzleflash(shotorg, 1);
+	//FireBullets(self, self, shotorg, 4, 1, 30, 30, dir * 10000, 0, "PLASMARIFLE", DT_NAIL, Obituary_PlasmaRifle);
+	FirePlasma(self, shotorg, dir, 30, 45, '0 0 0', "PLASMARIFLE", Obituary_PlasmaRifle);
+};
 
-	if (self.ammo_cells < 1)
-		stopfiring = TRUE;
+void() W_PlasmaRifleFireHighPower =
+{
+	self.currentammo = self.ammo_cells = self.ammo_cells - self.wload;
+	self.wfiretime = time;
+	//FireBullets(self, self, shotorg, 4, 1, self.wload * 30, self.wload * 30, dir * 10000, 0, "PLASMARIFLE", DT_NAIL, Obituary_PlasmaRifle);
+	FirePlasma(self, shotorg, shotdir, self.wload * 30, 105, '0 0 0', "PLASMARIFLE", Obituary_PlasmaRifle);
+	self.wload = 0;
 };
 
 .float idealzoom;
@@ -58,27 +41,36 @@
 void() w_plasmarifleraise2;
 void() w_plasmarifle =
 {
+	local float charge;
 	if (widle(w_plasmarifledrop1))
 		return;
 
 	if (self.button3)
 		self.idealzoom = 0.2;
 
-	if (self.button0)
+	if (self.wload > self.ammo_cells)
+		self.wload = self.ammo_cells;
+	
+	if (self.button0 && self.wload >= 1)
 	{
 		if (self.viewzoom < 1)
-		{
-			self.wload = 4;
-			W_GenericFireCode("", 0.7, W_PlasmaRifleFireCode);
-		}
+			W_GenericSlowFireCode("", 0.3, W_PlasmaRifleFireHighPower);
 		else
+			W_GenericSlowFireCode("", 0.1, W_PlasmaRifleFireRapid);
+	}
+	else if (time > self.attack_finished)
+	{
+		charge = self.ammo_cells;
+		if (charge > 8)
+			charge = 8;
+		if (self.wload < charge)
 		{
-			self.wload = 1;
-			W_GenericFireCode("", 0.1, W_PlasmaRifleFireCode);
+			self.wload = charge;
+			self.attack_finished = time + 0.2;
+			// FIXME: need a charge sound
+			//sound (self, CHAN_WEAPON, "weapons/plasmarifle/charge.wav", 1, ATTN_NORM);
 		}
 	}
-	else
-		self.notfiring = TRUE;
 
 	if (widle(w_plasmarifledrop1))
 		return;
Index: dpmod/qc/w_rocket.qc
diff -u dpmod/qc/w_rocket.qc:1.1.1.1 dpmod/qc/w_rocket.qc:1.2
--- dpmod/qc/w_rocket.qc:1.1.1.1	Thu Sep 19 15:07:37 2002
+++ dpmod/qc/w_rocket.qc	Fri Sep 20 01:59:12 2002
@@ -2,6 +2,9 @@
 void(entity targ, entity attacker, string dmsg, float dtype) Obituary_Rocket =
 {
 	local float r;
+	//bprint("targ bodyhealth ");
+	//bprintfloat(targ.bodyhealth);
+	//bprint("\n");
 	if (dtype == DTYPE_PLAYER)
 	{
 		deathstring1 = targ.netname;
@@ -12,12 +15,20 @@
 			deathstring2 = " found out online gaming with ";
 			deathstring4 = " was a big mistake";
  		}
+		else if (targ.bodyhealth < -250 && dmsg != "ROCKET1")
+		{
+			deathstring2 = " met a rocket storm from ";
+			deathstring4 = "";
+		}
 		else if (targ.bodyhealth < -150)
 		{
 			if (random() < 0.5)
 			{
 				deathstring2 = " was mistified by ";
-				deathstring4 = "'s rocket";
+				if (dmsg == "ROCKET1")
+					deathstring4 = "'s rocket";
+				else
+					deathstring4 = "'s rockets";
 			}
 			else
 			{
@@ -91,48 +102,35 @@
 
 void() W_RocketFireCode =
 {
-	if (self.ammo_rockets < 1/* || self.wload < 1*/) {stopfiring = TRUE;return;}
-	fightdone = time + 1; // delay stuff until fighting is over
 	self.wfiretime = time;
-//	self.punchangle_x = -2;
-
-	//self.velocity = self.velocity + '0 0 40' - shotdir * 50;self.flags = self.flags - (self.flags & FL_ONGROUND);
-
-//	self.wload = self.wload - 1;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
-	w_muzzleflash(shotorg, 4);
-	//LaunchMissile(shotorg, shotdir, self, 200, 250, "ROCKET", Obituary_Rocket);
-	//LaunchMissile(shotorg, shotdir, self, 100, 250, "ROCKET", Obituary_Rocket);
-	LaunchMissile(shotorg, shotdir, self, 120, 120, "ROCKET", Obituary_Rocket);
-
-	if (self.ammo_rockets < 1 || self.wload < 1) {stopfiring = TRUE;return;}
-};
-
-/*
-void() W_RocketTripleFireCode =
-{
-	if (self.ammo_rockets < 3) {stopfiring = TRUE;return;}
-	fightdone = time + 1; // delay stuff until fighting is over
-	self.wfiretime = time;
-//	self.punchangle_x = -2;
-
-	//self.velocity = self.velocity + '0 0 40' - shotdir * 50;self.flags = self.flags - (self.flags & FL_ONGROUND);
-
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 3;
-	w_muzzleflash(shotorg, 4);
-	//LaunchMissile(shotorg, shotdir, self, 200, 250, "ROCKET", Obituary_Rocket);
-	//LaunchMissile(shotorg, shotdir, self, 100, 250, "ROCKET", Obituary_Rocket);
-	self.velocity = self.velocity - v_right * 80;
-	LaunchMissile(shotorg, shotdir, self, 120, 120, "ROCKET", Obituary_Rocket);
-	self.velocity = self.velocity + v_right * 80;
-	LaunchMissile(shotorg, shotdir, self, 120, 120, "ROCKET", Obituary_Rocket);
-	self.velocity = self.velocity + v_right * 80;
-	LaunchMissile(shotorg, shotdir, self, 120, 120, "ROCKET", Obituary_Rocket);
-	self.velocity = self.velocity - v_right * 80;
+	self.flags = self.flags - (self.flags & FL_ONGROUND);
+	if (self.wload >= 3)
+	{
+		self.velocity = self.velocity - shotdir * 150;
+		self.currentammo = self.ammo_rockets = self.ammo_rockets - 3;
+		w_muzzleflash(shotorg, 4);
+		LaunchMissile(shotorg, shotdir                , self, 120, 120, "ROCKET3", Obituary_Rocket);
+		LaunchMissile(shotorg, shotdir + v_right * 0.1, self, 120, 120, "ROCKET3", Obituary_Rocket);
+		LaunchMissile(shotorg, shotdir - v_right * 0.1, self, 120, 120, "ROCKET3", Obituary_Rocket);
+	}
+	else if (self.wload >= 2)
+	{
+		self.velocity = self.velocity - shotdir * 100;
+		self.currentammo = self.ammo_rockets = self.ammo_rockets - 2;
+		w_muzzleflash(shotorg, 4);
+		LaunchMissile(shotorg, shotdir + v_right * 0.05, self, 120, 120, "ROCKET2", Obituary_Rocket);
+		LaunchMissile(shotorg, shotdir - v_right * 0.05, self, 120, 120, "ROCKET2", Obituary_Rocket);
+	}
+	else
+	{
+		self.velocity = self.velocity - shotdir * 50;
+		self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+		w_muzzleflash(shotorg, 4);
+		LaunchMissile(shotorg, shotdir                 , self, 120, 120, "ROCKET1", Obituary_Rocket);
+	}
 
-	if (self.ammo_rockets < 3) {stopfiring = TRUE;return;}
+	self.wload = 0;
 };
-*/
 
 void() w_rocketdrop1;
 void() w_rocketdrop2;
@@ -143,38 +141,30 @@
 	if (widle(w_rocketdrop1))
 		return;
 
-	/*
-	if (self.wload < 1)
-	if (self.ammo_rockets >= 1)
-	if (time > self.attack_finished)
-	if (!self.button0)
-	if (!self.button3)
-	{
-		self.wload = 3;
-		self.attack_finished = time + 0.6;
-		sound(self, CHAN_WEAPON, "weapons/bsgload.wav", 1, ATTN_STATIC);
-	}
-	*/
+	if (self.wload > self.ammo_rockets)
+		self.wload = self.ammo_rockets;
 
-//	if (self.wload > self.ammo_rockets)
-//		self.wload = self.ammo_rockets;
-
-	if (self.button0)
-	{
-		if (self.ammo_rockets >= 1)
-		//if (self.wload >= 1)
-			W_GenericFireCode("weapons/sgun1.wav", 0.5, W_RocketFireCode);
-	}
-	/*
-	else if (self.button3)
+	if (time >= self.attack_finished)
 	{
-		if (self.ammo_rockets >= 3)
-		//if (self.wload >= 1)
-			W_GenericFireCode("weapons/sgun1.wav", 1.0, W_RocketTripleFireCode);
+		if (self.wload < 1)
+		{
+			self.wload = 1;
+			self.attack_finished = time + 0.4;
+		}
+		else if (self.button0)
+			W_GenericSlowFireCode("weapons/sgun1.wav", 0.2, W_RocketFireCode);
+		else
+		{
+			if (self.button3)
+			if (self.wload < 3)
+			if (self.wload < self.ammo_rockets)
+			{
+				self.wload = self.wload + 1;
+				self.attack_finished = time + 0.4;
+				sound(self, CHAN_WEAPON, "weapons/bsgload.wav", 1, ATTN_STATIC);
+			}
+		}
 	}
-	*/
-	else
-		self.notfiring = TRUE;
 
 	if (self.wfiretime)
 	{
Index: dpmod/qc/w_shotgun.qc
diff -u dpmod/qc/w_shotgun.qc:1.1.1.1 dpmod/qc/w_shotgun.qc:1.2
--- dpmod/qc/w_shotgun.qc:1.1.1.1	Thu Sep 19 15:07:34 2002
+++ dpmod/qc/w_shotgun.qc	Fri Sep 20 01:59:12 2002
@@ -14,20 +14,13 @@
 
 void() W_SingleShotgunFireCode =
 {
-	stopfiring = TRUE;
 	self.wfiretime = time;
 	self.currentammo = self.ammo_shells = self.ammo_shells - 1;
-
 	w_muzzleflash(shotorg, 2);
-	//bullet_type = 1;
-	//FireBullets(5, 9, 9, shotdir * 6000, 0.05, "SHOTGUN", DT_SHOTGUN, Obituary_Shotgun);
-	//bullet_type = 0;
-	//FireBullets(10, 9, 9, shotdir * 6000, 0.05, "SHOTGUN", DT_SHOTGUN, Obituary_Shotgun);
 	bullet_type = 1;
 	FireBullets(5, 5, 5, shotdir * 6000, 0.05, "SHOTGUN", DT_SHOTGUN, Obituary_Shotgun);
 	bullet_type = 0;
 	FireBullets(10, 5, 5, shotdir * 6000, 0.05, "SHOTGUN", DT_SHOTGUN, Obituary_Shotgun);
-
 	self.wload = -1;
 };
 
@@ -37,7 +30,7 @@
 void() w_shotgunraise2;
 void() w_shotgun =
 {
-	local vector a, v;
+	local vector v;
 	if (widle(w_shotgundrop1))
 		return;
 
@@ -47,7 +40,7 @@
 	if (self.button0)
 	{
 		if (self.wload >= 1) // is it loaded?
-			W_GenericFireCode("weapons/shotgn2.wav", 0.3, W_SingleShotgunFireCode);
+			W_GenericSlowFireCode("weapons/shotgn2.wav", 0.3, W_SingleShotgunFireCode);
 	}
 	else
 		self.notfiring = TRUE;
Index: dpmod/qc/w_supernailgun.qc
diff -u dpmod/qc/w_supernailgun.qc:1.1.1.1 dpmod/qc/w_supernailgun.qc:1.2
--- dpmod/qc/w_supernailgun.qc:1.1.1.1	Thu Sep 19 15:07:59 2002
+++ dpmod/qc/w_supernailgun.qc	Fri Sep 20 01:59:12 2002
@@ -71,15 +71,13 @@
 void() W_SuperNailgunMineFireCode =
 {
 	local float a;
-	stopfiring = TRUE;
 	self.wfiretime = time;
-
 	a = 3;
 	if (a > self.ammo_rockets)
 		a = self.ammo_rockets;
 	self.currentammo = self.ammo_rockets = self.ammo_rockets - a;
 	w_muzzleflash(shotorg, 3);
-	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, a * 100, a * 100 + 50, MINE_PROXIMITY | MINE_DETONATEONBUTTON3, 60, "PROXIMITYMINE", Obituary_ProximityMine);
+	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, a * 100, a * 100 + 50, MINE_PROXIMITY, 60, "PROXIMITYMINE", Obituary_ProximityMine);
 };
 
 void() w_snailgundrop1;
@@ -94,15 +92,15 @@
 	if (self.button0)
 	{
 		if (self.ammo_nails >= 1)
-			W_GenericFireCode("weapons/spike2.wav", 0.05, W_SuperNailgunFireCode);
+			W_GenericRapidFireCode("weapons/spike2.wav", 0.05, W_SuperNailgunFireCode);
 	}
-	else if (self.button3)
+	else
 	{
+		self.notfiring = TRUE;
+		if (self.button3)
 		if (self.ammo_rockets >= 1)
-			W_GenericFireCode("weapons/grenade.wav", 0.5, W_SuperNailgunMineFireCode);
+			W_GenericSlowFireCode("weapons/grenade.wav", 0.5, W_SuperNailgunMineFireCode);
 	}
-	else
-		self.notfiring = TRUE;
 
 	if ((time - self.wfiretime) < 0.15)
 		self.weaponframe = self.wframe;


More information about the twilight-commits mailing list