r88 - trunk/basezym/progsqc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Dec 8 19:00:11 EST 2007


Author: vermeulen
Date: 2007-12-08 19:00:09 -0500 (Sat, 08 Dec 2007)
New Revision: 88

Modified:
   trunk/basezym/progsqc/actor.qc
   trunk/basezym/progsqc/damage.qc
   trunk/basezym/progsqc/dpextensions.qc
   trunk/basezym/progsqc/gamedefs.qc
   trunk/basezym/progsqc/inventory.qc
   trunk/basezym/progsqc/player.qc
Log:
Split up projectile flags into fire-explode-proj

Modified: trunk/basezym/progsqc/actor.qc
===================================================================
--- trunk/basezym/progsqc/actor.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/actor.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -304,14 +304,14 @@
 			weapon_state(WS_RELOAD);
 		else if (self.button4 && ((iteminfo_ammo < iteminfo_ammomax && iteminfo_ammoinventory >= 1)))
 			weapon_state(WS_RELOAD);
-		else if (self.button0 && iteminfo_weapon_canfire1 && (!self.weapon_oldbutton0 || !(iteminfo_ammo1flags & PROJECTILEFLAG_SEMIAUTOMATIC)))
+		else if (self.button0 && iteminfo_weapon_canfire1 && (!self.weapon_oldbutton0 || !(iteminfo_ammo1fireflags & FIREFLAG_SEMIAUTOMATIC)))
 			weapon_state(WS_FIRE1);
-		else if (self.button3 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton3 || !(iteminfo_ammo2flags & PROJECTILEFLAG_SEMIAUTOMATIC)))
+		else if (self.button3 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton3 || !(iteminfo_ammo2fireflags & FIREFLAG_SEMIAUTOMATIC)))
 			weapon_state(WS_FIRE2);
 		else if (self.button7)
 		{
 		 	Inventory_GetItemInfo(self, self.itemselected);
-			if (iteminfo_weapon_canfire1 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton7 || !(iteminfo_ammo1flags & PROJECTILEFLAG_SEMIAUTOMATIC)))
+			if (iteminfo_weapon_canfire1 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton7 || !(iteminfo_ammo1fireflags & FIREFLAG_SEMIAUTOMATIC)))
 			   weapon_state(WS_FIRE3);
 		}
 	}
@@ -414,7 +414,9 @@
 	local vector shotdamage;
 	local float shotdamagetype;
 	local float shotlifetime;
-	local float shotprojectileflags;
+	local float shotprojflags;
+	local float shotfireflags;
+	local float shotexplflags;
 	local float numberof;
 	local float recoil;
 	local float mintofire;
@@ -438,7 +440,9 @@
 		shotdamage = iteminfo_ammo2damage;
 		shotdamagetype = iteminfo_ammo2damagetype;
 		shotlifetime = iteminfo_ammo2lifetime;
-		shotprojectileflags = iteminfo_ammo2flags;
+		shotprojflags = iteminfo_ammo2projflags;
+		shotfireflags = iteminfo_ammo2fireflags;
+		shotexplflags = iteminfo_ammo2explflags;
 		shotmodel = iteminfo_ammo2model;
 		shotfiresound = iteminfo_ammo2firesound;
 		shotexplodesound = iteminfo_ammo2explodesound;
@@ -460,7 +464,9 @@
 		shotdamage = iteminfo_ammo1damage;
 		shotdamagetype = iteminfo_ammo1damagetype;
 		shotlifetime = iteminfo_ammo1lifetime;
-		shotprojectileflags = iteminfo_ammo1flags;
+		shotprojflags = iteminfo_ammo1projflags;
+		shotfireflags = iteminfo_ammo1fireflags;
+		shotexplflags = iteminfo_ammo1explflags;
 		shotmodel = iteminfo_ammo1model;
 		shotfiresound = iteminfo_ammo1firesound;
 		shotexplodesound = iteminfo_ammo1explodesound;
@@ -489,7 +495,7 @@
 	
 	while (numberof != 0)
 	{
-		  weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojectileflags, shotfiresound, shotexplodesound, shotbouncesound, tracer, tracermodel, modelscale, projhealth, projmass, projcolormod);	
+		  weapon_fireprojectile(shotmodel, shotorg, shotdir, shotdamage, shotdamagetype, shotlifetime, shotprojflags, shotfireflags, shotexplflags, shotfiresound, shotexplodesound, shotbouncesound, tracer, tracermodel, modelscale, projhealth, projmass, projcolormod);	
 		  numberof = numberof - 1;
 	}
 };

