Module dpmod: Change committed

havoc at icculus.org havoc at icculus.org
Sat Sep 28 02:59:51 EDT 2002


Commiter   : havoc
CVSROOT    : /cvs/cvsroot/twilight
Module     : dpmod
Commit time: 2002-09-28 06:59:51 UTC

Log message:

code for spiralling rockets (not used, because 3 rockets was just too powerful)
rocket launcher is now a dual rocket launcher - alternates left and right, or fire both with button3

Modified files:
     qc/rocket.qc qc/w_rocket.qc

------=MIME.48beb0766c72cf077f69b62e70714390
Content-Type: text/plain; name="dpmod.20020928.065951.havoc.diff"
Content-Disposition: attachment; filename="dpmod.20020928.065951.havoc.diff"
Content-Transfer-Encoding: 8bit

Index: dpmod/qc/rocket.qc
diff -u dpmod/qc/rocket.qc:1.2 dpmod/qc/rocket.qc:1.3
--- dpmod/qc/rocket.qc:1.2	Fri Sep 20 01:59:12 2002
+++ dpmod/qc/rocket.qc	Sat Sep 28 02:59:40 2002
@@ -33,6 +33,12 @@
 	remove(self);
 };
 
+void() MissileDet =
+{
+	self.think = MissileExplode;
+	self.nextthink = time;
+}
+
 void() MissileTouch =
 {
 	local   vector  v;
@@ -104,17 +110,14 @@
 	newmis.classname = "missile";
 	newmis.deathtype = dethtype;
 	newmis.obitfunc1 = obitfunc;
-	newmis.velocity = /*own.velocity + */dir * 20;
+	newmis.velocity = dir * 20;
 	newmis.dest = dir;
 	newmis.angles = vectoangles(dir);
 	newmis.touch = MissileTouch;
 	newmis.think = MissileThink;
-	newmis.th_die = MissileExplode;
+	newmis.th_die = MissileDet;
 	newmis.nextthink = time;
-	//if (own.weapon == IT_WEAPON4)
-	//	newmis.takedamage = DAMAGE_NO;
-	//else
-		newmis.takedamage = DAMAGE_YES;
+	newmis.takedamage = DAMAGE_YES;
 	newmis.health = 40;     // can be detonated inflight
 	newmis.cnt = time + 15; // 15 seconds max flight time
 	newmis.dmg = damg * damagescale;
@@ -133,3 +136,80 @@
 	setorigin (newmis, org);
 };
 
+void() MissileSpiralThink =
+{
+	local float p;
+
+	if (!self.enemy.health)
+	{
+		MissileExplode();
+		return;
+	}
+
+	self.nextthink = time;
+	fightdone = time + 1; // delay stuff until fighting is over
+
+	makevectors(self.enemy.angles + '0 0 720' * (time - self.weapon));
+	p = (time - self.weapon) * 4;
+	if (p > 1)
+		p = 1;
+	p = p * self.lefty;
+	tracebox(self.origin, self.mins, self.maxs, self.enemy.origin + v_right * p + v_up * p, FALSE, self);
+	setorigin(self, trace_endpos);
+
+	self.velocity = self.enemy.velocity;
+	self.angles = vectoangles(self.velocity);
+
+	p = pointcontents(self.origin);
+	if (p == CONTENT_SKY)
+		remove(self);
+	if (time > self.cnt || p == CONTENT_SOLID || p == CONTENT_LAVA || (trace_fraction < 1 && trace_ent != self.owner))
+	{
+		MissileExplode();
+		return;
+	}
+};
+
+entity spiralmissile_orbitentity;
+void(vector org, vector dir, entity own, float damg, float blastradius, string dethtype, void(entity t, entity a, string m, float dtyp) obitfunc, float orbitdistance) LaunchSpiralMissile =
+{
+	fightdone = time + 1; // delay stuff until fighting is over
+	newmis = spawn ();
+	//newmis.cantrigger = TRUE; // can trigger buttons
+	newmis.shoulddodge = TRUE;
+	newmis.dangerrating = 150;
+	newmis.owner = own;
+	newmis.createdtime = time;
+	newmis.movetype = MOVETYPE_FLY;
+	newmis.solid = SOLID_BBOX; // only solid so it can be shot
+	newmis.classname = "missile";
+	newmis.deathtype = dethtype;
+	newmis.obitfunc1 = obitfunc;
+	newmis.velocity = dir * 20;
+	newmis.lefty = orbitdistance;
+	newmis.dest = dir;
+	newmis.weapon = time;
+	newmis.enemy = spiralmissile_orbitentity;
+	newmis.angles = vectoangles(dir);
+	newmis.touch = MissileTouch;
+	newmis.think = MissileSpiralThink;
+	newmis.th_die = MissileDet;
+	newmis.nextthink = time;
+	newmis.takedamage = DAMAGE_YES;
+	newmis.health = 40;     // can be detonated inflight
+	newmis.cnt = time + 15; // 15 seconds max flight time
+	newmis.dmg = damg * damagescale;
+	newmis.dmg2 = blastradius;
+	newmis.wait = time;
+	newmis.effects = EF_LOWPRECISION;
+
+	if (own.items & IT_QUAD)
+	{
+		newmis.dmg = newmis.dmg * 4;
+		newmis.effects = newmis.effects | EF_BLUE;
+	}
+
+	setmodel (newmis, "progs/missile.mdl");
+	setsize (newmis, '0 0 0', '0 0 0');
+	setorigin (newmis, org);
+};
Index: dpmod/qc/w_rocket.qc
diff -u dpmod/qc/w_rocket.qc:1.2 dpmod/qc/w_rocket.qc:1.3
--- dpmod/qc/w_rocket.qc:1.2	Fri Sep 20 01:59:12 2002
+++ dpmod/qc/w_rocket.qc	Sat Sep 28 02:59:40 2002
@@ -15,20 +15,12 @@
 			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 ";
