Module dpmod: Change committed

havoc at icculus.org havoc at icculus.org
Wed Jun 11 05:07:48 EDT 2003


Commiter   : havoc
CVSROOT    : /cvs/cvsroot/twilight
Module     : dpmod
Commit time: 2003-06-11 09:07:47 UTC

Log message:

small change (hah!) - .ammo_shells, .ammo_nails, .ammo_rockets, .ammo_cells, and .ammo_xshells ceased to exist (except for updateammodisplay), replaced by a general item system which will grow to be far more useful than just keeping track of ammo counts, but it has to start somewhere...  inventory.qc contains the relevant functions.
grenade launcher now fires impact grenades (again) because pipebombs just weren't very useful and the bots were clueless about them anyway

Modified files:
     qc/client.qc qc/damage.qc qc/dpextensions.qc qc/havocbot_roles.qc
     qc/havocbotold_qcwaypoints.qc qc/havocbotold_qcwaysurfaces.qc
     qc/item_ammo.qc qc/item_backpacks.qc qc/item_weapons.qc
     qc/m_enforcer.qc qc/m_ogre.qc qc/m_soldier.qc qc/modedefs.qc
     qc/player.qc qc/progs.src qc/w_dbshotgun.qc qc/w_frame.qc
     qc/w_grenade.qc qc/w_info.qc qc/w_lightning.qc qc/w_nailgun.qc
     qc/w_oldplasmarifle.qc qc/w_plasmarifle.qc qc/w_plasmawave.qc
     qc/w_rocket.qc qc/w_shotgun.qc qc/w_supernailgun.qc

Added files:
     qc/inventory.qc

------=MIME.13146b7f53ad5fbacc9d6ef3925c48d0
Content-Type: text/plain; name="dpmod.20030611.090747.havoc.diff"
Content-Disposition: attachment; filename="dpmod.20030611.090747.havoc.diff"
Content-Transfer-Encoding: 8bit

Index: dpmod/qc/client.qc
diff -u dpmod/qc/client.qc:1.6 dpmod/qc/client.qc:1.7
--- dpmod/qc/client.qc:1.6	Wed Apr  9 23:24:30 2003
+++ dpmod/qc/client.qc	Wed Jun 11 05:07:37 2003
@@ -23,7 +23,7 @@
 
 float modelindex_nogun;
 
-/*
+/*c
 void() speech_precache =
 {
 	gibcomment_precache();
@@ -162,13 +162,13 @@
 	parm1 = self.items;
 	parm2 = self.health;
 	parm3 = self.armorvalue;
-	parm4 = self.ammo_shells;
-	parm5 = self.ammo_nails;
-	parm6 = self.ammo_rockets;
-	parm7 = self.ammo_cells;
+	parm4 = ItemQuantity(self, "shells");
+	parm5 = ItemQuantity(self, "nails");
+	parm6 = ItemQuantity(self, "rockets");
+	parm7 = ItemQuantity(self, "cells");
 	parm8 = self.weapon;
 	parm9 = self.armortype * 100;
-	parm10 = self.ammo_xshells;
+	parm10 = ItemQuantity(self, "xshells");
 };
 
 void() DecodeLevelParms =
@@ -181,12 +181,12 @@
 			self.health = self.max_health = HEALTHELIMINATION;
 		self.armortype = 0.8;
 		self.armorvalue = 200;
-		// this gets clipped down to whatever I have it set up for in bound_ammo, so I don't have to edit this when changing ammo limits
-		self.ammo_shells = 9999999;
-		self.ammo_nails = 9999999;
-		self.ammo_rockets = 9999999;
-		self.ammo_cells = 9999999;
-		self.ammo_xshells = 9999999;
+		// this gets clipped down to whatever the limits are
+		ItemSetQuantity(self, "shells", 9999999);
+		ItemSetQuantity(self, "nails", 9999999);
+		ItemSetQuantity(self, "rockets", 9999999);
+		ItemSetQuantity(self, "cells", 9999999);
+		ItemSetQuantity(self, "xshells", 9999999);
 		self.weapon = W_BestWeapon(TRUE);
 	}
 	else if (deathmatch)
@@ -196,11 +196,11 @@
 		self.max_health = HEALTHMAX;
 		self.armorvalue = 50;
 		self.armortype = 0.3;
-		self.ammo_shells = STARTDM_AMMO_SHELLS;
-		self.ammo_nails = STARTDM_AMMO_NAILS;
-		self.ammo_rockets = STARTDM_AMMO_ROCKETS;
-		self.ammo_cells = STARTDM_AMMO_CELLS;
-		self.ammo_xshells = STARTDM_AMMO_XSHELLS;
+		ItemSetQuantity(self, "shells", STARTDM_AMMO_SHELLS);
+		ItemSetQuantity(self, "nails", STARTDM_AMMO_NAILS);
+		ItemSetQuantity(self, "rockets", STARTDM_AMMO_ROCKETS);
+		ItemSetQuantity(self, "cells", STARTDM_AMMO_CELLS);
+		ItemSetQuantity(self, "xshells", STARTDM_AMMO_XSHELLS);
 		self.weapon = W_BestWeapon(TRUE);
 	}
 	else // singleplayer or coop
@@ -214,16 +214,15 @@
 		if (self.health < 1)
 			self.health = 1;
 		self.armorvalue = parm3;
-		self.ammo_shells = parm4;
-		self.ammo_nails = parm5;
-		self.ammo_rockets = parm6;
-		self.ammo_cells = parm7;
+		ItemSetQuantity(self, "shells", parm4);
+		ItemSetQuantity(self, "nails", parm5);
+		ItemSetQuantity(self, "rockets", parm6);
+		ItemSetQuantity(self, "cells", parm7);
 		self.weapon = parm8;
 		self.armortype = parm9 / 100;
-		self.ammo_xshells = parm10;
+		ItemSetQuantity(self, "xshells", parm10);
 	}
 	self.bodyhealth = self.health + 100;
-	bound_ammo(self);
 	if ((self.items & self.weapon) == 0)
 		self.weapon = W_BestWeapon(TRUE);
 	self.switchweapon = self.weapon;
@@ -851,7 +850,12 @@
 		self.solid = SOLID_NOT;
 		self.classname = "player";
 		self.health = 999;
-		self.armortype = self.armorvalue = self.currentammo = self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = self.ammo_xshells = 0;
+		self.armortype = self.armorvalue = self.currentammo = 0;
+		ItemSetQuantity(self, "shells", 0);
+		ItemSetQuantity(self, "nails", 0);
+		ItemSetQuantity(self, "rockets", 0);
+		ItemSetQuantity(self, "cells", 0);
+		ItemSetQuantity(self, "xshells", 0);
 		self.items = 0;
 		self.think = SUB_Null;
 		self.nextthink = 0;
@@ -1162,11 +1166,11 @@
 
 	if (cvar("temp1") & 4096)
 	{
-		self.ammo_shells = AMMOMAX_SHELLS;
-		self.ammo_nails = AMMOMAX_NAILS;
-		self.ammo_rockets = AMMOMAX_ROCKETS;
-		self.ammo_cells = AMMOMAX_CELLS;
-		self.ammo_xshells = AMMOMAX_XSHELLS;
+		ItemSetQuantity(self, "shells", AMMOMAX_SHELLS);
+		ItemSetQuantity(self, "nails", AMMOMAX_NAILS);
+		ItemSetQuantity(self, "rockets", AMMOMAX_ROCKETS);
+		ItemSetQuantity(self, "cells", AMMOMAX_CELLS);
+		ItemSetQuantity(self, "xshells", AMMOMAX_XSHELLS);
 	}
 
 	if (intermission_running)
Index: dpmod/qc/damage.qc
diff -u dpmod/qc/damage.qc:1.3 dpmod/qc/damage.qc:1.4
--- dpmod/qc/damage.qc:1.3	Tue Mar 11 14:30:35 2003
+++ dpmod/qc/damage.qc	Wed Jun 11 05:07:37 2003
@@ -112,34 +112,5 @@
 float MH_WIZARD    =    80;float MB_WIZARD    =    70;
 float MH_ZOMBIE    =   200; // explosives do more damage than normal
 
-void(entity e) bound_ammo =
-{
-	if (e.ammo_shells  > AMMOMAX_SHELLS ) e.ammo_shells  = AMMOMAX_SHELLS;
-	if (e.ammo_nails   > AMMOMAX_NAILS  ) e.ammo_nails   = AMMOMAX_NAILS;
-	if (e.ammo_rockets > AMMOMAX_ROCKETS) e.ammo_rockets = AMMOMAX_ROCKETS;
-	if (e.ammo_cells   > AMMOMAX_CELLS  ) e.ammo_cells   = AMMOMAX_CELLS;
-	if (e.ammo_xshells > AMMOMAX_XSHELLS) e.ammo_xshells = AMMOMAX_XSHELLS;
-};
-
-float(entity e, float t, float a) full_ammo =
-{
-	if (t == 1 && (e.ammo_shells  + a) > AMMOMAX_SHELLS ) return (AMMOMAX_SHELLS  - e.ammo_shells );
-	if (t == 2 && (e.ammo_nails   + a) > AMMOMAX_NAILS  ) return (AMMOMAX_NAILS   - e.ammo_nails  );
-	if (t == 3 && (e.ammo_rockets + a) > AMMOMAX_ROCKETS) return (AMMOMAX_ROCKETS - e.ammo_rockets);
-	if (t == 4 && (e.ammo_cells   + a) > AMMOMAX_CELLS  ) return (AMMOMAX_CELLS   - e.ammo_cells  );
-	if (t == 5 && (e.ammo_xshells + a) > AMMOMAX_XSHELLS) return (AMMOMAX_XSHELLS - e.ammo_xshells);
-	return a;
-};
-
-void(entity e) updateammodisplay =
-{
-/*
-	e.ammo_shells = e.ammo_shells;
-	e.ammo_nails = e.ammo_rounds;
-	e.ammo_rockets = e.ammo_bombs;
-	e.ammo_cells = e.ammo_plasma;
-*/
-};
-
 void(entity targ, entity inflictor, entity attacker, float damage, float bdamage, string dt, float damgtype, vector damgpoint, vector force, void(entity t, entity a, string m, float dtyp) obitfunc) T_Damage;
 void(entity inflictor, entity attacker, float damage, float radius, entity ignore, string dethtype, float damgtype, void(entity t, entity a, string m, float dtyp) obitfunc) T_RadiusDamage;
Index: dpmod/qc/dpextensions.qc
diff -u dpmod/qc/dpextensions.qc:1.4 dpmod/qc/dpextensions.qc:1.5
--- dpmod/qc/dpextensions.qc:1.4	Sun Jun  8 03:52:47 2003
+++ dpmod/qc/dpextensions.qc	Wed Jun 11 05:07:37 2003
@@ -1,6 +1,18 @@
 
 //DarkPlaces supported extension list, draft version 1.03
 
+//DP_QC_BOTCLIENT
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//builtin definitions:
+//entity() spawnclient = #; // like spawn but for client slots (also calls relevant connect/spawn functions), returns world if no clients available
+//void(entity e) removeclient = #; // like remove but for client slots (also calls relevant disconnect functions)
+//description:
+//functions to allow bots to use client slots with no hacks, some notes:
+//.netname controls name on scoreboard (so be sure to set it)
+//.frags controls score on scoreboard (this is expected)
+//.clientcolors controls coloring on scoreboard (this determines player colors exactly like the "color" command, except for using )
+
 //unassigned stuff:  (need to write up specs but haven't yet)
 .vector punchvector; // DP_SV_PUNCHVECTOR
 .float  ping; // DP_SV_PING
@@ -17,9 +29,9 @@
 //from then on you can check ext_setcolor to know if that extension is available
 
 // LordHavoc: HIGHLY experimental, do not implement this in other engines
+//DP_CGAME
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
-//DP_CGAME
 //SVC definitions:
 float svc_cgame = 50; // [short] length [bytes] data
 //description:
@@ -411,6 +423,18 @@
 //description:
 //the engine supports .spr32 sprites.
 
+//DP_SV_CLIENTCOLORS
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+.float clientcolors; // colors of the client (format: pants + shirt * 16)
+//description:
+//allows qc to read and modify the client colors associated with a client entity (not particularly useful on other entities), and automatically sends out any appropriate network updates if changed
+
+//DP_SV_CLIENTNAME
+//idea: LordHavoc
+//darkplaces implementation: LordHavoc
+//allows qc to modify the client's .netname, and automatically sends out any appropriate network updates if changed
+
 //DP_SV_DRAWONLYTOCLIENT
 //idea: LordHavoc
 //darkplaces implementation: LordHavoc