Modified: trunk/basezym/progsqc/damage.qc
===================================================================
--- trunk/basezym/progsqc/damage.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/damage.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -330,23 +330,28 @@
 .float damagetype;
 .vector damageinfo;
 
-float PROJECTILEFLAG_ANYIMPACT = 1;
-float PROJECTILEFLAG_CHARACTERIMPACT = 2;
-float PROJECTILEFLAG_REMOTEDETONATE = 4;
-float PROJECTILEFLAG_RICOCHET = 8;
-float PROJECTILEFLAG_ROCKET = 16;
-float PROJECTILEFLAG_EXPLODE = 32;
-float PROJECTILEFLAG_ELECTRICITY = 64;
-float PROJECTILEFLAG_MUZZLEFLASH = 128;
-float PROJECTILEFLAG_SEMIAUTOMATIC = 256; // not actually used by projectile code, but a convenient place to store this
-float PROJECTILEFLAG_GLOW = 512;
-float PROJECTILEFLAG_EXPLODELARGE = 1024;
-float PROJECTILEFLAG_SNIPERRAIL = 2048;
-float PROJECTILEFLAG_PLASMA = 4096;
-float PROJECTILEFLAG_ASSAULTRAIL = 8192;
-float PROJECTILEFLAG_STICK = 16384;
-float PROJECTILEFLAG_LASERGUIDED = 32768;
+float PROJFLAG_ANYIMPACT = 1;
+float PROJFLAG_CHARACTERIMPACT = 2;
+float PROJFLAG_RICOCHET = 4;
+float PROJFLAG_ROCKET = 8;
+float PROJFLAG_GLOW = 32;
+float PROJFLAG_STICK = 64;
+float PROJFLAG_LASERGUIDED = 128;
+float PROJFLAG_REMOTEDETONATE = 256;
 
+float FIREFLAG_MUZZLEFLASH = 1;
+float FIREFLAG_SEMIAUTOMATIC = 2;
+float FIREFLAG_ZOOM = 4;
+float FIREFLAG_HOOK = 8;
+float FIREFLAG_JETPACK = 16;
+
+float EXPLFLAG_EXPLODE = 1;
+float EXPLFLAG_EXPLODELARGE = 2;
+float EXPLFLAG_SNIPERRAIL = 4;
+float EXPLFLAG_PLASMA = 8;
+float EXPLFLAG_ASSAULTRAIL = 16;
+float EXPLFLAG_ELECTRICITY = 32;
+
 .float weaponsound_cycle; // templeofnoise: added for minigun routing sound, guess i'll use it for other sound specs also.
 
 void(string tracermodel, vector dir, vector org) fire_tracer =
@@ -364,15 +369,15 @@
 	setmodel (e, tracermodel);
 	setorigin (e, org);
 	setsize(e, '0 0 0', '0 0 0');
-	e.lefty = 17;
+	//e.lefty = 17;
 }
 
 void(entity attacker, float damage) projectile_pain =
 {
-	if (self.lefty  & PROJECTILEFLAG_STICK)
+	if (self.projflag  & PROJFLAG_STICK)
 	{
 		self.movetype = MOVETYPE_BOUNCE;
-		self.lefty = self.lefty - PROJECTILEFLAG_STICK;
+		self.projflag = self.projflag - PROJFLAG_STICK;
 	}
 }
 
@@ -402,7 +407,7 @@
 	else if (other != world)
 		T_Damage(other, self, self.realowner, self.damagetype, self.damageinfo_x, self.origin, normalize(self.velocity) * self.damageinfo_y);
 	self.takedamage = DAMAGE_NO;
-	if (self.lefty & PROJECTILEFLAG_EXPLODELARGE)
+	if (self.explflag & EXPLFLAG_EXPLODELARGE)
 	{
 		// LordHavoc: TE_TEI_BIGEXPLOSION
 		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
@@ -413,17 +418,17 @@
 		
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_EXPLODE)
+	else if (self.explflag & EXPLFLAG_EXPLODE)
 	{
 		te_explosion(self.origin);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_SNIPERRAIL)
+	else if (self.explflag & EXPLFLAG_SNIPERRAIL)
 	{
 		te_plasmaburn(self.origin);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_ELECTRICITY)
+	else if (self.explflag & EXPLFLAG_ELECTRICITY)
 	{
 		WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
 		WriteByte (MSG_BROADCAST, 79);
@@ -436,12 +441,12 @@
 		WriteByte (MSG_BROADCAST, 155);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_PLASMA)
+	else if (self.explflag & EXPLFLAG_PLASMA)
 	{
 		te_knightspike(self.origin);
 		remove(self);
 	}
