r87 - trunk/basezym/progsqc

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sat Dec 8 08:51:16 EST 2007


Author: vermeulen
Date: 2007-12-08 08:51:16 -0500 (Sat, 08 Dec 2007)
New Revision: 87

Modified:
   trunk/basezym/progsqc/actor.qc
   trunk/basezym/progsqc/inventory.qc
   trunk/basezym/progsqc/player.qc
Log:
Better item support, now shows in the hud and can switch

Modified: trunk/basezym/progsqc/actor.qc
===================================================================
--- trunk/basezym/progsqc/actor.qc	2007-11-27 03:11:40 UTC (rev 86)
+++ trunk/basezym/progsqc/actor.qc	2007-12-08 13:51:16 UTC (rev 87)
@@ -308,8 +308,12 @@
 			weapon_state(WS_FIRE1);
 		else if (self.button3 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton3 || !(iteminfo_ammo2flags & PROJECTILEFLAG_SEMIAUTOMATIC)))
 			weapon_state(WS_FIRE2);
-		else if (self.button7 && iteminfo_weapon_canfire1 && (!self.weapon_oldbutton7))
-			weapon_state(WS_FIRE3);
+		else if (self.button7)
+		{
+		 	Inventory_GetItemInfo(self, self.itemselected);
+			if (iteminfo_weapon_canfire1 && iteminfo_weapon_canfire2 && (!self.weapon_oldbutton7 || !(iteminfo_ammo1flags & PROJECTILEFLAG_SEMIAUTOMATIC)))
+			   weapon_state(WS_FIRE3);
+		}
 	}
 	self.weapon_oldbutton0 = self.button0;
 	self.weapon_oldbutton3 = self.button3;
@@ -366,7 +370,7 @@
 	}
 	else if (newstate == WS_FIRE3)
 	{
-	 	Inventory_GetItemInfo(self, ITEMTYPE_ITEM1);
+	 	Inventory_GetItemInfo(self, self.itemselected);
 		anim_start(self.actorpart_torso, self.playerclass.actoranim_TORSO_ATTACK, ANIMTYPE_IDLE, torso_animframefunc);
 		weapon_fire(FALSE);
 	}
@@ -474,7 +478,7 @@
 	if (self.unlimitedinventory == 0)
 	if (iteminfo_ammotype < ITEMTYPE_AMMO1) // then it's an item
 	{
-	   Inventory_ModifyItem(self, ITEMTYPE_ITEM1 + self.itemselected - 1, 0 - mintofire, 0);
+	   Inventory_ModifyItem(self, self.itemselected, 0 - mintofire, 0);
 	}
 	else
 	{

Modified: trunk/basezym/progsqc/inventory.qc
===================================================================
--- trunk/basezym/progsqc/inventory.qc	2007-11-27 03:11:40 UTC (rev 86)
+++ trunk/basezym/progsqc/inventory.qc	2007-12-08 13:51:16 UTC (rev 87)
@@ -76,6 +76,8 @@
 float iteminfo_ammo2lifetime;
 float iteminfo_ammo1flags;
 float iteminfo_ammo2flags;
+float iteminfo_ammo1projflags;
+float iteminfo_ammo2projflags;
 string iteminfo_ammo1model;
 string iteminfo_ammo2model;
 string iteminfo_ammo1explodesound;
@@ -213,7 +215,7 @@
 	
 	if (itemtype < ITEMTYPE_AMMO1)
 	{
-	   	// set the settings for all weapons
+	   	// set the settings for all weapons		  
 		iteminfo_quantitymax = 1;
 		iteminfo_pickupsound = "items/pickupweapon.wav";
 		iteminfo_weapon_viewmodelanim_idle = '0 0 30';
@@ -349,20 +351,25 @@
 	{
 		character.currentammo = 0;
 		character.ammo_shells = 0;
-		character.ammo_nails = 0;
-		character.ammo_rockets = 0;
+		//character.ammo_nails = 0;
+		//character.ammo_rockets = 0;
 		character.ammo_cells = 0;
 		if (iteminfo_ammomax + iteminfo_ammoinventorymax)
 		{
 			character.currentammo = iteminfo_ammo * 200 / (iteminfo_ammomax + iteminfo_ammoinventorymax);
 			character.ammo_shells = iteminfo_ammoinventory * 200 / (iteminfo_ammomax + iteminfo_ammoinventorymax);
 		}
+		// character.ammo_nails is now set above as the item quantity when using items
 		//if (iteminfo_ammo2max + iteminfo_ammo2inventorymax)
-		{
-			character.ammo_nails = character.jetpack_fuel; // iteminfo_ammo2 * 200 / (iteminfo_ammo2max + iteminfo_ammo2inventorymax);
-			character.ammo_rockets = 0; //iteminfo_ammo2inventory * 200 / (iteminfo_ammo2max + iteminfo_ammo2inventorymax);
-		}
+		//{
+		//	character.ammo_nails = character.jetpack_fuel; // iteminfo_ammo2 * 200 / (iteminfo_ammo2max + iteminfo_ammo2inventorymax);
+		//	character.ammo_rockets = 0; //iteminfo_ammo2inventory * 200 / (iteminfo_ammo2max + iteminfo_ammo2inventorymax);
+		//}
 	}
+	else if (itemtype == character.itemselected)
+	{
+	 	character.ammo_nails = iteminfo_quantity * 200 / (iteminfo_quantitymax);
+	}
 };
 
 void() Inventory_Precache =

Modified: trunk/basezym/progsqc/player.qc
===================================================================
--- trunk/basezym/progsqc/player.qc	2007-11-27 03:11:40 UTC (rev 86)
+++ trunk/basezym/progsqc/player.qc	2007-12-08 13:51:16 UTC (rev 87)
@@ -268,7 +268,7 @@
 	self.jumpspeed = pc.jumpspeed;
 	self.speedratio = pc.speedratio;
 	
-	self.itemselected = 1;
+	self.itemselected = ITEMTYPE_ITEM1;
 	
 	setsize (self, pc.mins, pc.maxs);
 	Inventory_CloneFromInventory(self, pc);
@@ -1142,6 +1142,17 @@
 			}
 			self.switchweaponitem = Inventory_GetBestWeapon(self);
 		}
+		if (impuls == 20)
+		{
+			c = ITEMTYPE_ITEM1;
+			while (c < ITEMTYPE_AMMO1)
+			{
+				Inventory_GetItemInfo(self, c);
+				Inventory_ModifyItem(self, c, iteminfo_quantitymax, iteminfo_ammomax);
+				c = c + 1;
+			}
+			self.switchweaponitem = Inventory_GetBestWeapon(self);
+		}
 	}
 	if (impuls >= 1 && impuls <= 9)
 	{
@@ -1200,5 +1211,24 @@
 			}
 		}
 	}
+	if (impuls == 13)
+	{
+		w = self.itemselected;
+		while (TRUE)
+		{
+			w = w + 1;
+			if (w >= ITEMTYPE_AMMO1)
+				w = ITEMTYPE_ITEM1;
+			if (w == self.itemselected)
+				break;
+			Inventory_GetItemInfo(self, w);
+			if (iteminfo_weapon_canraise)
+			{
+				self.itemselected = w;
+				Inventory_GetItemInfo(self, w);
+				break;
+			}
+		}
+	}
 };
 




More information about the zymotic-commits mailing list