@@ -458,6 +482,7 @@
 //description:
 //setcolor sets the color on a client and updates internal color information accordingly (equivilant to stuffing a "color" command but immediate)
 //SV_ChangeTeam is called by the engine whenever a "color" command is recieved, it may decide to do anything it pleases with the color passed by the client, including rejecting it (by doing nothing), or calling setcolor to apply it, preventing team changes is one use for this.
+//the color format is pants + shirt * 16 (0-255 potentially)
 
 //DP_SV_SLOWMO
 //idea: LordHavoc
Index: dpmod/qc/havocbot_roles.qc
diff -u dpmod/qc/havocbot_roles.qc:1.2 dpmod/qc/havocbot_roles.qc:1.3
--- dpmod/qc/havocbot_roles.qc:1.2	Fri Sep 20 01:35:21 2002
+++ dpmod/qc/havocbot_roles.qc	Wed Jun 11 05:07:37 2003
@@ -141,7 +141,7 @@
 void(float ratingscale) havocbot_goalrating_ctf_droppedflags =
 {
 	local entity redflag, blueflag;
-	
+
 	redflag = find(world, classname, "item_flag_team1");
 	blueflag = find(world, classname, "item_flag_team2");
 
@@ -354,7 +354,7 @@
 	*/
 	if (!self.havocbot_role_timeout)
 		self.havocbot_role_timeout = time + random() * 30 + 60;
-	if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout)
+	if (ItemQuantity(self, "rockets") < 15 || time > self.havocbot_role_timeout)
 	{
 		bprint("changing role to middle\n");
 		self.havocbot_role = havocbot_role_ctf_middle;
@@ -409,7 +409,7 @@
 	if (!self.havocbot_role_timeout)
 		self.havocbot_role_timeout = time + random() * 10 + 10;
 	if (time > self.havocbot_role_timeout)
-	if (self.ammo_rockets >= 25)
+	if (ItemQuantity(self, "rockets") >= 25)
 	{
 		if (random() < 0.5)
 		{
@@ -473,7 +473,7 @@
 	*/
 	if (!self.havocbot_role_timeout)
 		self.havocbot_role_timeout = time + random() * 20 + 30;
-	if (self.ammo_rockets < 15 || time > self.havocbot_role_timeout)
+	if (ItemQuantity(self, "rockets") < 15 || time > self.havocbot_role_timeout)
 	{
 		bprint("changing role to middle\n");
 		self.havocbot_role = havocbot_role_ctf_middle;
Index: dpmod/qc/havocbotold_qcwaypoints.qc
diff -u dpmod/qc/havocbotold_qcwaypoints.qc:1.1.1.1 dpmod/qc/havocbotold_qcwaypoints.qc:1.2
--- dpmod/qc/havocbotold_qcwaypoints.qc:1.1.1.1	Thu Sep 19 15:08:30 2002
+++ dpmod/qc/havocbotold_qcwaypoints.qc	Wed Jun 11 05:07:37 2003
@@ -1389,28 +1389,10 @@
 
 void() havocbot_chooseweapon =
 {
-	/*
-	local   float   best, bestdamage, shotspeed, dist;
-	dist = vlen(self.enemy.origin - self.origin);
-	best = IT_WEAPON1;bestdamage = DMG_WEAPON1;
-	if (self.items & IT_WEAPON2) if (self.ammo_shells  >= 1) if (dist >= DMG_WEAPON2_MINRANGE) if (dist < DMG_WEAPON2_RANGE) if (DMG_WEAPON2 > bestdamage) {best = IT_WEAPON2;bestdamage = DMG_WEAPON2;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON3) if (self.ammo_shells  >= 1) if (dist >= DMG_WEAPON3_MINRANGE) if (dist < DMG_WEAPON3_RANGE) if (DMG_WEAPON3 > bestdamage) {best = IT_WEAPON3;bestdamage = DMG_WEAPON3;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON4) if (self.ammo_nails   >= 1) if (dist >= DMG_WEAPON4_MINRANGE) if (dist < DMG_WEAPON4_RANGE) if (DMG_WEAPON4 > bestdamage) {best = IT_WEAPON4;bestdamage = DMG_WEAPON4;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON5) if (self.ammo_nails   >= 1) if (dist >= DMG_WEAPON5_MINRANGE) if (dist < DMG_WEAPON5_RANGE) if (DMG_WEAPON5 > bestdamage) {best = IT_WEAPON5;bestdamage = DMG_WEAPON5;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON6) if (self.ammo_rockets >= 1) if (dist >= DMG_WEAPON6_MINRANGE) if (dist < DMG_WEAPON6_RANGE) if (DMG_WEAPON6 > bestdamage) {best = IT_WEAPON6;bestdamage = DMG_WEAPON6;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON7) if (self.ammo_rockets >= 1) if (dist >= DMG_WEAPON7_MINRANGE) if (dist < DMG_WEAPON7_RANGE) if (DMG_WEAPON7 > bestdamage) {best = IT_WEAPON7;bestdamage = DMG_WEAPON7;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON8) if (self.ammo_cells   >= 1) if (dist >= DMG_WEAPON8_MINRANGE) if (dist < DMG_WEAPON8_RANGE) if (DMG_WEAPON8 > bestdamage) {best = IT_WEAPON8;bestdamage = DMG_WEAPON8;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON9) if (self.ammo_cells   >= 1) if (dist >= DMG_WEAPON9_MINRANGE) if (dist < DMG_WEAPON9_RANGE) if (DMG_WEAPON9 > bestdamage) {best = IT_WEAPON9;bestdamage = DMG_WEAPON9;shotspeed = DMG_WEAPON2_VELOCITY;}
-	self.switcheapon = best;
-	if (shotspeed >= 10000)
-		self.shotlead = 0; // instant weapon
-	else
-		self.shotlead = 1 / shotspeed;
-	*/
 	if (time > self.weaponchangetimeout || !setweapon(self.switchweapon, WR_SELECTABLE))
 	{
 		self.weaponchangetimeout = time + 0.5;
-		self.switchweapon = W_BestWeaponForTarget(self.enemy); //W_BestWeapon(TRUE);
+		self.switchweapon = W_BestWeaponForTarget(self.enemy);
 	}
 };
 
Index: dpmod/qc/havocbotold_qcwaysurfaces.qc
diff -u dpmod/qc/havocbotold_qcwaysurfaces.qc:1.1.1.1 dpmod/qc/havocbotold_qcwaysurfaces.qc:1.2
--- dpmod/qc/havocbotold_qcwaysurfaces.qc:1.1.1.1	Thu Sep 19 15:08:20 2002
+++ dpmod/qc/havocbotold_qcwaysurfaces.qc	Wed Jun 11 05:07:37 2003
@@ -1046,28 +1046,10 @@
 
 void() havocbot_chooseweapon =
 {
-	/*
-	local   float   best, bestdamage, shotspeed, dist;
-	dist = vlen(self.enemy.origin - self.origin);
-	best = IT_WEAPON1;bestdamage = DMG_WEAPON1;
-	if (self.items & IT_WEAPON2) if (self.ammo_shells  >= 1) if (dist >= DMG_WEAPON2_MINRANGE) if (dist < DMG_WEAPON2_RANGE) if (DMG_WEAPON2 > bestdamage) {best = IT_WEAPON2;bestdamage = DMG_WEAPON2;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON3) if (self.ammo_shells  >= 1) if (dist >= DMG_WEAPON3_MINRANGE) if (dist < DMG_WEAPON3_RANGE) if (DMG_WEAPON3 > bestdamage) {best = IT_WEAPON3;bestdamage = DMG_WEAPON3;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON4) if (self.ammo_nails   >= 1) if (dist >= DMG_WEAPON4_MINRANGE) if (dist < DMG_WEAPON4_RANGE) if (DMG_WEAPON4 > bestdamage) {best = IT_WEAPON4;bestdamage = DMG_WEAPON4;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON5) if (self.ammo_nails   >= 1) if (dist >= DMG_WEAPON5_MINRANGE) if (dist < DMG_WEAPON5_RANGE) if (DMG_WEAPON5 > bestdamage) {best = IT_WEAPON5;bestdamage = DMG_WEAPON5;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON6) if (self.ammo_rockets >= 1) if (dist >= DMG_WEAPON6_MINRANGE) if (dist < DMG_WEAPON6_RANGE) if (DMG_WEAPON6 > bestdamage) {best = IT_WEAPON6;bestdamage = DMG_WEAPON6;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON7) if (self.ammo_rockets >= 1) if (dist >= DMG_WEAPON7_MINRANGE) if (dist < DMG_WEAPON7_RANGE) if (DMG_WEAPON7 > bestdamage) {best = IT_WEAPON7;bestdamage = DMG_WEAPON7;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON8) if (self.ammo_cells   >= 1) if (dist >= DMG_WEAPON8_MINRANGE) if (dist < DMG_WEAPON8_RANGE) if (DMG_WEAPON8 > bestdamage) {best = IT_WEAPON8;bestdamage = DMG_WEAPON8;shotspeed = DMG_WEAPON2_VELOCITY;}
-	if (self.items & IT_WEAPON9) if (self.ammo_cells   >= 1) if (dist >= DMG_WEAPON9_MINRANGE) if (dist < DMG_WEAPON9_RANGE) if (DMG_WEAPON9 > bestdamage) {best = IT_WEAPON9;bestdamage = DMG_WEAPON9;shotspeed = DMG_WEAPON2_VELOCITY;}
-	self.switcheapon = best;
-	if (shotspeed >= 10000)
-		self.shotlead = 0; // instant weapon
-	else
-		self.shotlead = 1 / shotspeed;
-	*/
-	if (time > self.weaponchangetimeout/* || !setweapon(self.switchweapon, WR_SELECTABLE)*/)
+	if (time > self.weaponchangetimeout)
 	{
 		self.weaponchangetimeout = time + 0.2;
-		self.switchweapon = W_BestWeapon(TRUE);//ForTarget(self.enemy); //W_BestWeapon(TRUE);
+		self.switchweapon = W_BestWeapon(TRUE);
 	}
 };
 
Index: dpmod/qc/inventory.qc
diff -u /dev/null dpmod/qc/inventory.qc:1.1
--- /dev/null	Wed Jun 11 05:07:47 2003
+++ dpmod/qc/inventory.qc	Wed Jun 11 05:07:37 2003
@@ -0,0 +1,147 @@
+
+.float count;
+.float count1;
+.entity inventory_next;
+.entity inventory_prev;
+
+entity(entity e, string name) ItemCreate =
+{
+	local entity item;
+	item = spawn();
+	item.classname = "playeritem";
+	item.netname = name;
+	item.owner = e;
+	item.count = 0;
+	item.count1 = 10;
+	item.inventory_next = item.owner;
+	item.inventory_prev = item.inventory_next.inventory_prev;
+	item.inventory_next.inventory_prev = item;
+	item.inventory_prev.inventory_next = item;
+	     if (name == "shells") item.count1 = AMMOMAX_SHELLS;
+	else if (name == "nails") item.count1 = AMMOMAX_NAILS;
+	else if (name == "rockets") item.count1 = AMMOMAX_ROCKETS;
+	else if (name == "cells") item.count1 = AMMOMAX_CELLS;
+	else if (name == "xshells") item.count1 = AMMOMAX_XSHELLS;
+	return item;
+};
+
+entity(entity e, string name) ItemByName =
+{
+	local entity item;
+	item = e.inventory_next;
+	if (item == world)
+		item = e.inventory_next = e.inventory_prev = e;
+	while (item != e)
+	{
+		if (item.netname == name)
+			return item;
+		item = item.inventory_next;
+	}
+	return world;
+};
+
+float(entity e, string name) ItemMaxQuantity =
+{
+	local entity item;
+	item = ItemByName(e, name);
+	if (item)
+		return item.count1;
+	/*
+	if (name == "shells")
+		return AMMOMAX_SHELLS;
+	if (name == "nails")
+		return AMMOMAX_NAILS;
+	if (name == "rockets")
+		return AMMOMAX_ROCKETS;
+	if (name == "cells")
+		return AMMOMAX_CELLS;
+	if (name == "xshells")
+		return AMMOMAX_XSHELLS;
+	*/
+	return 255;
+};
+
+float(entity e, string name) ItemQuantity =
+{
+	local entity item;
+	item = ItemByName(e, name);
+	if (item)
+		return item.count;
+	/*
+	if (name == "shells")
+		return e.ammo_shells;
+	if (name == "nails")
+		return e.ammo_nails;
+	if (name == "rockets")
+		return e.ammo_rockets;
+	if (name == "cells")
+		return e.ammo_cells;
+	if (name == "xshells")
+		return e.ammo_xshells;
+	*/
+	return 0;
+};
+
+float(entity e, string name, float n) ItemAdjustQuantity =
+{
+	local entity item;
+	item = ItemByName(e, name);
+	if (item == world)
+		item = ItemCreate(e, name);
+	return (item.count = bound(0, item.count + n, item.count1));
+	/*
+	if (name == "shells")
+		return (e.ammo_shells = bound(0, e.ammo_shells + n, AMMOMAX_SHELLS));
+	if (name == "nails")
+		return (e.ammo_nails = bound(0, e.ammo_nails + n, AMMOMAX_NAILS));
+	if (name == "rockets")
+		return (e.ammo_rockets = bound(0, e.ammo_rockets + n, AMMOMAX_ROCKETS));
+	if (name == "cells")
+		return (e.ammo_cells = bound(0, e.ammo_cells + n, AMMOMAX_CELLS));
+	if (name == "xshells")
+		return (e.ammo_xshells = bound(0, e.ammo_xshells + n, AMMOMAX_XSHELLS));
+	*/
+};
+
+float(entity e, string name, float n) ItemSetQuantity =
+{
+	local entity item;
+	item = ItemByName(e, name);
+	if (item == world)
+		item = ItemCreate(e, name);
+	return (item.count = bound(0, n, item.count1));
+	/*
+	if (name == "shells")
+		return (e.ammo_shells = bound(0, n, AMMOMAX_SHELLS));
+	if (name == "nails")
+		return (e.ammo_nails = bound(0, n, AMMOMAX_NAILS));
+	if (name == "rockets")
+		return (e.ammo_rockets = bound(0, n, AMMOMAX_ROCKETS));
+	if (name == "cells")
+		return (e.ammo_cells = bound(0, n, AMMOMAX_CELLS));
+	if (name == "xshells")
+		return (e.ammo_xshells = bound(0, n, AMMOMAX_XSHELLS));
+	*/
+};
+
+float(entity e, float t, float a) full_ammo =
+{
+	local string s;
+	     if (t == 1) s = "shells";
+	else if (t == 2) s = "nails";
+	else if (t == 3) s = "rockets";
+	else if (t == 4) s = "cells";
+	else if (t == 5) s = "xshells";
+	else             return a;
+	return min(a, ItemMaxQuantity(e, s) - ItemQuantity(e, s));
+};
+
+void(entity e) updateammodisplay =
+{
+	e.ammo_shells = ItemQuantity(e, "shells");
+	e.ammo_nails = ItemQuantity(e, "nails");
+	e.ammo_rockets = ItemQuantity(e, "rockets");
+	e.ammo_cells = ItemQuantity(e, "cells");
+};
+
+
Index: dpmod/qc/item_ammo.qc
diff -u dpmod/qc/item_ammo.qc:1.3 dpmod/qc/item_ammo.qc:1.4
--- dpmod/qc/item_ammo.qc:1.3	Tue Mar 11 14:28:06 2003
+++ dpmod/qc/item_ammo.qc	Wed Jun 11 05:07:37 2003
@@ -27,14 +27,12 @@
 	best = W_BestWeapon(TRUE);
 	self = stemp;
 
-	if (self.weapon == 1) other.ammo_shells  = other.ammo_shells  + self.aflag;
-	if (self.weapon == 2) other.ammo_nails   = other.ammo_nails   + self.aflag;
-	if (self.weapon == 3) other.ammo_rockets = other.ammo_rockets + self.aflag;
-	if (self.weapon == 4) other.ammo_cells   = other.ammo_cells   + self.aflag;
-	if (self.weapon == 5) other.ammo_xshells = other.ammo_xshells + self.aflag;
+	if (self.weapon == 1) ItemAdjustQuantity(other, "shells", self.aflag);
+	if (self.weapon == 2) ItemAdjustQuantity(other, "nails", self.aflag);
+	if (self.weapon == 3) ItemAdjustQuantity(other, "rockets", self.aflag);
+	if (self.weapon == 4) ItemAdjustQuantity(other, "cells", self.aflag);
+	if (self.weapon == 5) ItemAdjustQuantity(other, "xshells", self.aflag);
 
-	bound_ammo (other);
-
 	if (other.flags & FL_CLIENT)
 	{
 //		sprint (other, self.netname);
@@ -77,11 +75,11 @@
 
 float WEAPON_BIG2 = 1;
 
-float(entity player, entity item) item_shells_pickupeval = {if (player.ammo_shells < AMMOMAX_SHELLS) return (AMMOMAX_SHELLS - player.ammo_shells) * (AMMOMAX_SHELLS - player.ammo_shells) * item.dmg;else return 0;};
-float(entity player, entity item) item_nails_pickupeval = {if (player.ammo_nails < AMMOMAX_NAILS) return (AMMOMAX_NAILS - player.ammo_nails) * (AMMOMAX_NAILS - player.ammo_nails) * item.dmg;else return 0;};
-float(entity player, entity item) item_rockets_pickupeval = {if (player.ammo_rockets < AMMOMAX_ROCKETS) return (AMMOMAX_ROCKETS - player.ammo_rockets) * (AMMOMAX_ROCKETS - player.ammo_rockets) * item.dmg;else return 0;};
-float(entity player, entity item) item_cells_pickupeval = {if (player.ammo_cells < AMMOMAX_CELLS) return (AMMOMAX_CELLS - player.ammo_cells) * (AMMOMAX_CELLS - player.ammo_cells) * item.dmg;else return 0;};
-//float(entity player, entity item) item_xshells_pickupeval = {if (player.ammo_xshells < AMMOMAX_XSHELLS) return (AMMOMAX_XSHELLS - player.ammo_xshells) * (AMMOMAX_XSHELLS - player.ammo_xshells) * item.dmg;else return 0;};
+float(entity player, entity item) item_shells_pickupeval = {if (ItemQuantity(player, "shells") < AMMOMAX_SHELLS) return (AMMOMAX_SHELLS - ItemQuantity(player, "shells")) * (AMMOMAX_SHELLS - ItemQuantity(player, "shells")) * item.dmg;else return 0;};
+float(entity player, entity item) item_nails_pickupeval = {if (ItemQuantity(player, "nails") < AMMOMAX_NAILS) return (AMMOMAX_NAILS - ItemQuantity(player, "nails")) * (AMMOMAX_NAILS - ItemQuantity(player, "nails")) * item.dmg;else return 0;};
+float(entity player, entity item) item_rockets_pickupeval = {if (ItemQuantity(player, "rockets") < AMMOMAX_ROCKETS) return (AMMOMAX_ROCKETS - ItemQuantity(player, "rockets")) * (AMMOMAX_ROCKETS - ItemQuantity(player, "rockets")) * item.dmg;else return 0;};
+float(entity player, entity item) item_cells_pickupeval = {if (ItemQuantity(player, "cells") < AMMOMAX_CELLS) return (AMMOMAX_CELLS - ItemQuantity(player, "cells")) * (AMMOMAX_CELLS - ItemQuantity(player, "cells")) * item.dmg;else return 0;};
+//float(entity player, entity item) item_xshells_pickupeval = {if (ItemQuantity(player, "xshells") < AMMOMAX_XSHELLS) return (AMMOMAX_XSHELLS - ItemQuantity(player, "xshells")) * (AMMOMAX_XSHELLS - ItemQuantity(player, "xshells")) * item.dmg;else return 0;};
 
 /*QUAKED item_shells (0 .5 .8) (0 0 0) (32 32 32)
 */
Index: dpmod/qc/item_backpacks.qc
diff -u dpmod/qc/item_backpacks.qc:1.1.1.1 dpmod/qc/item_backpacks.qc:1.2
--- dpmod/qc/item_backpacks.qc:1.1.1.1	Thu Sep 19 15:07:33 2002
+++ dpmod/qc/item_backpacks.qc	Wed Jun 11 05:07:37 2003
@@ -82,10 +82,10 @@
 	self = oself;
 
 	// add the ammo
-	other.ammo_shells  = other.ammo_shells  + self.ammo_shells;
-	other.ammo_nails   = other.ammo_nails   + self.ammo_nails;
-	other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
-	other.ammo_cells   = other.ammo_cells   + self.ammo_cells;
+	ItemAdjustQuantity(other, "shells", ItemQuantity(self, "shells"));
+	ItemAdjustQuantity(other, "nails", ItemQuantity(self, "nails"));
+	ItemAdjustQuantity(other, "rockets", ItemQuantity(self, "rockets"));
+	ItemAdjustQuantity(other, "cells", ItemQuantity(self, "cells"));
 	if (self.super_damage_finished > time)
 	if (self.super_damage_finished > other.super_damage_finished)
 	{
@@ -112,43 +112,41 @@
 	old = other.items;
 	other.items = old | new;
 
-	bound_ammo (other);
-
 	if (other.flags & FL_CLIENT)
 	{
-		if (self.ammo_shells)
+		if (ItemQuantity(self, "shells"))
 		{
 			if (acount)
 				sprint(other, ", ");
 			acount = 1;
-			s = ftos(self.ammo_shells);
+			s = ftos(ItemQuantity(self, "shells"));
 			sprint (other, s);
 			sprint (other, " shells");
 		}
-		if (self.ammo_nails)
+		if (ItemQuantity(self, "nails"))
 		{
 			if (acount)
 				sprint(other, ", ");
 			acount = 1;
-			s = ftos(self.ammo_nails);
+			s = ftos(ItemQuantity(self, "nails"));
 			sprint (other, s);
 			sprint (other, " rounds");
 		}
-		if (self.ammo_rockets)
+		if (ItemQuantity(self, "rockets"))
 		{
 			if (acount)
 				sprint(other, ", ");
 			acount = 1;
-			s = ftos(self.ammo_rockets);
+			s = ftos(ItemQuantity(self, "rockets"));
 			sprint (other, s);
 			sprint (other, " rockets");
 		}
-		if (self.ammo_cells)
+		if (ItemQuantity(self, "cells"))
 		{
 			if (acount)
 				sprint(other, ", ");
 			acount = 1;
-			s = ftos(self.ammo_cells);
+			s = ftos(ItemQuantity(self, "cells"));
 			sprint (other, s);
 			sprint (other, " cells");
 		}
@@ -218,7 +216,7 @@
 
 	if (deathmatch == DM_FRAGFEST || deathmatch == DM_ELIM)
 		return;
-	if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
+	if (!(ItemQuantity(self, "shells") + ItemQuantity(self, "nails") + ItemQuantity(self, "rockets") + ItemQuantity(self, "cells")))
 	if (!(self.super_damage_finished || self.invisible_finished || self.invincible_finished))
 	if (!(self.items & (IT_WEAPON3 | IT_WEAPON4 | IT_WEAPON5 | IT_WEAPON6 | IT_WEAPON7 | IT_WEAPON8 | IT_WEAPON9 | IT_WEAPON10)))
 		return; // nothing in it
@@ -252,14 +250,14 @@
 	item.items = self.items & (IT_WEAPON1 | IT_WEAPON2 | IT_WEAPON3 | IT_WEAPON4 | IT_WEAPON5 | IT_WEAPON6 | IT_WEAPON7 | IT_WEAPON8 | IT_WEAPON9 | IT_WEAPON10);
 	self.items = self.items - item.items;
 
-	item.ammo_shells = self.ammo_shells;
-	item.ammo_nails = self.ammo_nails;
-	item.ammo_rockets = self.ammo_rockets;
-	item.ammo_cells = self.ammo_cells;
-	self.ammo_shells = 0;
-	self.ammo_nails = 0;
-	self.ammo_rockets = 0;
-	self.ammo_cells = 0;
+	ItemSetQuantity(item, "shells", ItemQuantity(self, "shells"));
+	ItemSetQuantity(item, "nails", ItemQuantity(self, "nails"));
+	ItemSetQuantity(item, "rockets", ItemQuantity(self, "rockets"));
+	ItemSetQuantity(item, "cells", ItemQuantity(self, "cells"));
+	ItemSetQuantity(self, "shells", 0);
+	ItemSetQuantity(self, "nails", 0);
+	ItemSetQuantity(self, "rockets", 0);
+	ItemSetQuantity(self, "cells", 0);
 	item.super_damage_finished = self.super_damage_finished;
 	item.invisible_finished = self.invisible_finished;
 	item.invincible_finished = self.invincible_finished;
@@ -305,10 +303,10 @@
 	if (item.items & IT_WEAPON8) item.havocrating = item.havocrating + 300;
 	if (item.items & IT_WEAPON9) item.havocrating = item.havocrating + 0;
 	if (item.items & IT_WEAPON10) item.havocrating = item.havocrating + 300;
-	item.havocrating = item.havocrating + item.ammo_shells * 60;
-	item.havocrating = item.havocrating + item.ammo_nails * 15;
-	item.havocrating = item.havocrating + item.ammo_rockets * 120;
-	item.havocrating = item.havocrating + item.ammo_cells * 30;
+	item.havocrating = item.havocrating + ItemQuantity(item, "shells") * 60;
+	item.havocrating = item.havocrating + ItemQuantity(item, "nails") * 15;
+	item.havocrating = item.havocrating + ItemQuantity(item, "rockets") * 120;
+	item.havocrating = item.havocrating + ItemQuantity(item, "cells") * 30;
 	if (item.super_damage_finished > time) item.havocrating = item.havocrating + 10 * (item.super_damage_finished - time);
 	if (item.invisible_finished    > time) item.havocrating = item.havocrating + 10 * (item.invisible_finished - time);
 	if (item.invincible_finished   > time) item.havocrating = item.havocrating + 20 * (item.invincible_finished - time);
Index: dpmod/qc/item_weapons.qc
diff -u dpmod/qc/item_weapons.qc:1.4 dpmod/qc/item_weapons.qc:1.5
--- dpmod/qc/item_weapons.qc:1.4	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/item_weapons.qc	Wed Jun 11 05:07:37 2003
@@ -22,11 +22,11 @@
 		return;
 	new = self.weapon;
 	if (other.items & self.weapon == self.weapon) // has it already
-	if ((other.ammo_shells  >= AMMOMAX_SHELLS ) || (self.ammo_shells  < 1))
-	if ((other.ammo_nails   >= AMMOMAX_NAILS  ) || (self.ammo_nails   < 1))
-	if ((other.ammo_rockets >= AMMOMAX_ROCKETS) || (self.ammo_rockets < 1))
-	if ((other.ammo_cells   >= AMMOMAX_CELLS  ) || (self.ammo_cells   < 1))
-	if ((other.ammo_xshells >= AMMOMAX_XSHELLS) || (self.ammo_xshells < 1))
+	if ((ItemQuantity(other, "shells") >= AMMOMAX_SHELLS ) || (ItemQuantity(self, "shells") < 1))
+	if ((ItemQuantity(other, "nails") >= AMMOMAX_NAILS  ) || (ItemQuantity(self, "nails") < 1))
+	if ((ItemQuantity(other, "rockets") >= AMMOMAX_ROCKETS) || (ItemQuantity(self, "rockets") < 1))
+	if ((ItemQuantity(other, "cells") >= AMMOMAX_CELLS  ) || (ItemQuantity(self, "cells") < 1))
+	if ((ItemQuantity(other, "xshells") >= AMMOMAX_XSHELLS) || (ItemQuantity(self, "xshells") < 1))
 		return; // would gain no ammo or weapon
 
 	// if the player was using their best weapon, change up to the new one if better
@@ -38,19 +38,19 @@
 
 	if (itemrespawn && AMMOWEAPONOVERFLOW)
 	{
-		if (self.ammo_shells ) if (other.ammo_shells  < self.ammo_shells ) other.ammo_shells  = self.ammo_shells ; else other.ammo_shells  = other.ammo_shells  + AMMOWEAPONOVERFLOW_SHELLS ;
-		if (self.ammo_nails  ) if (other.ammo_nails   < self.ammo_nails  ) other.ammo_nails   = self.ammo_nails  ; else other.ammo_nails   = other.ammo_nails   + AMMOWEAPONOVERFLOW_NAILS  ;
-		if (self.ammo_rockets) if (other.ammo_rockets < self.ammo_rockets) other.ammo_rockets = self.ammo_rockets; else other.ammo_rockets = other.ammo_rockets + AMMOWEAPONOVERFLOW_ROCKETS;
-		if (self.ammo_cells  ) if (other.ammo_cells   < self.ammo_cells  ) other.ammo_cells   = self.ammo_cells  ; else other.ammo_cells   = other.ammo_cells   + AMMOWEAPONOVERFLOW_CELLS  ;
-		if (self.ammo_xshells) if (other.ammo_xshells < self.ammo_xshells) other.ammo_xshells = self.ammo_xshells; else other.ammo_xshells = other.ammo_xshells + AMMOWEAPONOVERFLOW_XSHELLS;
+		if (ItemQuantity(self, "shells")) if (ItemQuantity(other, "shells") < ItemQuantity(self, "shells")) ItemSetQuantity(other, "shells", ItemQuantity(self, "shells")); else ItemAdjustQuantity(other, "shells", AMMOWEAPONOVERFLOW_SHELLS);
+		if (ItemQuantity(self, "nails")) if (ItemQuantity(other, "nails") < ItemQuantity(self, "nails")) ItemSetQuantity(other, "nails", ItemQuantity(self, "nails")); else ItemAdjustQuantity(other, "nails", AMMOWEAPONOVERFLOW_NAILS);
+		if (ItemQuantity(self, "rockets")) if (ItemQuantity(other, "rockets") < ItemQuantity(self, "rockets")) ItemSetQuantity(other, "rockets", ItemQuantity(self, "rockets")); else ItemAdjustQuantity(other, "rockets", AMMOWEAPONOVERFLOW_ROCKETS);
+		if (ItemQuantity(self, "cells")) if (ItemQuantity(other, "cells") < ItemQuantity(self, "cells")) ItemSetQuantity(other, "cells", ItemQuantity(self, "cells")); else ItemAdjustQuantity(other, "cells", AMMOWEAPONOVERFLOW_CELLS);
+		if (ItemQuantity(self, "xshells")) if (ItemQuantity(other, "xshells") < ItemQuantity(self, "xshells")) ItemSetQuantity(other, "xshells", ItemQuantity(self, "xshells")); else ItemAdjustQuantity(other, "xshells", AMMOWEAPONOVERFLOW_XSHELLS);
 	}
 	else
 	{
-		other.ammo_shells  = other.ammo_shells  + self.ammo_shells ;
-		other.ammo_nails   = other.ammo_nails   + self.ammo_nails  ;
-		other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
-		other.ammo_cells   = other.ammo_cells   + self.ammo_cells  ;
-		other.ammo_xshells = other.ammo_xshells + self.ammo_xshells;
+		ItemAdjustQuantity(other, "shells", ItemQuantity(self, "shells"));
+		ItemAdjustQuantity(other, "nails", ItemQuantity(self, "nails"));
+		ItemAdjustQuantity(other, "rockets", ItemQuantity(self, "rockets"));
+		ItemAdjustQuantity(other, "cells", ItemQuantity(self, "cells"));
+		ItemAdjustQuantity(other, "xshells", ItemQuantity(self, "xshells"));
 	}
 
 	if (other.flags & FL_CLIENT)
@@ -62,8 +62,6 @@
 	// weapon touch sound
 	sound (other, CHAN_ITEM, "weapons/pkup.wav", 1, ATTN_NORM);
 
-	bound_ammo (other);
-
 	// change to the weapon
 	old = other.items;
 	other.items = other.items | new;
@@ -108,21 +106,21 @@
 		if (w & IT_WEAPON9) f = f + 1000;
 		if (w & IT_WEAPON10) f = f + 3000;
 	}
-	if (item.ammo_shells)
-	if (player.ammo_shells < AMMOMAX_SHELLS)
-		f = f + (AMMOMAX_SHELLS - player.ammo_shells) * (AMMOMAX_SHELLS - player.ammo_shells) * 60 * item.ammo_shells / (AMMOMAX_SHELLS * AMMOMAX_SHELLS);
-	if (item.ammo_nails)
-	if (player.ammo_nails < AMMOMAX_NAILS)
-		f = f + (AMMOMAX_NAILS - player.ammo_nails) * (AMMOMAX_NAILS - player.ammo_nails) * 15 * item.ammo_nails / (AMMOMAX_NAILS * AMMOMAX_NAILS);
-	if (item.ammo_rockets)
-	if (player.ammo_rockets < AMMOMAX_ROCKETS)
-		f = f + (AMMOMAX_ROCKETS - player.ammo_rockets) * (AMMOMAX_ROCKETS - player.ammo_rockets) * 120 * item.ammo_rockets / (AMMOMAX_ROCKETS * AMMOMAX_ROCKETS);
-	if (item.ammo_cells)
-	if (player.ammo_cells < AMMOMAX_CELLS)
-		f = f + (AMMOMAX_CELLS - player.ammo_cells) * (AMMOMAX_CELLS - player.ammo_cells) * 30 * item.ammo_cells / (AMMOMAX_CELLS * AMMOMAX_CELLS);
-	if (item.ammo_xshells)
-	if (player.ammo_xshells < AMMOMAX_XSHELLS)
-		f = f + (AMMOMAX_XSHELLS - player.ammo_xshells) * (AMMOMAX_XSHELLS - player.ammo_xshells) * 110 * item.ammo_xshells / (AMMOMAX_XSHELLS * AMMOMAX_XSHELLS);
+	if (ItemQuantity(item, "shells"))
+	if (ItemQuantity(player, "shells") < AMMOMAX_SHELLS)
+		f = f + (AMMOMAX_SHELLS - ItemQuantity(player, "shells")) * (AMMOMAX_SHELLS - ItemQuantity(player, "shells")) * 60 * ItemQuantity(item, "shells") / (AMMOMAX_SHELLS * AMMOMAX_SHELLS);
+	if (ItemQuantity(item, "nails"))
+	if (ItemQuantity(player, "nails") < AMMOMAX_NAILS)
+		f = f + (AMMOMAX_NAILS - ItemQuantity(player, "nails")) * (AMMOMAX_NAILS - ItemQuantity(player, "nails")) * 15 * ItemQuantity(item, "nails") / (AMMOMAX_NAILS * AMMOMAX_NAILS);
+	if (ItemQuantity(item, "rockets"))
+	if (ItemQuantity(player, "rockets") < AMMOMAX_ROCKETS)
+		f = f + (AMMOMAX_ROCKETS - ItemQuantity(player, "rockets")) * (AMMOMAX_ROCKETS - ItemQuantity(player, "rockets")) * 120 * ItemQuantity(item, "rockets") / (AMMOMAX_ROCKETS * AMMOMAX_ROCKETS);
+	if (ItemQuantity(item, "cells"))
+	if (ItemQuantity(player, "cells") < AMMOMAX_CELLS)
+		f = f + (AMMOMAX_CELLS - ItemQuantity(player, "cells")) * (AMMOMAX_CELLS - ItemQuantity(player, "cells")) * 30 * ItemQuantity(item, "cells") / (AMMOMAX_CELLS * AMMOMAX_CELLS);
+	if (ItemQuantity(item, "xshells"))
+	if (ItemQuantity(player, "xshells") < AMMOMAX_XSHELLS)
+		f = f + (AMMOMAX_XSHELLS - ItemQuantity(player, "xshells")) * (AMMOMAX_XSHELLS - ItemQuantity(player, "xshells")) * 110 * ItemQuantity(item, "xshells") / (AMMOMAX_XSHELLS * AMMOMAX_XSHELLS);
 	return f;
 };
 
@@ -134,28 +132,28 @@
 	setmodel (self, wmdl);
 	self.netname = name;
 	self.weapon = w;
-	self.ammo_shells  = shells;
-	self.ammo_nails   = nails;
-	self.ammo_rockets = rockets;
-	self.ammo_cells   = cells;
-	self.ammo_xshells = xshells;
-//	self.havocrating = self.havocrating + self.ammo_shells * 60;
-//	self.havocrating = self.havocrating + self.ammo_nails * 15;
-//	self.havocrating = self.havocrating + self.ammo_rockets * 120;
-//	self.havocrating = self.havocrating + self.ammo_cells * 30;
-//	self.havocrating = self.havocrating + self.ammo_xshells * 110;
-	self.touch = weapon_touch;
-	setsize (self, '-16 -16 0', '16 16 32');
 	/*
 	if (deathmatch)
 	{
-		if (shells ) self.ammo_shells  = 999;
-		if (nails  ) self.ammo_nails   = 999;
-		if (rockets) self.ammo_rockets = 999;
-		if (cells  ) self.ammo_cells   = 999;
-		if (xshells) self.ammo_xshells = 999;
+		if (shells) shells = 99999;
+		if (nails) nails = 99999;
+		if (rockets) rockets = 99999;
+		if (cells) cells = 99999;
+		if (xshells) xshells = 99999;
 	}
 	*/
+	ItemSetQuantity(self, "shells", shells);
+	ItemSetQuantity(self, "nails", nails);
+	ItemSetQuantity(self, "rockets", rockets);
+	ItemSetQuantity(self, "cells", cells);
+	ItemSetQuantity(self, "xshells", xshells);
+//	self.havocrating = self.havocrating + ItemQuantity(self, "shells") * 60;
+//	self.havocrating = self.havocrating + ItemQuantity(self, "nails") * 15;
+//	self.havocrating = self.havocrating + ItemQuantity(self, "rockets") * 120;
+//	self.havocrating = self.havocrating + ItemQuantity(self, "cells") * 30;
+//	self.havocrating = self.havocrating + ItemQuantity(self, "xshells") * 110;
+	self.touch = weapon_touch;
+	setsize (self, '-16 -16 0', '16 16 32');
 	StartItem ();
 };
 
Index: dpmod/qc/m_enforcer.qc
diff -u dpmod/qc/m_enforcer.qc:1.3 dpmod/qc/m_enforcer.qc:1.4
--- dpmod/qc/m_enforcer.qc:1.3	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/m_enforcer.qc	Wed Jun 11 05:07:37 2003
@@ -404,7 +404,7 @@
 	if (r < 0.20)
 	{
 		self.th_missile = enf_missile_rocket;
-		self.ammo_rockets = AMMO_ENFORCER_ROCKETS;
+		ItemSetQuantity(self, "rockets", AMMO_ENFORCER_ROCKETS);
 		//self.items = IT_WEAPON7;
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " was blasted by an enforcer";
@@ -412,7 +412,7 @@
 	else if (r < 0.50)
 	{
 		self.th_missile = enf_missile_plasma;
-		self.ammo_cells = AMMO_ENFORCER_PLASMACELLS;
+		ItemSetQuantity(self, "cells", AMMO_ENFORCER_PLASMACELLS);
 		//self.items = IT_WEAPON8;
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " was scorched by an enforcer";
@@ -420,7 +420,7 @@
 	else
 	{
 		self.th_missile = enf_missile_laser;
-		self.ammo_cells = AMMO_ENFORCER_LASERCELLS;
+		ItemSetQuantity(self, "cells", AMMO_ENFORCER_LASERCELLS);
 		self.items = 0;
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " was blasted by an enforcer";
Index: dpmod/qc/m_ogre.qc
diff -u dpmod/qc/m_ogre.qc:1.2 dpmod/qc/m_ogre.qc:1.3
--- dpmod/qc/m_ogre.qc:1.2	Thu Feb 20 03:49:09 2003
+++ dpmod/qc/m_ogre.qc	Wed Jun 11 05:07:37 2003
@@ -8,7 +8,7 @@
 
 $cd id1/models/ogre_c
 $origin 0 0 24
-$base base		
+$base base
 $skin base
 
 $frame	stand1 stand2 stand3 stand4 stand5 stand6 stand7 stand8 stand9
@@ -76,7 +76,7 @@
 		return FALSE;
 
 	// don't fire when out of ammo
-	if (self.ammo_rockets < 1 && self.ammo_nails < 1)
+	if (ItemQuantity(self, "rockets") < 1 && ItemQuantity(self, "nails") < 1)
 		return FALSE;
 
 	// see if any entities are in the way of the shot
@@ -112,7 +112,7 @@
 float() OgreFireGrenade =
 {
 	local   vector  v;
-	if (self.ammo_rockets < 1)
+	if (ItemQuantity(self, "rockets") < 1)
 		return FALSE;
 	if (!findtrajectorywithleading(self.origin, '0 0 0', '0 0 0', self.enemy, 1000, 2.5, 0, self))
 		return FALSE;
@@ -245,19 +245,19 @@
 void() ogre_smash14	=[	$smash14,		ogre_run1	] {ai_charge(12);};
 
 void() ogre_nail9;
-void() ogre_nail1       =[      $shoot1,                ogre_nail2      ] {ai_face();if (self.ammo_nails < 1) ogre_run1();};
+void() ogre_nail1       =[      $shoot1,                ogre_nail2      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_run1();};
 void() ogre_nail2       =[      $shoot2,                ogre_nail3      ] {ai_face();};
 void() ogre_nail3       =[      $shoot2,                ogre_nail4      ] {ai_face();};
-void() ogre_nail4       =[      $shoot3,                ogre_nail5      ] {ai_face();if (self.ammo_nails < 1) ogre_nail9();OgreFireNailgun();};
-void() ogre_nail5       =[      $shoot3,                ogre_nail6      ] {ai_face();if (self.ammo_nails < 1) ogre_nail9();OgreFireNailgun();};
-void() ogre_nail6       =[      $shoot3,                ogre_nail7      ] {ai_face();if (self.ammo_nails < 1) ogre_nail9();OgreFireNailgun();};
-void() ogre_nail7       =[      $shoot3,                ogre_nail8      ] {ai_face();if (self.ammo_nails < 1) ogre_nail9();OgreFireNailgun();};
-void() ogre_nail8       =[      $shoot3,                ogre_nail9      ] {ai_face();if (self.ammo_nails < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail4       =[      $shoot3,                ogre_nail5      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail5       =[      $shoot3,                ogre_nail6      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail6       =[      $shoot3,                ogre_nail7      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail7       =[      $shoot3,                ogre_nail8      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
+void() ogre_nail8       =[      $shoot3,                ogre_nail9      ] {ai_face();if (ItemQuantity(self, "nails") < 1) ogre_nail9();OgreFireNailgun();};
 void() ogre_nail9       =[      $shoot4,                ogre_nail10     ] {ai_face();};
 void() ogre_nail10      =[      $shoot5,                ogre_nail11     ] {ai_face();};
 void() ogre_nail11      =[      $shoot6,                ogre_run1       ] {ai_face();};
 
-void() ogre_gren1       =[      $shoot1,                ogre_gren2      ] {ai_face();if (self.ammo_rockets < 1) ogre_nail1();};
+void() ogre_gren1       =[      $shoot1,                ogre_gren2      ] {ai_face();if (ItemQuantity(self, "rockets") < 1) ogre_nail1();};
 void() ogre_gren2       =[      $shoot2,                ogre_gren3      ] {ai_face();};
 void() ogre_gren3       =[      $shoot2,                ogre_gren4      ] {ai_face();};
 void() ogre_gren4       =[      $shoot3,                ogre_gren5      ] {ai_face();if (!OgreFireGrenade()) ogre_nail1();};
@@ -342,10 +342,10 @@
 		return; // ignore it
 	self.dmg = 0;
 
-	sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);		
+	sound (self, CHAN_VOICE, "ogre/ogpain1.wav", 1, ATTN_NORM);
 
 	r = random();
-	
+
 	if (r < 0.25)
 	{
 		ogre_pain1 ();
@@ -464,8 +464,8 @@
 
 	if (!self.deathtype) // map makers can override this
 		self.deathtype = " was destroyed by an ogre";
-	self.ammo_rockets = AMMO_OGRE_GRENADES;
-	//self.ammo_nails = 0;
+	ItemSetQuantity(self, "rockets", AMMO_OGRE_GRENADES);
+	//ItemSetQuantity(self, "nails", 0);
 	//self.items = IT_WEAPON6;
 
 	self.shoulddodge = TRUE;
Index: dpmod/qc/m_soldier.qc
diff -u dpmod/qc/m_soldier.qc:1.4 dpmod/qc/m_soldier.qc:1.5
--- dpmod/qc/m_soldier.qc:1.4	Wed Apr  9 23:24:30 2003
+++ dpmod/qc/m_soldier.qc	Wed Jun 11 05:07:37 2003
@@ -501,7 +501,7 @@
 	{
 		//self.items = IT_WEAPON4;
 		self.th_missile = army_missile_nail;
-		self.ammo_nails = 15;
+		ItemSetQuantity(self, "nails", 15);
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " was nailed by a grunt";
 	}
@@ -509,7 +509,7 @@
 	{
 		//self.items = IT_WEAPON2;
 		self.th_missile = army_missile_shotgun;
-		self.ammo_shells = 5;
+		ItemSetQuantity(self, "shells", 5);
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " was gunned down by a grunt";
 	}
@@ -517,7 +517,7 @@
 	{
 		self.items = 0;
 		self.th_missile = army_missile_pistol;
-		self.ammo_nails = 5;
+		ItemSetQuantity(self, "nails", 5);
 		if (!self.deathtype) // map makers can override this
 			self.deathtype = " lays down for a grunt";
 	}
Index: dpmod/qc/modedefs.qc
diff -u dpmod/qc/modedefs.qc:1.1.1.1 dpmod/qc/modedefs.qc:1.2
--- dpmod/qc/modedefs.qc:1.1.1.1	Thu Sep 19 15:08:12 2002
+++ dpmod/qc/modedefs.qc	Wed Jun 11 05:07:37 2003
@@ -12,7 +12,7 @@
 
 float   DM_FRAGFEST                     = 5;
 
-float	DM_MONSTERS						= 7;
+float   DM_MONSTERS                     = 7;
 
 float   DM_ELIM                         = 8; // 1on1 or teams
 float   DM_ONEVSALL                     = 9;
@@ -21,3 +21,6 @@
 float   DM_CTF_2TEAM                    = 10;
 float   DM_CTF_3TEAM                    = 11;
 float   DM_TEAM_MODS_END                = 20;
+
+float   DM_REVELATION                   = 30;
+
Index: dpmod/qc/player.qc
diff -u dpmod/qc/player.qc:1.3 dpmod/qc/player.qc:1.4
--- dpmod/qc/player.qc:1.3	Thu Feb 13 21:30:23 2003
+++ dpmod/qc/player.qc	Wed Jun 11 05:07:37 2003
@@ -11,7 +11,7 @@
 
 $cd id1/models/player_4
 $origin 0 -6 24
-$base base		
+$base base
 $skin skin
 
 //
@@ -554,7 +554,7 @@
 		sound (self, CHAN_VOICE, "player/h2odeath.wav", 1, ATTN_NONE);
 		return;
 	}
-	
+
 	rs = random() * 5;
 	if (rs < 1)
 		sound (self, CHAN_VOICE, "player/death1.wav", 1, ATTN_NONE);
@@ -588,7 +588,7 @@
 		sound (self, CHAN_VOICE, "player/teledth1.wav", 1, ATTN_NONE);
 		return;
 	}
-		
+
 	if (random() < 0.5)
 		sound (self, CHAN_VOICE, "player/gib.wav", 1, ATTN_NONE);
 	else
@@ -646,7 +646,15 @@
 	//}
 
 	//self.solid = SOLID_NOT;
-	//self.currentammo = self.ammo_shells = self.ammo_nails = self.ammo_rockets = self.ammo_cells = self.items = self.effects = self.armorvalue = self.armortype = 0;
+	//self.currentammo = 0;
+	//ItemSetQuantity(self, "shells", 0);
+	//ItemSetQuantity(self, "nails", 0);
+	//ItemSetQuantity(self, "rockets", 0);
+	//ItemSetQuantity(self, "cells", 0);
+	//self.items = 0;
+	//self.effects = 0;
+	//self.armorvalue = 0;
+	//self.armortype = 0;
 	//self.movetype = MOVETYPE_NONE;
 	//self.velocity = '0 0 0';
 	//self.model = "";
Index: dpmod/qc/progs.src
diff -u dpmod/qc/progs.src:1.5 dpmod/qc/progs.src:1.6
--- dpmod/qc/progs.src:1.5	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/progs.src	Wed Jun 11 05:07:37 2003
@@ -16,6 +16,8 @@
 //localdamage.qc  // head/chest/foot/whatever shots
 damage.qc       // max ammo amounts, how much damage, starting health, etc
 
+inventory.qc
+
 util.qc         // useful functions (trajectory tracing for example)
 
 think.qc        // the extrathink function, which lets you use multiple thinks
Index: dpmod/qc/w_dbshotgun.qc
diff -u dpmod/qc/w_dbshotgun.qc:1.9 dpmod/qc/w_dbshotgun.qc:1.10
--- dpmod/qc/w_dbshotgun.qc:1.9	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_dbshotgun.qc	Wed Jun 11 05:07:37 2003
@@ -97,11 +97,11 @@
 */
 	/*
 	if (self.shotgunmode)
-		self.currentammo = self.ammo_xshells = self.ammo_xshells - 1;
+		self.currentammo = ItemAdjustQuantity(self, "xshells", -1);
 	else
 	*/
 /*
-		self.currentammo = self.ammo_shells = self.ammo_shells - 1;
+		self.currentammo = ItemAdjustQuantity(self, "shells", -1);
 	self.wfiretime = time;
 	w_muzzleflash(v, 4);
 	if (explosive)
@@ -156,10 +156,10 @@
 	}
 	/*
 	if (self.shotgunmode)
-		self.currentammo = self.ammo_xshells = self.ammo_xshells - 1;
+		self.currentammo = ItemAdjustQuantity(self, "xshells", -1);
 	else
 	*/
-		self.currentammo = self.ammo_shells = self.ammo_shells - 1;
+		self.currentammo = ItemAdjustQuantity(self, "shells", -1);
 	self.wfiretime = time;
 	w_muzzleflash(v, 2);
 	if (explosive)
@@ -198,13 +198,13 @@
 	/*
 	if (self.shotgunmode)
 	{
-		swapmode = self.ammo_xshells < 1 && self.ammo_shells >= 1;
-		otherammo = self.ammo_shells >= 1;
+		swapmode = ItemQuantity(self, "xshells") < 1 && ItemQuantity(self, "shells") >= 1;
+		otherammo = ItemQuantity(self, "shells") >= 1;
 	}
 	else
 	{
-		swapmode = self.ammo_shells < 1 && self.ammo_xshells >= 1;
-		otherammo = self.ammo_xshells >= 1;
+		swapmode = ItemQuantity(self, "shells") < 1 && ItemQuantity(self, "xshells") >= 1;
+		otherammo = ItemQuantity(self, "xshells") >= 1;
 	}
 
 	if (otherammo)
@@ -234,7 +234,7 @@
 			self.shotgunshells = 0;
 		}
 		if (self.button0 || self.button3)
-		if (self.ammo_shells > 0)
+		if (ItemQuantity(self, "shells") > 0)
 		if (W_ShotsToFire(0.2))
 			W_DBShotgunGatlingFireCode(self.button3);
 	}
@@ -271,9 +271,9 @@
 				/*
 				if (self.shotgunmode)
 				{
-					if (self.ammo_xshells >= 1)
+					if (ItemQuantity(self, "xshells") >= 1)
 					{
-						self.wload = min(self.ammo_xshells, 2);
+						self.wload = min(ItemQuantity(self, "xshells"), 2);
 						self.attack_finished = time + 0.2;
 						sound(self, CHAN_AUTO, "weapons/bsgload.wav", 1, ATTN_STATIC);
 					}
@@ -282,9 +282,9 @@
 				*/
 	/*
 				{
-					if (self.ammo_shells >= 1)
+					if (ItemQuantity(self, "shells") >= 1)
 					{
-						self.wload = min(self.ammo_shells, 2);
+						self.wload = min(ItemQuantity(self, "shells"), 2);
 						self.attack_finished = time + 0.2;
 						sound(self, CHAN_AUTO, "weapons/bsgload.wav", 1, ATTN_STATIC);
 					}
@@ -322,12 +322,12 @@
 {
 	/*
 	if (self.shotgunmode)
-		wset(IT_WEAPON3, IT_SHELLS, self.ammo_xshells, VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
+		wset(IT_WEAPON3, IT_SHELLS, ItemQuantity(self, "xshells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
 	else
 	*/
-		wset(IT_WEAPON3, IT_SHELLS, self.ammo_shells, VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
+		wset(IT_WEAPON3, IT_SHELLS, ItemQuantity(self, "shells"), VWEP_SUPER_SHOTGUN, "progs/v_dpshot2.mdl");
 };
-float(float request) setweapon3 = {return weapongeneric(IT_WEAPON3, self.ammo_shells >= 1/* || self.ammo_xshells >= 1*/, request, w_dbshotgunsetup, w_dbshotgun, w_dbshotgunraise1, w_directaim, w_dbshotgunrating, "Double Barrel Shotgun");};
+float(float request) setweapon3 = {return weapongeneric(IT_WEAPON3, ItemQuantity(self, "shells") >= 1/* || ItemQuantity(self, "xshells") >= 1*/, request, w_dbshotgunsetup, w_dbshotgun, w_dbshotgunraise1, w_directaim, w_dbshotgunrating, "Double Barrel Shotgun");};
 
 void() w_dbshotgunraise1 = {self.wload = 0;self.shotgunshells = 0;wraise(9, w_dbshotgunraise2, 0.1);};
 void() w_dbshotgunraise2 = {wraise(8, w_dbshotgun, 0.1);};
Index: dpmod/qc/w_frame.qc
diff -u dpmod/qc/w_frame.qc:1.5 dpmod/qc/w_frame.qc:1.6
--- dpmod/qc/w_frame.qc:1.5	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_frame.qc	Wed Jun 11 05:07:37 2003
@@ -1,4 +1,7 @@
 
+.float character_nextsave;
+.float character_loaded;
+
 .float seenhelp;
 .float idealzoom;
 
@@ -18,6 +21,8 @@
 	local string s;
 	//local vector v, realvangle;
 
+	updateammodisplay(self);
+
 	if (time > self.seenhelp)
 	{
 		if (self.seenhelp == 0)
@@ -34,6 +39,16 @@
 			}
 		}
 	}
+	/*
+	if (time > self.character_nextsave)
+	{
+		self.character_nextsave = time + 15;
+		if (self.character_loaded)
+			Character_Save();
+		else
+			Character_Load();
+	}
+	*/
 
 	if (!self.solid) // observer
 		return;
Index: dpmod/qc/w_grenade.qc
diff -u dpmod/qc/w_grenade.qc:1.8 dpmod/qc/w_grenade.qc:1.9
--- dpmod/qc/w_grenade.qc:1.8	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_grenade.qc	Wed Jun 11 05:07:37 2003
@@ -48,34 +48,36 @@
 		Obituary_Fallback(targ, attacker, dmsg, dtype);
 };
 
-/*
-.float grenademode;
+//.float grenademode;
 
 void() W_GrenadeFireImpact =
 {
+	W_Hostile();
+	sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
-	w_muzzleflash(shotorg, 3);
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
+	w_muzzleflash(shotorg, 5);
 	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200 + self.velocity, self, 150 * damagescale, 200, GRENADE_IMPACT | GRENADE_IMMUNETODAMAGE, 25, "GRENADE", Obituary_Grenade);
 	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 150 * damagescale, 120, GRENADE_IMPACT | GRENADE_IMMUNETODAMAGE, 25, "GRENADE", Obituary_Grenade);
 };
-*/
 
+/*
 void() W_GrenadeFirePipebomb =
 {
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 5);
 	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 150 * damagescale, 120, GRENADE_DETONATABLE | GRENADE_DETONATEONCREATURE, 60, "PIPEBOMB", Obituary_Grenade);
 };
+*/
 
 /*
 void() W_GrenadeFireProximity =
 {
 	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 3);
 	LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 100 * damagescale, 150, GRENADE_PROXIMITY, 5, "GRENADE", Obituary_Grenade);
 };
@@ -85,13 +87,13 @@
 void() W_GrenadeFireSticky =
 {
 	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 3);
 	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 120 * damagescale, 120, 50 * damagescale, 20 * damagescale, MINE_DETONATABLE, 60, "STICKYGRENADE", Obituary_Grenade);
 };
 */
 
-.float activemines;
+//.float activemines;
 //.float oldbutton3;
 void() w_grenadedrop1;
 void() w_grenadedrop2;
@@ -108,22 +110,26 @@
 	{
 		if (self.button0)
 		{
-			if (self.activemines < 20)
-			{
-				if (self.ammo_rockets >= 1)
+			//if (self.activemines < 20)
+			//{
+				if (ItemQuantity(self, "rockets") >= 1)
 				{
 					if (W_ShotsToFire(0.6))
-						W_GrenadeFirePipebomb();
+						W_GrenadeFireImpact();
+						//W_GrenadeFirePipebomb();
 				}
 				else
 					self.switchweapon = W_BestWeapon(TRUE);
+			/*
 			}
 			else
 			{
 				self.attack_finished = time + 0.3;
 				sprint(self, "only 20 remote explosives allowed, you must detonate some before placing more\n");
 			}
+			*/
 		}
+		/*
 		if (self.button3)
 		if (self.activemines > 0)
 		{
@@ -131,6 +137,7 @@
 			sound(self, CHAN_WEAPON, "weapons/bomb/trigger.wav", 1, ATTN_STATIC);
 			self.detonatetimeout = time + 0.1;
 		}
+		*/
 	}
 
 	/*
@@ -140,7 +147,7 @@
 		{
 			if (self.activemines < 20)
 			{
-				if (self.ammo_rockets >= 1)
+				if (ItemQuantity(self, "rockets") >= 1)
 					W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFirePipebomb);
 			}
 			else
@@ -160,7 +167,7 @@
 				sound(self, CHAN_WEAPON, "weapons/bomb/trigger.wav", 1, ATTN_STATIC);
 				self.detonatetimeout = time + 0.1;
 			}
-			else if (self.ammo_rockets >= 1)
+			else if (ItemQuantity(self, "rockets") >= 1)
 				W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireImpact);
 			else
 				self.switchweapon = W_BestWeapon(TRUE);
@@ -193,7 +200,7 @@
 		}
 		else if (self.button0)
 		{
-			if (self.ammo_rockets >= 1)
+			if (ItemQuantity(self, "rockets") >= 1)
 			{
 				if (self.grenademode == 0)
 					W_GenericSlowFireCode("weapons/grenade.wav", 0.6, W_GrenadeFireImpact);
@@ -220,12 +227,12 @@
 	/*
 	if (self.button0)
 	{
-		if (self.ammo_rockets >= 1)
+		if (ItemQuantity(self, "rockets") >= 1)
 			W_GenericSlowFireCode("weapons/grenade.wav", 0.5, W_GrenadeFireImpact);
 	}
 	else if (self.button3)
 	{
-		if (self.ammo_rockets >= 1)
+		if (ItemQuantity(self, "rockets") >= 1)
 			W_GenericSlowFireCode("weapons/grenade.wav", 0.8, W_GrenadeFireProximity);
 	}
 	*/
@@ -256,8 +263,8 @@
 };
 
 float() w_grenaderating = {return genericweaponrating(200, 500, 300);};
-void() w_grenadesetup = {wset(IT_WEAPON6, IT_ROCKETS, self.ammo_rockets, VWEP_GRENADE_LAUNCHER, "progs/v_dprock.mdl");};
-float(float request) setweapon6 = {return weapongeneric(IT_WEAPON6, self.ammo_rockets >= 1 || self.activemines > 0, request, w_grenadesetup, w_grenade, w_grenaderaise1, w_grenadeaim, w_grenaderating, "Grenade Launcher");};
+void() w_grenadesetup = {wset(IT_WEAPON6, IT_ROCKETS, ItemQuantity(self, "rockets"), VWEP_GRENADE_LAUNCHER, "progs/v_dprock.mdl");};
+float(float request) setweapon6 = {return weapongeneric(IT_WEAPON6, ItemQuantity(self, "rockets") >= 1/* || self.activemines > 0*/, request, w_grenadesetup, w_grenade, w_grenaderaise1, w_grenadeaim, w_grenaderating, "Grenade Launcher");};
 
 void() w_grenaderaise1 = {wraise(8, w_grenaderaise2, 0.1);};
 void() w_grenaderaise2 = {wraise(7, w_grenade, 0.1);};
Index: dpmod/qc/w_info.qc
diff -u dpmod/qc/w_info.qc:1.2 dpmod/qc/w_info.qc:1.3
--- dpmod/qc/w_info.qc:1.2	Wed Apr  9 23:24:30 2003
+++ dpmod/qc/w_info.qc	Wed Jun 11 05:07:37 2003
@@ -221,10 +221,10 @@
 	if (self.health < 1)
 		return;
 
-	self.ammo_shells  = 999;
-	self.ammo_nails   = 999;
-	self.ammo_rockets = 999;
-	self.ammo_cells   = 999;
+	ItemSetQuantity(self, "shells", 99999);
+	ItemSetQuantity(self, "nails", 99999);
+	ItemSetQuantity(self, "rockets", 99999);
+	ItemSetQuantity(self, "cells", 99999);
 	self.items = self.items
 	 | IT_WEAPON1
 	 | IT_WEAPON2
@@ -238,7 +238,6 @@
 	 | IT_WEAPON10
 	// | IT_KEY1 | IT_KEY2
 	;
-	bound_ammo(self);
 
 	self.impulse = 0;
 };
Index: dpmod/qc/w_lightning.qc
diff -u dpmod/qc/w_lightning.qc:1.1 dpmod/qc/w_lightning.qc:1.2
--- dpmod/qc/w_lightning.qc:1.1	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_lightning.qc	Wed Jun 11 05:07:37 2003
@@ -119,10 +119,10 @@
 
 void(float cells) W_LightningFireCode =
 {
-	if (cells > self.ammo_cells)
-		cells = self.ammo_cells;
+	if (cells > ItemQuantity(self, "cells"))
+		cells = ItemQuantity(self, "cells");
 	self.wfiretime = time;
-	self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+	self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
 	self.wframe = self.wframe + 1;
 	if (self.wframe >= 3)
 		self.wframe = 1;
@@ -144,7 +144,7 @@
 
 	if (self.button0)
 	{
-		if (self.ammo_cells > 0)
+		if (ItemQuantity(self, "cells") > 0)
 		{
 			if (!self.oldbutton0)
 				sound(self, CHAN_AUTO, "weapons/lstart.wav", 1, ATTN_NORM);
@@ -163,7 +163,7 @@
 	else if (self.button3)
 	{
 		//if (self.button3)
-		//if (self.ammo_rockets >= 1)
+		//if (ItemQuantity(self, "rockets") >= 1)
 		//	W_GenericSlowFireCode("weapons/grenade.wav", 0.5, W_SuperNailgunMineFireCode);
 	}
 	*/
@@ -191,5 +191,5 @@
 void() w_lightningdrop2 = {wdropped(6, 0.1);};
 
 float() w_lightningrating = {return genericweaponrating(0, 1000, 300);};
-void() w_lightningsetup = {wset(IT_WEAPON8, IT_CELLS, self.ammo_cells, VWEP_LIGHTNING, "progs/v_dplight.mdl");};
-float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, self.ammo_cells >= 1, request, w_lightningsetup, w_lightning, w_lightningraise1, w_directaim, w_lightningrating, "Thunderbolt");};
+void() w_lightningsetup = {wset(IT_WEAPON8, IT_CELLS, ItemQuantity(self, "cells"), VWEP_LIGHTNING, "progs/v_dplight.mdl");};
+float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, ItemQuantity(self, "cells") >= 1, request, w_lightningsetup, w_lightning, w_lightningraise1, w_directaim, w_lightningrating, "Thunderbolt");};
Index: dpmod/qc/w_nailgun.qc
diff -u dpmod/qc/w_nailgun.qc:1.7 dpmod/qc/w_nailgun.qc:1.8
--- dpmod/qc/w_nailgun.qc:1.7	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_nailgun.qc	Wed Jun 11 05:07:37 2003
@@ -17,11 +17,11 @@
 	local vector v, casingdir, ang;
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
-	while (shots > 0 && self.ammo_nails >= 1)
+	while (shots > 0 && ItemQuantity(self, "nails") >= 1)
 	{
 		shots = shots - 1;
 		self.wfiretime = time;
-		self.currentammo = self.ammo_nails = self.ammo_nails - 1;
+		self.currentammo = ItemAdjustQuantity(self, "nails", -1);
 		self.wframe = self.wframe + 1;
 		if (self.wframe >= 9)
 			self.wframe = 1;
@@ -81,7 +81,7 @@
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 1);
 	//LaunchGrenade(shotorg, shotdir * 1000 + v_up * 200, self, 80 * damagescale, 300, GRENADE_IMPACT, 2.5, "NAILGUNGRENADE", Obituary_NailgunGrenade);
 	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, 200 * damagescale, 70, 20 * damagescale, 10 * damagescale, MINE_LASERTRIP, 60, "LASERTRIPMINE", Obituary_NailgunMine);
@@ -99,7 +99,7 @@
 
 	if (self.button0)
 	{
-		if (self.ammo_nails >= 1)
+		if (ItemQuantity(self, "nails") >= 1)
 		{
 			self.wload = W_ShotsToFire(0.1);
 			if (self.wload)
@@ -109,7 +109,7 @@
 	else
 	{
 		if (self.button3)
-		if (self.ammo_rockets >= 1)
+		if (ItemQuantity(self, "rockets") >= 1)
 		if (W_ShotsToFire(0.8))
 			W_NailgunGrenadeFireCode();
 	}
@@ -138,6 +138,6 @@
 void() w_nailgundrop2 = {wdropped(10, 0.1);};
 
 float() w_nailgunrating = {return genericweaponrating(0, 1200, 150);};
-void() w_nailgunsetup = {wset(IT_WEAPON4, IT_NAILS, self.ammo_nails, VWEP_NAILGUN, "progs/v_dpnail.mdl");};
-float(float request) setweapon4 = {return weapongeneric(IT_WEAPON4, self.ammo_nails >= 1 || self.ammo_rockets >= 1, request, w_nailgunsetup, w_nailgun, w_nailgunraise1, w_directaim, w_nailgunrating, "Nailgun");};
+void() w_nailgunsetup = {wset(IT_WEAPON4, IT_NAILS, ItemQuantity(self, "nails"), VWEP_NAILGUN, "progs/v_dpnail.mdl");};
+float(float request) setweapon4 = {return weapongeneric(IT_WEAPON4, ItemQuantity(self, "nails") >= 1 || ItemQuantity(self, "rockets") >= 1, request, w_nailgunsetup, w_nailgun, w_nailgunraise1, w_directaim, w_nailgunrating, "Nailgun");};
 
Index: dpmod/qc/w_oldplasmarifle.qc
diff -u dpmod/qc/w_oldplasmarifle.qc:1.1 dpmod/qc/w_oldplasmarifle.qc:1.2
--- dpmod/qc/w_oldplasmarifle.qc:1.1	Thu Feb 13 21:47:16 2003
+++ dpmod/qc/w_oldplasmarifle.qc	Wed Jun 11 05:07:37 2003
@@ -16,7 +16,7 @@
 {
 	local vector dir;
 	self.wload = self.wload - 1;
-	self.currentammo = self.ammo_cells = self.ammo_cells - 1;
+	self.currentammo = ItemAdjustQuantity(self, "cells", -1);
 	self.wfiretime = time;
 	dir = shotdir + randomvec() * 0.03;
 	w_muzzleflash(shotorg, 1);
@@ -26,7 +26,7 @@
 
 void() W_PlasmaRifleFireHighPower =
 {
-	self.currentammo = self.ammo_cells = self.ammo_cells - self.wload;
+	self.currentammo = ItemAdjustQuantity(self, "cells", 0 - self.wload);
 	self.wfiretime = time;
 	//FireBullets(self, self, shotorg, 4, 1, self.wload * 30, self.wload * 30, dir * 10000, 0, "PLASMARIFLE", DT_NAIL, Obituary_PlasmaRifle);
 	FirePlasma(self, shotorg, shotdir, self.wload * 30 * damagescale, 105, '0 0 0', "PLASMARIFLE", Obituary_PlasmaRifle);
@@ -48,8 +48,8 @@
 	if (self.button3)
 		self.idealzoom = 0.2;
 
-	if (self.wload > self.ammo_cells)
-		self.wload = self.ammo_cells;
+	if (self.wload > ItemQuantity(self, "cells"))
+		self.wload = ItemQuantity(self, "cells");
 
 	if (self.button0 && self.wload >= 1)
 	{
@@ -60,7 +60,7 @@
 	}
 	else if (time > self.attack_finished)
 	{
-		charge = self.ammo_cells;
+		charge = ItemQuantity(self, "cells");
 		if (charge > 8)
 			charge = 8;
 		if (self.wload < charge)
@@ -97,8 +97,8 @@
 };
 
 float() w_plasmariflerating = {return genericweaponrating(0, 1500, 200);};
-void() w_plasmariflesetup = {wset(IT_WEAPON8, IT_CELLS, self.ammo_cells, VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
-float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, self.ammo_cells >= 1, request, w_plasmariflesetup, w_plasmarifle, w_plasmarifleraise1, w_directaim, w_plasmariflerating, "PlasmaRifle");};
+void() w_plasmariflesetup = {wset(IT_WEAPON8, IT_CELLS, ItemQuantity(self, "cells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon8 = {return weapongeneric(IT_WEAPON8, ItemQuantity(self, "cells") >= 1, request, w_plasmariflesetup, w_plasmarifle, w_plasmarifleraise1, w_directaim, w_plasmariflerating, "PlasmaRifle");};
 
 void() w_plasmarifleraise1 = {wraise(8, w_plasmarifleraise2, 0.1);};
 void() w_plasmarifleraise2 = {wraise(7, w_plasmarifle, 0.1);};
Index: dpmod/qc/w_plasmarifle.qc
diff -u dpmod/qc/w_plasmarifle.qc:1.9 dpmod/qc/w_plasmarifle.qc:1.10
--- dpmod/qc/w_plasmarifle.qc:1.9	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_plasmarifle.qc	Wed Jun 11 05:07:37 2003
@@ -32,11 +32,11 @@
 	{
 		shots = shots - 1;
 		cells = cellspershot;
-		if (cells > self.ammo_cells)
-			cells = self.ammo_cells;
+		if (cells > ItemQuantity(self, "cells"))
+			cells = ItemQuantity(self, "cells");
 		if (cells <= 0)
 			return;
-		self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+		self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
 		self.wfiretime = time;
 		if (self.plasmabarrel == 0)
 		{
@@ -89,7 +89,7 @@
 			self.woverload = 0;
 		}
 	}
-	else if (self.button0 && self.ammo_cells > 0)
+	else if (self.button0 && ItemQuantity(self, "cells") > 0)
 	{
 		self.wload = W_ShotsToFire(0.05);
 		if (self.wload > 0)
@@ -97,12 +97,12 @@
 	}
 	else if (time >= self.attack_finished)
 	{
-		if (self.button3 && self.ammo_cells > 0)
+		if (self.button3 && ItemQuantity(self, "cells") > 0)
 		{
 			self.woverload = 12;
-			//if (self.woverload > self.ammo_cells)
-			//	self.woverload = self.ammo_cells;
-			//self.currentammo = self.ammo_cells = self.ammo_cells - self.woverload;
+			//if (self.woverload > ItemQuantity(self, "cells"))
+			//	self.woverload = ItemQuantity(self, "cells");
+			//self.currentammo = ItemAdjustQuantity(self, "cells", 0 - self.woverload);
 			self.attack_finished = time + 0.2;
 			// FIXME: need overload charge sound (first overload sound)
 			sound(self, CHAN_WEAPON, "plasma/plasexpl.wav", 1, ATTN_NORM);
@@ -134,8 +134,8 @@
 };
 
 float() w_plasmariflerating = {return genericweaponrating(0, 1500, 200);};
-void() w_plasmariflesetup = {wset(IT_WEAPON9, IT_CELLS, self.ammo_cells, VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
-float(float request) setweapon9 = {return weapongeneric(IT_WEAPON9, self.ammo_cells >= 1, request, w_plasmariflesetup, w_plasmarifle, w_plasmarifleraise1, w_directaim, w_plasmariflerating, "PlasmaRifle");};
+void() w_plasmariflesetup = {wset(IT_WEAPON9, IT_CELLS, ItemQuantity(self, "cells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon9 = {return weapongeneric(IT_WEAPON9, ItemQuantity(self, "cells") >= 1, request, w_plasmariflesetup, w_plasmarifle, w_plasmarifleraise1, w_directaim, w_plasmariflerating, "PlasmaRifle");};
 
 void() w_plasmarifleraise1 = {wraise(8, w_plasmarifleraise2, 0.1);};
 void() w_plasmarifleraise2 = {self.wburst = 9;wraise(7, w_plasmarifle, 0.1);};
Index: dpmod/qc/w_plasmawave.qc
diff -u dpmod/qc/w_plasmawave.qc:1.1 dpmod/qc/w_plasmawave.qc:1.2
--- dpmod/qc/w_plasmawave.qc:1.1	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_plasmawave.qc	Wed Jun 11 05:07:37 2003
@@ -48,11 +48,11 @@
 	local float cells;
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
-	cells = self.ammo_cells;
+	cells = ItemQuantity(self, "cells");
 	if (cells > 10)
 		cells = 10;
 	self.wfiretime = time;
-	self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+	self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
 	FirePlasmaBall(self, shotorg, shotdir * 1000, cells * 20 * damagescale, 120, "PLASMAWAVE", Obituary_PlasmaWaveShot);
 };
 
@@ -62,22 +62,22 @@
 	local float cells;
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
-	cells = self.ammo_cells;
+	cells = ItemQuantity(self, "cells");
 	if (cells > 50)
 		cells = 50;
 	self.wfiretime = time;
-	self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+	self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
 	FirePlasmaBall(self, shotorg, shotdir * 1000, cells * 15 * damagescale, 300, "PLASMAWAVE", Obituary_PlasmaWaveShot);
 	*/
 	local float cells, shots, damage;
 	local vector ang;
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "plasma/plasma.wav", 1, ATTN_NORM);
-	cells = self.ammo_cells;
+	cells = ItemQuantity(self, "cells");
 	if (cells > 50)
 		cells = 50;
 	self.wfiretime = time;
-	self.currentammo = self.ammo_cells = self.ammo_cells - cells;
+	self.currentammo = ItemAdjustQuantity(self, "cells", 0 - cells);
 	//cells = cells + 60;
 	shots = ceil(cells / 5);
 	if (shots > 12)
@@ -109,14 +109,14 @@
 			W_PlasmaWaveFireWave();
 		}
 	}
-	else if (self.button0 && self.ammo_cells > 0)
+	else if (self.button0 && ItemQuantity(self, "cells") > 0)
 	{
 		if (W_ShotsToFire(0.5))
 			W_PlasmaWaveFireShot();
 	}
 	else if (time >= self.attack_finished)
 	{
-		if (self.button3 && self.ammo_cells > 0)
+		if (self.button3 && ItemQuantity(self, "cells") > 0)
 		{
 			self.woverload = 1;
 			self.attack_finished = time + 0.5;
@@ -150,8 +150,8 @@
 };
 
 float() w_plasmawaverating = {return genericweaponrating(0, 1500, 200);};
-void() w_plasmawavesetup = {wset(IT_WEAPON10, IT_CELLS, self.ammo_cells, VWEP_LIGHTNING, "progs/v_dplight.mdl");};
-float(float request) setweapon10 = {return weapongeneric(IT_WEAPON10, self.ammo_cells >= 1, request, w_plasmawavesetup, w_plasmawave, w_plasmawaveraise1, w_directaim, w_plasmawaverating, "Plasma Wave Cannon");};
+void() w_plasmawavesetup = {wset(IT_WEAPON10, IT_CELLS, ItemQuantity(self, "cells"), VWEP_LIGHTNING, "progs/v_dplight.mdl");};
+float(float request) setweapon10 = {return weapongeneric(IT_WEAPON10, ItemQuantity(self, "cells") >= 1, request, w_plasmawavesetup, w_plasmawave, w_plasmawaveraise1, w_directaim, w_plasmawaverating, "Plasma Wave Cannon");};
 
 void() w_plasmawaveraise1 = {wraise(3, w_plasmawaveraise2, 0.1);};
 void() w_plasmawaveraise2 = {self.wburst = 4;wraise(7, w_plasmawave, 0.1);};
Index: dpmod/qc/w_rocket.qc
diff -u dpmod/qc/w_rocket.qc:1.8 dpmod/qc/w_rocket.qc:1.9
--- dpmod/qc/w_rocket.qc:1.8	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_rocket.qc	Wed Jun 11 05:07:37 2003
@@ -98,9 +98,9 @@
 	sound(self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
 	self.flags = self.flags - (self.flags & FL_ONGROUND);
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 2);
-	LaunchMissile(shotorg, shotdir * 5000, self, 120 * damagescale, 100, "ROCKET", Obituary_Rocket);
+	LaunchMissile(shotorg, shotdir * 5000, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket);
 };
 
 void() W_RocketFireTripleSpiral =
@@ -110,20 +110,20 @@
 	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;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg, 4);
-	LaunchMissile(shotorg, shotdir * 3000, self, 120 * damagescale, 100, "ROCKET", Obituary_Rocket);
+	LaunchMissile(shotorg, shotdir * 3000, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket);
 	spiralmissile_orbitentity = newmis;
-	if (self.ammo_rockets < 1)
+	if (ItemQuantity(self, "rockets") < 1)
 		return;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg + v_right * 8, 4);
-	LaunchSpiralMissile(shotorg, shotdir, self, 120 * damagescale, 100, "ROCKET", Obituary_Rocket, -12);
-	if (self.ammo_rockets < 1)
+	LaunchSpiralMissile(shotorg, shotdir, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket, -12);
+	if (ItemQuantity(self, "rockets") < 1)
 		return;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
+	self.currentammo = ItemAdjustQuantity(self, "rockets", -1);
 	w_muzzleflash(shotorg - v_right * 8, 4);
-	LaunchSpiralMissile(shotorg, shotdir, self, 120 * damagescale, 100, "ROCKET", Obituary_Rocket, 12);
+	LaunchSpiralMissile(shotorg, shotdir, self, 100 * damagescale, 100, "ROCKET", Obituary_Rocket, 12);
 };
 
 void() w_rocketdrop1;
@@ -168,8 +168,8 @@
 };
 
 float() w_rocketrating = {return genericweaponrating(200, 1000, 240);};
-void() w_rocketsetup = {wset(IT_WEAPON7, IT_ROCKETS, self.ammo_rockets, VWEP_ROCKET_LAUNCHER, "progs/v_dprock2.mdl");};
-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_rocketsetup = {wset(IT_WEAPON7, IT_ROCKETS, ItemQuantity(self, "rockets"), VWEP_ROCKET_LAUNCHER, "progs/v_dprock2.mdl");};
+float(float request) setweapon7 = {return weapongeneric(IT_WEAPON7, ItemQuantity(self, "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 = {self.wload = 0;wraise(7, w_rocket, 0.1);};
Index: dpmod/qc/w_shotgun.qc
diff -u dpmod/qc/w_shotgun.qc:1.8 dpmod/qc/w_shotgun.qc:1.9
--- dpmod/qc/w_shotgun.qc:1.8	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_shotgun.qc	Wed Jun 11 05:07:37 2003
@@ -21,7 +21,7 @@
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "weapons/shotgn2.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
-	self.currentammo = self.ammo_shells = self.ammo_shells - 1;
+	self.currentammo = ItemAdjustQuantity(self, "shells", -1);
 	w_muzzleflash(shotorg, 2);
 	if (fireexplosive)
 		FireBullets(self, self, 1, 1, SHOTGUNEXPLOSIVESLUG * 0.2 * damagescale, SHOTGUNEXPLOSIVESLUG * 0.2 * damagescale, SHOTGUNEXPLOSIVESLUG * 0.8 * damagescale, 80, shotdir * 5000, 0, "SHOTGUNEXPLOSIVESLUG", DT_SHOTGUN, Obituary_Shotgun);
@@ -57,8 +57,8 @@
 	}
 	*/
 
-	if (self.wload > self.ammo_shells)
-		self.wload = self.ammo_shells;
+	if (self.wload > ItemQuantity(self, "shells"))
+		self.wload = ItemQuantity(self, "shells");
 
 	if (self.button0 || self.button3)
 	{
@@ -78,7 +78,7 @@
 			ejectcasing(v, v_right * 100 + v_up * 40, 30, ang, '0 250 0', 100, 1);
 			self.wload = 0;
 		}
-		else if (self.ammo_shells >= 1)
+		else if (ItemQuantity(self, "shells") >= 1)
 		{
 			self.wload = 1;
 			self.attack_finished = time + 0.2;
@@ -109,8 +109,8 @@
 };
 
 float() w_shotgunrating = {return genericweaponrating(0, 2000, 128);};
-void() w_shotgunsetup = {wset(IT_WEAPON2, IT_SHELLS, self.ammo_shells, VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
-float(float request) setweapon2 = {return weapongeneric(IT_WEAPON2, self.ammo_shells >= 1, request, w_shotgunsetup, w_shotgun, w_shotgunraise1, w_directaim, w_shotgunrating, "Shotgun");};
+void() w_shotgunsetup = {wset(IT_WEAPON2, IT_SHELLS, ItemQuantity(self, "shells"), VWEP_SHOTGUN, "progs/v_dpshot.mdl");};
+float(float request) setweapon2 = {return weapongeneric(IT_WEAPON2, ItemQuantity(self, "shells") >= 1, request, w_shotgunsetup, w_shotgun, w_shotgunraise1, w_directaim, w_shotgunrating, "Shotgun");};
 
 void() w_shotgunraise1 = {self.wload = 1;wraise(8, w_shotgunraise2, 0.1);};
 void() w_shotgunraise2 = {wraise(7, w_shotgun, 0.1);};
Index: dpmod/qc/w_supernailgun.qc
diff -u dpmod/qc/w_supernailgun.qc:1.7 dpmod/qc/w_supernailgun.qc:1.8
--- dpmod/qc/w_supernailgun.qc:1.7	Sun Jun  8 04:02:48 2003
+++ dpmod/qc/w_supernailgun.qc	Wed Jun 11 05:07:37 2003
@@ -18,10 +18,10 @@
 	W_Hostile();
 	sound(self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
 	v = shotorg;
-	while (shots > 0 && self.ammo_nails >= 1)
+	while (shots > 0 && ItemQuantity(self, "nails") >= 1)
 	{
 		shots = shots - 1;
-		self.currentammo = self.ammo_nails = self.ammo_nails - 1;
+		self.currentammo = ItemAdjustQuantity(self, "nails", -1);
 		self.wframe = self.wframe + 0.5; // 10fps animation
 		if (self.wframe >= 9)
 			self.wframe = 1;
@@ -79,9 +79,9 @@
 	sound(self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
 	self.wfiretime = time;
 	a = 3;
-	if (a > self.ammo_rockets)
-		a = self.ammo_rockets;
-	self.currentammo = self.ammo_rockets = self.ammo_rockets - a;
+	if (a > ItemQuantity(self, "rockets"))
+		a = ItemQuantity(self, "rockets");
+	self.currentammo = ItemAdjustQuantity(self, "rockets", 0 - a);
 	w_muzzleflash(shotorg, 3);
 	LaunchMine(shotorg, shotdir * 1000 + v_up * 200, self, a * 100 * damagescale, a * 100 + 50, 20 * damagescale, 10 * damagescale, MINE_PROXIMITY, 60, "PROXIMITYMINE", Obituary_ProximityMine);
 };
@@ -97,7 +97,7 @@
 
 	if (self.button0)
 	{
-		if (self.ammo_nails >= 1)
+		if (ItemQuantity(self, "nails") >= 1)
 		{
 			self.wload = W_ShotsToFire(0.05);
 			if (self.wload > 0)
@@ -107,7 +107,7 @@
 	else
 	{
 		if (self.button3)
-		if (self.ammo_rockets >= 1)
+		if (ItemQuantity(self, "rockets") >= 1)
 		if (W_ShotsToFire(0.5))
 			W_SuperNailgunMineFireCode();
 	}
@@ -135,5 +135,5 @@
 void() w_snailgundrop2 = {wdropped(10, 0.1);};
 
 float() w_snailgunrating = {return genericweaponrating(0, 1000, 300);};
-void() w_snailgunsetup = {wset(IT_WEAPON5, IT_NAILS, self.ammo_nails, VWEP_SUPER_NAILGUN, "progs/v_dpnail2.mdl");};
-float(float request) setweapon5 = {return weapongeneric(IT_WEAPON5, self.ammo_nails >= 1 || self.ammo_rockets >= 1, request, w_snailgunsetup, w_snailgun, w_snailgunraise1, w_directaim, w_snailgunrating, "Super Nailgun");};
+void() w_snailgunsetup = {wset(IT_WEAPON5, IT_NAILS, ItemQuantity(self, "nails"), VWEP_SUPER_NAILGUN, "progs/v_dpnail2.mdl");};
+float(float request) setweapon5 = {return weapongeneric(IT_WEAPON5, ItemQuantity(self, "nails") >= 1 || ItemQuantity(self, "rockets") >= 1, request, w_snailgunsetup, w_snailgun, w_snailgunraise1, w_directaim, w_snailgunrating, "Super Nailgun");};


More information about the twilight-commits mailing list