-	else if (self.lefty & PROJECTILEFLAG_ASSAULTRAIL)
+	else if (self.explflag & EXPLFLAG_ASSAULTRAIL)
 	{
 		te_gunshotquad(self.origin);
 		remove(self);
@@ -456,9 +461,20 @@
 //.vector oldvelocity;
 void() projectile_touch =
 {
-	if (self.lefty  & PROJECTILEFLAG_STICK)
+	if (self.projflag  & PROJFLAG_STICK)
 		self.movetype = MOVETYPE_NONE;
 
+	if (self.fireflag & FIREFLAG_HOOK)
+	{
+	   self.state = 1;
+	   self.nextthink = time;
+	   self.touch = SUB_Null;
+	   self.velocity = '0 0 0';
+	   self.movetype = MOVETYPE_NONE;
+	   self.rope_length = -1;
+	   return;
+	}
+		
 	if (self.owner)
 	{
 		if (other == self.owner)
@@ -466,12 +482,12 @@
 		self.owner = world;
 	}
 	if (other.solid == SOLID_SLIDEBOX)
-	if (self.lefty & (PROJECTILEFLAG_CHARACTERIMPACT | PROJECTILEFLAG_ANYIMPACT))
+	if (self.projflag & (PROJFLAG_CHARACTERIMPACT | PROJFLAG_ANYIMPACT))
 	{
 		self.th_die();
 		return;
 	}
-	if (self.lefty & PROJECTILEFLAG_RICOCHET)
+	if (self.projflag & PROJFLAG_RICOCHET)
 	{
 		//if (vlen(self.velocity - self.oldvelocity) >= vlen(self.oldvelocity) * 0.02)
 		traceline(self.origin, self.origin + self.velocity, FALSE, self);
@@ -481,10 +497,8 @@
 			self.th_die();
 			return;
 		}
-		//bprint("2\n");
-		//self.lefty = self.lefty - (self.lefty & PROJECTILEFLAG_RICOCHET);
 	}
-	else if (self.lefty & PROJECTILEFLAG_ANYIMPACT)
+	else if (self.projflag & PROJFLAG_ANYIMPACT)
 	{
 		self.th_die();
 		return;
@@ -503,7 +517,7 @@
 		self.th_die();
 		return;
 	}
-	if (self.lefty & PROJECTILEFLAG_LASERGUIDED)
+	if (self.projflag & PROJFLAG_LASERGUIDED)
 	{
 	    float velspeed,turnrate;
 		vector desireddir, olddir, newdir;
@@ -519,16 +533,53 @@
 		self.velocity = newdir * velspeed;					// make me fly in the new direction at my flight speed
 		self.angles = vectoangles(self.velocity);			// turn model in the new flight direction
 	}
-	if (self.lefty & PROJECTILEFLAG_REMOTEDETONATE)
+	if (self.projflag & PROJFLAG_REMOTEDETONATE)
 	{
 	    if (self.realowner.button4)
 		{
 		   self.th_die();
 		}
 	}
+	if (self.fireflag & FIREFLAG_HOOK)
+	{
+	   	float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
+	 	vector dir, org, end;
+		makevectors(self.owner.v_angle);
+		org = self.owner.origin + self.owner.view_ofs + v_forward * 8 - v_right * 8 + v_up * -12;
+		if(self.rope_length < 0)
+							self.rope_length = vlen(org - self.origin);
+							
+		if(self.state == 1)
+		{
+		 	pullspeed = 2000;
+			rubberforce = 2000;
+			rubberforce_overstretch = 1000;
+			minlength = 100;
+			ropestretch = 400;
+			ropeairfriction = 0.2;
+		
+			dir = self.origin - org;
+			dist = vlen(dir);
+			dir = normalize(dir);
+		
+			end = self.origin - dir*50;
+			dist = vlen(end - org);
+			if(dist < 200)
+				spd = dist * (pullspeed / 200);
+			else
+				spd = pullspeed;
+			if(spd < 50)
+			   spd = 0;
+			self.owner.velocity = dir*spd;
+			self.owner.movetype = MOVETYPE_FLY;
+		}
+		
+		makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0');
+		te_beam(self, self.origin + v_forward * (-9), org);
+	}
 }
 
