r84 - trunk/basezym/progsqc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Nov 17 21:52:01 EST 2007


Author: vermeulen
Date: 2007-11-17 21:52:01 -0500 (Sat, 17 Nov 2007)
New Revision: 84

Modified:
   trunk/basezym/progsqc/actor.qc
   trunk/basezym/progsqc/gamedefs.qc
   trunk/basezym/progsqc/inventory.qc
   trunk/basezym/progsqc/mapentities.qc
   trunk/basezym/progsqc/player.qc
Log:
Item/Spawning changes
New map entities added

Modified: trunk/basezym/progsqc/actor.qc
===================================================================
--- trunk/basezym/progsqc/actor.qc	2007-11-16 01:42:29 UTC (rev 83)
+++ trunk/basezym/progsqc/actor.qc	2007-11-18 02:52:01 UTC (rev 84)
@@ -131,7 +131,6 @@
 	
 	self.scale = self.scaleratio;
 	setsize(self, self.boxmin, self.boxmax);
-	
 
 	// it's ok if this bone is missing as long as the torso model is made
 	// relative to the legs origin, but that prevents any chance of leaning

Modified: trunk/basezym/progsqc/gamedefs.qc
===================================================================
--- trunk/basezym/progsqc/gamedefs.qc	2007-11-16 01:42:29 UTC (rev 83)
+++ trunk/basezym/progsqc/gamedefs.qc	2007-11-18 02:52:01 UTC (rev 84)
@@ -5,9 +5,17 @@
 
 .float respawntime;
 
+.float itemitemtype;
+
 .vector viewmodelchange;
 .vector viewmodeldiff;
 
+.vector	pos1, pos2;
+.vector	mangle;
+.vector dest;
+.float state;
+.float		t_length, t_width;
+
 .float fade_time;
 .float fade_rate;
 .vector finaldest, finalangle;

Modified: trunk/basezym/progsqc/inventory.qc
===================================================================
--- trunk/basezym/progsqc/inventory.qc	2007-11-16 01:42:29 UTC (rev 83)
+++ trunk/basezym/progsqc/inventory.qc	2007-11-18 02:52:01 UTC (rev 84)
@@ -540,7 +540,7 @@
 	if (other.team != 1)
 	   	return;
 	sound(other, CHAN_AUTO, self.noise, 1, ATTN_NORM);
-	bprint(self.netname,"\n");
+	//bprint(self.netname,"\n");
 	
 	if (self.health)
 	   other.health = other.health + self.health;
@@ -549,7 +549,8 @@
 	else
 	{
 		Inventory_AddFromInventory(other, self);
-		other.switchweaponitem = Inventory_GetBestWeapon(other);
+		if (self.itemitemtype < ITEMTYPE_AI_WEAP1)
+		   other.switchweaponitem = self.itemitemtype;
 	}
 	
 	if (self.respawntime > 0)
@@ -575,6 +576,7 @@
 	newmis.respawntime = respawntim;
 	newmis.classname = "item";
 	newmis.netname = strzone(iteminfo_name);
+	newmis.itemitemtype = itemtype;
 	newmis.ispointable = TRUE;
 	newmis.solid = SOLID_TRIGGER;
 	newmis.movetype = MOVETYPE_BOUNCE;
@@ -596,7 +598,7 @@
 	setsize(newmis, '-25 -25 -25', '8 8 8');
 	Inventory_ModifyItem(newmis, itemtype, quantity, ammo1);
 	
-	newmis.effects = newmis.effects | EF_FULLBRIGHT;
+	//newmis.effects = newmis.effects | EF_FULLBRIGHT;
 	newmis.scale = modelscale;
 };
 
@@ -678,6 +680,32 @@
 	newmis.effects = newmis.effects | EF_FULLBRIGHT;
 }
 
+void() item_health25 =
+{
+	newmis = spawn();
+	newmis.health = 25;
+	newmis.owner = world;
+	newmis.respawntime = 5;
+	newmis.classname = "Health";
+	newmis.netname = "Health";
+	newmis.ispointable = TRUE;
+	newmis.solid = SOLID_TRIGGER;
+	newmis.movetype = MOVETYPE_TOSS;
+	newmis.velocity = '0 0 0';
+	newmis.angles = '0 0 0';
+	newmis.nextthink = time + 10;
+	newmis.think = Item_Think;
+	newmis.use = Item_Pickup;
+	if (cvar("g_itemtouchpickup"))
+		newmis.touch = Item_Pickup;
+	newmis.noise = "pickuphealth";
+	setorigin(newmis, self.origin);
+	setmodel(newmis, "models/items/health25.md3");
+	setsize(newmis, '-8 -8 -8', '8 8 8');
+	
+	newmis.effects = newmis.effects | EF_FULLBRIGHT;
+}
+
 void() item_armor1 =
 {
 	newmis = spawn();
@@ -703,7 +731,32 @@
 	newmis.effects = newmis.effects | EF_ADDITIVE | EF_FULLBRIGHT;
 }
 