-				if (dmsg == "ROCKET1")
-					deathstring4 = "'s rocket";
-				else
-					deathstring4 = "'s rockets";
+				deathstring4 = "'s rocket";
 			}
 			else
 			{
@@ -100,38 +92,78 @@
 		Obituary_Fallback(targ, attacker, dmsg, dtype);
 }
 
-void() W_RocketFireCode =
+void() W_RocketFire =
 {
 	self.wfiretime = time;
 	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 - 1;
+	if (self.wload)
 	{
-		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);
+		w_muzzleflash(shotorg + v_right * 6, 10);
+		LaunchMissile(shotorg + v_right * 6, shotdir, self, 150, 200, "ROCKET", 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);
+		w_muzzleflash(shotorg - v_right * 6, 10);
+		LaunchMissile(shotorg - v_right * 6, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket);
 	}
+	self.wload = !self.wload;
+};
 
-	self.wload = 0;
+void() W_RocketFireDual =
+{
+	self.wfiretime = time;
+	self.flags = self.flags - (self.flags & FL_ONGROUND);
+	self.velocity = self.velocity - shotdir * 150;
+	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	w_muzzleflash(shotorg + v_right * 6, 10);
+	LaunchMissile(shotorg + v_right * 6, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket);
+	if (self.ammo_rockets < 1)
+		return;
+	w_muzzleflash(shotorg - v_right * 6, 10);
+	LaunchMissile(shotorg - v_right * 6, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket);
 };
 
+void() W_RocketFireTriple =
+{
+	self.wfiretime = time;
+	self.flags = self.flags - (self.flags & FL_ONGROUND);
+	self.velocity = self.velocity - shotdir * 450;
+	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	w_muzzleflash(shotorg, 10);
+	LaunchMissile(shotorg, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket);
+	if (self.ammo_rockets < 1)
+		return;
+	w_muzzleflash(shotorg + v_right * 8, 10);
+	LaunchMissile(shotorg + v_right * 8, shotdir + v_right * 0.025, self, 150, 200, "ROCKET", Obituary_Rocket);
+	if (self.ammo_rockets < 1)
+		return;
+	w_muzzleflash(shotorg - v_right * 8, 10);
+	LaunchMissile(shotorg - v_right * 8, shotdir - v_right * 0.025, self, 150, 200, "ROCKET", Obituary_Rocket);
+	self.wload = !self.wload;
+};
+
+void() W_RocketFireTripleSpiral =
+{
+	self.wfiretime = time;
+	self.flags = self.flags - (self.flags & FL_ONGROUND);
+	self.velocity = self.velocity - shotdir * 450;
+	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	w_muzzleflash(shotorg, 10);
+	LaunchMissile(shotorg, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket);
+	spiralmissile_orbitentity = newmis;
+	if (self.ammo_rockets < 1)
+		return;
+	w_muzzleflash(shotorg + v_right * 8, 10);
+	LaunchSpiralMissile(shotorg, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket, -4);
+	if (self.ammo_rockets < 1)
+		return;
+	w_muzzleflash(shotorg - v_right * 8, 10);
+	LaunchSpiralMissile(shotorg, shotdir, self, 150, 200, "ROCKET", Obituary_Rocket, 4);
+	self.wload = !self.wload;
+};
+
 void() w_rocketdrop1;
 void() w_rocketdrop2;
 void() w_rocketraise1;
@@ -140,31 +172,25 @@
 {
 	if (widle(w_rocketdrop1))
 		return;
-
-	if (self.wload > self.ammo_rockets)
-		self.wload = self.ammo_rockets;
 
-	if (time >= self.attack_finished)
+	if (self.button3)
+		W_GenericSlowFireCode("weapons/sgun1.wav", 1.2, W_RocketFireDual);
+	//	W_GenericSlowFireCode("weapons/sgun1.wav", 1.2, W_RocketFireTripleSpiral);
+	/*
 	{
-		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);
+		if (self.button0)
+			W_GenericSlowFireCode("weapons/sgun1.wav", 1.2, W_RocketFireTriple);
 		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);
-			}
-		}
+			self.wburst = 1;
+	}
+	else if (self.wburst)
+	{
+		self.wburst = 0;
+		W_GenericSlowFireCode("weapons/sgun1.wav", 1.2, W_RocketFireTripleSpiral);
 	}
+	*/
+	else if (self.button0)
+		W_GenericSlowFireCode("weapons/sgun1.wav", 0.5, W_RocketFire);
 
 	if (self.wfiretime)
 	{
@@ -192,7 +218,7 @@
 float(float request) setweapon7 = {return weapongeneric(IT_WEAPON7, self.ammo_rockets >= 1, request, w_rocketsetup, w_rocket, w_rocketraise1, w_rocketaim, w_rocketrating, "Rocket Launcher");};
 
 void() w_rocketraise1 = {wraise(8, w_rocketraise2, 0.1);};
-void() w_rocketraise2 = {wraise(7, w_rocket, 0.1);};
+void() w_rocketraise2 = {self.wload = 0;wraise(7, w_rocket, 0.1);};
 
 void() w_rocketdrop1 = {wdrop(7, w_rocketdrop2, 0.1);};
 void() w_rocketdrop2 = {wdropped(8, 0.1);};


More information about the twilight-commits mailing list