-void(string modelname, vector shotorg, vector shotvel, vector damage, float damagtype, float lifetime, float projectileflags, string firesound, string explodesound, string bouncesound, float tracer, string tracermodel, float modelscale, float projhealth, float projmass, vector projcolormod) weapon_fireprojectile =
+void(string modelname, vector shotorg, vector shotvel, vector damage, float damagtype, float lifetime, float PROJFLAGs, float FIREFLAGs, float EXPLFLAGs, string firesound, string explodesound, string bouncesound, float tracer, string tracermodel, float modelscale, float projhealth, float projmass, vector projcolormod) weapon_fireprojectile =
 {
 	local float r; // templeofnoise
 	
@@ -547,7 +598,11 @@
  	newmis.think = projectile_think;
  	newmis.nextthink = time;
  	newmis.cnt = time + lifetime;
- 	newmis.lefty = projectileflags;
+	
+ 	newmis.projflag = PROJFLAGs;
+ 	newmis.fireflag = FIREFLAGs;
+ 	newmis.explflag = EXPLFLAGs;
+	
  	newmis.noise = explodesound;
  	newmis.noise1 = bouncesound;
  	newmis.owner = self; // initially same as realowner, cleared on first bounce so that it can hit owner
@@ -647,11 +702,17 @@
 
 	sound(self, CHAN_WEAPON, firesound, 1, ATTN_NORM); // templeofnoise: 1) CHAN_WEAPON instead voice, selfexpl 2)"self", not "newmis" for spawner .. prevent wrong locations and sound overflow.
 
-	if (projectileflags & PROJECTILEFLAG_MUZZLEFLASH)
+	if (FIREFLAGs & FIREFLAG_HOOK)
+	{
+	    self.hook = newmis;
+		newmis.state = 0;
+	}
+	
+	if (FIREFLAGs & FIREFLAG_MUZZLEFLASH)
 		te_smallflash(shotorg);
-	if (projectileflags & PROJECTILEFLAG_ROCKET)
+	if (PROJFLAGs & PROJFLAG_ROCKET)
 		newmis.movetype = MOVETYPE_BOUNCEMISSILE;
-	if (projectileflags & PROJECTILEFLAG_GLOW)
+	if (PROJFLAGs & PROJFLAG_GLOW)
 		newmis.effects = newmis.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_NOSHADOW; // | EF_BRIGHTFIELD; Add once Zymotic gamemode has support for this
 };
 

Modified: trunk/basezym/progsqc/dpextensions.qc
===================================================================
--- trunk/basezym/progsqc/dpextensions.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/dpextensions.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -1091,7 +1091,7 @@
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
 //field definitions:
-//.float viewzoom;
+.float viewzoom;
 //description:
 //scales fov and sensitivity of player, valid range is 0 to 1 (intended for sniper rifle zooming, and such)
 

Modified: trunk/basezym/progsqc/gamedefs.qc
===================================================================
--- trunk/basezym/progsqc/gamedefs.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/gamedefs.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -7,6 +7,10 @@
 
 .float itemitemtype;
 
+.float projflag;
+.float explflag;
+.float fireflag;
+
 .float itemselected;
 
 .vector viewmodelchange;
@@ -18,6 +22,9 @@
 .float state;
 .float		t_length, t_width;
 
+.entity		hook;
+.float rope_length;
+
 .float fade_time;
 .float fade_rate;
 .vector finaldest, finalangle;

Modified: trunk/basezym/progsqc/inventory.qc
===================================================================
--- trunk/basezym/progsqc/inventory.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/inventory.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -74,10 +74,12 @@
 vector iteminfo_ammo2speeds;
 float iteminfo_ammo1lifetime;
 float iteminfo_ammo2lifetime;
-float iteminfo_ammo1flags;
-float iteminfo_ammo2flags;
+float iteminfo_ammo1fireflags;
+float iteminfo_ammo2fireflags;
 float iteminfo_ammo1projflags;
 float iteminfo_ammo2projflags;
+float iteminfo_ammo1explflags;
+float iteminfo_ammo2explflags;
 string iteminfo_ammo1model;
 string iteminfo_ammo2model;
 string iteminfo_ammo1explodesound;
@@ -164,7 +166,9 @@
 	iteminfo_ammo1damage = '0 0 0';
 	iteminfo_ammo1speeds = '0 0 0';
 	iteminfo_ammo1lifetime = 10;
-	iteminfo_ammo1flags = PROJECTILEFLAG_ANYIMPACT;
+	iteminfo_ammo1projflags = PROJFLAG_ANYIMPACT;
+	iteminfo_ammo1explflags = 0;
+	iteminfo_ammo1fireflags = 0;
 	iteminfo_ammo1model = "";
 	iteminfo_ammo1firesound = "";
 	iteminfo_ammo1explodesound = "";
@@ -183,7 +187,9 @@
 	iteminfo_ammo2damage = '0 0 0';
 	iteminfo_ammo2speeds = '0 0 0';
 	iteminfo_ammo2lifetime = 10;
