[nexuiz-commits] r7939 - in trunk/data: . qcsrc/server

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Sep 27 06:23:55 EDT 2009


Author: div0
Date: 2009-09-27 06:23:55 -0400 (Sun, 27 Sep 2009)
New Revision: 7939

Modified:
   trunk/data/effectinfo.txt
   trunk/data/qcsrc/server/w_rocketlauncher.qc
Log:
rocket guiding: particle effect, sound when guiding starts, to make the sudden guiding start look less odd


Modified: trunk/data/effectinfo.txt
===================================================================
--- trunk/data/effectinfo.txt	2009-09-27 10:00:31 UTC (rev 7938)
+++ trunk/data/effectinfo.txt	2009-09-27 10:23:55 UTC (rev 7939)
@@ -4451,3 +4451,52 @@
 bounce 1.5
 liquidfriction 4
 velocityjitter 16 16 16
+
+
+
+// rocket guiding start
+// smoke
+effect rocket_guide
+type alphastatic
+notunderwater
+tex 0 8
+count 10
+size 10 20
+sizeincrease 17
+alpha 300 550 556
+velocityjitter 128 128 128
+airfriction 5
+color 0x000000 0x111111
+bounce 6
+velocitymultiplier -0.3
+// underwater bubbles
+effect rocket_guide
+underwater
+count 8
+type bubble
+tex 62 62
+color 0x404040 0x808080
+size 1.5 1.5
+alpha 128 256 64
+gravity -0.125
+bounce 1.5
+liquidfriction 0.25
+originjitter 8 8 8
+velocityjitter 48 48 48
+velocitymultiplier -0.3
+// bouncing sparks
+effect rocket_guide
+notunderwater
+count 16
+type spark
+color 0x903010 0xFFD030
+size 2 2
+tex 40 40
+alpha 256 256 384
+gravity 1
+airfriction 0.2
+bounce 1.5
+liquidfriction 0.8
+velocityoffset 0 0 80
+velocityjitter 256 256 256
+velocitymultiplier -0.3

Modified: trunk/data/qcsrc/server/w_rocketlauncher.qc
===================================================================
--- trunk/data/qcsrc/server/w_rocketlauncher.qc	2009-09-27 10:00:31 UTC (rev 7938)
+++ trunk/data/qcsrc/server/w_rocketlauncher.qc	2009-09-27 10:23:55 UTC (rev 7939)
@@ -136,6 +136,9 @@
 {
 	entity e;
 	vector desireddir, olddir, newdir, desiredorigin, goal;
+#if 0
+	float cosminang, cosmaxang, cosang;
+#endif
 	float turnrate, velspeed, f;
 	self.nextthink = time;
 	if (time > self.cnt)
@@ -212,7 +215,12 @@
 			if(time > self.pushltime)
 			if(self.owner.deadflag == DEAD_NO)
 			{
-				f = min(1, (time - self.pushltime) / cvar("g_balance_rocketlauncher_guideratedelay"));
+				f = cvar("g_balance_rocketlauncher_guideratedelay");
+				if(f)
+					f = bound(0, (time - self.pushltime) / f, 1);
+				else
+					f = 1;
+
 				velspeed = vlen(self.velocity);
 
 				makevectors(self.owner.v_angle);
@@ -220,13 +228,32 @@
 				desiredorigin = self.owner.origin + self.owner.view_ofs;
 				olddir = normalize(self.velocity);
 
+#if 0
+				// disabled this code because it doesn't do what I want it to do :P
+				cosminang = cos(cvar("g_balance_rocketlauncher_guidefadeangle") * DEG2RAD);
+				cosmaxang = cos(cvar("g_balance_rocketlauncher_guidemaxangle") * DEG2RAD);
+				cosang = desireddir * normalize(self.origin - desiredorigin);
+				if(cosminang == cosmaxang)
+					f *= (cosang >= cosminang);
+				else
+					f *= bound(0, (cosang - cosmaxang) / (cosminang - cosmaxang), 1);
+#endif
+
 				// now it gets tricky... we want to move like some curve to approximate the target direction
 				// but we are limiting the rate at which we can turn!
 				goal = desiredorigin + ((self.origin - desiredorigin) * desireddir + cvar("g_balance_rocketlauncher_guidegoal")) * desireddir;
-				newdir = rocket_steerto(olddir, normalize(goal - self.origin), cos(cvar("g_balance_rocketlauncher_guiderate") * f * frametime * PI / 180));
+				newdir = rocket_steerto(olddir, normalize(goal - self.origin), cos(cvar("g_balance_rocketlauncher_guiderate") * f * frametime * DEG2RAD));
 
 				self.velocity = newdir * velspeed;
 				self.angles = vectoangles(self.velocity);
+
+				if(!self.count)
+				{
+					pointparticles(particleeffectnum("rocket_guide"), self.origin, self.velocity, 1);
+					// TODO add a better sound here
+					sound (self.owner, CHAN_WEAPON2, "weapons/rocket_mode.wav", VOL_BASE, ATTN_NORM);
+					self.count = 1;
+				}
 			}
 
 			if(self.rl_detonate_later)
@@ -493,10 +520,10 @@
 		precache_model ("models/weapons/h_rl.dpm");
 		precache_sound ("weapons/rocket_det.wav");
 		precache_sound ("weapons/rocket_fire.wav");
+		precache_sound ("weapons/rocket_mode.wav");
 		if (g_laserguided_missile)
 		{
 			precache_model ("models/laser_dot.mdl"); // rocket launcher
-			precache_sound ("weapons/rocket_mode.wav");
 		}
 	}
 	else if (req == WR_SETUP)



More information about the nexuiz-commits mailing list