+void() item_armor25 =
+{
+	newmis = spawn();
+	newmis.armorvalue = 25;
+	newmis.owner = world;
+	newmis.classname = "Armor";
+	newmis.netname = "Armor";
+	newmis.ispointable = TRUE;
+	newmis.solid = SOLID_TRIGGER;
+	newmis.movetype = MOVETYPE_TOSS;
+	newmis.velocity = '0 0 0';
+	newmis.angles = '0 0 0';
+	newmis.nextthink = time + 10;
+	newmis.think = Item_Think;
+	newmis.use = Item_Pickup;
+	if (cvar("g_itemtouchpickup"))
+		newmis.touch = Item_Pickup;
+	newmis.noise = "pickuphealth";
+	setorigin(newmis, self.origin);
+	setmodel(newmis, "models/items/armor25.md3");
+	setsize(newmis, '-8 -8 -8', '8 8 8');
+	
+	newmis.effects = newmis.effects | EF_ADDITIVE | EF_FULLBRIGHT;
+}
 
+
 /*
 // _x = quantity, _y = ammo type, _z = ammo quantity
 .vector inventory_weap1;

Modified: trunk/basezym/progsqc/mapentities.qc
===================================================================
--- trunk/basezym/progsqc/mapentities.qc	2007-11-16 01:42:29 UTC (rev 83)
+++ trunk/basezym/progsqc/mapentities.qc	2007-11-18 02:52:01 UTC (rev 84)
@@ -48,3 +48,397 @@
 	setmodel (self, self.model);	// set size and link into world
 	self.touch = func_ladder_touch;
 };
+
+
+
+
+void Teleport_Touch (void)
+{
+	entity head;
+
+	// Make teleport effect where the player left
+	sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM);
+	te_teleport (other.origin);
+
+	// Make teleport effect where the player arrived
+	sound (other, CHAN_ITEM, "misc/teleport.wav", 1, ATTN_NORM);
+	makevectors (self.enemy.mangle);
+	te_teleport (self.enemy.origin + v_forward * 32);
+
+	// Relocate the player
+	setorigin (other, self.enemy.origin + '0 0 1' * (1 - other.mins_z - 24));
+	other.angles = self.enemy.mangle;
+	other.fixangle = TRUE;
+	other.velocity = v_forward * vlen(other.velocity);
+
+	/*
+	// Kill anyone else in the teleporter box (NO MORE TDEATH)
+	if(other.takedamage)
+	{
+		vector deathmin;
+		vector deathmax;
+		float deathradius;
+		deathmin = other.absmin;
+		deathmax = other.absmax;
+		deathradius = max(vlen(deathmin), vlen(deathmax));
+		for(head = findradius(other.origin, deathradius); head; head = head.chain)
+			if(head != other)
+				if(head.takedamage)
+					if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
+					{
+						if ((other.classname == "player") && (other.health >= 1))
+							Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
+						else if (other.health < 1) // corpses gib
+							Damage (head, self, other, 10000, DEATH_TELEFRAG, head.origin, '0 0 0');
+						else // dead bodies and monsters gib themselves instead of telefragging
+							Damage (other, self, other, 10000, DEATH_TELEFRAG, other.origin, '0 0 0');
+					}
+	}
+	*/
+
+	// hide myself a tic
+	other.effects = other.effects | EF_NODRAW;
+	other.teleport_time = time + cvar("sys_ticrate");
+
+	other.flags = other.flags - (other.flags & FL_ONGROUND);
+	// reset tracking of oldvelocity for impact damage (sudden velocity changes)
+	other.oldvelocity = other.velocity;
+}
+
+void info_teleport_destination (void)
+{
+	self.mangle = self.angles;
+	self.angles = '0 0 0';
+
+	//setorigin (self, self.origin + '0 0 27');	// To fix a mappers' habit as old as Quake
+	setorigin (self, self.origin);
+
+	if (!self.targetname)
+		objerror ("Teleport destination without a targetname");
+}
+
+void misc_teleporter_dest (void)
+{
+	info_teleport_destination();
+}
+
+void target_teleporter (void)
+{
+	info_teleport_destination();
+}
+
+void teleport_findtarget (void)
+{
+	// now enable touch
+	self.touch = Teleport_Touch;
+
+	self.enemy = find (world, targetname, self.target);
+	if (!self.enemy)
+	{
+		objerror ("Teleporter with nonexistant target");
+		remove(self);
+		return;
+	}
+
+	self.dest = self.enemy.origin;
+}
+
+void trigger_teleport (void)
+{
+	self.angles = '0 0 0';
+
+	self.solid = SOLID_TRIGGER;
+	self.movetype = MOVETYPE_NONE;
+
+	setmodel (self, self.model); // no precision needed
+
+	self.model = "";
+	self.modelindex = 0;
+
+	self.think = teleport_findtarget;
+	self.nextthink = time + 0.2;
+
+	if (!self.target)
+		objerror ("Teleporter with no target");
+}
+
+void() target_speaker =
+{
+if(self.noise) {
+ precache_sound (self.noise);
+ ambientsound (self.origin, self.noise, 1, ATTN_STATIC);
+}
+//remove(self);
+};
+
+
+void() rotating_blocked =
+{
+
+/*
+    if(self.dmg && other.takedamage != DAMAGE_NO) {
+        if(self.dmgtime2 < time) {
+            Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+            self.dmgtime2 = time + self.dmgtime;
+        }
+
+        // Gib dead/dying stuff
+        if(other.deadflag != DEAD_NO)
+            Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+    }
+*/
+}
+
+/*QUAKED func_rotating (0 .5 .8) ? - - X_AXIS Y_AXIS
+Brush model that spins in place on one axis (default Z).
+speed   : speed to rotate (in degrees per second)
+noise   : path/name of looping .wav file to play.
+dmg     : Do this mutch dmg every .dmgtime intervall when blocked
+dmgtime : See above.
+*/
+
+void() func_rotating =
+{
+	if (self.noise)
+	{
+		precache_sound(self.noise);
+		ambientsound(self.origin, self.noise, 1, ATTN_IDLE);
+	}
+	if (!self.speed)
+		self.speed = 100;
+	// FIXME: test if this turns the right way, then remove this comment (negate as needed)
+	if (self.spawnflags & 4) // X (untested)
+		self.avelocity = '0 0 1' * self.speed;
+	// FIXME: test if this turns the right way, then remove this comment (negate as needed)
+	else if (self.spawnflags & 8) // Y (untested)
+		self.avelocity = '1 0 0' * self.speed;
+	// FIXME: test if this turns the right way, then remove this comment (negate as needed)
+	else // Z
+		self.avelocity = '0 1 0' * self.speed;
+		
+	self.solid = SOLID_BSP;
+	self.movetype = MOVETYPE_PUSH;
+
+	setmodel(self, self.model); // no lowprecision here! evil!
+	setsize(self, self.mins, self.maxs);
+	setorigin(self, self.origin);
+
+    self.blocked = rotating_blocked;
+
+	// wait for targets to spawn
+	self.nextthink = self.ltime + 999999999;
+	self.think = SUB_Null;
+};
+
+.entity trigger_field;
+
+void() plat_center_touch;
+void() plat_outside_touch;
+void() plat_trigger_use;
+void() plat_go_up;
+void() plat_go_down;
+void() plat_crush;
+float PLAT_LOW_TRIGGER = 1;
+
+void() plat_spawn_inside_trigger =
+{
+	local entity trigger;
+	local vector tmin, tmax;
+
+	trigger = spawn();
+	trigger.touch = plat_center_touch;
+	trigger.movetype = MOVETYPE_NONE;
+	trigger.solid = SOLID_TRIGGER;
+	trigger.enemy = self;
+
+	tmin = self.mins + '25 25 0';
+	tmax = self.maxs - '25 25 -8';
+	tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8);
+	if (self.spawnflags & PLAT_LOW_TRIGGER)
+		tmax_z = tmin_z + 8;
+
+	if (self.size_x <= 50)
+	{
+		tmin_x = (self.mins_x + self.maxs_x) / 2;
+		tmax_x = tmin_x + 1;
+	}
+	if (self.size_y <= 50)
+	{
+		tmin_y = (self.mins_y + self.maxs_y) / 2;
+		tmax_y = tmin_y + 1;
+	}
+
+	setsize (trigger, tmin, tmax);
+};
+
+void() plat_hit_top =
+{
+	sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+	self.state = 1;
+	self.think = plat_go_down;
+	self.nextthink = self.ltime + 3;
+};
+
+void() plat_hit_bottom =
+{
+	sound (self, CHAN_VOICE, self.noise1, 1, ATTN_NORM);
+	self.state = 2;
+};
+
+void() plat_go_down =
+{
+	sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+	self.state = 3;
+	SUB_CalcMove (self.pos2, self.speed, plat_hit_bottom);
+};
+
+void() plat_go_up =
+{
+	sound (self, CHAN_VOICE, self.noise, 1, ATTN_NORM);
+	self.state = 4;
+	SUB_CalcMove (self.pos1, self.speed, plat_hit_top);
+};
+
+void() plat_center_touch =
+{
+	if (other.classname != "player")
+		return;
+
+	if (other.health <= 0)
+		return;
+
+	self = self.enemy;
+	if (self.state == 2)
+		plat_go_up ();
+	else if (self.state == 1)
+		self.nextthink = self.ltime + 1;	// delay going down
+};
+
+void() plat_outside_touch =
+{
+	if (other.classname != "player")
+		return;
+
+	if (other.health <= 0)
+		return;
+
+	self = self.enemy;
+	if (self.state == 1)
+		plat_go_down ();
+};
+
+void() plat_trigger_use =
+{
+	if (self.think)
+		return;		// allready activated
+	plat_go_down();
+};
+
+
+void() plat_crush =
+{
+/*
+    if((self.spawnflags & 4) && (other.takedamage != DAMAGE_NO)) { // KIll Kill Kill!!
+        Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+    } else {
+        if((self.dmg) && (other.takedamage != DAMAGE_NO)) {   // Shall we bite?
+            Damage (other, self, self, self.dmg, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+            // Gib dead/dying stuff
+            if(other.deadflag != DEAD_NO)
+                Damage (other, self, self, 10000, DEATH_HURTTRIGGER, other.origin, '0 0 0');
+        }
+
+        if (self.state == 4)
+            plat_go_down ();
+        else if (self.state == 3)
+            plat_go_up ();
+        else
+            objerror ("plat_crush: bad self.state\n");
+    }
+	*/
+};
+
+void() plat_use =
+{
+	self.use = SUB_Null;
+	if (self.state != 4)
+		objerror ("plat_use: not in up state");
+	plat_go_down();
+};
+
+
+.string sound1, sound2;
+
+void() func_plat =
+{
+	if (!self.t_length)
+		self.t_length = 80;
+	if (!self.t_width)
+		self.t_width = 10;
+
+	if (self.sounds == 0)
+		self.sounds = 2;
+
+	if (self.sounds == 1)
+	{
+		precache_sound ("plats/plat1.wav");
+		precache_sound ("plats/plat2.wav");
+		self.noise = "plats/plat1.wav";
+		self.noise1 = "plats/plat2.wav";
+	}
+
+	if (self.sounds == 2)
+	{
+		precache_sound ("plats/medplat1.wav");
+		precache_sound ("plats/medplat2.wav");
+		self.noise = "plats/medplat1.wav";
+		self.noise1 = "plats/medplat2.wav";
+	}
+
+	if (self.sound1)
+	{
+		precache_sound (self.sound1);
+		self.noise = self.sound1;
+	}
+	if (self.sound2)
+	{
+		precache_sound (self.sound2);
+		self.noise1 = self.sound2;
+	}
+
+	self.mangle = self.angles;
+	self.angles = '0 0 0';
+
+	self.classname = "plat";
+	self.solid = SOLID_BSP;
+	self.movetype = MOVETYPE_PUSH;
+	setorigin (self, self.origin);
+	setmodel (self, self.model); // precision set below
+	self.effects |= EF_LOWPRECISION;
+	setsize (self, self.mins , self.maxs);
+
+	self.blocked = plat_crush;
+
+	if (!self.speed)
+		self.speed = 150;
+
+	self.pos1 = self.origin;
+	self.pos2 = self.origin;
+	self.pos2_z = self.origin_z - self.size_z + 8;
+
+	self.use = plat_trigger_use;
+
+	plat_spawn_inside_trigger ();	// the "start moving" trigger
+
+	if (self.targetname)
+	{
+		self.state = 4;
+		self.use = plat_use;
+	}
+	else
+	{
+		setorigin (self, self.pos2);
+		self.state = 2;
+	}
+};
+

Modified: trunk/basezym/progsqc/player.qc
===================================================================
--- trunk/basezym/progsqc/player.qc	2007-11-16 01:42:29 UTC (rev 83)
+++ trunk/basezym/progsqc/player.qc	2007-11-18 02:52:01 UTC (rev 84)
@@ -469,8 +469,8 @@
 	
 	if (self.flags & FL_CLIENT) // should really be client side
 	{
-	   self.viewmodelchange_x = self.viewmodelchange_x - (self.velocity_x / 1000);
-	   self.viewmodelchange_y = self.viewmodelchange_y - (self.velocity_y / 2000);
+	   self.viewmodelchange_x = self.viewmodelchange_x - (self.movement_x / 1000);
+	   self.viewmodelchange_y = self.viewmodelchange_y - (self.movement_y / 1000);
 	   self.viewmodelchange_z = self.viewmodelchange_z - (self.velocity_z / 1000);
 	
 	   Inventory_GetItemInfo(self, self.weaponitem);




More information about the zymotic-commits mailing list