-	iteminfo_ammo2flags = PROJECTILEFLAG_ANYIMPACT;
+	iteminfo_ammo2projflags = PROJFLAG_ANYIMPACT;
+	iteminfo_ammo2explflags = 0;
+	iteminfo_ammo2fireflags = 0;
 	iteminfo_ammo2model = "";
 	iteminfo_ammo2firesound = "";
 	iteminfo_ammo2explodesound = "";
@@ -257,7 +263,11 @@
 		iteminfo_ammo1model = cvar_string(wname,"_ammo1model");
 		iteminfo_ammo1firesound = cvar_string(wname,"_ammo1firesound");
 		//iteminfo_ammo1explodesound = strzone(cvar_string(wname,"_ammo1explodesound"));
-		iteminfo_ammo1flags = cvar(wname,"_ammo1flags");
+		
+		iteminfo_ammo1projflags = cvar(wname,"_ammo1projflags");
+		iteminfo_ammo1explflags = cvar(wname,"_ammo1explflags");
+		iteminfo_ammo1fireflags = cvar(wname,"_ammo1fireflags");
+		
 		iteminfo_ammo1numberof = cvar(wname,"_ammo1numberof");
 		iteminfo_ammo1recoil = cvar(wname,"_ammo1recoil");
 		iteminfo_ammo1minimumtofire = cvar(wname,"_ammo1mintofire");
@@ -276,7 +286,11 @@
 		iteminfo_ammo2model = cvar_string(wname,"_ammo2model");
 		iteminfo_ammo2firesound = cvar_string(wname,"_ammo2firesound");
 		//iteminfo_ammo2explodesound = strzone(cvar_string(wname,"_ammo2explodesound"));
-		iteminfo_ammo2flags = cvar(wname,"_ammo2flags");
+		
+		iteminfo_ammo2projflags = cvar(wname,"_ammo2projflags");
+		iteminfo_ammo2explflags = cvar(wname,"_ammo2explflags");
+		iteminfo_ammo2fireflags = cvar(wname,"_ammo2fireflags");
+		
 		iteminfo_ammo2numberof = cvar(wname,"_ammo2numberof");
 		iteminfo_ammo2recoil = cvar(wname,"_ammo2recoil");
 		iteminfo_ammo2minimumtofire = cvar(wname,"_ammo2mintofire");

Modified: trunk/basezym/progsqc/player.qc
===================================================================
--- trunk/basezym/progsqc/player.qc	2007-12-08 13:51:16 UTC (rev 87)
+++ trunk/basezym/progsqc/player.qc	2007-12-09 00:00:09 UTC (rev 88)
@@ -483,6 +483,12 @@
 	   actor_setviewmodeloffset(self.viewmodelchange);
 	}
 	
+	if ((self.hook) && (!self.button7))
+	{
+	   if (self.hook.fireflag & FIREFLAG_HOOK)
+			remove(self.hook);
+	}
+	
 	local float im;
 	if (self.flags & FL_CLIENT) // only real players can respawn, not NPCs
 	if (self.deadflag)
@@ -532,18 +538,26 @@
 	}
 	if (!self.deadflag)
 	{
+	   	if (self.button4)
+		{
+		    Inventory_GetItemInfo(self, self.weaponitem);
+		   	if (iteminfo_ammo1fireflags & FIREFLAG_ZOOM)
+		       self.viewzoom = 0.2;
+		}
+		else
+			self.viewzoom = 1;
 		if (self.button5)
 		{
 			if ((self.jetpack_fuel > 10) && (self.actorpart_jetpacktrail.effects & EF_NODRAW))
-				self.actorpart_jetpacktrail.effects = self.actorpart_jetpacktrail.effects - EF_NODRAW;
+			   	 self.actorpart_jetpacktrail.effects = self.actorpart_jetpacktrail.effects - EF_NODRAW;
 			else if (self.jetpack_fuel < 10)
-				self.actorpart_jetpacktrail.effects = self.actorpart_jetpacktrail.effects | EF_NODRAW;
+			 	 self.actorpart_jetpacktrail.effects = self.actorpart_jetpacktrail.effects | EF_NODRAW;
 				
 			self.jetpack_fuel = max(0, self.jetpack_fuel - self.jetpack_use * frametime);
 			if (!self.jetpackactive)
 			{
-				sound(self, CHAN_BODY, strcat(self.playerclass.sounddir, "/jetpack.wav"), 1, ATTN_NORM);
-				self.jetpackactive = TRUE;
+				   	sound(self, CHAN_BODY, strcat(self.playerclass.sounddir, "/jetpack.wav"), 1, ATTN_NORM);
+					self.jetpackactive = TRUE;
 			}
 		}
 		else




More information about the zymotic-commits mailing list